vendor: 2,672 bytes, lines 1-47
1(() => { 2 var __create = Object.create; 3 var __defProp = Object.defineProperty; 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 5 var __getOwnPropNames = Object.getOwnPropertyNames; 6 var __getProtoOf = Object.getPrototypeOf; 7 var __hasOwnProp = Object.prototype.hasOwnProperty; 8 var __typeError = (msg) => { 9 throw TypeError(msg); 10 }; 11 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 12 var __esm = (fn, res) => function __init() { 13 return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; 14 }; 15 var __commonJS = (cb, mod) => function __require() { 16 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 17 }; 18 var __copyProps = (to, from, except, desc) => { 19 if (from && typeof from === "object" || typeof from === "function") { 20 for (let key of __getOwnPropNames(from)) 21 if (!__hasOwnProp.call(to, key) && key !== except) 22 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 23 } 24 return to; 25 }; 26 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 27 // If the importer is in node compatibility mode or this is not an ESM 28 // file that has been converted to a CommonJS file using a Babel- 29 // compatible transform (i.e. "__esModule" has not been set), then set 30 // "default" to the CommonJS "module.exports" for node compatibility. 31 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 32 mod 33 )); 34 var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 35 var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); 36 var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); 37 var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); 38 var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); 39 var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); 40 41 // <define:process> 42 var init_define_process = __esm({ 43 "<define:process>"() { 44 } 45 }); 46 47
vendor: 265,590 bytes, lines 47-6490
47// node_modules/jquery/dist/jquery.js 48 var require_jquery = __commonJS({ 49 "node_modules/jquery/dist/jquery.js"(exports, module) { 50 init_define_process(); 51 init_jquery(); 52 (function(global2, factory) { 53 "use strict"; 54 if (typeof module === "object" && typeof module.exports === "object") { 55 module.exports = global2.document ? factory(global2, true) : function(w) { 56 if (!w.document) { 57 throw new Error("jQuery requires a window with a document"); 58 } 59 return factory(w); 60 }; 61 } else { 62 factory(global2); 63 } 64 })(typeof window !== "undefined" ? window : exports, function(window2, noGlobal) { 65 "use strict"; 66 var arr = []; 67 var getProto = Object.getPrototypeOf; 68 var slice = arr.slice; 69 var flat = arr.flat ? function(array) { 70 return arr.flat.call(array); 71 } : function(array) { 72 return arr.concat.apply([], array); 73 }; 74 var push = arr.push; 75 var indexOf = arr.indexOf; 76 var class2type = {}; 77 var toString = class2type.toString; 78 var hasOwn = class2type.hasOwnProperty; 79 var fnToString = hasOwn.toString; 80 var ObjectFunctionString = fnToString.call(Object); 81 var support = {}; 82 var isFunction = function isFunction2(obj) { 83 return typeof obj === "function" && typeof obj.nodeType !== "number"; 84 }; 85 var isWindow = function isWindow2(obj) { 86 return obj != null && obj === obj.window; 87 }; 88 var document2 = window2.document; 89 var preservedScriptAttributes = { 90 type: true, 91 src: true, 92 nonce: true, 93 noModule: true 94 }; 95 function DOMEval(code, node, doc) { 96 doc = doc || document2; 97 var i, val, script = doc.createElement("script"); 98 script.text = code; 99 if (node) { 100 for (i in preservedScriptAttributes) { 101 val = node[i] || node.getAttribute && node.getAttribute(i); 102 if (val) { 103 script.setAttribute(i, val); 104 } 105 } 106 } 107 doc.head.appendChild(script).parentNode.removeChild(script); 108 } 109 function toType(obj) { 110 if (obj == null) { 111 return obj + ""; 112 } 113 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj; 114 } 115 var version = "3.5.1", jQuery = function(selector, context) { 116 return new jQuery.fn.init(selector, context); 117 }; 118 jQuery.fn = jQuery.prototype = { 119 // The current version of jQuery being used 120 jquery: version, 121 constructor: jQuery, 122 // The default length of a jQuery object is 0 123 length: 0, 124 toArray: function() { 125 return slice.call(this); 126 }, 127 // Get the Nth element in the matched element set OR 128 // Get the whole matched element set as a clean array 129 get: function(num) { 130 if (num == null) { 131 return slice.call(this); 132 } 133 return num < 0 ? this[num + this.length] : this[num]; 134 }, 135 // Take an array of elements and push it onto the stack 136 // (returning the new matched element set) 137 pushStack: function(elems) { 138 var ret = jQuery.merge(this.constructor(), elems); 139 ret.prevObject = this; 140 return ret; 141 }, 142 // Execute a callback for every element in the matched set. 143 each: function(callback) { 144 return jQuery.each(this, callback); 145 }, 146 map: function(callback) { 147 return this.pushStack(jQuery.map(this, function(elem, i) { 148 return callback.call(elem, i, elem); 149 })); 150 }, 151 slice: function() { 152 return this.pushStack(slice.apply(this, arguments)); 153 }, 154 first: function() { 155 return this.eq(0); 156 }, 157 last: function() { 158 return this.eq(-1); 159 }, 160 even: function() { 161 return this.pushStack(jQuery.grep(this, function(_elem, i) { 162 return (i + 1) % 2; 163 })); 164 }, 165 odd: function() { 166 return this.pushStack(jQuery.grep(this, function(_elem, i) { 167 return i % 2; 168 })); 169 }, 170 eq: function(i) { 171 var len = this.length, j = +i + (i < 0 ? len : 0); 172 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 173 }, 174 end: function() { 175 return this.prevObject || this.constructor(); 176 }, 177 // For internal use only. 178 // Behaves like an Array's method, not like a jQuery method. 179 push, 180 sort: arr.sort, 181 splice: arr.splice 182 }; 183 jQuery.extend = jQuery.fn.extend = function() { 184 var options, name, src, copy2, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; 185 if (typeof target === "boolean") { 186 deep = target; 187 target = arguments[i] || {}; 188 i++; 189 } 190 if (typeof target !== "object" && !isFunction(target)) { 191 target = {}; 192 } 193 if (i === length) { 194 target = this; 195 i--; 196 } 197 for (; i < length; i++) { 198 if ((options = arguments[i]) != null) { 199 for (name in options) { 200 copy2 = options[name]; 201 if (name === "__proto__" || target === copy2) { 202 continue; 203 } 204 if (deep && copy2 && (jQuery.isPlainObject(copy2) || (copyIsArray = Array.isArray(copy2)))) { 205 src = target[name]; 206 if (copyIsArray && !Array.isArray(src)) { 207 clone = []; 208 } else if (!copyIsArray && !jQuery.isPlainObject(src)) { 209 clone = {}; 210 } else { 211 clone = src; 212 } 213 copyIsArray = false; 214 target[name] = jQuery.extend(deep, clone, copy2); 215 } else if (copy2 !== void 0) { 216 target[name] = copy2; 217 } 218 } 219 } 220 } 221 return target; 222 }; 223 jQuery.extend({ 224 // Unique for each copy of jQuery on the page 225 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 226 // Assume jQuery is ready without the ready module 227 isReady: true, 228 error: function(msg) { 229 throw new Error(msg); 230 }, 231 noop: function() { 232 }, 233 isPlainObject: function(obj) { 234 var proto, Ctor; 235 if (!obj || toString.call(obj) !== "[object Object]") { 236 return false; 237 } 238 proto = getProto(obj); 239 if (!proto) { 240 return true; 241 } 242 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 243 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 244 }, 245 isEmptyObject: function(obj) { 246 var name; 247 for (name in obj) { 248 return false; 249 } 250 return true; 251 }, 252 // Evaluates a script in a provided context; falls back to the global one 253 // if not specified. 254 globalEval: function(code, options, doc) { 255 DOMEval(code, { nonce: options && options.nonce }, doc); 256 }, 257 each: function(obj, callback) { 258 var length, i = 0; 259 if (isArrayLike(obj)) { 260 length = obj.length; 261 for (; i < length; i++) { 262 if (callback.call(obj[i], i, obj[i]) === false) { 263 break; 264 } 265 } 266 } else { 267 for (i in obj) { 268 if (callback.call(obj[i], i, obj[i]) === false) { 269 break; 270 } 271 } 272 } 273 return obj; 274 }, 275 // results is for internal usage only 276 makeArray: function(arr2, results) { 277 var ret = results || []; 278 if (arr2 != null) { 279 if (isArrayLike(Object(arr2))) { 280 jQuery.merge( 281 ret, 282 typeof arr2 === "string" ? [arr2] : arr2 283 ); 284 } else { 285 push.call(ret, arr2); 286 } 287 } 288 return ret; 289 }, 290 inArray: function(elem, arr2, i) { 291 return arr2 == null ? -1 : indexOf.call(arr2, elem, i); 292 }, 293 // Support: Android <=4.0 only, PhantomJS 1 only 294 // push.apply(_, arraylike) throws on ancient WebKit 295 merge: function(first, second) { 296 var len = +second.length, j = 0, i = first.length; 297 for (; j < len; j++) { 298 first[i++] = second[j]; 299 } 300 first.length = i; 301 return first; 302 }, 303 grep: function(elems, callback, invert) { 304 var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; 305 for (; i < length; i++) { 306 callbackInverse = !callback(elems[i], i); 307 if (callbackInverse !== callbackExpect) { 308 matches.push(elems[i]); 309 } 310 } 311 return matches; 312 }, 313 // arg is for internal usage only 314 map: function(elems, callback, arg) { 315 var length, value, i = 0, ret = []; 316 if (isArrayLike(elems)) { 317 length = elems.length; 318 for (; i < length; i++) { 319 value = callback(elems[i], i, arg); 320 if (value != null) { 321 ret.push(value); 322 } 323 } 324 } else { 325 for (i in elems) { 326 value = callback(elems[i], i, arg); 327 if (value != null) { 328 ret.push(value); 329 } 330 } 331 } 332 return flat(ret); 333 }, 334 // A global GUID counter for objects 335 guid: 1, 336 // jQuery.support is not used in Core but other projects attach their 337 // properties to it so it needs to exist. 338 support 339 }); 340 if (typeof Symbol === "function") { 341 jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; 342 } 343 jQuery.each( 344 "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 345 function(_i, name) { 346 class2type["[object " + name + "]"] = name.toLowerCase(); 347 } 348 ); 349 function isArrayLike(obj) { 350 var length = !!obj && "length" in obj && obj.length, type = toType(obj); 351 if (isFunction(obj) || isWindow(obj)) { 352 return false; 353 } 354 return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; 355 } 356 var Sizzle = ( 357 /*! 358 * Sizzle CSS Selector Engine v2.3.5 359 * https://sizzlejs.com/ 360 * 361 * Copyright JS Foundation and other contributors 362 * Released under the MIT license 363 * https://js.foundation/ 364 * 365 * Date: 2020-03-14 366 */ 367 function(window3) { 368 var i, support2, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document3, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + 1 * /* @__PURE__ */ new Date(), preferredDoc = window3.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) { 369 if (a === b) { 370 hasDuplicate = true; 371 } 372 return 0; 373 }, hasOwn2 = {}.hasOwnProperty, arr2 = [], pop = arr2.pop, pushNative = arr2.push, push2 = arr2.push, slice2 = arr2.slice, indexOf2 = function(list, elem) { 374 var i2 = 0, len = list.length; 375 for (; i2 < len; i2++) { 376 if (list[i2] === elem) { 377 return i2; 378 } 379 } 380 return -1; 381 }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", whitespace = "[\\x20\\t\\r\\n\\f]", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) 382 "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] 383 // or strings [capture 3 or capture 4]" 384 `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rtrim2 = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { 385 "ID": new RegExp("^#(" + identifier + ")"), 386 "CLASS": new RegExp("^\\.(" + identifier + ")"), 387 "TAG": new RegExp("^(" + identifier + "|[*])"), 388 "ATTR": new RegExp("^" + attributes), 389 "PSEUDO": new RegExp("^" + pseudos), 390 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 391 "bool": new RegExp("^(?:" + booleans + ")$", "i"), 392 // For use in libraries implementing .is() 393 // We use this for POS matching in `select` 394 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 395 }, rhtml2 = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) { 396 var high = "0x" + escape2.slice(1) - 65536; 397 return nonHex ? ( 398 // Strip the backslash prefix from a non-hex escape sequence 399 nonHex 400 ) : ( 401 // Replace a hexadecimal escape sequence with the encoded Unicode code point 402 // Support: IE <=11+ 403 // For values outside the Basic Multilingual Plane (BMP), manually construct a 404 // surrogate pair 405 high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320) 406 ); 407 }, rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, fcssescape = function(ch, asCodePoint) { 408 if (asCodePoint) { 409 if (ch === "\0") { 410 return "\uFFFD"; 411 } 412 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 413 } 414 return "\\" + ch; 415 }, unloadHandler = function() { 416 setDocument(); 417 }, inDisabledFieldset = addCombinator( 418 function(elem) { 419 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 420 }, 421 { dir: "parentNode", next: "legend" } 422 ); 423 try { 424 push2.apply( 425 arr2 = slice2.call(preferredDoc.childNodes), 426 preferredDoc.childNodes 427 ); 428 arr2[preferredDoc.childNodes.length].nodeType; 429 } catch (e) { 430 push2 = { 431 apply: arr2.length ? ( 432 // Leverage slice if possible 433 function(target, els) { 434 pushNative.apply(target, slice2.call(els)); 435 } 436 ) : ( 437 // Support: IE<9 438 // Otherwise append directly 439 function(target, els) { 440 var j = target.length, i2 = 0; 441 while (target[j++] = els[i2++]) { 442 } 443 target.length = j - 1; 444 } 445 ) 446 }; 447 } 448 function Sizzle2(selector, context, results, seed) { 449 var m, i2, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9; 450 results = results || []; 451 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 452 return results; 453 } 454 if (!seed) { 455 setDocument(context); 456 context = context || document3; 457 if (documentIsHTML) { 458 if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) { 459 if (m = match[1]) { 460 if (nodeType === 9) { 461 if (elem = context.getElementById(m)) { 462 if (elem.id === m) { 463 results.push(elem); 464 return results; 465 } 466 } else { 467 return results; 468 } 469 } else { 470 if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) { 471 results.push(elem); 472 return results; 473 } 474 } 475 } else if (match[2]) { 476 push2.apply(results, context.getElementsByTagName(selector)); 477 return results; 478 } else if ((m = match[3]) && support2.getElementsByClassName && context.getElementsByClassName) { 479 push2.apply(results, context.getElementsByClassName(m)); 480 return results; 481 } 482 } 483 if (support2.qsa && !nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector)) && // Support: IE 8 only 484 // Exclude object elements 485 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object")) { 486 newSelector = selector; 487 newContext = context; 488 if (nodeType === 1 && (rdescend.test(selector) || rcombinators.test(selector))) { 489 newContext = rsibling.test(selector) && testContext(context.parentNode) || context; 490 if (newContext !== context || !support2.scope) { 491 if (nid = context.getAttribute("id")) { 492 nid = nid.replace(rcssescape, fcssescape); 493 } else { 494 context.setAttribute("id", nid = expando); 495 } 496 } 497 groups = tokenize(selector); 498 i2 = groups.length; 499 while (i2--) { 500 groups[i2] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i2]); 501 } 502 newSelector = groups.join(","); 503 } 504 try { 505 push2.apply( 506 results, 507 newContext.querySelectorAll(newSelector) 508 ); 509 return results; 510 } catch (qsaError) { 511 nonnativeSelectorCache(selector, true); 512 } finally { 513 if (nid === expando) { 514 context.removeAttribute("id"); 515 } 516 } 517 } 518 } 519 } 520 return select(selector.replace(rtrim2, "$1"), context, results, seed); 521 } 522 function createCache() { 523 var keys = []; 524 function cache(key, value) { 525 if (keys.push(key + " ") > Expr.cacheLength) { 526 delete cache[keys.shift()]; 527 } 528 return cache[key + " "] = value; 529 } 530 return cache; 531 } 532 function markFunction(fn) { 533 fn[expando] = true; 534 return fn; 535 } 536 function assert(fn) { 537 var el = document3.createElement("fieldset"); 538 try { 539 return !!fn(el); 540 } catch (e) { 541 return false; 542 } finally { 543 if (el.parentNode) { 544 el.parentNode.removeChild(el); 545 } 546 el = null; 547 } 548 } 549 function addHandle(attrs, handler) { 550 var arr3 = attrs.split("|"), i2 = arr3.length; 551 while (i2--) { 552 Expr.attrHandle[arr3[i2]] = handler; 553 } 554 } 555 function siblingCheck(a, b) { 556 var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex; 557 if (diff) { 558 return diff; 559 } 560 if (cur) { 561 while (cur = cur.nextSibling) { 562 if (cur === b) { 563 return -1; 564 } 565 } 566 } 567 return a ? 1 : -1; 568 } 569 function createInputPseudo(type) { 570 return function(elem) { 571 var name = elem.nodeName.toLowerCase(); 572 return name === "input" && elem.type === type; 573 }; 574 } 575 function createButtonPseudo(type) { 576 return function(elem) { 577 var name = elem.nodeName.toLowerCase(); 578 return (name === "input" || name === "button") && elem.type === type; 579 }; 580 } 581 function createDisabledPseudo(disabled) { 582 return function(elem) { 583 if ("form" in elem) { 584 if (elem.parentNode && elem.disabled === false) { 585 if ("label" in elem) { 586 if ("label" in elem.parentNode) { 587 return elem.parentNode.disabled === disabled; 588 } else { 589 return elem.disabled === disabled; 590 } 591 } 592 return elem.isDisabled === disabled || // Where there is no isDisabled, check manually 593 /* jshint -W018 */ 594 elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled; 595 } 596 return elem.disabled === disabled; 597 } else if ("label" in elem) { 598 return elem.disabled === disabled; 599 } 600 return false; 601 }; 602 } 603 function createPositionalPseudo(fn) { 604 return markFunction(function(argument) { 605 argument = +argument; 606 return markFunction(function(seed, matches2) { 607 var j, matchIndexes = fn([], seed.length, argument), i2 = matchIndexes.length; 608 while (i2--) { 609 if (seed[j = matchIndexes[i2]]) { 610 seed[j] = !(matches2[j] = seed[j]); 611 } 612 } 613 }); 614 }); 615 } 616 function testContext(context) { 617 return context && typeof context.getElementsByTagName !== "undefined" && context; 618 } 619 support2 = Sizzle2.support = {}; 620 isXML = Sizzle2.isXML = function(elem) { 621 var namespace = elem.namespaceURI, docElem2 = (elem.ownerDocument || elem).documentElement; 622 return !rhtml2.test(namespace || docElem2 && docElem2.nodeName || "HTML"); 623 }; 624 setDocument = Sizzle2.setDocument = function(node) { 625 var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc; 626 if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) { 627 return document3; 628 } 629 document3 = doc; 630 docElem = document3.documentElement; 631 documentIsHTML = !isXML(document3); 632 if (preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) { 633 if (subWindow.addEventListener) { 634 subWindow.addEventListener("unload", unloadHandler, false); 635 } else if (subWindow.attachEvent) { 636 subWindow.attachEvent("onunload", unloadHandler); 637 } 638 } 639 support2.scope = assert(function(el) { 640 docElem.appendChild(el).appendChild(document3.createElement("div")); 641 return typeof el.querySelectorAll !== "undefined" && !el.querySelectorAll(":scope fieldset div").length; 642 }); 643 support2.attributes = assert(function(el) { 644 el.className = "i"; 645 return !el.getAttribute("className"); 646 }); 647 support2.getElementsByTagName = assert(function(el) { 648 el.appendChild(document3.createComment("")); 649 return !el.getElementsByTagName("*").length; 650 }); 651 support2.getElementsByClassName = rnative.test(document3.getElementsByClassName); 652 support2.getById = assert(function(el) { 653 docElem.appendChild(el).id = expando; 654 return !document3.getElementsByName || !document3.getElementsByName(expando).length; 655 }); 656 if (support2.getById) { 657 Expr.filter["ID"] = function(id) { 658 var attrId = id.replace(runescape, funescape); 659 return function(elem) { 660 return elem.getAttribute("id") === attrId; 661 }; 662 }; 663 Expr.find["ID"] = function(id, context) { 664 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 665 var elem = context.getElementById(id); 666 return elem ? [elem] : []; 667 } 668 }; 669 } else { 670 Expr.filter["ID"] = function(id) { 671 var attrId = id.replace(runescape, funescape); 672 return function(elem) { 673 var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 674 return node2 && node2.value === attrId; 675 }; 676 }; 677 Expr.find["ID"] = function(id, context) { 678 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 679 var node2, i2, elems, elem = context.getElementById(id); 680 if (elem) { 681 node2 = elem.getAttributeNode("id"); 682 if (node2 && node2.value === id) { 683 return [elem]; 684 } 685 elems = context.getElementsByName(id); 686 i2 = 0; 687 while (elem = elems[i2++]) { 688 node2 = elem.getAttributeNode("id"); 689 if (node2 && node2.value === id) { 690 return [elem]; 691 } 692 } 693 } 694 return []; 695 } 696 }; 697 } 698 Expr.find["TAG"] = support2.getElementsByTagName ? function(tag, context) { 699 if (typeof context.getElementsByTagName !== "undefined") { 700 return context.getElementsByTagName(tag); 701 } else if (support2.qsa) { 702 return context.querySelectorAll(tag); 703 } 704 } : function(tag, context) { 705 var elem, tmp = [], i2 = 0, results = context.getElementsByTagName(tag); 706 if (tag === "*") { 707 while (elem = results[i2++]) { 708 if (elem.nodeType === 1) { 709 tmp.push(elem); 710 } 711 } 712 return tmp; 713 } 714 return results; 715 }; 716 Expr.find["CLASS"] = support2.getElementsByClassName && function(className, context) { 717 if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { 718 return context.getElementsByClassName(className); 719 } 720 }; 721 rbuggyMatches = []; 722 rbuggyQSA = []; 723 if (support2.qsa = rnative.test(document3.querySelectorAll)) { 724 assert(function(el) { 725 var input; 726 docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a><select id='" + expando + "-\r\\' msallowcapture=''><option selected=''></option></select>"; 727 if (el.querySelectorAll("[msallowcapture^='']").length) { 728 rbuggyQSA.push("[*^$]=" + whitespace + `*(?:''|"")`); 729 } 730 if (!el.querySelectorAll("[selected]").length) { 731 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 732 } 733 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 734 rbuggyQSA.push("~="); 735 } 736 input = document3.createElement("input"); 737 input.setAttribute("name", ""); 738 el.appendChild(input); 739 if (!el.querySelectorAll("[name='']").length) { 740 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`); 741 } 742 if (!el.querySelectorAll(":checked").length) { 743 rbuggyQSA.push(":checked"); 744 } 745 if (!el.querySelectorAll("a#" + expando + "+*").length) { 746 rbuggyQSA.push(".#.+[+~]"); 747 } 748 el.querySelectorAll("\\\f"); 749 rbuggyQSA.push("[\\r\\n\\f]"); 750 }); 751 assert(function(el) { 752 el.innerHTML = "<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>"; 753 var input = document3.createElement("input"); 754 input.setAttribute("type", "hidden"); 755 el.appendChild(input).setAttribute("name", "D"); 756 if (el.querySelectorAll("[name=d]").length) { 757 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); 758 } 759 if (el.querySelectorAll(":enabled").length !== 2) { 760 rbuggyQSA.push(":enabled", ":disabled"); 761 } 762 docElem.appendChild(el).disabled = true; 763 if (el.querySelectorAll(":disabled").length !== 2) { 764 rbuggyQSA.push(":enabled", ":disabled"); 765 } 766 el.querySelectorAll("*,:x"); 767 rbuggyQSA.push(",.*:"); 768 }); 769 } 770 if (support2.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) { 771 assert(function(el) { 772 support2.disconnectedMatch = matches.call(el, "*"); 773 matches.call(el, "[s!='']:x"); 774 rbuggyMatches.push("!=", pseudos); 775 }); 776 } 777 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 778 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); 779 hasCompare = rnative.test(docElem.compareDocumentPosition); 780 contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) { 781 var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; 782 return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); 783 } : function(a, b) { 784 if (b) { 785 while (b = b.parentNode) { 786 if (b === a) { 787 return true; 788 } 789 } 790 } 791 return false; 792 }; 793 sortOrder = hasCompare ? function(a, b) { 794 if (a === b) { 795 hasDuplicate = true; 796 return 0; 797 } 798 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 799 if (compare) { 800 return compare; 801 } 802 compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : ( 803 // Otherwise we know they are disconnected 804 1 805 ); 806 if (compare & 1 || !support2.sortDetached && b.compareDocumentPosition(a) === compare) { 807 if (a == document3 || a.ownerDocument == preferredDoc && contains(preferredDoc, a)) { 808 return -1; 809 } 810 if (b == document3 || b.ownerDocument == preferredDoc && contains(preferredDoc, b)) { 811 return 1; 812 } 813 return sortInput ? indexOf2(sortInput, a) - indexOf2(sortInput, b) : 0; 814 } 815 return compare & 4 ? -1 : 1; 816 } : function(a, b) { 817 if (a === b) { 818 hasDuplicate = true; 819 return 0; 820 } 821 var cur, i2 = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b]; 822 if (!aup || !bup) { 823 return a == document3 ? -1 : b == document3 ? 1 : ( 824 /* eslint-enable eqeqeq */ 825 aup ? -1 : bup ? 1 : sortInput ? indexOf2(sortInput, a) - indexOf2(sortInput, b) : 0 826 ); 827 } else if (aup === bup) { 828 return siblingCheck(a, b); 829 } 830 cur = a; 831 while (cur = cur.parentNode) { 832 ap.unshift(cur); 833 } 834 cur = b; 835 while (cur = cur.parentNode) { 836 bp.unshift(cur); 837 } 838 while (ap[i2] === bp[i2]) { 839 i2++; 840 } 841 return i2 ? ( 842 // Do a sibling check if the nodes have a common ancestor 843 siblingCheck(ap[i2], bp[i2]) 844 ) : ( 845 // Otherwise nodes in our document sort first 846 // Support: IE 11+, Edge 17 - 18+ 847 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 848 // two documents; shallow comparisons work. 849 /* eslint-disable eqeqeq */ 850 ap[i2] == preferredDoc ? -1 : bp[i2] == preferredDoc ? 1 : ( 851 /* eslint-enable eqeqeq */ 852 0 853 ) 854 ); 855 }; 856 return document3; 857 }; 858 Sizzle2.matches = function(expr, elements) { 859 return Sizzle2(expr, null, null, elements); 860 }; 861 Sizzle2.matchesSelector = function(elem, expr) { 862 setDocument(elem); 863 if (support2.matchesSelector && documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { 864 try { 865 var ret = matches.call(elem, expr); 866 if (ret || support2.disconnectedMatch || // As well, disconnected nodes are said to be in a document 867 // fragment in IE 9 868 elem.document && elem.document.nodeType !== 11) { 869 return ret; 870 } 871 } catch (e) { 872 nonnativeSelectorCache(expr, true); 873 } 874 } 875 return Sizzle2(expr, document3, null, [elem]).length > 0; 876 }; 877 Sizzle2.contains = function(context, elem) { 878 if ((context.ownerDocument || context) != document3) { 879 setDocument(context); 880 } 881 return contains(context, elem); 882 }; 883 Sizzle2.attr = function(elem, name) { 884 if ((elem.ownerDocument || elem) != document3) { 885 setDocument(elem); 886 } 887 var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn2.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : void 0; 888 return val !== void 0 ? val : support2.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; 889 }; 890 Sizzle2.escape = function(sel) { 891 return (sel + "").replace(rcssescape, fcssescape); 892 }; 893 Sizzle2.error = function(msg) { 894 throw new Error("Syntax error, unrecognized expression: " + msg); 895 }; 896 Sizzle2.uniqueSort = function(results) { 897 var elem, duplicates = [], j = 0, i2 = 0; 898 hasDuplicate = !support2.detectDuplicates; 899 sortInput = !support2.sortStable && results.slice(0); 900 results.sort(sortOrder); 901 if (hasDuplicate) { 902 while (elem = results[i2++]) { 903 if (elem === results[i2]) { 904 j = duplicates.push(i2); 905 } 906 } 907 while (j--) { 908 results.splice(duplicates[j], 1); 909 } 910 } 911 sortInput = null; 912 return results; 913 }; 914 getText = Sizzle2.getText = function(elem) { 915 var node, ret = "", i2 = 0, nodeType = elem.nodeType; 916 if (!nodeType) { 917 while (node = elem[i2++]) { 918 ret += getText(node); 919 } 920 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { 921 if (typeof elem.textContent === "string") { 922 return elem.textContent; 923 } else { 924 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 925 ret += getText(elem); 926 } 927 } 928 } else if (nodeType === 3 || nodeType === 4) { 929 return elem.nodeValue; 930 } 931 return ret; 932 }; 933 Expr = Sizzle2.selectors = { 934 // Can be adjusted by the user 935 cacheLength: 50, 936 createPseudo: markFunction, 937 match: matchExpr, 938 attrHandle: {}, 939 find: {}, 940 relative: { 941 ">": { dir: "parentNode", first: true }, 942 " ": { dir: "parentNode" }, 943 "+": { dir: "previousSibling", first: true }, 944 "~": { dir: "previousSibling" } 945 }, 946 preFilter: { 947 "ATTR": function(match) { 948 match[1] = match[1].replace(runescape, funescape); 949 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); 950 if (match[2] === "~=") { 951 match[3] = " " + match[3] + " "; 952 } 953 return match.slice(0, 4); 954 }, 955 "CHILD": function(match) { 956 match[1] = match[1].toLowerCase(); 957 if (match[1].slice(0, 3) === "nth") { 958 if (!match[3]) { 959 Sizzle2.error(match[0]); 960 } 961 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); 962 match[5] = +(match[7] + match[8] || match[3] === "odd"); 963 } else if (match[3]) { 964 Sizzle2.error(match[0]); 965 } 966 return match; 967 }, 968 "PSEUDO": function(match) { 969 var excess, unquoted = !match[6] && match[2]; 970 if (matchExpr["CHILD"].test(match[0])) { 971 return null; 972 } 973 if (match[3]) { 974 match[2] = match[4] || match[5] || ""; 975 } else if (unquoted && rpseudo.test(unquoted) && // Get excess from tokenize (recursively) 976 (excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis 977 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 978 match[0] = match[0].slice(0, excess); 979 match[2] = unquoted.slice(0, excess); 980 } 981 return match.slice(0, 3); 982 } 983 }, 984 filter: { 985 "TAG": function(nodeNameSelector) { 986 var nodeName2 = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 987 return nodeNameSelector === "*" ? function() { 988 return true; 989 } : function(elem) { 990 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName2; 991 }; 992 }, 993 "CLASS": function(className) { 994 var pattern = classCache[className + " "]; 995 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache( 996 className, 997 function(elem) { 998 return pattern.test( 999 typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" 1000 ); 1001 } 1002 ); 1003 }, 1004 "ATTR": function(name, operator, check) { 1005 return function(elem) { 1006 var result = Sizzle2.attr(elem, name); 1007 if (result == null) { 1008 return operator === "!="; 1009 } 1010 if (!operator) { 1011 return true; 1012 } 1013 result += ""; 1014 return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false; 1015 }; 1016 }, 1017 "CHILD": function(type, what, _argument, first, last) { 1018 var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type"; 1019 return first === 1 && last === 0 ? ( 1020 // Shortcut for :nth-*(n) 1021 function(elem) { 1022 return !!elem.parentNode; 1023 } 1024 ) : function(elem, _context, xml) { 1025 var cache, uniqueCache, outerCache, node, nodeIndex, start, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; 1026 if (parent) { 1027 if (simple) { 1028 while (dir2) { 1029 node = elem; 1030 while (node = node[dir2]) { 1031 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { 1032 return false; 1033 } 1034 } 1035 start = dir2 = type === "only" && !start && "nextSibling"; 1036 } 1037 return true; 1038 } 1039 start = [forward ? parent.firstChild : parent.lastChild]; 1040 if (forward && useCache) { 1041 node = parent; 1042 outerCache = node[expando] || (node[expando] = {}); 1043 uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); 1044 cache = uniqueCache[type] || []; 1045 nodeIndex = cache[0] === dirruns && cache[1]; 1046 diff = nodeIndex && cache[2]; 1047 node = nodeIndex && parent.childNodes[nodeIndex]; 1048 while (node = ++nodeIndex && node && node[dir2] || // Fallback to seeking `elem` from the start 1049 (diff = nodeIndex = 0) || start.pop()) { 1050 if (node.nodeType === 1 && ++diff && node === elem) { 1051 uniqueCache[type] = [dirruns, nodeIndex, diff]; 1052 break; 1053 } 1054 } 1055 } else { 1056 if (useCache) { 1057 node = elem; 1058 outerCache = node[expando] || (node[expando] = {}); 1059 uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); 1060 cache = uniqueCache[type] || []; 1061 nodeIndex = cache[0] === dirruns && cache[1]; 1062 diff = nodeIndex; 1063 } 1064 if (diff === false) { 1065 while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start.pop()) { 1066 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { 1067 if (useCache) { 1068 outerCache = node[expando] || (node[expando] = {}); 1069 uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); 1070 uniqueCache[type] = [dirruns, diff]; 1071 } 1072 if (node === elem) { 1073 break; 1074 } 1075 } 1076 } 1077 } 1078 } 1079 diff -= last; 1080 return diff === first || diff % first === 0 && diff / first >= 0; 1081 } 1082 }; 1083 }, 1084 "PSEUDO": function(pseudo, argument) { 1085 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle2.error("unsupported pseudo: " + pseudo); 1086 if (fn[expando]) { 1087 return fn(argument); 1088 } 1089 if (fn.length > 1) { 1090 args = [pseudo, pseudo, "", argument]; 1091 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) { 1092 var idx, matched = fn(seed, argument), i2 = matched.length; 1093 while (i2--) { 1094 idx = indexOf2(seed, matched[i2]); 1095 seed[idx] = !(matches2[idx] = matched[i2]); 1096 } 1097 }) : function(elem) { 1098 return fn(elem, 0, args); 1099 }; 1100 } 1101 return fn; 1102 } 1103 }, 1104 pseudos: { 1105 // Potentially complex pseudos 1106 "not": markFunction(function(selector) { 1107 var input = [], results = [], matcher = compile(selector.replace(rtrim2, "$1")); 1108 return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) { 1109 var elem, unmatched = matcher(seed, null, xml, []), i2 = seed.length; 1110 while (i2--) { 1111 if (elem = unmatched[i2]) { 1112 seed[i2] = !(matches2[i2] = elem); 1113 } 1114 } 1115 }) : function(elem, _context, xml) { 1116 input[0] = elem; 1117 matcher(input, null, xml, results); 1118 input[0] = null; 1119 return !results.pop(); 1120 }; 1121 }), 1122 "has": markFunction(function(selector) { 1123 return function(elem) { 1124 return Sizzle2(selector, elem).length > 0; 1125 }; 1126 }), 1127 "contains": markFunction(function(text) { 1128 text = text.replace(runescape, funescape); 1129 return function(elem) { 1130 return (elem.textContent || getText(elem)).indexOf(text) > -1; 1131 }; 1132 }), 1133 // "Whether an element is represented by a :lang() selector 1134 // is based solely on the element's language value 1135 // being equal to the identifier C, 1136 // or beginning with the identifier C immediately followed by "-". 1137 // The matching of C against the element's language value is performed case-insensitively. 1138 // The identifier C does not have to be a valid language name." 1139 // http://www.w3.org/TR/selectors/#lang-pseudo 1140 "lang": markFunction(function(lang) { 1141 if (!ridentifier.test(lang || "")) { 1142 Sizzle2.error("unsupported lang: " + lang); 1143 } 1144 lang = lang.replace(runescape, funescape).toLowerCase(); 1145 return function(elem) { 1146 var elemLang; 1147 do { 1148 if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { 1149 elemLang = elemLang.toLowerCase(); 1150 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 1151 } 1152 } while ((elem = elem.parentNode) && elem.nodeType === 1); 1153 return false; 1154 }; 1155 }), 1156 // Miscellaneous 1157 "target": function(elem) { 1158 var hash = window3.location && window3.location.hash; 1159 return hash && hash.slice(1) === elem.id; 1160 }, 1161 "root": function(elem) { 1162 return elem === docElem; 1163 }, 1164 "focus": function(elem) { 1165 return elem === document3.activeElement && (!document3.hasFocus || document3.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 1166 }, 1167 // Boolean properties 1168 "enabled": createDisabledPseudo(false), 1169 "disabled": createDisabledPseudo(true), 1170 "checked": function(elem) { 1171 var nodeName2 = elem.nodeName.toLowerCase(); 1172 return nodeName2 === "input" && !!elem.checked || nodeName2 === "option" && !!elem.selected; 1173 }, 1174 "selected": function(elem) { 1175 if (elem.parentNode) { 1176 elem.parentNode.selectedIndex; 1177 } 1178 return elem.selected === true; 1179 }, 1180 // Contents 1181 "empty": function(elem) { 1182 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1183 if (elem.nodeType < 6) { 1184 return false; 1185 } 1186 } 1187 return true; 1188 }, 1189 "parent": function(elem) { 1190 return !Expr.pseudos["empty"](elem); 1191 }, 1192 // Element/input types 1193 "header": function(elem) { 1194 return rheader.test(elem.nodeName); 1195 }, 1196 "input": function(elem) { 1197 return rinputs.test(elem.nodeName); 1198 }, 1199 "button": function(elem) { 1200 var name = elem.nodeName.toLowerCase(); 1201 return name === "input" && elem.type === "button" || name === "button"; 1202 }, 1203 "text": function(elem) { 1204 var attr; 1205 return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 1206 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 1207 ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); 1208 }, 1209 // Position-in-collection 1210 "first": createPositionalPseudo(function() { 1211 return [0]; 1212 }), 1213 "last": createPositionalPseudo(function(_matchIndexes, length) { 1214 return [length - 1]; 1215 }), 1216 "eq": createPositionalPseudo(function(_matchIndexes, length, argument) { 1217 return [argument < 0 ? argument + length : argument]; 1218 }), 1219 "even": createPositionalPseudo(function(matchIndexes, length) { 1220 var i2 = 0; 1221 for (; i2 < length; i2 += 2) { 1222 matchIndexes.push(i2); 1223 } 1224 return matchIndexes; 1225 }), 1226 "odd": createPositionalPseudo(function(matchIndexes, length) { 1227 var i2 = 1; 1228 for (; i2 < length; i2 += 2) { 1229 matchIndexes.push(i2); 1230 } 1231 return matchIndexes; 1232 }), 1233 "lt": createPositionalPseudo(function(matchIndexes, length, argument) { 1234 var i2 = argument < 0 ? argument + length : argument > length ? length : argument; 1235 for (; --i2 >= 0; ) { 1236 matchIndexes.push(i2); 1237 } 1238 return matchIndexes; 1239 }), 1240 "gt": createPositionalPseudo(function(matchIndexes, length, argument) { 1241 var i2 = argument < 0 ? argument + length : argument; 1242 for (; ++i2 < length; ) { 1243 matchIndexes.push(i2); 1244 } 1245 return matchIndexes; 1246 }) 1247 } 1248 }; 1249 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 1250 for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { 1251 Expr.pseudos[i] = createInputPseudo(i); 1252 } 1253 for (i in { submit: true, reset: true }) { 1254 Expr.pseudos[i] = createButtonPseudo(i); 1255 } 1256 function setFilters() { 1257 } 1258 setFilters.prototype = Expr.filters = Expr.pseudos; 1259 Expr.setFilters = new setFilters(); 1260 tokenize = Sizzle2.tokenize = function(selector, parseOnly) { 1261 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "]; 1262 if (cached) { 1263 return parseOnly ? 0 : cached.slice(0); 1264 } 1265 soFar = selector; 1266 groups = []; 1267 preFilters = Expr.preFilter; 1268 while (soFar) { 1269 if (!matched || (match = rcomma.exec(soFar))) { 1270 if (match) { 1271 soFar = soFar.slice(match[0].length) || soFar; 1272 } 1273 groups.push(tokens = []); 1274 } 1275 matched = false; 1276 if (match = rcombinators.exec(soFar)) { 1277 matched = match.shift(); 1278 tokens.push({ 1279 value: matched, 1280 // Cast descendant combinators to space 1281 type: match[0].replace(rtrim2, " ") 1282 }); 1283 soFar = soFar.slice(matched.length); 1284 } 1285 for (type in Expr.filter) { 1286 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { 1287 matched = match.shift(); 1288 tokens.push({ 1289 value: matched, 1290 type, 1291 matches: match 1292 }); 1293 soFar = soFar.slice(matched.length); 1294 } 1295 } 1296 if (!matched) { 1297 break; 1298 } 1299 } 1300 return parseOnly ? soFar.length : soFar ? Sizzle2.error(selector) : ( 1301 // Cache the tokens 1302 tokenCache(selector, groups).slice(0) 1303 ); 1304 }; 1305 function toSelector(tokens) { 1306 var i2 = 0, len = tokens.length, selector = ""; 1307 for (; i2 < len; i2++) { 1308 selector += tokens[i2].value; 1309 } 1310 return selector; 1311 } 1312 function addCombinator(matcher, combinator, base) { 1313 var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base && key === "parentNode", doneName = done++; 1314 return combinator.first ? ( 1315 // Check against closest ancestor/preceding element 1316 function(elem, context, xml) { 1317 while (elem = elem[dir2]) { 1318 if (elem.nodeType === 1 || checkNonElements) { 1319 return matcher(elem, context, xml); 1320 } 1321 } 1322 return false; 1323 } 1324 ) : ( 1325 // Check against all ancestor/preceding elements 1326 function(elem, context, xml) { 1327 var oldCache, uniqueCache, outerCache, newCache = [dirruns, doneName]; 1328 if (xml) { 1329 while (elem = elem[dir2]) { 1330 if (elem.nodeType === 1 || checkNonElements) { 1331 if (matcher(elem, context, xml)) { 1332 return true; 1333 } 1334 } 1335 } 1336 } else { 1337 while (elem = elem[dir2]) { 1338 if (elem.nodeType === 1 || checkNonElements) { 1339 outerCache = elem[expando] || (elem[expando] = {}); 1340 uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {}); 1341 if (skip && skip === elem.nodeName.toLowerCase()) { 1342 elem = elem[dir2] || elem; 1343 } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) { 1344 return newCache[2] = oldCache[2]; 1345 } else { 1346 uniqueCache[key] = newCache; 1347 if (newCache[2] = matcher(elem, context, xml)) { 1348 return true; 1349 } 1350 } 1351 } 1352 } 1353 } 1354 return false; 1355 } 1356 ); 1357 } 1358 function elementMatcher(matchers) { 1359 return matchers.length > 1 ? function(elem, context, xml) { 1360 var i2 = matchers.length; 1361 while (i2--) { 1362 if (!matchers[i2](elem, context, xml)) { 1363 return false; 1364 } 1365 } 1366 return true; 1367 } : matchers[0]; 1368 } 1369 function multipleContexts(selector, contexts, results) { 1370 var i2 = 0, len = contexts.length; 1371 for (; i2 < len; i2++) { 1372 Sizzle2(selector, contexts[i2], results); 1373 } 1374 return results; 1375 } 1376 function condense(unmatched, map, filter, context, xml) { 1377 var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map != null; 1378 for (; i2 < len; i2++) { 1379 if (elem = unmatched[i2]) { 1380 if (!filter || filter(elem, context, xml)) { 1381 newUnmatched.push(elem); 1382 if (mapped) { 1383 map.push(i2); 1384 } 1385 } 1386 } 1387 } 1388 return newUnmatched; 1389 } 1390 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 1391 if (postFilter && !postFilter[expando]) { 1392 postFilter = setMatcher(postFilter); 1393 } 1394 if (postFinder && !postFinder[expando]) { 1395 postFinder = setMatcher(postFinder, postSelector); 1396 } 1397 return markFunction(function(seed, results, context, xml) { 1398 var temp, i2, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts( 1399 selector || "*", 1400 context.nodeType ? [context] : context, 1401 [] 1402 ), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? ( 1403 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 1404 postFinder || (seed ? preFilter : preexisting || postFilter) ? ( 1405 // ...intermediate processing is necessary 1406 [] 1407 ) : ( 1408 // ...otherwise use results directly 1409 results 1410 ) 1411 ) : matcherIn; 1412 if (matcher) { 1413 matcher(matcherIn, matcherOut, context, xml); 1414 } 1415 if (postFilter) { 1416 temp = condense(matcherOut, postMap); 1417 postFilter(temp, [], context, xml); 1418 i2 = temp.length; 1419 while (i2--) { 1420 if (elem = temp[i2]) { 1421 matcherOut[postMap[i2]] = !(matcherIn[postMap[i2]] = elem); 1422 } 1423 } 1424 } 1425 if (seed) { 1426 if (postFinder || preFilter) { 1427 if (postFinder) { 1428 temp = []; 1429 i2 = matcherOut.length; 1430 while (i2--) { 1431 if (elem = matcherOut[i2]) { 1432 temp.push(matcherIn[i2] = elem); 1433 } 1434 } 1435 postFinder(null, matcherOut = [], temp, xml); 1436 } 1437 i2 = matcherOut.length; 1438 while (i2--) { 1439 if ((elem = matcherOut[i2]) && (temp = postFinder ? indexOf2(seed, elem) : preMap[i2]) > -1) { 1440 seed[temp] = !(results[temp] = elem); 1441 } 1442 } 1443 } 1444 } else { 1445 matcherOut = condense( 1446 matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut 1447 ); 1448 if (postFinder) { 1449 postFinder(null, results, matcherOut, xml); 1450 } else { 1451 push2.apply(results, matcherOut); 1452 } 1453 } 1454 }); 1455 } 1456 function matcherFromTokens(tokens) { 1457 var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i2 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) { 1458 return elem === checkContext; 1459 }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) { 1460 return indexOf2(checkContext, elem) > -1; 1461 }, implicitRelative, true), matchers = [function(elem, context, xml) { 1462 var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); 1463 checkContext = null; 1464 return ret; 1465 }]; 1466 for (; i2 < len; i2++) { 1467 if (matcher = Expr.relative[tokens[i2].type]) { 1468 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 1469 } else { 1470 matcher = Expr.filter[tokens[i2].type].apply(null, tokens[i2].matches); 1471 if (matcher[expando]) { 1472 j = ++i2; 1473 for (; j < len; j++) { 1474 if (Expr.relative[tokens[j].type]) { 1475 break; 1476 } 1477 } 1478 return setMatcher( 1479 i2 > 1 && elementMatcher(matchers), 1480 i2 > 1 && toSelector( 1481 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 1482 tokens.slice(0, i2 - 1).concat({ value: tokens[i2 - 2].type === " " ? "*" : "" }) 1483 ).replace(rtrim2, "$1"), 1484 matcher, 1485 i2 < j && matcherFromTokens(tokens.slice(i2, j)), 1486 j < len && matcherFromTokens(tokens = tokens.slice(j)), 1487 j < len && toSelector(tokens) 1488 ); 1489 } 1490 matchers.push(matcher); 1491 } 1492 } 1493 return elementMatcher(matchers); 1494 } 1495 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 1496 var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) { 1497 var elem, j, matcher, matchedCount = 0, i2 = "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; 1498 if (outermost) { 1499 outermostContext = context == document3 || context || outermost; 1500 } 1501 for (; i2 !== len && (elem = elems[i2]) != null; i2++) { 1502 if (byElement && elem) { 1503 j = 0; 1504 if (!context && elem.ownerDocument != document3) { 1505 setDocument(elem); 1506 xml = !documentIsHTML; 1507 } 1508 while (matcher = elementMatchers[j++]) { 1509 if (matcher(elem, context || document3, xml)) { 1510 results.push(elem); 1511 break; 1512 } 1513 } 1514 if (outermost) { 1515 dirruns = dirrunsUnique; 1516 } 1517 } 1518 if (bySet) { 1519 if (elem = !matcher && elem) { 1520 matchedCount--; 1521 } 1522 if (seed) { 1523 unmatched.push(elem); 1524 } 1525 } 1526 } 1527 matchedCount += i2; 1528 if (bySet && i2 !== matchedCount) { 1529 j = 0; 1530 while (matcher = setMatchers[j++]) { 1531 matcher(unmatched, setMatched, context, xml); 1532 } 1533 if (seed) { 1534 if (matchedCount > 0) { 1535 while (i2--) { 1536 if (!(unmatched[i2] || setMatched[i2])) { 1537 setMatched[i2] = pop.call(results); 1538 } 1539 } 1540 } 1541 setMatched = condense(setMatched); 1542 } 1543 push2.apply(results, setMatched); 1544 if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { 1545 Sizzle2.uniqueSort(results); 1546 } 1547 } 1548 if (outermost) { 1549 dirruns = dirrunsUnique; 1550 outermostContext = contextBackup; 1551 } 1552 return unmatched; 1553 }; 1554 return bySet ? markFunction(superMatcher) : superMatcher; 1555 } 1556 compile = Sizzle2.compile = function(selector, match) { 1557 var i2, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "]; 1558 if (!cached) { 1559 if (!match) { 1560 match = tokenize(selector); 1561 } 1562 i2 = match.length; 1563 while (i2--) { 1564 cached = matcherFromTokens(match[i2]); 1565 if (cached[expando]) { 1566 setMatchers.push(cached); 1567 } else { 1568 elementMatchers.push(cached); 1569 } 1570 } 1571 cached = compilerCache( 1572 selector, 1573 matcherFromGroupMatchers(elementMatchers, setMatchers) 1574 ); 1575 cached.selector = selector; 1576 } 1577 return cached; 1578 }; 1579 select = Sizzle2.select = function(selector, context, results, seed) { 1580 var i2, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector); 1581 results = results || []; 1582 if (match.length === 1) { 1583 tokens = match[0] = match[0].slice(0); 1584 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 1585 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0]; 1586 if (!context) { 1587 return results; 1588 } else if (compiled) { 1589 context = context.parentNode; 1590 } 1591 selector = selector.slice(tokens.shift().value.length); 1592 } 1593 i2 = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; 1594 while (i2--) { 1595 token = tokens[i2]; 1596 if (Expr.relative[type = token.type]) { 1597 break; 1598 } 1599 if (find = Expr.find[type]) { 1600 if (seed = find( 1601 token.matches[0].replace(runescape, funescape), 1602 rsibling.test(tokens[0].type) && testContext(context.parentNode) || context 1603 )) { 1604 tokens.splice(i2, 1); 1605 selector = seed.length && toSelector(tokens); 1606 if (!selector) { 1607 push2.apply(results, seed); 1608 return results; 1609 } 1610 break; 1611 } 1612 } 1613 } 1614 } 1615 (compiled || compile(selector, match))( 1616 seed, 1617 context, 1618 !documentIsHTML, 1619 results, 1620 !context || rsibling.test(selector) && testContext(context.parentNode) || context 1621 ); 1622 return results; 1623 }; 1624 support2.sortStable = expando.split("").sort(sortOrder).join("") === expando; 1625 support2.detectDuplicates = !!hasDuplicate; 1626 setDocument(); 1627 support2.sortDetached = assert(function(el) { 1628 return el.compareDocumentPosition(document3.createElement("fieldset")) & 1; 1629 }); 1630 if (!assert(function(el) { 1631 el.innerHTML = "<a href='#'></a>"; 1632 return el.firstChild.getAttribute("href") === "#"; 1633 })) { 1634 addHandle("type|href|height|width", function(elem, name, isXML2) { 1635 if (!isXML2) { 1636 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2); 1637 } 1638 }); 1639 } 1640 if (!support2.attributes || !assert(function(el) { 1641 el.innerHTML = "<input/>"; 1642 el.firstChild.setAttribute("value", ""); 1643 return el.firstChild.getAttribute("value") === ""; 1644 })) { 1645 addHandle("value", function(elem, _name, isXML2) { 1646 if (!isXML2 && elem.nodeName.toLowerCase() === "input") { 1647 return elem.defaultValue; 1648 } 1649 }); 1650 } 1651 if (!assert(function(el) { 1652 return el.getAttribute("disabled") == null; 1653 })) { 1654 addHandle(booleans, function(elem, name, isXML2) { 1655 var val; 1656 if (!isXML2) { 1657 return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; 1658 } 1659 }); 1660 } 1661 return Sizzle2; 1662 }(window2) 1663 ); 1664 jQuery.find = Sizzle; 1665 jQuery.expr = Sizzle.selectors; 1666 jQuery.expr[":"] = jQuery.expr.pseudos; 1667 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 1668 jQuery.text = Sizzle.getText; 1669 jQuery.isXMLDoc = Sizzle.isXML; 1670 jQuery.contains = Sizzle.contains; 1671 jQuery.escapeSelector = Sizzle.escape; 1672 var dir = function(elem, dir2, until) { 1673 var matched = [], truncate = until !== void 0; 1674 while ((elem = elem[dir2]) && elem.nodeType !== 9) { 1675 if (elem.nodeType === 1) { 1676 if (truncate && jQuery(elem).is(until)) { 1677 break; 1678 } 1679 matched.push(elem); 1680 } 1681 } 1682 return matched; 1683 }; 1684 var siblings = function(n, elem) { 1685 var matched = []; 1686 for (; n; n = n.nextSibling) { 1687 if (n.nodeType === 1 && n !== elem) { 1688 matched.push(n); 1689 } 1690 } 1691 return matched; 1692 }; 1693 var rneedsContext = jQuery.expr.match.needsContext; 1694 function nodeName(elem, name) { 1695 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 1696 } 1697 ; 1698 var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; 1699 function winnow(elements, qualifier, not) { 1700 if (isFunction(qualifier)) { 1701 return jQuery.grep(elements, function(elem, i) { 1702 return !!qualifier.call(elem, i, elem) !== not; 1703 }); 1704 } 1705 if (qualifier.nodeType) { 1706 return jQuery.grep(elements, function(elem) { 1707 return elem === qualifier !== not; 1708 }); 1709 } 1710 if (typeof qualifier !== "string") { 1711 return jQuery.grep(elements, function(elem) { 1712 return indexOf.call(qualifier, elem) > -1 !== not; 1713 }); 1714 } 1715 return jQuery.filter(qualifier, elements, not); 1716 } 1717 jQuery.filter = function(expr, elems, not) { 1718 var elem = elems[0]; 1719 if (not) { 1720 expr = ":not(" + expr + ")"; 1721 } 1722 if (elems.length === 1 && elem.nodeType === 1) { 1723 return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; 1724 } 1725 return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) { 1726 return elem2.nodeType === 1; 1727 })); 1728 }; 1729 jQuery.fn.extend({ 1730 find: function(selector) { 1731 var i, ret, len = this.length, self2 = this; 1732 if (typeof selector !== "string") { 1733 return this.pushStack(jQuery(selector).filter(function() { 1734 for (i = 0; i < len; i++) { 1735 if (jQuery.contains(self2[i], this)) { 1736 return true; 1737 } 1738 } 1739 })); 1740 } 1741 ret = this.pushStack([]); 1742 for (i = 0; i < len; i++) { 1743 jQuery.find(selector, self2[i], ret); 1744 } 1745 return len > 1 ? jQuery.uniqueSort(ret) : ret; 1746 }, 1747 filter: function(selector) { 1748 return this.pushStack(winnow(this, selector || [], false)); 1749 }, 1750 not: function(selector) { 1751 return this.pushStack(winnow(this, selector || [], true)); 1752 }, 1753 is: function(selector) { 1754 return !!winnow( 1755 this, 1756 // If this is a positional/relative selector, check membership in the returned set 1757 // so $("p:first").is("p:last") won't return true for a doc with two "p". 1758 typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], 1759 false 1760 ).length; 1761 } 1762 }); 1763 var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root) { 1764 var match, elem; 1765 if (!selector) { 1766 return this; 1767 } 1768 root = root || rootjQuery; 1769 if (typeof selector === "string") { 1770 if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) { 1771 match = [null, selector, null]; 1772 } else { 1773 match = rquickExpr.exec(selector); 1774 } 1775 if (match && (match[1] || !context)) { 1776 if (match[1]) { 1777 context = context instanceof jQuery ? context[0] : context; 1778 jQuery.merge(this, jQuery.parseHTML( 1779 match[1], 1780 context && context.nodeType ? context.ownerDocument || context : document2, 1781 true 1782 )); 1783 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { 1784 for (match in context) { 1785 if (isFunction(this[match])) { 1786 this[match](context[match]); 1787 } else { 1788 this.attr(match, context[match]); 1789 } 1790 } 1791 } 1792 return this; 1793 } else { 1794 elem = document2.getElementById(match[2]); 1795 if (elem) { 1796 this[0] = elem; 1797 this.length = 1; 1798 } 1799 return this; 1800 } 1801 } else if (!context || context.jquery) { 1802 return (context || root).find(selector); 1803 } else { 1804 return this.constructor(context).find(selector); 1805 } 1806 } else if (selector.nodeType) { 1807 this[0] = selector; 1808 this.length = 1; 1809 return this; 1810 } else if (isFunction(selector)) { 1811 return root.ready !== void 0 ? root.ready(selector) : ( 1812 // Execute immediately if ready is not present 1813 selector(jQuery) 1814 ); 1815 } 1816 return jQuery.makeArray(selector, this); 1817 }; 1818 init.prototype = jQuery.fn; 1819 rootjQuery = jQuery(document2); 1820 var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = { 1821 children: true, 1822 contents: true, 1823 next: true, 1824 prev: true 1825 }; 1826 jQuery.fn.extend({ 1827 has: function(target) { 1828 var targets = jQuery(target, this), l = targets.length; 1829 return this.filter(function() { 1830 var i = 0; 1831 for (; i < l; i++) { 1832 if (jQuery.contains(this, targets[i])) { 1833 return true; 1834 } 1835 } 1836 }); 1837 }, 1838 closest: function(selectors, context) { 1839 var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors); 1840 if (!rneedsContext.test(selectors)) { 1841 for (; i < l; i++) { 1842 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { 1843 if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : ( 1844 // Don't pass non-elements to Sizzle 1845 cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors) 1846 ))) { 1847 matched.push(cur); 1848 break; 1849 } 1850 } 1851 } 1852 } 1853 return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched); 1854 }, 1855 // Determine the position of an element within the set 1856 index: function(elem) { 1857 if (!elem) { 1858 return this[0] && this[0].parentNode ? this.first().prevAll().length : -1; 1859 } 1860 if (typeof elem === "string") { 1861 return indexOf.call(jQuery(elem), this[0]); 1862 } 1863 return indexOf.call( 1864 this, 1865 // If it receives a jQuery object, the first element is used 1866 elem.jquery ? elem[0] : elem 1867 ); 1868 }, 1869 add: function(selector, context) { 1870 return this.pushStack( 1871 jQuery.uniqueSort( 1872 jQuery.merge(this.get(), jQuery(selector, context)) 1873 ) 1874 ); 1875 }, 1876 addBack: function(selector) { 1877 return this.add( 1878 selector == null ? this.prevObject : this.prevObject.filter(selector) 1879 ); 1880 } 1881 }); 1882 function sibling(cur, dir2) { 1883 while ((cur = cur[dir2]) && cur.nodeType !== 1) { 1884 } 1885 return cur; 1886 } 1887 jQuery.each({ 1888 parent: function(elem) { 1889 var parent = elem.parentNode; 1890 return parent && parent.nodeType !== 11 ? parent : null; 1891 }, 1892 parents: function(elem) { 1893 return dir(elem, "parentNode"); 1894 }, 1895 parentsUntil: function(elem, _i, until) { 1896 return dir(elem, "parentNode", until); 1897 }, 1898 next: function(elem) { 1899 return sibling(elem, "nextSibling"); 1900 }, 1901 prev: function(elem) { 1902 return sibling(elem, "previousSibling"); 1903 }, 1904 nextAll: function(elem) { 1905 return dir(elem, "nextSibling"); 1906 }, 1907 prevAll: function(elem) { 1908 return dir(elem, "previousSibling"); 1909 }, 1910 nextUntil: function(elem, _i, until) { 1911 return dir(elem, "nextSibling", until); 1912 }, 1913 prevUntil: function(elem, _i, until) { 1914 return dir(elem, "previousSibling", until); 1915 }, 1916 siblings: function(elem) { 1917 return siblings((elem.parentNode || {}).firstChild, elem); 1918 }, 1919 children: function(elem) { 1920 return siblings(elem.firstChild); 1921 }, 1922 contents: function(elem) { 1923 if (elem.contentDocument != null && // Support: IE 11+ 1924 // <object> elements with no `data` attribute has an object 1925 // `contentDocument` with a `null` prototype. 1926 getProto(elem.contentDocument)) { 1927 return elem.contentDocument; 1928 } 1929 if (nodeName(elem, "template")) { 1930 elem = elem.content || elem; 1931 } 1932 return jQuery.merge([], elem.childNodes); 1933 } 1934 }, function(name, fn) { 1935 jQuery.fn[name] = function(until, selector) { 1936 var matched = jQuery.map(this, fn, until); 1937 if (name.slice(-5) !== "Until") { 1938 selector = until; 1939 } 1940 if (selector && typeof selector === "string") { 1941 matched = jQuery.filter(selector, matched); 1942 } 1943 if (this.length > 1) { 1944 if (!guaranteedUnique[name]) { 1945 jQuery.uniqueSort(matched); 1946 } 1947 if (rparentsprev.test(name)) { 1948 matched.reverse(); 1949 } 1950 } 1951 return this.pushStack(matched); 1952 }; 1953 }); 1954 var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; 1955 function createOptions(options) { 1956 var object = {}; 1957 jQuery.each(options.match(rnothtmlwhite) || [], function(_23, flag) { 1958 object[flag] = true; 1959 }); 1960 return object; 1961 } 1962 jQuery.Callbacks = function(options) { 1963 options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options); 1964 var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() { 1965 locked = locked || options.once; 1966 fired = firing = true; 1967 for (; queue.length; firingIndex = -1) { 1968 memory = queue.shift(); 1969 while (++firingIndex < list.length) { 1970 if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) { 1971 firingIndex = list.length; 1972 memory = false; 1973 } 1974 } 1975 } 1976 if (!options.memory) { 1977 memory = false; 1978 } 1979 firing = false; 1980 if (locked) { 1981 if (memory) { 1982 list = []; 1983 } else { 1984 list = ""; 1985 } 1986 } 1987 }, self2 = { 1988 // Add a callback or a collection of callbacks to the list 1989 add: function() { 1990 if (list) { 1991 if (memory && !firing) { 1992 firingIndex = list.length - 1; 1993 queue.push(memory); 1994 } 1995 (function add(args) { 1996 jQuery.each(args, function(_23, arg) { 1997 if (isFunction(arg)) { 1998 if (!options.unique || !self2.has(arg)) { 1999 list.push(arg); 2000 } 2001 } else if (arg && arg.length && toType(arg) !== "string") { 2002 add(arg); 2003 } 2004 }); 2005 })(arguments); 2006 if (memory && !firing) { 2007 fire(); 2008 } 2009 } 2010 return this; 2011 }, 2012 // Remove a callback from the list 2013 remove: function() { 2014 jQuery.each(arguments, function(_23, arg) { 2015 var index; 2016 while ((index = jQuery.inArray(arg, list, index)) > -1) { 2017 list.splice(index, 1); 2018 if (index <= firingIndex) { 2019 firingIndex--; 2020 } 2021 } 2022 }); 2023 return this; 2024 }, 2025 // Check if a given callback is in the list. 2026 // If no argument is given, return whether or not list has callbacks attached. 2027 has: function(fn) { 2028 return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0; 2029 }, 2030 // Remove all callbacks from the list 2031 empty: function() { 2032 if (list) { 2033 list = []; 2034 } 2035 return this; 2036 }, 2037 // Disable .fire and .add 2038 // Abort any current/pending executions 2039 // Clear all callbacks and values 2040 disable: function() { 2041 locked = queue = []; 2042 list = memory = ""; 2043 return this; 2044 }, 2045 disabled: function() { 2046 return !list; 2047 }, 2048 // Disable .fire 2049 // Also disable .add unless we have memory (since it would have no effect) 2050 // Abort any pending executions 2051 lock: function() { 2052 locked = queue = []; 2053 if (!memory && !firing) { 2054 list = memory = ""; 2055 } 2056 return this; 2057 }, 2058 locked: function() { 2059 return !!locked; 2060 }, 2061 // Call all callbacks with the given context and arguments 2062 fireWith: function(context, args) { 2063 if (!locked) { 2064 args = args || []; 2065 args = [context, args.slice ? args.slice() : args]; 2066 queue.push(args); 2067 if (!firing) { 2068 fire(); 2069 } 2070 } 2071 return this; 2072 }, 2073 // Call all the callbacks with the given arguments 2074 fire: function() { 2075 self2.fireWith(this, arguments); 2076 return this; 2077 }, 2078 // To know if the callbacks have already been called at least once 2079 fired: function() { 2080 return !!fired; 2081 } 2082 }; 2083 return self2; 2084 }; 2085 function Identity(v) { 2086 return v; 2087 } 2088 function Thrower(ex) { 2089 throw ex; 2090 } 2091 function adoptValue(value, resolve, reject, noValue) { 2092 var method; 2093 try { 2094 if (value && isFunction(method = value.promise)) { 2095 method.call(value).done(resolve).fail(reject); 2096 } else if (value && isFunction(method = value.then)) { 2097 method.call(value, resolve, reject); 2098 } else { 2099 resolve.apply(void 0, [value].slice(noValue)); 2100 } 2101 } catch (value2) { 2102 reject.apply(void 0, [value2]); 2103 } 2104 } 2105 jQuery.extend({ 2106 Deferred: function(func) { 2107 var tuples = [ 2108 // action, add listener, callbacks, 2109 // ... .then handlers, argument index, [final state] 2110 [ 2111 "notify", 2112 "progress", 2113 jQuery.Callbacks("memory"), 2114 jQuery.Callbacks("memory"), 2115 2 2116 ], 2117 [ 2118 "resolve", 2119 "done", 2120 jQuery.Callbacks("once memory"), 2121 jQuery.Callbacks("once memory"), 2122 0, 2123 "resolved" 2124 ], 2125 [ 2126 "reject", 2127 "fail", 2128 jQuery.Callbacks("once memory"), 2129 jQuery.Callbacks("once memory"), 2130 1, 2131 "rejected" 2132 ] 2133 ], state = "pending", promise = { 2134 state: function() { 2135 return state; 2136 }, 2137 always: function() { 2138 deferred.done(arguments).fail(arguments); 2139 return this; 2140 }, 2141 "catch": function(fn) { 2142 return promise.then(null, fn); 2143 }, 2144 // Keep pipe for back-compat 2145 pipe: function() { 2146 var fns = arguments; 2147 return jQuery.Deferred(function(newDefer) { 2148 jQuery.each(tuples, function(_i, tuple) { 2149 var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]]; 2150 deferred[tuple[1]](function() { 2151 var returned = fn && fn.apply(this, arguments); 2152 if (returned && isFunction(returned.promise)) { 2153 returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject); 2154 } else { 2155 newDefer[tuple[0] + "With"]( 2156 this, 2157 fn ? [returned] : arguments 2158 ); 2159 } 2160 }); 2161 }); 2162 fns = null; 2163 }).promise(); 2164 }, 2165 then: function(onFulfilled, onRejected, onProgress) { 2166 var maxDepth = 0; 2167 function resolve(depth, deferred2, handler, special) { 2168 return function() { 2169 var that = this, args = arguments, mightThrow = function() { 2170 var returned, then; 2171 if (depth < maxDepth) { 2172 return; 2173 } 2174 returned = handler.apply(that, args); 2175 if (returned === deferred2.promise()) { 2176 throw new TypeError("Thenable self-resolution"); 2177 } 2178 then = returned && // Support: Promises/A+ section 2.3.4 2179 // https://promisesaplus.com/#point-64 2180 // Only check objects and functions for thenability 2181 (typeof returned === "object" || typeof returned === "function") && returned.then; 2182 if (isFunction(then)) { 2183 if (special) { 2184 then.call( 2185 returned, 2186 resolve(maxDepth, deferred2, Identity, special), 2187 resolve(maxDepth, deferred2, Thrower, special) 2188 ); 2189 } else { 2190 maxDepth++; 2191 then.call( 2192 returned, 2193 resolve(maxDepth, deferred2, Identity, special), 2194 resolve(maxDepth, deferred2, Thrower, special), 2195 resolve( 2196 maxDepth, 2197 deferred2, 2198 Identity, 2199 deferred2.notifyWith 2200 ) 2201 ); 2202 } 2203 } else { 2204 if (handler !== Identity) { 2205 that = void 0; 2206 args = [returned]; 2207 } 2208 (special || deferred2.resolveWith)(that, args); 2209 } 2210 }, process = special ? mightThrow : function() { 2211 try { 2212 mightThrow(); 2213 } catch (e) { 2214 if (jQuery.Deferred.exceptionHook) { 2215 jQuery.Deferred.exceptionHook( 2216 e, 2217 process.stackTrace 2218 ); 2219 } 2220 if (depth + 1 >= maxDepth) { 2221 if (handler !== Thrower) { 2222 that = void 0; 2223 args = [e]; 2224 } 2225 deferred2.rejectWith(that, args); 2226 } 2227 } 2228 }; 2229 if (depth) { 2230 process(); 2231 } else { 2232 if (jQuery.Deferred.getStackHook) { 2233 process.stackTrace = jQuery.Deferred.getStackHook(); 2234 } 2235 window2.setTimeout(process); 2236 } 2237 }; 2238 } 2239 return jQuery.Deferred(function(newDefer) { 2240 tuples[0][3].add( 2241 resolve( 2242 0, 2243 newDefer, 2244 isFunction(onProgress) ? onProgress : Identity, 2245 newDefer.notifyWith 2246 ) 2247 ); 2248 tuples[1][3].add( 2249 resolve( 2250 0, 2251 newDefer, 2252 isFunction(onFulfilled) ? onFulfilled : Identity 2253 ) 2254 ); 2255 tuples[2][3].add( 2256 resolve( 2257 0, 2258 newDefer, 2259 isFunction(onRejected) ? onRejected : Thrower 2260 ) 2261 ); 2262 }).promise(); 2263 }, 2264 // Get a promise for this deferred 2265 // If obj is provided, the promise aspect is added to the object 2266 promise: function(obj) { 2267 return obj != null ? jQuery.extend(obj, promise) : promise; 2268 } 2269 }, deferred = {}; 2270 jQuery.each(tuples, function(i, tuple) { 2271 var list = tuple[2], stateString = tuple[5]; 2272 promise[tuple[1]] = list.add; 2273 if (stateString) { 2274 list.add( 2275 function() { 2276 state = stateString; 2277 }, 2278 // rejected_callbacks.disable 2279 // fulfilled_callbacks.disable 2280 tuples[3 - i][2].disable, 2281 // rejected_handlers.disable 2282 // fulfilled_handlers.disable 2283 tuples[3 - i][3].disable, 2284 // progress_callbacks.lock 2285 tuples[0][2].lock, 2286 // progress_handlers.lock 2287 tuples[0][3].lock 2288 ); 2289 } 2290 list.add(tuple[3].fire); 2291 deferred[tuple[0]] = function() { 2292 deferred[tuple[0] + "With"](this === deferred ? void 0 : this, arguments); 2293 return this; 2294 }; 2295 deferred[tuple[0] + "With"] = list.fireWith; 2296 }); 2297 promise.promise(deferred); 2298 if (func) { 2299 func.call(deferred, deferred); 2300 } 2301 return deferred; 2302 }, 2303 // Deferred helper 2304 when: function(singleValue) { 2305 var remaining = arguments.length, i = remaining, resolveContexts = Array(i), resolveValues = slice.call(arguments), master = jQuery.Deferred(), updateFunc = function(i2) { 2306 return function(value) { 2307 resolveContexts[i2] = this; 2308 resolveValues[i2] = arguments.length > 1 ? slice.call(arguments) : value; 2309 if (!--remaining) { 2310 master.resolveWith(resolveContexts, resolveValues); 2311 } 2312 }; 2313 }; 2314 if (remaining <= 1) { 2315 adoptValue( 2316 singleValue, 2317 master.done(updateFunc(i)).resolve, 2318 master.reject, 2319 !remaining 2320 ); 2321 if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) { 2322 return master.then(); 2323 } 2324 } 2325 while (i--) { 2326 adoptValue(resolveValues[i], updateFunc(i), master.reject); 2327 } 2328 return master.promise(); 2329 } 2330 }); 2331 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 2332 jQuery.Deferred.exceptionHook = function(error2, stack) { 2333 if (window2.console && window2.console.warn && error2 && rerrorNames.test(error2.name)) { 2334 window2.console.warn("jQuery.Deferred exception: " + error2.message, error2.stack, stack); 2335 } 2336 }; 2337 jQuery.readyException = function(error2) { 2338 window2.setTimeout(function() { 2339 throw error2; 2340 }); 2341 }; 2342 var readyList = jQuery.Deferred(); 2343 jQuery.fn.ready = function(fn) { 2344 readyList.then(fn).catch(function(error2) { 2345 jQuery.readyException(error2); 2346 }); 2347 return this; 2348 }; 2349 jQuery.extend({ 2350 // Is the DOM ready to be used? Set to true once it occurs. 2351 isReady: false, 2352 // A counter to track how many items to wait for before 2353 // the ready event fires. See #6781 2354 readyWait: 1, 2355 // Handle when the DOM is ready 2356 ready: function(wait) { 2357 if (wait === true ? --jQuery.readyWait : jQuery.isReady) { 2358 return; 2359 } 2360 jQuery.isReady = true; 2361 if (wait !== true && --jQuery.readyWait > 0) { 2362 return; 2363 } 2364 readyList.resolveWith(document2, [jQuery]); 2365 } 2366 }); 2367 jQuery.ready.then = readyList.then; 2368 function completed() { 2369 document2.removeEventListener("DOMContentLoaded", completed); 2370 window2.removeEventListener("load", completed); 2371 jQuery.ready(); 2372 } 2373 if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) { 2374 window2.setTimeout(jQuery.ready); 2375 } else { 2376 document2.addEventListener("DOMContentLoaded", completed); 2377 window2.addEventListener("load", completed); 2378 } 2379 var access = function(elems, fn, key, value, chainable, emptyGet, raw) { 2380 var i = 0, len = elems.length, bulk = key == null; 2381 if (toType(key) === "object") { 2382 chainable = true; 2383 for (i in key) { 2384 access(elems, fn, i, key[i], true, emptyGet, raw); 2385 } 2386 } else if (value !== void 0) { 2387 chainable = true; 2388 if (!isFunction(value)) { 2389 raw = true; 2390 } 2391 if (bulk) { 2392 if (raw) { 2393 fn.call(elems, value); 2394 fn = null; 2395 } else { 2396 bulk = fn; 2397 fn = function(elem, _key, value2) { 2398 return bulk.call(jQuery(elem), value2); 2399 }; 2400 } 2401 } 2402 if (fn) { 2403 for (; i < len; i++) { 2404 fn( 2405 elems[i], 2406 key, 2407 raw ? value : value.call(elems[i], i, fn(elems[i], key)) 2408 ); 2409 } 2410 } 2411 } 2412 if (chainable) { 2413 return elems; 2414 } 2415 if (bulk) { 2416 return fn.call(elems); 2417 } 2418 return len ? fn(elems[0], key) : emptyGet; 2419 }; 2420 var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g; 2421 function fcamelCase(_all, letter) { 2422 return letter.toUpperCase(); 2423 } 2424 function camelCase(string) { 2425 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 2426 } 2427 var acceptData = function(owner) { 2428 return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; 2429 }; 2430 function Data() { 2431 this.expando = jQuery.expando + Data.uid++; 2432 } 2433 Data.uid = 1; 2434 Data.prototype = { 2435 cache: function(owner) { 2436 var value = owner[this.expando]; 2437 if (!value) { 2438 value = {}; 2439 if (acceptData(owner)) { 2440 if (owner.nodeType) { 2441 owner[this.expando] = value; 2442 } else { 2443 Object.defineProperty(owner, this.expando, { 2444 value, 2445 configurable: true 2446 }); 2447 } 2448 } 2449 } 2450 return value; 2451 }, 2452 set: function(owner, data, value) { 2453 var prop, cache = this.cache(owner); 2454 if (typeof data === "string") { 2455 cache[camelCase(data)] = value; 2456 } else { 2457 for (prop in data) { 2458 cache[camelCase(prop)] = data[prop]; 2459 } 2460 } 2461 return cache; 2462 }, 2463 get: function(owner, key) { 2464 return key === void 0 ? this.cache(owner) : ( 2465 // Always use camelCase key (gh-2257) 2466 owner[this.expando] && owner[this.expando][camelCase(key)] 2467 ); 2468 }, 2469 access: function(owner, key, value) { 2470 if (key === void 0 || key && typeof key === "string" && value === void 0) { 2471 return this.get(owner, key); 2472 } 2473 this.set(owner, key, value); 2474 return value !== void 0 ? value : key; 2475 }, 2476 remove: function(owner, key) { 2477 var i, cache = owner[this.expando]; 2478 if (cache === void 0) { 2479 return; 2480 } 2481 if (key !== void 0) { 2482 if (Array.isArray(key)) { 2483 key = key.map(camelCase); 2484 } else { 2485 key = camelCase(key); 2486 key = key in cache ? [key] : key.match(rnothtmlwhite) || []; 2487 } 2488 i = key.length; 2489 while (i--) { 2490 delete cache[key[i]]; 2491 } 2492 } 2493 if (key === void 0 || jQuery.isEmptyObject(cache)) { 2494 if (owner.nodeType) { 2495 owner[this.expando] = void 0; 2496 } else { 2497 delete owner[this.expando]; 2498 } 2499 } 2500 }, 2501 hasData: function(owner) { 2502 var cache = owner[this.expando]; 2503 return cache !== void 0 && !jQuery.isEmptyObject(cache); 2504 } 2505 }; 2506 var dataPriv = new Data(); 2507 var dataUser = new Data(); 2508 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; 2509 function getData(data) { 2510 if (data === "true") { 2511 return true; 2512 } 2513 if (data === "false") { 2514 return false; 2515 } 2516 if (data === "null") { 2517 return null; 2518 } 2519 if (data === +data + "") { 2520 return +data; 2521 } 2522 if (rbrace.test(data)) { 2523 return JSON.parse(data); 2524 } 2525 return data; 2526 } 2527 function dataAttr(elem, key, data) { 2528 var name; 2529 if (data === void 0 && elem.nodeType === 1) { 2530 name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); 2531 data = elem.getAttribute(name); 2532 if (typeof data === "string") { 2533 try { 2534 data = getData(data); 2535 } catch (e) { 2536 } 2537 dataUser.set(elem, key, data); 2538 } else { 2539 data = void 0; 2540 } 2541 } 2542 return data; 2543 } 2544 jQuery.extend({ 2545 hasData: function(elem) { 2546 return dataUser.hasData(elem) || dataPriv.hasData(elem); 2547 }, 2548 data: function(elem, name, data) { 2549 return dataUser.access(elem, name, data); 2550 }, 2551 removeData: function(elem, name) { 2552 dataUser.remove(elem, name); 2553 }, 2554 // TODO: Now that all calls to _data and _removeData have been replaced 2555 // with direct calls to dataPriv methods, these can be deprecated. 2556 _data: function(elem, name, data) { 2557 return dataPriv.access(elem, name, data); 2558 }, 2559 _removeData: function(elem, name) { 2560 dataPriv.remove(elem, name); 2561 } 2562 }); 2563 jQuery.fn.extend({ 2564 data: function(key, value) { 2565 var i, name, data, elem = this[0], attrs = elem && elem.attributes; 2566 if (key === void 0) { 2567 if (this.length) { 2568 data = dataUser.get(elem); 2569 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 2570 i = attrs.length; 2571 while (i--) { 2572 if (attrs[i]) { 2573 name = attrs[i].name; 2574 if (name.indexOf("data-") === 0) { 2575 name = camelCase(name.slice(5)); 2576 dataAttr(elem, name, data[name]); 2577 } 2578 } 2579 } 2580 dataPriv.set(elem, "hasDataAttrs", true); 2581 } 2582 } 2583 return data; 2584 } 2585 if (typeof key === "object") { 2586 return this.each(function() { 2587 dataUser.set(this, key); 2588 }); 2589 } 2590 return access(this, function(value2) { 2591 var data2; 2592 if (elem && value2 === void 0) { 2593 data2 = dataUser.get(elem, key); 2594 if (data2 !== void 0) { 2595 return data2; 2596 } 2597 data2 = dataAttr(elem, key); 2598 if (data2 !== void 0) { 2599 return data2; 2600 } 2601 return; 2602 } 2603 this.each(function() { 2604 dataUser.set(this, key, value2); 2605 }); 2606 }, null, value, arguments.length > 1, null, true); 2607 }, 2608 removeData: function(key) { 2609 return this.each(function() { 2610 dataUser.remove(this, key); 2611 }); 2612 } 2613 }); 2614 jQuery.extend({ 2615 queue: function(elem, type, data) { 2616 var queue; 2617 if (elem) { 2618 type = (type || "fx") + "queue"; 2619 queue = dataPriv.get(elem, type); 2620 if (data) { 2621 if (!queue || Array.isArray(data)) { 2622 queue = dataPriv.access(elem, type, jQuery.makeArray(data)); 2623 } else { 2624 queue.push(data); 2625 } 2626 } 2627 return queue || []; 2628 } 2629 }, 2630 dequeue: function(elem, type) { 2631 type = type || "fx"; 2632 var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function() { 2633 jQuery.dequeue(elem, type); 2634 }; 2635 if (fn === "inprogress") { 2636 fn = queue.shift(); 2637 startLength--; 2638 } 2639 if (fn) { 2640 if (type === "fx") { 2641 queue.unshift("inprogress"); 2642 } 2643 delete hooks.stop; 2644 fn.call(elem, next, hooks); 2645 } 2646 if (!startLength && hooks) { 2647 hooks.empty.fire(); 2648 } 2649 }, 2650 // Not public - generate a queueHooks object, or return the current one 2651 _queueHooks: function(elem, type) { 2652 var key = type + "queueHooks"; 2653 return dataPriv.get(elem, key) || dataPriv.access(elem, key, { 2654 empty: jQuery.Callbacks("once memory").add(function() { 2655 dataPriv.remove(elem, [type + "queue", key]); 2656 }) 2657 }); 2658 } 2659 }); 2660 jQuery.fn.extend({ 2661 queue: function(type, data) { 2662 var setter = 2; 2663 if (typeof type !== "string") { 2664 data = type; 2665 type = "fx"; 2666 setter--; 2667 } 2668 if (arguments.length < setter) { 2669 return jQuery.queue(this[0], type); 2670 } 2671 return data === void 0 ? this : this.each(function() { 2672 var queue = jQuery.queue(this, type, data); 2673 jQuery._queueHooks(this, type); 2674 if (type === "fx" && queue[0] !== "inprogress") { 2675 jQuery.dequeue(this, type); 2676 } 2677 }); 2678 }, 2679 dequeue: function(type) { 2680 return this.each(function() { 2681 jQuery.dequeue(this, type); 2682 }); 2683 }, 2684 clearQueue: function(type) { 2685 return this.queue(type || "fx", []); 2686 }, 2687 // Get a promise resolved when queues of a certain type 2688 // are emptied (fx is the type by default) 2689 promise: function(type, obj) { 2690 var tmp, count = 1, defer2 = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { 2691 if (!--count) { 2692 defer2.resolveWith(elements, [elements]); 2693 } 2694 }; 2695 if (typeof type !== "string") { 2696 obj = type; 2697 type = void 0; 2698 } 2699 type = type || "fx"; 2700 while (i--) { 2701 tmp = dataPriv.get(elements[i], type + "queueHooks"); 2702 if (tmp && tmp.empty) { 2703 count++; 2704 tmp.empty.add(resolve); 2705 } 2706 } 2707 resolve(); 2708 return defer2.promise(obj); 2709 } 2710 }); 2711 var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; 2712 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 2713 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 2714 var documentElement = document2.documentElement; 2715 var isAttached = function(elem) { 2716 return jQuery.contains(elem.ownerDocument, elem); 2717 }, composed = { composed: true }; 2718 if (documentElement.getRootNode) { 2719 isAttached = function(elem) { 2720 return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument; 2721 }; 2722 } 2723 var isHiddenWithinTree = function(elem, el) { 2724 elem = el || elem; 2725 return elem.style.display === "none" || elem.style.display === "" && // Otherwise, check computed style 2726 // Support: Firefox <=43 - 45 2727 // Disconnected elements can have computed display: none, so first confirm that elem is 2728 // in the document. 2729 isAttached(elem) && jQuery.css(elem, "display") === "none"; 2730 }; 2731 function adjustCSS(elem, prop, valueParts, tween) { 2732 var adjusted, scale, maxIterations = 20, currentValue = tween ? function() { 2733 return tween.cur(); 2734 } : function() { 2735 return jQuery.css(elem, prop, ""); 2736 }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop)); 2737 if (initialInUnit && initialInUnit[3] !== unit) { 2738 initial = initial / 2; 2739 unit = unit || initialInUnit[3]; 2740 initialInUnit = +initial || 1; 2741 while (maxIterations--) { 2742 jQuery.style(elem, prop, initialInUnit + unit); 2743 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 2744 maxIterations = 0; 2745 } 2746 initialInUnit = initialInUnit / scale; 2747 } 2748 initialInUnit = initialInUnit * 2; 2749 jQuery.style(elem, prop, initialInUnit + unit); 2750 valueParts = valueParts || []; 2751 } 2752 if (valueParts) { 2753 initialInUnit = +initialInUnit || +initial || 0; 2754 adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2]; 2755 if (tween) { 2756 tween.unit = unit; 2757 tween.start = initialInUnit; 2758 tween.end = adjusted; 2759 } 2760 } 2761 return adjusted; 2762 } 2763 var defaultDisplayMap = {}; 2764 function getDefaultDisplay(elem) { 2765 var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2]; 2766 if (display) { 2767 return display; 2768 } 2769 temp = doc.body.appendChild(doc.createElement(nodeName2)); 2770 display = jQuery.css(temp, "display"); 2771 temp.parentNode.removeChild(temp); 2772 if (display === "none") { 2773 display = "block"; 2774 } 2775 defaultDisplayMap[nodeName2] = display; 2776 return display; 2777 } 2778 function showHide(elements, show) { 2779 var display, elem, values = [], index = 0, length = elements.length; 2780 for (; index < length; index++) { 2781 elem = elements[index]; 2782 if (!elem.style) { 2783 continue; 2784 } 2785 display = elem.style.display; 2786 if (show) { 2787 if (display === "none") { 2788 values[index] = dataPriv.get(elem, "display") || null; 2789 if (!values[index]) { 2790 elem.style.display = ""; 2791 } 2792 } 2793 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 2794 values[index] = getDefaultDisplay(elem); 2795 } 2796 } else { 2797 if (display !== "none") { 2798 values[index] = "none"; 2799 dataPriv.set(elem, "display", display); 2800 } 2801 } 2802 } 2803 for (index = 0; index < length; index++) { 2804 if (values[index] != null) { 2805 elements[index].style.display = values[index]; 2806 } 2807 } 2808 return elements; 2809 } 2810 jQuery.fn.extend({ 2811 show: function() { 2812 return showHide(this, true); 2813 }, 2814 hide: function() { 2815 return showHide(this); 2816 }, 2817 toggle: function(state) { 2818 if (typeof state === "boolean") { 2819 return state ? this.show() : this.hide(); 2820 } 2821 return this.each(function() { 2822 if (isHiddenWithinTree(this)) { 2823 jQuery(this).show(); 2824 } else { 2825 jQuery(this).hide(); 2826 } 2827 }); 2828 } 2829 }); 2830 var rcheckableType = /^(?:checkbox|radio)$/i; 2831 var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; 2832 var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; 2833 (function() { 2834 var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input"); 2835 input.setAttribute("type", "radio"); 2836 input.setAttribute("checked", "checked"); 2837 input.setAttribute("name", "t"); 2838 div.appendChild(input); 2839 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 2840 div.innerHTML = "<textarea>x</textarea>"; 2841 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 2842 div.innerHTML = "<option></option>"; 2843 support.option = !!div.lastChild; 2844 })(); 2845 var wrapMap = { 2846 // XHTML parsers do not magically insert elements in the 2847 // same way that tag soup parsers do. So we cannot shorten 2848 // this by omitting <tbody> or other required elements. 2849 thead: [1, "<table>", "</table>"], 2850 col: [2, "<table><colgroup>", "</colgroup></table>"], 2851 tr: [2, "<table><tbody>", "</tbody></table>"], 2852 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 2853 _default: [0, "", ""] 2854 }; 2855 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 2856 wrapMap.th = wrapMap.td; 2857 if (!support.option) { 2858 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 2859 } 2860 function getAll(context, tag) { 2861 var ret; 2862 if (typeof context.getElementsByTagName !== "undefined") { 2863 ret = context.getElementsByTagName(tag || "*"); 2864 } else if (typeof context.querySelectorAll !== "undefined") { 2865 ret = context.querySelectorAll(tag || "*"); 2866 } else { 2867 ret = []; 2868 } 2869 if (tag === void 0 || tag && nodeName(context, tag)) { 2870 return jQuery.merge([context], ret); 2871 } 2872 return ret; 2873 } 2874 function setGlobalEval(elems, refElements) { 2875 var i = 0, l = elems.length; 2876 for (; i < l; i++) { 2877 dataPriv.set( 2878 elems[i], 2879 "globalEval", 2880 !refElements || dataPriv.get(refElements[i], "globalEval") 2881 ); 2882 } 2883 } 2884 var rhtml = /<|&#?\w+;/; 2885 function buildFragment(elems, context, scripts, selection, ignored) { 2886 var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; 2887 for (; i < l; i++) { 2888 elem = elems[i]; 2889 if (elem || elem === 0) { 2890 if (toType(elem) === "object") { 2891 jQuery.merge(nodes, elem.nodeType ? [elem] : elem); 2892 } else if (!rhtml.test(elem)) { 2893 nodes.push(context.createTextNode(elem)); 2894 } else { 2895 tmp = tmp || fragment.appendChild(context.createElement("div")); 2896 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 2897 wrap = wrapMap[tag] || wrapMap._default; 2898 tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; 2899 j = wrap[0]; 2900 while (j--) { 2901 tmp = tmp.lastChild; 2902 } 2903 jQuery.merge(nodes, tmp.childNodes); 2904 tmp = fragment.firstChild; 2905 tmp.textContent = ""; 2906 } 2907 } 2908 } 2909 fragment.textContent = ""; 2910 i = 0; 2911 while (elem = nodes[i++]) { 2912 if (selection && jQuery.inArray(elem, selection) > -1) { 2913 if (ignored) { 2914 ignored.push(elem); 2915 } 2916 continue; 2917 } 2918 attached = isAttached(elem); 2919 tmp = getAll(fragment.appendChild(elem), "script"); 2920 if (attached) { 2921 setGlobalEval(tmp); 2922 } 2923 if (scripts) { 2924 j = 0; 2925 while (elem = tmp[j++]) { 2926 if (rscriptType.test(elem.type || "")) { 2927 scripts.push(elem); 2928 } 2929 } 2930 } 2931 } 2932 return fragment; 2933 } 2934 var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 2935 function returnTrue() { 2936 return true; 2937 } 2938 function returnFalse() { 2939 return false; 2940 } 2941 function expectSync(elem, type) { 2942 return elem === safeActiveElement() === (type === "focus"); 2943 } 2944 function safeActiveElement() { 2945 try { 2946 return document2.activeElement; 2947 } catch (err) { 2948 } 2949 } 2950 function on(elem, types, selector, data, fn, one) { 2951 var origFn, type; 2952 if (typeof types === "object") { 2953 if (typeof selector !== "string") { 2954 data = data || selector; 2955 selector = void 0; 2956 } 2957 for (type in types) { 2958 on(elem, type, selector, data, types[type], one); 2959 } 2960 return elem; 2961 } 2962 if (data == null && fn == null) { 2963 fn = selector; 2964 data = selector = void 0; 2965 } else if (fn == null) { 2966 if (typeof selector === "string") { 2967 fn = data; 2968 data = void 0; 2969 } else { 2970 fn = data; 2971 data = selector; 2972 selector = void 0; 2973 } 2974 } 2975 if (fn === false) { 2976 fn = returnFalse; 2977 } else if (!fn) { 2978 return elem; 2979 } 2980 if (one === 1) { 2981 origFn = fn; 2982 fn = function(event) { 2983 jQuery().off(event); 2984 return origFn.apply(this, arguments); 2985 }; 2986 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 2987 } 2988 return elem.each(function() { 2989 jQuery.event.add(this, types, fn, data, selector); 2990 }); 2991 } 2992 jQuery.event = { 2993 global: {}, 2994 add: function(elem, types, handler, data, selector) { 2995 var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem); 2996 if (!acceptData(elem)) { 2997 return; 2998 } 2999 if (handler.handler) { 3000 handleObjIn = handler; 3001 handler = handleObjIn.handler; 3002 selector = handleObjIn.selector; 3003 } 3004 if (selector) { 3005 jQuery.find.matchesSelector(documentElement, selector); 3006 } 3007 if (!handler.guid) { 3008 handler.guid = jQuery.guid++; 3009 } 3010 if (!(events = elemData.events)) { 3011 events = elemData.events = /* @__PURE__ */ Object.create(null); 3012 } 3013 if (!(eventHandle = elemData.handle)) { 3014 eventHandle = elemData.handle = function(e) { 3015 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0; 3016 }; 3017 } 3018 types = (types || "").match(rnothtmlwhite) || [""]; 3019 t = types.length; 3020 while (t--) { 3021 tmp = rtypenamespace.exec(types[t]) || []; 3022 type = origType = tmp[1]; 3023 namespaces = (tmp[2] || "").split(".").sort(); 3024 if (!type) { 3025 continue; 3026 } 3027 special = jQuery.event.special[type] || {}; 3028 type = (selector ? special.delegateType : special.bindType) || type; 3029 special = jQuery.event.special[type] || {}; 3030 handleObj = jQuery.extend({ 3031 type, 3032 origType, 3033 data, 3034 handler, 3035 guid: handler.guid, 3036 selector, 3037 needsContext: selector && jQuery.expr.match.needsContext.test(selector), 3038 namespace: namespaces.join(".") 3039 }, handleObjIn); 3040 if (!(handlers = events[type])) { 3041 handlers = events[type] = []; 3042 handlers.delegateCount = 0; 3043 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 3044 if (elem.addEventListener) { 3045 elem.addEventListener(type, eventHandle); 3046 } 3047 } 3048 } 3049 if (special.add) { 3050 special.add.call(elem, handleObj); 3051 if (!handleObj.handler.guid) { 3052 handleObj.handler.guid = handler.guid; 3053 } 3054 } 3055 if (selector) { 3056 handlers.splice(handlers.delegateCount++, 0, handleObj); 3057 } else { 3058 handlers.push(handleObj); 3059 } 3060 jQuery.event.global[type] = true; 3061 } 3062 }, 3063 // Detach an event or set of events from an element 3064 remove: function(elem, types, handler, selector, mappedTypes) { 3065 var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 3066 if (!elemData || !(events = elemData.events)) { 3067 return; 3068 } 3069 types = (types || "").match(rnothtmlwhite) || [""]; 3070 t = types.length; 3071 while (t--) { 3072 tmp = rtypenamespace.exec(types[t]) || []; 3073 type = origType = tmp[1]; 3074 namespaces = (tmp[2] || "").split(".").sort(); 3075 if (!type) { 3076 for (type in events) { 3077 jQuery.event.remove(elem, type + types[t], handler, selector, true); 3078 } 3079 continue; 3080 } 3081 special = jQuery.event.special[type] || {}; 3082 type = (selector ? special.delegateType : special.bindType) || type; 3083 handlers = events[type] || []; 3084 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 3085 origCount = j = handlers.length; 3086 while (j--) { 3087 handleObj = handlers[j]; 3088 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { 3089 handlers.splice(j, 1); 3090 if (handleObj.selector) { 3091 handlers.delegateCount--; 3092 } 3093 if (special.remove) { 3094 special.remove.call(elem, handleObj); 3095 } 3096 } 3097 } 3098 if (origCount && !handlers.length) { 3099 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { 3100 jQuery.removeEvent(elem, type, elemData.handle); 3101 } 3102 delete events[type]; 3103 } 3104 } 3105 if (jQuery.isEmptyObject(events)) { 3106 dataPriv.remove(elem, "handle events"); 3107 } 3108 }, 3109 dispatch: function(nativeEvent) { 3110 var i, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event.type] || [], special = jQuery.event.special[event.type] || {}; 3111 args[0] = event; 3112 for (i = 1; i < arguments.length; i++) { 3113 args[i] = arguments[i]; 3114 } 3115 event.delegateTarget = this; 3116 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 3117 return; 3118 } 3119 handlerQueue = jQuery.event.handlers.call(this, event, handlers); 3120 i = 0; 3121 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 3122 event.currentTarget = matched.elem; 3123 j = 0; 3124 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { 3125 if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) { 3126 event.handleObj = handleObj; 3127 event.data = handleObj.data; 3128 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args); 3129 if (ret !== void 0) { 3130 if ((event.result = ret) === false) { 3131 event.preventDefault(); 3132 event.stopPropagation(); 3133 } 3134 } 3135 } 3136 } 3137 } 3138 if (special.postDispatch) { 3139 special.postDispatch.call(this, event); 3140 } 3141 return event.result; 3142 }, 3143 handlers: function(event, handlers) { 3144 var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; 3145 if (delegateCount && // Support: IE <=9 3146 // Black-hole SVG <use> instance trees (trac-13180) 3147 cur.nodeType && // Support: Firefox <=42 3148 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 3149 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 3150 // Support: IE 11 only 3151 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 3152 !(event.type === "click" && event.button >= 1)) { 3153 for (; cur !== this; cur = cur.parentNode || this) { 3154 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 3155 matchedHandlers = []; 3156 matchedSelectors = {}; 3157 for (i = 0; i < delegateCount; i++) { 3158 handleObj = handlers[i]; 3159 sel = handleObj.selector + " "; 3160 if (matchedSelectors[sel] === void 0) { 3161 matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length; 3162 } 3163 if (matchedSelectors[sel]) { 3164 matchedHandlers.push(handleObj); 3165 } 3166 } 3167 if (matchedHandlers.length) { 3168 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 3169 } 3170 } 3171 } 3172 } 3173 cur = this; 3174 if (delegateCount < handlers.length) { 3175 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 3176 } 3177 return handlerQueue; 3178 }, 3179 addProp: function(name, hook) { 3180 Object.defineProperty(jQuery.Event.prototype, name, { 3181 enumerable: true, 3182 configurable: true, 3183 get: isFunction(hook) ? function() { 3184 if (this.originalEvent) { 3185 return hook(this.originalEvent); 3186 } 3187 } : function() { 3188 if (this.originalEvent) { 3189 return this.originalEvent[name]; 3190 } 3191 }, 3192 set: function(value) { 3193 Object.defineProperty(this, name, { 3194 enumerable: true, 3195 configurable: true, 3196 writable: true, 3197 value 3198 }); 3199 } 3200 }); 3201 }, 3202 fix: function(originalEvent) { 3203 return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent); 3204 }, 3205 special: { 3206 load: { 3207 // Prevent triggered image.load events from bubbling to window.load 3208 noBubble: true 3209 }, 3210 click: { 3211 // Utilize native event to ensure correct state for checkable inputs 3212 setup: function(data) { 3213 var el = this || data; 3214 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3215 leverageNative(el, "click", returnTrue); 3216 } 3217 return false; 3218 }, 3219 trigger: function(data) { 3220 var el = this || data; 3221 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3222 leverageNative(el, "click"); 3223 } 3224 return true; 3225 }, 3226 // For cross-browser consistency, suppress native .click() on links 3227 // Also prevent it if we're currently inside a leveraged native-event stack 3228 _default: function(event) { 3229 var target = event.target; 3230 return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a"); 3231 } 3232 }, 3233 beforeunload: { 3234 postDispatch: function(event) { 3235 if (event.result !== void 0 && event.originalEvent) { 3236 event.originalEvent.returnValue = event.result; 3237 } 3238 } 3239 } 3240 } 3241 }; 3242 function leverageNative(el, type, expectSync2) { 3243 if (!expectSync2) { 3244 if (dataPriv.get(el, type) === void 0) { 3245 jQuery.event.add(el, type, returnTrue); 3246 } 3247 return; 3248 } 3249 dataPriv.set(el, type, false); 3250 jQuery.event.add(el, type, { 3251 namespace: false, 3252 handler: function(event) { 3253 var notAsync, result, saved = dataPriv.get(this, type); 3254 if (event.isTrigger & 1 && this[type]) { 3255 if (!saved.length) { 3256 saved = slice.call(arguments); 3257 dataPriv.set(this, type, saved); 3258 notAsync = expectSync2(this, type); 3259 this[type](); 3260 result = dataPriv.get(this, type); 3261 if (saved !== result || notAsync) { 3262 dataPriv.set(this, type, false); 3263 } else { 3264 result = {}; 3265 } 3266 if (saved !== result) { 3267 event.stopImmediatePropagation(); 3268 event.preventDefault(); 3269 return result.value; 3270 } 3271 } else if ((jQuery.event.special[type] || {}).delegateType) { 3272 event.stopPropagation(); 3273 } 3274 } else if (saved.length) { 3275 dataPriv.set(this, type, { 3276 value: jQuery.event.trigger( 3277 // Support: IE <=9 - 11+ 3278 // Extend with the prototype to reset the above stopImmediatePropagation() 3279 jQuery.extend(saved[0], jQuery.Event.prototype), 3280 saved.slice(1), 3281 this 3282 ) 3283 }); 3284 event.stopImmediatePropagation(); 3285 } 3286 } 3287 }); 3288 } 3289 jQuery.removeEvent = function(elem, type, handle2) { 3290 if (elem.removeEventListener) { 3291 elem.removeEventListener(type, handle2); 3292 } 3293 }; 3294 jQuery.Event = function(src, props) { 3295 if (!(this instanceof jQuery.Event)) { 3296 return new jQuery.Event(src, props); 3297 } 3298 if (src && src.type) { 3299 this.originalEvent = src; 3300 this.type = src.type; 3301 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && // Support: Android <=2.3 only 3302 src.returnValue === false ? returnTrue : returnFalse; 3303 this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target; 3304 this.currentTarget = src.currentTarget; 3305 this.relatedTarget = src.relatedTarget; 3306 } else { 3307 this.type = src; 3308 } 3309 if (props) { 3310 jQuery.extend(this, props); 3311 } 3312 this.timeStamp = src && src.timeStamp || Date.now(); 3313 this[jQuery.expando] = true; 3314 }; 3315 jQuery.Event.prototype = { 3316 constructor: jQuery.Event, 3317 isDefaultPrevented: returnFalse, 3318 isPropagationStopped: returnFalse, 3319 isImmediatePropagationStopped: returnFalse, 3320 isSimulated: false, 3321 preventDefault: function() { 3322 var e = this.originalEvent; 3323 this.isDefaultPrevented = returnTrue; 3324 if (e && !this.isSimulated) { 3325 e.preventDefault(); 3326 } 3327 }, 3328 stopPropagation: function() { 3329 var e = this.originalEvent; 3330 this.isPropagationStopped = returnTrue; 3331 if (e && !this.isSimulated) { 3332 e.stopPropagation(); 3333 } 3334 }, 3335 stopImmediatePropagation: function() { 3336 var e = this.originalEvent; 3337 this.isImmediatePropagationStopped = returnTrue; 3338 if (e && !this.isSimulated) { 3339 e.stopImmediatePropagation(); 3340 } 3341 this.stopPropagation(); 3342 } 3343 }; 3344 jQuery.each({ 3345 altKey: true, 3346 bubbles: true, 3347 cancelable: true, 3348 changedTouches: true, 3349 ctrlKey: true, 3350 detail: true, 3351 eventPhase: true, 3352 metaKey: true, 3353 pageX: true, 3354 pageY: true, 3355 shiftKey: true, 3356 view: true, 3357 "char": true, 3358 code: true, 3359 charCode: true, 3360 key: true, 3361 keyCode: true, 3362 button: true, 3363 buttons: true, 3364 clientX: true, 3365 clientY: true, 3366 offsetX: true, 3367 offsetY: true, 3368 pointerId: true, 3369 pointerType: true, 3370 screenX: true, 3371 screenY: true, 3372 targetTouches: true, 3373 toElement: true, 3374 touches: true, 3375 which: function(event) { 3376 var button = event.button; 3377 if (event.which == null && rkeyEvent.test(event.type)) { 3378 return event.charCode != null ? event.charCode : event.keyCode; 3379 } 3380 if (!event.which && button !== void 0 && rmouseEvent.test(event.type)) { 3381 if (button & 1) { 3382 return 1; 3383 } 3384 if (button & 2) { 3385 return 3; 3386 } 3387 if (button & 4) { 3388 return 2; 3389 } 3390 return 0; 3391 } 3392 return event.which; 3393 } 3394 }, jQuery.event.addProp); 3395 jQuery.each({ focus: "focusin", blur: "focusout" }, function(type, delegateType) { 3396 jQuery.event.special[type] = { 3397 // Utilize native event if possible so blur/focus sequence is correct 3398 setup: function() { 3399 leverageNative(this, type, expectSync); 3400 return false; 3401 }, 3402 trigger: function() { 3403 leverageNative(this, type); 3404 return true; 3405 }, 3406 delegateType 3407 }; 3408 }); 3409 jQuery.each({ 3410 mouseenter: "mouseover", 3411 mouseleave: "mouseout", 3412 pointerenter: "pointerover", 3413 pointerleave: "pointerout" 3414 }, function(orig, fix) { 3415 jQuery.event.special[orig] = { 3416 delegateType: fix, 3417 bindType: fix, 3418 handle: function(event) { 3419 var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; 3420 if (!related || related !== target && !jQuery.contains(target, related)) { 3421 event.type = handleObj.origType; 3422 ret = handleObj.handler.apply(this, arguments); 3423 event.type = fix; 3424 } 3425 return ret; 3426 } 3427 }; 3428 }); 3429 jQuery.fn.extend({ 3430 on: function(types, selector, data, fn) { 3431 return on(this, types, selector, data, fn); 3432 }, 3433 one: function(types, selector, data, fn) { 3434 return on(this, types, selector, data, fn, 1); 3435 }, 3436 off: function(types, selector, fn) { 3437 var handleObj, type; 3438 if (types && types.preventDefault && types.handleObj) { 3439 handleObj = types.handleObj; 3440 jQuery(types.delegateTarget).off( 3441 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 3442 handleObj.selector, 3443 handleObj.handler 3444 ); 3445 return this; 3446 } 3447 if (typeof types === "object") { 3448 for (type in types) { 3449 this.off(type, selector, types[type]); 3450 } 3451 return this; 3452 } 3453 if (selector === false || typeof selector === "function") { 3454 fn = selector; 3455 selector = void 0; 3456 } 3457 if (fn === false) { 3458 fn = returnFalse; 3459 } 3460 return this.each(function() { 3461 jQuery.event.remove(this, types, fn, selector); 3462 }); 3463 } 3464 }); 3465 var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 3466 function manipulationTarget(elem, content) { 3467 if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 3468 return jQuery(elem).children("tbody")[0] || elem; 3469 } 3470 return elem; 3471 } 3472 function disableScript(elem) { 3473 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 3474 return elem; 3475 } 3476 function restoreScript(elem) { 3477 if ((elem.type || "").slice(0, 5) === "true/") { 3478 elem.type = elem.type.slice(5); 3479 } else { 3480 elem.removeAttribute("type"); 3481 } 3482 return elem; 3483 } 3484 function cloneCopyEvent(src, dest) { 3485 var i, l, type, pdataOld, udataOld, udataCur, events; 3486 if (dest.nodeType !== 1) { 3487 return; 3488 } 3489 if (dataPriv.hasData(src)) { 3490 pdataOld = dataPriv.get(src); 3491 events = pdataOld.events; 3492 if (events) { 3493 dataPriv.remove(dest, "handle events"); 3494 for (type in events) { 3495 for (i = 0, l = events[type].length; i < l; i++) { 3496 jQuery.event.add(dest, type, events[type][i]); 3497 } 3498 } 3499 } 3500 } 3501 if (dataUser.hasData(src)) { 3502 udataOld = dataUser.access(src); 3503 udataCur = jQuery.extend({}, udataOld); 3504 dataUser.set(dest, udataCur); 3505 } 3506 } 3507 function fixInput(src, dest) { 3508 var nodeName2 = dest.nodeName.toLowerCase(); 3509 if (nodeName2 === "input" && rcheckableType.test(src.type)) { 3510 dest.checked = src.checked; 3511 } else if (nodeName2 === "input" || nodeName2 === "textarea") { 3512 dest.defaultValue = src.defaultValue; 3513 } 3514 } 3515 function domManip(collection, args, callback, ignored) { 3516 args = flat(args); 3517 var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction(value); 3518 if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) { 3519 return collection.each(function(index) { 3520 var self2 = collection.eq(index); 3521 if (valueIsFunction) { 3522 args[0] = value.call(this, index, self2.html()); 3523 } 3524 domManip(self2, args, callback, ignored); 3525 }); 3526 } 3527 if (l) { 3528 fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); 3529 first = fragment.firstChild; 3530 if (fragment.childNodes.length === 1) { 3531 fragment = first; 3532 } 3533 if (first || ignored) { 3534 scripts = jQuery.map(getAll(fragment, "script"), disableScript); 3535 hasScripts = scripts.length; 3536 for (; i < l; i++) { 3537 node = fragment; 3538 if (i !== iNoClone) { 3539 node = jQuery.clone(node, true, true); 3540 if (hasScripts) { 3541 jQuery.merge(scripts, getAll(node, "script")); 3542 } 3543 } 3544 callback.call(collection[i], node, i); 3545 } 3546 if (hasScripts) { 3547 doc = scripts[scripts.length - 1].ownerDocument; 3548 jQuery.map(scripts, restoreScript); 3549 for (i = 0; i < hasScripts; i++) { 3550 node = scripts[i]; 3551 if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) { 3552 if (node.src && (node.type || "").toLowerCase() !== "module") { 3553 if (jQuery._evalUrl && !node.noModule) { 3554 jQuery._evalUrl(node.src, { 3555 nonce: node.nonce || node.getAttribute("nonce") 3556 }, doc); 3557 } 3558 } else { 3559 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); 3560 } 3561 } 3562 } 3563 } 3564 } 3565 } 3566 return collection; 3567 } 3568 function remove2(elem, selector, keepData) { 3569 var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0; 3570 for (; (node = nodes[i]) != null; i++) { 3571 if (!keepData && node.nodeType === 1) { 3572 jQuery.cleanData(getAll(node)); 3573 } 3574 if (node.parentNode) { 3575 if (keepData && isAttached(node)) { 3576 setGlobalEval(getAll(node, "script")); 3577 } 3578 node.parentNode.removeChild(node); 3579 } 3580 } 3581 return elem; 3582 } 3583 jQuery.extend({ 3584 htmlPrefilter: function(html) { 3585 return html; 3586 }, 3587 clone: function(elem, dataAndEvents, deepDataAndEvents) { 3588 var i, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem); 3589 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { 3590 destElements = getAll(clone); 3591 srcElements = getAll(elem); 3592 for (i = 0, l = srcElements.length; i < l; i++) { 3593 fixInput(srcElements[i], destElements[i]); 3594 } 3595 } 3596 if (dataAndEvents) { 3597 if (deepDataAndEvents) { 3598 srcElements = srcElements || getAll(elem); 3599 destElements = destElements || getAll(clone); 3600 for (i = 0, l = srcElements.length; i < l; i++) { 3601 cloneCopyEvent(srcElements[i], destElements[i]); 3602 } 3603 } else { 3604 cloneCopyEvent(elem, clone); 3605 } 3606 } 3607 destElements = getAll(clone, "script"); 3608 if (destElements.length > 0) { 3609 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 3610 } 3611 return clone; 3612 }, 3613 cleanData: function(elems) { 3614 var data, elem, type, special = jQuery.event.special, i = 0; 3615 for (; (elem = elems[i]) !== void 0; i++) { 3616 if (acceptData(elem)) { 3617 if (data = elem[dataPriv.expando]) { 3618 if (data.events) { 3619 for (type in data.events) { 3620 if (special[type]) { 3621 jQuery.event.remove(elem, type); 3622 } else { 3623 jQuery.removeEvent(elem, type, data.handle); 3624 } 3625 } 3626 } 3627 elem[dataPriv.expando] = void 0; 3628 } 3629 if (elem[dataUser.expando]) { 3630 elem[dataUser.expando] = void 0; 3631 } 3632 } 3633 } 3634 } 3635 }); 3636 jQuery.fn.extend({ 3637 detach: function(selector) { 3638 return remove2(this, selector, true); 3639 }, 3640 remove: function(selector) { 3641 return remove2(this, selector); 3642 }, 3643 text: function(value) { 3644 return access(this, function(value2) { 3645 return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() { 3646 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3647 this.textContent = value2; 3648 } 3649 }); 3650 }, null, value, arguments.length); 3651 }, 3652 append: function() { 3653 return domManip(this, arguments, function(elem) { 3654 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3655 var target = manipulationTarget(this, elem); 3656 target.appendChild(elem); 3657 } 3658 }); 3659 }, 3660 prepend: function() { 3661 return domManip(this, arguments, function(elem) { 3662 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3663 var target = manipulationTarget(this, elem); 3664 target.insertBefore(elem, target.firstChild); 3665 } 3666 }); 3667 }, 3668 before: function() { 3669 return domManip(this, arguments, function(elem) { 3670 if (this.parentNode) { 3671 this.parentNode.insertBefore(elem, this); 3672 } 3673 }); 3674 }, 3675 after: function() { 3676 return domManip(this, arguments, function(elem) { 3677 if (this.parentNode) { 3678 this.parentNode.insertBefore(elem, this.nextSibling); 3679 } 3680 }); 3681 }, 3682 empty: function() { 3683 var elem, i = 0; 3684 for (; (elem = this[i]) != null; i++) { 3685 if (elem.nodeType === 1) { 3686 jQuery.cleanData(getAll(elem, false)); 3687 elem.textContent = ""; 3688 } 3689 } 3690 return this; 3691 }, 3692 clone: function(dataAndEvents, deepDataAndEvents) { 3693 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 3694 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 3695 return this.map(function() { 3696 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 3697 }); 3698 }, 3699 html: function(value) { 3700 return access(this, function(value2) { 3701 var elem = this[0] || {}, i = 0, l = this.length; 3702 if (value2 === void 0 && elem.nodeType === 1) { 3703 return elem.innerHTML; 3704 } 3705 if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) { 3706 value2 = jQuery.htmlPrefilter(value2); 3707 try { 3708 for (; i < l; i++) { 3709 elem = this[i] || {}; 3710 if (elem.nodeType === 1) { 3711 jQuery.cleanData(getAll(elem, false)); 3712 elem.innerHTML = value2; 3713 } 3714 } 3715 elem = 0; 3716 } catch (e) { 3717 } 3718 } 3719 if (elem) { 3720 this.empty().append(value2); 3721 } 3722 }, null, value, arguments.length); 3723 }, 3724 replaceWith: function() { 3725 var ignored = []; 3726 return domManip(this, arguments, function(elem) { 3727 var parent = this.parentNode; 3728 if (jQuery.inArray(this, ignored) < 0) { 3729 jQuery.cleanData(getAll(this)); 3730 if (parent) { 3731 parent.replaceChild(elem, this); 3732 } 3733 } 3734 }, ignored); 3735 } 3736 }); 3737 jQuery.each({ 3738 appendTo: "append", 3739 prependTo: "prepend", 3740 insertBefore: "before", 3741 insertAfter: "after", 3742 replaceAll: "replaceWith" 3743 }, function(name, original) { 3744 jQuery.fn[name] = function(selector) { 3745 var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0; 3746 for (; i <= last; i++) { 3747 elems = i === last ? this : this.clone(true); 3748 jQuery(insert[i])[original](elems); 3749 push.apply(ret, elems.get()); 3750 } 3751 return this.pushStack(ret); 3752 }; 3753 }); 3754 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 3755 var getStyles = function(elem) { 3756 var view = elem.ownerDocument.defaultView; 3757 if (!view || !view.opener) { 3758 view = window2; 3759 } 3760 return view.getComputedStyle(elem); 3761 }; 3762 var swap = function(elem, options, callback) { 3763 var ret, name, old = {}; 3764 for (name in options) { 3765 old[name] = elem.style[name]; 3766 elem.style[name] = options[name]; 3767 } 3768 ret = callback.call(elem); 3769 for (name in options) { 3770 elem.style[name] = old[name]; 3771 } 3772 return ret; 3773 }; 3774 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 3775 (function() { 3776 function computeStyleTests() { 3777 if (!div) { 3778 return; 3779 } 3780 container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0"; 3781 div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%"; 3782 documentElement.appendChild(container).appendChild(div); 3783 var divStyle = window2.getComputedStyle(div); 3784 pixelPositionVal = divStyle.top !== "1%"; 3785 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 3786 div.style.right = "60%"; 3787 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 3788 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 3789 div.style.position = "absolute"; 3790 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 3791 documentElement.removeChild(container); 3792 div = null; 3793 } 3794 function roundPixelMeasures(measure) { 3795 return Math.round(parseFloat(measure)); 3796 } 3797 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div"); 3798 if (!div.style) { 3799 return; 3800 } 3801 div.style.backgroundClip = "content-box"; 3802 div.cloneNode(true).style.backgroundClip = ""; 3803 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 3804 jQuery.extend(support, { 3805 boxSizingReliable: function() { 3806 computeStyleTests(); 3807 return boxSizingReliableVal; 3808 }, 3809 pixelBoxStyles: function() { 3810 computeStyleTests(); 3811 return pixelBoxStylesVal; 3812 }, 3813 pixelPosition: function() { 3814 computeStyleTests(); 3815 return pixelPositionVal; 3816 }, 3817 reliableMarginLeft: function() { 3818 computeStyleTests(); 3819 return reliableMarginLeftVal; 3820 }, 3821 scrollboxSize: function() { 3822 computeStyleTests(); 3823 return scrollboxSizeVal; 3824 }, 3825 // Support: IE 9 - 11+, Edge 15 - 18+ 3826 // IE/Edge misreport `getComputedStyle` of table rows with width/height 3827 // set in CSS while `offset*` properties report correct values. 3828 // Behavior in IE 9 is more subtle than in newer versions & it passes 3829 // some versions of this test; make sure not to make it pass there! 3830 reliableTrDimensions: function() { 3831 var table, tr, trChild, trStyle; 3832 if (reliableTrDimensionsVal == null) { 3833 table = document2.createElement("table"); 3834 tr = document2.createElement("tr"); 3835 trChild = document2.createElement("div"); 3836 table.style.cssText = "position:absolute;left:-11111px"; 3837 tr.style.height = "1px"; 3838 trChild.style.height = "9px"; 3839 documentElement.appendChild(table).appendChild(tr).appendChild(trChild); 3840 trStyle = window2.getComputedStyle(tr); 3841 reliableTrDimensionsVal = parseInt(trStyle.height) > 3; 3842 documentElement.removeChild(table); 3843 } 3844 return reliableTrDimensionsVal; 3845 } 3846 }); 3847 })(); 3848 function curCSS(elem, name, computed) { 3849 var width, minWidth, maxWidth, ret, style = elem.style; 3850 computed = computed || getStyles(elem); 3851 if (computed) { 3852 ret = computed.getPropertyValue(name) || computed[name]; 3853 if (ret === "" && !isAttached(elem)) { 3854 ret = jQuery.style(elem, name); 3855 } 3856 if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) { 3857 width = style.width; 3858 minWidth = style.minWidth; 3859 maxWidth = style.maxWidth; 3860 style.minWidth = style.maxWidth = style.width = ret; 3861 ret = computed.width; 3862 style.width = width; 3863 style.minWidth = minWidth; 3864 style.maxWidth = maxWidth; 3865 } 3866 } 3867 return ret !== void 0 ? ( 3868 // Support: IE <=9 - 11 only 3869 // IE returns zIndex value as an integer. 3870 ret + "" 3871 ) : ret; 3872 } 3873 function addGetHookIf(conditionFn, hookFn) { 3874 return { 3875 get: function() { 3876 if (conditionFn()) { 3877 delete this.get; 3878 return; 3879 } 3880 return (this.get = hookFn).apply(this, arguments); 3881 } 3882 }; 3883 } 3884 var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {}; 3885 function vendorPropName(name) { 3886 var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length; 3887 while (i--) { 3888 name = cssPrefixes[i] + capName; 3889 if (name in emptyStyle) { 3890 return name; 3891 } 3892 } 3893 } 3894 function finalPropName(name) { 3895 var final = jQuery.cssProps[name] || vendorProps[name]; 3896 if (final) { 3897 return final; 3898 } 3899 if (name in emptyStyle) { 3900 return name; 3901 } 3902 return vendorProps[name] = vendorPropName(name) || name; 3903 } 3904 var rdisplayswap = /^(none|table(?!-c[ea]).+)/, rcustomProp = /^--/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { 3905 letterSpacing: "0", 3906 fontWeight: "400" 3907 }; 3908 function setPositiveNumber(_elem, value, subtract) { 3909 var matches = rcssNum.exec(value); 3910 return matches ? ( 3911 // Guard against undefined "subtract", e.g., when used as in cssHooks 3912 Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") 3913 ) : value; 3914 } 3915 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 3916 var i = dimension === "width" ? 1 : 0, extra = 0, delta = 0; 3917 if (box === (isBorderBox ? "border" : "content")) { 3918 return 0; 3919 } 3920 for (; i < 4; i += 2) { 3921 if (box === "margin") { 3922 delta += jQuery.css(elem, box + cssExpand[i], true, styles); 3923 } 3924 if (!isBorderBox) { 3925 delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles); 3926 if (box !== "padding") { 3927 delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3928 } else { 3929 extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3930 } 3931 } else { 3932 if (box === "content") { 3933 delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); 3934 } 3935 if (box !== "margin") { 3936 delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3937 } 3938 } 3939 } 3940 if (!isBorderBox && computedVal >= 0) { 3941 delta += Math.max(0, Math.ceil( 3942 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5 3943 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 3944 // Use an explicit zero to avoid NaN (gh-3964) 3945 )) || 0; 3946 } 3947 return delta; 3948 } 3949 function getWidthOrHeight(elem, dimension, extra) { 3950 var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 3951 if (rnumnonpx.test(val)) { 3952 if (!extra) { 3953 return val; 3954 } 3955 val = "auto"; 3956 } 3957 if ((!support.boxSizingReliable() && isBorderBox || // Support: IE 10 - 11+, Edge 15 - 18+ 3958 // IE/Edge misreport `getComputedStyle` of table rows with width/height 3959 // set in CSS while `offset*` properties report correct values. 3960 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 3961 !support.reliableTrDimensions() && nodeName(elem, "tr") || // Fall back to offsetWidth/offsetHeight when value is "auto" 3962 // This happens for inline elements with no explicit setting (gh-3571) 3963 val === "auto" || // Support: Android <=4.1 - 4.3 only 3964 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 3965 !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && // Make sure the element is visible & connected 3966 elem.getClientRects().length) { 3967 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box"; 3968 valueIsBorderBox = offsetProp in elem; 3969 if (valueIsBorderBox) { 3970 val = elem[offsetProp]; 3971 } 3972 } 3973 val = parseFloat(val) || 0; 3974 return val + boxModelAdjustment( 3975 elem, 3976 dimension, 3977 extra || (isBorderBox ? "border" : "content"), 3978 valueIsBorderBox, 3979 styles, 3980 // Provide the current computed size to request scroll gutter calculation (gh-3589) 3981 val 3982 ) + "px"; 3983 } 3984 jQuery.extend({ 3985 // Add in style property hooks for overriding the default 3986 // behavior of getting and setting a style property 3987 cssHooks: { 3988 opacity: { 3989 get: function(elem, computed) { 3990 if (computed) { 3991 var ret = curCSS(elem, "opacity"); 3992 return ret === "" ? "1" : ret; 3993 } 3994 } 3995 } 3996 }, 3997 // Don't automatically add "px" to these possibly-unitless properties 3998 cssNumber: { 3999 "animationIterationCount": true, 4000 "columnCount": true, 4001 "fillOpacity": true, 4002 "flexGrow": true, 4003 "flexShrink": true, 4004 "fontWeight": true, 4005 "gridArea": true, 4006 "gridColumn": true, 4007 "gridColumnEnd": true, 4008 "gridColumnStart": true, 4009 "gridRow": true, 4010 "gridRowEnd": true, 4011 "gridRowStart": true, 4012 "lineHeight": true, 4013 "opacity": true, 4014 "order": true, 4015 "orphans": true, 4016 "widows": true, 4017 "zIndex": true, 4018 "zoom": true 4019 }, 4020 // Add in properties whose names you wish to fix before 4021 // setting or getting the value 4022 cssProps: {}, 4023 // Get and set the style property on a DOM Node 4024 style: function(elem, name, value, extra) { 4025 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 4026 return; 4027 } 4028 var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style; 4029 if (!isCustomProp) { 4030 name = finalPropName(origName); 4031 } 4032 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 4033 if (value !== void 0) { 4034 type = typeof value; 4035 if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { 4036 value = adjustCSS(elem, name, ret); 4037 type = "number"; 4038 } 4039 if (value == null || value !== value) { 4040 return; 4041 } 4042 if (type === "number" && !isCustomProp) { 4043 value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px"); 4044 } 4045 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 4046 style[name] = "inherit"; 4047 } 4048 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== void 0) { 4049 if (isCustomProp) { 4050 style.setProperty(name, value); 4051 } else { 4052 style[name] = value; 4053 } 4054 } 4055 } else { 4056 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== void 0) { 4057 return ret; 4058 } 4059 return style[name]; 4060 } 4061 }, 4062 css: function(elem, name, extra, styles) { 4063 var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name); 4064 if (!isCustomProp) { 4065 name = finalPropName(origName); 4066 } 4067 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 4068 if (hooks && "get" in hooks) { 4069 val = hooks.get(elem, true, extra); 4070 } 4071 if (val === void 0) { 4072 val = curCSS(elem, name, styles); 4073 } 4074 if (val === "normal" && name in cssNormalTransform) { 4075 val = cssNormalTransform[name]; 4076 } 4077 if (extra === "" || extra) { 4078 num = parseFloat(val); 4079 return extra === true || isFinite(num) ? num || 0 : val; 4080 } 4081 return val; 4082 } 4083 }); 4084 jQuery.each(["height", "width"], function(_i, dimension) { 4085 jQuery.cssHooks[dimension] = { 4086 get: function(elem, computed, extra) { 4087 if (computed) { 4088 return rdisplayswap.test(jQuery.css(elem, "display")) && // Support: Safari 8+ 4089 // Table columns in Safari have non-zero offsetWidth & zero 4090 // getBoundingClientRect().width unless display is changed. 4091 // Support: IE <=11 only 4092 // Running getBoundingClientRect on a disconnected node 4093 // in IE throws an error. 4094 (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() { 4095 return getWidthOrHeight(elem, dimension, extra); 4096 }) : getWidthOrHeight(elem, dimension, extra); 4097 } 4098 }, 4099 set: function(elem, value, extra) { 4100 var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment( 4101 elem, 4102 dimension, 4103 extra, 4104 isBorderBox, 4105 styles 4106 ) : 0; 4107 if (isBorderBox && scrollboxSizeBuggy) { 4108 subtract -= Math.ceil( 4109 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5 4110 ); 4111 } 4112 if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") { 4113 elem.style[dimension] = value; 4114 value = jQuery.css(elem, dimension); 4115 } 4116 return setPositiveNumber(elem, value, subtract); 4117 } 4118 }; 4119 }); 4120 jQuery.cssHooks.marginLeft = addGetHookIf( 4121 support.reliableMarginLeft, 4122 function(elem, computed) { 4123 if (computed) { 4124 return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() { 4125 return elem.getBoundingClientRect().left; 4126 })) + "px"; 4127 } 4128 } 4129 ); 4130 jQuery.each({ 4131 margin: "", 4132 padding: "", 4133 border: "Width" 4134 }, function(prefix, suffix) { 4135 jQuery.cssHooks[prefix + suffix] = { 4136 expand: function(value) { 4137 var i = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value]; 4138 for (; i < 4; i++) { 4139 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; 4140 } 4141 return expanded; 4142 } 4143 }; 4144 if (prefix !== "margin") { 4145 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; 4146 } 4147 }); 4148 jQuery.fn.extend({ 4149 css: function(name, value) { 4150 return access(this, function(elem, name2, value2) { 4151 var styles, len, map = {}, i = 0; 4152 if (Array.isArray(name2)) { 4153 styles = getStyles(elem); 4154 len = name2.length; 4155 for (; i < len; i++) { 4156 map[name2[i]] = jQuery.css(elem, name2[i], false, styles); 4157 } 4158 return map; 4159 } 4160 return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2); 4161 }, name, value, arguments.length > 1); 4162 } 4163 }); 4164 function Tween(elem, options, prop, end, easing) { 4165 return new Tween.prototype.init(elem, options, prop, end, easing); 4166 } 4167 jQuery.Tween = Tween; 4168 Tween.prototype = { 4169 constructor: Tween, 4170 init: function(elem, options, prop, end, easing, unit) { 4171 this.elem = elem; 4172 this.prop = prop; 4173 this.easing = easing || jQuery.easing._default; 4174 this.options = options; 4175 this.start = this.now = this.cur(); 4176 this.end = end; 4177 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); 4178 }, 4179 cur: function() { 4180 var hooks = Tween.propHooks[this.prop]; 4181 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); 4182 }, 4183 run: function(percent) { 4184 var eased, hooks = Tween.propHooks[this.prop]; 4185 if (this.options.duration) { 4186 this.pos = eased = jQuery.easing[this.easing]( 4187 percent, 4188 this.options.duration * percent, 4189 0, 4190 1, 4191 this.options.duration 4192 ); 4193 } else { 4194 this.pos = eased = percent; 4195 } 4196 this.now = (this.end - this.start) * eased + this.start; 4197 if (this.options.step) { 4198 this.options.step.call(this.elem, this.now, this); 4199 } 4200 if (hooks && hooks.set) { 4201 hooks.set(this); 4202 } else { 4203 Tween.propHooks._default.set(this); 4204 } 4205 return this; 4206 } 4207 }; 4208 Tween.prototype.init.prototype = Tween.prototype; 4209 Tween.propHooks = { 4210 _default: { 4211 get: function(tween) { 4212 var result; 4213 if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 4214 return tween.elem[tween.prop]; 4215 } 4216 result = jQuery.css(tween.elem, tween.prop, ""); 4217 return !result || result === "auto" ? 0 : result; 4218 }, 4219 set: function(tween) { 4220 if (jQuery.fx.step[tween.prop]) { 4221 jQuery.fx.step[tween.prop](tween); 4222 } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) { 4223 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 4224 } else { 4225 tween.elem[tween.prop] = tween.now; 4226 } 4227 } 4228 } 4229 }; 4230 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 4231 set: function(tween) { 4232 if (tween.elem.nodeType && tween.elem.parentNode) { 4233 tween.elem[tween.prop] = tween.now; 4234 } 4235 } 4236 }; 4237 jQuery.easing = { 4238 linear: function(p) { 4239 return p; 4240 }, 4241 swing: function(p) { 4242 return 0.5 - Math.cos(p * Math.PI) / 2; 4243 }, 4244 _default: "swing" 4245 }; 4246 jQuery.fx = Tween.prototype.init; 4247 jQuery.fx.step = {}; 4248 var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; 4249 function schedule() { 4250 if (inProgress) { 4251 if (document2.hidden === false && window2.requestAnimationFrame) { 4252 window2.requestAnimationFrame(schedule); 4253 } else { 4254 window2.setTimeout(schedule, jQuery.fx.interval); 4255 } 4256 jQuery.fx.tick(); 4257 } 4258 } 4259 function createFxNow() { 4260 window2.setTimeout(function() { 4261 fxNow = void 0; 4262 }); 4263 return fxNow = Date.now(); 4264 } 4265 function genFx(type, includeWidth) { 4266 var which, i = 0, attrs = { height: type }; 4267 includeWidth = includeWidth ? 1 : 0; 4268 for (; i < 4; i += 2 - includeWidth) { 4269 which = cssExpand[i]; 4270 attrs["margin" + which] = attrs["padding" + which] = type; 4271 } 4272 if (includeWidth) { 4273 attrs.opacity = attrs.width = type; 4274 } 4275 return attrs; 4276 } 4277 function createTween(value, prop, animation) { 4278 var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index = 0, length = collection.length; 4279 for (; index < length; index++) { 4280 if (tween = collection[index].call(animation, prop, value)) { 4281 return tween; 4282 } 4283 } 4284 } 4285 function defaultPrefilter(elem, props, opts) { 4286 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"); 4287 if (!opts.queue) { 4288 hooks = jQuery._queueHooks(elem, "fx"); 4289 if (hooks.unqueued == null) { 4290 hooks.unqueued = 0; 4291 oldfire = hooks.empty.fire; 4292 hooks.empty.fire = function() { 4293 if (!hooks.unqueued) { 4294 oldfire(); 4295 } 4296 }; 4297 } 4298 hooks.unqueued++; 4299 anim.always(function() { 4300 anim.always(function() { 4301 hooks.unqueued--; 4302 if (!jQuery.queue(elem, "fx").length) { 4303 hooks.empty.fire(); 4304 } 4305 }); 4306 }); 4307 } 4308 for (prop in props) { 4309 value = props[prop]; 4310 if (rfxtypes.test(value)) { 4311 delete props[prop]; 4312 toggle = toggle || value === "toggle"; 4313 if (value === (hidden ? "hide" : "show")) { 4314 if (value === "show" && dataShow && dataShow[prop] !== void 0) { 4315 hidden = true; 4316 } else { 4317 continue; 4318 } 4319 } 4320 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); 4321 } 4322 } 4323 propTween = !jQuery.isEmptyObject(props); 4324 if (!propTween && jQuery.isEmptyObject(orig)) { 4325 return; 4326 } 4327 if (isBox && elem.nodeType === 1) { 4328 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 4329 restoreDisplay = dataShow && dataShow.display; 4330 if (restoreDisplay == null) { 4331 restoreDisplay = dataPriv.get(elem, "display"); 4332 } 4333 display = jQuery.css(elem, "display"); 4334 if (display === "none") { 4335 if (restoreDisplay) { 4336 display = restoreDisplay; 4337 } else { 4338 showHide([elem], true); 4339 restoreDisplay = elem.style.display || restoreDisplay; 4340 display = jQuery.css(elem, "display"); 4341 showHide([elem]); 4342 } 4343 } 4344 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 4345 if (jQuery.css(elem, "float") === "none") { 4346 if (!propTween) { 4347 anim.done(function() { 4348 style.display = restoreDisplay; 4349 }); 4350 if (restoreDisplay == null) { 4351 display = style.display; 4352 restoreDisplay = display === "none" ? "" : display; 4353 } 4354 } 4355 style.display = "inline-block"; 4356 } 4357 } 4358 } 4359 if (opts.overflow) { 4360 style.overflow = "hidden"; 4361 anim.always(function() { 4362 style.overflow = opts.overflow[0]; 4363 style.overflowX = opts.overflow[1]; 4364 style.overflowY = opts.overflow[2]; 4365 }); 4366 } 4367 propTween = false; 4368 for (prop in orig) { 4369 if (!propTween) { 4370 if (dataShow) { 4371 if ("hidden" in dataShow) { 4372 hidden = dataShow.hidden; 4373 } 4374 } else { 4375 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 4376 } 4377 if (toggle) { 4378 dataShow.hidden = !hidden; 4379 } 4380 if (hidden) { 4381 showHide([elem], true); 4382 } 4383 anim.done(function() { 4384 if (!hidden) { 4385 showHide([elem]); 4386 } 4387 dataPriv.remove(elem, "fxshow"); 4388 for (prop in orig) { 4389 jQuery.style(elem, prop, orig[prop]); 4390 } 4391 }); 4392 } 4393 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 4394 if (!(prop in dataShow)) { 4395 dataShow[prop] = propTween.start; 4396 if (hidden) { 4397 propTween.end = propTween.start; 4398 propTween.start = 0; 4399 } 4400 } 4401 } 4402 } 4403 function propFilter(props, specialEasing) { 4404 var index, name, easing, value, hooks; 4405 for (index in props) { 4406 name = camelCase(index); 4407 easing = specialEasing[name]; 4408 value = props[index]; 4409 if (Array.isArray(value)) { 4410 easing = value[1]; 4411 value = props[index] = value[0]; 4412 } 4413 if (index !== name) { 4414 props[name] = value; 4415 delete props[index]; 4416 } 4417 hooks = jQuery.cssHooks[name]; 4418 if (hooks && "expand" in hooks) { 4419 value = hooks.expand(value); 4420 delete props[name]; 4421 for (index in value) { 4422 if (!(index in props)) { 4423 props[index] = value[index]; 4424 specialEasing[index] = easing; 4425 } 4426 } 4427 } else { 4428 specialEasing[name] = easing; 4429 } 4430 } 4431 } 4432 function Animation(elem, properties, options) { 4433 var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function() { 4434 delete tick.elem; 4435 }), tick = function() { 4436 if (stopped) { 4437 return false; 4438 } 4439 var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index2 = 0, length2 = animation.tweens.length; 4440 for (; index2 < length2; index2++) { 4441 animation.tweens[index2].run(percent); 4442 } 4443 deferred.notifyWith(elem, [animation, percent, remaining]); 4444 if (percent < 1 && length2) { 4445 return remaining; 4446 } 4447 if (!length2) { 4448 deferred.notifyWith(elem, [animation, 1, 0]); 4449 } 4450 deferred.resolveWith(elem, [animation]); 4451 return false; 4452 }, animation = deferred.promise({ 4453 elem, 4454 props: jQuery.extend({}, properties), 4455 opts: jQuery.extend(true, { 4456 specialEasing: {}, 4457 easing: jQuery.easing._default 4458 }, options), 4459 originalProperties: properties, 4460 originalOptions: options, 4461 startTime: fxNow || createFxNow(), 4462 duration: options.duration, 4463 tweens: [], 4464 createTween: function(prop, end) { 4465 var tween = jQuery.Tween( 4466 elem, 4467 animation.opts, 4468 prop, 4469 end, 4470 animation.opts.specialEasing[prop] || animation.opts.easing 4471 ); 4472 animation.tweens.push(tween); 4473 return tween; 4474 }, 4475 stop: function(gotoEnd) { 4476 var index2 = 0, length2 = gotoEnd ? animation.tweens.length : 0; 4477 if (stopped) { 4478 return this; 4479 } 4480 stopped = true; 4481 for (; index2 < length2; index2++) { 4482 animation.tweens[index2].run(1); 4483 } 4484 if (gotoEnd) { 4485 deferred.notifyWith(elem, [animation, 1, 0]); 4486 deferred.resolveWith(elem, [animation, gotoEnd]); 4487 } else { 4488 deferred.rejectWith(elem, [animation, gotoEnd]); 4489 } 4490 return this; 4491 } 4492 }), props = animation.props; 4493 propFilter(props, animation.opts.specialEasing); 4494 for (; index < length; index++) { 4495 result = Animation.prefilters[index].call(animation, elem, props, animation.opts); 4496 if (result) { 4497 if (isFunction(result.stop)) { 4498 jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result); 4499 } 4500 return result; 4501 } 4502 } 4503 jQuery.map(props, createTween, animation); 4504 if (isFunction(animation.opts.start)) { 4505 animation.opts.start.call(elem, animation); 4506 } 4507 animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always); 4508 jQuery.fx.timer( 4509 jQuery.extend(tick, { 4510 elem, 4511 anim: animation, 4512 queue: animation.opts.queue 4513 }) 4514 ); 4515 return animation; 4516 } 4517 jQuery.Animation = jQuery.extend(Animation, { 4518 tweeners: { 4519 "*": [function(prop, value) { 4520 var tween = this.createTween(prop, value); 4521 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 4522 return tween; 4523 }] 4524 }, 4525 tweener: function(props, callback) { 4526 if (isFunction(props)) { 4527 callback = props; 4528 props = ["*"]; 4529 } else { 4530 props = props.match(rnothtmlwhite); 4531 } 4532 var prop, index = 0, length = props.length; 4533 for (; index < length; index++) { 4534 prop = props[index]; 4535 Animation.tweeners[prop] = Animation.tweeners[prop] || []; 4536 Animation.tweeners[prop].unshift(callback); 4537 } 4538 }, 4539 prefilters: [defaultPrefilter], 4540 prefilter: function(callback, prepend) { 4541 if (prepend) { 4542 Animation.prefilters.unshift(callback); 4543 } else { 4544 Animation.prefilters.push(callback); 4545 } 4546 } 4547 }); 4548 jQuery.speed = function(speed, easing, fn) { 4549 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 4550 complete: fn || !fn && easing || isFunction(speed) && speed, 4551 duration: speed, 4552 easing: fn && easing || easing && !isFunction(easing) && easing 4553 }; 4554 if (jQuery.fx.off) { 4555 opt.duration = 0; 4556 } else { 4557 if (typeof opt.duration !== "number") { 4558 if (opt.duration in jQuery.fx.speeds) { 4559 opt.duration = jQuery.fx.speeds[opt.duration]; 4560 } else { 4561 opt.duration = jQuery.fx.speeds._default; 4562 } 4563 } 4564 } 4565 if (opt.queue == null || opt.queue === true) { 4566 opt.queue = "fx"; 4567 } 4568 opt.old = opt.complete; 4569 opt.complete = function() { 4570 if (isFunction(opt.old)) { 4571 opt.old.call(this); 4572 } 4573 if (opt.queue) { 4574 jQuery.dequeue(this, opt.queue); 4575 } 4576 }; 4577 return opt; 4578 }; 4579 jQuery.fn.extend({ 4580 fadeTo: function(speed, to, easing, callback) { 4581 return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback); 4582 }, 4583 animate: function(prop, speed, easing, callback) { 4584 var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function() { 4585 var anim = Animation(this, jQuery.extend({}, prop), optall); 4586 if (empty || dataPriv.get(this, "finish")) { 4587 anim.stop(true); 4588 } 4589 }; 4590 doAnimation.finish = doAnimation; 4591 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); 4592 }, 4593 stop: function(type, clearQueue, gotoEnd) { 4594 var stopQueue = function(hooks) { 4595 var stop = hooks.stop; 4596 delete hooks.stop; 4597 stop(gotoEnd); 4598 }; 4599 if (typeof type !== "string") { 4600 gotoEnd = clearQueue; 4601 clearQueue = type; 4602 type = void 0; 4603 } 4604 if (clearQueue) { 4605 this.queue(type || "fx", []); 4606 } 4607 return this.each(function() { 4608 var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this); 4609 if (index) { 4610 if (data[index] && data[index].stop) { 4611 stopQueue(data[index]); 4612 } 4613 } else { 4614 for (index in data) { 4615 if (data[index] && data[index].stop && rrun.test(index)) { 4616 stopQueue(data[index]); 4617 } 4618 } 4619 } 4620 for (index = timers.length; index--; ) { 4621 if (timers[index].elem === this && (type == null || timers[index].queue === type)) { 4622 timers[index].anim.stop(gotoEnd); 4623 dequeue = false; 4624 timers.splice(index, 1); 4625 } 4626 } 4627 if (dequeue || !gotoEnd) { 4628 jQuery.dequeue(this, type); 4629 } 4630 }); 4631 }, 4632 finish: function(type) { 4633 if (type !== false) { 4634 type = type || "fx"; 4635 } 4636 return this.each(function() { 4637 var index, data = dataPriv.get(this), queue = data[type + "queue"], hooks = data[type + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0; 4638 data.finish = true; 4639 jQuery.queue(this, type, []); 4640 if (hooks && hooks.stop) { 4641 hooks.stop.call(this, true); 4642 } 4643 for (index = timers.length; index--; ) { 4644 if (timers[index].elem === this && timers[index].queue === type) { 4645 timers[index].anim.stop(true); 4646 timers.splice(index, 1); 4647 } 4648 } 4649 for (index = 0; index < length; index++) { 4650 if (queue[index] && queue[index].finish) { 4651 queue[index].finish.call(this); 4652 } 4653 } 4654 delete data.finish; 4655 }); 4656 } 4657 }); 4658 jQuery.each(["toggle", "show", "hide"], function(_i, name) { 4659 var cssFn = jQuery.fn[name]; 4660 jQuery.fn[name] = function(speed, easing, callback) { 4661 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); 4662 }; 4663 }); 4664 jQuery.each({ 4665 slideDown: genFx("show"), 4666 slideUp: genFx("hide"), 4667 slideToggle: genFx("toggle"), 4668 fadeIn: { opacity: "show" }, 4669 fadeOut: { opacity: "hide" }, 4670 fadeToggle: { opacity: "toggle" } 4671 }, function(name, props) { 4672 jQuery.fn[name] = function(speed, easing, callback) { 4673 return this.animate(props, speed, easing, callback); 4674 }; 4675 }); 4676 jQuery.timers = []; 4677 jQuery.fx.tick = function() { 4678 var timer, i = 0, timers = jQuery.timers; 4679 fxNow = Date.now(); 4680 for (; i < timers.length; i++) { 4681 timer = timers[i]; 4682 if (!timer() && timers[i] === timer) { 4683 timers.splice(i--, 1); 4684 } 4685 } 4686 if (!timers.length) { 4687 jQuery.fx.stop(); 4688 } 4689 fxNow = void 0; 4690 }; 4691 jQuery.fx.timer = function(timer) { 4692 jQuery.timers.push(timer); 4693 jQuery.fx.start(); 4694 }; 4695 jQuery.fx.interval = 13; 4696 jQuery.fx.start = function() { 4697 if (inProgress) { 4698 return; 4699 } 4700 inProgress = true; 4701 schedule(); 4702 }; 4703 jQuery.fx.stop = function() { 4704 inProgress = null; 4705 }; 4706 jQuery.fx.speeds = { 4707 slow: 600, 4708 fast: 200, 4709 // Default speed 4710 _default: 400 4711 }; 4712 jQuery.fn.delay = function(time, type) { 4713 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 4714 type = type || "fx"; 4715 return this.queue(type, function(next, hooks) { 4716 var timeout = window2.setTimeout(next, time); 4717 hooks.stop = function() { 4718 window2.clearTimeout(timeout); 4719 }; 4720 }); 4721 }; 4722 (function() { 4723 var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option")); 4724 input.type = "checkbox"; 4725 support.checkOn = input.value !== ""; 4726 support.optSelected = opt.selected; 4727 input = document2.createElement("input"); 4728 input.value = "t"; 4729 input.type = "radio"; 4730 support.radioValue = input.value === "t"; 4731 })(); 4732 var boolHook, attrHandle = jQuery.expr.attrHandle; 4733 jQuery.fn.extend({ 4734 attr: function(name, value) { 4735 return access(this, jQuery.attr, name, value, arguments.length > 1); 4736 }, 4737 removeAttr: function(name) { 4738 return this.each(function() { 4739 jQuery.removeAttr(this, name); 4740 }); 4741 } 4742 }); 4743 jQuery.extend({ 4744 attr: function(elem, name, value) { 4745 var ret, hooks, nType = elem.nodeType; 4746 if (nType === 3 || nType === 8 || nType === 2) { 4747 return; 4748 } 4749 if (typeof elem.getAttribute === "undefined") { 4750 return jQuery.prop(elem, name, value); 4751 } 4752 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 4753 hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0); 4754 } 4755 if (value !== void 0) { 4756 if (value === null) { 4757 jQuery.removeAttr(elem, name); 4758 return; 4759 } 4760 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) { 4761 return ret; 4762 } 4763 elem.setAttribute(name, value + ""); 4764 return value; 4765 } 4766 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4767 return ret; 4768 } 4769 ret = jQuery.find.attr(elem, name); 4770 return ret == null ? void 0 : ret; 4771 }, 4772 attrHooks: { 4773 type: { 4774 set: function(elem, value) { 4775 if (!support.radioValue && value === "radio" && nodeName(elem, "input")) { 4776 var val = elem.value; 4777 elem.setAttribute("type", value); 4778 if (val) { 4779 elem.value = val; 4780 } 4781 return value; 4782 } 4783 } 4784 } 4785 }, 4786 removeAttr: function(elem, value) { 4787 var name, i = 0, attrNames = value && value.match(rnothtmlwhite); 4788 if (attrNames && elem.nodeType === 1) { 4789 while (name = attrNames[i++]) { 4790 elem.removeAttribute(name); 4791 } 4792 } 4793 } 4794 }); 4795 boolHook = { 4796 set: function(elem, value, name) { 4797 if (value === false) { 4798 jQuery.removeAttr(elem, name); 4799 } else { 4800 elem.setAttribute(name, name); 4801 } 4802 return name; 4803 } 4804 }; 4805 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i, name) { 4806 var getter = attrHandle[name] || jQuery.find.attr; 4807 attrHandle[name] = function(elem, name2, isXML) { 4808 var ret, handle2, lowercaseName = name2.toLowerCase(); 4809 if (!isXML) { 4810 handle2 = attrHandle[lowercaseName]; 4811 attrHandle[lowercaseName] = ret; 4812 ret = getter(elem, name2, isXML) != null ? lowercaseName : null; 4813 attrHandle[lowercaseName] = handle2; 4814 } 4815 return ret; 4816 }; 4817 }); 4818 var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; 4819 jQuery.fn.extend({ 4820 prop: function(name, value) { 4821 return access(this, jQuery.prop, name, value, arguments.length > 1); 4822 }, 4823 removeProp: function(name) { 4824 return this.each(function() { 4825 delete this[jQuery.propFix[name] || name]; 4826 }); 4827 } 4828 }); 4829 jQuery.extend({ 4830 prop: function(elem, name, value) { 4831 var ret, hooks, nType = elem.nodeType; 4832 if (nType === 3 || nType === 8 || nType === 2) { 4833 return; 4834 } 4835 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 4836 name = jQuery.propFix[name] || name; 4837 hooks = jQuery.propHooks[name]; 4838 } 4839 if (value !== void 0) { 4840 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) { 4841 return ret; 4842 } 4843 return elem[name] = value; 4844 } 4845 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4846 return ret; 4847 } 4848 return elem[name]; 4849 }, 4850 propHooks: { 4851 tabIndex: { 4852 get: function(elem) { 4853 var tabindex = jQuery.find.attr(elem, "tabindex"); 4854 if (tabindex) { 4855 return parseInt(tabindex, 10); 4856 } 4857 if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) { 4858 return 0; 4859 } 4860 return -1; 4861 } 4862 } 4863 }, 4864 propFix: { 4865 "for": "htmlFor", 4866 "class": "className" 4867 } 4868 }); 4869 if (!support.optSelected) { 4870 jQuery.propHooks.selected = { 4871 get: function(elem) { 4872 var parent = elem.parentNode; 4873 if (parent && parent.parentNode) { 4874 parent.parentNode.selectedIndex; 4875 } 4876 return null; 4877 }, 4878 set: function(elem) { 4879 var parent = elem.parentNode; 4880 if (parent) { 4881 parent.selectedIndex; 4882 if (parent.parentNode) { 4883 parent.parentNode.selectedIndex; 4884 } 4885 } 4886 } 4887 }; 4888 } 4889 jQuery.each([ 4890 "tabIndex", 4891 "readOnly", 4892 "maxLength", 4893 "cellSpacing", 4894 "cellPadding", 4895 "rowSpan", 4896 "colSpan", 4897 "useMap", 4898 "frameBorder", 4899 "contentEditable" 4900 ], function() { 4901 jQuery.propFix[this.toLowerCase()] = this; 4902 }); 4903 function stripAndCollapse(value) { 4904 var tokens = value.match(rnothtmlwhite) || []; 4905 return tokens.join(" "); 4906 } 4907 function getClass(elem) { 4908 return elem.getAttribute && elem.getAttribute("class") || ""; 4909 } 4910 function classesToArray(value) { 4911 if (Array.isArray(value)) { 4912 return value; 4913 } 4914 if (typeof value === "string") { 4915 return value.match(rnothtmlwhite) || []; 4916 } 4917 return []; 4918 } 4919 jQuery.fn.extend({ 4920 addClass: function(value) { 4921 var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; 4922 if (isFunction(value)) { 4923 return this.each(function(j2) { 4924 jQuery(this).addClass(value.call(this, j2, getClass(this))); 4925 }); 4926 } 4927 classes = classesToArray(value); 4928 if (classes.length) { 4929 while (elem = this[i++]) { 4930 curValue = getClass(elem); 4931 cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4932 if (cur) { 4933 j = 0; 4934 while (clazz = classes[j++]) { 4935 if (cur.indexOf(" " + clazz + " ") < 0) { 4936 cur += clazz + " "; 4937 } 4938 } 4939 finalValue = stripAndCollapse(cur); 4940 if (curValue !== finalValue) { 4941 elem.setAttribute("class", finalValue); 4942 } 4943 } 4944 } 4945 } 4946 return this; 4947 }, 4948 removeClass: function(value) { 4949 var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; 4950 if (isFunction(value)) { 4951 return this.each(function(j2) { 4952 jQuery(this).removeClass(value.call(this, j2, getClass(this))); 4953 }); 4954 } 4955 if (!arguments.length) { 4956 return this.attr("class", ""); 4957 } 4958 classes = classesToArray(value); 4959 if (classes.length) { 4960 while (elem = this[i++]) { 4961 curValue = getClass(elem); 4962 cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4963 if (cur) { 4964 j = 0; 4965 while (clazz = classes[j++]) { 4966 while (cur.indexOf(" " + clazz + " ") > -1) { 4967 cur = cur.replace(" " + clazz + " ", " "); 4968 } 4969 } 4970 finalValue = stripAndCollapse(cur); 4971 if (curValue !== finalValue) { 4972 elem.setAttribute("class", finalValue); 4973 } 4974 } 4975 } 4976 } 4977 return this; 4978 }, 4979 toggleClass: function(value, stateVal) { 4980 var type = typeof value, isValidValue = type === "string" || Array.isArray(value); 4981 if (typeof stateVal === "boolean" && isValidValue) { 4982 return stateVal ? this.addClass(value) : this.removeClass(value); 4983 } 4984 if (isFunction(value)) { 4985 return this.each(function(i) { 4986 jQuery(this).toggleClass( 4987 value.call(this, i, getClass(this), stateVal), 4988 stateVal 4989 ); 4990 }); 4991 } 4992 return this.each(function() { 4993 var className, i, self2, classNames; 4994 if (isValidValue) { 4995 i = 0; 4996 self2 = jQuery(this); 4997 classNames = classesToArray(value); 4998 while (className = classNames[i++]) { 4999 if (self2.hasClass(className)) { 5000 self2.removeClass(className); 5001 } else { 5002 self2.addClass(className); 5003 } 5004 } 5005 } else if (value === void 0 || type === "boolean") { 5006 className = getClass(this); 5007 if (className) { 5008 dataPriv.set(this, "__className__", className); 5009 } 5010 if (this.setAttribute) { 5011 this.setAttribute( 5012 "class", 5013 className || value === false ? "" : dataPriv.get(this, "__className__") || "" 5014 ); 5015 } 5016 } 5017 }); 5018 }, 5019 hasClass: function(selector) { 5020 var className, elem, i = 0; 5021 className = " " + selector + " "; 5022 while (elem = this[i++]) { 5023 if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 5024 return true; 5025 } 5026 } 5027 return false; 5028 } 5029 }); 5030 var rreturn = /\r/g; 5031 jQuery.fn.extend({ 5032 val: function(value) { 5033 var hooks, ret, valueIsFunction, elem = this[0]; 5034 if (!arguments.length) { 5035 if (elem) { 5036 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; 5037 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== void 0) { 5038 return ret; 5039 } 5040 ret = elem.value; 5041 if (typeof ret === "string") { 5042 return ret.replace(rreturn, ""); 5043 } 5044 return ret == null ? "" : ret; 5045 } 5046 return; 5047 } 5048 valueIsFunction = isFunction(value); 5049 return this.each(function(i) { 5050 var val; 5051 if (this.nodeType !== 1) { 5052 return; 5053 } 5054 if (valueIsFunction) { 5055 val = value.call(this, i, jQuery(this).val()); 5056 } else { 5057 val = value; 5058 } 5059 if (val == null) { 5060 val = ""; 5061 } else if (typeof val === "number") { 5062 val += ""; 5063 } else if (Array.isArray(val)) { 5064 val = jQuery.map(val, function(value2) { 5065 return value2 == null ? "" : value2 + ""; 5066 }); 5067 } 5068 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 5069 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === void 0) { 5070 this.value = val; 5071 } 5072 }); 5073 } 5074 }); 5075 jQuery.extend({ 5076 valHooks: { 5077 option: { 5078 get: function(elem) { 5079 var val = jQuery.find.attr(elem, "value"); 5080 return val != null ? val : ( 5081 // Support: IE <=10 - 11 only 5082 // option.text throws exceptions (#14686, #14858) 5083 // Strip and collapse whitespace 5084 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 5085 stripAndCollapse(jQuery.text(elem)) 5086 ); 5087 } 5088 }, 5089 select: { 5090 get: function(elem) { 5091 var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], max = one ? index + 1 : options.length; 5092 if (index < 0) { 5093 i = max; 5094 } else { 5095 i = one ? index : 0; 5096 } 5097 for (; i < max; i++) { 5098 option = options[i]; 5099 if ((option.selected || i === index) && // Don't return options that are disabled or in a disabled optgroup 5100 !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) { 5101 value = jQuery(option).val(); 5102 if (one) { 5103 return value; 5104 } 5105 values.push(value); 5106 } 5107 } 5108 return values; 5109 }, 5110 set: function(elem, value) { 5111 var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length; 5112 while (i--) { 5113 option = options[i]; 5114 if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) { 5115 optionSet = true; 5116 } 5117 } 5118 if (!optionSet) { 5119 elem.selectedIndex = -1; 5120 } 5121 return values; 5122 } 5123 } 5124 } 5125 }); 5126 jQuery.each(["radio", "checkbox"], function() { 5127 jQuery.valHooks[this] = { 5128 set: function(elem, value) { 5129 if (Array.isArray(value)) { 5130 return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1; 5131 } 5132 } 5133 }; 5134 if (!support.checkOn) { 5135 jQuery.valHooks[this].get = function(elem) { 5136 return elem.getAttribute("value") === null ? "on" : elem.value; 5137 }; 5138 } 5139 }); 5140 support.focusin = "onfocusin" in window2; 5141 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) { 5142 e.stopPropagation(); 5143 }; 5144 jQuery.extend(jQuery.event, { 5145 trigger: function(event, data, elem, onlyHandlers) { 5146 var i, cur, tmp, bubbleType, ontype, handle2, special, lastElement, eventPath = [elem || document2], type = hasOwn.call(event, "type") ? event.type : event, namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 5147 cur = lastElement = tmp = elem = elem || document2; 5148 if (elem.nodeType === 3 || elem.nodeType === 8) { 5149 return; 5150 } 5151 if (rfocusMorph.test(type + jQuery.event.triggered)) { 5152 return; 5153 } 5154 if (type.indexOf(".") > -1) { 5155 namespaces = type.split("."); 5156 type = namespaces.shift(); 5157 namespaces.sort(); 5158 } 5159 ontype = type.indexOf(":") < 0 && "on" + type; 5160 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event); 5161 event.isTrigger = onlyHandlers ? 2 : 3; 5162 event.namespace = namespaces.join("."); 5163 event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 5164 event.result = void 0; 5165 if (!event.target) { 5166 event.target = elem; 5167 } 5168 data = data == null ? [event] : jQuery.makeArray(data, [event]); 5169 special = jQuery.event.special[type] || {}; 5170 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 5171 return; 5172 } 5173 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 5174 bubbleType = special.delegateType || type; 5175 if (!rfocusMorph.test(bubbleType + type)) { 5176 cur = cur.parentNode; 5177 } 5178 for (; cur; cur = cur.parentNode) { 5179 eventPath.push(cur); 5180 tmp = cur; 5181 } 5182 if (tmp === (elem.ownerDocument || document2)) { 5183 eventPath.push(tmp.defaultView || tmp.parentWindow || window2); 5184 } 5185 } 5186 i = 0; 5187 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 5188 lastElement = cur; 5189 event.type = i > 1 ? bubbleType : special.bindType || type; 5190 handle2 = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event.type] && dataPriv.get(cur, "handle"); 5191 if (handle2) { 5192 handle2.apply(cur, data); 5193 } 5194 handle2 = ontype && cur[ontype]; 5195 if (handle2 && handle2.apply && acceptData(cur)) { 5196 event.result = handle2.apply(cur, data); 5197 if (event.result === false) { 5198 event.preventDefault(); 5199 } 5200 } 5201 } 5202 event.type = type; 5203 if (!onlyHandlers && !event.isDefaultPrevented()) { 5204 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) { 5205 if (ontype && isFunction(elem[type]) && !isWindow(elem)) { 5206 tmp = elem[ontype]; 5207 if (tmp) { 5208 elem[ontype] = null; 5209 } 5210 jQuery.event.triggered = type; 5211 if (event.isPropagationStopped()) { 5212 lastElement.addEventListener(type, stopPropagationCallback); 5213 } 5214 elem[type](); 5215 if (event.isPropagationStopped()) { 5216 lastElement.removeEventListener(type, stopPropagationCallback); 5217 } 5218 jQuery.event.triggered = void 0; 5219 if (tmp) { 5220 elem[ontype] = tmp; 5221 } 5222 } 5223 } 5224 } 5225 return event.result; 5226 }, 5227 // Piggyback on a donor event to simulate a different one 5228 // Used only for `focus(in | out)` events 5229 simulate: function(type, elem, event) { 5230 var e = jQuery.extend( 5231 new jQuery.Event(), 5232 event, 5233 { 5234 type, 5235 isSimulated: true 5236 } 5237 ); 5238 jQuery.event.trigger(e, null, elem); 5239 } 5240 }); 5241 jQuery.fn.extend({ 5242 trigger: function(type, data) { 5243 return this.each(function() { 5244 jQuery.event.trigger(type, data, this); 5245 }); 5246 }, 5247 triggerHandler: function(type, data) { 5248 var elem = this[0]; 5249 if (elem) { 5250 return jQuery.event.trigger(type, data, elem, true); 5251 } 5252 } 5253 }); 5254 if (!support.focusin) { 5255 jQuery.each({ focus: "focusin", blur: "focusout" }, function(orig, fix) { 5256 var handler = function(event) { 5257 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event)); 5258 }; 5259 jQuery.event.special[fix] = { 5260 setup: function() { 5261 var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix); 5262 if (!attaches) { 5263 doc.addEventListener(orig, handler, true); 5264 } 5265 dataPriv.access(doc, fix, (attaches || 0) + 1); 5266 }, 5267 teardown: function() { 5268 var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix) - 1; 5269 if (!attaches) { 5270 doc.removeEventListener(orig, handler, true); 5271 dataPriv.remove(doc, fix); 5272 } else { 5273 dataPriv.access(doc, fix, attaches); 5274 } 5275 } 5276 }; 5277 }); 5278 } 5279 var location = window2.location; 5280 var nonce = { guid: Date.now() }; 5281 var rquery = /\?/; 5282 jQuery.parseXML = function(data) { 5283 var xml; 5284 if (!data || typeof data !== "string") { 5285 return null; 5286 } 5287 try { 5288 xml = new window2.DOMParser().parseFromString(data, "text/xml"); 5289 } catch (e) { 5290 xml = void 0; 5291 } 5292 if (!xml || xml.getElementsByTagName("parsererror").length) { 5293 jQuery.error("Invalid XML: " + data); 5294 } 5295 return xml; 5296 }; 5297 var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; 5298 function buildParams(prefix, obj, traditional, add) { 5299 var name; 5300 if (Array.isArray(obj)) { 5301 jQuery.each(obj, function(i, v) { 5302 if (traditional || rbracket.test(prefix)) { 5303 add(prefix, v); 5304 } else { 5305 buildParams( 5306 prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", 5307 v, 5308 traditional, 5309 add 5310 ); 5311 } 5312 }); 5313 } else if (!traditional && toType(obj) === "object") { 5314 for (name in obj) { 5315 buildParams(prefix + "[" + name + "]", obj[name], traditional, add); 5316 } 5317 } else { 5318 add(prefix, obj); 5319 } 5320 } 5321 jQuery.param = function(a, traditional) { 5322 var prefix, s = [], add = function(key, valueOrFunction) { 5323 var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction; 5324 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value); 5325 }; 5326 if (a == null) { 5327 return ""; 5328 } 5329 if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) { 5330 jQuery.each(a, function() { 5331 add(this.name, this.value); 5332 }); 5333 } else { 5334 for (prefix in a) { 5335 buildParams(prefix, a[prefix], traditional, add); 5336 } 5337 } 5338 return s.join("&"); 5339 }; 5340 jQuery.fn.extend({ 5341 serialize: function() { 5342 return jQuery.param(this.serializeArray()); 5343 }, 5344 serializeArray: function() { 5345 return this.map(function() { 5346 var elements = jQuery.prop(this, "elements"); 5347 return elements ? jQuery.makeArray(elements) : this; 5348 }).filter(function() { 5349 var type = this.type; 5350 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type)); 5351 }).map(function(_i, elem) { 5352 var val = jQuery(this).val(); 5353 if (val == null) { 5354 return null; 5355 } 5356 if (Array.isArray(val)) { 5357 return jQuery.map(val, function(val2) { 5358 return { name: elem.name, value: val2.replace(rCRLF, "\r\n") }; 5359 }); 5360 } 5361 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 5362 }).get(); 5363 } 5364 }); 5365 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"); 5366 originAnchor.href = location.href; 5367 function addToPrefiltersOrTransports(structure) { 5368 return function(dataTypeExpression, func) { 5369 if (typeof dataTypeExpression !== "string") { 5370 func = dataTypeExpression; 5371 dataTypeExpression = "*"; 5372 } 5373 var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 5374 if (isFunction(func)) { 5375 while (dataType = dataTypes[i++]) { 5376 if (dataType[0] === "+") { 5377 dataType = dataType.slice(1) || "*"; 5378 (structure[dataType] = structure[dataType] || []).unshift(func); 5379 } else { 5380 (structure[dataType] = structure[dataType] || []).push(func); 5381 } 5382 } 5383 } 5384 }; 5385 } 5386 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 5387 var inspected = {}, seekingTransport = structure === transports; 5388 function inspect(dataType) { 5389 var selected; 5390 inspected[dataType] = true; 5391 jQuery.each(structure[dataType] || [], function(_23, prefilterOrFactory) { 5392 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 5393 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { 5394 options.dataTypes.unshift(dataTypeOrTransport); 5395 inspect(dataTypeOrTransport); 5396 return false; 5397 } else if (seekingTransport) { 5398 return !(selected = dataTypeOrTransport); 5399 } 5400 }); 5401 return selected; 5402 } 5403 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 5404 } 5405 function ajaxExtend(target, src) { 5406 var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; 5407 for (key in src) { 5408 if (src[key] !== void 0) { 5409 (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]; 5410 } 5411 } 5412 if (deep) { 5413 jQuery.extend(true, target, deep); 5414 } 5415 return target; 5416 } 5417 function ajaxHandleResponses(s, jqXHR, responses) { 5418 var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes; 5419 while (dataTypes[0] === "*") { 5420 dataTypes.shift(); 5421 if (ct === void 0) { 5422 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 5423 } 5424 } 5425 if (ct) { 5426 for (type in contents) { 5427 if (contents[type] && contents[type].test(ct)) { 5428 dataTypes.unshift(type); 5429 break; 5430 } 5431 } 5432 } 5433 if (dataTypes[0] in responses) { 5434 finalDataType = dataTypes[0]; 5435 } else { 5436 for (type in responses) { 5437 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 5438 finalDataType = type; 5439 break; 5440 } 5441 if (!firstDataType) { 5442 firstDataType = type; 5443 } 5444 } 5445 finalDataType = finalDataType || firstDataType; 5446 } 5447 if (finalDataType) { 5448 if (finalDataType !== dataTypes[0]) { 5449 dataTypes.unshift(finalDataType); 5450 } 5451 return responses[finalDataType]; 5452 } 5453 } 5454 function ajaxConvert(s, response, jqXHR, isSuccess) { 5455 var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice(); 5456 if (dataTypes[1]) { 5457 for (conv in s.converters) { 5458 converters[conv.toLowerCase()] = s.converters[conv]; 5459 } 5460 } 5461 current = dataTypes.shift(); 5462 while (current) { 5463 if (s.responseFields[current]) { 5464 jqXHR[s.responseFields[current]] = response; 5465 } 5466 if (!prev && isSuccess && s.dataFilter) { 5467 response = s.dataFilter(response, s.dataType); 5468 } 5469 prev = current; 5470 current = dataTypes.shift(); 5471 if (current) { 5472 if (current === "*") { 5473 current = prev; 5474 } else if (prev !== "*" && prev !== current) { 5475 conv = converters[prev + " " + current] || converters["* " + current]; 5476 if (!conv) { 5477 for (conv2 in converters) { 5478 tmp = conv2.split(" "); 5479 if (tmp[1] === current) { 5480 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; 5481 if (conv) { 5482 if (conv === true) { 5483 conv = converters[conv2]; 5484 } else if (converters[conv2] !== true) { 5485 current = tmp[0]; 5486 dataTypes.unshift(tmp[1]); 5487 } 5488 break; 5489 } 5490 } 5491 } 5492 } 5493 if (conv !== true) { 5494 if (conv && s.throws) { 5495 response = conv(response); 5496 } else { 5497 try { 5498 response = conv(response); 5499 } catch (e) { 5500 return { 5501 state: "parsererror", 5502 error: conv ? e : "No conversion from " + prev + " to " + current 5503 }; 5504 } 5505 } 5506 } 5507 } 5508 } 5509 } 5510 return { state: "success", data: response }; 5511 } 5512 jQuery.extend({ 5513 // Counter for holding the number of active queries 5514 active: 0, 5515 // Last-Modified header cache for next request 5516 lastModified: {}, 5517 etag: {}, 5518 ajaxSettings: { 5519 url: location.href, 5520 type: "GET", 5521 isLocal: rlocalProtocol.test(location.protocol), 5522 global: true, 5523 processData: true, 5524 async: true, 5525 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 5526 /* 5527 timeout: 0, 5528 data: null, 5529 dataType: null, 5530 username: null, 5531 password: null, 5532 cache: null, 5533 throws: false, 5534 traditional: false, 5535 headers: {}, 5536 */ 5537 accepts: { 5538 "*": allTypes, 5539 text: "text/plain", 5540 html: "text/html", 5541 xml: "application/xml, text/xml", 5542 json: "application/json, text/javascript" 5543 }, 5544 contents: { 5545 xml: /\bxml\b/, 5546 html: /\bhtml/, 5547 json: /\bjson\b/ 5548 }, 5549 responseFields: { 5550 xml: "responseXML", 5551 text: "responseText", 5552 json: "responseJSON" 5553 }, 5554 // Data converters 5555 // Keys separate source (or catchall "*") and destination types with a single space 5556 converters: { 5557 // Convert anything to text 5558 "* text": String, 5559 // Text to html (true = no transformation) 5560 "text html": true, 5561 // Evaluate text as a json expression 5562 "text json": JSON.parse, 5563 // Parse text as xml 5564 "text xml": jQuery.parseXML 5565 }, 5566 // For options that shouldn't be deep extended: 5567 // you can add your own custom options here if 5568 // and when you create one that shouldn't be 5569 // deep extended (see ajaxExtend) 5570 flatOptions: { 5571 url: true, 5572 context: true 5573 } 5574 }, 5575 // Creates a full fledged settings object into target 5576 // with both ajaxSettings and settings fields. 5577 // If target is omitted, writes into ajaxSettings. 5578 ajaxSetup: function(target, settings) { 5579 return settings ? ( 5580 // Building a settings object 5581 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) 5582 ) : ( 5583 // Extending ajaxSettings 5584 ajaxExtend(jQuery.ajaxSettings, target) 5585 ); 5586 }, 5587 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 5588 ajaxTransport: addToPrefiltersOrTransports(transports), 5589 // Main method 5590 ajax: function(url, options) { 5591 if (typeof url === "object") { 5592 options = url; 5593 url = void 0; 5594 } 5595 options = options || {}; 5596 var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i, uncached, s = jQuery.ajaxSetup({}, options), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = { 5597 readyState: 0, 5598 // Builds headers hashtable if needed 5599 getResponseHeader: function(key) { 5600 var match; 5601 if (completed2) { 5602 if (!responseHeaders) { 5603 responseHeaders = {}; 5604 while (match = rheaders.exec(responseHeadersString)) { 5605 responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]); 5606 } 5607 } 5608 match = responseHeaders[key.toLowerCase() + " "]; 5609 } 5610 return match == null ? null : match.join(", "); 5611 }, 5612 // Raw string 5613 getAllResponseHeaders: function() { 5614 return completed2 ? responseHeadersString : null; 5615 }, 5616 // Caches the header 5617 setRequestHeader: function(name, value) { 5618 if (completed2 == null) { 5619 name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name; 5620 requestHeaders[name] = value; 5621 } 5622 return this; 5623 }, 5624 // Overrides response content-type header 5625 overrideMimeType: function(type) { 5626 if (completed2 == null) { 5627 s.mimeType = type; 5628 } 5629 return this; 5630 }, 5631 // Status-dependent callbacks 5632 statusCode: function(map) { 5633 var code; 5634 if (map) { 5635 if (completed2) { 5636 jqXHR.always(map[jqXHR.status]); 5637 } else { 5638 for (code in map) { 5639 statusCode[code] = [statusCode[code], map[code]]; 5640 } 5641 } 5642 } 5643 return this; 5644 }, 5645 // Cancel the request 5646 abort: function(statusText) { 5647 var finalText = statusText || strAbort; 5648 if (transport) { 5649 transport.abort(finalText); 5650 } 5651 done(0, finalText); 5652 return this; 5653 } 5654 }; 5655 deferred.promise(jqXHR); 5656 s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//"); 5657 s.type = options.method || options.type || s.method || s.type; 5658 s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 5659 if (s.crossDomain == null) { 5660 urlAnchor = document2.createElement("a"); 5661 try { 5662 urlAnchor.href = s.url; 5663 urlAnchor.href = urlAnchor.href; 5664 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; 5665 } catch (e) { 5666 s.crossDomain = true; 5667 } 5668 } 5669 if (s.data && s.processData && typeof s.data !== "string") { 5670 s.data = jQuery.param(s.data, s.traditional); 5671 } 5672 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 5673 if (completed2) { 5674 return jqXHR; 5675 } 5676 fireGlobals = jQuery.event && s.global; 5677 if (fireGlobals && jQuery.active++ === 0) { 5678 jQuery.event.trigger("ajaxStart"); 5679 } 5680 s.type = s.type.toUpperCase(); 5681 s.hasContent = !rnoContent.test(s.type); 5682 cacheURL = s.url.replace(rhash, ""); 5683 if (!s.hasContent) { 5684 uncached = s.url.slice(cacheURL.length); 5685 if (s.data && (s.processData || typeof s.data === "string")) { 5686 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; 5687 delete s.data; 5688 } 5689 if (s.cache === false) { 5690 cacheURL = cacheURL.replace(rantiCache, "$1"); 5691 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached; 5692 } 5693 s.url = cacheURL + uncached; 5694 } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 5695 s.data = s.data.replace(r20, "+"); 5696 } 5697 if (s.ifModified) { 5698 if (jQuery.lastModified[cacheURL]) { 5699 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); 5700 } 5701 if (jQuery.etag[cacheURL]) { 5702 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); 5703 } 5704 } 5705 if (s.data && s.hasContent && s.contentType !== false || options.contentType) { 5706 jqXHR.setRequestHeader("Content-Type", s.contentType); 5707 } 5708 jqXHR.setRequestHeader( 5709 "Accept", 5710 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"] 5711 ); 5712 for (i in s.headers) { 5713 jqXHR.setRequestHeader(i, s.headers[i]); 5714 } 5715 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed2)) { 5716 return jqXHR.abort(); 5717 } 5718 strAbort = "abort"; 5719 completeDeferred.add(s.complete); 5720 jqXHR.done(s.success); 5721 jqXHR.fail(s.error); 5722 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 5723 if (!transport) { 5724 done(-1, "No Transport"); 5725 } else { 5726 jqXHR.readyState = 1; 5727 if (fireGlobals) { 5728 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 5729 } 5730 if (completed2) { 5731 return jqXHR; 5732 } 5733 if (s.async && s.timeout > 0) { 5734 timeoutTimer = window2.setTimeout(function() { 5735 jqXHR.abort("timeout"); 5736 }, s.timeout); 5737 } 5738 try { 5739 completed2 = false; 5740 transport.send(requestHeaders, done); 5741 } catch (e) { 5742 if (completed2) { 5743 throw e; 5744 } 5745 done(-1, e); 5746 } 5747 } 5748 function done(status, nativeStatusText, responses, headers) { 5749 var isSuccess, success, error2, response, modified, statusText = nativeStatusText; 5750 if (completed2) { 5751 return; 5752 } 5753 completed2 = true; 5754 if (timeoutTimer) { 5755 window2.clearTimeout(timeoutTimer); 5756 } 5757 transport = void 0; 5758 responseHeadersString = headers || ""; 5759 jqXHR.readyState = status > 0 ? 4 : 0; 5760 isSuccess = status >= 200 && status < 300 || status === 304; 5761 if (responses) { 5762 response = ajaxHandleResponses(s, jqXHR, responses); 5763 } 5764 if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1) { 5765 s.converters["text script"] = function() { 5766 }; 5767 } 5768 response = ajaxConvert(s, response, jqXHR, isSuccess); 5769 if (isSuccess) { 5770 if (s.ifModified) { 5771 modified = jqXHR.getResponseHeader("Last-Modified"); 5772 if (modified) { 5773 jQuery.lastModified[cacheURL] = modified; 5774 } 5775 modified = jqXHR.getResponseHeader("etag"); 5776 if (modified) { 5777 jQuery.etag[cacheURL] = modified; 5778 } 5779 } 5780 if (status === 204 || s.type === "HEAD") { 5781 statusText = "nocontent"; 5782 } else if (status === 304) { 5783 statusText = "notmodified"; 5784 } else { 5785 statusText = response.state; 5786 success = response.data; 5787 error2 = response.error; 5788 isSuccess = !error2; 5789 } 5790 } else { 5791 error2 = statusText; 5792 if (status || !statusText) { 5793 statusText = "error"; 5794 if (status < 0) { 5795 status = 0; 5796 } 5797 } 5798 } 5799 jqXHR.status = status; 5800 jqXHR.statusText = (nativeStatusText || statusText) + ""; 5801 if (isSuccess) { 5802 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 5803 } else { 5804 deferred.rejectWith(callbackContext, [jqXHR, statusText, error2]); 5805 } 5806 jqXHR.statusCode(statusCode); 5807 statusCode = void 0; 5808 if (fireGlobals) { 5809 globalEventContext.trigger( 5810 isSuccess ? "ajaxSuccess" : "ajaxError", 5811 [jqXHR, s, isSuccess ? success : error2] 5812 ); 5813 } 5814 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 5815 if (fireGlobals) { 5816 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 5817 if (!--jQuery.active) { 5818 jQuery.event.trigger("ajaxStop"); 5819 } 5820 } 5821 } 5822 return jqXHR; 5823 }, 5824 getJSON: function(url, data, callback) { 5825 return jQuery.get(url, data, callback, "json"); 5826 }, 5827 getScript: function(url, callback) { 5828 return jQuery.get(url, void 0, callback, "script"); 5829 } 5830 }); 5831 jQuery.each(["get", "post"], function(_i, method) { 5832 jQuery[method] = function(url, data, callback, type) { 5833 if (isFunction(data)) { 5834 type = type || callback; 5835 callback = data; 5836 data = void 0; 5837 } 5838 return jQuery.ajax(jQuery.extend({ 5839 url, 5840 type: method, 5841 dataType: type, 5842 data, 5843 success: callback 5844 }, jQuery.isPlainObject(url) && url)); 5845 }; 5846 }); 5847 jQuery.ajaxPrefilter(function(s) { 5848 var i; 5849 for (i in s.headers) { 5850 if (i.toLowerCase() === "content-type") { 5851 s.contentType = s.headers[i] || ""; 5852 } 5853 } 5854 }); 5855 jQuery._evalUrl = function(url, options, doc) { 5856 return jQuery.ajax({ 5857 url, 5858 // Make this explicit, since user can override this through ajaxSetup (#11264) 5859 type: "GET", 5860 dataType: "script", 5861 cache: true, 5862 async: false, 5863 global: false, 5864 // Only evaluate the response if it is successful (gh-4126) 5865 // dataFilter is not invoked for failure responses, so using it instead 5866 // of the default converter is kludgy but it works. 5867 converters: { 5868 "text script": function() { 5869 } 5870 }, 5871 dataFilter: function(response) { 5872 jQuery.globalEval(response, options, doc); 5873 } 5874 }); 5875 }; 5876 jQuery.fn.extend({ 5877 wrapAll: function(html) { 5878 var wrap; 5879 if (this[0]) { 5880 if (isFunction(html)) { 5881 html = html.call(this[0]); 5882 } 5883 wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 5884 if (this[0].parentNode) { 5885 wrap.insertBefore(this[0]); 5886 } 5887 wrap.map(function() { 5888 var elem = this; 5889 while (elem.firstElementChild) { 5890 elem = elem.firstElementChild; 5891 } 5892 return elem; 5893 }).append(this); 5894 } 5895 return this; 5896 }, 5897 wrapInner: function(html) { 5898 if (isFunction(html)) { 5899 return this.each(function(i) { 5900 jQuery(this).wrapInner(html.call(this, i)); 5901 }); 5902 } 5903 return this.each(function() { 5904 var self2 = jQuery(this), contents = self2.contents(); 5905 if (contents.length) { 5906 contents.wrapAll(html); 5907 } else { 5908 self2.append(html); 5909 } 5910 }); 5911 }, 5912 wrap: function(html) { 5913 var htmlIsFunction = isFunction(html); 5914 return this.each(function(i) { 5915 jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); 5916 }); 5917 }, 5918 unwrap: function(selector) { 5919 this.parent(selector).not("body").each(function() { 5920 jQuery(this).replaceWith(this.childNodes); 5921 }); 5922 return this; 5923 } 5924 }); 5925 jQuery.expr.pseudos.hidden = function(elem) { 5926 return !jQuery.expr.pseudos.visible(elem); 5927 }; 5928 jQuery.expr.pseudos.visible = function(elem) { 5929 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 5930 }; 5931 jQuery.ajaxSettings.xhr = function() { 5932 try { 5933 return new window2.XMLHttpRequest(); 5934 } catch (e) { 5935 } 5936 }; 5937 var xhrSuccessStatus = { 5938 // File protocol always yields status code 0, assume 200 5939 0: 200, 5940 // Support: IE <=9 only 5941 // #1450: sometimes IE returns 1223 when it should be 204 5942 1223: 204 5943 }, xhrSupported = jQuery.ajaxSettings.xhr(); 5944 support.cors = !!xhrSupported && "withCredentials" in xhrSupported; 5945 support.ajax = xhrSupported = !!xhrSupported; 5946 jQuery.ajaxTransport(function(options) { 5947 var callback, errorCallback; 5948 if (support.cors || xhrSupported && !options.crossDomain) { 5949 return { 5950 send: function(headers, complete) { 5951 var i, xhr = options.xhr(); 5952 xhr.open( 5953 options.type, 5954 options.url, 5955 options.async, 5956 options.username, 5957 options.password 5958 ); 5959 if (options.xhrFields) { 5960 for (i in options.xhrFields) { 5961 xhr[i] = options.xhrFields[i]; 5962 } 5963 } 5964 if (options.mimeType && xhr.overrideMimeType) { 5965 xhr.overrideMimeType(options.mimeType); 5966 } 5967 if (!options.crossDomain && !headers["X-Requested-With"]) { 5968 headers["X-Requested-With"] = "XMLHttpRequest"; 5969 } 5970 for (i in headers) { 5971 xhr.setRequestHeader(i, headers[i]); 5972 } 5973 callback = function(type) { 5974 return function() { 5975 if (callback) { 5976 callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null; 5977 if (type === "abort") { 5978 xhr.abort(); 5979 } else if (type === "error") { 5980 if (typeof xhr.status !== "number") { 5981 complete(0, "error"); 5982 } else { 5983 complete( 5984 // File: protocol always yields status 0; see #8605, #14207 5985 xhr.status, 5986 xhr.statusText 5987 ); 5988 } 5989 } else { 5990 complete( 5991 xhrSuccessStatus[xhr.status] || xhr.status, 5992 xhr.statusText, 5993 // Support: IE <=9 only 5994 // IE9 has no XHR2 but throws on binary (trac-11426) 5995 // For XHR2 non-text, let the caller handle it (gh-2498) 5996 (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, 5997 xhr.getAllResponseHeaders() 5998 ); 5999 } 6000 } 6001 }; 6002 }; 6003 xhr.onload = callback(); 6004 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 6005 if (xhr.onabort !== void 0) { 6006 xhr.onabort = errorCallback; 6007 } else { 6008 xhr.onreadystatechange = function() { 6009 if (xhr.readyState === 4) { 6010 window2.setTimeout(function() { 6011 if (callback) { 6012 errorCallback(); 6013 } 6014 }); 6015 } 6016 }; 6017 } 6018 callback = callback("abort"); 6019 try { 6020 xhr.send(options.hasContent && options.data || null); 6021 } catch (e) { 6022 if (callback) { 6023 throw e; 6024 } 6025 } 6026 }, 6027 abort: function() { 6028 if (callback) { 6029 callback(); 6030 } 6031 } 6032 }; 6033 } 6034 }); 6035 jQuery.ajaxPrefilter(function(s) { 6036 if (s.crossDomain) { 6037 s.contents.script = false; 6038 } 6039 }); 6040 jQuery.ajaxSetup({ 6041 accepts: { 6042 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 6043 }, 6044 contents: { 6045 script: /\b(?:java|ecma)script\b/ 6046 }, 6047 converters: { 6048 "text script": function(text) { 6049 jQuery.globalEval(text); 6050 return text; 6051 } 6052 } 6053 }); 6054 jQuery.ajaxPrefilter("script", function(s) { 6055 if (s.cache === void 0) { 6056 s.cache = false; 6057 } 6058 if (s.crossDomain) { 6059 s.type = "GET"; 6060 } 6061 }); 6062 jQuery.ajaxTransport("script", function(s) { 6063 if (s.crossDomain || s.scriptAttrs) { 6064 var script, callback; 6065 return { 6066 send: function(_23, complete) { 6067 script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback = function(evt) { 6068 script.remove(); 6069 callback = null; 6070 if (evt) { 6071 complete(evt.type === "error" ? 404 : 200, evt.type); 6072 } 6073 }); 6074 document2.head.appendChild(script[0]); 6075 }, 6076 abort: function() { 6077 if (callback) { 6078 callback(); 6079 } 6080 } 6081 }; 6082 } 6083 }); 6084 var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; 6085 jQuery.ajaxSetup({ 6086 jsonp: "callback", 6087 jsonpCallback: function() { 6088 var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++; 6089 this[callback] = true; 6090 return callback; 6091 } 6092 }); 6093 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) { 6094 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"); 6095 if (jsonProp || s.dataTypes[0] === "jsonp") { 6096 callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback; 6097 if (jsonProp) { 6098 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); 6099 } else if (s.jsonp !== false) { 6100 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; 6101 } 6102 s.converters["script json"] = function() { 6103 if (!responseContainer) { 6104 jQuery.error(callbackName + " was not called"); 6105 } 6106 return responseContainer[0]; 6107 }; 6108 s.dataTypes[0] = "json"; 6109 overwritten = window2[callbackName]; 6110 window2[callbackName] = function() { 6111 responseContainer = arguments; 6112 }; 6113 jqXHR.always(function() { 6114 if (overwritten === void 0) { 6115 jQuery(window2).removeProp(callbackName); 6116 } else { 6117 window2[callbackName] = overwritten; 6118 } 6119 if (s[callbackName]) { 6120 s.jsonpCallback = originalSettings.jsonpCallback; 6121 oldCallbacks.push(callbackName); 6122 } 6123 if (responseContainer && isFunction(overwritten)) { 6124 overwritten(responseContainer[0]); 6125 } 6126 responseContainer = overwritten = void 0; 6127 }); 6128 return "script"; 6129 } 6130 }); 6131 support.createHTMLDocument = function() { 6132 var body = document2.implementation.createHTMLDocument("").body; 6133 body.innerHTML = "<form></form><form></form>"; 6134 return body.childNodes.length === 2; 6135 }(); 6136 jQuery.parseHTML = function(data, context, keepScripts) { 6137 if (typeof data !== "string") { 6138 return []; 6139 } 6140 if (typeof context === "boolean") { 6141 keepScripts = context; 6142 context = false; 6143 } 6144 var base, parsed, scripts; 6145 if (!context) { 6146 if (support.createHTMLDocument) { 6147 context = document2.implementation.createHTMLDocument(""); 6148 base = context.createElement("base"); 6149 base.href = document2.location.href; 6150 context.head.appendChild(base); 6151 } else { 6152 context = document2; 6153 } 6154 } 6155 parsed = rsingleTag.exec(data); 6156 scripts = !keepScripts && []; 6157 if (parsed) { 6158 return [context.createElement(parsed[1])]; 6159 } 6160 parsed = buildFragment([data], context, scripts); 6161 if (scripts && scripts.length) { 6162 jQuery(scripts).remove(); 6163 } 6164 return jQuery.merge([], parsed.childNodes); 6165 }; 6166 jQuery.fn.load = function(url, params, callback) { 6167 var selector, type, response, self2 = this, off = url.indexOf(" "); 6168 if (off > -1) { 6169 selector = stripAndCollapse(url.slice(off)); 6170 url = url.slice(0, off); 6171 } 6172 if (isFunction(params)) { 6173 callback = params; 6174 params = void 0; 6175 } else if (params && typeof params === "object") { 6176 type = "POST"; 6177 } 6178 if (self2.length > 0) { 6179 jQuery.ajax({ 6180 url, 6181 // If "type" variable is undefined, then "GET" method will be used. 6182 // Make value of this field explicit since 6183 // user can override it through ajaxSetup method 6184 type: type || "GET", 6185 dataType: "html", 6186 data: params 6187 }).done(function(responseText) { 6188 response = arguments; 6189 self2.html(selector ? ( 6190 // If a selector was specified, locate the right elements in a dummy div 6191 // Exclude scripts to avoid IE 'Permission Denied' errors 6192 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) 6193 ) : ( 6194 // Otherwise use the full result 6195 responseText 6196 )); 6197 }).always(callback && function(jqXHR, status) { 6198 self2.each(function() { 6199 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 6200 }); 6201 }); 6202 } 6203 return this; 6204 }; 6205 jQuery.expr.pseudos.animated = function(elem) { 6206 return jQuery.grep(jQuery.timers, function(fn) { 6207 return elem === fn.elem; 6208 }).length; 6209 }; 6210 jQuery.offset = { 6211 setOffset: function(elem, options, i) { 6212 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {}; 6213 if (position === "static") { 6214 elem.style.position = "relative"; 6215 } 6216 curOffset = curElem.offset(); 6217 curCSSTop = jQuery.css(elem, "top"); 6218 curCSSLeft = jQuery.css(elem, "left"); 6219 calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1; 6220 if (calculatePosition) { 6221 curPosition = curElem.position(); 6222 curTop = curPosition.top; 6223 curLeft = curPosition.left; 6224 } else { 6225 curTop = parseFloat(curCSSTop) || 0; 6226 curLeft = parseFloat(curCSSLeft) || 0; 6227 } 6228 if (isFunction(options)) { 6229 options = options.call(elem, i, jQuery.extend({}, curOffset)); 6230 } 6231 if (options.top != null) { 6232 props.top = options.top - curOffset.top + curTop; 6233 } 6234 if (options.left != null) { 6235 props.left = options.left - curOffset.left + curLeft; 6236 } 6237 if ("using" in options) { 6238 options.using.call(elem, props); 6239 } else { 6240 if (typeof props.top === "number") { 6241 props.top += "px"; 6242 } 6243 if (typeof props.left === "number") { 6244 props.left += "px"; 6245 } 6246 curElem.css(props); 6247 } 6248 } 6249 }; 6250 jQuery.fn.extend({ 6251 // offset() relates an element's border box to the document origin 6252 offset: function(options) { 6253 if (arguments.length) { 6254 return options === void 0 ? this : this.each(function(i) { 6255 jQuery.offset.setOffset(this, options, i); 6256 }); 6257 } 6258 var rect, win, elem = this[0]; 6259 if (!elem) { 6260 return; 6261 } 6262 if (!elem.getClientRects().length) { 6263 return { top: 0, left: 0 }; 6264 } 6265 rect = elem.getBoundingClientRect(); 6266 win = elem.ownerDocument.defaultView; 6267 return { 6268 top: rect.top + win.pageYOffset, 6269 left: rect.left + win.pageXOffset 6270 }; 6271 }, 6272 // position() relates an element's margin box to its offset parent's padding box 6273 // This corresponds to the behavior of CSS absolute positioning 6274 position: function() { 6275 if (!this[0]) { 6276 return; 6277 } 6278 var offsetParent, offset, doc, elem = this[0], parentOffset = { top: 0, left: 0 }; 6279 if (jQuery.css(elem, "position") === "fixed") { 6280 offset = elem.getBoundingClientRect(); 6281 } else { 6282 offset = this.offset(); 6283 doc = elem.ownerDocument; 6284 offsetParent = elem.offsetParent || doc.documentElement; 6285 while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") { 6286 offsetParent = offsetParent.parentNode; 6287 } 6288 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 6289 parentOffset = jQuery(offsetParent).offset(); 6290 parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true); 6291 parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true); 6292 } 6293 } 6294 return { 6295 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), 6296 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) 6297 }; 6298 }, 6299 // This method will return documentElement in the following cases: 6300 // 1) For the element inside the iframe without offsetParent, this method will return 6301 // documentElement of the parent window 6302 // 2) For the hidden or detached element 6303 // 3) For body or html element, i.e. in case of the html node - it will return itself 6304 // 6305 // but those exceptions were never presented as a real life use-cases 6306 // and might be considered as more preferable results. 6307 // 6308 // This logic, however, is not guaranteed and can change at any point in the future 6309 offsetParent: function() { 6310 return this.map(function() { 6311 var offsetParent = this.offsetParent; 6312 while (offsetParent && jQuery.css(offsetParent, "position") === "static") { 6313 offsetParent = offsetParent.offsetParent; 6314 } 6315 return offsetParent || documentElement; 6316 }); 6317 } 6318 }); 6319 jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) { 6320 var top = "pageYOffset" === prop; 6321 jQuery.fn[method] = function(val) { 6322 return access(this, function(elem, method2, val2) { 6323 var win; 6324 if (isWindow(elem)) { 6325 win = elem; 6326 } else if (elem.nodeType === 9) { 6327 win = elem.defaultView; 6328 } 6329 if (val2 === void 0) { 6330 return win ? win[prop] : elem[method2]; 6331 } 6332 if (win) { 6333 win.scrollTo( 6334 !top ? val2 : win.pageXOffset, 6335 top ? val2 : win.pageYOffset 6336 ); 6337 } else { 6338 elem[method2] = val2; 6339 } 6340 }, method, val, arguments.length); 6341 }; 6342 }); 6343 jQuery.each(["top", "left"], function(_i, prop) { 6344 jQuery.cssHooks[prop] = addGetHookIf( 6345 support.pixelPosition, 6346 function(elem, computed) { 6347 if (computed) { 6348 computed = curCSS(elem, prop); 6349 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed; 6350 } 6351 } 6352 ); 6353 }); 6354 jQuery.each({ Height: "height", Width: "width" }, function(name, type) { 6355 jQuery.each( 6356 { padding: "inner" + name, content: type, "": "outer" + name }, 6357 function(defaultExtra, funcName) { 6358 jQuery.fn[funcName] = function(margin, value) { 6359 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 6360 return access(this, function(elem, type2, value2) { 6361 var doc; 6362 if (isWindow(elem)) { 6363 return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name]; 6364 } 6365 if (elem.nodeType === 9) { 6366 doc = elem.documentElement; 6367 return Math.max( 6368 elem.body["scroll" + name], 6369 doc["scroll" + name], 6370 elem.body["offset" + name], 6371 doc["offset" + name], 6372 doc["client" + name] 6373 ); 6374 } 6375 return value2 === void 0 ? ( 6376 // Get width or height on the element, requesting but not forcing parseFloat 6377 jQuery.css(elem, type2, extra) 6378 ) : ( 6379 // Set width or height on the element 6380 jQuery.style(elem, type2, value2, extra) 6381 ); 6382 }, type, chainable ? margin : void 0, chainable); 6383 }; 6384 } 6385 ); 6386 }); 6387 jQuery.each([ 6388 "ajaxStart", 6389 "ajaxStop", 6390 "ajaxComplete", 6391 "ajaxError", 6392 "ajaxSuccess", 6393 "ajaxSend" 6394 ], function(_i, type) { 6395 jQuery.fn[type] = function(fn) { 6396 return this.on(type, fn); 6397 }; 6398 }); 6399 jQuery.fn.extend({ 6400 bind: function(types, data, fn) { 6401 return this.on(types, null, data, fn); 6402 }, 6403 unbind: function(types, fn) { 6404 return this.off(types, null, fn); 6405 }, 6406 delegate: function(selector, types, data, fn) { 6407 return this.on(types, selector, data, fn); 6408 }, 6409 undelegate: function(selector, types, fn) { 6410 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); 6411 }, 6412 hover: function(fnOver, fnOut) { 6413 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 6414 } 6415 }); 6416 jQuery.each( 6417 "blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), 6418 function(_i, name) { 6419 jQuery.fn[name] = function(data, fn) { 6420 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name); 6421 }; 6422 } 6423 ); 6424 var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 6425 jQuery.proxy = function(fn, context) { 6426 var tmp, args, proxy; 6427 if (typeof context === "string") { 6428 tmp = fn[context]; 6429 context = fn; 6430 fn = tmp; 6431 } 6432 if (!isFunction(fn)) { 6433 return void 0; 6434 } 6435 args = slice.call(arguments, 2); 6436 proxy = function() { 6437 return fn.apply(context || this, args.concat(slice.call(arguments))); 6438 }; 6439 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 6440 return proxy; 6441 }; 6442 jQuery.holdReady = function(hold) { 6443 if (hold) { 6444 jQuery.readyWait++; 6445 } else { 6446 jQuery.ready(true); 6447 } 6448 }; 6449 jQuery.isArray = Array.isArray; 6450 jQuery.parseJSON = JSON.parse; 6451 jQuery.nodeName = nodeName; 6452 jQuery.isFunction = isFunction; 6453 jQuery.isWindow = isWindow; 6454 jQuery.camelCase = camelCase; 6455 jQuery.type = toType; 6456 jQuery.now = Date.now; 6457 jQuery.isNumeric = function(obj) { 6458 var type = jQuery.type(obj); 6459 return (type === "number" || type === "string") && // parseFloat NaNs numeric-cast false positives ("") 6460 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 6461 // subtraction forces infinities to NaN 6462 !isNaN(obj - parseFloat(obj)); 6463 }; 6464 jQuery.trim = function(text) { 6465 return text == null ? "" : (text + "").replace(rtrim, ""); 6466 }; 6467 if (typeof define === "function" && define.amd) { 6468 define("jquery", [], function() { 6469 return jQuery; 6470 }); 6471 } 6472 var _jQuery = window2.jQuery, _$ = window2.$; 6473 jQuery.noConflict = function(deep) { 6474 if (window2.$ === jQuery) { 6475 window2.$ = _$; 6476 } 6477 if (deep && window2.jQuery === jQuery) { 6478 window2.jQuery = _jQuery; 6479 } 6480 return jQuery; 6481 }; 6482 if (typeof noGlobal === "undefined") { 6483 window2.jQuery = window2.$ = jQuery; 6484 } 6485 return jQuery; 6486 }); 6487 } 6488 }); 6489 6490
6490// app/javascript/jquery.js 6491 function defineJQuery(target) { 6492 if (typeof target !== "undefined" && target.$ === void 0) { 6493 target.$ = target.jQuery = target.jquery = import_jquery.default; 6494 } 6495 } 6496 var import_jquery; 6497 var init_jquery = __esm({ 6498 "app/javascript/jquery.js"() { 6499 import_jquery = __toESM(require_jquery()); 6500 if (typeof window !== "undefined") { 6501 defineJQuery(window); 6502 } 6503 if (typeof window !== "undefined") { 6504 defineJQuery(window); 6505 } 6506 } 6507 }); 6508 6509
vendor: 100,935 bytes, lines 6509-9009
6509// node_modules/@hotwired/stimulus/dist/stimulus.umd.js 6510 var require_stimulus_umd = __commonJS({ 6511 "node_modules/@hotwired/stimulus/dist/stimulus.umd.js"(exports, module) { 6512 init_define_process(); 6513 init_jquery(); 6514 (function(global2, factory) { 6515 typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.Stimulus = {})); 6516 })(exports, function(exports2) { 6517 "use strict"; 6518 class EventListener { 6519 constructor(eventTarget, eventName, eventOptions) { 6520 this.eventTarget = eventTarget; 6521 this.eventName = eventName; 6522 this.eventOptions = eventOptions; 6523 this.unorderedBindings = /* @__PURE__ */ new Set(); 6524 } 6525 connect() { 6526 this.eventTarget.addEventListener(this.eventName, this, this.eventOptions); 6527 } 6528 disconnect() { 6529 this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions); 6530 } 6531 bindingConnected(binding) { 6532 this.unorderedBindings.add(binding); 6533 } 6534 bindingDisconnected(binding) { 6535 this.unorderedBindings.delete(binding); 6536 } 6537 handleEvent(event) { 6538 const extendedEvent = extendEvent(event); 6539 for (const binding of this.bindings) { 6540 if (extendedEvent.immediatePropagationStopped) { 6541 break; 6542 } else { 6543 binding.handleEvent(extendedEvent); 6544 } 6545 } 6546 } 6547 hasBindings() { 6548 return this.unorderedBindings.size > 0; 6549 } 6550 get bindings() { 6551 return Array.from(this.unorderedBindings).sort((left, right) => { 6552 const leftIndex = left.index, rightIndex = right.index; 6553 return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0; 6554 }); 6555 } 6556 } 6557 function extendEvent(event) { 6558 if ("immediatePropagationStopped" in event) { 6559 return event; 6560 } else { 6561 const { stopImmediatePropagation } = event; 6562 return Object.assign(event, { 6563 immediatePropagationStopped: false, 6564 stopImmediatePropagation() { 6565 this.immediatePropagationStopped = true; 6566 stopImmediatePropagation.call(this); 6567 } 6568 }); 6569 } 6570 } 6571 class Dispatcher { 6572 constructor(application2) { 6573 this.application = application2; 6574 this.eventListenerMaps = /* @__PURE__ */ new Map(); 6575 this.started = false; 6576 } 6577 start() { 6578 if (!this.started) { 6579 this.started = true; 6580 this.eventListeners.forEach((eventListener) => eventListener.connect()); 6581 } 6582 } 6583 stop() { 6584 if (this.started) { 6585 this.started = false; 6586 this.eventListeners.forEach((eventListener) => eventListener.disconnect()); 6587 } 6588 } 6589 get eventListeners() { 6590 return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []); 6591 } 6592 bindingConnected(binding) { 6593 this.fetchEventListenerForBinding(binding).bindingConnected(binding); 6594 } 6595 bindingDisconnected(binding, clearEventListeners = false) { 6596 this.fetchEventListenerForBinding(binding).bindingDisconnected(binding); 6597 if (clearEventListeners) 6598 this.clearEventListenersForBinding(binding); 6599 } 6600 handleError(error3, message, detail = {}) { 6601 this.application.handleError(error3, `Error ${message}`, detail); 6602 } 6603 clearEventListenersForBinding(binding) { 6604 const eventListener = this.fetchEventListenerForBinding(binding); 6605 if (!eventListener.hasBindings()) { 6606 eventListener.disconnect(); 6607 this.removeMappedEventListenerFor(binding); 6608 } 6609 } 6610 removeMappedEventListenerFor(binding) { 6611 const { eventTarget, eventName, eventOptions } = binding; 6612 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 6613 const cacheKey = this.cacheKey(eventName, eventOptions); 6614 eventListenerMap.delete(cacheKey); 6615 if (eventListenerMap.size == 0) 6616 this.eventListenerMaps.delete(eventTarget); 6617 } 6618 fetchEventListenerForBinding(binding) { 6619 const { eventTarget, eventName, eventOptions } = binding; 6620 return this.fetchEventListener(eventTarget, eventName, eventOptions); 6621 } 6622 fetchEventListener(eventTarget, eventName, eventOptions) { 6623 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 6624 const cacheKey = this.cacheKey(eventName, eventOptions); 6625 let eventListener = eventListenerMap.get(cacheKey); 6626 if (!eventListener) { 6627 eventListener = this.createEventListener(eventTarget, eventName, eventOptions); 6628 eventListenerMap.set(cacheKey, eventListener); 6629 } 6630 return eventListener; 6631 } 6632 createEventListener(eventTarget, eventName, eventOptions) { 6633 const eventListener = new EventListener(eventTarget, eventName, eventOptions); 6634 if (this.started) { 6635 eventListener.connect(); 6636 } 6637 return eventListener; 6638 } 6639 fetchEventListenerMapForEventTarget(eventTarget) { 6640 let eventListenerMap = this.eventListenerMaps.get(eventTarget); 6641 if (!eventListenerMap) { 6642 eventListenerMap = /* @__PURE__ */ new Map(); 6643 this.eventListenerMaps.set(eventTarget, eventListenerMap); 6644 } 6645 return eventListenerMap; 6646 } 6647 cacheKey(eventName, eventOptions) { 6648 const parts = [eventName]; 6649 Object.keys(eventOptions).sort().forEach((key) => { 6650 parts.push(`${eventOptions[key] ? "" : "!"}${key}`); 6651 }); 6652 return parts.join(":"); 6653 } 6654 } 6655 const defaultActionDescriptorFilters = { 6656 stop({ event, value }) { 6657 if (value) 6658 event.stopPropagation(); 6659 return true; 6660 }, 6661 prevent({ event, value }) { 6662 if (value) 6663 event.preventDefault(); 6664 return true; 6665 }, 6666 self({ event, value, element }) { 6667 if (value) { 6668 return element === event.target; 6669 } else { 6670 return true; 6671 } 6672 } 6673 }; 6674 const descriptorPattern = /^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/; 6675 function parseActionDescriptorString(descriptorString) { 6676 const source = descriptorString.trim(); 6677 const matches = source.match(descriptorPattern) || []; 6678 let eventName = matches[2]; 6679 let keyFilter = matches[3]; 6680 if (keyFilter && !["keydown", "keyup", "keypress"].includes(eventName)) { 6681 eventName += `.${keyFilter}`; 6682 keyFilter = ""; 6683 } 6684 return { 6685 eventTarget: parseEventTarget(matches[4]), 6686 eventName, 6687 eventOptions: matches[7] ? parseEventOptions(matches[7]) : {}, 6688 identifier: matches[5], 6689 methodName: matches[6], 6690 keyFilter: matches[1] || keyFilter 6691 }; 6692 } 6693 function parseEventTarget(eventTargetName) { 6694 if (eventTargetName == "window") { 6695 return window; 6696 } else if (eventTargetName == "document") { 6697 return document; 6698 } 6699 } 6700 function parseEventOptions(eventOptions) { 6701 return eventOptions.split(":").reduce((options, token) => Object.assign(options, { [token.replace(/^!/, "")]: !/^!/.test(token) }), {}); 6702 } 6703 function stringifyEventTarget(eventTarget) { 6704 if (eventTarget == window) { 6705 return "window"; 6706 } else if (eventTarget == document) { 6707 return "document"; 6708 } 6709 } 6710 function camelize(value) { 6711 return value.replace(/(?:[_-])([a-z0-9])/g, (_23, char) => char.toUpperCase()); 6712 } 6713 function namespaceCamelize(value) { 6714 return camelize(value.replace(/--/g, "-").replace(/__/g, "_")); 6715 } 6716 function capitalize2(value) { 6717 return value.charAt(0).toUpperCase() + value.slice(1); 6718 } 6719 function dasherize(value) { 6720 return value.replace(/([A-Z])/g, (_23, char) => `-${char.toLowerCase()}`); 6721 } 6722 function tokenize(value) { 6723 return value.match(/[^\s]+/g) || []; 6724 } 6725 function isSomething(object) { 6726 return object !== null && object !== void 0; 6727 } 6728 function hasProperty(object, property) { 6729 return Object.prototype.hasOwnProperty.call(object, property); 6730 } 6731 const allModifiers = ["meta", "ctrl", "alt", "shift"]; 6732 class Action { 6733 constructor(element, index, descriptor, schema) { 6734 this.element = element; 6735 this.index = index; 6736 this.eventTarget = descriptor.eventTarget || element; 6737 this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error2("missing event name"); 6738 this.eventOptions = descriptor.eventOptions || {}; 6739 this.identifier = descriptor.identifier || error2("missing identifier"); 6740 this.methodName = descriptor.methodName || error2("missing method name"); 6741 this.keyFilter = descriptor.keyFilter || ""; 6742 this.schema = schema; 6743 } 6744 static forToken(token, schema) { 6745 return new this(token.element, token.index, parseActionDescriptorString(token.content), schema); 6746 } 6747 toString() { 6748 const eventFilter = this.keyFilter ? `.${this.keyFilter}` : ""; 6749 const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : ""; 6750 return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`; 6751 } 6752 shouldIgnoreKeyboardEvent(event) { 6753 if (!this.keyFilter) { 6754 return false; 6755 } 6756 const filters = this.keyFilter.split("+"); 6757 if (this.keyFilterDissatisfied(event, filters)) { 6758 return true; 6759 } 6760 const standardFilter = filters.filter((key) => !allModifiers.includes(key))[0]; 6761 if (!standardFilter) { 6762 return false; 6763 } 6764 if (!hasProperty(this.keyMappings, standardFilter)) { 6765 error2(`contains unknown key filter: ${this.keyFilter}`); 6766 } 6767 return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase(); 6768 } 6769 shouldIgnoreMouseEvent(event) { 6770 if (!this.keyFilter) { 6771 return false; 6772 } 6773 const filters = [this.keyFilter]; 6774 if (this.keyFilterDissatisfied(event, filters)) { 6775 return true; 6776 } 6777 return false; 6778 } 6779 get params() { 6780 const params = {}; 6781 const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, "i"); 6782 for (const { name, value } of Array.from(this.element.attributes)) { 6783 const match = name.match(pattern); 6784 const key = match && match[1]; 6785 if (key) { 6786 params[camelize(key)] = typecast(value); 6787 } 6788 } 6789 return params; 6790 } 6791 get eventTargetName() { 6792 return stringifyEventTarget(this.eventTarget); 6793 } 6794 get keyMappings() { 6795 return this.schema.keyMappings; 6796 } 6797 keyFilterDissatisfied(event, filters) { 6798 const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier)); 6799 return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift; 6800 } 6801 } 6802 const defaultEventNames = { 6803 a: () => "click", 6804 button: () => "click", 6805 form: () => "submit", 6806 details: () => "toggle", 6807 input: (e) => e.getAttribute("type") == "submit" ? "click" : "input", 6808 select: () => "change", 6809 textarea: () => "input" 6810 }; 6811 function getDefaultEventNameForElement(element) { 6812 const tagName = element.tagName.toLowerCase(); 6813 if (tagName in defaultEventNames) { 6814 return defaultEventNames[tagName](element); 6815 } 6816 } 6817 function error2(message) { 6818 throw new Error(message); 6819 } 6820 function typecast(value) { 6821 try { 6822 return JSON.parse(value); 6823 } catch (o_O) { 6824 return value; 6825 } 6826 } 6827 class Binding { 6828 constructor(context, action) { 6829 this.context = context; 6830 this.action = action; 6831 } 6832 get index() { 6833 return this.action.index; 6834 } 6835 get eventTarget() { 6836 return this.action.eventTarget; 6837 } 6838 get eventOptions() { 6839 return this.action.eventOptions; 6840 } 6841 get identifier() { 6842 return this.context.identifier; 6843 } 6844 handleEvent(event) { 6845 const actionEvent = this.prepareActionEvent(event); 6846 if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) { 6847 this.invokeWithEvent(actionEvent); 6848 } 6849 } 6850 get eventName() { 6851 return this.action.eventName; 6852 } 6853 get method() { 6854 const method = this.controller[this.methodName]; 6855 if (typeof method == "function") { 6856 return method; 6857 } 6858 throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`); 6859 } 6860 applyEventModifiers(event) { 6861 const { element } = this.action; 6862 const { actionDescriptorFilters } = this.context.application; 6863 const { controller } = this.context; 6864 let passes = true; 6865 for (const [name, value] of Object.entries(this.eventOptions)) { 6866 if (name in actionDescriptorFilters) { 6867 const filter = actionDescriptorFilters[name]; 6868 passes = passes && filter({ name, value, event, element, controller }); 6869 } else { 6870 continue; 6871 } 6872 } 6873 return passes; 6874 } 6875 prepareActionEvent(event) { 6876 return Object.assign(event, { params: this.action.params }); 6877 } 6878 invokeWithEvent(event) { 6879 const { target, currentTarget } = event; 6880 try { 6881 this.method.call(this.controller, event); 6882 this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName }); 6883 } catch (error3) { 6884 const { identifier, controller, element, index } = this; 6885 const detail = { identifier, controller, element, index, event }; 6886 this.context.handleError(error3, `invoking action "${this.action}"`, detail); 6887 } 6888 } 6889 willBeInvokedByEvent(event) { 6890 const eventTarget = event.target; 6891 if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) { 6892 return false; 6893 } 6894 if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) { 6895 return false; 6896 } 6897 if (this.element === eventTarget) { 6898 return true; 6899 } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) { 6900 return this.scope.containsElement(eventTarget); 6901 } else { 6902 return this.scope.containsElement(this.action.element); 6903 } 6904 } 6905 get controller() { 6906 return this.context.controller; 6907 } 6908 get methodName() { 6909 return this.action.methodName; 6910 } 6911 get element() { 6912 return this.scope.element; 6913 } 6914 get scope() { 6915 return this.context.scope; 6916 } 6917 } 6918 class ElementObserver { 6919 constructor(element, delegate) { 6920 this.mutationObserverInit = { attributes: true, childList: true, subtree: true }; 6921 this.element = element; 6922 this.started = false; 6923 this.delegate = delegate; 6924 this.elements = /* @__PURE__ */ new Set(); 6925 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 6926 } 6927 start() { 6928 if (!this.started) { 6929 this.started = true; 6930 this.mutationObserver.observe(this.element, this.mutationObserverInit); 6931 this.refresh(); 6932 } 6933 } 6934 pause(callback) { 6935 if (this.started) { 6936 this.mutationObserver.disconnect(); 6937 this.started = false; 6938 } 6939 callback(); 6940 if (!this.started) { 6941 this.mutationObserver.observe(this.element, this.mutationObserverInit); 6942 this.started = true; 6943 } 6944 } 6945 stop() { 6946 if (this.started) { 6947 this.mutationObserver.takeRecords(); 6948 this.mutationObserver.disconnect(); 6949 this.started = false; 6950 } 6951 } 6952 refresh() { 6953 if (this.started) { 6954 const matches = new Set(this.matchElementsInTree()); 6955 for (const element of Array.from(this.elements)) { 6956 if (!matches.has(element)) { 6957 this.removeElement(element); 6958 } 6959 } 6960 for (const element of Array.from(matches)) { 6961 this.addElement(element); 6962 } 6963 } 6964 } 6965 processMutations(mutations) { 6966 if (this.started) { 6967 for (const mutation of mutations) { 6968 this.processMutation(mutation); 6969 } 6970 } 6971 } 6972 processMutation(mutation) { 6973 if (mutation.type == "attributes") { 6974 this.processAttributeChange(mutation.target, mutation.attributeName); 6975 } else if (mutation.type == "childList") { 6976 this.processRemovedNodes(mutation.removedNodes); 6977 this.processAddedNodes(mutation.addedNodes); 6978 } 6979 } 6980 processAttributeChange(element, attributeName) { 6981 if (this.elements.has(element)) { 6982 if (this.delegate.elementAttributeChanged && this.matchElement(element)) { 6983 this.delegate.elementAttributeChanged(element, attributeName); 6984 } else { 6985 this.removeElement(element); 6986 } 6987 } else if (this.matchElement(element)) { 6988 this.addElement(element); 6989 } 6990 } 6991 processRemovedNodes(nodes) { 6992 for (const node of Array.from(nodes)) { 6993 const element = this.elementFromNode(node); 6994 if (element) { 6995 this.processTree(element, this.removeElement); 6996 } 6997 } 6998 } 6999 processAddedNodes(nodes) { 7000 for (const node of Array.from(nodes)) { 7001 const element = this.elementFromNode(node); 7002 if (element && this.elementIsActive(element)) { 7003 this.processTree(element, this.addElement); 7004 } 7005 } 7006 } 7007 matchElement(element) { 7008 return this.delegate.matchElement(element); 7009 } 7010 matchElementsInTree(tree = this.element) { 7011 return this.delegate.matchElementsInTree(tree); 7012 } 7013 processTree(tree, processor) { 7014 for (const element of this.matchElementsInTree(tree)) { 7015 processor.call(this, element); 7016 } 7017 } 7018 elementFromNode(node) { 7019 if (node.nodeType == Node.ELEMENT_NODE) { 7020 return node; 7021 } 7022 } 7023 elementIsActive(element) { 7024 if (element.isConnected != this.element.isConnected) { 7025 return false; 7026 } else { 7027 return this.element.contains(element); 7028 } 7029 } 7030 addElement(element) { 7031 if (!this.elements.has(element)) { 7032 if (this.elementIsActive(element)) { 7033 this.elements.add(element); 7034 if (this.delegate.elementMatched) { 7035 this.delegate.elementMatched(element); 7036 } 7037 } 7038 } 7039 } 7040 removeElement(element) { 7041 if (this.elements.has(element)) { 7042 this.elements.delete(element); 7043 if (this.delegate.elementUnmatched) { 7044 this.delegate.elementUnmatched(element); 7045 } 7046 } 7047 } 7048 } 7049 class AttributeObserver { 7050 constructor(element, attributeName, delegate) { 7051 this.attributeName = attributeName; 7052 this.delegate = delegate; 7053 this.elementObserver = new ElementObserver(element, this); 7054 } 7055 get element() { 7056 return this.elementObserver.element; 7057 } 7058 get selector() { 7059 return `[${this.attributeName}]`; 7060 } 7061 start() { 7062 this.elementObserver.start(); 7063 } 7064 pause(callback) { 7065 this.elementObserver.pause(callback); 7066 } 7067 stop() { 7068 this.elementObserver.stop(); 7069 } 7070 refresh() { 7071 this.elementObserver.refresh(); 7072 } 7073 get started() { 7074 return this.elementObserver.started; 7075 } 7076 matchElement(element) { 7077 return element.hasAttribute(this.attributeName); 7078 } 7079 matchElementsInTree(tree) { 7080 const match = this.matchElement(tree) ? [tree] : []; 7081 const matches = Array.from(tree.querySelectorAll(this.selector)); 7082 return match.concat(matches); 7083 } 7084 elementMatched(element) { 7085 if (this.delegate.elementMatchedAttribute) { 7086 this.delegate.elementMatchedAttribute(element, this.attributeName); 7087 } 7088 } 7089 elementUnmatched(element) { 7090 if (this.delegate.elementUnmatchedAttribute) { 7091 this.delegate.elementUnmatchedAttribute(element, this.attributeName); 7092 } 7093 } 7094 elementAttributeChanged(element, attributeName) { 7095 if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) { 7096 this.delegate.elementAttributeValueChanged(element, attributeName); 7097 } 7098 } 7099 } 7100 function add(map, key, value) { 7101 fetch2(map, key).add(value); 7102 } 7103 function del(map, key, value) { 7104 fetch2(map, key).delete(value); 7105 prune(map, key); 7106 } 7107 function fetch2(map, key) { 7108 let values = map.get(key); 7109 if (!values) { 7110 values = /* @__PURE__ */ new Set(); 7111 map.set(key, values); 7112 } 7113 return values; 7114 } 7115 function prune(map, key) { 7116 const values = map.get(key); 7117 if (values != null && values.size == 0) { 7118 map.delete(key); 7119 } 7120 } 7121 class Multimap { 7122 constructor() { 7123 this.valuesByKey = /* @__PURE__ */ new Map(); 7124 } 7125 get keys() { 7126 return Array.from(this.valuesByKey.keys()); 7127 } 7128 get values() { 7129 const sets2 = Array.from(this.valuesByKey.values()); 7130 return sets2.reduce((values, set) => values.concat(Array.from(set)), []); 7131 } 7132 get size() { 7133 const sets2 = Array.from(this.valuesByKey.values()); 7134 return sets2.reduce((size, set) => size + set.size, 0); 7135 } 7136 add(key, value) { 7137 add(this.valuesByKey, key, value); 7138 } 7139 delete(key, value) { 7140 del(this.valuesByKey, key, value); 7141 } 7142 has(key, value) { 7143 const values = this.valuesByKey.get(key); 7144 return values != null && values.has(value); 7145 } 7146 hasKey(key) { 7147 return this.valuesByKey.has(key); 7148 } 7149 hasValue(value) { 7150 const sets2 = Array.from(this.valuesByKey.values()); 7151 return sets2.some((set) => set.has(value)); 7152 } 7153 getValuesForKey(key) { 7154 const values = this.valuesByKey.get(key); 7155 return values ? Array.from(values) : []; 7156 } 7157 getKeysForValue(value) { 7158 return Array.from(this.valuesByKey).filter(([_key, values]) => values.has(value)).map(([key, _values]) => key); 7159 } 7160 } 7161 class IndexedMultimap extends Multimap { 7162 constructor() { 7163 super(); 7164 this.keysByValue = /* @__PURE__ */ new Map(); 7165 } 7166 get values() { 7167 return Array.from(this.keysByValue.keys()); 7168 } 7169 add(key, value) { 7170 super.add(key, value); 7171 add(this.keysByValue, value, key); 7172 } 7173 delete(key, value) { 7174 super.delete(key, value); 7175 del(this.keysByValue, value, key); 7176 } 7177 hasValue(value) { 7178 return this.keysByValue.has(value); 7179 } 7180 getKeysForValue(value) { 7181 const set = this.keysByValue.get(value); 7182 return set ? Array.from(set) : []; 7183 } 7184 } 7185 class SelectorObserver { 7186 constructor(element, selector, delegate, details) { 7187 this._selector = selector; 7188 this.details = details; 7189 this.elementObserver = new ElementObserver(element, this); 7190 this.delegate = delegate; 7191 this.matchesByElement = new Multimap(); 7192 } 7193 get started() { 7194 return this.elementObserver.started; 7195 } 7196 get selector() { 7197 return this._selector; 7198 } 7199 set selector(selector) { 7200 this._selector = selector; 7201 this.refresh(); 7202 } 7203 start() { 7204 this.elementObserver.start(); 7205 } 7206 pause(callback) { 7207 this.elementObserver.pause(callback); 7208 } 7209 stop() { 7210 this.elementObserver.stop(); 7211 } 7212 refresh() { 7213 this.elementObserver.refresh(); 7214 } 7215 get element() { 7216 return this.elementObserver.element; 7217 } 7218 matchElement(element) { 7219 const { selector } = this; 7220 if (selector) { 7221 const matches = element.matches(selector); 7222 if (this.delegate.selectorMatchElement) { 7223 return matches && this.delegate.selectorMatchElement(element, this.details); 7224 } 7225 return matches; 7226 } else { 7227 return false; 7228 } 7229 } 7230 matchElementsInTree(tree) { 7231 const { selector } = this; 7232 if (selector) { 7233 const match = this.matchElement(tree) ? [tree] : []; 7234 const matches = Array.from(tree.querySelectorAll(selector)).filter((match2) => this.matchElement(match2)); 7235 return match.concat(matches); 7236 } else { 7237 return []; 7238 } 7239 } 7240 elementMatched(element) { 7241 const { selector } = this; 7242 if (selector) { 7243 this.selectorMatched(element, selector); 7244 } 7245 } 7246 elementUnmatched(element) { 7247 const selectors = this.matchesByElement.getKeysForValue(element); 7248 for (const selector of selectors) { 7249 this.selectorUnmatched(element, selector); 7250 } 7251 } 7252 elementAttributeChanged(element, _attributeName) { 7253 const { selector } = this; 7254 if (selector) { 7255 const matches = this.matchElement(element); 7256 const matchedBefore = this.matchesByElement.has(selector, element); 7257 if (matches && !matchedBefore) { 7258 this.selectorMatched(element, selector); 7259 } else if (!matches && matchedBefore) { 7260 this.selectorUnmatched(element, selector); 7261 } 7262 } 7263 } 7264 selectorMatched(element, selector) { 7265 this.delegate.selectorMatched(element, selector, this.details); 7266 this.matchesByElement.add(selector, element); 7267 } 7268 selectorUnmatched(element, selector) { 7269 this.delegate.selectorUnmatched(element, selector, this.details); 7270 this.matchesByElement.delete(selector, element); 7271 } 7272 } 7273 class StringMapObserver { 7274 constructor(element, delegate) { 7275 this.element = element; 7276 this.delegate = delegate; 7277 this.started = false; 7278 this.stringMap = /* @__PURE__ */ new Map(); 7279 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 7280 } 7281 start() { 7282 if (!this.started) { 7283 this.started = true; 7284 this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true }); 7285 this.refresh(); 7286 } 7287 } 7288 stop() { 7289 if (this.started) { 7290 this.mutationObserver.takeRecords(); 7291 this.mutationObserver.disconnect(); 7292 this.started = false; 7293 } 7294 } 7295 refresh() { 7296 if (this.started) { 7297 for (const attributeName of this.knownAttributeNames) { 7298 this.refreshAttribute(attributeName, null); 7299 } 7300 } 7301 } 7302 processMutations(mutations) { 7303 if (this.started) { 7304 for (const mutation of mutations) { 7305 this.processMutation(mutation); 7306 } 7307 } 7308 } 7309 processMutation(mutation) { 7310 const attributeName = mutation.attributeName; 7311 if (attributeName) { 7312 this.refreshAttribute(attributeName, mutation.oldValue); 7313 } 7314 } 7315 refreshAttribute(attributeName, oldValue) { 7316 const key = this.delegate.getStringMapKeyForAttribute(attributeName); 7317 if (key != null) { 7318 if (!this.stringMap.has(attributeName)) { 7319 this.stringMapKeyAdded(key, attributeName); 7320 } 7321 const value = this.element.getAttribute(attributeName); 7322 if (this.stringMap.get(attributeName) != value) { 7323 this.stringMapValueChanged(value, key, oldValue); 7324 } 7325 if (value == null) { 7326 const oldValue2 = this.stringMap.get(attributeName); 7327 this.stringMap.delete(attributeName); 7328 if (oldValue2) 7329 this.stringMapKeyRemoved(key, attributeName, oldValue2); 7330 } else { 7331 this.stringMap.set(attributeName, value); 7332 } 7333 } 7334 } 7335 stringMapKeyAdded(key, attributeName) { 7336 if (this.delegate.stringMapKeyAdded) { 7337 this.delegate.stringMapKeyAdded(key, attributeName); 7338 } 7339 } 7340 stringMapValueChanged(value, key, oldValue) { 7341 if (this.delegate.stringMapValueChanged) { 7342 this.delegate.stringMapValueChanged(value, key, oldValue); 7343 } 7344 } 7345 stringMapKeyRemoved(key, attributeName, oldValue) { 7346 if (this.delegate.stringMapKeyRemoved) { 7347 this.delegate.stringMapKeyRemoved(key, attributeName, oldValue); 7348 } 7349 } 7350 get knownAttributeNames() { 7351 return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames))); 7352 } 7353 get currentAttributeNames() { 7354 return Array.from(this.element.attributes).map((attribute) => attribute.name); 7355 } 7356 get recordedAttributeNames() { 7357 return Array.from(this.stringMap.keys()); 7358 } 7359 } 7360 class TokenListObserver { 7361 constructor(element, attributeName, delegate) { 7362 this.attributeObserver = new AttributeObserver(element, attributeName, this); 7363 this.delegate = delegate; 7364 this.tokensByElement = new Multimap(); 7365 } 7366 get started() { 7367 return this.attributeObserver.started; 7368 } 7369 start() { 7370 this.attributeObserver.start(); 7371 } 7372 pause(callback) { 7373 this.attributeObserver.pause(callback); 7374 } 7375 stop() { 7376 this.attributeObserver.stop(); 7377 } 7378 refresh() { 7379 this.attributeObserver.refresh(); 7380 } 7381 get element() { 7382 return this.attributeObserver.element; 7383 } 7384 get attributeName() { 7385 return this.attributeObserver.attributeName; 7386 } 7387 elementMatchedAttribute(element) { 7388 this.tokensMatched(this.readTokensForElement(element)); 7389 } 7390 elementAttributeValueChanged(element) { 7391 const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element); 7392 this.tokensUnmatched(unmatchedTokens); 7393 this.tokensMatched(matchedTokens); 7394 } 7395 elementUnmatchedAttribute(element) { 7396 this.tokensUnmatched(this.tokensByElement.getValuesForKey(element)); 7397 } 7398 tokensMatched(tokens) { 7399 tokens.forEach((token) => this.tokenMatched(token)); 7400 } 7401 tokensUnmatched(tokens) { 7402 tokens.forEach((token) => this.tokenUnmatched(token)); 7403 } 7404 tokenMatched(token) { 7405 this.delegate.tokenMatched(token); 7406 this.tokensByElement.add(token.element, token); 7407 } 7408 tokenUnmatched(token) { 7409 this.delegate.tokenUnmatched(token); 7410 this.tokensByElement.delete(token.element, token); 7411 } 7412 refreshTokensForElement(element) { 7413 const previousTokens = this.tokensByElement.getValuesForKey(element); 7414 const currentTokens = this.readTokensForElement(element); 7415 const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken)); 7416 if (firstDifferingIndex == -1) { 7417 return [[], []]; 7418 } else { 7419 return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)]; 7420 } 7421 } 7422 readTokensForElement(element) { 7423 const attributeName = this.attributeName; 7424 const tokenString = element.getAttribute(attributeName) || ""; 7425 return parseTokenString(tokenString, element, attributeName); 7426 } 7427 } 7428 function parseTokenString(tokenString, element, attributeName) { 7429 return tokenString.trim().split(/\s+/).filter((content) => content.length).map((content, index) => ({ element, attributeName, content, index })); 7430 } 7431 function zip(left, right) { 7432 const length = Math.max(left.length, right.length); 7433 return Array.from({ length }, (_23, index) => [left[index], right[index]]); 7434 } 7435 function tokensAreEqual(left, right) { 7436 return left && right && left.index == right.index && left.content == right.content; 7437 } 7438 class ValueListObserver { 7439 constructor(element, attributeName, delegate) { 7440 this.tokenListObserver = new TokenListObserver(element, attributeName, this); 7441 this.delegate = delegate; 7442 this.parseResultsByToken = /* @__PURE__ */ new WeakMap(); 7443 this.valuesByTokenByElement = /* @__PURE__ */ new WeakMap(); 7444 } 7445 get started() { 7446 return this.tokenListObserver.started; 7447 } 7448 start() { 7449 this.tokenListObserver.start(); 7450 } 7451 stop() { 7452 this.tokenListObserver.stop(); 7453 } 7454 refresh() { 7455 this.tokenListObserver.refresh(); 7456 } 7457 get element() { 7458 return this.tokenListObserver.element; 7459 } 7460 get attributeName() { 7461 return this.tokenListObserver.attributeName; 7462 } 7463 tokenMatched(token) { 7464 const { element } = token; 7465 const { value } = this.fetchParseResultForToken(token); 7466 if (value) { 7467 this.fetchValuesByTokenForElement(element).set(token, value); 7468 this.delegate.elementMatchedValue(element, value); 7469 } 7470 } 7471 tokenUnmatched(token) { 7472 const { element } = token; 7473 const { value } = this.fetchParseResultForToken(token); 7474 if (value) { 7475 this.fetchValuesByTokenForElement(element).delete(token); 7476 this.delegate.elementUnmatchedValue(element, value); 7477 } 7478 } 7479 fetchParseResultForToken(token) { 7480 let parseResult = this.parseResultsByToken.get(token); 7481 if (!parseResult) { 7482 parseResult = this.parseToken(token); 7483 this.parseResultsByToken.set(token, parseResult); 7484 } 7485 return parseResult; 7486 } 7487 fetchValuesByTokenForElement(element) { 7488 let valuesByToken = this.valuesByTokenByElement.get(element); 7489 if (!valuesByToken) { 7490 valuesByToken = /* @__PURE__ */ new Map(); 7491 this.valuesByTokenByElement.set(element, valuesByToken); 7492 } 7493 return valuesByToken; 7494 } 7495 parseToken(token) { 7496 try { 7497 const value = this.delegate.parseValueForToken(token); 7498 return { value }; 7499 } catch (error3) { 7500 return { error: error3 }; 7501 } 7502 } 7503 } 7504 class BindingObserver { 7505 constructor(context, delegate) { 7506 this.context = context; 7507 this.delegate = delegate; 7508 this.bindingsByAction = /* @__PURE__ */ new Map(); 7509 } 7510 start() { 7511 if (!this.valueListObserver) { 7512 this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this); 7513 this.valueListObserver.start(); 7514 } 7515 } 7516 stop() { 7517 if (this.valueListObserver) { 7518 this.valueListObserver.stop(); 7519 delete this.valueListObserver; 7520 this.disconnectAllActions(); 7521 } 7522 } 7523 get element() { 7524 return this.context.element; 7525 } 7526 get identifier() { 7527 return this.context.identifier; 7528 } 7529 get actionAttribute() { 7530 return this.schema.actionAttribute; 7531 } 7532 get schema() { 7533 return this.context.schema; 7534 } 7535 get bindings() { 7536 return Array.from(this.bindingsByAction.values()); 7537 } 7538 connectAction(action) { 7539 const binding = new Binding(this.context, action); 7540 this.bindingsByAction.set(action, binding); 7541 this.delegate.bindingConnected(binding); 7542 } 7543 disconnectAction(action) { 7544 const binding = this.bindingsByAction.get(action); 7545 if (binding) { 7546 this.bindingsByAction.delete(action); 7547 this.delegate.bindingDisconnected(binding); 7548 } 7549 } 7550 disconnectAllActions() { 7551 this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true)); 7552 this.bindingsByAction.clear(); 7553 } 7554 parseValueForToken(token) { 7555 const action = Action.forToken(token, this.schema); 7556 if (action.identifier == this.identifier) { 7557 return action; 7558 } 7559 } 7560 elementMatchedValue(element, action) { 7561 this.connectAction(action); 7562 } 7563 elementUnmatchedValue(element, action) { 7564 this.disconnectAction(action); 7565 } 7566 } 7567 class ValueObserver { 7568 constructor(context, receiver) { 7569 this.context = context; 7570 this.receiver = receiver; 7571 this.stringMapObserver = new StringMapObserver(this.element, this); 7572 this.valueDescriptorMap = this.controller.valueDescriptorMap; 7573 } 7574 start() { 7575 this.stringMapObserver.start(); 7576 this.invokeChangedCallbacksForDefaultValues(); 7577 } 7578 stop() { 7579 this.stringMapObserver.stop(); 7580 } 7581 get element() { 7582 return this.context.element; 7583 } 7584 get controller() { 7585 return this.context.controller; 7586 } 7587 getStringMapKeyForAttribute(attributeName) { 7588 if (attributeName in this.valueDescriptorMap) { 7589 return this.valueDescriptorMap[attributeName].name; 7590 } 7591 } 7592 stringMapKeyAdded(key, attributeName) { 7593 const descriptor = this.valueDescriptorMap[attributeName]; 7594 if (!this.hasValue(key)) { 7595 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue)); 7596 } 7597 } 7598 stringMapValueChanged(value, name, oldValue) { 7599 const descriptor = this.valueDescriptorNameMap[name]; 7600 if (value === null) 7601 return; 7602 if (oldValue === null) { 7603 oldValue = descriptor.writer(descriptor.defaultValue); 7604 } 7605 this.invokeChangedCallback(name, value, oldValue); 7606 } 7607 stringMapKeyRemoved(key, attributeName, oldValue) { 7608 const descriptor = this.valueDescriptorNameMap[key]; 7609 if (this.hasValue(key)) { 7610 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue); 7611 } else { 7612 this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue); 7613 } 7614 } 7615 invokeChangedCallbacksForDefaultValues() { 7616 for (const { key, name, defaultValue, writer } of this.valueDescriptors) { 7617 if (defaultValue != void 0 && !this.controller.data.has(key)) { 7618 this.invokeChangedCallback(name, writer(defaultValue), void 0); 7619 } 7620 } 7621 } 7622 invokeChangedCallback(name, rawValue, rawOldValue) { 7623 const changedMethodName = `${name}Changed`; 7624 const changedMethod = this.receiver[changedMethodName]; 7625 if (typeof changedMethod == "function") { 7626 const descriptor = this.valueDescriptorNameMap[name]; 7627 try { 7628 const value = descriptor.reader(rawValue); 7629 let oldValue = rawOldValue; 7630 if (rawOldValue) { 7631 oldValue = descriptor.reader(rawOldValue); 7632 } 7633 changedMethod.call(this.receiver, value, oldValue); 7634 } catch (error3) { 7635 if (error3 instanceof TypeError) { 7636 error3.message = `Stimulus Value "${this.context.identifier}.${descriptor.name}" - ${error3.message}`; 7637 } 7638 throw error3; 7639 } 7640 } 7641 } 7642 get valueDescriptors() { 7643 const { valueDescriptorMap } = this; 7644 return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]); 7645 } 7646 get valueDescriptorNameMap() { 7647 const descriptors = {}; 7648 Object.keys(this.valueDescriptorMap).forEach((key) => { 7649 const descriptor = this.valueDescriptorMap[key]; 7650 descriptors[descriptor.name] = descriptor; 7651 }); 7652 return descriptors; 7653 } 7654 hasValue(attributeName) { 7655 const descriptor = this.valueDescriptorNameMap[attributeName]; 7656 const hasMethodName = `has${capitalize2(descriptor.name)}`; 7657 return this.receiver[hasMethodName]; 7658 } 7659 } 7660 class TargetObserver { 7661 constructor(context, delegate) { 7662 this.context = context; 7663 this.delegate = delegate; 7664 this.targetsByName = new Multimap(); 7665 } 7666 start() { 7667 if (!this.tokenListObserver) { 7668 this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this); 7669 this.tokenListObserver.start(); 7670 } 7671 } 7672 stop() { 7673 if (this.tokenListObserver) { 7674 this.disconnectAllTargets(); 7675 this.tokenListObserver.stop(); 7676 delete this.tokenListObserver; 7677 } 7678 } 7679 tokenMatched({ element, content: name }) { 7680 if (this.scope.containsElement(element)) { 7681 this.connectTarget(element, name); 7682 } 7683 } 7684 tokenUnmatched({ element, content: name }) { 7685 this.disconnectTarget(element, name); 7686 } 7687 connectTarget(element, name) { 7688 var _a; 7689 if (!this.targetsByName.has(name, element)) { 7690 this.targetsByName.add(name, element); 7691 (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name)); 7692 } 7693 } 7694 disconnectTarget(element, name) { 7695 var _a; 7696 if (this.targetsByName.has(name, element)) { 7697 this.targetsByName.delete(name, element); 7698 (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name)); 7699 } 7700 } 7701 disconnectAllTargets() { 7702 for (const name of this.targetsByName.keys) { 7703 for (const element of this.targetsByName.getValuesForKey(name)) { 7704 this.disconnectTarget(element, name); 7705 } 7706 } 7707 } 7708 get attributeName() { 7709 return `data-${this.context.identifier}-target`; 7710 } 7711 get element() { 7712 return this.context.element; 7713 } 7714 get scope() { 7715 return this.context.scope; 7716 } 7717 } 7718 function readInheritableStaticArrayValues(constructor, propertyName) { 7719 const ancestors = getAncestorsForConstructor(constructor); 7720 return Array.from(ancestors.reduce((values, constructor2) => { 7721 getOwnStaticArrayValues(constructor2, propertyName).forEach((name) => values.add(name)); 7722 return values; 7723 }, /* @__PURE__ */ new Set())); 7724 } 7725 function readInheritableStaticObjectPairs(constructor, propertyName) { 7726 const ancestors = getAncestorsForConstructor(constructor); 7727 return ancestors.reduce((pairs, constructor2) => { 7728 pairs.push(...getOwnStaticObjectPairs(constructor2, propertyName)); 7729 return pairs; 7730 }, []); 7731 } 7732 function getAncestorsForConstructor(constructor) { 7733 const ancestors = []; 7734 while (constructor) { 7735 ancestors.push(constructor); 7736 constructor = Object.getPrototypeOf(constructor); 7737 } 7738 return ancestors.reverse(); 7739 } 7740 function getOwnStaticArrayValues(constructor, propertyName) { 7741 const definition = constructor[propertyName]; 7742 return Array.isArray(definition) ? definition : []; 7743 } 7744 function getOwnStaticObjectPairs(constructor, propertyName) { 7745 const definition = constructor[propertyName]; 7746 return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : []; 7747 } 7748 class OutletObserver { 7749 constructor(context, delegate) { 7750 this.started = false; 7751 this.context = context; 7752 this.delegate = delegate; 7753 this.outletsByName = new Multimap(); 7754 this.outletElementsByName = new Multimap(); 7755 this.selectorObserverMap = /* @__PURE__ */ new Map(); 7756 this.attributeObserverMap = /* @__PURE__ */ new Map(); 7757 } 7758 start() { 7759 if (!this.started) { 7760 this.outletDefinitions.forEach((outletName) => { 7761 this.setupSelectorObserverForOutlet(outletName); 7762 this.setupAttributeObserverForOutlet(outletName); 7763 }); 7764 this.started = true; 7765 this.dependentContexts.forEach((context) => context.refresh()); 7766 } 7767 } 7768 refresh() { 7769 this.selectorObserverMap.forEach((observer) => observer.refresh()); 7770 this.attributeObserverMap.forEach((observer) => observer.refresh()); 7771 } 7772 stop() { 7773 if (this.started) { 7774 this.started = false; 7775 this.disconnectAllOutlets(); 7776 this.stopSelectorObservers(); 7777 this.stopAttributeObservers(); 7778 } 7779 } 7780 stopSelectorObservers() { 7781 if (this.selectorObserverMap.size > 0) { 7782 this.selectorObserverMap.forEach((observer) => observer.stop()); 7783 this.selectorObserverMap.clear(); 7784 } 7785 } 7786 stopAttributeObservers() { 7787 if (this.attributeObserverMap.size > 0) { 7788 this.attributeObserverMap.forEach((observer) => observer.stop()); 7789 this.attributeObserverMap.clear(); 7790 } 7791 } 7792 selectorMatched(element, _selector, { outletName }) { 7793 const outlet = this.getOutlet(element, outletName); 7794 if (outlet) { 7795 this.connectOutlet(outlet, element, outletName); 7796 } 7797 } 7798 selectorUnmatched(element, _selector, { outletName }) { 7799 const outlet = this.getOutletFromMap(element, outletName); 7800 if (outlet) { 7801 this.disconnectOutlet(outlet, element, outletName); 7802 } 7803 } 7804 selectorMatchElement(element, { outletName }) { 7805 const selector = this.selector(outletName); 7806 const hasOutlet = this.hasOutlet(element, outletName); 7807 const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`); 7808 if (selector) { 7809 return hasOutlet && hasOutletController && element.matches(selector); 7810 } else { 7811 return false; 7812 } 7813 } 7814 elementMatchedAttribute(_element, attributeName) { 7815 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 7816 if (outletName) { 7817 this.updateSelectorObserverForOutlet(outletName); 7818 } 7819 } 7820 elementAttributeValueChanged(_element, attributeName) { 7821 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 7822 if (outletName) { 7823 this.updateSelectorObserverForOutlet(outletName); 7824 } 7825 } 7826 elementUnmatchedAttribute(_element, attributeName) { 7827 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 7828 if (outletName) { 7829 this.updateSelectorObserverForOutlet(outletName); 7830 } 7831 } 7832 connectOutlet(outlet, element, outletName) { 7833 var _a; 7834 if (!this.outletElementsByName.has(outletName, element)) { 7835 this.outletsByName.add(outletName, outlet); 7836 this.outletElementsByName.add(outletName, element); 7837 (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName)); 7838 } 7839 } 7840 disconnectOutlet(outlet, element, outletName) { 7841 var _a; 7842 if (this.outletElementsByName.has(outletName, element)) { 7843 this.outletsByName.delete(outletName, outlet); 7844 this.outletElementsByName.delete(outletName, element); 7845 (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName)); 7846 } 7847 } 7848 disconnectAllOutlets() { 7849 for (const outletName of this.outletElementsByName.keys) { 7850 for (const element of this.outletElementsByName.getValuesForKey(outletName)) { 7851 for (const outlet of this.outletsByName.getValuesForKey(outletName)) { 7852 this.disconnectOutlet(outlet, element, outletName); 7853 } 7854 } 7855 } 7856 } 7857 updateSelectorObserverForOutlet(outletName) { 7858 const observer = this.selectorObserverMap.get(outletName); 7859 if (observer) { 7860 observer.selector = this.selector(outletName); 7861 } 7862 } 7863 setupSelectorObserverForOutlet(outletName) { 7864 const selector = this.selector(outletName); 7865 const selectorObserver = new SelectorObserver(document.body, selector, this, { outletName }); 7866 this.selectorObserverMap.set(outletName, selectorObserver); 7867 selectorObserver.start(); 7868 } 7869 setupAttributeObserverForOutlet(outletName) { 7870 const attributeName = this.attributeNameForOutletName(outletName); 7871 const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this); 7872 this.attributeObserverMap.set(outletName, attributeObserver); 7873 attributeObserver.start(); 7874 } 7875 selector(outletName) { 7876 return this.scope.outlets.getSelectorForOutletName(outletName); 7877 } 7878 attributeNameForOutletName(outletName) { 7879 return this.scope.schema.outletAttributeForScope(this.identifier, outletName); 7880 } 7881 getOutletNameFromOutletAttributeName(attributeName) { 7882 return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName); 7883 } 7884 get outletDependencies() { 7885 const dependencies = new Multimap(); 7886 this.router.modules.forEach((module2) => { 7887 const constructor = module2.definition.controllerConstructor; 7888 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 7889 outlets.forEach((outlet) => dependencies.add(outlet, module2.identifier)); 7890 }); 7891 return dependencies; 7892 } 7893 get outletDefinitions() { 7894 return this.outletDependencies.getKeysForValue(this.identifier); 7895 } 7896 get dependentControllerIdentifiers() { 7897 return this.outletDependencies.getValuesForKey(this.identifier); 7898 } 7899 get dependentContexts() { 7900 const identifiers = this.dependentControllerIdentifiers; 7901 return this.router.contexts.filter((context) => identifiers.includes(context.identifier)); 7902 } 7903 hasOutlet(element, outletName) { 7904 return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName); 7905 } 7906 getOutlet(element, outletName) { 7907 return this.application.getControllerForElementAndIdentifier(element, outletName); 7908 } 7909 getOutletFromMap(element, outletName) { 7910 return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element); 7911 } 7912 get scope() { 7913 return this.context.scope; 7914 } 7915 get schema() { 7916 return this.context.schema; 7917 } 7918 get identifier() { 7919 return this.context.identifier; 7920 } 7921 get application() { 7922 return this.context.application; 7923 } 7924 get router() { 7925 return this.application.router; 7926 } 7927 } 7928 class Context { 7929 constructor(module2, scope) { 7930 this.logDebugActivity = (functionName, detail = {}) => { 7931 const { identifier, controller, element } = this; 7932 detail = Object.assign({ identifier, controller, element }, detail); 7933 this.application.logDebugActivity(this.identifier, functionName, detail); 7934 }; 7935 this.module = module2; 7936 this.scope = scope; 7937 this.controller = new module2.controllerConstructor(this); 7938 this.bindingObserver = new BindingObserver(this, this.dispatcher); 7939 this.valueObserver = new ValueObserver(this, this.controller); 7940 this.targetObserver = new TargetObserver(this, this); 7941 this.outletObserver = new OutletObserver(this, this); 7942 try { 7943 this.controller.initialize(); 7944 this.logDebugActivity("initialize"); 7945 } catch (error3) { 7946 this.handleError(error3, "initializing controller"); 7947 } 7948 } 7949 connect() { 7950 this.bindingObserver.start(); 7951 this.valueObserver.start(); 7952 this.targetObserver.start(); 7953 this.outletObserver.start(); 7954 try { 7955 this.controller.connect(); 7956 this.logDebugActivity("connect"); 7957 } catch (error3) { 7958 this.handleError(error3, "connecting controller"); 7959 } 7960 } 7961 refresh() { 7962 this.outletObserver.refresh(); 7963 } 7964 disconnect() { 7965 try { 7966 this.controller.disconnect(); 7967 this.logDebugActivity("disconnect"); 7968 } catch (error3) { 7969 this.handleError(error3, "disconnecting controller"); 7970 } 7971 this.outletObserver.stop(); 7972 this.targetObserver.stop(); 7973 this.valueObserver.stop(); 7974 this.bindingObserver.stop(); 7975 } 7976 get application() { 7977 return this.module.application; 7978 } 7979 get identifier() { 7980 return this.module.identifier; 7981 } 7982 get schema() { 7983 return this.application.schema; 7984 } 7985 get dispatcher() { 7986 return this.application.dispatcher; 7987 } 7988 get element() { 7989 return this.scope.element; 7990 } 7991 get parentElement() { 7992 return this.element.parentElement; 7993 } 7994 handleError(error3, message, detail = {}) { 7995 const { identifier, controller, element } = this; 7996 detail = Object.assign({ identifier, controller, element }, detail); 7997 this.application.handleError(error3, `Error ${message}`, detail); 7998 } 7999 targetConnected(element, name) { 8000 this.invokeControllerMethod(`${name}TargetConnected`, element); 8001 } 8002 targetDisconnected(element, name) { 8003 this.invokeControllerMethod(`${name}TargetDisconnected`, element); 8004 } 8005 outletConnected(outlet, element, name) { 8006 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element); 8007 } 8008 outletDisconnected(outlet, element, name) { 8009 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element); 8010 } 8011 invokeControllerMethod(methodName, ...args) { 8012 const controller = this.controller; 8013 if (typeof controller[methodName] == "function") { 8014 controller[methodName](...args); 8015 } 8016 } 8017 } 8018 function bless(constructor) { 8019 return shadow(constructor, getBlessedProperties(constructor)); 8020 } 8021 function shadow(constructor, properties) { 8022 const shadowConstructor = extend(constructor); 8023 const shadowProperties = getShadowProperties(constructor.prototype, properties); 8024 Object.defineProperties(shadowConstructor.prototype, shadowProperties); 8025 return shadowConstructor; 8026 } 8027 function getBlessedProperties(constructor) { 8028 const blessings = readInheritableStaticArrayValues(constructor, "blessings"); 8029 return blessings.reduce((blessedProperties, blessing) => { 8030 const properties = blessing(constructor); 8031 for (const key in properties) { 8032 const descriptor = blessedProperties[key] || {}; 8033 blessedProperties[key] = Object.assign(descriptor, properties[key]); 8034 } 8035 return blessedProperties; 8036 }, {}); 8037 } 8038 function getShadowProperties(prototype, properties) { 8039 return getOwnKeys(properties).reduce((shadowProperties, key) => { 8040 const descriptor = getShadowedDescriptor(prototype, properties, key); 8041 if (descriptor) { 8042 Object.assign(shadowProperties, { [key]: descriptor }); 8043 } 8044 return shadowProperties; 8045 }, {}); 8046 } 8047 function getShadowedDescriptor(prototype, properties, key) { 8048 const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key); 8049 const shadowedByValue = shadowingDescriptor && "value" in shadowingDescriptor; 8050 if (!shadowedByValue) { 8051 const descriptor = Object.getOwnPropertyDescriptor(properties, key).value; 8052 if (shadowingDescriptor) { 8053 descriptor.get = shadowingDescriptor.get || descriptor.get; 8054 descriptor.set = shadowingDescriptor.set || descriptor.set; 8055 } 8056 return descriptor; 8057 } 8058 } 8059 const getOwnKeys = (() => { 8060 if (typeof Object.getOwnPropertySymbols == "function") { 8061 return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]; 8062 } else { 8063 return Object.getOwnPropertyNames; 8064 } 8065 })(); 8066 const extend = (() => { 8067 function extendWithReflect(constructor) { 8068 function extended() { 8069 return Reflect.construct(constructor, arguments, new.target); 8070 } 8071 extended.prototype = Object.create(constructor.prototype, { 8072 constructor: { value: extended } 8073 }); 8074 Reflect.setPrototypeOf(extended, constructor); 8075 return extended; 8076 } 8077 function testReflectExtension() { 8078 const a = function() { 8079 this.a.call(this); 8080 }; 8081 const b = extendWithReflect(a); 8082 b.prototype.a = function() { 8083 }; 8084 return new b(); 8085 } 8086 try { 8087 testReflectExtension(); 8088 return extendWithReflect; 8089 } catch (error3) { 8090 return (constructor) => class extended extends constructor { 8091 }; 8092 } 8093 })(); 8094 function blessDefinition(definition) { 8095 return { 8096 identifier: definition.identifier, 8097 controllerConstructor: bless(definition.controllerConstructor) 8098 }; 8099 } 8100 class Module { 8101 constructor(application2, definition) { 8102 this.application = application2; 8103 this.definition = blessDefinition(definition); 8104 this.contextsByScope = /* @__PURE__ */ new WeakMap(); 8105 this.connectedContexts = /* @__PURE__ */ new Set(); 8106 } 8107 get identifier() { 8108 return this.definition.identifier; 8109 } 8110 get controllerConstructor() { 8111 return this.definition.controllerConstructor; 8112 } 8113 get contexts() { 8114 return Array.from(this.connectedContexts); 8115 } 8116 connectContextForScope(scope) { 8117 const context = this.fetchContextForScope(scope); 8118 this.connectedContexts.add(context); 8119 context.connect(); 8120 } 8121 disconnectContextForScope(scope) { 8122 const context = this.contextsByScope.get(scope); 8123 if (context) { 8124 this.connectedContexts.delete(context); 8125 context.disconnect(); 8126 } 8127 } 8128 fetchContextForScope(scope) { 8129 let context = this.contextsByScope.get(scope); 8130 if (!context) { 8131 context = new Context(this, scope); 8132 this.contextsByScope.set(scope, context); 8133 } 8134 return context; 8135 } 8136 } 8137 class ClassMap { 8138 constructor(scope) { 8139 this.scope = scope; 8140 } 8141 has(name) { 8142 return this.data.has(this.getDataKey(name)); 8143 } 8144 get(name) { 8145 return this.getAll(name)[0]; 8146 } 8147 getAll(name) { 8148 const tokenString = this.data.get(this.getDataKey(name)) || ""; 8149 return tokenize(tokenString); 8150 } 8151 getAttributeName(name) { 8152 return this.data.getAttributeNameForKey(this.getDataKey(name)); 8153 } 8154 getDataKey(name) { 8155 return `${name}-class`; 8156 } 8157 get data() { 8158 return this.scope.data; 8159 } 8160 } 8161 class DataMap { 8162 constructor(scope) { 8163 this.scope = scope; 8164 } 8165 get element() { 8166 return this.scope.element; 8167 } 8168 get identifier() { 8169 return this.scope.identifier; 8170 } 8171 get(key) { 8172 const name = this.getAttributeNameForKey(key); 8173 return this.element.getAttribute(name); 8174 } 8175 set(key, value) { 8176 const name = this.getAttributeNameForKey(key); 8177 this.element.setAttribute(name, value); 8178 return this.get(key); 8179 } 8180 has(key) { 8181 const name = this.getAttributeNameForKey(key); 8182 return this.element.hasAttribute(name); 8183 } 8184 delete(key) { 8185 if (this.has(key)) { 8186 const name = this.getAttributeNameForKey(key); 8187 this.element.removeAttribute(name); 8188 return true; 8189 } else { 8190 return false; 8191 } 8192 } 8193 getAttributeNameForKey(key) { 8194 return `data-${this.identifier}-${dasherize(key)}`; 8195 } 8196 } 8197 class Guide { 8198 constructor(logger) { 8199 this.warnedKeysByObject = /* @__PURE__ */ new WeakMap(); 8200 this.logger = logger; 8201 } 8202 warn(object, key, message) { 8203 let warnedKeys = this.warnedKeysByObject.get(object); 8204 if (!warnedKeys) { 8205 warnedKeys = /* @__PURE__ */ new Set(); 8206 this.warnedKeysByObject.set(object, warnedKeys); 8207 } 8208 if (!warnedKeys.has(key)) { 8209 warnedKeys.add(key); 8210 this.logger.warn(message, object); 8211 } 8212 } 8213 } 8214 function attributeValueContainsToken(attributeName, token) { 8215 return `[${attributeName}~="${token}"]`; 8216 } 8217 class TargetSet { 8218 constructor(scope) { 8219 this.scope = scope; 8220 } 8221 get element() { 8222 return this.scope.element; 8223 } 8224 get identifier() { 8225 return this.scope.identifier; 8226 } 8227 get schema() { 8228 return this.scope.schema; 8229 } 8230 has(targetName) { 8231 return this.find(targetName) != null; 8232 } 8233 find(...targetNames) { 8234 return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), void 0); 8235 } 8236 findAll(...targetNames) { 8237 return targetNames.reduce((targets, targetName) => [ 8238 ...targets, 8239 ...this.findAllTargets(targetName), 8240 ...this.findAllLegacyTargets(targetName) 8241 ], []); 8242 } 8243 findTarget(targetName) { 8244 const selector = this.getSelectorForTargetName(targetName); 8245 return this.scope.findElement(selector); 8246 } 8247 findAllTargets(targetName) { 8248 const selector = this.getSelectorForTargetName(targetName); 8249 return this.scope.findAllElements(selector); 8250 } 8251 getSelectorForTargetName(targetName) { 8252 const attributeName = this.schema.targetAttributeForScope(this.identifier); 8253 return attributeValueContainsToken(attributeName, targetName); 8254 } 8255 findLegacyTarget(targetName) { 8256 const selector = this.getLegacySelectorForTargetName(targetName); 8257 return this.deprecate(this.scope.findElement(selector), targetName); 8258 } 8259 findAllLegacyTargets(targetName) { 8260 const selector = this.getLegacySelectorForTargetName(targetName); 8261 return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName)); 8262 } 8263 getLegacySelectorForTargetName(targetName) { 8264 const targetDescriptor = `${this.identifier}.${targetName}`; 8265 return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor); 8266 } 8267 deprecate(element, targetName) { 8268 if (element) { 8269 const { identifier } = this; 8270 const attributeName = this.schema.targetAttribute; 8271 const revisedAttributeName = this.schema.targetAttributeForScope(identifier); 8272 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.`); 8273 } 8274 return element; 8275 } 8276 get guide() { 8277 return this.scope.guide; 8278 } 8279 } 8280 class OutletSet { 8281 constructor(scope, controllerElement) { 8282 this.scope = scope; 8283 this.controllerElement = controllerElement; 8284 } 8285 get element() { 8286 return this.scope.element; 8287 } 8288 get identifier() { 8289 return this.scope.identifier; 8290 } 8291 get schema() { 8292 return this.scope.schema; 8293 } 8294 has(outletName) { 8295 return this.find(outletName) != null; 8296 } 8297 find(...outletNames) { 8298 return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), void 0); 8299 } 8300 findAll(...outletNames) { 8301 return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []); 8302 } 8303 getSelectorForOutletName(outletName) { 8304 const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName); 8305 return this.controllerElement.getAttribute(attributeName); 8306 } 8307 findOutlet(outletName) { 8308 const selector = this.getSelectorForOutletName(outletName); 8309 if (selector) 8310 return this.findElement(selector, outletName); 8311 } 8312 findAllOutlets(outletName) { 8313 const selector = this.getSelectorForOutletName(outletName); 8314 return selector ? this.findAllElements(selector, outletName) : []; 8315 } 8316 findElement(selector, outletName) { 8317 const elements = this.scope.queryElements(selector); 8318 return elements.filter((element) => this.matchesElement(element, selector, outletName))[0]; 8319 } 8320 findAllElements(selector, outletName) { 8321 const elements = this.scope.queryElements(selector); 8322 return elements.filter((element) => this.matchesElement(element, selector, outletName)); 8323 } 8324 matchesElement(element, selector, outletName) { 8325 const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || ""; 8326 return element.matches(selector) && controllerAttribute.split(" ").includes(outletName); 8327 } 8328 } 8329 class Scope { 8330 constructor(schema, element, identifier, logger) { 8331 this.targets = new TargetSet(this); 8332 this.classes = new ClassMap(this); 8333 this.data = new DataMap(this); 8334 this.containsElement = (element2) => { 8335 return element2.closest(this.controllerSelector) === this.element; 8336 }; 8337 this.schema = schema; 8338 this.element = element; 8339 this.identifier = identifier; 8340 this.guide = new Guide(logger); 8341 this.outlets = new OutletSet(this.documentScope, element); 8342 } 8343 findElement(selector) { 8344 return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement); 8345 } 8346 findAllElements(selector) { 8347 return [ 8348 ...this.element.matches(selector) ? [this.element] : [], 8349 ...this.queryElements(selector).filter(this.containsElement) 8350 ]; 8351 } 8352 queryElements(selector) { 8353 return Array.from(this.element.querySelectorAll(selector)); 8354 } 8355 get controllerSelector() { 8356 return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier); 8357 } 8358 get isDocumentScope() { 8359 return this.element === document.documentElement; 8360 } 8361 get documentScope() { 8362 return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger); 8363 } 8364 } 8365 class ScopeObserver { 8366 constructor(element, schema, delegate) { 8367 this.element = element; 8368 this.schema = schema; 8369 this.delegate = delegate; 8370 this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this); 8371 this.scopesByIdentifierByElement = /* @__PURE__ */ new WeakMap(); 8372 this.scopeReferenceCounts = /* @__PURE__ */ new WeakMap(); 8373 } 8374 start() { 8375 this.valueListObserver.start(); 8376 } 8377 stop() { 8378 this.valueListObserver.stop(); 8379 } 8380 get controllerAttribute() { 8381 return this.schema.controllerAttribute; 8382 } 8383 parseValueForToken(token) { 8384 const { element, content: identifier } = token; 8385 return this.parseValueForElementAndIdentifier(element, identifier); 8386 } 8387 parseValueForElementAndIdentifier(element, identifier) { 8388 const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element); 8389 let scope = scopesByIdentifier.get(identifier); 8390 if (!scope) { 8391 scope = this.delegate.createScopeForElementAndIdentifier(element, identifier); 8392 scopesByIdentifier.set(identifier, scope); 8393 } 8394 return scope; 8395 } 8396 elementMatchedValue(element, value) { 8397 const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1; 8398 this.scopeReferenceCounts.set(value, referenceCount); 8399 if (referenceCount == 1) { 8400 this.delegate.scopeConnected(value); 8401 } 8402 } 8403 elementUnmatchedValue(element, value) { 8404 const referenceCount = this.scopeReferenceCounts.get(value); 8405 if (referenceCount) { 8406 this.scopeReferenceCounts.set(value, referenceCount - 1); 8407 if (referenceCount == 1) { 8408 this.delegate.scopeDisconnected(value); 8409 } 8410 } 8411 } 8412 fetchScopesByIdentifierForElement(element) { 8413 let scopesByIdentifier = this.scopesByIdentifierByElement.get(element); 8414 if (!scopesByIdentifier) { 8415 scopesByIdentifier = /* @__PURE__ */ new Map(); 8416 this.scopesByIdentifierByElement.set(element, scopesByIdentifier); 8417 } 8418 return scopesByIdentifier; 8419 } 8420 } 8421 class Router { 8422 constructor(application2) { 8423 this.application = application2; 8424 this.scopeObserver = new ScopeObserver(this.element, this.schema, this); 8425 this.scopesByIdentifier = new Multimap(); 8426 this.modulesByIdentifier = /* @__PURE__ */ new Map(); 8427 } 8428 get element() { 8429 return this.application.element; 8430 } 8431 get schema() { 8432 return this.application.schema; 8433 } 8434 get logger() { 8435 return this.application.logger; 8436 } 8437 get controllerAttribute() { 8438 return this.schema.controllerAttribute; 8439 } 8440 get modules() { 8441 return Array.from(this.modulesByIdentifier.values()); 8442 } 8443 get contexts() { 8444 return this.modules.reduce((contexts, module2) => contexts.concat(module2.contexts), []); 8445 } 8446 start() { 8447 this.scopeObserver.start(); 8448 } 8449 stop() { 8450 this.scopeObserver.stop(); 8451 } 8452 loadDefinition(definition) { 8453 this.unloadIdentifier(definition.identifier); 8454 const module2 = new Module(this.application, definition); 8455 this.connectModule(module2); 8456 const afterLoad = definition.controllerConstructor.afterLoad; 8457 if (afterLoad) { 8458 afterLoad.call(definition.controllerConstructor, definition.identifier, this.application); 8459 } 8460 } 8461 unloadIdentifier(identifier) { 8462 const module2 = this.modulesByIdentifier.get(identifier); 8463 if (module2) { 8464 this.disconnectModule(module2); 8465 } 8466 } 8467 getContextForElementAndIdentifier(element, identifier) { 8468 const module2 = this.modulesByIdentifier.get(identifier); 8469 if (module2) { 8470 return module2.contexts.find((context) => context.element == element); 8471 } 8472 } 8473 proposeToConnectScopeForElementAndIdentifier(element, identifier) { 8474 const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier); 8475 if (scope) { 8476 this.scopeObserver.elementMatchedValue(scope.element, scope); 8477 } else { 8478 console.error(`Couldn't find or create scope for identifier: "${identifier}" and element:`, element); 8479 } 8480 } 8481 handleError(error3, message, detail) { 8482 this.application.handleError(error3, message, detail); 8483 } 8484 createScopeForElementAndIdentifier(element, identifier) { 8485 return new Scope(this.schema, element, identifier, this.logger); 8486 } 8487 scopeConnected(scope) { 8488 this.scopesByIdentifier.add(scope.identifier, scope); 8489 const module2 = this.modulesByIdentifier.get(scope.identifier); 8490 if (module2) { 8491 module2.connectContextForScope(scope); 8492 } 8493 } 8494 scopeDisconnected(scope) { 8495 this.scopesByIdentifier.delete(scope.identifier, scope); 8496 const module2 = this.modulesByIdentifier.get(scope.identifier); 8497 if (module2) { 8498 module2.disconnectContextForScope(scope); 8499 } 8500 } 8501 connectModule(module2) { 8502 this.modulesByIdentifier.set(module2.identifier, module2); 8503 const scopes = this.scopesByIdentifier.getValuesForKey(module2.identifier); 8504 scopes.forEach((scope) => module2.connectContextForScope(scope)); 8505 } 8506 disconnectModule(module2) { 8507 this.modulesByIdentifier.delete(module2.identifier); 8508 const scopes = this.scopesByIdentifier.getValuesForKey(module2.identifier); 8509 scopes.forEach((scope) => module2.disconnectContextForScope(scope)); 8510 } 8511 } 8512 const defaultSchema = { 8513 controllerAttribute: "data-controller", 8514 actionAttribute: "data-action", 8515 targetAttribute: "data-target", 8516 targetAttributeForScope: (identifier) => `data-${identifier}-target`, 8517 outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`, 8518 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]))) 8519 }; 8520 function objectFromEntries(array) { 8521 return array.reduce((memo, [k, v]) => Object.assign(Object.assign({}, memo), { [k]: v }), {}); 8522 } 8523 class Application2 { 8524 constructor(element = document.documentElement, schema = defaultSchema) { 8525 this.logger = console; 8526 this.debug = false; 8527 this.logDebugActivity = (identifier, functionName, detail = {}) => { 8528 if (this.debug) { 8529 this.logFormattedMessage(identifier, functionName, detail); 8530 } 8531 }; 8532 this.element = element; 8533 this.schema = schema; 8534 this.dispatcher = new Dispatcher(this); 8535 this.router = new Router(this); 8536 this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters); 8537 } 8538 static start(element, schema) { 8539 const application2 = new this(element, schema); 8540 application2.start(); 8541 return application2; 8542 } 8543 async start() { 8544 await domReady(); 8545 this.logDebugActivity("application", "starting"); 8546 this.dispatcher.start(); 8547 this.router.start(); 8548 this.logDebugActivity("application", "start"); 8549 } 8550 stop() { 8551 this.logDebugActivity("application", "stopping"); 8552 this.dispatcher.stop(); 8553 this.router.stop(); 8554 this.logDebugActivity("application", "stop"); 8555 } 8556 register(identifier, controllerConstructor) { 8557 this.load({ identifier, controllerConstructor }); 8558 } 8559 registerActionOption(name, filter) { 8560 this.actionDescriptorFilters[name] = filter; 8561 } 8562 load(head, ...rest) { 8563 const definitions = Array.isArray(head) ? head : [head, ...rest]; 8564 definitions.forEach((definition) => { 8565 if (definition.controllerConstructor.shouldLoad) { 8566 this.router.loadDefinition(definition); 8567 } 8568 }); 8569 } 8570 unload(head, ...rest) { 8571 const identifiers = Array.isArray(head) ? head : [head, ...rest]; 8572 identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier)); 8573 } 8574 get controllers() { 8575 return this.router.contexts.map((context) => context.controller); 8576 } 8577 getControllerForElementAndIdentifier(element, identifier) { 8578 const context = this.router.getContextForElementAndIdentifier(element, identifier); 8579 return context ? context.controller : null; 8580 } 8581 handleError(error3, message, detail) { 8582 var _a; 8583 this.logger.error(`%s 8584 8585%o 8586 8587%o`, message, error3, detail); 8588 (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, "", 0, 0, error3); 8589 } 8590 logFormattedMessage(identifier, functionName, detail = {}) { 8591 detail = Object.assign({ application: this }, detail); 8592 this.logger.groupCollapsed(`${identifier} #${functionName}`); 8593 this.logger.log("details:", Object.assign({}, detail)); 8594 this.logger.groupEnd(); 8595 } 8596 } 8597 function domReady() { 8598 return new Promise((resolve) => { 8599 if (document.readyState == "loading") { 8600 document.addEventListener("DOMContentLoaded", () => resolve()); 8601 } else { 8602 resolve(); 8603 } 8604 }); 8605 } 8606 function ClassPropertiesBlessing(constructor) { 8607 const classes = readInheritableStaticArrayValues(constructor, "classes"); 8608 return classes.reduce((properties, classDefinition) => { 8609 return Object.assign(properties, propertiesForClassDefinition(classDefinition)); 8610 }, {}); 8611 } 8612 function propertiesForClassDefinition(key) { 8613 return { 8614 [`${key}Class`]: { 8615 get() { 8616 const { classes } = this; 8617 if (classes.has(key)) { 8618 return classes.get(key); 8619 } else { 8620 const attribute = classes.getAttributeName(key); 8621 throw new Error(`Missing attribute "${attribute}"`); 8622 } 8623 } 8624 }, 8625 [`${key}Classes`]: { 8626 get() { 8627 return this.classes.getAll(key); 8628 } 8629 }, 8630 [`has${capitalize2(key)}Class`]: { 8631 get() { 8632 return this.classes.has(key); 8633 } 8634 } 8635 }; 8636 } 8637 function OutletPropertiesBlessing(constructor) { 8638 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 8639 return outlets.reduce((properties, outletDefinition) => { 8640 return Object.assign(properties, propertiesForOutletDefinition(outletDefinition)); 8641 }, {}); 8642 } 8643 function getOutletController(controller, element, identifier) { 8644 return controller.application.getControllerForElementAndIdentifier(element, identifier); 8645 } 8646 function getControllerAndEnsureConnectedScope(controller, element, outletName) { 8647 let outletController = getOutletController(controller, element, outletName); 8648 if (outletController) 8649 return outletController; 8650 controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName); 8651 outletController = getOutletController(controller, element, outletName); 8652 if (outletController) 8653 return outletController; 8654 } 8655 function propertiesForOutletDefinition(name) { 8656 const camelizedName = namespaceCamelize(name); 8657 return { 8658 [`${camelizedName}Outlet`]: { 8659 get() { 8660 const outletElement = this.outlets.find(name); 8661 const selector = this.outlets.getSelectorForOutletName(name); 8662 if (outletElement) { 8663 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 8664 if (outletController) 8665 return outletController; 8666 throw new Error(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`); 8667 } 8668 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 8669 } 8670 }, 8671 [`${camelizedName}Outlets`]: { 8672 get() { 8673 const outlets = this.outlets.findAll(name); 8674 if (outlets.length > 0) { 8675 return outlets.map((outletElement) => { 8676 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 8677 if (outletController) 8678 return outletController; 8679 console.warn(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`, outletElement); 8680 }).filter((controller) => controller); 8681 } 8682 return []; 8683 } 8684 }, 8685 [`${camelizedName}OutletElement`]: { 8686 get() { 8687 const outletElement = this.outlets.find(name); 8688 const selector = this.outlets.getSelectorForOutletName(name); 8689 if (outletElement) { 8690 return outletElement; 8691 } else { 8692 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 8693 } 8694 } 8695 }, 8696 [`${camelizedName}OutletElements`]: { 8697 get() { 8698 return this.outlets.findAll(name); 8699 } 8700 }, 8701 [`has${capitalize2(camelizedName)}Outlet`]: { 8702 get() { 8703 return this.outlets.has(name); 8704 } 8705 } 8706 }; 8707 } 8708 function TargetPropertiesBlessing(constructor) { 8709 const targets = readInheritableStaticArrayValues(constructor, "targets"); 8710 return targets.reduce((properties, targetDefinition) => { 8711 return Object.assign(properties, propertiesForTargetDefinition(targetDefinition)); 8712 }, {}); 8713 } 8714 function propertiesForTargetDefinition(name) { 8715 return { 8716 [`${name}Target`]: { 8717 get() { 8718 const target = this.targets.find(name); 8719 if (target) { 8720 return target; 8721 } else { 8722 throw new Error(`Missing target element "${name}" for "${this.identifier}" controller`); 8723 } 8724 } 8725 }, 8726 [`${name}Targets`]: { 8727 get() { 8728 return this.targets.findAll(name); 8729 } 8730 }, 8731 [`has${capitalize2(name)}Target`]: { 8732 get() { 8733 return this.targets.has(name); 8734 } 8735 } 8736 }; 8737 } 8738 function ValuePropertiesBlessing(constructor) { 8739 const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, "values"); 8740 const propertyDescriptorMap = { 8741 valueDescriptorMap: { 8742 get() { 8743 return valueDefinitionPairs.reduce((result, valueDefinitionPair) => { 8744 const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier); 8745 const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key); 8746 return Object.assign(result, { [attributeName]: valueDescriptor }); 8747 }, {}); 8748 } 8749 } 8750 }; 8751 return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => { 8752 return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair)); 8753 }, propertyDescriptorMap); 8754 } 8755 function propertiesForValueDefinitionPair(valueDefinitionPair, controller) { 8756 const definition = parseValueDefinitionPair(valueDefinitionPair, controller); 8757 const { key, name, reader: read, writer: write } = definition; 8758 return { 8759 [name]: { 8760 get() { 8761 const value = this.data.get(key); 8762 if (value !== null) { 8763 return read(value); 8764 } else { 8765 return definition.defaultValue; 8766 } 8767 }, 8768 set(value) { 8769 if (value === void 0) { 8770 this.data.delete(key); 8771 } else { 8772 this.data.set(key, write(value)); 8773 } 8774 } 8775 }, 8776 [`has${capitalize2(name)}`]: { 8777 get() { 8778 return this.data.has(key) || definition.hasCustomDefaultValue; 8779 } 8780 } 8781 }; 8782 } 8783 function parseValueDefinitionPair([token, typeDefinition], controller) { 8784 return valueDescriptorForTokenAndTypeDefinition({ 8785 controller, 8786 token, 8787 typeDefinition 8788 }); 8789 } 8790 function parseValueTypeConstant(constant) { 8791 switch (constant) { 8792 case Array: 8793 return "array"; 8794 case Boolean: 8795 return "boolean"; 8796 case Number: 8797 return "number"; 8798 case Object: 8799 return "object"; 8800 case String: 8801 return "string"; 8802 } 8803 } 8804 function parseValueTypeDefault(defaultValue) { 8805 switch (typeof defaultValue) { 8806 case "boolean": 8807 return "boolean"; 8808 case "number": 8809 return "number"; 8810 case "string": 8811 return "string"; 8812 } 8813 if (Array.isArray(defaultValue)) 8814 return "array"; 8815 if (Object.prototype.toString.call(defaultValue) === "[object Object]") 8816 return "object"; 8817 } 8818 function parseValueTypeObject(payload) { 8819 const { controller, token, typeObject } = payload; 8820 const hasType = isSomething(typeObject.type); 8821 const hasDefault = isSomething(typeObject.default); 8822 const fullObject = hasType && hasDefault; 8823 const onlyType = hasType && !hasDefault; 8824 const onlyDefault = !hasType && hasDefault; 8825 const typeFromObject = parseValueTypeConstant(typeObject.type); 8826 const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default); 8827 if (onlyType) 8828 return typeFromObject; 8829 if (onlyDefault) 8830 return typeFromDefaultValue; 8831 if (typeFromObject !== typeFromDefaultValue) { 8832 const propertyPath = controller ? `${controller}.${token}` : token; 8833 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}".`); 8834 } 8835 if (fullObject) 8836 return typeFromObject; 8837 } 8838 function parseValueTypeDefinition(payload) { 8839 const { controller, token, typeDefinition } = payload; 8840 const typeObject = { controller, token, typeObject: typeDefinition }; 8841 const typeFromObject = parseValueTypeObject(typeObject); 8842 const typeFromDefaultValue = parseValueTypeDefault(typeDefinition); 8843 const typeFromConstant = parseValueTypeConstant(typeDefinition); 8844 const type = typeFromObject || typeFromDefaultValue || typeFromConstant; 8845 if (type) 8846 return type; 8847 const propertyPath = controller ? `${controller}.${typeDefinition}` : token; 8848 throw new Error(`Unknown value type "${propertyPath}" for "${token}" value`); 8849 } 8850 function defaultValueForDefinition(typeDefinition) { 8851 const constant = parseValueTypeConstant(typeDefinition); 8852 if (constant) 8853 return defaultValuesByType[constant]; 8854 const hasDefault = hasProperty(typeDefinition, "default"); 8855 const hasType = hasProperty(typeDefinition, "type"); 8856 const typeObject = typeDefinition; 8857 if (hasDefault) 8858 return typeObject.default; 8859 if (hasType) { 8860 const { type } = typeObject; 8861 const constantFromType = parseValueTypeConstant(type); 8862 if (constantFromType) 8863 return defaultValuesByType[constantFromType]; 8864 } 8865 return typeDefinition; 8866 } 8867 function valueDescriptorForTokenAndTypeDefinition(payload) { 8868 const { token, typeDefinition } = payload; 8869 const key = `${dasherize(token)}-value`; 8870 const type = parseValueTypeDefinition(payload); 8871 return { 8872 type, 8873 key, 8874 name: camelize(key), 8875 get defaultValue() { 8876 return defaultValueForDefinition(typeDefinition); 8877 }, 8878 get hasCustomDefaultValue() { 8879 return parseValueTypeDefault(typeDefinition) !== void 0; 8880 }, 8881 reader: readers[type], 8882 writer: writers[type] || writers.default 8883 }; 8884 } 8885 const defaultValuesByType = { 8886 get array() { 8887 return []; 8888 }, 8889 boolean: false, 8890 number: 0, 8891 get object() { 8892 return {}; 8893 }, 8894 string: "" 8895 }; 8896 const readers = { 8897 array(value) { 8898 const array = JSON.parse(value); 8899 if (!Array.isArray(array)) { 8900 throw new TypeError(`expected value of type "array" but instead got value "${value}" of type "${parseValueTypeDefault(array)}"`); 8901 } 8902 return array; 8903 }, 8904 boolean(value) { 8905 return !(value == "0" || String(value).toLowerCase() == "false"); 8906 }, 8907 number(value) { 8908 return Number(value.replace(/_/g, "")); 8909 }, 8910 object(value) { 8911 const object = JSON.parse(value); 8912 if (object === null || typeof object != "object" || Array.isArray(object)) { 8913 throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseValueTypeDefault(object)}"`); 8914 } 8915 return object; 8916 }, 8917 string(value) { 8918 return value; 8919 } 8920 }; 8921 const writers = { 8922 default: writeString, 8923 array: writeJSON, 8924 object: writeJSON 8925 }; 8926 function writeJSON(value) { 8927 return JSON.stringify(value); 8928 } 8929 function writeString(value) { 8930 return `${value}`; 8931 } 8932 class Controller3 { 8933 constructor(context) { 8934 this.context = context; 8935 } 8936 static get shouldLoad() { 8937 return true; 8938 } 8939 static afterLoad(_identifier, _application) { 8940 return; 8941 } 8942 get application() { 8943 return this.context.application; 8944 } 8945 get scope() { 8946 return this.context.scope; 8947 } 8948 get element() { 8949 return this.scope.element; 8950 } 8951 get identifier() { 8952 return this.scope.identifier; 8953 } 8954 get targets() { 8955 return this.scope.targets; 8956 } 8957 get outlets() { 8958 return this.scope.outlets; 8959 } 8960 get classes() { 8961 return this.scope.classes; 8962 } 8963 get data() { 8964 return this.scope.data; 8965 } 8966 initialize() { 8967 } 8968 connect() { 8969 } 8970 disconnect() { 8971 } 8972 dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) { 8973 const type = prefix ? `${prefix}:${eventName}` : eventName; 8974 const event = new CustomEvent(type, { detail, bubbles, cancelable }); 8975 target.dispatchEvent(event); 8976 return event; 8977 } 8978 } 8979 Controller3.blessings = [ 8980 ClassPropertiesBlessing, 8981 TargetPropertiesBlessing, 8982 ValuePropertiesBlessing, 8983 OutletPropertiesBlessing 8984 ]; 8985 Controller3.targets = []; 8986 Controller3.outlets = []; 8987 Controller3.values = {}; 8988 exports2.Application = Application2; 8989 exports2.AttributeObserver = AttributeObserver; 8990 exports2.Context = Context; 8991 exports2.Controller = Controller3; 8992 exports2.ElementObserver = ElementObserver; 8993 exports2.IndexedMultimap = IndexedMultimap; 8994 exports2.Multimap = Multimap; 8995 exports2.SelectorObserver = SelectorObserver; 8996 exports2.StringMapObserver = StringMapObserver; 8997 exports2.TokenListObserver = TokenListObserver; 8998 exports2.ValueListObserver = ValueListObserver; 8999 exports2.add = add; 9000 exports2.defaultSchema = defaultSchema; 9001 exports2.del = del; 9002 exports2.fetch = fetch2; 9003 exports2.prune = prune; 9004 Object.defineProperty(exports2, "__esModule", { value: true }); 9005 }); 9006 } 9007 }); 9008 9009
vendor: 235,862 bytes, lines 9009-14509
9009// node_modules/lodash/lodash.js 9010 var require_lodash = __commonJS({ 9011 "node_modules/lodash/lodash.js"(exports, module) { 9012 init_define_process(); 9013 init_jquery(); 9014 (function() { 9015 var undefined2; 9016 var VERSION = "4.18.1"; 9017 var LARGE_ARRAY_SIZE = 200; 9018 var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`", INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` option passed into `_.template`"; 9019 var HASH_UNDEFINED = "__lodash_hash_undefined__"; 9020 var MAX_MEMOIZE_SIZE = 500; 9021 var PLACEHOLDER = "__lodash_placeholder__"; 9022 var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; 9023 var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; 9024 var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; 9025 var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; 9026 var HOT_COUNT = 800, HOT_SPAN = 16; 9027 var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; 9028 var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; 9029 var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 9030 var wrapFlags = [ 9031 ["ary", WRAP_ARY_FLAG], 9032 ["bind", WRAP_BIND_FLAG], 9033 ["bindKey", WRAP_BIND_KEY_FLAG], 9034 ["curry", WRAP_CURRY_FLAG], 9035 ["curryRight", WRAP_CURRY_RIGHT_FLAG], 9036 ["flip", WRAP_FLIP_FLAG], 9037 ["partial", WRAP_PARTIAL_FLAG], 9038 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], 9039 ["rearg", WRAP_REARG_FLAG] 9040 ]; 9041 var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; 9042 var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; 9043 var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 9044 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 9045 var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; 9046 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 9047 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); 9048 var reTrimStart = /^\s+/; 9049 var reWhitespace = /\s/; 9050 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; 9051 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 9052 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 9053 var reEscapeChar = /\\(\\)?/g; 9054 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 9055 var reFlags = /\w*$/; 9056 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 9057 var reIsBinary = /^0b[01]+$/i; 9058 var reIsHostCtor = /^\[object .+?Constructor\]$/; 9059 var reIsOctal = /^0o[0-7]+$/i; 9060 var reIsUint = /^(?:0|[1-9]\d*)$/; 9061 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 9062 var reNoMatch = /($^)/; 9063 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 9064 var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 9065 var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d"; 9066 var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; 9067 var reApos = RegExp(rsApos, "g"); 9068 var reComboMark = RegExp(rsCombo, "g"); 9069 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); 9070 var reUnicodeWord = RegExp([ 9071 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", 9072 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", 9073 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, 9074 rsUpper + "+" + rsOptContrUpper, 9075 rsOrdUpper, 9076 rsOrdLower, 9077 rsDigits, 9078 rsEmoji 9079 ].join("|"), "g"); 9080 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); 9081 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; 9082 var contextProps = [ 9083 "Array", 9084 "Buffer", 9085 "DataView", 9086 "Date", 9087 "Error", 9088 "Float32Array", 9089 "Float64Array", 9090 "Function", 9091 "Int8Array", 9092 "Int16Array", 9093 "Int32Array", 9094 "Map", 9095 "Math", 9096 "Object", 9097 "Promise", 9098 "RegExp", 9099 "Set", 9100 "String", 9101 "Symbol", 9102 "TypeError", 9103 "Uint8Array", 9104 "Uint8ClampedArray", 9105 "Uint16Array", 9106 "Uint32Array", 9107 "WeakMap", 9108 "_", 9109 "clearTimeout", 9110 "isFinite", 9111 "parseInt", 9112 "setTimeout" 9113 ]; 9114 var templateCounter = -1; 9115 var typedArrayTags = {}; 9116 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; 9117 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; 9118 var cloneableTags = {}; 9119 cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 9120 cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; 9121 var deburredLetters = { 9122 // Latin-1 Supplement block. 9123 "\xC0": "A", 9124 "\xC1": "A", 9125 "\xC2": "A", 9126 "\xC3": "A", 9127 "\xC4": "A", 9128 "\xC5": "A", 9129 "\xE0": "a", 9130 "\xE1": "a", 9131 "\xE2": "a", 9132 "\xE3": "a", 9133 "\xE4": "a", 9134 "\xE5": "a", 9135 "\xC7": "C", 9136 "\xE7": "c", 9137 "\xD0": "D", 9138 "\xF0": "d", 9139 "\xC8": "E", 9140 "\xC9": "E", 9141 "\xCA": "E", 9142 "\xCB": "E", 9143 "\xE8": "e", 9144 "\xE9": "e", 9145 "\xEA": "e", 9146 "\xEB": "e", 9147 "\xCC": "I", 9148 "\xCD": "I", 9149 "\xCE": "I", 9150 "\xCF": "I", 9151 "\xEC": "i", 9152 "\xED": "i", 9153 "\xEE": "i", 9154 "\xEF": "i", 9155 "\xD1": "N", 9156 "\xF1": "n", 9157 "\xD2": "O", 9158 "\xD3": "O", 9159 "\xD4": "O", 9160 "\xD5": "O", 9161 "\xD6": "O", 9162 "\xD8": "O", 9163 "\xF2": "o", 9164 "\xF3": "o", 9165 "\xF4": "o", 9166 "\xF5": "o", 9167 "\xF6": "o", 9168 "\xF8": "o", 9169 "\xD9": "U", 9170 "\xDA": "U", 9171 "\xDB": "U", 9172 "\xDC": "U", 9173 "\xF9": "u", 9174 "\xFA": "u", 9175 "\xFB": "u", 9176 "\xFC": "u", 9177 "\xDD": "Y", 9178 "\xFD": "y", 9179 "\xFF": "y", 9180 "\xC6": "Ae", 9181 "\xE6": "ae", 9182 "\xDE": "Th", 9183 "\xFE": "th", 9184 "\xDF": "ss", 9185 // Latin Extended-A block. 9186 "\u0100": "A", 9187 "\u0102": "A", 9188 "\u0104": "A", 9189 "\u0101": "a", 9190 "\u0103": "a", 9191 "\u0105": "a", 9192 "\u0106": "C", 9193 "\u0108": "C", 9194 "\u010A": "C", 9195 "\u010C": "C", 9196 "\u0107": "c", 9197 "\u0109": "c", 9198 "\u010B": "c", 9199 "\u010D": "c", 9200 "\u010E": "D", 9201 "\u0110": "D", 9202 "\u010F": "d", 9203 "\u0111": "d", 9204 "\u0112": "E", 9205 "\u0114": "E", 9206 "\u0116": "E", 9207 "\u0118": "E", 9208 "\u011A": "E", 9209 "\u0113": "e", 9210 "\u0115": "e", 9211 "\u0117": "e", 9212 "\u0119": "e", 9213 "\u011B": "e", 9214 "\u011C": "G", 9215 "\u011E": "G", 9216 "\u0120": "G", 9217 "\u0122": "G", 9218 "\u011D": "g", 9219 "\u011F": "g", 9220 "\u0121": "g", 9221 "\u0123": "g", 9222 "\u0124": "H", 9223 "\u0126": "H", 9224 "\u0125": "h", 9225 "\u0127": "h", 9226 "\u0128": "I", 9227 "\u012A": "I", 9228 "\u012C": "I", 9229 "\u012E": "I", 9230 "\u0130": "I", 9231 "\u0129": "i", 9232 "\u012B": "i", 9233 "\u012D": "i", 9234 "\u012F": "i", 9235 "\u0131": "i", 9236 "\u0134": "J", 9237 "\u0135": "j", 9238 "\u0136": "K", 9239 "\u0137": "k", 9240 "\u0138": "k", 9241 "\u0139": "L", 9242 "\u013B": "L", 9243 "\u013D": "L", 9244 "\u013F": "L", 9245 "\u0141": "L", 9246 "\u013A": "l", 9247 "\u013C": "l", 9248 "\u013E": "l", 9249 "\u0140": "l", 9250 "\u0142": "l", 9251 "\u0143": "N", 9252 "\u0145": "N", 9253 "\u0147": "N", 9254 "\u014A": "N", 9255 "\u0144": "n", 9256 "\u0146": "n", 9257 "\u0148": "n", 9258 "\u014B": "n", 9259 "\u014C": "O", 9260 "\u014E": "O", 9261 "\u0150": "O", 9262 "\u014D": "o", 9263 "\u014F": "o", 9264 "\u0151": "o", 9265 "\u0154": "R", 9266 "\u0156": "R", 9267 "\u0158": "R", 9268 "\u0155": "r", 9269 "\u0157": "r", 9270 "\u0159": "r", 9271 "\u015A": "S", 9272 "\u015C": "S", 9273 "\u015E": "S", 9274 "\u0160": "S", 9275 "\u015B": "s", 9276 "\u015D": "s", 9277 "\u015F": "s", 9278 "\u0161": "s", 9279 "\u0162": "T", 9280 "\u0164": "T", 9281 "\u0166": "T", 9282 "\u0163": "t", 9283 "\u0165": "t", 9284 "\u0167": "t", 9285 "\u0168": "U", 9286 "\u016A": "U", 9287 "\u016C": "U", 9288 "\u016E": "U", 9289 "\u0170": "U", 9290 "\u0172": "U", 9291 "\u0169": "u", 9292 "\u016B": "u", 9293 "\u016D": "u", 9294 "\u016F": "u", 9295 "\u0171": "u", 9296 "\u0173": "u", 9297 "\u0174": "W", 9298 "\u0175": "w", 9299 "\u0176": "Y", 9300 "\u0177": "y", 9301 "\u0178": "Y", 9302 "\u0179": "Z", 9303 "\u017B": "Z", 9304 "\u017D": "Z", 9305 "\u017A": "z", 9306 "\u017C": "z", 9307 "\u017E": "z", 9308 "\u0132": "IJ", 9309 "\u0133": "ij", 9310 "\u0152": "Oe", 9311 "\u0153": "oe", 9312 "\u0149": "'n", 9313 "\u017F": "s" 9314 }; 9315 var htmlEscapes = { 9316 "&": "&", 9317 "<": "<", 9318 ">": ">", 9319 '"': """, 9320 "'": "'" 9321 }; 9322 var htmlUnescapes = { 9323 "&": "&", 9324 "<": "<", 9325 ">": ">", 9326 """: '"', 9327 "'": "'" 9328 }; 9329 var stringEscapes = { 9330 "\\": "\\", 9331 "'": "'", 9332 "\n": "n", 9333 "\r": "r", 9334 "\u2028": "u2028", 9335 "\u2029": "u2029" 9336 }; 9337 var freeParseFloat = parseFloat, freeParseInt = parseInt; 9338 var freeGlobal = typeof window == "object" && window && window.Object === Object && window; 9339 var freeSelf = typeof self == "object" && self && self.Object === Object && self; 9340 var root = freeGlobal || freeSelf || Function("return this")(); 9341 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; 9342 var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; 9343 var moduleExports = freeModule && freeModule.exports === freeExports; 9344 var freeProcess = moduleExports && freeGlobal.process; 9345 var nodeUtil = function() { 9346 try { 9347 var types = freeModule && freeModule.require && freeModule.require("util").types; 9348 if (types) { 9349 return types; 9350 } 9351 return freeProcess && freeProcess.binding && freeProcess.binding("util"); 9352 } catch (e) { 9353 } 9354 }(); 9355 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 9356 function apply(func, thisArg, args) { 9357 switch (args.length) { 9358 case 0: 9359 return func.call(thisArg); 9360 case 1: 9361 return func.call(thisArg, args[0]); 9362 case 2: 9363 return func.call(thisArg, args[0], args[1]); 9364 case 3: 9365 return func.call(thisArg, args[0], args[1], args[2]); 9366 } 9367 return func.apply(thisArg, args); 9368 } 9369 function arrayAggregator(array, setter, iteratee, accumulator) { 9370 var index = -1, length = array == null ? 0 : array.length; 9371 while (++index < length) { 9372 var value = array[index]; 9373 setter(accumulator, value, iteratee(value), array); 9374 } 9375 return accumulator; 9376 } 9377 function arrayEach(array, iteratee) { 9378 var index = -1, length = array == null ? 0 : array.length; 9379 while (++index < length) { 9380 if (iteratee(array[index], index, array) === false) { 9381 break; 9382 } 9383 } 9384 return array; 9385 } 9386 function arrayEachRight(array, iteratee) { 9387 var length = array == null ? 0 : array.length; 9388 while (length--) { 9389 if (iteratee(array[length], length, array) === false) { 9390 break; 9391 } 9392 } 9393 return array; 9394 } 9395 function arrayEvery(array, predicate) { 9396 var index = -1, length = array == null ? 0 : array.length; 9397 while (++index < length) { 9398 if (!predicate(array[index], index, array)) { 9399 return false; 9400 } 9401 } 9402 return true; 9403 } 9404 function arrayFilter(array, predicate) { 9405 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; 9406 while (++index < length) { 9407 var value = array[index]; 9408 if (predicate(value, index, array)) { 9409 result[resIndex++] = value; 9410 } 9411 } 9412 return result; 9413 } 9414 function arrayIncludes(array, value) { 9415 var length = array == null ? 0 : array.length; 9416 return !!length && baseIndexOf(array, value, 0) > -1; 9417 } 9418 function arrayIncludesWith(array, value, comparator) { 9419 var index = -1, length = array == null ? 0 : array.length; 9420 while (++index < length) { 9421 if (comparator(value, array[index])) { 9422 return true; 9423 } 9424 } 9425 return false; 9426 } 9427 function arrayMap(array, iteratee) { 9428 var index = -1, length = array == null ? 0 : array.length, result = Array(length); 9429 while (++index < length) { 9430 result[index] = iteratee(array[index], index, array); 9431 } 9432 return result; 9433 } 9434 function arrayPush(array, values) { 9435 var index = -1, length = values.length, offset = array.length; 9436 while (++index < length) { 9437 array[offset + index] = values[index]; 9438 } 9439 return array; 9440 } 9441 function arrayReduce(array, iteratee, accumulator, initAccum) { 9442 var index = -1, length = array == null ? 0 : array.length; 9443 if (initAccum && length) { 9444 accumulator = array[++index]; 9445 } 9446 while (++index < length) { 9447 accumulator = iteratee(accumulator, array[index], index, array); 9448 } 9449 return accumulator; 9450 } 9451 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 9452 var length = array == null ? 0 : array.length; 9453 if (initAccum && length) { 9454 accumulator = array[--length]; 9455 } 9456 while (length--) { 9457 accumulator = iteratee(accumulator, array[length], length, array); 9458 } 9459 return accumulator; 9460 } 9461 function arraySome(array, predicate) { 9462 var index = -1, length = array == null ? 0 : array.length; 9463 while (++index < length) { 9464 if (predicate(array[index], index, array)) { 9465 return true; 9466 } 9467 } 9468 return false; 9469 } 9470 var asciiSize = baseProperty("length"); 9471 function asciiToArray(string) { 9472 return string.split(""); 9473 } 9474 function asciiWords(string) { 9475 return string.match(reAsciiWord) || []; 9476 } 9477 function baseFindKey(collection, predicate, eachFunc) { 9478 var result; 9479 eachFunc(collection, function(value, key, collection2) { 9480 if (predicate(value, key, collection2)) { 9481 result = key; 9482 return false; 9483 } 9484 }); 9485 return result; 9486 } 9487 function baseFindIndex(array, predicate, fromIndex, fromRight) { 9488 var length = array.length, index = fromIndex + (fromRight ? 1 : -1); 9489 while (fromRight ? index-- : ++index < length) { 9490 if (predicate(array[index], index, array)) { 9491 return index; 9492 } 9493 } 9494 return -1; 9495 } 9496 function baseIndexOf(array, value, fromIndex) { 9497 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); 9498 } 9499 function baseIndexOfWith(array, value, fromIndex, comparator) { 9500 var index = fromIndex - 1, length = array.length; 9501 while (++index < length) { 9502 if (comparator(array[index], value)) { 9503 return index; 9504 } 9505 } 9506 return -1; 9507 } 9508 function baseIsNaN(value) { 9509 return value !== value; 9510 } 9511 function baseMean(array, iteratee) { 9512 var length = array == null ? 0 : array.length; 9513 return length ? baseSum(array, iteratee) / length : NAN; 9514 } 9515 function baseProperty(key) { 9516 return function(object) { 9517 return object == null ? undefined2 : object[key]; 9518 }; 9519 } 9520 function basePropertyOf(object) { 9521 return function(key) { 9522 return object == null ? undefined2 : object[key]; 9523 }; 9524 } 9525 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 9526 eachFunc(collection, function(value, index, collection2) { 9527 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); 9528 }); 9529 return accumulator; 9530 } 9531 function baseSortBy(array, comparer) { 9532 var length = array.length; 9533 array.sort(comparer); 9534 while (length--) { 9535 array[length] = array[length].value; 9536 } 9537 return array; 9538 } 9539 function baseSum(array, iteratee) { 9540 var result, index = -1, length = array.length; 9541 while (++index < length) { 9542 var current = iteratee(array[index]); 9543 if (current !== undefined2) { 9544 result = result === undefined2 ? current : result + current; 9545 } 9546 } 9547 return result; 9548 } 9549 function baseTimes(n, iteratee) { 9550 var index = -1, result = Array(n); 9551 while (++index < n) { 9552 result[index] = iteratee(index); 9553 } 9554 return result; 9555 } 9556 function baseToPairs(object, props) { 9557 return arrayMap(props, function(key) { 9558 return [key, object[key]]; 9559 }); 9560 } 9561 function baseTrim(string) { 9562 return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; 9563 } 9564 function baseUnary(func) { 9565 return function(value) { 9566 return func(value); 9567 }; 9568 } 9569 function baseValues(object, props) { 9570 return arrayMap(props, function(key) { 9571 return object[key]; 9572 }); 9573 } 9574 function cacheHas(cache, key) { 9575 return cache.has(key); 9576 } 9577 function charsStartIndex(strSymbols, chrSymbols) { 9578 var index = -1, length = strSymbols.length; 9579 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 9580 } 9581 return index; 9582 } 9583 function charsEndIndex(strSymbols, chrSymbols) { 9584 var index = strSymbols.length; 9585 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 9586 } 9587 return index; 9588 } 9589 function countHolders(array, placeholder) { 9590 var length = array.length, result = 0; 9591 while (length--) { 9592 if (array[length] === placeholder) { 9593 ++result; 9594 } 9595 } 9596 return result; 9597 } 9598 var deburrLetter = basePropertyOf(deburredLetters); 9599 var escapeHtmlChar = basePropertyOf(htmlEscapes); 9600 function escapeStringChar(chr) { 9601 return "\\" + stringEscapes[chr]; 9602 } 9603 function getValue(object, key) { 9604 return object == null ? undefined2 : object[key]; 9605 } 9606 function hasUnicode(string) { 9607 return reHasUnicode.test(string); 9608 } 9609 function hasUnicodeWord(string) { 9610 return reHasUnicodeWord.test(string); 9611 } 9612 function iteratorToArray(iterator) { 9613 var data, result = []; 9614 while (!(data = iterator.next()).done) { 9615 result.push(data.value); 9616 } 9617 return result; 9618 } 9619 function mapToArray(map) { 9620 var index = -1, result = Array(map.size); 9621 map.forEach(function(value, key) { 9622 result[++index] = [key, value]; 9623 }); 9624 return result; 9625 } 9626 function overArg(func, transform) { 9627 return function(arg) { 9628 return func(transform(arg)); 9629 }; 9630 } 9631 function replaceHolders(array, placeholder) { 9632 var index = -1, length = array.length, resIndex = 0, result = []; 9633 while (++index < length) { 9634 var value = array[index]; 9635 if (value === placeholder || value === PLACEHOLDER) { 9636 array[index] = PLACEHOLDER; 9637 result[resIndex++] = index; 9638 } 9639 } 9640 return result; 9641 } 9642 function setToArray(set) { 9643 var index = -1, result = Array(set.size); 9644 set.forEach(function(value) { 9645 result[++index] = value; 9646 }); 9647 return result; 9648 } 9649 function setToPairs(set) { 9650 var index = -1, result = Array(set.size); 9651 set.forEach(function(value) { 9652 result[++index] = [value, value]; 9653 }); 9654 return result; 9655 } 9656 function strictIndexOf(array, value, fromIndex) { 9657 var index = fromIndex - 1, length = array.length; 9658 while (++index < length) { 9659 if (array[index] === value) { 9660 return index; 9661 } 9662 } 9663 return -1; 9664 } 9665 function strictLastIndexOf(array, value, fromIndex) { 9666 var index = fromIndex + 1; 9667 while (index--) { 9668 if (array[index] === value) { 9669 return index; 9670 } 9671 } 9672 return index; 9673 } 9674 function stringSize(string) { 9675 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); 9676 } 9677 function stringToArray(string) { 9678 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); 9679 } 9680 function trimmedEndIndex(string) { 9681 var index = string.length; 9682 while (index-- && reWhitespace.test(string.charAt(index))) { 9683 } 9684 return index; 9685 } 9686 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 9687 function unicodeSize(string) { 9688 var result = reUnicode.lastIndex = 0; 9689 while (reUnicode.test(string)) { 9690 ++result; 9691 } 9692 return result; 9693 } 9694 function unicodeToArray(string) { 9695 return string.match(reUnicode) || []; 9696 } 9697 function unicodeWords(string) { 9698 return string.match(reUnicodeWord) || []; 9699 } 9700 var runInContext = function runInContext2(context) { 9701 context = context == null ? root : _23.defaults(root.Object(), context, _23.pick(root, contextProps)); 9702 var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; 9703 var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; 9704 var coreJsData = context["__core-js_shared__"]; 9705 var funcToString = funcProto.toString; 9706 var hasOwnProperty = objectProto.hasOwnProperty; 9707 var idCounter = 0; 9708 var maskSrcKey = function() { 9709 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); 9710 return uid ? "Symbol(src)_1." + uid : ""; 9711 }(); 9712 var nativeObjectToString = objectProto.toString; 9713 var objectCtorString = funcToString.call(Object2); 9714 var oldDash = root._; 9715 var reIsNative = RegExp2( 9716 "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" 9717 ); 9718 var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; 9719 var defineProperty = function() { 9720 try { 9721 var func = getNative(Object2, "defineProperty"); 9722 func({}, "", {}); 9723 return func; 9724 } catch (e) { 9725 } 9726 }(); 9727 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 9728 var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; 9729 var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); 9730 var metaMap = WeakMap2 && new WeakMap2(); 9731 var realNames = {}; 9732 var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2); 9733 var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2; 9734 function lodash(value) { 9735 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 9736 if (value instanceof LodashWrapper) { 9737 return value; 9738 } 9739 if (hasOwnProperty.call(value, "__wrapped__")) { 9740 return wrapperClone(value); 9741 } 9742 } 9743 return new LodashWrapper(value); 9744 } 9745 var baseCreate = /* @__PURE__ */ function() { 9746 function object() { 9747 } 9748 return function(proto) { 9749 if (!isObject(proto)) { 9750 return {}; 9751 } 9752 if (objectCreate) { 9753 return objectCreate(proto); 9754 } 9755 object.prototype = proto; 9756 var result2 = new object(); 9757 object.prototype = undefined2; 9758 return result2; 9759 }; 9760 }(); 9761 function baseLodash() { 9762 } 9763 function LodashWrapper(value, chainAll) { 9764 this.__wrapped__ = value; 9765 this.__actions__ = []; 9766 this.__chain__ = !!chainAll; 9767 this.__index__ = 0; 9768 this.__values__ = undefined2; 9769 } 9770 lodash.templateSettings = { 9771 /** 9772 * Used to detect `data` property values to be HTML-escaped. 9773 * 9774 * @memberOf _.templateSettings 9775 * @type {RegExp} 9776 */ 9777 "escape": reEscape, 9778 /** 9779 * Used to detect code to be evaluated. 9780 * 9781 * @memberOf _.templateSettings 9782 * @type {RegExp} 9783 */ 9784 "evaluate": reEvaluate, 9785 /** 9786 * Used to detect `data` property values to inject. 9787 * 9788 * @memberOf _.templateSettings 9789 * @type {RegExp} 9790 */ 9791 "interpolate": reInterpolate, 9792 /** 9793 * Used to reference the data object in the template text. 9794 * 9795 * @memberOf _.templateSettings 9796 * @type {string} 9797 */ 9798 "variable": "", 9799 /** 9800 * Used to import variables into the compiled template. 9801 * 9802 * @memberOf _.templateSettings 9803 * @type {Object} 9804 */ 9805 "imports": { 9806 /** 9807 * A reference to the `lodash` function. 9808 * 9809 * @memberOf _.templateSettings.imports 9810 * @type {Function} 9811 */ 9812 "_": lodash 9813 } 9814 }; 9815 lodash.prototype = baseLodash.prototype; 9816 lodash.prototype.constructor = lodash; 9817 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 9818 LodashWrapper.prototype.constructor = LodashWrapper; 9819 function LazyWrapper(value) { 9820 this.__wrapped__ = value; 9821 this.__actions__ = []; 9822 this.__dir__ = 1; 9823 this.__filtered__ = false; 9824 this.__iteratees__ = []; 9825 this.__takeCount__ = MAX_ARRAY_LENGTH; 9826 this.__views__ = []; 9827 } 9828 function lazyClone() { 9829 var result2 = new LazyWrapper(this.__wrapped__); 9830 result2.__actions__ = copyArray(this.__actions__); 9831 result2.__dir__ = this.__dir__; 9832 result2.__filtered__ = this.__filtered__; 9833 result2.__iteratees__ = copyArray(this.__iteratees__); 9834 result2.__takeCount__ = this.__takeCount__; 9835 result2.__views__ = copyArray(this.__views__); 9836 return result2; 9837 } 9838 function lazyReverse() { 9839 if (this.__filtered__) { 9840 var result2 = new LazyWrapper(this); 9841 result2.__dir__ = -1; 9842 result2.__filtered__ = true; 9843 } else { 9844 result2 = this.clone(); 9845 result2.__dir__ *= -1; 9846 } 9847 return result2; 9848 } 9849 function lazyValue() { 9850 var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); 9851 if (!isArr || !isRight && arrLength == length && takeCount == length) { 9852 return baseWrapperValue(array, this.__actions__); 9853 } 9854 var result2 = []; 9855 outer: 9856 while (length-- && resIndex < takeCount) { 9857 index += dir; 9858 var iterIndex = -1, value = array[index]; 9859 while (++iterIndex < iterLength) { 9860 var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value); 9861 if (type == LAZY_MAP_FLAG) { 9862 value = computed; 9863 } else if (!computed) { 9864 if (type == LAZY_FILTER_FLAG) { 9865 continue outer; 9866 } else { 9867 break outer; 9868 } 9869 } 9870 } 9871 result2[resIndex++] = value; 9872 } 9873 return result2; 9874 } 9875 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 9876 LazyWrapper.prototype.constructor = LazyWrapper; 9877 function Hash(entries) { 9878 var index = -1, length = entries == null ? 0 : entries.length; 9879 this.clear(); 9880 while (++index < length) { 9881 var entry = entries[index]; 9882 this.set(entry[0], entry[1]); 9883 } 9884 } 9885 function hashClear() { 9886 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 9887 this.size = 0; 9888 } 9889 function hashDelete(key) { 9890 var result2 = this.has(key) && delete this.__data__[key]; 9891 this.size -= result2 ? 1 : 0; 9892 return result2; 9893 } 9894 function hashGet(key) { 9895 var data = this.__data__; 9896 if (nativeCreate) { 9897 var result2 = data[key]; 9898 return result2 === HASH_UNDEFINED ? undefined2 : result2; 9899 } 9900 return hasOwnProperty.call(data, key) ? data[key] : undefined2; 9901 } 9902 function hashHas(key) { 9903 var data = this.__data__; 9904 return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key); 9905 } 9906 function hashSet(key, value) { 9907 var data = this.__data__; 9908 this.size += this.has(key) ? 0 : 1; 9909 data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; 9910 return this; 9911 } 9912 Hash.prototype.clear = hashClear; 9913 Hash.prototype["delete"] = hashDelete; 9914 Hash.prototype.get = hashGet; 9915 Hash.prototype.has = hashHas; 9916 Hash.prototype.set = hashSet; 9917 function ListCache(entries) { 9918 var index = -1, length = entries == null ? 0 : entries.length; 9919 this.clear(); 9920 while (++index < length) { 9921 var entry = entries[index]; 9922 this.set(entry[0], entry[1]); 9923 } 9924 } 9925 function listCacheClear() { 9926 this.__data__ = []; 9927 this.size = 0; 9928 } 9929 function listCacheDelete(key) { 9930 var data = this.__data__, index = assocIndexOf(data, key); 9931 if (index < 0) { 9932 return false; 9933 } 9934 var lastIndex = data.length - 1; 9935 if (index == lastIndex) { 9936 data.pop(); 9937 } else { 9938 splice.call(data, index, 1); 9939 } 9940 --this.size; 9941 return true; 9942 } 9943 function listCacheGet(key) { 9944 var data = this.__data__, index = assocIndexOf(data, key); 9945 return index < 0 ? undefined2 : data[index][1]; 9946 } 9947 function listCacheHas(key) { 9948 return assocIndexOf(this.__data__, key) > -1; 9949 } 9950 function listCacheSet(key, value) { 9951 var data = this.__data__, index = assocIndexOf(data, key); 9952 if (index < 0) { 9953 ++this.size; 9954 data.push([key, value]); 9955 } else { 9956 data[index][1] = value; 9957 } 9958 return this; 9959 } 9960 ListCache.prototype.clear = listCacheClear; 9961 ListCache.prototype["delete"] = listCacheDelete; 9962 ListCache.prototype.get = listCacheGet; 9963 ListCache.prototype.has = listCacheHas; 9964 ListCache.prototype.set = listCacheSet; 9965 function MapCache(entries) { 9966 var index = -1, length = entries == null ? 0 : entries.length; 9967 this.clear(); 9968 while (++index < length) { 9969 var entry = entries[index]; 9970 this.set(entry[0], entry[1]); 9971 } 9972 } 9973 function mapCacheClear() { 9974 this.size = 0; 9975 this.__data__ = { 9976 "hash": new Hash(), 9977 "map": new (Map2 || ListCache)(), 9978 "string": new Hash() 9979 }; 9980 } 9981 function mapCacheDelete(key) { 9982 var result2 = getMapData(this, key)["delete"](key); 9983 this.size -= result2 ? 1 : 0; 9984 return result2; 9985 } 9986 function mapCacheGet(key) { 9987 return getMapData(this, key).get(key); 9988 } 9989 function mapCacheHas(key) { 9990 return getMapData(this, key).has(key); 9991 } 9992 function mapCacheSet(key, value) { 9993 var data = getMapData(this, key), size2 = data.size; 9994 data.set(key, value); 9995 this.size += data.size == size2 ? 0 : 1; 9996 return this; 9997 } 9998 MapCache.prototype.clear = mapCacheClear; 9999 MapCache.prototype["delete"] = mapCacheDelete; 10000 MapCache.prototype.get = mapCacheGet; 10001 MapCache.prototype.has = mapCacheHas; 10002 MapCache.prototype.set = mapCacheSet; 10003 function SetCache(values2) { 10004 var index = -1, length = values2 == null ? 0 : values2.length; 10005 this.__data__ = new MapCache(); 10006 while (++index < length) { 10007 this.add(values2[index]); 10008 } 10009 } 10010 function setCacheAdd(value) { 10011 this.__data__.set(value, HASH_UNDEFINED); 10012 return this; 10013 } 10014 function setCacheHas(value) { 10015 return this.__data__.has(value); 10016 } 10017 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 10018 SetCache.prototype.has = setCacheHas; 10019 function Stack(entries) { 10020 var data = this.__data__ = new ListCache(entries); 10021 this.size = data.size; 10022 } 10023 function stackClear() { 10024 this.__data__ = new ListCache(); 10025 this.size = 0; 10026 } 10027 function stackDelete(key) { 10028 var data = this.__data__, result2 = data["delete"](key); 10029 this.size = data.size; 10030 return result2; 10031 } 10032 function stackGet(key) { 10033 return this.__data__.get(key); 10034 } 10035 function stackHas(key) { 10036 return this.__data__.has(key); 10037 } 10038 function stackSet(key, value) { 10039 var data = this.__data__; 10040 if (data instanceof ListCache) { 10041 var pairs = data.__data__; 10042 if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { 10043 pairs.push([key, value]); 10044 this.size = ++data.size; 10045 return this; 10046 } 10047 data = this.__data__ = new MapCache(pairs); 10048 } 10049 data.set(key, value); 10050 this.size = data.size; 10051 return this; 10052 } 10053 Stack.prototype.clear = stackClear; 10054 Stack.prototype["delete"] = stackDelete; 10055 Stack.prototype.get = stackGet; 10056 Stack.prototype.has = stackHas; 10057 Stack.prototype.set = stackSet; 10058 function arrayLikeKeys(value, inherited) { 10059 var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; 10060 for (var key in value) { 10061 if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. 10062 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. 10063 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. 10064 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. 10065 isIndex(key, length)))) { 10066 result2.push(key); 10067 } 10068 } 10069 return result2; 10070 } 10071 function arraySample(array) { 10072 var length = array.length; 10073 return length ? array[baseRandom(0, length - 1)] : undefined2; 10074 } 10075 function arraySampleSize(array, n) { 10076 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 10077 } 10078 function arrayShuffle(array) { 10079 return shuffleSelf(copyArray(array)); 10080 } 10081 function assignMergeValue(object, key, value) { 10082 if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) { 10083 baseAssignValue(object, key, value); 10084 } 10085 } 10086 function assignValue(object, key, value) { 10087 var objValue = object[key]; 10088 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) { 10089 baseAssignValue(object, key, value); 10090 } 10091 } 10092 function assocIndexOf(array, key) { 10093 var length = array.length; 10094 while (length--) { 10095 if (eq(array[length][0], key)) { 10096 return length; 10097 } 10098 } 10099 return -1; 10100 } 10101 function baseAggregator(collection, setter, iteratee2, accumulator) { 10102 baseEach(collection, function(value, key, collection2) { 10103 setter(accumulator, value, iteratee2(value), collection2); 10104 }); 10105 return accumulator; 10106 } 10107 function baseAssign(object, source) { 10108 return object && copyObject(source, keys(source), object); 10109 } 10110 function baseAssignIn(object, source) { 10111 return object && copyObject(source, keysIn(source), object); 10112 } 10113 function baseAssignValue(object, key, value) { 10114 if (key == "__proto__" && defineProperty) { 10115 defineProperty(object, key, { 10116 "configurable": true, 10117 "enumerable": true, 10118 "value": value, 10119 "writable": true 10120 }); 10121 } else { 10122 object[key] = value; 10123 } 10124 } 10125 function baseAt(object, paths) { 10126 var index = -1, length = paths.length, result2 = Array2(length), skip = object == null; 10127 while (++index < length) { 10128 result2[index] = skip ? undefined2 : get2(object, paths[index]); 10129 } 10130 return result2; 10131 } 10132 function baseClamp(number, lower, upper) { 10133 if (number === number) { 10134 if (upper !== undefined2) { 10135 number = number <= upper ? number : upper; 10136 } 10137 if (lower !== undefined2) { 10138 number = number >= lower ? number : lower; 10139 } 10140 } 10141 return number; 10142 } 10143 function baseClone(value, bitmask, customizer, key, object, stack) { 10144 var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; 10145 if (customizer) { 10146 result2 = object ? customizer(value, key, object, stack) : customizer(value); 10147 } 10148 if (result2 !== undefined2) { 10149 return result2; 10150 } 10151 if (!isObject(value)) { 10152 return value; 10153 } 10154 var isArr = isArray(value); 10155 if (isArr) { 10156 result2 = initCloneArray(value); 10157 if (!isDeep) { 10158 return copyArray(value, result2); 10159 } 10160 } else { 10161 var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; 10162 if (isBuffer(value)) { 10163 return cloneBuffer(value, isDeep); 10164 } 10165 if (tag == objectTag || tag == argsTag || isFunc && !object) { 10166 result2 = isFlat || isFunc ? {} : initCloneObject(value); 10167 if (!isDeep) { 10168 return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); 10169 } 10170 } else { 10171 if (!cloneableTags[tag]) { 10172 return object ? value : {}; 10173 } 10174 result2 = initCloneByTag(value, tag, isDeep); 10175 } 10176 } 10177 stack || (stack = new Stack()); 10178 var stacked = stack.get(value); 10179 if (stacked) { 10180 return stacked; 10181 } 10182 stack.set(value, result2); 10183 if (isSet(value)) { 10184 value.forEach(function(subValue) { 10185 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 10186 }); 10187 } else if (isMap(value)) { 10188 value.forEach(function(subValue, key2) { 10189 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 10190 }); 10191 } 10192 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; 10193 var props = isArr ? undefined2 : keysFunc(value); 10194 arrayEach(props || value, function(subValue, key2) { 10195 if (props) { 10196 key2 = subValue; 10197 subValue = value[key2]; 10198 } 10199 assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 10200 }); 10201 return result2; 10202 } 10203 function baseConforms(source) { 10204 var props = keys(source); 10205 return function(object) { 10206 return baseConformsTo(object, source, props); 10207 }; 10208 } 10209 function baseConformsTo(object, source, props) { 10210 var length = props.length; 10211 if (object == null) { 10212 return !length; 10213 } 10214 object = Object2(object); 10215 while (length--) { 10216 var key = props[length], predicate = source[key], value = object[key]; 10217 if (value === undefined2 && !(key in object) || !predicate(value)) { 10218 return false; 10219 } 10220 } 10221 return true; 10222 } 10223 function baseDelay(func, wait, args) { 10224 if (typeof func != "function") { 10225 throw new TypeError2(FUNC_ERROR_TEXT); 10226 } 10227 return setTimeout2(function() { 10228 func.apply(undefined2, args); 10229 }, wait); 10230 } 10231 function baseDifference(array, values2, iteratee2, comparator) { 10232 var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length; 10233 if (!length) { 10234 return result2; 10235 } 10236 if (iteratee2) { 10237 values2 = arrayMap(values2, baseUnary(iteratee2)); 10238 } 10239 if (comparator) { 10240 includes2 = arrayIncludesWith; 10241 isCommon = false; 10242 } else if (values2.length >= LARGE_ARRAY_SIZE) { 10243 includes2 = cacheHas; 10244 isCommon = false; 10245 values2 = new SetCache(values2); 10246 } 10247 outer: 10248 while (++index < length) { 10249 var value = array[index], computed = iteratee2 == null ? value : iteratee2(value); 10250 value = comparator || value !== 0 ? value : 0; 10251 if (isCommon && computed === computed) { 10252 var valuesIndex = valuesLength; 10253 while (valuesIndex--) { 10254 if (values2[valuesIndex] === computed) { 10255 continue outer; 10256 } 10257 } 10258 result2.push(value); 10259 } else if (!includes2(values2, computed, comparator)) { 10260 result2.push(value); 10261 } 10262 } 10263 return result2; 10264 } 10265 var baseEach = createBaseEach(baseForOwn); 10266 var baseEachRight = createBaseEach(baseForOwnRight, true); 10267 function baseEvery(collection, predicate) { 10268 var result2 = true; 10269 baseEach(collection, function(value, index, collection2) { 10270 result2 = !!predicate(value, index, collection2); 10271 return result2; 10272 }); 10273 return result2; 10274 } 10275 function baseExtremum(array, iteratee2, comparator) { 10276 var index = -1, length = array.length; 10277 while (++index < length) { 10278 var value = array[index], current = iteratee2(value); 10279 if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) { 10280 var computed = current, result2 = value; 10281 } 10282 } 10283 return result2; 10284 } 10285 function baseFill(array, value, start, end) { 10286 var length = array.length; 10287 start = toInteger(start); 10288 if (start < 0) { 10289 start = -start > length ? 0 : length + start; 10290 } 10291 end = end === undefined2 || end > length ? length : toInteger(end); 10292 if (end < 0) { 10293 end += length; 10294 } 10295 end = start > end ? 0 : toLength(end); 10296 while (start < end) { 10297 array[start++] = value; 10298 } 10299 return array; 10300 } 10301 function baseFilter(collection, predicate) { 10302 var result2 = []; 10303 baseEach(collection, function(value, index, collection2) { 10304 if (predicate(value, index, collection2)) { 10305 result2.push(value); 10306 } 10307 }); 10308 return result2; 10309 } 10310 function baseFlatten(array, depth, predicate, isStrict, result2) { 10311 var index = -1, length = array.length; 10312 predicate || (predicate = isFlattenable); 10313 result2 || (result2 = []); 10314 while (++index < length) { 10315 var value = array[index]; 10316 if (depth > 0 && predicate(value)) { 10317 if (depth > 1) { 10318 baseFlatten(value, depth - 1, predicate, isStrict, result2); 10319 } else { 10320 arrayPush(result2, value); 10321 } 10322 } else if (!isStrict) { 10323 result2[result2.length] = value; 10324 } 10325 } 10326 return result2; 10327 } 10328 var baseFor = createBaseFor(); 10329 var baseForRight = createBaseFor(true); 10330 function baseForOwn(object, iteratee2) { 10331 return object && baseFor(object, iteratee2, keys); 10332 } 10333 function baseForOwnRight(object, iteratee2) { 10334 return object && baseForRight(object, iteratee2, keys); 10335 } 10336 function baseFunctions(object, props) { 10337 return arrayFilter(props, function(key) { 10338 return isFunction(object[key]); 10339 }); 10340 } 10341 function baseGet(object, path) { 10342 path = castPath(path, object); 10343 var index = 0, length = path.length; 10344 while (object != null && index < length) { 10345 object = object[toKey(path[index++])]; 10346 } 10347 return index && index == length ? object : undefined2; 10348 } 10349 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 10350 var result2 = keysFunc(object); 10351 return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object)); 10352 } 10353 function baseGetTag(value) { 10354 if (value == null) { 10355 return value === undefined2 ? undefinedTag : nullTag; 10356 } 10357 return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value); 10358 } 10359 function baseGt(value, other) { 10360 return value > other; 10361 } 10362 function baseHas(object, key) { 10363 return object != null && hasOwnProperty.call(object, key); 10364 } 10365 function baseHasIn(object, key) { 10366 return object != null && key in Object2(object); 10367 } 10368 function baseInRange(number, start, end) { 10369 return number >= nativeMin(start, end) && number < nativeMax(start, end); 10370 } 10371 function baseIntersection(arrays, iteratee2, comparator) { 10372 var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; 10373 while (othIndex--) { 10374 var array = arrays[othIndex]; 10375 if (othIndex && iteratee2) { 10376 array = arrayMap(array, baseUnary(iteratee2)); 10377 } 10378 maxLength = nativeMin(array.length, maxLength); 10379 caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; 10380 } 10381 array = arrays[0]; 10382 var index = -1, seen = caches[0]; 10383 outer: 10384 while (++index < length && result2.length < maxLength) { 10385 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 10386 value = comparator || value !== 0 ? value : 0; 10387 if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { 10388 othIndex = othLength; 10389 while (--othIndex) { 10390 var cache = caches[othIndex]; 10391 if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { 10392 continue outer; 10393 } 10394 } 10395 if (seen) { 10396 seen.push(computed); 10397 } 10398 result2.push(value); 10399 } 10400 } 10401 return result2; 10402 } 10403 function baseInverter(object, setter, iteratee2, accumulator) { 10404 baseForOwn(object, function(value, key, object2) { 10405 setter(accumulator, iteratee2(value), key, object2); 10406 }); 10407 return accumulator; 10408 } 10409 function baseInvoke(object, path, args) { 10410 path = castPath(path, object); 10411 object = parent(object, path); 10412 var func = object == null ? object : object[toKey(last(path))]; 10413 return func == null ? undefined2 : apply(func, object, args); 10414 } 10415 function baseIsArguments(value) { 10416 return isObjectLike(value) && baseGetTag(value) == argsTag; 10417 } 10418 function baseIsArrayBuffer(value) { 10419 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 10420 } 10421 function baseIsDate(value) { 10422 return isObjectLike(value) && baseGetTag(value) == dateTag; 10423 } 10424 function baseIsEqual(value, other, bitmask, customizer, stack) { 10425 if (value === other) { 10426 return true; 10427 } 10428 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { 10429 return value !== value && other !== other; 10430 } 10431 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 10432 } 10433 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 10434 var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); 10435 objTag = objTag == argsTag ? objectTag : objTag; 10436 othTag = othTag == argsTag ? objectTag : othTag; 10437 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; 10438 if (isSameTag && isBuffer(object)) { 10439 if (!isBuffer(other)) { 10440 return false; 10441 } 10442 objIsArr = true; 10443 objIsObj = false; 10444 } 10445 if (isSameTag && !objIsObj) { 10446 stack || (stack = new Stack()); 10447 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 10448 } 10449 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 10450 var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); 10451 if (objIsWrapped || othIsWrapped) { 10452 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; 10453 stack || (stack = new Stack()); 10454 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 10455 } 10456 } 10457 if (!isSameTag) { 10458 return false; 10459 } 10460 stack || (stack = new Stack()); 10461 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 10462 } 10463 function baseIsMap(value) { 10464 return isObjectLike(value) && getTag(value) == mapTag; 10465 } 10466 function baseIsMatch(object, source, matchData, customizer) { 10467 var index = matchData.length, length = index, noCustomizer = !customizer; 10468 if (object == null) { 10469 return !length; 10470 } 10471 object = Object2(object); 10472 while (index--) { 10473 var data = matchData[index]; 10474 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { 10475 return false; 10476 } 10477 } 10478 while (++index < length) { 10479 data = matchData[index]; 10480 var key = data[0], objValue = object[key], srcValue = data[1]; 10481 if (noCustomizer && data[2]) { 10482 if (objValue === undefined2 && !(key in object)) { 10483 return false; 10484 } 10485 } else { 10486 var stack = new Stack(); 10487 if (customizer) { 10488 var result2 = customizer(objValue, srcValue, key, object, source, stack); 10489 } 10490 if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { 10491 return false; 10492 } 10493 } 10494 } 10495 return true; 10496 } 10497 function baseIsNative(value) { 10498 if (!isObject(value) || isMasked(value)) { 10499 return false; 10500 } 10501 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 10502 return pattern.test(toSource(value)); 10503 } 10504 function baseIsRegExp(value) { 10505 return isObjectLike(value) && baseGetTag(value) == regexpTag; 10506 } 10507 function baseIsSet(value) { 10508 return isObjectLike(value) && getTag(value) == setTag; 10509 } 10510 function baseIsTypedArray(value) { 10511 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 10512 } 10513 function baseIteratee(value) { 10514 if (typeof value == "function") { 10515 return value; 10516 } 10517 if (value == null) { 10518 return identity; 10519 } 10520 if (typeof value == "object") { 10521 return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); 10522 } 10523 return property(value); 10524 } 10525 function baseKeys(object) { 10526 if (!isPrototype(object)) { 10527 return nativeKeys(object); 10528 } 10529 var result2 = []; 10530 for (var key in Object2(object)) { 10531 if (hasOwnProperty.call(object, key) && key != "constructor") { 10532 result2.push(key); 10533 } 10534 } 10535 return result2; 10536 } 10537 function baseKeysIn(object) { 10538 if (!isObject(object)) { 10539 return nativeKeysIn(object); 10540 } 10541 var isProto = isPrototype(object), result2 = []; 10542 for (var key in object) { 10543 if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) { 10544 result2.push(key); 10545 } 10546 } 10547 return result2; 10548 } 10549 function baseLt(value, other) { 10550 return value < other; 10551 } 10552 function baseMap(collection, iteratee2) { 10553 var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; 10554 baseEach(collection, function(value, key, collection2) { 10555 result2[++index] = iteratee2(value, key, collection2); 10556 }); 10557 return result2; 10558 } 10559 function baseMatches(source) { 10560 var matchData = getMatchData(source); 10561 if (matchData.length == 1 && matchData[0][2]) { 10562 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 10563 } 10564 return function(object) { 10565 return object === source || baseIsMatch(object, source, matchData); 10566 }; 10567 } 10568 function baseMatchesProperty(path, srcValue) { 10569 if (isKey(path) && isStrictComparable(srcValue)) { 10570 return matchesStrictComparable(toKey(path), srcValue); 10571 } 10572 return function(object) { 10573 var objValue = get2(object, path); 10574 return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 10575 }; 10576 } 10577 function baseMerge(object, source, srcIndex, customizer, stack) { 10578 if (object === source) { 10579 return; 10580 } 10581 baseFor(source, function(srcValue, key) { 10582 stack || (stack = new Stack()); 10583 if (isObject(srcValue)) { 10584 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 10585 } else { 10586 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2; 10587 if (newValue === undefined2) { 10588 newValue = srcValue; 10589 } 10590 assignMergeValue(object, key, newValue); 10591 } 10592 }, keysIn); 10593 } 10594 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 10595 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); 10596 if (stacked) { 10597 assignMergeValue(object, key, stacked); 10598 return; 10599 } 10600 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2; 10601 var isCommon = newValue === undefined2; 10602 if (isCommon) { 10603 var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); 10604 newValue = srcValue; 10605 if (isArr || isBuff || isTyped) { 10606 if (isArray(objValue)) { 10607 newValue = objValue; 10608 } else if (isArrayLikeObject(objValue)) { 10609 newValue = copyArray(objValue); 10610 } else if (isBuff) { 10611 isCommon = false; 10612 newValue = cloneBuffer(srcValue, true); 10613 } else if (isTyped) { 10614 isCommon = false; 10615 newValue = cloneTypedArray(srcValue, true); 10616 } else { 10617 newValue = []; 10618 } 10619 } else if (isPlainObject(srcValue) || isArguments(srcValue)) { 10620 newValue = objValue; 10621 if (isArguments(objValue)) { 10622 newValue = toPlainObject(objValue); 10623 } else if (!isObject(objValue) || isFunction(objValue)) { 10624 newValue = initCloneObject(srcValue); 10625 } 10626 } else { 10627 isCommon = false; 10628 } 10629 } 10630 if (isCommon) { 10631 stack.set(srcValue, newValue); 10632 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 10633 stack["delete"](srcValue); 10634 } 10635 assignMergeValue(object, key, newValue); 10636 } 10637 function baseNth(array, n) { 10638 var length = array.length; 10639 if (!length) { 10640 return; 10641 } 10642 n += n < 0 ? length : 0; 10643 return isIndex(n, length) ? array[n] : undefined2; 10644 } 10645 function baseOrderBy(collection, iteratees, orders) { 10646 if (iteratees.length) { 10647 iteratees = arrayMap(iteratees, function(iteratee2) { 10648 if (isArray(iteratee2)) { 10649 return function(value) { 10650 return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); 10651 }; 10652 } 10653 return iteratee2; 10654 }); 10655 } else { 10656 iteratees = [identity]; 10657 } 10658 var index = -1; 10659 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 10660 var result2 = baseMap(collection, function(value, key, collection2) { 10661 var criteria = arrayMap(iteratees, function(iteratee2) { 10662 return iteratee2(value); 10663 }); 10664 return { "criteria": criteria, "index": ++index, "value": value }; 10665 }); 10666 return baseSortBy(result2, function(object, other) { 10667 return compareMultiple(object, other, orders); 10668 }); 10669 } 10670 function basePick(object, paths) { 10671 return basePickBy(object, paths, function(value, path) { 10672 return hasIn(object, path); 10673 }); 10674 } 10675 function basePickBy(object, paths, predicate) { 10676 var index = -1, length = paths.length, result2 = {}; 10677 while (++index < length) { 10678 var path = paths[index], value = baseGet(object, path); 10679 if (predicate(value, path)) { 10680 baseSet(result2, castPath(path, object), value); 10681 } 10682 } 10683 return result2; 10684 } 10685 function basePropertyDeep(path) { 10686 return function(object) { 10687 return baseGet(object, path); 10688 }; 10689 } 10690 function basePullAll(array, values2, iteratee2, comparator) { 10691 var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; 10692 if (array === values2) { 10693 values2 = copyArray(values2); 10694 } 10695 if (iteratee2) { 10696 seen = arrayMap(array, baseUnary(iteratee2)); 10697 } 10698 while (++index < length) { 10699 var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; 10700 while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { 10701 if (seen !== array) { 10702 splice.call(seen, fromIndex, 1); 10703 } 10704 splice.call(array, fromIndex, 1); 10705 } 10706 } 10707 return array; 10708 } 10709 function basePullAt(array, indexes) { 10710 var length = array ? indexes.length : 0, lastIndex = length - 1; 10711 while (length--) { 10712 var index = indexes[length]; 10713 if (length == lastIndex || index !== previous) { 10714 var previous = index; 10715 if (isIndex(index)) { 10716 splice.call(array, index, 1); 10717 } else { 10718 baseUnset(array, index); 10719 } 10720 } 10721 } 10722 return array; 10723 } 10724 function baseRandom(lower, upper) { 10725 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 10726 } 10727 function baseRange(start, end, step, fromRight) { 10728 var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); 10729 while (length--) { 10730 result2[fromRight ? length : ++index] = start; 10731 start += step; 10732 } 10733 return result2; 10734 } 10735 function baseRepeat(string, n) { 10736 var result2 = ""; 10737 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 10738 return result2; 10739 } 10740 do { 10741 if (n % 2) { 10742 result2 += string; 10743 } 10744 n = nativeFloor(n / 2); 10745 if (n) { 10746 string += string; 10747 } 10748 } while (n); 10749 return result2; 10750 } 10751 function baseRest(func, start) { 10752 return setToString(overRest(func, start, identity), func + ""); 10753 } 10754 function baseSample(collection) { 10755 return arraySample(values(collection)); 10756 } 10757 function baseSampleSize(collection, n) { 10758 var array = values(collection); 10759 return shuffleSelf(array, baseClamp(n, 0, array.length)); 10760 } 10761 function baseSet(object, path, value, customizer) { 10762 if (!isObject(object)) { 10763 return object; 10764 } 10765 path = castPath(path, object); 10766 var index = -1, length = path.length, lastIndex = length - 1, nested = object; 10767 while (nested != null && ++index < length) { 10768 var key = toKey(path[index]), newValue = value; 10769 if (key === "__proto__" || key === "constructor" || key === "prototype") { 10770 return object; 10771 } 10772 if (index != lastIndex) { 10773 var objValue = nested[key]; 10774 newValue = customizer ? customizer(objValue, key, nested) : undefined2; 10775 if (newValue === undefined2) { 10776 newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; 10777 } 10778 } 10779 assignValue(nested, key, newValue); 10780 nested = nested[key]; 10781 } 10782 return object; 10783 } 10784 var baseSetData = !metaMap ? identity : function(func, data) { 10785 metaMap.set(func, data); 10786 return func; 10787 }; 10788 var baseSetToString = !defineProperty ? identity : function(func, string) { 10789 return defineProperty(func, "toString", { 10790 "configurable": true, 10791 "enumerable": false, 10792 "value": constant(string), 10793 "writable": true 10794 }); 10795 }; 10796 function baseShuffle(collection) { 10797 return shuffleSelf(values(collection)); 10798 } 10799 function baseSlice(array, start, end) { 10800 var index = -1, length = array.length; 10801 if (start < 0) { 10802 start = -start > length ? 0 : length + start; 10803 } 10804 end = end > length ? length : end; 10805 if (end < 0) { 10806 end += length; 10807 } 10808 length = start > end ? 0 : end - start >>> 0; 10809 start >>>= 0; 10810 var result2 = Array2(length); 10811 while (++index < length) { 10812 result2[index] = array[index + start]; 10813 } 10814 return result2; 10815 } 10816 function baseSome(collection, predicate) { 10817 var result2; 10818 baseEach(collection, function(value, index, collection2) { 10819 result2 = predicate(value, index, collection2); 10820 return !result2; 10821 }); 10822 return !!result2; 10823 } 10824 function baseSortedIndex(array, value, retHighest) { 10825 var low = 0, high = array == null ? low : array.length; 10826 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 10827 while (low < high) { 10828 var mid = low + high >>> 1, computed = array[mid]; 10829 if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) { 10830 low = mid + 1; 10831 } else { 10832 high = mid; 10833 } 10834 } 10835 return high; 10836 } 10837 return baseSortedIndexBy(array, value, identity, retHighest); 10838 } 10839 function baseSortedIndexBy(array, value, iteratee2, retHighest) { 10840 var low = 0, high = array == null ? 0 : array.length; 10841 if (high === 0) { 10842 return 0; 10843 } 10844 value = iteratee2(value); 10845 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2; 10846 while (low < high) { 10847 var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); 10848 if (valIsNaN) { 10849 var setLow = retHighest || othIsReflexive; 10850 } else if (valIsUndefined) { 10851 setLow = othIsReflexive && (retHighest || othIsDefined); 10852 } else if (valIsNull) { 10853 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 10854 } else if (valIsSymbol) { 10855 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 10856 } else if (othIsNull || othIsSymbol) { 10857 setLow = false; 10858 } else { 10859 setLow = retHighest ? computed <= value : computed < value; 10860 } 10861 if (setLow) { 10862 low = mid + 1; 10863 } else { 10864 high = mid; 10865 } 10866 } 10867 return nativeMin(high, MAX_ARRAY_INDEX); 10868 } 10869 function baseSortedUniq(array, iteratee2) { 10870 var index = -1, length = array.length, resIndex = 0, result2 = []; 10871 while (++index < length) { 10872 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 10873 if (!index || !eq(computed, seen)) { 10874 var seen = computed; 10875 result2[resIndex++] = value === 0 ? 0 : value; 10876 } 10877 } 10878 return result2; 10879 } 10880 function baseToNumber(value) { 10881 if (typeof value == "number") { 10882 return value; 10883 } 10884 if (isSymbol(value)) { 10885 return NAN; 10886 } 10887 return +value; 10888 } 10889 function baseToString(value) { 10890 if (typeof value == "string") { 10891 return value; 10892 } 10893 if (isArray(value)) { 10894 return arrayMap(value, baseToString) + ""; 10895 } 10896 if (isSymbol(value)) { 10897 return symbolToString ? symbolToString.call(value) : ""; 10898 } 10899 var result2 = value + ""; 10900 return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; 10901 } 10902 function baseUniq(array, iteratee2, comparator) { 10903 var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; 10904 if (comparator) { 10905 isCommon = false; 10906 includes2 = arrayIncludesWith; 10907 } else if (length >= LARGE_ARRAY_SIZE) { 10908 var set2 = iteratee2 ? null : createSet(array); 10909 if (set2) { 10910 return setToArray(set2); 10911 } 10912 isCommon = false; 10913 includes2 = cacheHas; 10914 seen = new SetCache(); 10915 } else { 10916 seen = iteratee2 ? [] : result2; 10917 } 10918 outer: 10919 while (++index < length) { 10920 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 10921 value = comparator || value !== 0 ? value : 0; 10922 if (isCommon && computed === computed) { 10923 var seenIndex = seen.length; 10924 while (seenIndex--) { 10925 if (seen[seenIndex] === computed) { 10926 continue outer; 10927 } 10928 } 10929 if (iteratee2) { 10930 seen.push(computed); 10931 } 10932 result2.push(value); 10933 } else if (!includes2(seen, computed, comparator)) { 10934 if (seen !== result2) { 10935 seen.push(computed); 10936 } 10937 result2.push(value); 10938 } 10939 } 10940 return result2; 10941 } 10942 function baseUnset(object, path) { 10943 path = castPath(path, object); 10944 var index = -1, length = path.length; 10945 if (!length) { 10946 return true; 10947 } 10948 while (++index < length) { 10949 var key = toKey(path[index]); 10950 if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) { 10951 return false; 10952 } 10953 if ((key === "constructor" || key === "prototype") && index < length - 1) { 10954 return false; 10955 } 10956 } 10957 var obj = parent(object, path); 10958 return obj == null || delete obj[toKey(last(path))]; 10959 } 10960 function baseUpdate(object, path, updater, customizer) { 10961 return baseSet(object, path, updater(baseGet(object, path)), customizer); 10962 } 10963 function baseWhile(array, predicate, isDrop, fromRight) { 10964 var length = array.length, index = fromRight ? length : -1; 10965 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { 10966 } 10967 return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); 10968 } 10969 function baseWrapperValue(value, actions) { 10970 var result2 = value; 10971 if (result2 instanceof LazyWrapper) { 10972 result2 = result2.value(); 10973 } 10974 return arrayReduce(actions, function(result3, action) { 10975 return action.func.apply(action.thisArg, arrayPush([result3], action.args)); 10976 }, result2); 10977 } 10978 function baseXor(arrays, iteratee2, comparator) { 10979 var length = arrays.length; 10980 if (length < 2) { 10981 return length ? baseUniq(arrays[0]) : []; 10982 } 10983 var index = -1, result2 = Array2(length); 10984 while (++index < length) { 10985 var array = arrays[index], othIndex = -1; 10986 while (++othIndex < length) { 10987 if (othIndex != index) { 10988 result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator); 10989 } 10990 } 10991 } 10992 return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); 10993 } 10994 function baseZipObject(props, values2, assignFunc) { 10995 var index = -1, length = props.length, valsLength = values2.length, result2 = {}; 10996 while (++index < length) { 10997 var value = index < valsLength ? values2[index] : undefined2; 10998 assignFunc(result2, props[index], value); 10999 } 11000 return result2; 11001 } 11002 function castArrayLikeObject(value) { 11003 return isArrayLikeObject(value) ? value : []; 11004 } 11005 function castFunction(value) { 11006 return typeof value == "function" ? value : identity; 11007 } 11008 function castPath(value, object) { 11009 if (isArray(value)) { 11010 return value; 11011 } 11012 return isKey(value, object) ? [value] : stringToPath(toString(value)); 11013 } 11014 var castRest = baseRest; 11015 function castSlice(array, start, end) { 11016 var length = array.length; 11017 end = end === undefined2 ? length : end; 11018 return !start && end >= length ? array : baseSlice(array, start, end); 11019 } 11020 var clearTimeout2 = ctxClearTimeout || function(id) { 11021 return root.clearTimeout(id); 11022 }; 11023 function cloneBuffer(buffer, isDeep) { 11024 if (isDeep) { 11025 return buffer.slice(); 11026 } 11027 var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 11028 buffer.copy(result2); 11029 return result2; 11030 } 11031 function cloneArrayBuffer(arrayBuffer) { 11032 var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); 11033 new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); 11034 return result2; 11035 } 11036 function cloneDataView(dataView, isDeep) { 11037 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 11038 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 11039 } 11040 function cloneRegExp(regexp) { 11041 var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 11042 result2.lastIndex = regexp.lastIndex; 11043 return result2; 11044 } 11045 function cloneSymbol(symbol) { 11046 return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; 11047 } 11048 function cloneTypedArray(typedArray, isDeep) { 11049 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 11050 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 11051 } 11052 function compareAscending(value, other) { 11053 if (value !== other) { 11054 var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); 11055 var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); 11056 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { 11057 return 1; 11058 } 11059 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { 11060 return -1; 11061 } 11062 } 11063 return 0; 11064 } 11065 function compareMultiple(object, other, orders) { 11066 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; 11067 while (++index < length) { 11068 var result2 = compareAscending(objCriteria[index], othCriteria[index]); 11069 if (result2) { 11070 if (index >= ordersLength) { 11071 return result2; 11072 } 11073 var order = orders[index]; 11074 return result2 * (order == "desc" ? -1 : 1); 11075 } 11076 } 11077 return object.index - other.index; 11078 } 11079 function composeArgs(args, partials, holders, isCurried) { 11080 var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; 11081 while (++leftIndex < leftLength) { 11082 result2[leftIndex] = partials[leftIndex]; 11083 } 11084 while (++argsIndex < holdersLength) { 11085 if (isUncurried || argsIndex < argsLength) { 11086 result2[holders[argsIndex]] = args[argsIndex]; 11087 } 11088 } 11089 while (rangeLength--) { 11090 result2[leftIndex++] = args[argsIndex++]; 11091 } 11092 return result2; 11093 } 11094 function composeArgsRight(args, partials, holders, isCurried) { 11095 var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; 11096 while (++argsIndex < rangeLength) { 11097 result2[argsIndex] = args[argsIndex]; 11098 } 11099 var offset = argsIndex; 11100 while (++rightIndex < rightLength) { 11101 result2[offset + rightIndex] = partials[rightIndex]; 11102 } 11103 while (++holdersIndex < holdersLength) { 11104 if (isUncurried || argsIndex < argsLength) { 11105 result2[offset + holders[holdersIndex]] = args[argsIndex++]; 11106 } 11107 } 11108 return result2; 11109 } 11110 function copyArray(source, array) { 11111 var index = -1, length = source.length; 11112 array || (array = Array2(length)); 11113 while (++index < length) { 11114 array[index] = source[index]; 11115 } 11116 return array; 11117 } 11118 function copyObject(source, props, object, customizer) { 11119 var isNew = !object; 11120 object || (object = {}); 11121 var index = -1, length = props.length; 11122 while (++index < length) { 11123 var key = props[index]; 11124 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2; 11125 if (newValue === undefined2) { 11126 newValue = source[key]; 11127 } 11128 if (isNew) { 11129 baseAssignValue(object, key, newValue); 11130 } else { 11131 assignValue(object, key, newValue); 11132 } 11133 } 11134 return object; 11135 } 11136 function copySymbols(source, object) { 11137 return copyObject(source, getSymbols(source), object); 11138 } 11139 function copySymbolsIn(source, object) { 11140 return copyObject(source, getSymbolsIn(source), object); 11141 } 11142 function createAggregator(setter, initializer) { 11143 return function(collection, iteratee2) { 11144 var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; 11145 return func(collection, setter, getIteratee(iteratee2, 2), accumulator); 11146 }; 11147 } 11148 function createAssigner(assigner) { 11149 return baseRest(function(object, sources) { 11150 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; 11151 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; 11152 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 11153 customizer = length < 3 ? undefined2 : customizer; 11154 length = 1; 11155 } 11156 object = Object2(object); 11157 while (++index < length) { 11158 var source = sources[index]; 11159 if (source) { 11160 assigner(object, source, index, customizer); 11161 } 11162 } 11163 return object; 11164 }); 11165 } 11166 function createBaseEach(eachFunc, fromRight) { 11167 return function(collection, iteratee2) { 11168 if (collection == null) { 11169 return collection; 11170 } 11171 if (!isArrayLike(collection)) { 11172 return eachFunc(collection, iteratee2); 11173 } 11174 var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); 11175 while (fromRight ? index-- : ++index < length) { 11176 if (iteratee2(iterable[index], index, iterable) === false) { 11177 break; 11178 } 11179 } 11180 return collection; 11181 }; 11182 } 11183 function createBaseFor(fromRight) { 11184 return function(object, iteratee2, keysFunc) { 11185 var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; 11186 while (length--) { 11187 var key = props[fromRight ? length : ++index]; 11188 if (iteratee2(iterable[key], key, iterable) === false) { 11189 break; 11190 } 11191 } 11192 return object; 11193 }; 11194 } 11195 function createBind(func, bitmask, thisArg) { 11196 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); 11197 function wrapper() { 11198 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 11199 return fn.apply(isBind ? thisArg : this, arguments); 11200 } 11201 return wrapper; 11202 } 11203 function createCaseFirst(methodName) { 11204 return function(string) { 11205 string = toString(string); 11206 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2; 11207 var chr = strSymbols ? strSymbols[0] : string.charAt(0); 11208 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); 11209 return chr[methodName]() + trailing; 11210 }; 11211 } 11212 function createCompounder(callback) { 11213 return function(string) { 11214 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); 11215 }; 11216 } 11217 function createCtor(Ctor) { 11218 return function() { 11219 var args = arguments; 11220 switch (args.length) { 11221 case 0: 11222 return new Ctor(); 11223 case 1: 11224 return new Ctor(args[0]); 11225 case 2: 11226 return new Ctor(args[0], args[1]); 11227 case 3: 11228 return new Ctor(args[0], args[1], args[2]); 11229 case 4: 11230 return new Ctor(args[0], args[1], args[2], args[3]); 11231 case 5: 11232 return new Ctor(args[0], args[1], args[2], args[3], args[4]); 11233 case 6: 11234 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 11235 case 7: 11236 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 11237 } 11238 var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); 11239 return isObject(result2) ? result2 : thisBinding; 11240 }; 11241 } 11242 function createCurry(func, bitmask, arity) { 11243 var Ctor = createCtor(func); 11244 function wrapper() { 11245 var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper); 11246 while (index--) { 11247 args[index] = arguments[index]; 11248 } 11249 var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); 11250 length -= holders.length; 11251 if (length < arity) { 11252 return createRecurry( 11253 func, 11254 bitmask, 11255 createHybrid, 11256 wrapper.placeholder, 11257 undefined2, 11258 args, 11259 holders, 11260 undefined2, 11261 undefined2, 11262 arity - length 11263 ); 11264 } 11265 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 11266 return apply(fn, this, args); 11267 } 11268 return wrapper; 11269 } 11270 function createFind(findIndexFunc) { 11271 return function(collection, predicate, fromIndex) { 11272 var iterable = Object2(collection); 11273 if (!isArrayLike(collection)) { 11274 var iteratee2 = getIteratee(predicate, 3); 11275 collection = keys(collection); 11276 predicate = function(key) { 11277 return iteratee2(iterable[key], key, iterable); 11278 }; 11279 } 11280 var index = findIndexFunc(collection, predicate, fromIndex); 11281 return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2; 11282 }; 11283 } 11284 function createFlow(fromRight) { 11285 return flatRest(function(funcs) { 11286 var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; 11287 if (fromRight) { 11288 funcs.reverse(); 11289 } 11290 while (index--) { 11291 var func = funcs[index]; 11292 if (typeof func != "function") { 11293 throw new TypeError2(FUNC_ERROR_TEXT); 11294 } 11295 if (prereq && !wrapper && getFuncName(func) == "wrapper") { 11296 var wrapper = new LodashWrapper([], true); 11297 } 11298 } 11299 index = wrapper ? index : length; 11300 while (++index < length) { 11301 func = funcs[index]; 11302 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2; 11303 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) { 11304 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 11305 } else { 11306 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); 11307 } 11308 } 11309 return function() { 11310 var args = arguments, value = args[0]; 11311 if (wrapper && args.length == 1 && isArray(value)) { 11312 return wrapper.plant(value).value(); 11313 } 11314 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; 11315 while (++index2 < length) { 11316 result2 = funcs[index2].call(this, result2); 11317 } 11318 return result2; 11319 }; 11320 }); 11321 } 11322 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { 11323 var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); 11324 function wrapper() { 11325 var length = arguments.length, args = Array2(length), index = length; 11326 while (index--) { 11327 args[index] = arguments[index]; 11328 } 11329 if (isCurried) { 11330 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); 11331 } 11332 if (partials) { 11333 args = composeArgs(args, partials, holders, isCurried); 11334 } 11335 if (partialsRight) { 11336 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 11337 } 11338 length -= holdersCount; 11339 if (isCurried && length < arity) { 11340 var newHolders = replaceHolders(args, placeholder); 11341 return createRecurry( 11342 func, 11343 bitmask, 11344 createHybrid, 11345 wrapper.placeholder, 11346 thisArg, 11347 args, 11348 newHolders, 11349 argPos, 11350 ary2, 11351 arity - length 11352 ); 11353 } 11354 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; 11355 length = args.length; 11356 if (argPos) { 11357 args = reorder(args, argPos); 11358 } else if (isFlip && length > 1) { 11359 args.reverse(); 11360 } 11361 if (isAry && ary2 < length) { 11362 args.length = ary2; 11363 } 11364 if (this && this !== root && this instanceof wrapper) { 11365 fn = Ctor || createCtor(fn); 11366 } 11367 return fn.apply(thisBinding, args); 11368 } 11369 return wrapper; 11370 } 11371 function createInverter(setter, toIteratee) { 11372 return function(object, iteratee2) { 11373 return baseInverter(object, setter, toIteratee(iteratee2), {}); 11374 }; 11375 } 11376 function createMathOperation(operator, defaultValue) { 11377 return function(value, other) { 11378 var result2; 11379 if (value === undefined2 && other === undefined2) { 11380 return defaultValue; 11381 } 11382 if (value !== undefined2) { 11383 result2 = value; 11384 } 11385 if (other !== undefined2) { 11386 if (result2 === undefined2) { 11387 return other; 11388 } 11389 if (typeof value == "string" || typeof other == "string") { 11390 value = baseToString(value); 11391 other = baseToString(other); 11392 } else { 11393 value = baseToNumber(value); 11394 other = baseToNumber(other); 11395 } 11396 result2 = operator(value, other); 11397 } 11398 return result2; 11399 }; 11400 } 11401 function createOver(arrayFunc) { 11402 return flatRest(function(iteratees) { 11403 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 11404 return baseRest(function(args) { 11405 var thisArg = this; 11406 return arrayFunc(iteratees, function(iteratee2) { 11407 return apply(iteratee2, thisArg, args); 11408 }); 11409 }); 11410 }); 11411 } 11412 function createPadding(length, chars) { 11413 chars = chars === undefined2 ? " " : baseToString(chars); 11414 var charsLength = chars.length; 11415 if (charsLength < 2) { 11416 return charsLength ? baseRepeat(chars, length) : chars; 11417 } 11418 var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 11419 return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); 11420 } 11421 function createPartial(func, bitmask, thisArg, partials) { 11422 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); 11423 function wrapper() { 11424 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; 11425 while (++leftIndex < leftLength) { 11426 args[leftIndex] = partials[leftIndex]; 11427 } 11428 while (argsLength--) { 11429 args[leftIndex++] = arguments[++argsIndex]; 11430 } 11431 return apply(fn, isBind ? thisArg : this, args); 11432 } 11433 return wrapper; 11434 } 11435 function createRange(fromRight) { 11436 return function(start, end, step) { 11437 if (step && typeof step != "number" && isIterateeCall(start, end, step)) { 11438 end = step = undefined2; 11439 } 11440 start = toFinite(start); 11441 if (end === undefined2) { 11442 end = start; 11443 start = 0; 11444 } else { 11445 end = toFinite(end); 11446 } 11447 step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step); 11448 return baseRange(start, end, step, fromRight); 11449 }; 11450 } 11451 function createRelationalOperation(operator) { 11452 return function(value, other) { 11453 if (!(typeof value == "string" && typeof other == "string")) { 11454 value = toNumber(value); 11455 other = toNumber(other); 11456 } 11457 return operator(value, other); 11458 }; 11459 } 11460 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { 11461 var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials; 11462 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG; 11463 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 11464 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 11465 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 11466 } 11467 var newData = [ 11468 func, 11469 bitmask, 11470 thisArg, 11471 newPartials, 11472 newHolders, 11473 newPartialsRight, 11474 newHoldersRight, 11475 argPos, 11476 ary2, 11477 arity 11478 ]; 11479 var result2 = wrapFunc.apply(undefined2, newData); 11480 if (isLaziable(func)) { 11481 setData(result2, newData); 11482 } 11483 result2.placeholder = placeholder; 11484 return setWrapToString(result2, func, bitmask); 11485 } 11486 function createRound(methodName) { 11487 var func = Math2[methodName]; 11488 return function(number, precision) { 11489 number = toNumber(number); 11490 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 11491 if (precision && nativeIsFinite(number)) { 11492 var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); 11493 pair = (toString(value) + "e").split("e"); 11494 return +(pair[0] + "e" + (+pair[1] - precision)); 11495 } 11496 return func(number); 11497 }; 11498 } 11499 var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values2) { 11500 return new Set2(values2); 11501 }; 11502 function createToPairs(keysFunc) { 11503 return function(object) { 11504 var tag = getTag(object); 11505 if (tag == mapTag) { 11506 return mapToArray(object); 11507 } 11508 if (tag == setTag) { 11509 return setToPairs(object); 11510 } 11511 return baseToPairs(object, keysFunc(object)); 11512 }; 11513 } 11514 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { 11515 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 11516 if (!isBindKey && typeof func != "function") { 11517 throw new TypeError2(FUNC_ERROR_TEXT); 11518 } 11519 var length = partials ? partials.length : 0; 11520 if (!length) { 11521 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 11522 partials = holders = undefined2; 11523 } 11524 ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0); 11525 arity = arity === undefined2 ? arity : toInteger(arity); 11526 length -= holders ? holders.length : 0; 11527 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 11528 var partialsRight = partials, holdersRight = holders; 11529 partials = holders = undefined2; 11530 } 11531 var data = isBindKey ? undefined2 : getData(func); 11532 var newData = [ 11533 func, 11534 bitmask, 11535 thisArg, 11536 partials, 11537 holders, 11538 partialsRight, 11539 holdersRight, 11540 argPos, 11541 ary2, 11542 arity 11543 ]; 11544 if (data) { 11545 mergeData(newData, data); 11546 } 11547 func = newData[0]; 11548 bitmask = newData[1]; 11549 thisArg = newData[2]; 11550 partials = newData[3]; 11551 holders = newData[4]; 11552 arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0); 11553 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 11554 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 11555 } 11556 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 11557 var result2 = createBind(func, bitmask, thisArg); 11558 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 11559 result2 = createCurry(func, bitmask, arity); 11560 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 11561 result2 = createPartial(func, bitmask, thisArg, partials); 11562 } else { 11563 result2 = createHybrid.apply(undefined2, newData); 11564 } 11565 var setter = data ? baseSetData : setData; 11566 return setWrapToString(setter(result2, newData), func, bitmask); 11567 } 11568 function customDefaultsAssignIn(objValue, srcValue, key, object) { 11569 if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) { 11570 return srcValue; 11571 } 11572 return objValue; 11573 } 11574 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 11575 if (isObject(objValue) && isObject(srcValue)) { 11576 stack.set(srcValue, objValue); 11577 baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); 11578 stack["delete"](srcValue); 11579 } 11580 return objValue; 11581 } 11582 function customOmitClone(value) { 11583 return isPlainObject(value) ? undefined2 : value; 11584 } 11585 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 11586 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; 11587 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 11588 return false; 11589 } 11590 var arrStacked = stack.get(array); 11591 var othStacked = stack.get(other); 11592 if (arrStacked && othStacked) { 11593 return arrStacked == other && othStacked == array; 11594 } 11595 var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; 11596 stack.set(array, other); 11597 stack.set(other, array); 11598 while (++index < arrLength) { 11599 var arrValue = array[index], othValue = other[index]; 11600 if (customizer) { 11601 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); 11602 } 11603 if (compared !== undefined2) { 11604 if (compared) { 11605 continue; 11606 } 11607 result2 = false; 11608 break; 11609 } 11610 if (seen) { 11611 if (!arraySome(other, function(othValue2, othIndex) { 11612 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { 11613 return seen.push(othIndex); 11614 } 11615 })) { 11616 result2 = false; 11617 break; 11618 } 11619 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 11620 result2 = false; 11621 break; 11622 } 11623 } 11624 stack["delete"](array); 11625 stack["delete"](other); 11626 return result2; 11627 } 11628 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 11629 switch (tag) { 11630 case dataViewTag: 11631 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { 11632 return false; 11633 } 11634 object = object.buffer; 11635 other = other.buffer; 11636 case arrayBufferTag: 11637 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { 11638 return false; 11639 } 11640 return true; 11641 case boolTag: 11642 case dateTag: 11643 case numberTag: 11644 return eq(+object, +other); 11645 case errorTag: 11646 return object.name == other.name && object.message == other.message; 11647 case regexpTag: 11648 case stringTag: 11649 return object == other + ""; 11650 case mapTag: 11651 var convert = mapToArray; 11652 case setTag: 11653 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 11654 convert || (convert = setToArray); 11655 if (object.size != other.size && !isPartial) { 11656 return false; 11657 } 11658 var stacked = stack.get(object); 11659 if (stacked) { 11660 return stacked == other; 11661 } 11662 bitmask |= COMPARE_UNORDERED_FLAG; 11663 stack.set(object, other); 11664 var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 11665 stack["delete"](object); 11666 return result2; 11667 case symbolTag: 11668 if (symbolValueOf) { 11669 return symbolValueOf.call(object) == symbolValueOf.call(other); 11670 } 11671 } 11672 return false; 11673 } 11674 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 11675 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; 11676 if (objLength != othLength && !isPartial) { 11677 return false; 11678 } 11679 var index = objLength; 11680 while (index--) { 11681 var key = objProps[index]; 11682 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 11683 return false; 11684 } 11685 } 11686 var objStacked = stack.get(object); 11687 var othStacked = stack.get(other); 11688 if (objStacked && othStacked) { 11689 return objStacked == other && othStacked == object; 11690 } 11691 var result2 = true; 11692 stack.set(object, other); 11693 stack.set(other, object); 11694 var skipCtor = isPartial; 11695 while (++index < objLength) { 11696 key = objProps[index]; 11697 var objValue = object[key], othValue = other[key]; 11698 if (customizer) { 11699 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); 11700 } 11701 if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { 11702 result2 = false; 11703 break; 11704 } 11705 skipCtor || (skipCtor = key == "constructor"); 11706 } 11707 if (result2 && !skipCtor) { 11708 var objCtor = object.constructor, othCtor = other.constructor; 11709 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { 11710 result2 = false; 11711 } 11712 } 11713 stack["delete"](object); 11714 stack["delete"](other); 11715 return result2; 11716 } 11717 function flatRest(func) { 11718 return setToString(overRest(func, undefined2, flatten), func + ""); 11719 } 11720 function getAllKeys(object) { 11721 return baseGetAllKeys(object, keys, getSymbols); 11722 } 11723 function getAllKeysIn(object) { 11724 return baseGetAllKeys(object, keysIn, getSymbolsIn); 11725 } 11726 var getData = !metaMap ? noop2 : function(func) { 11727 return metaMap.get(func); 11728 }; 11729 function getFuncName(func) { 11730 var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0; 11731 while (length--) { 11732 var data = array[length], otherFunc = data.func; 11733 if (otherFunc == null || otherFunc == func) { 11734 return data.name; 11735 } 11736 } 11737 return result2; 11738 } 11739 function getHolder(func) { 11740 var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func; 11741 return object.placeholder; 11742 } 11743 function getIteratee() { 11744 var result2 = lodash.iteratee || iteratee; 11745 result2 = result2 === iteratee ? baseIteratee : result2; 11746 return arguments.length ? result2(arguments[0], arguments[1]) : result2; 11747 } 11748 function getMapData(map2, key) { 11749 var data = map2.__data__; 11750 return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; 11751 } 11752 function getMatchData(object) { 11753 var result2 = keys(object), length = result2.length; 11754 while (length--) { 11755 var key = result2[length], value = object[key]; 11756 result2[length] = [key, value, isStrictComparable(value)]; 11757 } 11758 return result2; 11759 } 11760 function getNative(object, key) { 11761 var value = getValue(object, key); 11762 return baseIsNative(value) ? value : undefined2; 11763 } 11764 function getRawTag(value) { 11765 var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; 11766 try { 11767 value[symToStringTag] = undefined2; 11768 var unmasked = true; 11769 } catch (e) { 11770 } 11771 var result2 = nativeObjectToString.call(value); 11772 if (unmasked) { 11773 if (isOwn) { 11774 value[symToStringTag] = tag; 11775 } else { 11776 delete value[symToStringTag]; 11777 } 11778 } 11779 return result2; 11780 } 11781 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 11782 if (object == null) { 11783 return []; 11784 } 11785 object = Object2(object); 11786 return arrayFilter(nativeGetSymbols(object), function(symbol) { 11787 return propertyIsEnumerable.call(object, symbol); 11788 }); 11789 }; 11790 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 11791 var result2 = []; 11792 while (object) { 11793 arrayPush(result2, getSymbols(object)); 11794 object = getPrototype(object); 11795 } 11796 return result2; 11797 }; 11798 var getTag = baseGetTag; 11799 if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) { 11800 getTag = function(value) { 11801 var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : ""; 11802 if (ctorString) { 11803 switch (ctorString) { 11804 case dataViewCtorString: 11805 return dataViewTag; 11806 case mapCtorString: 11807 return mapTag; 11808 case promiseCtorString: 11809 return promiseTag; 11810 case setCtorString: 11811 return setTag; 11812 case weakMapCtorString: 11813 return weakMapTag; 11814 } 11815 } 11816 return result2; 11817 }; 11818 } 11819 function getView(start, end, transforms) { 11820 var index = -1, length = transforms.length; 11821 while (++index < length) { 11822 var data = transforms[index], size2 = data.size; 11823 switch (data.type) { 11824 case "drop": 11825 start += size2; 11826 break; 11827 case "dropRight": 11828 end -= size2; 11829 break; 11830 case "take": 11831 end = nativeMin(end, start + size2); 11832 break; 11833 case "takeRight": 11834 start = nativeMax(start, end - size2); 11835 break; 11836 } 11837 } 11838 return { "start": start, "end": end }; 11839 } 11840 function getWrapDetails(source) { 11841 var match = source.match(reWrapDetails); 11842 return match ? match[1].split(reSplitDetails) : []; 11843 } 11844 function hasPath(object, path, hasFunc) { 11845 path = castPath(path, object); 11846 var index = -1, length = path.length, result2 = false; 11847 while (++index < length) { 11848 var key = toKey(path[index]); 11849 if (!(result2 = object != null && hasFunc(object, key))) { 11850 break; 11851 } 11852 object = object[key]; 11853 } 11854 if (result2 || ++index != length) { 11855 return result2; 11856 } 11857 length = object == null ? 0 : object.length; 11858 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); 11859 } 11860 function initCloneArray(array) { 11861 var length = array.length, result2 = new array.constructor(length); 11862 if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { 11863 result2.index = array.index; 11864 result2.input = array.input; 11865 } 11866 return result2; 11867 } 11868 function initCloneObject(object) { 11869 return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; 11870 } 11871 function initCloneByTag(object, tag, isDeep) { 11872 var Ctor = object.constructor; 11873 switch (tag) { 11874 case arrayBufferTag: 11875 return cloneArrayBuffer(object); 11876 case boolTag: 11877 case dateTag: 11878 return new Ctor(+object); 11879 case dataViewTag: 11880 return cloneDataView(object, isDeep); 11881 case float32Tag: 11882 case float64Tag: 11883 case int8Tag: 11884 case int16Tag: 11885 case int32Tag: 11886 case uint8Tag: 11887 case uint8ClampedTag: 11888 case uint16Tag: 11889 case uint32Tag: 11890 return cloneTypedArray(object, isDeep); 11891 case mapTag: 11892 return new Ctor(); 11893 case numberTag: 11894 case stringTag: 11895 return new Ctor(object); 11896 case regexpTag: 11897 return cloneRegExp(object); 11898 case setTag: 11899 return new Ctor(); 11900 case symbolTag: 11901 return cloneSymbol(object); 11902 } 11903 } 11904 function insertWrapDetails(source, details) { 11905 var length = details.length; 11906 if (!length) { 11907 return source; 11908 } 11909 var lastIndex = length - 1; 11910 details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; 11911 details = details.join(length > 2 ? ", " : " "); 11912 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); 11913 } 11914 function isFlattenable(value) { 11915 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); 11916 } 11917 function isIndex(value, length) { 11918 var type = typeof value; 11919 length = length == null ? MAX_SAFE_INTEGER : length; 11920 return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); 11921 } 11922 function isIterateeCall(value, index, object) { 11923 if (!isObject(object)) { 11924 return false; 11925 } 11926 var type = typeof index; 11927 if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) { 11928 return eq(object[index], value); 11929 } 11930 return false; 11931 } 11932 function isKey(value, object) { 11933 if (isArray(value)) { 11934 return false; 11935 } 11936 var type = typeof value; 11937 if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { 11938 return true; 11939 } 11940 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); 11941 } 11942 function isKeyable(value) { 11943 var type = typeof value; 11944 return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; 11945 } 11946 function isLaziable(func) { 11947 var funcName = getFuncName(func), other = lodash[funcName]; 11948 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { 11949 return false; 11950 } 11951 if (func === other) { 11952 return true; 11953 } 11954 var data = getData(other); 11955 return !!data && func === data[0]; 11956 } 11957 function isMasked(func) { 11958 return !!maskSrcKey && maskSrcKey in func; 11959 } 11960 var isMaskable = coreJsData ? isFunction : stubFalse; 11961 function isPrototype(value) { 11962 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; 11963 return value === proto; 11964 } 11965 function isStrictComparable(value) { 11966 return value === value && !isObject(value); 11967 } 11968 function matchesStrictComparable(key, srcValue) { 11969 return function(object) { 11970 if (object == null) { 11971 return false; 11972 } 11973 return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); 11974 }; 11975 } 11976 function memoizeCapped(func) { 11977 var result2 = memoize(func, function(key) { 11978 if (cache.size === MAX_MEMOIZE_SIZE) { 11979 cache.clear(); 11980 } 11981 return key; 11982 }); 11983 var cache = result2.cache; 11984 return result2; 11985 } 11986 function mergeData(data, source) { 11987 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 11988 var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; 11989 if (!(isCommon || isCombo)) { 11990 return data; 11991 } 11992 if (srcBitmask & WRAP_BIND_FLAG) { 11993 data[2] = source[2]; 11994 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 11995 } 11996 var value = source[3]; 11997 if (value) { 11998 var partials = data[3]; 11999 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 12000 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 12001 } 12002 value = source[5]; 12003 if (value) { 12004 partials = data[5]; 12005 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 12006 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 12007 } 12008 value = source[7]; 12009 if (value) { 12010 data[7] = value; 12011 } 12012 if (srcBitmask & WRAP_ARY_FLAG) { 12013 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 12014 } 12015 if (data[9] == null) { 12016 data[9] = source[9]; 12017 } 12018 data[0] = source[0]; 12019 data[1] = newBitmask; 12020 return data; 12021 } 12022 function nativeKeysIn(object) { 12023 var result2 = []; 12024 if (object != null) { 12025 for (var key in Object2(object)) { 12026 result2.push(key); 12027 } 12028 } 12029 return result2; 12030 } 12031 function objectToString(value) { 12032 return nativeObjectToString.call(value); 12033 } 12034 function overRest(func, start, transform2) { 12035 start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); 12036 return function() { 12037 var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); 12038 while (++index < length) { 12039 array[index] = args[start + index]; 12040 } 12041 index = -1; 12042 var otherArgs = Array2(start + 1); 12043 while (++index < start) { 12044 otherArgs[index] = args[index]; 12045 } 12046 otherArgs[start] = transform2(array); 12047 return apply(func, this, otherArgs); 12048 }; 12049 } 12050 function parent(object, path) { 12051 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 12052 } 12053 function reorder(array, indexes) { 12054 var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); 12055 while (length--) { 12056 var index = indexes[length]; 12057 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2; 12058 } 12059 return array; 12060 } 12061 function safeGet(object, key) { 12062 if (key === "constructor" && typeof object[key] === "function") { 12063 return; 12064 } 12065 if (key == "__proto__") { 12066 return; 12067 } 12068 return object[key]; 12069 } 12070 var setData = shortOut(baseSetData); 12071 var setTimeout2 = ctxSetTimeout || function(func, wait) { 12072 return root.setTimeout(func, wait); 12073 }; 12074 var setToString = shortOut(baseSetToString); 12075 function setWrapToString(wrapper, reference, bitmask) { 12076 var source = reference + ""; 12077 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 12078 } 12079 function shortOut(func) { 12080 var count = 0, lastCalled = 0; 12081 return function() { 12082 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); 12083 lastCalled = stamp; 12084 if (remaining > 0) { 12085 if (++count >= HOT_COUNT) { 12086 return arguments[0]; 12087 } 12088 } else { 12089 count = 0; 12090 } 12091 return func.apply(undefined2, arguments); 12092 }; 12093 } 12094 function shuffleSelf(array, size2) { 12095 var index = -1, length = array.length, lastIndex = length - 1; 12096 size2 = size2 === undefined2 ? length : size2; 12097 while (++index < size2) { 12098 var rand = baseRandom(index, lastIndex), value = array[rand]; 12099 array[rand] = array[index]; 12100 array[index] = value; 12101 } 12102 array.length = size2; 12103 return array; 12104 } 12105 var stringToPath = memoizeCapped(function(string) { 12106 var result2 = []; 12107 if (string.charCodeAt(0) === 46) { 12108 result2.push(""); 12109 } 12110 string.replace(rePropName, function(match, number, quote, subString) { 12111 result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); 12112 }); 12113 return result2; 12114 }); 12115 function toKey(value) { 12116 if (typeof value == "string" || isSymbol(value)) { 12117 return value; 12118 } 12119 var result2 = value + ""; 12120 return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; 12121 } 12122 function toSource(func) { 12123 if (func != null) { 12124 try { 12125 return funcToString.call(func); 12126 } catch (e) { 12127 } 12128 try { 12129 return func + ""; 12130 } catch (e) { 12131 } 12132 } 12133 return ""; 12134 } 12135 function updateWrapDetails(details, bitmask) { 12136 arrayEach(wrapFlags, function(pair) { 12137 var value = "_." + pair[0]; 12138 if (bitmask & pair[1] && !arrayIncludes(details, value)) { 12139 details.push(value); 12140 } 12141 }); 12142 return details.sort(); 12143 } 12144 function wrapperClone(wrapper) { 12145 if (wrapper instanceof LazyWrapper) { 12146 return wrapper.clone(); 12147 } 12148 var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 12149 result2.__actions__ = copyArray(wrapper.__actions__); 12150 result2.__index__ = wrapper.__index__; 12151 result2.__values__ = wrapper.__values__; 12152 return result2; 12153 } 12154 function chunk(array, size2, guard) { 12155 if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) { 12156 size2 = 1; 12157 } else { 12158 size2 = nativeMax(toInteger(size2), 0); 12159 } 12160 var length = array == null ? 0 : array.length; 12161 if (!length || size2 < 1) { 12162 return []; 12163 } 12164 var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2)); 12165 while (index < length) { 12166 result2[resIndex++] = baseSlice(array, index, index += size2); 12167 } 12168 return result2; 12169 } 12170 function compact(array) { 12171 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; 12172 while (++index < length) { 12173 var value = array[index]; 12174 if (value) { 12175 result2[resIndex++] = value; 12176 } 12177 } 12178 return result2; 12179 } 12180 function concat() { 12181 var length = arguments.length; 12182 if (!length) { 12183 return []; 12184 } 12185 var args = Array2(length - 1), array = arguments[0], index = length; 12186 while (index--) { 12187 args[index - 1] = arguments[index]; 12188 } 12189 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 12190 } 12191 var difference = baseRest(function(array, values2) { 12192 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; 12193 }); 12194 var differenceBy = baseRest(function(array, values2) { 12195 var iteratee2 = last(values2); 12196 if (isArrayLikeObject(iteratee2)) { 12197 iteratee2 = undefined2; 12198 } 12199 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; 12200 }); 12201 var differenceWith = baseRest(function(array, values2) { 12202 var comparator = last(values2); 12203 if (isArrayLikeObject(comparator)) { 12204 comparator = undefined2; 12205 } 12206 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : []; 12207 }); 12208 function drop(array, n, guard) { 12209 var length = array == null ? 0 : array.length; 12210 if (!length) { 12211 return []; 12212 } 12213 n = guard || n === undefined2 ? 1 : toInteger(n); 12214 return baseSlice(array, n < 0 ? 0 : n, length); 12215 } 12216 function dropRight(array, n, guard) { 12217 var length = array == null ? 0 : array.length; 12218 if (!length) { 12219 return []; 12220 } 12221 n = guard || n === undefined2 ? 1 : toInteger(n); 12222 n = length - n; 12223 return baseSlice(array, 0, n < 0 ? 0 : n); 12224 } 12225 function dropRightWhile(array, predicate) { 12226 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; 12227 } 12228 function dropWhile(array, predicate) { 12229 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; 12230 } 12231 function fill(array, value, start, end) { 12232 var length = array == null ? 0 : array.length; 12233 if (!length) { 12234 return []; 12235 } 12236 if (start && typeof start != "number" && isIterateeCall(array, value, start)) { 12237 start = 0; 12238 end = length; 12239 } 12240 return baseFill(array, value, start, end); 12241 } 12242 function findIndex(array, predicate, fromIndex) { 12243 var length = array == null ? 0 : array.length; 12244 if (!length) { 12245 return -1; 12246 } 12247 var index = fromIndex == null ? 0 : toInteger(fromIndex); 12248 if (index < 0) { 12249 index = nativeMax(length + index, 0); 12250 } 12251 return baseFindIndex(array, getIteratee(predicate, 3), index); 12252 } 12253 function findLastIndex(array, predicate, fromIndex) { 12254 var length = array == null ? 0 : array.length; 12255 if (!length) { 12256 return -1; 12257 } 12258 var index = length - 1; 12259 if (fromIndex !== undefined2) { 12260 index = toInteger(fromIndex); 12261 index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 12262 } 12263 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 12264 } 12265 function flatten(array) { 12266 var length = array == null ? 0 : array.length; 12267 return length ? baseFlatten(array, 1) : []; 12268 } 12269 function flattenDeep(array) { 12270 var length = array == null ? 0 : array.length; 12271 return length ? baseFlatten(array, INFINITY) : []; 12272 } 12273 function flattenDepth(array, depth) { 12274 var length = array == null ? 0 : array.length; 12275 if (!length) { 12276 return []; 12277 } 12278 depth = depth === undefined2 ? 1 : toInteger(depth); 12279 return baseFlatten(array, depth); 12280 } 12281 function fromPairs(pairs) { 12282 var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; 12283 while (++index < length) { 12284 var pair = pairs[index]; 12285 baseAssignValue(result2, pair[0], pair[1]); 12286 } 12287 return result2; 12288 } 12289 function head(array) { 12290 return array && array.length ? array[0] : undefined2; 12291 } 12292 function indexOf(array, value, fromIndex) { 12293 var length = array == null ? 0 : array.length; 12294 if (!length) { 12295 return -1; 12296 } 12297 var index = fromIndex == null ? 0 : toInteger(fromIndex); 12298 if (index < 0) { 12299 index = nativeMax(length + index, 0); 12300 } 12301 return baseIndexOf(array, value, index); 12302 } 12303 function initial(array) { 12304 var length = array == null ? 0 : array.length; 12305 return length ? baseSlice(array, 0, -1) : []; 12306 } 12307 var intersection = baseRest(function(arrays) { 12308 var mapped = arrayMap(arrays, castArrayLikeObject); 12309 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; 12310 }); 12311 var intersectionBy = baseRest(function(arrays) { 12312 var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 12313 if (iteratee2 === last(mapped)) { 12314 iteratee2 = undefined2; 12315 } else { 12316 mapped.pop(); 12317 } 12318 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; 12319 }); 12320 var intersectionWith = baseRest(function(arrays) { 12321 var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 12322 comparator = typeof comparator == "function" ? comparator : undefined2; 12323 if (comparator) { 12324 mapped.pop(); 12325 } 12326 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; 12327 }); 12328 function join(array, separator) { 12329 return array == null ? "" : nativeJoin.call(array, separator); 12330 } 12331 function last(array) { 12332 var length = array == null ? 0 : array.length; 12333 return length ? array[length - 1] : undefined2; 12334 } 12335 function lastIndexOf(array, value, fromIndex) { 12336 var length = array == null ? 0 : array.length; 12337 if (!length) { 12338 return -1; 12339 } 12340 var index = length; 12341 if (fromIndex !== undefined2) { 12342 index = toInteger(fromIndex); 12343 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 12344 } 12345 return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); 12346 } 12347 function nth(array, n) { 12348 return array && array.length ? baseNth(array, toInteger(n)) : undefined2; 12349 } 12350 var pull = baseRest(pullAll); 12351 function pullAll(array, values2) { 12352 return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array; 12353 } 12354 function pullAllBy(array, values2, iteratee2) { 12355 return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array; 12356 } 12357 function pullAllWith(array, values2, comparator) { 12358 return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array; 12359 } 12360 var pullAt = flatRest(function(array, indexes) { 12361 var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); 12362 basePullAt(array, arrayMap(indexes, function(index) { 12363 return isIndex(index, length) ? +index : index; 12364 }).sort(compareAscending)); 12365 return result2; 12366 }); 12367 function remove2(array, predicate) { 12368 var result2 = []; 12369 if (!(array && array.length)) { 12370 return result2; 12371 } 12372 var index = -1, indexes = [], length = array.length; 12373 predicate = getIteratee(predicate, 3); 12374 while (++index < length) { 12375 var value = array[index]; 12376 if (predicate(value, index, array)) { 12377 result2.push(value); 12378 indexes.push(index); 12379 } 12380 } 12381 basePullAt(array, indexes); 12382 return result2; 12383 } 12384 function reverse(array) { 12385 return array == null ? array : nativeReverse.call(array); 12386 } 12387 function slice(array, start, end) { 12388 var length = array == null ? 0 : array.length; 12389 if (!length) { 12390 return []; 12391 } 12392 if (end && typeof end != "number" && isIterateeCall(array, start, end)) { 12393 start = 0; 12394 end = length; 12395 } else { 12396 start = start == null ? 0 : toInteger(start); 12397 end = end === undefined2 ? length : toInteger(end); 12398 } 12399 return baseSlice(array, start, end); 12400 } 12401 function sortedIndex(array, value) { 12402 return baseSortedIndex(array, value); 12403 } 12404 function sortedIndexBy(array, value, iteratee2) { 12405 return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); 12406 } 12407 function sortedIndexOf(array, value) { 12408 var length = array == null ? 0 : array.length; 12409 if (length) { 12410 var index = baseSortedIndex(array, value); 12411 if (index < length && eq(array[index], value)) { 12412 return index; 12413 } 12414 } 12415 return -1; 12416 } 12417 function sortedLastIndex(array, value) { 12418 return baseSortedIndex(array, value, true); 12419 } 12420 function sortedLastIndexBy(array, value, iteratee2) { 12421 return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); 12422 } 12423 function sortedLastIndexOf(array, value) { 12424 var length = array == null ? 0 : array.length; 12425 if (length) { 12426 var index = baseSortedIndex(array, value, true) - 1; 12427 if (eq(array[index], value)) { 12428 return index; 12429 } 12430 } 12431 return -1; 12432 } 12433 function sortedUniq(array) { 12434 return array && array.length ? baseSortedUniq(array) : []; 12435 } 12436 function sortedUniqBy(array, iteratee2) { 12437 return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; 12438 } 12439 function tail(array) { 12440 var length = array == null ? 0 : array.length; 12441 return length ? baseSlice(array, 1, length) : []; 12442 } 12443 function take(array, n, guard) { 12444 if (!(array && array.length)) { 12445 return []; 12446 } 12447 n = guard || n === undefined2 ? 1 : toInteger(n); 12448 return baseSlice(array, 0, n < 0 ? 0 : n); 12449 } 12450 function takeRight(array, n, guard) { 12451 var length = array == null ? 0 : array.length; 12452 if (!length) { 12453 return []; 12454 } 12455 n = guard || n === undefined2 ? 1 : toInteger(n); 12456 n = length - n; 12457 return baseSlice(array, n < 0 ? 0 : n, length); 12458 } 12459 function takeRightWhile(array, predicate) { 12460 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; 12461 } 12462 function takeWhile(array, predicate) { 12463 return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; 12464 } 12465 var union = baseRest(function(arrays) { 12466 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 12467 }); 12468 var unionBy = baseRest(function(arrays) { 12469 var iteratee2 = last(arrays); 12470 if (isArrayLikeObject(iteratee2)) { 12471 iteratee2 = undefined2; 12472 } 12473 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); 12474 }); 12475 var unionWith = baseRest(function(arrays) { 12476 var comparator = last(arrays); 12477 comparator = typeof comparator == "function" ? comparator : undefined2; 12478 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator); 12479 }); 12480 function uniq(array) { 12481 return array && array.length ? baseUniq(array) : []; 12482 } 12483 function uniqBy(array, iteratee2) { 12484 return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; 12485 } 12486 function uniqWith(array, comparator) { 12487 comparator = typeof comparator == "function" ? comparator : undefined2; 12488 return array && array.length ? baseUniq(array, undefined2, comparator) : []; 12489 } 12490 function unzip(array) { 12491 if (!(array && array.length)) { 12492 return []; 12493 } 12494 var length = 0; 12495 array = arrayFilter(array, function(group) { 12496 if (isArrayLikeObject(group)) { 12497 length = nativeMax(group.length, length); 12498 return true; 12499 } 12500 }); 12501 return baseTimes(length, function(index) { 12502 return arrayMap(array, baseProperty(index)); 12503 }); 12504 } 12505 function unzipWith(array, iteratee2) { 12506 if (!(array && array.length)) { 12507 return []; 12508 } 12509 var result2 = unzip(array); 12510 if (iteratee2 == null) { 12511 return result2; 12512 } 12513 return arrayMap(result2, function(group) { 12514 return apply(iteratee2, undefined2, group); 12515 }); 12516 } 12517 var without = baseRest(function(array, values2) { 12518 return isArrayLikeObject(array) ? baseDifference(array, values2) : []; 12519 }); 12520 var xor = baseRest(function(arrays) { 12521 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 12522 }); 12523 var xorBy = baseRest(function(arrays) { 12524 var iteratee2 = last(arrays); 12525 if (isArrayLikeObject(iteratee2)) { 12526 iteratee2 = undefined2; 12527 } 12528 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); 12529 }); 12530 var xorWith = baseRest(function(arrays) { 12531 var comparator = last(arrays); 12532 comparator = typeof comparator == "function" ? comparator : undefined2; 12533 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); 12534 }); 12535 var zip = baseRest(unzip); 12536 function zipObject(props, values2) { 12537 return baseZipObject(props || [], values2 || [], assignValue); 12538 } 12539 function zipObjectDeep(props, values2) { 12540 return baseZipObject(props || [], values2 || [], baseSet); 12541 } 12542 var zipWith = baseRest(function(arrays) { 12543 var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2; 12544 iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2; 12545 return unzipWith(arrays, iteratee2); 12546 }); 12547 function chain(value) { 12548 var result2 = lodash(value); 12549 result2.__chain__ = true; 12550 return result2; 12551 } 12552 function tap(value, interceptor) { 12553 interceptor(value); 12554 return value; 12555 } 12556 function thru(value, interceptor) { 12557 return interceptor(value); 12558 } 12559 var wrapperAt = flatRest(function(paths) { 12560 var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { 12561 return baseAt(object, paths); 12562 }; 12563 if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { 12564 return this.thru(interceptor); 12565 } 12566 value = value.slice(start, +start + (length ? 1 : 0)); 12567 value.__actions__.push({ 12568 "func": thru, 12569 "args": [interceptor], 12570 "thisArg": undefined2 12571 }); 12572 return new LodashWrapper(value, this.__chain__).thru(function(array) { 12573 if (length && !array.length) { 12574 array.push(undefined2); 12575 } 12576 return array; 12577 }); 12578 }); 12579 function wrapperChain() { 12580 return chain(this); 12581 } 12582 function wrapperCommit() { 12583 return new LodashWrapper(this.value(), this.__chain__); 12584 } 12585 function wrapperNext() { 12586 if (this.__values__ === undefined2) { 12587 this.__values__ = toArray(this.value()); 12588 } 12589 var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; 12590 return { "done": done, "value": value }; 12591 } 12592 function wrapperToIterator() { 12593 return this; 12594 } 12595 function wrapperPlant(value) { 12596 var result2, parent2 = this; 12597 while (parent2 instanceof baseLodash) { 12598 var clone2 = wrapperClone(parent2); 12599 clone2.__index__ = 0; 12600 clone2.__values__ = undefined2; 12601 if (result2) { 12602 previous.__wrapped__ = clone2; 12603 } else { 12604 result2 = clone2; 12605 } 12606 var previous = clone2; 12607 parent2 = parent2.__wrapped__; 12608 } 12609 previous.__wrapped__ = value; 12610 return result2; 12611 } 12612 function wrapperReverse() { 12613 var value = this.__wrapped__; 12614 if (value instanceof LazyWrapper) { 12615 var wrapped = value; 12616 if (this.__actions__.length) { 12617 wrapped = new LazyWrapper(this); 12618 } 12619 wrapped = wrapped.reverse(); 12620 wrapped.__actions__.push({ 12621 "func": thru, 12622 "args": [reverse], 12623 "thisArg": undefined2 12624 }); 12625 return new LodashWrapper(wrapped, this.__chain__); 12626 } 12627 return this.thru(reverse); 12628 } 12629 function wrapperValue() { 12630 return baseWrapperValue(this.__wrapped__, this.__actions__); 12631 } 12632 var countBy = createAggregator(function(result2, value, key) { 12633 if (hasOwnProperty.call(result2, key)) { 12634 ++result2[key]; 12635 } else { 12636 baseAssignValue(result2, key, 1); 12637 } 12638 }); 12639 function every(collection, predicate, guard) { 12640 var func = isArray(collection) ? arrayEvery : baseEvery; 12641 if (guard && isIterateeCall(collection, predicate, guard)) { 12642 predicate = undefined2; 12643 } 12644 return func(collection, getIteratee(predicate, 3)); 12645 } 12646 function filter(collection, predicate) { 12647 var func = isArray(collection) ? arrayFilter : baseFilter; 12648 return func(collection, getIteratee(predicate, 3)); 12649 } 12650 var find = createFind(findIndex); 12651 var findLast = createFind(findLastIndex); 12652 function flatMap(collection, iteratee2) { 12653 return baseFlatten(map(collection, iteratee2), 1); 12654 } 12655 function flatMapDeep(collection, iteratee2) { 12656 return baseFlatten(map(collection, iteratee2), INFINITY); 12657 } 12658 function flatMapDepth(collection, iteratee2, depth) { 12659 depth = depth === undefined2 ? 1 : toInteger(depth); 12660 return baseFlatten(map(collection, iteratee2), depth); 12661 } 12662 function forEach(collection, iteratee2) { 12663 var func = isArray(collection) ? arrayEach : baseEach; 12664 return func(collection, getIteratee(iteratee2, 3)); 12665 } 12666 function forEachRight(collection, iteratee2) { 12667 var func = isArray(collection) ? arrayEachRight : baseEachRight; 12668 return func(collection, getIteratee(iteratee2, 3)); 12669 } 12670 var groupBy = createAggregator(function(result2, value, key) { 12671 if (hasOwnProperty.call(result2, key)) { 12672 result2[key].push(value); 12673 } else { 12674 baseAssignValue(result2, key, [value]); 12675 } 12676 }); 12677 function includes(collection, value, fromIndex, guard) { 12678 collection = isArrayLike(collection) ? collection : values(collection); 12679 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; 12680 var length = collection.length; 12681 if (fromIndex < 0) { 12682 fromIndex = nativeMax(length + fromIndex, 0); 12683 } 12684 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; 12685 } 12686 var invokeMap = baseRest(function(collection, path, args) { 12687 var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; 12688 baseEach(collection, function(value) { 12689 result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 12690 }); 12691 return result2; 12692 }); 12693 var keyBy = createAggregator(function(result2, value, key) { 12694 baseAssignValue(result2, key, value); 12695 }); 12696 function map(collection, iteratee2) { 12697 var func = isArray(collection) ? arrayMap : baseMap; 12698 return func(collection, getIteratee(iteratee2, 3)); 12699 } 12700 function orderBy(collection, iteratees, orders, guard) { 12701 if (collection == null) { 12702 return []; 12703 } 12704 if (!isArray(iteratees)) { 12705 iteratees = iteratees == null ? [] : [iteratees]; 12706 } 12707 orders = guard ? undefined2 : orders; 12708 if (!isArray(orders)) { 12709 orders = orders == null ? [] : [orders]; 12710 } 12711 return baseOrderBy(collection, iteratees, orders); 12712 } 12713 var partition = createAggregator(function(result2, value, key) { 12714 result2[key ? 0 : 1].push(value); 12715 }, function() { 12716 return [[], []]; 12717 }); 12718 function reduce(collection, iteratee2, accumulator) { 12719 var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; 12720 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); 12721 } 12722 function reduceRight(collection, iteratee2, accumulator) { 12723 var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; 12724 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); 12725 } 12726 function reject(collection, predicate) { 12727 var func = isArray(collection) ? arrayFilter : baseFilter; 12728 return func(collection, negate(getIteratee(predicate, 3))); 12729 } 12730 function sample(collection) { 12731 var func = isArray(collection) ? arraySample : baseSample; 12732 return func(collection); 12733 } 12734 function sampleSize(collection, n, guard) { 12735 if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) { 12736 n = 1; 12737 } else { 12738 n = toInteger(n); 12739 } 12740 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 12741 return func(collection, n); 12742 } 12743 function shuffle(collection) { 12744 var func = isArray(collection) ? arrayShuffle : baseShuffle; 12745 return func(collection); 12746 } 12747 function size(collection) { 12748 if (collection == null) { 12749 return 0; 12750 } 12751 if (isArrayLike(collection)) { 12752 return isString(collection) ? stringSize(collection) : collection.length; 12753 } 12754 var tag = getTag(collection); 12755 if (tag == mapTag || tag == setTag) { 12756 return collection.size; 12757 } 12758 return baseKeys(collection).length; 12759 } 12760 function some(collection, predicate, guard) { 12761 var func = isArray(collection) ? arraySome : baseSome; 12762 if (guard && isIterateeCall(collection, predicate, guard)) { 12763 predicate = undefined2; 12764 } 12765 return func(collection, getIteratee(predicate, 3)); 12766 } 12767 var sortBy = baseRest(function(collection, iteratees) { 12768 if (collection == null) { 12769 return []; 12770 } 12771 var length = iteratees.length; 12772 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 12773 iteratees = []; 12774 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 12775 iteratees = [iteratees[0]]; 12776 } 12777 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 12778 }); 12779 var now = ctxNow || function() { 12780 return root.Date.now(); 12781 }; 12782 function after(n, func) { 12783 if (typeof func != "function") { 12784 throw new TypeError2(FUNC_ERROR_TEXT); 12785 } 12786 n = toInteger(n); 12787 return function() { 12788 if (--n < 1) { 12789 return func.apply(this, arguments); 12790 } 12791 }; 12792 } 12793 function ary(func, n, guard) { 12794 n = guard ? undefined2 : n; 12795 n = func && n == null ? func.length : n; 12796 return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n); 12797 } 12798 function before(n, func) { 12799 var result2; 12800 if (typeof func != "function") { 12801 throw new TypeError2(FUNC_ERROR_TEXT); 12802 } 12803 n = toInteger(n); 12804 return function() { 12805 if (--n > 0) { 12806 result2 = func.apply(this, arguments); 12807 } 12808 if (n <= 1) { 12809 func = undefined2; 12810 } 12811 return result2; 12812 }; 12813 } 12814 var bind = baseRest(function(func, thisArg, partials) { 12815 var bitmask = WRAP_BIND_FLAG; 12816 if (partials.length) { 12817 var holders = replaceHolders(partials, getHolder(bind)); 12818 bitmask |= WRAP_PARTIAL_FLAG; 12819 } 12820 return createWrap(func, bitmask, thisArg, partials, holders); 12821 }); 12822 var bindKey = baseRest(function(object, key, partials) { 12823 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 12824 if (partials.length) { 12825 var holders = replaceHolders(partials, getHolder(bindKey)); 12826 bitmask |= WRAP_PARTIAL_FLAG; 12827 } 12828 return createWrap(key, bitmask, object, partials, holders); 12829 }); 12830 function curry(func, arity, guard) { 12831 arity = guard ? undefined2 : arity; 12832 var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); 12833 result2.placeholder = curry.placeholder; 12834 return result2; 12835 } 12836 function curryRight(func, arity, guard) { 12837 arity = guard ? undefined2 : arity; 12838 var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); 12839 result2.placeholder = curryRight.placeholder; 12840 return result2; 12841 } 12842 function debounce2(func, wait, options) { 12843 var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; 12844 if (typeof func != "function") { 12845 throw new TypeError2(FUNC_ERROR_TEXT); 12846 } 12847 wait = toNumber(wait) || 0; 12848 if (isObject(options)) { 12849 leading = !!options.leading; 12850 maxing = "maxWait" in options; 12851 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 12852 trailing = "trailing" in options ? !!options.trailing : trailing; 12853 } 12854 function invokeFunc(time) { 12855 var args = lastArgs, thisArg = lastThis; 12856 lastArgs = lastThis = undefined2; 12857 lastInvokeTime = time; 12858 result2 = func.apply(thisArg, args); 12859 return result2; 12860 } 12861 function leadingEdge(time) { 12862 lastInvokeTime = time; 12863 timerId = setTimeout2(timerExpired, wait); 12864 return leading ? invokeFunc(time) : result2; 12865 } 12866 function remainingWait(time) { 12867 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; 12868 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; 12869 } 12870 function shouldInvoke(time) { 12871 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; 12872 return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; 12873 } 12874 function timerExpired() { 12875 var time = now(); 12876 if (shouldInvoke(time)) { 12877 return trailingEdge(time); 12878 } 12879 timerId = setTimeout2(timerExpired, remainingWait(time)); 12880 } 12881 function trailingEdge(time) { 12882 timerId = undefined2; 12883 if (trailing && lastArgs) { 12884 return invokeFunc(time); 12885 } 12886 lastArgs = lastThis = undefined2; 12887 return result2; 12888 } 12889 function cancel() { 12890 if (timerId !== undefined2) { 12891 clearTimeout2(timerId); 12892 } 12893 lastInvokeTime = 0; 12894 lastArgs = lastCallTime = lastThis = timerId = undefined2; 12895 } 12896 function flush() { 12897 return timerId === undefined2 ? result2 : trailingEdge(now()); 12898 } 12899 function debounced() { 12900 var time = now(), isInvoking = shouldInvoke(time); 12901 lastArgs = arguments; 12902 lastThis = this; 12903 lastCallTime = time; 12904 if (isInvoking) { 12905 if (timerId === undefined2) { 12906 return leadingEdge(lastCallTime); 12907 } 12908 if (maxing) { 12909 clearTimeout2(timerId); 12910 timerId = setTimeout2(timerExpired, wait); 12911 return invokeFunc(lastCallTime); 12912 } 12913 } 12914 if (timerId === undefined2) { 12915 timerId = setTimeout2(timerExpired, wait); 12916 } 12917 return result2; 12918 } 12919 debounced.cancel = cancel; 12920 debounced.flush = flush; 12921 return debounced; 12922 } 12923 var defer2 = baseRest(function(func, args) { 12924 return baseDelay(func, 1, args); 12925 }); 12926 var delay = baseRest(function(func, wait, args) { 12927 return baseDelay(func, toNumber(wait) || 0, args); 12928 }); 12929 function flip(func) { 12930 return createWrap(func, WRAP_FLIP_FLAG); 12931 } 12932 function memoize(func, resolver) { 12933 if (typeof func != "function" || resolver != null && typeof resolver != "function") { 12934 throw new TypeError2(FUNC_ERROR_TEXT); 12935 } 12936 var memoized = function() { 12937 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; 12938 if (cache.has(key)) { 12939 return cache.get(key); 12940 } 12941 var result2 = func.apply(this, args); 12942 memoized.cache = cache.set(key, result2) || cache; 12943 return result2; 12944 }; 12945 memoized.cache = new (memoize.Cache || MapCache)(); 12946 return memoized; 12947 } 12948 memoize.Cache = MapCache; 12949 function negate(predicate) { 12950 if (typeof predicate != "function") { 12951 throw new TypeError2(FUNC_ERROR_TEXT); 12952 } 12953 return function() { 12954 var args = arguments; 12955 switch (args.length) { 12956 case 0: 12957 return !predicate.call(this); 12958 case 1: 12959 return !predicate.call(this, args[0]); 12960 case 2: 12961 return !predicate.call(this, args[0], args[1]); 12962 case 3: 12963 return !predicate.call(this, args[0], args[1], args[2]); 12964 } 12965 return !predicate.apply(this, args); 12966 }; 12967 } 12968 function once(func) { 12969 return before(2, func); 12970 } 12971 var overArgs = castRest(function(func, transforms) { 12972 transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 12973 var funcsLength = transforms.length; 12974 return baseRest(function(args) { 12975 var index = -1, length = nativeMin(args.length, funcsLength); 12976 while (++index < length) { 12977 args[index] = transforms[index].call(this, args[index]); 12978 } 12979 return apply(func, this, args); 12980 }); 12981 }); 12982 var partial = baseRest(function(func, partials) { 12983 var holders = replaceHolders(partials, getHolder(partial)); 12984 return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders); 12985 }); 12986 var partialRight = baseRest(function(func, partials) { 12987 var holders = replaceHolders(partials, getHolder(partialRight)); 12988 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); 12989 }); 12990 var rearg = flatRest(function(func, indexes) { 12991 return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); 12992 }); 12993 function rest(func, start) { 12994 if (typeof func != "function") { 12995 throw new TypeError2(FUNC_ERROR_TEXT); 12996 } 12997 start = start === undefined2 ? start : toInteger(start); 12998 return baseRest(func, start); 12999 } 13000 function spread(func, start) { 13001 if (typeof func != "function") { 13002 throw new TypeError2(FUNC_ERROR_TEXT); 13003 } 13004 start = start == null ? 0 : nativeMax(toInteger(start), 0); 13005 return baseRest(function(args) { 13006 var array = args[start], otherArgs = castSlice(args, 0, start); 13007 if (array) { 13008 arrayPush(otherArgs, array); 13009 } 13010 return apply(func, this, otherArgs); 13011 }); 13012 } 13013 function throttle(func, wait, options) { 13014 var leading = true, trailing = true; 13015 if (typeof func != "function") { 13016 throw new TypeError2(FUNC_ERROR_TEXT); 13017 } 13018 if (isObject(options)) { 13019 leading = "leading" in options ? !!options.leading : leading; 13020 trailing = "trailing" in options ? !!options.trailing : trailing; 13021 } 13022 return debounce2(func, wait, { 13023 "leading": leading, 13024 "maxWait": wait, 13025 "trailing": trailing 13026 }); 13027 } 13028 function unary(func) { 13029 return ary(func, 1); 13030 } 13031 function wrap(value, wrapper) { 13032 return partial(castFunction(wrapper), value); 13033 } 13034 function castArray() { 13035 if (!arguments.length) { 13036 return []; 13037 } 13038 var value = arguments[0]; 13039 return isArray(value) ? value : [value]; 13040 } 13041 function clone(value) { 13042 return baseClone(value, CLONE_SYMBOLS_FLAG); 13043 } 13044 function cloneWith(value, customizer) { 13045 customizer = typeof customizer == "function" ? customizer : undefined2; 13046 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 13047 } 13048 function cloneDeep(value) { 13049 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 13050 } 13051 function cloneDeepWith(value, customizer) { 13052 customizer = typeof customizer == "function" ? customizer : undefined2; 13053 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 13054 } 13055 function conformsTo(object, source) { 13056 return source == null || baseConformsTo(object, source, keys(source)); 13057 } 13058 function eq(value, other) { 13059 return value === other || value !== value && other !== other; 13060 } 13061 var gt = createRelationalOperation(baseGt); 13062 var gte = createRelationalOperation(function(value, other) { 13063 return value >= other; 13064 }); 13065 var isArguments = baseIsArguments(/* @__PURE__ */ function() { 13066 return arguments; 13067 }()) ? baseIsArguments : function(value) { 13068 return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); 13069 }; 13070 var isArray = Array2.isArray; 13071 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 13072 function isArrayLike(value) { 13073 return value != null && isLength(value.length) && !isFunction(value); 13074 } 13075 function isArrayLikeObject(value) { 13076 return isObjectLike(value) && isArrayLike(value); 13077 } 13078 function isBoolean(value) { 13079 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; 13080 } 13081 var isBuffer = nativeIsBuffer || stubFalse; 13082 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 13083 function isElement(value) { 13084 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 13085 } 13086 function isEmpty(value) { 13087 if (value == null) { 13088 return true; 13089 } 13090 if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { 13091 return !value.length; 13092 } 13093 var tag = getTag(value); 13094 if (tag == mapTag || tag == setTag) { 13095 return !value.size; 13096 } 13097 if (isPrototype(value)) { 13098 return !baseKeys(value).length; 13099 } 13100 for (var key in value) { 13101 if (hasOwnProperty.call(value, key)) { 13102 return false; 13103 } 13104 } 13105 return true; 13106 } 13107 function isEqual(value, other) { 13108 return baseIsEqual(value, other); 13109 } 13110 function isEqualWith(value, other, customizer) { 13111 customizer = typeof customizer == "function" ? customizer : undefined2; 13112 var result2 = customizer ? customizer(value, other) : undefined2; 13113 return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; 13114 } 13115 function isError(value) { 13116 if (!isObjectLike(value)) { 13117 return false; 13118 } 13119 var tag = baseGetTag(value); 13120 return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); 13121 } 13122 function isFinite2(value) { 13123 return typeof value == "number" && nativeIsFinite(value); 13124 } 13125 function isFunction(value) { 13126 if (!isObject(value)) { 13127 return false; 13128 } 13129 var tag = baseGetTag(value); 13130 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 13131 } 13132 function isInteger(value) { 13133 return typeof value == "number" && value == toInteger(value); 13134 } 13135 function isLength(value) { 13136 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 13137 } 13138 function isObject(value) { 13139 var type = typeof value; 13140 return value != null && (type == "object" || type == "function"); 13141 } 13142 function isObjectLike(value) { 13143 return value != null && typeof value == "object"; 13144 } 13145 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 13146 function isMatch(object, source) { 13147 return object === source || baseIsMatch(object, source, getMatchData(source)); 13148 } 13149 function isMatchWith(object, source, customizer) { 13150 customizer = typeof customizer == "function" ? customizer : undefined2; 13151 return baseIsMatch(object, source, getMatchData(source), customizer); 13152 } 13153 function isNaN2(value) { 13154 return isNumber(value) && value != +value; 13155 } 13156 function isNative(value) { 13157 if (isMaskable(value)) { 13158 throw new Error2(CORE_ERROR_TEXT); 13159 } 13160 return baseIsNative(value); 13161 } 13162 function isNull(value) { 13163 return value === null; 13164 } 13165 function isNil(value) { 13166 return value == null; 13167 } 13168 function isNumber(value) { 13169 return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; 13170 } 13171 function isPlainObject(value) { 13172 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 13173 return false; 13174 } 13175 var proto = getPrototype(value); 13176 if (proto === null) { 13177 return true; 13178 } 13179 var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; 13180 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; 13181 } 13182 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 13183 function isSafeInteger(value) { 13184 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 13185 } 13186 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 13187 function isString(value) { 13188 return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; 13189 } 13190 function isSymbol(value) { 13191 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; 13192 } 13193 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 13194 function isUndefined(value) { 13195 return value === undefined2; 13196 } 13197 function isWeakMap(value) { 13198 return isObjectLike(value) && getTag(value) == weakMapTag; 13199 } 13200 function isWeakSet(value) { 13201 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 13202 } 13203 var lt = createRelationalOperation(baseLt); 13204 var lte = createRelationalOperation(function(value, other) { 13205 return value <= other; 13206 }); 13207 function toArray(value) { 13208 if (!value) { 13209 return []; 13210 } 13211 if (isArrayLike(value)) { 13212 return isString(value) ? stringToArray(value) : copyArray(value); 13213 } 13214 if (symIterator && value[symIterator]) { 13215 return iteratorToArray(value[symIterator]()); 13216 } 13217 var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; 13218 return func(value); 13219 } 13220 function toFinite(value) { 13221 if (!value) { 13222 return value === 0 ? value : 0; 13223 } 13224 value = toNumber(value); 13225 if (value === INFINITY || value === -INFINITY) { 13226 var sign = value < 0 ? -1 : 1; 13227 return sign * MAX_INTEGER; 13228 } 13229 return value === value ? value : 0; 13230 } 13231 function toInteger(value) { 13232 var result2 = toFinite(value), remainder = result2 % 1; 13233 return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; 13234 } 13235 function toLength(value) { 13236 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 13237 } 13238 function toNumber(value) { 13239 if (typeof value == "number") { 13240 return value; 13241 } 13242 if (isSymbol(value)) { 13243 return NAN; 13244 } 13245 if (isObject(value)) { 13246 var other = typeof value.valueOf == "function" ? value.valueOf() : value; 13247 value = isObject(other) ? other + "" : other; 13248 } 13249 if (typeof value != "string") { 13250 return value === 0 ? value : +value; 13251 } 13252 value = baseTrim(value); 13253 var isBinary = reIsBinary.test(value); 13254 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; 13255 } 13256 function toPlainObject(value) { 13257 return copyObject(value, keysIn(value)); 13258 } 13259 function toSafeInteger(value) { 13260 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; 13261 } 13262 function toString(value) { 13263 return value == null ? "" : baseToString(value); 13264 } 13265 var assign = createAssigner(function(object, source) { 13266 if (isPrototype(source) || isArrayLike(source)) { 13267 copyObject(source, keys(source), object); 13268 return; 13269 } 13270 for (var key in source) { 13271 if (hasOwnProperty.call(source, key)) { 13272 assignValue(object, key, source[key]); 13273 } 13274 } 13275 }); 13276 var assignIn = createAssigner(function(object, source) { 13277 copyObject(source, keysIn(source), object); 13278 }); 13279 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 13280 copyObject(source, keysIn(source), object, customizer); 13281 }); 13282 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 13283 copyObject(source, keys(source), object, customizer); 13284 }); 13285 var at = flatRest(baseAt); 13286 function create(prototype, properties) { 13287 var result2 = baseCreate(prototype); 13288 return properties == null ? result2 : baseAssign(result2, properties); 13289 } 13290 var defaults = baseRest(function(object, sources) { 13291 object = Object2(object); 13292 var index = -1; 13293 var length = sources.length; 13294 var guard = length > 2 ? sources[2] : undefined2; 13295 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 13296 length = 1; 13297 } 13298 while (++index < length) { 13299 var source = sources[index]; 13300 var props = keysIn(source); 13301 var propsIndex = -1; 13302 var propsLength = props.length; 13303 while (++propsIndex < propsLength) { 13304 var key = props[propsIndex]; 13305 var value = object[key]; 13306 if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) { 13307 object[key] = source[key]; 13308 } 13309 } 13310 } 13311 return object; 13312 }); 13313 var defaultsDeep = baseRest(function(args) { 13314 args.push(undefined2, customDefaultsMerge); 13315 return apply(mergeWith, undefined2, args); 13316 }); 13317 function findKey(object, predicate) { 13318 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 13319 } 13320 function findLastKey(object, predicate) { 13321 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 13322 } 13323 function forIn(object, iteratee2) { 13324 return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); 13325 } 13326 function forInRight(object, iteratee2) { 13327 return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); 13328 } 13329 function forOwn(object, iteratee2) { 13330 return object && baseForOwn(object, getIteratee(iteratee2, 3)); 13331 } 13332 function forOwnRight(object, iteratee2) { 13333 return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); 13334 } 13335 function functions(object) { 13336 return object == null ? [] : baseFunctions(object, keys(object)); 13337 } 13338 function functionsIn(object) { 13339 return object == null ? [] : baseFunctions(object, keysIn(object)); 13340 } 13341 function get2(object, path, defaultValue) { 13342 var result2 = object == null ? undefined2 : baseGet(object, path); 13343 return result2 === undefined2 ? defaultValue : result2; 13344 } 13345 function has(object, path) { 13346 return object != null && hasPath(object, path, baseHas); 13347 } 13348 function hasIn(object, path) { 13349 return object != null && hasPath(object, path, baseHasIn); 13350 } 13351 var invert = createInverter(function(result2, value, key) { 13352 if (value != null && typeof value.toString != "function") { 13353 value = nativeObjectToString.call(value); 13354 } 13355 result2[value] = key; 13356 }, constant(identity)); 13357 var invertBy = createInverter(function(result2, value, key) { 13358 if (value != null && typeof value.toString != "function") { 13359 value = nativeObjectToString.call(value); 13360 } 13361 if (hasOwnProperty.call(result2, value)) { 13362 result2[value].push(key); 13363 } else { 13364 result2[value] = [key]; 13365 } 13366 }, getIteratee); 13367 var invoke = baseRest(baseInvoke); 13368 function keys(object) { 13369 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 13370 } 13371 function keysIn(object) { 13372 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 13373 } 13374 function mapKeys(object, iteratee2) { 13375 var result2 = {}; 13376 iteratee2 = getIteratee(iteratee2, 3); 13377 baseForOwn(object, function(value, key, object2) { 13378 baseAssignValue(result2, iteratee2(value, key, object2), value); 13379 }); 13380 return result2; 13381 } 13382 function mapValues(object, iteratee2) { 13383 var result2 = {}; 13384 iteratee2 = getIteratee(iteratee2, 3); 13385 baseForOwn(object, function(value, key, object2) { 13386 baseAssignValue(result2, key, iteratee2(value, key, object2)); 13387 }); 13388 return result2; 13389 } 13390 var merge = createAssigner(function(object, source, srcIndex) { 13391 baseMerge(object, source, srcIndex); 13392 }); 13393 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 13394 baseMerge(object, source, srcIndex, customizer); 13395 }); 13396 var omit = flatRest(function(object, paths) { 13397 var result2 = {}; 13398 if (object == null) { 13399 return result2; 13400 } 13401 var isDeep = false; 13402 paths = arrayMap(paths, function(path) { 13403 path = castPath(path, object); 13404 isDeep || (isDeep = path.length > 1); 13405 return path; 13406 }); 13407 copyObject(object, getAllKeysIn(object), result2); 13408 if (isDeep) { 13409 result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 13410 } 13411 var length = paths.length; 13412 while (length--) { 13413 baseUnset(result2, paths[length]); 13414 } 13415 return result2; 13416 }); 13417 function omitBy(object, predicate) { 13418 return pickBy(object, negate(getIteratee(predicate))); 13419 } 13420 var pick = flatRest(function(object, paths) { 13421 return object == null ? {} : basePick(object, paths); 13422 }); 13423 function pickBy(object, predicate) { 13424 if (object == null) { 13425 return {}; 13426 } 13427 var props = arrayMap(getAllKeysIn(object), function(prop) { 13428 return [prop]; 13429 }); 13430 predicate = getIteratee(predicate); 13431 return basePickBy(object, props, function(value, path) { 13432 return predicate(value, path[0]); 13433 }); 13434 } 13435 function result(object, path, defaultValue) { 13436 path = castPath(path, object); 13437 var index = -1, length = path.length; 13438 if (!length) { 13439 length = 1; 13440 object = undefined2; 13441 } 13442 while (++index < length) { 13443 var value = object == null ? undefined2 : object[toKey(path[index])]; 13444 if (value === undefined2) { 13445 index = length; 13446 value = defaultValue; 13447 } 13448 object = isFunction(value) ? value.call(object) : value; 13449 } 13450 return object; 13451 } 13452 function set(object, path, value) { 13453 return object == null ? object : baseSet(object, path, value); 13454 } 13455 function setWith(object, path, value, customizer) { 13456 customizer = typeof customizer == "function" ? customizer : undefined2; 13457 return object == null ? object : baseSet(object, path, value, customizer); 13458 } 13459 var toPairs = createToPairs(keys); 13460 var toPairsIn = createToPairs(keysIn); 13461 function transform(object, iteratee2, accumulator) { 13462 var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); 13463 iteratee2 = getIteratee(iteratee2, 4); 13464 if (accumulator == null) { 13465 var Ctor = object && object.constructor; 13466 if (isArrLike) { 13467 accumulator = isArr ? new Ctor() : []; 13468 } else if (isObject(object)) { 13469 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 13470 } else { 13471 accumulator = {}; 13472 } 13473 } 13474 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { 13475 return iteratee2(accumulator, value, index, object2); 13476 }); 13477 return accumulator; 13478 } 13479 function unset(object, path) { 13480 return object == null ? true : baseUnset(object, path); 13481 } 13482 function update(object, path, updater) { 13483 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 13484 } 13485 function updateWith(object, path, updater, customizer) { 13486 customizer = typeof customizer == "function" ? customizer : undefined2; 13487 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 13488 } 13489 function values(object) { 13490 return object == null ? [] : baseValues(object, keys(object)); 13491 } 13492 function valuesIn(object) { 13493 return object == null ? [] : baseValues(object, keysIn(object)); 13494 } 13495 function clamp(number, lower, upper) { 13496 if (upper === undefined2) { 13497 upper = lower; 13498 lower = undefined2; 13499 } 13500 if (upper !== undefined2) { 13501 upper = toNumber(upper); 13502 upper = upper === upper ? upper : 0; 13503 } 13504 if (lower !== undefined2) { 13505 lower = toNumber(lower); 13506 lower = lower === lower ? lower : 0; 13507 } 13508 return baseClamp(toNumber(number), lower, upper); 13509 } 13510 function inRange(number, start, end) { 13511 start = toFinite(start); 13512 if (end === undefined2) { 13513 end = start; 13514 start = 0; 13515 } else { 13516 end = toFinite(end); 13517 } 13518 number = toNumber(number); 13519 return baseInRange(number, start, end); 13520 } 13521 function random(lower, upper, floating) { 13522 if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { 13523 upper = floating = undefined2; 13524 } 13525 if (floating === undefined2) { 13526 if (typeof upper == "boolean") { 13527 floating = upper; 13528 upper = undefined2; 13529 } else if (typeof lower == "boolean") { 13530 floating = lower; 13531 lower = undefined2; 13532 } 13533 } 13534 if (lower === undefined2 && upper === undefined2) { 13535 lower = 0; 13536 upper = 1; 13537 } else { 13538 lower = toFinite(lower); 13539 if (upper === undefined2) { 13540 upper = lower; 13541 lower = 0; 13542 } else { 13543 upper = toFinite(upper); 13544 } 13545 } 13546 if (lower > upper) { 13547 var temp = lower; 13548 lower = upper; 13549 upper = temp; 13550 } 13551 if (floating || lower % 1 || upper % 1) { 13552 var rand = nativeRandom(); 13553 return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); 13554 } 13555 return baseRandom(lower, upper); 13556 } 13557 var camelCase = createCompounder(function(result2, word, index) { 13558 word = word.toLowerCase(); 13559 return result2 + (index ? capitalize2(word) : word); 13560 }); 13561 function capitalize2(string) { 13562 return upperFirst(toString(string).toLowerCase()); 13563 } 13564 function deburr(string) { 13565 string = toString(string); 13566 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); 13567 } 13568 function endsWith(string, target, position) { 13569 string = toString(string); 13570 target = baseToString(target); 13571 var length = string.length; 13572 position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length); 13573 var end = position; 13574 position -= target.length; 13575 return position >= 0 && string.slice(position, end) == target; 13576 } 13577 function escape2(string) { 13578 string = toString(string); 13579 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; 13580 } 13581 function escapeRegExp(string) { 13582 string = toString(string); 13583 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; 13584 } 13585 var kebabCase = createCompounder(function(result2, word, index) { 13586 return result2 + (index ? "-" : "") + word.toLowerCase(); 13587 }); 13588 var lowerCase = createCompounder(function(result2, word, index) { 13589 return result2 + (index ? " " : "") + word.toLowerCase(); 13590 }); 13591 var lowerFirst = createCaseFirst("toLowerCase"); 13592 function pad(string, length, chars) { 13593 string = toString(string); 13594 length = toInteger(length); 13595 var strLength = length ? stringSize(string) : 0; 13596 if (!length || strLength >= length) { 13597 return string; 13598 } 13599 var mid = (length - strLength) / 2; 13600 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); 13601 } 13602 function padEnd(string, length, chars) { 13603 string = toString(string); 13604 length = toInteger(length); 13605 var strLength = length ? stringSize(string) : 0; 13606 return length && strLength < length ? string + createPadding(length - strLength, chars) : string; 13607 } 13608 function padStart(string, length, chars) { 13609 string = toString(string); 13610 length = toInteger(length); 13611 var strLength = length ? stringSize(string) : 0; 13612 return length && strLength < length ? createPadding(length - strLength, chars) + string : string; 13613 } 13614 function parseInt2(string, radix, guard) { 13615 if (guard || radix == null) { 13616 radix = 0; 13617 } else if (radix) { 13618 radix = +radix; 13619 } 13620 return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0); 13621 } 13622 function repeat(string, n, guard) { 13623 if (guard ? isIterateeCall(string, n, guard) : n === undefined2) { 13624 n = 1; 13625 } else { 13626 n = toInteger(n); 13627 } 13628 return baseRepeat(toString(string), n); 13629 } 13630 function replace() { 13631 var args = arguments, string = toString(args[0]); 13632 return args.length < 3 ? string : string.replace(args[1], args[2]); 13633 } 13634 var snakeCase = createCompounder(function(result2, word, index) { 13635 return result2 + (index ? "_" : "") + word.toLowerCase(); 13636 }); 13637 function split(string, separator, limit) { 13638 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) { 13639 separator = limit = undefined2; 13640 } 13641 limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; 13642 if (!limit) { 13643 return []; 13644 } 13645 string = toString(string); 13646 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { 13647 separator = baseToString(separator); 13648 if (!separator && hasUnicode(string)) { 13649 return castSlice(stringToArray(string), 0, limit); 13650 } 13651 } 13652 return string.split(separator, limit); 13653 } 13654 var startCase = createCompounder(function(result2, word, index) { 13655 return result2 + (index ? " " : "") + upperFirst(word); 13656 }); 13657 function startsWith(string, target, position) { 13658 string = toString(string); 13659 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); 13660 target = baseToString(target); 13661 return string.slice(position, position + target.length) == target; 13662 } 13663 function template(string, options, guard) { 13664 var settings = lodash.templateSettings; 13665 if (guard && isIterateeCall(string, options, guard)) { 13666 options = undefined2; 13667 } 13668 string = toString(string); 13669 options = assignWith({}, options, settings, customDefaultsAssignIn); 13670 var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); 13671 arrayEach(importsKeys, function(key) { 13672 if (reForbiddenIdentifierChars.test(key)) { 13673 throw new Error2(INVALID_TEMPL_IMPORTS_ERROR_TEXT); 13674 } 13675 }); 13676 var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; 13677 var reDelimiters = RegExp2( 13678 (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", 13679 "g" 13680 ); 13681 var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; 13682 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 13683 interpolateValue || (interpolateValue = esTemplateValue); 13684 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 13685 if (escapeValue) { 13686 isEscaping = true; 13687 source += "' +\n__e(" + escapeValue + ") +\n'"; 13688 } 13689 if (evaluateValue) { 13690 isEvaluating = true; 13691 source += "';\n" + evaluateValue + ";\n__p += '"; 13692 } 13693 if (interpolateValue) { 13694 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 13695 } 13696 index = offset + match.length; 13697 return match; 13698 }); 13699 source += "';\n"; 13700 var variable = hasOwnProperty.call(options, "variable") && options.variable; 13701 if (!variable) { 13702 source = "with (obj) {\n" + source + "\n}\n"; 13703 } else if (reForbiddenIdentifierChars.test(variable)) { 13704 throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); 13705 } 13706 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); 13707 source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; 13708 var result2 = attempt(function() { 13709 return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues); 13710 }); 13711 result2.source = source; 13712 if (isError(result2)) { 13713 throw result2; 13714 } 13715 return result2; 13716 } 13717 function toLower(value) { 13718 return toString(value).toLowerCase(); 13719 } 13720 function toUpper(value) { 13721 return toString(value).toUpperCase(); 13722 } 13723 function trim(string, chars, guard) { 13724 string = toString(string); 13725 if (string && (guard || chars === undefined2)) { 13726 return baseTrim(string); 13727 } 13728 if (!string || !(chars = baseToString(chars))) { 13729 return string; 13730 } 13731 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; 13732 return castSlice(strSymbols, start, end).join(""); 13733 } 13734 function trimEnd(string, chars, guard) { 13735 string = toString(string); 13736 if (string && (guard || chars === undefined2)) { 13737 return string.slice(0, trimmedEndIndex(string) + 1); 13738 } 13739 if (!string || !(chars = baseToString(chars))) { 13740 return string; 13741 } 13742 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 13743 return castSlice(strSymbols, 0, end).join(""); 13744 } 13745 function trimStart(string, chars, guard) { 13746 string = toString(string); 13747 if (string && (guard || chars === undefined2)) { 13748 return string.replace(reTrimStart, ""); 13749 } 13750 if (!string || !(chars = baseToString(chars))) { 13751 return string; 13752 } 13753 var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); 13754 return castSlice(strSymbols, start).join(""); 13755 } 13756 function truncate(string, options) { 13757 var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; 13758 if (isObject(options)) { 13759 var separator = "separator" in options ? options.separator : separator; 13760 length = "length" in options ? toInteger(options.length) : length; 13761 omission = "omission" in options ? baseToString(options.omission) : omission; 13762 } 13763 string = toString(string); 13764 var strLength = string.length; 13765 if (hasUnicode(string)) { 13766 var strSymbols = stringToArray(string); 13767 strLength = strSymbols.length; 13768 } 13769 if (length >= strLength) { 13770 return string; 13771 } 13772 var end = length - stringSize(omission); 13773 if (end < 1) { 13774 return omission; 13775 } 13776 var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); 13777 if (separator === undefined2) { 13778 return result2 + omission; 13779 } 13780 if (strSymbols) { 13781 end += result2.length - end; 13782 } 13783 if (isRegExp(separator)) { 13784 if (string.slice(end).search(separator)) { 13785 var match, substring = result2; 13786 if (!separator.global) { 13787 separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g"); 13788 } 13789 separator.lastIndex = 0; 13790 while (match = separator.exec(substring)) { 13791 var newEnd = match.index; 13792 } 13793 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); 13794 } 13795 } else if (string.indexOf(baseToString(separator), end) != end) { 13796 var index = result2.lastIndexOf(separator); 13797 if (index > -1) { 13798 result2 = result2.slice(0, index); 13799 } 13800 } 13801 return result2 + omission; 13802 } 13803 function unescape(string) { 13804 string = toString(string); 13805 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; 13806 } 13807 var upperCase = createCompounder(function(result2, word, index) { 13808 return result2 + (index ? " " : "") + word.toUpperCase(); 13809 }); 13810 var upperFirst = createCaseFirst("toUpperCase"); 13811 function words(string, pattern, guard) { 13812 string = toString(string); 13813 pattern = guard ? undefined2 : pattern; 13814 if (pattern === undefined2) { 13815 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 13816 } 13817 return string.match(pattern) || []; 13818 } 13819 var attempt = baseRest(function(func, args) { 13820 try { 13821 return apply(func, undefined2, args); 13822 } catch (e) { 13823 return isError(e) ? e : new Error2(e); 13824 } 13825 }); 13826 var bindAll = flatRest(function(object, methodNames) { 13827 arrayEach(methodNames, function(key) { 13828 key = toKey(key); 13829 baseAssignValue(object, key, bind(object[key], object)); 13830 }); 13831 return object; 13832 }); 13833 function cond(pairs) { 13834 var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); 13835 pairs = !length ? [] : arrayMap(pairs, function(pair) { 13836 if (typeof pair[1] != "function") { 13837 throw new TypeError2(FUNC_ERROR_TEXT); 13838 } 13839 return [toIteratee(pair[0]), pair[1]]; 13840 }); 13841 return baseRest(function(args) { 13842 var index = -1; 13843 while (++index < length) { 13844 var pair = pairs[index]; 13845 if (apply(pair[0], this, args)) { 13846 return apply(pair[1], this, args); 13847 } 13848 } 13849 }); 13850 } 13851 function conforms(source) { 13852 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 13853 } 13854 function constant(value) { 13855 return function() { 13856 return value; 13857 }; 13858 } 13859 function defaultTo(value, defaultValue) { 13860 return value == null || value !== value ? defaultValue : value; 13861 } 13862 var flow = createFlow(); 13863 var flowRight = createFlow(true); 13864 function identity(value) { 13865 return value; 13866 } 13867 function iteratee(func) { 13868 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); 13869 } 13870 function matches(source) { 13871 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 13872 } 13873 function matchesProperty(path, srcValue) { 13874 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 13875 } 13876 var method = baseRest(function(path, args) { 13877 return function(object) { 13878 return baseInvoke(object, path, args); 13879 }; 13880 }); 13881 var methodOf = baseRest(function(object, args) { 13882 return function(path) { 13883 return baseInvoke(object, path, args); 13884 }; 13885 }); 13886 function mixin(object, source, options) { 13887 var props = keys(source), methodNames = baseFunctions(source, props); 13888 if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { 13889 options = source; 13890 source = object; 13891 object = this; 13892 methodNames = baseFunctions(source, keys(source)); 13893 } 13894 var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object); 13895 arrayEach(methodNames, function(methodName) { 13896 var func = source[methodName]; 13897 object[methodName] = func; 13898 if (isFunc) { 13899 object.prototype[methodName] = function() { 13900 var chainAll = this.__chain__; 13901 if (chain2 || chainAll) { 13902 var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); 13903 actions.push({ "func": func, "args": arguments, "thisArg": object }); 13904 result2.__chain__ = chainAll; 13905 return result2; 13906 } 13907 return func.apply(object, arrayPush([this.value()], arguments)); 13908 }; 13909 } 13910 }); 13911 return object; 13912 } 13913 function noConflict() { 13914 if (root._ === this) { 13915 root._ = oldDash; 13916 } 13917 return this; 13918 } 13919 function noop2() { 13920 } 13921 function nthArg(n) { 13922 n = toInteger(n); 13923 return baseRest(function(args) { 13924 return baseNth(args, n); 13925 }); 13926 } 13927 var over = createOver(arrayMap); 13928 var overEvery = createOver(arrayEvery); 13929 var overSome = createOver(arraySome); 13930 function property(path) { 13931 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 13932 } 13933 function propertyOf(object) { 13934 return function(path) { 13935 return object == null ? undefined2 : baseGet(object, path); 13936 }; 13937 } 13938 var range = createRange(); 13939 var rangeRight = createRange(true); 13940 function stubArray() { 13941 return []; 13942 } 13943 function stubFalse() { 13944 return false; 13945 } 13946 function stubObject() { 13947 return {}; 13948 } 13949 function stubString() { 13950 return ""; 13951 } 13952 function stubTrue() { 13953 return true; 13954 } 13955 function times(n, iteratee2) { 13956 n = toInteger(n); 13957 if (n < 1 || n > MAX_SAFE_INTEGER) { 13958 return []; 13959 } 13960 var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); 13961 iteratee2 = getIteratee(iteratee2); 13962 n -= MAX_ARRAY_LENGTH; 13963 var result2 = baseTimes(length, iteratee2); 13964 while (++index < n) { 13965 iteratee2(index); 13966 } 13967 return result2; 13968 } 13969 function toPath(value) { 13970 if (isArray(value)) { 13971 return arrayMap(value, toKey); 13972 } 13973 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 13974 } 13975 function uniqueId(prefix) { 13976 var id = ++idCounter; 13977 return toString(prefix) + id; 13978 } 13979 var add = createMathOperation(function(augend, addend) { 13980 return augend + addend; 13981 }, 0); 13982 var ceil = createRound("ceil"); 13983 var divide = createMathOperation(function(dividend, divisor) { 13984 return dividend / divisor; 13985 }, 1); 13986 var floor = createRound("floor"); 13987 function max(array) { 13988 return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2; 13989 } 13990 function maxBy(array, iteratee2) { 13991 return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2; 13992 } 13993 function mean(array) { 13994 return baseMean(array, identity); 13995 } 13996 function meanBy(array, iteratee2) { 13997 return baseMean(array, getIteratee(iteratee2, 2)); 13998 } 13999 function min(array) { 14000 return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2; 14001 } 14002 function minBy(array, iteratee2) { 14003 return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2; 14004 } 14005 var multiply = createMathOperation(function(multiplier, multiplicand) { 14006 return multiplier * multiplicand; 14007 }, 1); 14008 var round = createRound("round"); 14009 var subtract = createMathOperation(function(minuend, subtrahend) { 14010 return minuend - subtrahend; 14011 }, 0); 14012 function sum(array) { 14013 return array && array.length ? baseSum(array, identity) : 0; 14014 } 14015 function sumBy(array, iteratee2) { 14016 return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; 14017 } 14018 lodash.after = after; 14019 lodash.ary = ary; 14020 lodash.assign = assign; 14021 lodash.assignIn = assignIn; 14022 lodash.assignInWith = assignInWith; 14023 lodash.assignWith = assignWith; 14024 lodash.at = at; 14025 lodash.before = before; 14026 lodash.bind = bind; 14027 lodash.bindAll = bindAll; 14028 lodash.bindKey = bindKey; 14029 lodash.castArray = castArray; 14030 lodash.chain = chain; 14031 lodash.chunk = chunk; 14032 lodash.compact = compact; 14033 lodash.concat = concat; 14034 lodash.cond = cond; 14035 lodash.conforms = conforms; 14036 lodash.constant = constant; 14037 lodash.countBy = countBy; 14038 lodash.create = create; 14039 lodash.curry = curry; 14040 lodash.curryRight = curryRight; 14041 lodash.debounce = debounce2; 14042 lodash.defaults = defaults; 14043 lodash.defaultsDeep = defaultsDeep; 14044 lodash.defer = defer2; 14045 lodash.delay = delay; 14046 lodash.difference = difference; 14047 lodash.differenceBy = differenceBy; 14048 lodash.differenceWith = differenceWith; 14049 lodash.drop = drop; 14050 lodash.dropRight = dropRight; 14051 lodash.dropRightWhile = dropRightWhile; 14052 lodash.dropWhile = dropWhile; 14053 lodash.fill = fill; 14054 lodash.filter = filter; 14055 lodash.flatMap = flatMap; 14056 lodash.flatMapDeep = flatMapDeep; 14057 lodash.flatMapDepth = flatMapDepth; 14058 lodash.flatten = flatten; 14059 lodash.flattenDeep = flattenDeep; 14060 lodash.flattenDepth = flattenDepth; 14061 lodash.flip = flip; 14062 lodash.flow = flow; 14063 lodash.flowRight = flowRight; 14064 lodash.fromPairs = fromPairs; 14065 lodash.functions = functions; 14066 lodash.functionsIn = functionsIn; 14067 lodash.groupBy = groupBy; 14068 lodash.initial = initial; 14069 lodash.intersection = intersection; 14070 lodash.intersectionBy = intersectionBy; 14071 lodash.intersectionWith = intersectionWith; 14072 lodash.invert = invert; 14073 lodash.invertBy = invertBy; 14074 lodash.invokeMap = invokeMap; 14075 lodash.iteratee = iteratee; 14076 lodash.keyBy = keyBy; 14077 lodash.keys = keys; 14078 lodash.keysIn = keysIn; 14079 lodash.map = map; 14080 lodash.mapKeys = mapKeys; 14081 lodash.mapValues = mapValues; 14082 lodash.matches = matches; 14083 lodash.matchesProperty = matchesProperty; 14084 lodash.memoize = memoize; 14085 lodash.merge = merge; 14086 lodash.mergeWith = mergeWith; 14087 lodash.method = method; 14088 lodash.methodOf = methodOf; 14089 lodash.mixin = mixin; 14090 lodash.negate = negate; 14091 lodash.nthArg = nthArg; 14092 lodash.omit = omit; 14093 lodash.omitBy = omitBy; 14094 lodash.once = once; 14095 lodash.orderBy = orderBy; 14096 lodash.over = over; 14097 lodash.overArgs = overArgs; 14098 lodash.overEvery = overEvery; 14099 lodash.overSome = overSome; 14100 lodash.partial = partial; 14101 lodash.partialRight = partialRight; 14102 lodash.partition = partition; 14103 lodash.pick = pick; 14104 lodash.pickBy = pickBy; 14105 lodash.property = property; 14106 lodash.propertyOf = propertyOf; 14107 lodash.pull = pull; 14108 lodash.pullAll = pullAll; 14109 lodash.pullAllBy = pullAllBy; 14110 lodash.pullAllWith = pullAllWith; 14111 lodash.pullAt = pullAt; 14112 lodash.range = range; 14113 lodash.rangeRight = rangeRight; 14114 lodash.rearg = rearg; 14115 lodash.reject = reject; 14116 lodash.remove = remove2; 14117 lodash.rest = rest; 14118 lodash.reverse = reverse; 14119 lodash.sampleSize = sampleSize; 14120 lodash.set = set; 14121 lodash.setWith = setWith; 14122 lodash.shuffle = shuffle; 14123 lodash.slice = slice; 14124 lodash.sortBy = sortBy; 14125 lodash.sortedUniq = sortedUniq; 14126 lodash.sortedUniqBy = sortedUniqBy; 14127 lodash.split = split; 14128 lodash.spread = spread; 14129 lodash.tail = tail; 14130 lodash.take = take; 14131 lodash.takeRight = takeRight; 14132 lodash.takeRightWhile = takeRightWhile; 14133 lodash.takeWhile = takeWhile; 14134 lodash.tap = tap; 14135 lodash.throttle = throttle; 14136 lodash.thru = thru; 14137 lodash.toArray = toArray; 14138 lodash.toPairs = toPairs; 14139 lodash.toPairsIn = toPairsIn; 14140 lodash.toPath = toPath; 14141 lodash.toPlainObject = toPlainObject; 14142 lodash.transform = transform; 14143 lodash.unary = unary; 14144 lodash.union = union; 14145 lodash.unionBy = unionBy; 14146 lodash.unionWith = unionWith; 14147 lodash.uniq = uniq; 14148 lodash.uniqBy = uniqBy; 14149 lodash.uniqWith = uniqWith; 14150 lodash.unset = unset; 14151 lodash.unzip = unzip; 14152 lodash.unzipWith = unzipWith; 14153 lodash.update = update; 14154 lodash.updateWith = updateWith; 14155 lodash.values = values; 14156 lodash.valuesIn = valuesIn; 14157 lodash.without = without; 14158 lodash.words = words; 14159 lodash.wrap = wrap; 14160 lodash.xor = xor; 14161 lodash.xorBy = xorBy; 14162 lodash.xorWith = xorWith; 14163 lodash.zip = zip; 14164 lodash.zipObject = zipObject; 14165 lodash.zipObjectDeep = zipObjectDeep; 14166 lodash.zipWith = zipWith; 14167 lodash.entries = toPairs; 14168 lodash.entriesIn = toPairsIn; 14169 lodash.extend = assignIn; 14170 lodash.extendWith = assignInWith; 14171 mixin(lodash, lodash); 14172 lodash.add = add; 14173 lodash.attempt = attempt; 14174 lodash.camelCase = camelCase; 14175 lodash.capitalize = capitalize2; 14176 lodash.ceil = ceil; 14177 lodash.clamp = clamp; 14178 lodash.clone = clone; 14179 lodash.cloneDeep = cloneDeep; 14180 lodash.cloneDeepWith = cloneDeepWith; 14181 lodash.cloneWith = cloneWith; 14182 lodash.conformsTo = conformsTo; 14183 lodash.deburr = deburr; 14184 lodash.defaultTo = defaultTo; 14185 lodash.divide = divide; 14186 lodash.endsWith = endsWith; 14187 lodash.eq = eq; 14188 lodash.escape = escape2; 14189 lodash.escapeRegExp = escapeRegExp; 14190 lodash.every = every; 14191 lodash.find = find; 14192 lodash.findIndex = findIndex; 14193 lodash.findKey = findKey; 14194 lodash.findLast = findLast; 14195 lodash.findLastIndex = findLastIndex; 14196 lodash.findLastKey = findLastKey; 14197 lodash.floor = floor; 14198 lodash.forEach = forEach; 14199 lodash.forEachRight = forEachRight; 14200 lodash.forIn = forIn; 14201 lodash.forInRight = forInRight; 14202 lodash.forOwn = forOwn; 14203 lodash.forOwnRight = forOwnRight; 14204 lodash.get = get2; 14205 lodash.gt = gt; 14206 lodash.gte = gte; 14207 lodash.has = has; 14208 lodash.hasIn = hasIn; 14209 lodash.head = head; 14210 lodash.identity = identity; 14211 lodash.includes = includes; 14212 lodash.indexOf = indexOf; 14213 lodash.inRange = inRange; 14214 lodash.invoke = invoke; 14215 lodash.isArguments = isArguments; 14216 lodash.isArray = isArray; 14217 lodash.isArrayBuffer = isArrayBuffer; 14218 lodash.isArrayLike = isArrayLike; 14219 lodash.isArrayLikeObject = isArrayLikeObject; 14220 lodash.isBoolean = isBoolean; 14221 lodash.isBuffer = isBuffer; 14222 lodash.isDate = isDate; 14223 lodash.isElement = isElement; 14224 lodash.isEmpty = isEmpty; 14225 lodash.isEqual = isEqual; 14226 lodash.isEqualWith = isEqualWith; 14227 lodash.isError = isError; 14228 lodash.isFinite = isFinite2; 14229 lodash.isFunction = isFunction; 14230 lodash.isInteger = isInteger; 14231 lodash.isLength = isLength; 14232 lodash.isMap = isMap; 14233 lodash.isMatch = isMatch; 14234 lodash.isMatchWith = isMatchWith; 14235 lodash.isNaN = isNaN2; 14236 lodash.isNative = isNative; 14237 lodash.isNil = isNil; 14238 lodash.isNull = isNull; 14239 lodash.isNumber = isNumber; 14240 lodash.isObject = isObject; 14241 lodash.isObjectLike = isObjectLike; 14242 lodash.isPlainObject = isPlainObject; 14243 lodash.isRegExp = isRegExp; 14244 lodash.isSafeInteger = isSafeInteger; 14245 lodash.isSet = isSet; 14246 lodash.isString = isString; 14247 lodash.isSymbol = isSymbol; 14248 lodash.isTypedArray = isTypedArray; 14249 lodash.isUndefined = isUndefined; 14250 lodash.isWeakMap = isWeakMap; 14251 lodash.isWeakSet = isWeakSet; 14252 lodash.join = join; 14253 lodash.kebabCase = kebabCase; 14254 lodash.last = last; 14255 lodash.lastIndexOf = lastIndexOf; 14256 lodash.lowerCase = lowerCase; 14257 lodash.lowerFirst = lowerFirst; 14258 lodash.lt = lt; 14259 lodash.lte = lte; 14260 lodash.max = max; 14261 lodash.maxBy = maxBy; 14262 lodash.mean = mean; 14263 lodash.meanBy = meanBy; 14264 lodash.min = min; 14265 lodash.minBy = minBy; 14266 lodash.stubArray = stubArray; 14267 lodash.stubFalse = stubFalse; 14268 lodash.stubObject = stubObject; 14269 lodash.stubString = stubString; 14270 lodash.stubTrue = stubTrue; 14271 lodash.multiply = multiply; 14272 lodash.nth = nth; 14273 lodash.noConflict = noConflict; 14274 lodash.noop = noop2; 14275 lodash.now = now; 14276 lodash.pad = pad; 14277 lodash.padEnd = padEnd; 14278 lodash.padStart = padStart; 14279 lodash.parseInt = parseInt2; 14280 lodash.random = random; 14281 lodash.reduce = reduce; 14282 lodash.reduceRight = reduceRight; 14283 lodash.repeat = repeat; 14284 lodash.replace = replace; 14285 lodash.result = result; 14286 lodash.round = round; 14287 lodash.runInContext = runInContext2; 14288 lodash.sample = sample; 14289 lodash.size = size; 14290 lodash.snakeCase = snakeCase; 14291 lodash.some = some; 14292 lodash.sortedIndex = sortedIndex; 14293 lodash.sortedIndexBy = sortedIndexBy; 14294 lodash.sortedIndexOf = sortedIndexOf; 14295 lodash.sortedLastIndex = sortedLastIndex; 14296 lodash.sortedLastIndexBy = sortedLastIndexBy; 14297 lodash.sortedLastIndexOf = sortedLastIndexOf; 14298 lodash.startCase = startCase; 14299 lodash.startsWith = startsWith; 14300 lodash.subtract = subtract; 14301 lodash.sum = sum; 14302 lodash.sumBy = sumBy; 14303 lodash.template = template; 14304 lodash.times = times; 14305 lodash.toFinite = toFinite; 14306 lodash.toInteger = toInteger; 14307 lodash.toLength = toLength; 14308 lodash.toLower = toLower; 14309 lodash.toNumber = toNumber; 14310 lodash.toSafeInteger = toSafeInteger; 14311 lodash.toString = toString; 14312 lodash.toUpper = toUpper; 14313 lodash.trim = trim; 14314 lodash.trimEnd = trimEnd; 14315 lodash.trimStart = trimStart; 14316 lodash.truncate = truncate; 14317 lodash.unescape = unescape; 14318 lodash.uniqueId = uniqueId; 14319 lodash.upperCase = upperCase; 14320 lodash.upperFirst = upperFirst; 14321 lodash.each = forEach; 14322 lodash.eachRight = forEachRight; 14323 lodash.first = head; 14324 mixin(lodash, function() { 14325 var source = {}; 14326 baseForOwn(lodash, function(func, methodName) { 14327 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 14328 source[methodName] = func; 14329 } 14330 }); 14331 return source; 14332 }(), { "chain": false }); 14333 lodash.VERSION = VERSION; 14334 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { 14335 lodash[methodName].placeholder = lodash; 14336 }); 14337 arrayEach(["drop", "take"], function(methodName, index) { 14338 LazyWrapper.prototype[methodName] = function(n) { 14339 n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0); 14340 var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); 14341 if (result2.__filtered__) { 14342 result2.__takeCount__ = nativeMin(n, result2.__takeCount__); 14343 } else { 14344 result2.__views__.push({ 14345 "size": nativeMin(n, MAX_ARRAY_LENGTH), 14346 "type": methodName + (result2.__dir__ < 0 ? "Right" : "") 14347 }); 14348 } 14349 return result2; 14350 }; 14351 LazyWrapper.prototype[methodName + "Right"] = function(n) { 14352 return this.reverse()[methodName](n).reverse(); 14353 }; 14354 }); 14355 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { 14356 var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 14357 LazyWrapper.prototype[methodName] = function(iteratee2) { 14358 var result2 = this.clone(); 14359 result2.__iteratees__.push({ 14360 "iteratee": getIteratee(iteratee2, 3), 14361 "type": type 14362 }); 14363 result2.__filtered__ = result2.__filtered__ || isFilter; 14364 return result2; 14365 }; 14366 }); 14367 arrayEach(["head", "last"], function(methodName, index) { 14368 var takeName = "take" + (index ? "Right" : ""); 14369 LazyWrapper.prototype[methodName] = function() { 14370 return this[takeName](1).value()[0]; 14371 }; 14372 }); 14373 arrayEach(["initial", "tail"], function(methodName, index) { 14374 var dropName = "drop" + (index ? "" : "Right"); 14375 LazyWrapper.prototype[methodName] = function() { 14376 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 14377 }; 14378 }); 14379 LazyWrapper.prototype.compact = function() { 14380 return this.filter(identity); 14381 }; 14382 LazyWrapper.prototype.find = function(predicate) { 14383 return this.filter(predicate).head(); 14384 }; 14385 LazyWrapper.prototype.findLast = function(predicate) { 14386 return this.reverse().find(predicate); 14387 }; 14388 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 14389 if (typeof path == "function") { 14390 return new LazyWrapper(this); 14391 } 14392 return this.map(function(value) { 14393 return baseInvoke(value, path, args); 14394 }); 14395 }); 14396 LazyWrapper.prototype.reject = function(predicate) { 14397 return this.filter(negate(getIteratee(predicate))); 14398 }; 14399 LazyWrapper.prototype.slice = function(start, end) { 14400 start = toInteger(start); 14401 var result2 = this; 14402 if (result2.__filtered__ && (start > 0 || end < 0)) { 14403 return new LazyWrapper(result2); 14404 } 14405 if (start < 0) { 14406 result2 = result2.takeRight(-start); 14407 } else if (start) { 14408 result2 = result2.drop(start); 14409 } 14410 if (end !== undefined2) { 14411 end = toInteger(end); 14412 result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); 14413 } 14414 return result2; 14415 }; 14416 LazyWrapper.prototype.takeRightWhile = function(predicate) { 14417 return this.reverse().takeWhile(predicate).reverse(); 14418 }; 14419 LazyWrapper.prototype.toArray = function() { 14420 return this.take(MAX_ARRAY_LENGTH); 14421 }; 14422 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 14423 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); 14424 if (!lodashFunc) { 14425 return; 14426 } 14427 lodash.prototype[methodName] = function() { 14428 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value); 14429 var interceptor = function(value2) { 14430 var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); 14431 return isTaker && chainAll ? result3[0] : result3; 14432 }; 14433 if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { 14434 isLazy = useLazy = false; 14435 } 14436 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; 14437 if (!retUnwrapped && useLazy) { 14438 value = onlyLazy ? value : new LazyWrapper(this); 14439 var result2 = func.apply(value, args); 14440 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); 14441 return new LodashWrapper(result2, chainAll); 14442 } 14443 if (isUnwrapped && onlyLazy) { 14444 return func.apply(this, args); 14445 } 14446 result2 = this.thru(interceptor); 14447 return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; 14448 }; 14449 }); 14450 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { 14451 var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); 14452 lodash.prototype[methodName] = function() { 14453 var args = arguments; 14454 if (retUnwrapped && !this.__chain__) { 14455 var value = this.value(); 14456 return func.apply(isArray(value) ? value : [], args); 14457 } 14458 return this[chainName](function(value2) { 14459 return func.apply(isArray(value2) ? value2 : [], args); 14460 }); 14461 }; 14462 }); 14463 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 14464 var lodashFunc = lodash[methodName]; 14465 if (lodashFunc) { 14466 var key = lodashFunc.name + ""; 14467 if (!hasOwnProperty.call(realNames, key)) { 14468 realNames[key] = []; 14469 } 14470 realNames[key].push({ "name": methodName, "func": lodashFunc }); 14471 } 14472 }); 14473 realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ 14474 "name": "wrapper", 14475 "func": undefined2 14476 }]; 14477 LazyWrapper.prototype.clone = lazyClone; 14478 LazyWrapper.prototype.reverse = lazyReverse; 14479 LazyWrapper.prototype.value = lazyValue; 14480 lodash.prototype.at = wrapperAt; 14481 lodash.prototype.chain = wrapperChain; 14482 lodash.prototype.commit = wrapperCommit; 14483 lodash.prototype.next = wrapperNext; 14484 lodash.prototype.plant = wrapperPlant; 14485 lodash.prototype.reverse = wrapperReverse; 14486 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 14487 lodash.prototype.first = lodash.prototype.head; 14488 if (symIterator) { 14489 lodash.prototype[symIterator] = wrapperToIterator; 14490 } 14491 return lodash; 14492 }; 14493 var _23 = runInContext(); 14494 if (typeof define == "function" && typeof define.amd == "object" && define.amd) { 14495 root._ = _23; 14496 define(function() { 14497 return _23; 14498 }); 14499 } else if (freeModule) { 14500 (freeModule.exports = _23)._ = _23; 14501 freeExports._ = _23; 14502 } else { 14503 root._ = _23; 14504 } 14505 }).call(exports); 14506 } 14507 }); 14508 14509
14509// app/javascript/entrypoints/account/omni.js 14510 init_define_process(); 14511 init_jquery(); 14512 var import_stimulus3 = __toESM(require_stimulus_umd()); 14513 14514
14514// app/javascript/omni/controllers/omni_input_controller.js 14515 init_define_process(); 14516 init_jquery(); 14517 14518
14518// app/javascript/controllers/application_controller.js 14519 init_define_process(); 14520 init_jquery(); 14521 var import_stimulus = __toESM(require_stimulus_umd()); 14522 var application_controller_default = class extends import_stimulus.Controller { 14523 constructor() { 14524 super(...arguments); 14525 __publicField(this, "handleError", (error2, message, detail) => { 14526 const context = { 14527 controller: this.identifier, 14528 ...detail 14529 }; 14530 this.application.handleError(error2, message, context); 14531 }); 14532 } 14533 }; 14534 14535
14535// app/javascript/omni/controllers/omni_input_controller.js 14536 var _currentFocusedElement, _omniWrapper, _boundHandlers, _aiChatElement, _instances, getAiChatElement_fn, addDelegatedListener_fn, handleFocus_fn, handleBlur_fn, showOmniButton_fn, createOmniButton_fn, hideOmniButton_fn, handleOmniClick_fn, gatherContext_fn, findLabelForElement_fn, getMaxLengthForField_fn, getElementValue_fn, openOmniWithContext_fn, handleFillInput_fn; 14537 var omni_input_controller_default = class extends application_controller_default { 14538 constructor() { 14539 super(...arguments); 14540 __privateAdd(this, _instances); 14541 __privateAdd(this, _currentFocusedElement, null); 14542 __privateAdd(this, _omniWrapper, null); 14543 __privateAdd(this, _boundHandlers, /* @__PURE__ */ new Map()); 14544 __privateAdd(this, _aiChatElement, null); 14545 } 14546 connect() { 14547 const selector = [ 14548 'input[name*="description"]', 14549 'input[name*="content"]', 14550 'input[name*="title"]', 14551 'input[name*="summary"]', 14552 'input[name*="subject"]', 14553 'input[name*="preheadline"]', 14554 'textarea[name*="description"]', 14555 'textarea[name*="content"]', 14556 'textarea[name*="title"]', 14557 'textarea[name*="summary"]', 14558 'textarea[name*="subject"]', 14559 'textarea[name*="preheadline"]', 14560 // Additional selectors for special elements 14561 ".tinyMce-placeholder", 14562 ".txtTinyMce-wrapper[data-mce-style]" 14563 ].join(","); 14564 __privateMethod(this, _instances, addDelegatedListener_fn).call(this, "focusin", selector, __privateMethod(this, _instances, handleFocus_fn).bind(this)); 14565 __privateMethod(this, _instances, addDelegatedListener_fn).call(this, "focusout", selector, __privateMethod(this, _instances, handleBlur_fn).bind(this)); 14566 document.addEventListener("ai-chat:fill-input", __privateMethod(this, _instances, handleFillInput_fn).bind(this)); 14567 } 14568 disconnect() { 14569 if (__privateGet(this, _omniWrapper)) { 14570 __privateGet(this, _omniWrapper).remove(); 14571 __privateSet(this, _omniWrapper, null); 14572 } 14573 __privateGet(this, _boundHandlers).forEach((handler, key) => { 14574 const [event] = key.split("-"); 14575 document.removeEventListener(event, handler, true); 14576 }); 14577 __privateGet(this, _boundHandlers).clear(); 14578 __privateSet(this, _currentFocusedElement, null); 14579 __privateSet(this, _aiChatElement, null); 14580 } 14581 }; 14582 _currentFocusedElement = new WeakMap(); 14583 _omniWrapper = new WeakMap(); 14584 _boundHandlers = new WeakMap(); 14585 _aiChatElement = new WeakMap(); 14586 _instances = new WeakSet(); 14587 /** 14588 * Get or cache the AI chat element 14589 * @private 14590 * @returns {HTMLElement|null} 14591 */ 14592 getAiChatElement_fn = function() { 14593 if (!__privateGet(this, _aiChatElement)) { 14594 __privateSet(this, _aiChatElement, document.querySelector('[data-controller="ai-chat"]')); 14595 } 14596 return __privateGet(this, _aiChatElement); 14597 }; 14598 /** 14599 * Add delegated event listener 14600 * @private 14601 */ 14602 addDelegatedListener_fn = function(event, selector, handler) { 14603 const wrappedHandler = (e) => { 14604 if (e.target.matches(selector)) { 14605 handler(e); 14606 } 14607 }; 14608 __privateGet(this, _boundHandlers).set(`${event}-${selector}`, wrappedHandler); 14609 document.addEventListener(event, wrappedHandler, true); 14610 }; 14611 /** 14612 * Handle input focus - show Omni button 14613 * @private 14614 */ 14615 handleFocus_fn = function(event) { 14616 const element = event.target; 14617 __privateSet(this, _currentFocusedElement, element); 14618 __privateMethod(this, _instances, showOmniButton_fn).call(this, element); 14619 }; 14620 /** 14621 * Handle input blur - hide Omni button 14622 * @private 14623 */ 14624 handleBlur_fn = function() { 14625 __privateMethod(this, _instances, hideOmniButton_fn).call(this); 14626 __privateSet(this, _currentFocusedElement, null); 14627 }; 14628 /** 14629 * Show Omni button for the focused element 14630 * @private 14631 */ 14632 showOmniButton_fn = function(element) { 14633 __privateMethod(this, _instances, hideOmniButton_fn).call(this); 14634 const template = document.getElementById("omni-input-wrapper-template"); 14635 const wrapperClone = template.content.cloneNode(true); 14636 const wrapper = wrapperClone.firstElementChild; 14637 wrapper.appendChild(__privateMethod(this, _instances, createOmniButton_fn).call(this)); 14638 const rect = element.getBoundingClientRect(); 14639 const parentRect = element.parentNode.getBoundingClientRect(); 14640 wrapper.style.top = `${rect.top - parentRect.top - 28}px`;
14641 wrapper.style.left = `${rect.left - parentRect.left + rect.width - 25}px`; 14642 element.parentNode.insertBefore(wrapper, element.nextSibling); 14643 __privateSet(this, _omniWrapper, wrapper); 14644 requestAnimationFrame(() => { 14645 wrapper.classList.remove("g:opacity-0", "g:scale-90", "g:pointer-events-none"); 14646 wrapper.classList.add("g:opacity-100", "g:scale-100", "g:pointer-events-auto"); 14647 }); 14648 }; 14649 /** 14650 * Create the Omni button element 14651 * @private 14652 * @returns {HTMLElement} The button element 14653 */ 14654 createOmniButton_fn = function() { 14655 const template = document.getElementById("omni-icon-template-small"); 14656 if (template) { 14657 const iconClone = template.content.cloneNode(true); 14658 const button = iconClone.querySelector(".omni-focus-button"); 14659 if (button) { 14660 button.tabIndex = -1; 14661 button.addEventListener("mousedown", (e) => e.preventDefault()); 14662 button.addEventListener("click", __privateMethod(this, _instances, handleOmniClick_fn).bind(this)); 14663 return button; 14664 } 14665 } 14666 console.error("Omni icon template not found"); 14667 return document.createElement("div"); 14668 }; 14669 /** 14670 * Hide Omni button 14671 * @private 14672 */ 14673 hideOmniButton_fn = function() { 14674 if (__privateGet(this, _omniWrapper)) { 14675 __privateGet(this, _omniWrapper).remove(); 14676 __privateSet(this, _omniWrapper, null); 14677 } 14678 }; 14679 /** 14680 * Handle click on Omni button 14681 * @private 14682 */ 14683 handleOmniClick_fn = function(event) { 14684 event.preventDefault(); 14685 event.stopPropagation(); 14686 event.stopImmediatePropagation(); 14687 if (!__privateGet(this, _currentFocusedElement)) { 14688 return; 14689 } 14690 const context = __privateMethod(this, _instances, gatherContext_fn).call(this); 14691 __privateMethod(this, _instances, hideOmniButton_fn).call(this); 14692 __privateMethod(this, _instances, openOmniWithContext_fn).call(this, context); 14693 }; 14694 /** 14695 * Gather context from current and related fields 14696 * @private 14697 */ 14698 gatherContext_fn = function() { 14699 const element = __privateGet(this, _currentFocusedElement); 14700 const name = element.name || element.getAttribute("data-field-name") || ""; 14701 const tagName = element.tagName.toLowerCase(); 14702 let fieldType = tagName; 14703 if (name.includes("description")) fieldType = "description"; 14704 else if (name.includes("title")) fieldType = "title"; 14705 else if (name.includes("content")) fieldType = "content"; 14706 else if (name.includes("summary")) fieldType = "summary"; 14707 else if (name.includes("subject")) fieldType = "subject"; 14708 else if (name.includes("preheadline")) fieldType = "preheadline"; 14709 const fallbackFieldName = __privateMethod(this, _instances, getAiChatElement_fn).call(this)?.dataset?.aiChatFallbackFieldNameValue; 14710 const fieldLabel = __privateMethod(this, _instances, findLabelForElement_fn).call(this, element); 14711 const omniPageContext = document.querySelector("[data-omni-translated-model-name]")?.dataset?.omniTranslatedModelName || null; 14712 const context = { 14713 source: "omni-button", 14714 fieldName: name || fallbackFieldName, 14715 fieldLabel, 14716 // Add translated label from DOM 14717 omniPageContext, 14718 // Add translated model name from data attribute 14719 fieldValue: __privateMethod(this, _instances, getElementValue_fn).call(this, element), 14720 fieldType, 14721 value: __privateMethod(this, _instances, getElementValue_fn).call(this, element),
14722 // Add this for compatibility with AI chat controller 14723 maxLength: __privateMethod(this, _instances, getMaxLengthForField_fn).call(this, element, fieldType), 14724 relatedFields: {}, 14725 plainText: true 14726 }; 14727 const relatedSelectors = { 14728 name: '[name*="name"]', 14729 title: '[name*="title"]', 14730 description: '[name*="description"]' 14731 }; 14732 Object.entries(relatedSelectors).forEach(([key, selector]) => { 14733 const relatedElement = document.querySelector(selector); 14734 if (relatedElement && relatedElement !== element) { 14735 const value = __privateMethod(this, _instances, getElementValue_fn).call(this, relatedElement); 14736 if (value) { 14737 context.relatedFields[key] = value; 14738 } 14739 } 14740 }); 14741 context.relatedFields["context"] = omniPageContext; 14742 return context; 14743 }; 14744 /** 14745 * Find associated label for an input element 14746 * @private 14747 * @param {HTMLElement} element - The input element 14748 * @returns {string|null} Label text or null 14749 */ 14750 findLabelForElement_fn = function(element) { 14751 if (element.id) { 14752 const label = document.querySelector(`label[for="${element.id}"]`); 14753 if (label) return label.textContent.trim(); 14754 } 14755 const parentLabel = element.closest("label"); 14756 if (parentLabel) return parentLabel.textContent.trim(); 14757 if (element.name) { 14758 const label = document.querySelector(`label[for="${element.name}"]`); 14759 if (label) return label.textContent.trim(); 14760 } 14761 return null; 14762 }; 14763 /** 14764 * Get maximum length constraint for a field 14765 * @private 14766 * @param {HTMLElement} element - The input element 14767 * @param {string} fieldType - The field type 14768 * @returns {number|null} Maximum length or null for unlimited 14769 */ 14770 getMaxLengthForField_fn = function(element, fieldType) { 14771 const htmlMaxLength = element.getAttribute("maxlength"); 14772 if (htmlMaxLength) { 14773 return parseInt(htmlMaxLength, 10); 14774 } 14775 const defaults = { 14776 title: 60, 14777 subject: 80, 14778 preheadline: 100, 14779 description: 150, 14780 summary: 200, 14781 content: null 14782 // no limit 14783 }; 14784 return defaults[fieldType] || null; 14785 }; 14786 /** 14787 * Get value from element (handles different element types) 14788 * @private 14789 */ 14790 getElementValue_fn = function(element) { 14791 if (element.tagName === "INPUT" || element.tagName === "TEXTAREA") { 14792 return element.value; 14793 } else if (element.contentEditable === "true") { 14794 return element.innerText; 14795 } else { 14796 return element.textContent; 14797 } 14798 }; 14799 /** 14800 * Open Omni panel with input context 14801 * @private 14802 */ 14803 openOmniWithContext_fn = function(context) { 14804 const isPanelOpen = document.body.dataset.omniPanelExpanded === "true"; 14805 if (!isPanelOpen) { 14806 document.dispatchEvent( 14807 new CustomEvent("ai-chat-panel:toggle", { 14808 bubbles: true, 14809 detail: { source: "omni-input" } 14810 }) 14811 ); 14812 } 14813 const aiChatElement = __privateMethod(this, _instances, getAiChatElement_fn).call(this); 14814 if (aiChatElement) { 14815 aiChatElement.dispatchEvent( 14816 new CustomEvent("omni:context-received", { 14817 bubbles: true, 14818 detail: context 14819 }) 14820 ); 14821 } 14822 }; 14823 /** 14824 * Handle fill input request from AI chat 14825 * @private 14826 * @param {CustomEvent} event 14827 */ 14828 handleFillInput_fn = function(event) { 14829 const { content, context } = event.detail; 14830 if (!content || !context) { 14831 return; 14832 } 14833 const targetElement = context.fieldName ? document.querySelector(`input[name="${context.fieldName}"], textarea[name="${context.fieldName}"]`) : null; 14834 if (!targetElement) { 14835 return; 14836 } 14837 targetElement.value = content; 14838 targetElement.dispatchEvent(new Event("input", { bubbles: true })); 14839 targetElement.dispatchEvent(new Event("change", { bubbles: true })); 14840 targetElement.focus(); 14841 setTimeout(() => { 14842 targetElement.blur(); 14843 }, 200); 14844 }; 14845 14846
14846// app/javascript/omni/controllers/omni_capabilities_controller.js 14847 init_define_process(); 14848 init_jquery(); 14849 var _instances2, populatePromptsView_fn, createPromptCard_fn, submitPromptMessage_fn, fillPromptInInput_fn, getTranslation_fn; 14850 var omni_capabilities_controller_default = class extends application_controller_default { 14851 constructor() { 14852 super(...arguments); 14853 __privateAdd(this, _instances2); 14854 } 14855 /** 14856 * Handle category selection to show prompts 14857 * @param {Event} event - The click event with category data 14858 */ 14859 showPrompts(event) { 14860 event.preventDefault(); 14861 event.stopPropagation(); 14862 const title = event.params.title; 14863 const icon = event.params.icon; 14864 const promptsBase64 = event.params.prompts; 14865 const promptsJson = atob(promptsBase64); 14866 const prompts = JSON.parse(promptsJson); 14867 __privateMethod(this, _instances2, populatePromptsView_fn).call(this, title, icon, prompts); 14868 this.categoriesViewTarget.classList.add("g:hidden"); 14869 this.promptsViewTarget.classList.remove("g:hidden"); 14870 } 14871 /** 14872 * Handle back navigation to show categories 14873 * @param {Event} event - The click event 14874 */ 14875 showCategories(event) { 14876 if (event) { 14877 event.preventDefault(); 14878 event.stopPropagation(); 14879 } 14880 this.categoriesViewTarget.classList.remove("g:hidden"); 14881 this.promptsViewTarget.classList.add("g:hidden"); 14882 } 14883 /**
14884 * Handle prompt card click to send message immediately 14885 * @param {Event} event - The click event 14886 */ 14887 sendPrompt(event) { 14888 event.preventDefault(); 14889 event.stopPropagation(); 14890 const prompt = event.currentTarget.dataset.prompt; 14891 if (prompt) { 14892 __privateMethod(this, _instances2, submitPromptMessage_fn).call(this, prompt); 14893 } 14894 } 14895 /** 14896 * Handle edit button click to customize prompt 14897 * @param {Event} event - The click event 14898 */ 14899 editPrompt(event) { 14900 event.preventDefault(); 14901 event.stopPropagation(); 14902 const prompt = event.currentTarget.dataset.prompt; 14903 if (prompt) { 14904 __privateMethod(this, _instances2, fillPromptInInput_fn).call(this, prompt); 14905 } 14906 } 14907 }; 14908 _instances2 = new WeakSet(); 14909 /** 14910 * Populate the prompts view using templates 14911 * @private 14912 * @param {string} title - The category title 14913 * @param {string} icon - The category icon class 14914 * @param {Array<string>} prompts - Array of prompt strings 14915 */ 14916 populatePromptsView_fn = function(title, icon, prompts) { 14917 this.promptsViewTarget.innerHTML = ""; 14918 const template = this.promptsViewTemplateTarget.content.cloneNode(true); 14919 const backButton = template.querySelector('[data-omni-capabilities-target="backButton"]'); 14920 const categoryIcon = template.querySelector('[data-omni-capabilities-target="categoryIcon"]'); 14921 const categoryTitle = template.querySelector('[data-omni-capabilities-target="categoryTitle"]'); 14922 const selectPromptTextEl = template.querySelector('[data-omni-capabilities-target="selectPromptText"]'); 14923 const promptsContainer = template.querySelector('[data-omni-capabilities-target="promptsContainer"]'); 14924 const backButtonText = __privateMethod(this, _instances2, getTranslation_fn).call(this, "back_to_outcomes", "\u2190 Back"); 14925 const selectPromptText = __privateMethod(this, _instances2, getTranslation_fn).call(this, "select_prompt", "Here are some prompt ideas to get you started:"); 14926 backButton.textContent = backButtonText; 14927 categoryIcon.className = `fa-duotone fa-regular ${icon || "fa-cog"} g:text-wave g:text-lg`; 14928 categoryTitle.textContent = title; 14929 selectPromptTextEl.textContent = selectPromptText;
14930 prompts.forEach((prompt) => { 14931 const promptCard = __privateMethod(this, _instances2, createPromptCard_fn).call(this, prompt); 14932 promptsContainer.appendChild(promptCard); 14933 }); 14934 this.promptsViewTarget.appendChild(template); 14935 }; 14936 /** 14937 * Create individual prompt card using template 14938 * @private 14939 * @param {string} prompt - The prompt text 14940 * @returns {DocumentFragment} The populated prompt card 14941 */ 14942 createPromptCard_fn = function(prompt) { 14943 const template = this.promptCardTemplateTarget.content.cloneNode(true); 14944 const promptCard = template.querySelector('[data-omni-capabilities-target="promptCard"]'); 14945 const promptText = template.querySelector('[data-omni-capabilities-target="promptText"]'); 14946 const editBtn = template.querySelector('[data-omni-capabilities-target="editBtn"]'); 14947 promptCard.dataset.prompt = prompt; 14948 promptText.textContent = prompt; 14949 editBtn.dataset.prompt = prompt; 14950 return template; 14951 }; 14952 /** 14953 * Submit a prompt message to the AI chat 14954 * @private 14955 * @param {string} prompt - The prompt text to send 14956 */ 14957 submitPromptMessage_fn = function(prompt) { 14958 if (this.hasAiChatOutlet) { 14959 const aiChat = this.aiChatOutlet; 14960 if (aiChat.inputTarget) { 14961 aiChat.inputTarget.value = prompt; 14962 aiChat.updateButtonState(); 14963 const event = new Event("submit", { bubbles: true, cancelable: true }); 14964 aiChat.handleSubmit(event); 14965 this.element.classList.add("g:hidden"); 14966 } 14967 } 14968 }; 14969 /** 14970 * Fill the AI chat input with a prompt for customization 14971 * @private 14972 * @param {string} prompt - The prompt text to fill 14973 */ 14974 fillPromptInInput_fn = function(prompt) { 14975 if (this.hasAiChatOutlet) { 14976 const aiChat = this.aiChatOutlet; 14977 if (aiChat.inputTarget) { 14978 const input = aiChat.inputTarget; 14979 const currentValue = input.value.trim(); 14980 if (currentValue) { 14981 input.value = currentValue + " " + prompt; 14982 } else { 14983 input.value = prompt; 14984 } 14985 aiChat.updateButtonState(); 14986 const customizeMessage = __privateMethod(this, _instances2, getTranslation_fn).call(this, "customize_prompt", "Customize your prompt below"); 14987 aiChat.addTemporarySystemMessage(customizeMessage, 0); 14988 input.focus(); 14989 input.setSelectionRange(input.value.length, input.value.length); 14990 this.element.classList.add("g:hidden"); 14991 } 14992 } 14993 }; 14994 /** 14995 * Get translated text from AI chat panel translations 14996 * @private 14997 * @param {string} key - The translation key 14998 * @param {string} defaultValue - The default value if translation not found 14999 * @returns {string} The translated text or default value 15000 */ 15001 getTranslation_fn = function(key, defaultValue) { 15002 const translationsElement = document.querySelector("[data-ai-chat-translations-value]"); 15003 if (translationsElement) { 15004 try { 15005 const translations = JSON.parse(translationsElement.dataset.aiChatTranslationsValue); 15006 return translations.capabilities?.[key] || defaultValue; 15007 } catch { 15008 return defaultValue; 15009 } 15010 } 15011 return defaultValue; 15012 }; 15013 __publicField(omni_capabilities_controller_default, "outlets", ["ai-chat"]); 15014 __publicField(omni_capabilities_controller_default, "targets", [ 15015 "categoriesView", 15016 "promptsView", 15017 "promptCard", 15018 "promptsViewTemplate", 15019 "promptCardTemplate", 15020 "backButton", 15021 "categoryIcon", 15022 "categoryTitle", 15023 "selectPromptText", 15024 "promptsContainer", 15025 "promptText" 15026 ]); 15027 15028
15028// app/javascript/omni/controllers/ai_chat_controller.js 15029 init_define_process(); 15030 init_jquery(); 15031 15032
15032// app/javascript/i18n-js/config.js 15033 init_define_process(); 15034 init_jquery(); 15035 15036
vendor: 89 bytes, lines 15036-15040
15036// node_modules/i18next/dist/esm/i18next.js 15037 init_define_process(); 15038 init_jquery(); 15039 15040
vendor: 454 bytes, lines 15040-15052
15040// node_modules/@babel/runtime/helpers/esm/typeof.js 15041 init_define_process(); 15042 init_jquery(); 15043 function _typeof(o) { 15044 "@babel/helpers - typeof"; 15045 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { 15046 return typeof o2; 15047 } : function(o2) { 15048 return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; 15049 }, _typeof(o); 15050 } 15051 15052
vendor: 104 bytes, lines 15052-15056
15052// node_modules/@babel/runtime/helpers/esm/objectSpread.js 15053 init_define_process(); 15054 init_jquery(); 15055 15056
vendor: 106 bytes, lines 15056-15060
15056// node_modules/@babel/runtime/helpers/esm/defineProperty.js 15057 init_define_process(); 15058 init_jquery(); 15059 15060
vendor: 105 bytes, lines 15060-15064
15060// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js 15061 init_define_process(); 15062 init_jquery(); 15063 15064
vendor: 461 bytes, lines 15064-15078
15064// node_modules/@babel/runtime/helpers/esm/toPrimitive.js 15065 init_define_process(); 15066 init_jquery(); 15067 function toPrimitive(t, r) { 15068 if ("object" != _typeof(t) || !t) return t; 15069 var e = t[Symbol.toPrimitive]; 15070 if (void 0 !== e) { 15071 var i = e.call(t, r || "default"); 15072 if ("object" != _typeof(i)) return i; 15073 throw new TypeError("@@toPrimitive must return a primitive value."); 15074 } 15075 return ("string" === r ? String : Number)(t); 15076 } 15077 15078
vendor: 183 bytes, lines 15078-15084
15078// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js 15079 function toPropertyKey(t) { 15080 var i = toPrimitive(t, "string"); 15081 return "symbol" == _typeof(i) ? i : i + ""; 15082 } 15083 15084
vendor: 286 bytes, lines 15084-15094
15084// node_modules/@babel/runtime/helpers/esm/defineProperty.js 15085 function _defineProperty(e, r, t) { 15086 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 15087 value: t, 15088 enumerable: true, 15089 configurable: true, 15090 writable: true 15091 }) : e[r] = t, e; 15092 } 15093 15094
vendor: 529 bytes, lines 15094-15107
15094// node_modules/@babel/runtime/helpers/esm/objectSpread.js 15095 function _objectSpread(e) { 15096 for (var r = 1; r < arguments.length; r++) { 15097 var t = null != arguments[r] ? Object(arguments[r]) : {}, o = Object.keys(t); 15098 "function" == typeof Object.getOwnPropertySymbols && o.push.apply(o, Object.getOwnPropertySymbols(t).filter(function(e2) { 15099 return Object.getOwnPropertyDescriptor(t, e2).enumerable; 15100 })), o.forEach(function(r2) { 15101 _defineProperty(e, r2, t[r2]); 15102 }); 15103 } 15104 return e; 15105 } 15106 15107
vendor: 230 bytes, lines 15107-15114
15107// node_modules/@babel/runtime/helpers/esm/classCallCheck.js 15108 init_define_process(); 15109 init_jquery(); 15110 function _classCallCheck(a, n) { 15111 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 15112 } 15113 15114
vendor: 559 bytes, lines 15114-15129
15114// node_modules/@babel/runtime/helpers/esm/createClass.js 15115 init_define_process(); 15116 init_jquery(); 15117 function _defineProperties(e, r) { 15118 for (var t = 0; t < r.length; t++) { 15119 var o = r[t]; 15120 o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o); 15121 } 15122 } 15123 function _createClass(e, r, t) { 15124 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 15125 writable: false 15126 }), e; 15127 } 15128 15129
vendor: 117 bytes, lines 15129-15133
15129// node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js 15130 init_define_process(); 15131 init_jquery(); 15132 15133
vendor: 279 bytes, lines 15133-15141
15133// node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js 15134 init_define_process(); 15135 init_jquery(); 15136 function _assertThisInitialized(e) { 15137 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 15138 return e; 15139 } 15140 15141
vendor: 341 bytes, lines 15141-15148
15141// node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js 15142 function _possibleConstructorReturn(t, e) { 15143 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; 15144 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 15145 return _assertThisInitialized(t); 15146 } 15147 15148
vendor: 324 bytes, lines 15148-15157
15148// node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js 15149 init_define_process(); 15150 init_jquery(); 15151 function _getPrototypeOf(t) { 15152 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) { 15153 return t2.__proto__ || Object.getPrototypeOf(t2); 15154 }, _getPrototypeOf(t); 15155 } 15156 15157
vendor: 100 bytes, lines 15157-15161
15157// node_modules/@babel/runtime/helpers/esm/inherits.js 15158 init_define_process(); 15159 init_jquery(); 15160 15161
vendor: 314 bytes, lines 15161-15170
15161// node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js 15162 init_define_process(); 15163 init_jquery(); 15164 function _setPrototypeOf(t, e) { 15165 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) { 15166 return t2.__proto__ = e2, t2; 15167 }, _setPrototypeOf(t, e); 15168 } 15169 15170
vendor: 468 bytes, lines 15170-15184
15170// node_modules/@babel/runtime/helpers/esm/inherits.js 15171 function _inherits(t, e) { 15172 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 15173 t.prototype = Object.create(e && e.prototype, { 15174 constructor: { 15175 value: t, 15176 writable: true, 15177 configurable: true 15178 } 15179 }), Object.defineProperty(t, "prototype", { 15180 writable: false 15181 }), e && _setPrototypeOf(t, e); 15182 } 15183 15184
vendor: 79,097 bytes, lines 15184-17146
15184// node_modules/i18next/dist/esm/i18next.js 15185 var consoleLogger = { 15186 type: "logger", 15187 log: function log(args) { 15188 this.output("log", args); 15189 }, 15190 warn: function warn(args) { 15191 this.output("warn", args); 15192 }, 15193 error: function error(args) { 15194 this.output("error", args); 15195 }, 15196 output: function output(type, args) { 15197 if (console && console[type]) console[type].apply(console, args); 15198 } 15199 }; 15200 var Logger = function() { 15201 function Logger2(concreteLogger) { 15202 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 15203 _classCallCheck(this, Logger2); 15204 this.init(concreteLogger, options); 15205 } 15206 _createClass(Logger2, [{ 15207 key: "init", 15208 value: function init(concreteLogger) { 15209 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 15210 this.prefix = options.prefix || "i18next:"; 15211 this.logger = concreteLogger || consoleLogger; 15212 this.options = options; 15213 this.debug = options.debug; 15214 } 15215 }, { 15216 key: "setDebug", 15217 value: function setDebug(bool) { 15218 this.debug = bool; 15219 } 15220 }, { 15221 key: "log", 15222 value: function log2() { 15223 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 15224 args[_key] = arguments[_key]; 15225 } 15226 return this.forward(args, "log", "", true); 15227 } 15228 }, { 15229 key: "warn", 15230 value: function warn2() { 15231 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 15232 args[_key2] = arguments[_key2]; 15233 } 15234 return this.forward(args, "warn", "", true); 15235 } 15236 }, { 15237 key: "error", 15238 value: function error2() { 15239 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 15240 args[_key3] = arguments[_key3]; 15241 } 15242 return this.forward(args, "error", ""); 15243 } 15244 }, { 15245 key: "deprecate", 15246 value: function deprecate() { 15247 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { 15248 args[_key4] = arguments[_key4]; 15249 } 15250 return this.forward(args, "warn", "WARNING DEPRECATED: ", true); 15251 } 15252 }, { 15253 key: "forward", 15254 value: function forward(args, lvl, prefix, debugOnly) { 15255 if (debugOnly && !this.debug) return null; 15256 if (typeof args[0] === "string") args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]); 15257 return this.logger[lvl](args); 15258 } 15259 }, { 15260 key: "create", 15261 value: function create(moduleName) { 15262 return new Logger2(this.logger, _objectSpread({}, { 15263 prefix: "".concat(this.prefix, ":").concat(moduleName, ":") 15264 }, this.options)); 15265 } 15266 }]); 15267 return Logger2; 15268 }(); 15269 var baseLogger = new Logger(); 15270 var EventEmitter = function() { 15271 function EventEmitter2() { 15272 _classCallCheck(this, EventEmitter2); 15273 this.observers = {}; 15274 } 15275 _createClass(EventEmitter2, [{ 15276 key: "on", 15277 value: function on(events, listener) { 15278 var _this = this; 15279 events.split(" ").forEach(function(event) { 15280 _this.observers[event] = _this.observers[event] || []; 15281 _this.observers[event].push(listener); 15282 }); 15283 return this; 15284 } 15285 }, { 15286 key: "off", 15287 value: function off(event, listener) { 15288 if (!this.observers[event]) return; 15289 if (!listener) { 15290 delete this.observers[event]; 15291 return; 15292 } 15293 this.observers[event] = this.observers[event].filter(function(l) { 15294 return l !== listener; 15295 }); 15296 } 15297 }, { 15298 key: "emit", 15299 value: function emit(event) { 15300 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 15301 args[_key - 1] = arguments[_key]; 15302 } 15303 if (this.observers[event]) { 15304 var cloned = [].concat(this.observers[event]); 15305 cloned.forEach(function(observer) { 15306 observer.apply(void 0, args); 15307 }); 15308 } 15309 if (this.observers["*"]) { 15310 var _cloned = [].concat(this.observers["*"]); 15311 _cloned.forEach(function(observer) { 15312 observer.apply(observer, [event].concat(args)); 15313 }); 15314 } 15315 } 15316 }]); 15317 return EventEmitter2; 15318 }(); 15319 function defer() { 15320 var res; 15321 var rej; 15322 var promise = new Promise(function(resolve, reject) { 15323 res = resolve; 15324 rej = reject; 15325 }); 15326 promise.resolve = res; 15327 promise.reject = rej; 15328 return promise; 15329 } 15330 function makeString(object) { 15331 if (object == null) return ""; 15332 return "" + object; 15333 } 15334 function copy(a, s, t) { 15335 a.forEach(function(m) { 15336 if (s[m]) t[m] = s[m]; 15337 }); 15338 } 15339 function getLastOfPath(object, path, Empty) { 15340 function cleanKey(key2) { 15341 return key2 && key2.indexOf("###") > -1 ? key2.replace(/###/g, ".") : key2; 15342 } 15343 function canNotTraverseDeeper() { 15344 return !object || typeof object === "string"; 15345 } 15346 var stack = typeof path !== "string" ? [].concat(path) : path.split("."); 15347 while (stack.length > 1) { 15348 if (canNotTraverseDeeper()) return {}; 15349 var key = cleanKey(stack.shift()); 15350 if (!object[key] && Empty) object[key] = new Empty(); 15351 if (Object.prototype.hasOwnProperty.call(object, key)) { 15352 object = object[key]; 15353 } else { 15354 object = {}; 15355 } 15356 } 15357 if (canNotTraverseDeeper()) return {}; 15358 return { 15359 obj: object, 15360 k: cleanKey(stack.shift()) 15361 }; 15362 } 15363 function setPath(object, path, newValue) { 15364 var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k; 15365 obj[k] = newValue; 15366 } 15367 function pushPath(object, path, newValue, concat) { 15368 var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k; 15369 obj[k] = obj[k] || []; 15370 if (concat) obj[k] = obj[k].concat(newValue); 15371 if (!concat) obj[k].push(newValue); 15372 } 15373 function getPath(object, path) { 15374 var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k; 15375 if (!obj) return void 0; 15376 return obj[k]; 15377 } 15378 function getPathWithDefaults(data, defaultData, key) { 15379 var value = getPath(data, key); 15380 if (value !== void 0) { 15381 return value; 15382 } 15383 return getPath(defaultData, key); 15384 } 15385 function deepExtend(target, source, overwrite) { 15386 for (var prop in source) { 15387 if (prop !== "__proto__" && prop !== "constructor") { 15388 if (prop in target) { 15389 if (typeof target[prop] === "string" || target[prop] instanceof String || typeof source[prop] === "string" || source[prop] instanceof String) { 15390 if (overwrite) target[prop] = source[prop]; 15391 } else { 15392 deepExtend(target[prop], source[prop], overwrite); 15393 } 15394 } else { 15395 target[prop] = source[prop]; 15396 } 15397 } 15398 } 15399 return target; 15400 } 15401 function regexEscape(str) { 15402 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 15403 } 15404 var _entityMap = { 15405 "&": "&", 15406 "<": "<", 15407 ">": ">", 15408 '"': """, 15409 "'": "'", 15410 "/": "/" 15411 }; 15412 function escape(data) { 15413 if (typeof data === "string") { 15414 return data.replace(/[&<>"'\/]/g, function(s) { 15415 return _entityMap[s]; 15416 }); 15417 } 15418 return data; 15419 } 15420 var isIE10 = typeof window !== "undefined" && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1; 15421 var ResourceStore = function(_EventEmitter) { 15422 _inherits(ResourceStore2, _EventEmitter); 15423 function ResourceStore2(data) { 15424 var _this; 15425 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { 15426 ns: ["translation"], 15427 defaultNS: "translation" 15428 }; 15429 _classCallCheck(this, ResourceStore2); 15430 _this = _possibleConstructorReturn(this, _getPrototypeOf(ResourceStore2).call(this)); 15431 if (isIE10) { 15432 EventEmitter.call(_assertThisInitialized(_this)); 15433 } 15434 _this.data = data || {}; 15435 _this.options = options; 15436 if (_this.options.keySeparator === void 0) { 15437 _this.options.keySeparator = "."; 15438 } 15439 return _this; 15440 } 15441 _createClass(ResourceStore2, [{ 15442 key: "addNamespaces", 15443 value: function addNamespaces(ns) { 15444 if (this.options.ns.indexOf(ns) < 0) { 15445 this.options.ns.push(ns); 15446 } 15447 } 15448 }, { 15449 key: "removeNamespaces", 15450 value: function removeNamespaces(ns) { 15451 var index = this.options.ns.indexOf(ns); 15452 if (index > -1) { 15453 this.options.ns.splice(index, 1); 15454 } 15455 } 15456 }, { 15457 key: "getResource", 15458 value: function getResource(lng, ns, key) { 15459 var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 15460 var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; 15461 var path = [lng, ns]; 15462 if (key && typeof key !== "string") path = path.concat(key); 15463 if (key && typeof key === "string") path = path.concat(keySeparator ? key.split(keySeparator) : key); 15464 if (lng.indexOf(".") > -1) { 15465 path = lng.split("."); 15466 } 15467 return getPath(this.data, path); 15468 } 15469 }, { 15470 key: "addResource", 15471 value: function addResource(lng, ns, key, value) { 15472 var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { 15473 silent: false 15474 }; 15475 var keySeparator = this.options.keySeparator; 15476 if (keySeparator === void 0) keySeparator = "."; 15477 var path = [lng, ns]; 15478 if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key); 15479 if (lng.indexOf(".") > -1) { 15480 path = lng.split("."); 15481 value = ns; 15482 ns = path[1]; 15483 } 15484 this.addNamespaces(ns); 15485 setPath(this.data, path, value); 15486 if (!options.silent) this.emit("added", lng, ns, key, value); 15487 } 15488 }, { 15489 key: "addResources", 15490 value: function addResources(lng, ns, resources) { 15491 var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { 15492 silent: false 15493 }; 15494 for (var m in resources) { 15495 if (typeof resources[m] === "string" || Object.prototype.toString.apply(resources[m]) === "[object Array]") this.addResource(lng, ns, m, resources[m], { 15496 silent: true 15497 }); 15498 } 15499 if (!options.silent) this.emit("added", lng, ns, resources); 15500 } 15501 }, { 15502 key: "addResourceBundle", 15503 value: function addResourceBundle(lng, ns, resources, deep, overwrite) { 15504 var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { 15505 silent: false 15506 }; 15507 var path = [lng, ns]; 15508 if (lng.indexOf(".") > -1) { 15509 path = lng.split("."); 15510 deep = resources; 15511 resources = ns; 15512 ns = path[1]; 15513 } 15514 this.addNamespaces(ns); 15515 var pack = getPath(this.data, path) || {}; 15516 if (deep) { 15517 deepExtend(pack, resources, overwrite); 15518 } else { 15519 pack = _objectSpread({}, pack, resources); 15520 } 15521 setPath(this.data, path, pack); 15522 if (!options.silent) this.emit("added", lng, ns, resources); 15523 } 15524 }, { 15525 key: "removeResourceBundle", 15526 value: function removeResourceBundle(lng, ns) { 15527 if (this.hasResourceBundle(lng, ns)) { 15528 delete this.data[lng][ns]; 15529 } 15530 this.removeNamespaces(ns); 15531 this.emit("removed", lng, ns); 15532 } 15533 }, { 15534 key: "hasResourceBundle", 15535 value: function hasResourceBundle(lng, ns) { 15536 return this.getResource(lng, ns) !== void 0; 15537 } 15538 }, { 15539 key: "getResourceBundle", 15540 value: function getResourceBundle(lng, ns) { 15541 if (!ns) ns = this.options.defaultNS; 15542 if (this.options.compatibilityAPI === "v1") return _objectSpread({}, {}, this.getResource(lng, ns)); 15543 return this.getResource(lng, ns); 15544 } 15545 }, { 15546 key: "getDataByLanguage", 15547 value: function getDataByLanguage(lng) { 15548 return this.data[lng]; 15549 } 15550 }, { 15551 key: "toJSON", 15552 value: function toJSON() { 15553 return this.data; 15554 } 15555 }]); 15556 return ResourceStore2; 15557 }(EventEmitter); 15558 var postProcessor = { 15559 processors: {}, 15560 addPostProcessor: function addPostProcessor(module) { 15561 this.processors[module.name] = module; 15562 }, 15563 handle: function handle(processors, value, key, options, translator) { 15564 var _this = this; 15565 processors.forEach(function(processor) { 15566 if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator); 15567 }); 15568 return value; 15569 } 15570 }; 15571 var checkedLoadedFor = {}; 15572 var Translator = function(_EventEmitter) { 15573 _inherits(Translator2, _EventEmitter); 15574 function Translator2(services) { 15575 var _this; 15576 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 15577 _classCallCheck(this, Translator2); 15578 _this = _possibleConstructorReturn(this, _getPrototypeOf(Translator2).call(this)); 15579 if (isIE10) { 15580 EventEmitter.call(_assertThisInitialized(_this)); 15581 } 15582 copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, _assertThisInitialized(_this)); 15583 _this.options = options; 15584 if (_this.options.keySeparator === void 0) { 15585 _this.options.keySeparator = "."; 15586 } 15587 _this.logger = baseLogger.create("translator"); 15588 return _this; 15589 } 15590 _createClass(Translator2, [{ 15591 key: "changeLanguage", 15592 value: function changeLanguage(lng) { 15593 if (lng) this.language = lng; 15594 } 15595 }, { 15596 key: "exists", 15597 value: function exists(key) { 15598 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { 15599 interpolation: {} 15600 }; 15601 var resolved = this.resolve(key, options); 15602 return resolved && resolved.res !== void 0; 15603 } 15604 }, { 15605 key: "extractFromKey", 15606 value: function extractFromKey(key, options) { 15607 var nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator; 15608 if (nsSeparator === void 0) nsSeparator = ":"; 15609 var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; 15610 var namespaces = options.ns || this.options.defaultNS; 15611 if (nsSeparator && key.indexOf(nsSeparator) > -1) { 15612 var m = key.match(this.interpolator.nestingRegexp); 15613 if (m && m.length > 0) { 15614 return { 15615 key, 15616 namespaces 15617 }; 15618 } 15619 var parts = key.split(nsSeparator); 15620 if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift(); 15621 key = parts.join(keySeparator); 15622 } 15623 if (typeof namespaces === "string") namespaces = [namespaces]; 15624 return { 15625 key, 15626 namespaces 15627 }; 15628 } 15629 }, { 15630 key: "translate", 15631 value: function translate(keys, options, lastKey) { 15632 var _this2 = this; 15633 if (_typeof(options) !== "object" && this.options.overloadTranslationOptionHandler) { 15634 options = this.options.overloadTranslationOptionHandler(arguments); 15635 } 15636 if (!options) options = {}; 15637 if (keys === void 0 || keys === null) return ""; 15638 if (!Array.isArray(keys)) keys = [String(keys)]; 15639 var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; 15640 var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces; 15641 var namespace = namespaces[namespaces.length - 1]; 15642 var lng = options.lng || this.language; 15643 var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; 15644 if (lng && lng.toLowerCase() === "cimode") { 15645 if (appendNamespaceToCIMode) { 15646 var nsSeparator = options.nsSeparator || this.options.nsSeparator; 15647 return namespace + nsSeparator + key; 15648 } 15649 return key; 15650 } 15651 var resolved = this.resolve(keys, options); 15652 var res = resolved && resolved.res; 15653 var resUsedKey = resolved && resolved.usedKey || key; 15654 var resExactUsedKey = resolved && resolved.exactUsedKey || key; 15655 var resType = Object.prototype.toString.apply(res); 15656 var noObject = ["[object Number]", "[object Function]", "[object RegExp]"]; 15657 var joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays; 15658 var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject; 15659 var handleAsObject = typeof res !== "string" && typeof res !== "boolean" && typeof res !== "number"; 15660 if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === "string" && resType === "[object Array]")) { 15661 if (!options.returnObjects && !this.options.returnObjects) { 15662 this.logger.warn("accessing an object - but returnObjects options is not enabled!"); 15663 return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, options) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string."); 15664 } 15665 if (keySeparator) { 15666 var resTypeIsArray = resType === "[object Array]"; 15667 var copy2 = resTypeIsArray ? [] : {}; 15668 var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey; 15669 for (var m in res) { 15670 if (Object.prototype.hasOwnProperty.call(res, m)) { 15671 var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m); 15672 copy2[m] = this.translate(deepKey, _objectSpread({}, options, { 15673 joinArrays: false, 15674 ns: namespaces 15675 })); 15676 if (copy2[m] === deepKey) copy2[m] = res[m]; 15677 } 15678 } 15679 res = copy2; 15680 } 15681 } else if (handleAsObjectInI18nFormat && typeof joinArrays === "string" && resType === "[object Array]") { 15682 res = res.join(joinArrays); 15683 if (res) res = this.extendTranslation(res, keys, options, lastKey); 15684 } else { 15685 var usedDefault = false; 15686 var usedKey = false; 15687 var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string"; 15688 var hasDefaultValue = Translator2.hasDefaultValue(options); 15689 var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count) : ""; 15690 var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue; 15691 if (!this.isValidLookup(res) && hasDefaultValue) { 15692 usedDefault = true; 15693 res = defaultValue; 15694 } 15695 if (!this.isValidLookup(res)) { 15696 usedKey = true; 15697 res = key; 15698 } 15699 var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing; 15700 if (usedKey || usedDefault || updateMissing) { 15701 this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res); 15702 if (keySeparator) { 15703 var fk = this.resolve(key, _objectSpread({}, options, { 15704 keySeparator: false 15705 })); 15706 if (fk && fk.res) this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format."); 15707 } 15708 var lngs = []; 15709 var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language); 15710 if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) { 15711 for (var i = 0; i < fallbackLngs.length; i++) { 15712 lngs.push(fallbackLngs[i]); 15713 } 15714 } else if (this.options.saveMissingTo === "all") { 15715 lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language); 15716 } else { 15717 lngs.push(options.lng || this.language); 15718 } 15719 var send = function send2(l, k, fallbackValue) { 15720 if (_this2.options.missingKeyHandler) { 15721 _this2.options.missingKeyHandler(l, namespace, k, updateMissing ? fallbackValue : res, updateMissing, options); 15722 } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) { 15723 _this2.backendConnector.saveMissing(l, namespace, k, updateMissing ? fallbackValue : res, updateMissing, options); 15724 } 15725 _this2.emit("missingKey", l, namespace, k, res); 15726 }; 15727 if (this.options.saveMissing) { 15728 if (this.options.saveMissingPlurals && needsPluralHandling) { 15729 lngs.forEach(function(language) { 15730 _this2.pluralResolver.getSuffixes(language).forEach(function(suffix) { 15731 send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue); 15732 }); 15733 }); 15734 } else { 15735 send(lngs, key, defaultValue); 15736 } 15737 } 15738 } 15739 res = this.extendTranslation(res, keys, options, resolved, lastKey); 15740 if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key); 15741 if (usedKey && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(res); 15742 } 15743 return res; 15744 } 15745 }, { 15746 key: "extendTranslation", 15747 value: function extendTranslation(res, key, options, resolved, lastKey) { 15748 var _this3 = this; 15749 if (this.i18nFormat && this.i18nFormat.parse) { 15750 res = this.i18nFormat.parse(res, options, resolved.usedLng, resolved.usedNS, resolved.usedKey, { 15751 resolved 15752 }); 15753 } else if (!options.skipInterpolation) { 15754 if (options.interpolation) this.interpolator.init(_objectSpread({}, options, { 15755 interpolation: _objectSpread({}, this.options.interpolation, options.interpolation) 15756 })); 15757 var skipOnVariables = options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables; 15758 var nestBef; 15759 if (skipOnVariables) { 15760 var nb = res.match(this.interpolator.nestingRegexp); 15761 nestBef = nb && nb.length; 15762 } 15763 var data = options.replace && typeof options.replace !== "string" ? options.replace : options; 15764 if (this.options.interpolation.defaultVariables) data = _objectSpread({}, this.options.interpolation.defaultVariables, data); 15765 res = this.interpolator.interpolate(res, data, options.lng || this.language, options); 15766 if (skipOnVariables) { 15767 var na = res.match(this.interpolator.nestingRegexp); 15768 var nestAft = na && na.length; 15769 if (nestBef < nestAft) options.nest = false; 15770 } 15771 if (options.nest !== false) res = this.interpolator.nest(res, function() { 15772 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 15773 args[_key] = arguments[_key]; 15774 } 15775 if (lastKey && lastKey[0] === args[0] && !options.context) { 15776 _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0])); 15777 return null; 15778 } 15779 return _this3.translate.apply(_this3, args.concat([key])); 15780 }, options); 15781 if (options.interpolation) this.interpolator.reset(); 15782 } 15783 var postProcess = options.postProcess || this.options.postProcess; 15784 var postProcessorNames = typeof postProcess === "string" ? [postProcess] : postProcess; 15785 if (res !== void 0 && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) { 15786 res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread({ 15787 i18nResolved: resolved 15788 }, options) : options, this); 15789 } 15790 return res; 15791 } 15792 }, { 15793 key: "resolve", 15794 value: function resolve(keys) { 15795 var _this4 = this; 15796 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 15797 var found; 15798 var usedKey; 15799 var exactUsedKey; 15800 var usedLng; 15801 var usedNS; 15802 if (typeof keys === "string") keys = [keys]; 15803 keys.forEach(function(k) { 15804 if (_this4.isValidLookup(found)) return; 15805 var extracted = _this4.extractFromKey(k, options); 15806 var key = extracted.key; 15807 usedKey = key; 15808 var namespaces = extracted.namespaces; 15809 if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS); 15810 var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string"; 15811 var needsContextHandling = options.context !== void 0 && typeof options.context === "string" && options.context !== ""; 15812 var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng); 15813 namespaces.forEach(function(ns) { 15814 if (_this4.isValidLookup(found)) return; 15815 usedNS = ns; 15816 if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) { 15817 checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true; 15818 _this4.logger.warn('key "'.concat(usedKey, '" for languages "').concat(codes.join(", "), `" won't get resolved as namespace "`).concat(usedNS, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); 15819 } 15820 codes.forEach(function(code) { 15821 if (_this4.isValidLookup(found)) return; 15822 usedLng = code; 15823 var finalKey = key; 15824 var finalKeys = [finalKey]; 15825 if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) { 15826 _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options); 15827 } else { 15828 var pluralSuffix; 15829 if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count); 15830 if (needsPluralHandling && needsContextHandling) finalKeys.push(finalKey + pluralSuffix); 15831 if (needsContextHandling) finalKeys.push(finalKey += "".concat(_this4.options.contextSeparator).concat(options.context)); 15832 if (needsPluralHandling) finalKeys.push(finalKey += pluralSuffix); 15833 } 15834 var possibleKey; 15835 while (possibleKey = finalKeys.pop()) { 15836 if (!_this4.isValidLookup(found)) { 15837 exactUsedKey = possibleKey; 15838 found = _this4.getResource(code, ns, possibleKey, options); 15839 } 15840 } 15841 }); 15842 }); 15843 }); 15844 return { 15845 res: found, 15846 usedKey, 15847 exactUsedKey, 15848 usedLng, 15849 usedNS 15850 }; 15851 } 15852 }, { 15853 key: "isValidLookup", 15854 value: function isValidLookup(res) { 15855 return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === ""); 15856 } 15857 }, { 15858 key: "getResource", 15859 value: function getResource(code, ns, key) { 15860 var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 15861 if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options); 15862 return this.resourceStore.getResource(code, ns, key, options); 15863 } 15864 }], [{ 15865 key: "hasDefaultValue", 15866 value: function hasDefaultValue(options) { 15867 var prefix = "defaultValue"; 15868 for (var option in options) { 15869 if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && void 0 !== options[option]) { 15870 return true; 15871 } 15872 } 15873 return false; 15874 } 15875 }]); 15876 return Translator2; 15877 }(EventEmitter); 15878 function capitalize(string) { 15879 return string.charAt(0).toUpperCase() + string.slice(1); 15880 } 15881 var LanguageUtil = function() { 15882 function LanguageUtil2(options) { 15883 _classCallCheck(this, LanguageUtil2); 15884 this.options = options; 15885 this.whitelist = this.options.supportedLngs || false; 15886 this.supportedLngs = this.options.supportedLngs || false; 15887 this.logger = baseLogger.create("languageUtils"); 15888 } 15889 _createClass(LanguageUtil2, [{ 15890 key: "getScriptPartFromCode", 15891 value: function getScriptPartFromCode(code) { 15892 if (!code || code.indexOf("-") < 0) return null; 15893 var p = code.split("-"); 15894 if (p.length === 2) return null; 15895 p.pop(); 15896 if (p[p.length - 1].toLowerCase() === "x") return null; 15897 return this.formatLanguageCode(p.join("-")); 15898 } 15899 }, { 15900 key: "getLanguagePartFromCode", 15901 value: function getLanguagePartFromCode(code) { 15902 if (!code || code.indexOf("-") < 0) return code; 15903 var p = code.split("-"); 15904 return this.formatLanguageCode(p[0]); 15905 } 15906 }, { 15907 key: "formatLanguageCode", 15908 value: function formatLanguageCode(code) { 15909 if (typeof code === "string" && code.indexOf("-") > -1) { 15910 var specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"]; 15911 var p = code.split("-"); 15912 if (this.options.lowerCaseLng) { 15913 p = p.map(function(part) { 15914 return part.toLowerCase(); 15915 }); 15916 } else if (p.length === 2) { 15917 p[0] = p[0].toLowerCase(); 15918 p[1] = p[1].toUpperCase(); 15919 if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase()); 15920 } else if (p.length === 3) { 15921 p[0] = p[0].toLowerCase(); 15922 if (p[1].length === 2) p[1] = p[1].toUpperCase(); 15923 if (p[0] !== "sgn" && p[2].length === 2) p[2] = p[2].toUpperCase(); 15924 if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase()); 15925 if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase()); 15926 } 15927 return p.join("-"); 15928 } 15929 return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code; 15930 } 15931 }, { 15932 key: "isWhitelisted", 15933 value: function isWhitelisted(code) { 15934 this.logger.deprecate("languageUtils.isWhitelisted", `function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it's usage asap.`); 15935 return this.isSupportedCode(code); 15936 } 15937 }, { 15938 key: "isSupportedCode", 15939 value: function isSupportedCode(code) { 15940 if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) { 15941 code = this.getLanguagePartFromCode(code); 15942 } 15943 return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1; 15944 } 15945 }, { 15946 key: "getBestMatchFromCodes", 15947 value: function getBestMatchFromCodes(codes) { 15948 var _this = this; 15949 if (!codes) return null; 15950 var found; 15951 codes.forEach(function(code) { 15952 if (found) return; 15953 var cleanedLng = _this.formatLanguageCode(code); 15954 if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng; 15955 }); 15956 if (!found && this.options.supportedLngs) { 15957 codes.forEach(function(code) { 15958 if (found) return; 15959 var lngOnly = _this.getLanguagePartFromCode(code); 15960 if (_this.isSupportedCode(lngOnly)) return found = lngOnly; 15961 found = _this.options.supportedLngs.find(function(supportedLng) { 15962 if (supportedLng.indexOf(lngOnly) === 0) return supportedLng; 15963 }); 15964 }); 15965 } 15966 if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0]; 15967 return found; 15968 } 15969 }, { 15970 key: "getFallbackCodes", 15971 value: function getFallbackCodes(fallbacks, code) { 15972 if (!fallbacks) return []; 15973 if (typeof fallbacks === "function") fallbacks = fallbacks(code); 15974 if (typeof fallbacks === "string") fallbacks = [fallbacks]; 15975 if (Object.prototype.toString.apply(fallbacks) === "[object Array]") return fallbacks; 15976 if (!code) return fallbacks["default"] || []; 15977 var found = fallbacks[code]; 15978 if (!found) found = fallbacks[this.getScriptPartFromCode(code)]; 15979 if (!found) found = fallbacks[this.formatLanguageCode(code)]; 15980 if (!found) found = fallbacks[this.getLanguagePartFromCode(code)]; 15981 if (!found) found = fallbacks["default"]; 15982 return found || []; 15983 } 15984 }, { 15985 key: "toResolveHierarchy", 15986 value: function toResolveHierarchy(code, fallbackCode) { 15987 var _this2 = this; 15988 var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code); 15989 var codes = []; 15990 var addCode = function addCode2(c) { 15991 if (!c) return; 15992 if (_this2.isSupportedCode(c)) { 15993 codes.push(c); 15994 } else { 15995 _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)); 15996 } 15997 }; 15998 if (typeof code === "string" && code.indexOf("-") > -1) { 15999 if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code)); 16000 if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code)); 16001 if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code)); 16002 } else if (typeof code === "string") { 16003 addCode(this.formatLanguageCode(code)); 16004 } 16005 fallbackCodes.forEach(function(fc) { 16006 if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc)); 16007 }); 16008 return codes; 16009 } 16010 }]); 16011 return LanguageUtil2; 16012 }(); 16013 var sets = [{ 16014 lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"], 16015 nr: [1, 2], 16016 fc: 1 16017 }, { 16018 lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"], 16019 nr: [1, 2], 16020 fc: 2 16021 }, { 16022 lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "kk", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"], 16023 nr: [1], 16024 fc: 3 16025 }, { 16026 lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"], 16027 nr: [1, 2, 5], 16028 fc: 4 16029 }, { 16030 lngs: ["ar"], 16031 nr: [0, 1, 2, 3, 11, 100], 16032 fc: 5 16033 }, { 16034 lngs: ["cs", "sk"], 16035 nr: [1, 2, 5], 16036 fc: 6 16037 }, { 16038 lngs: ["csb", "pl"], 16039 nr: [1, 2, 5], 16040 fc: 7 16041 }, { 16042 lngs: ["cy"], 16043 nr: [1, 2, 3, 8], 16044 fc: 8 16045 }, { 16046 lngs: ["fr"], 16047 nr: [1, 2], 16048 fc: 9 16049 }, { 16050 lngs: ["ga"], 16051 nr: [1, 2, 3, 7, 11], 16052 fc: 10 16053 }, { 16054 lngs: ["gd"], 16055 nr: [1, 2, 3, 20], 16056 fc: 11 16057 }, { 16058 lngs: ["is"], 16059 nr: [1, 2], 16060 fc: 12 16061 }, { 16062 lngs: ["jv"], 16063 nr: [0, 1], 16064 fc: 13 16065 }, { 16066 lngs: ["kw"], 16067 nr: [1, 2, 3, 4], 16068 fc: 14 16069 }, { 16070 lngs: ["lt"], 16071 nr: [1, 2, 10], 16072 fc: 15 16073 }, { 16074 lngs: ["lv"], 16075 nr: [1, 2, 0], 16076 fc: 16 16077 }, { 16078 lngs: ["mk"], 16079 nr: [1, 2], 16080 fc: 17 16081 }, { 16082 lngs: ["mnk"], 16083 nr: [0, 1, 2], 16084 fc: 18 16085 }, { 16086 lngs: ["mt"], 16087 nr: [1, 2, 11, 20], 16088 fc: 19 16089 }, { 16090 lngs: ["or"], 16091 nr: [2, 1], 16092 fc: 2 16093 }, { 16094 lngs: ["ro"], 16095 nr: [1, 2, 20], 16096 fc: 20 16097 }, { 16098 lngs: ["sl"], 16099 nr: [5, 1, 2, 3], 16100 fc: 21 16101 }, { 16102 lngs: ["he", "iw"], 16103 nr: [1, 2, 20, 21], 16104 fc: 22 16105 }]; 16106 var _rulesPluralsTypes = { 16107 1: function _(n) { 16108 return Number(n > 1); 16109 }, 16110 2: function _2(n) { 16111 return Number(n != 1); 16112 }, 16113 3: function _3(n) { 16114 return 0; 16115 }, 16116 4: function _4(n) { 16117 return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); 16118 }, 16119 5: function _5(n) { 16120 return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5); 16121 }, 16122 6: function _6(n) { 16123 return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2); 16124 }, 16125 7: function _7(n) { 16126 return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); 16127 }, 16128 8: function _8(n) { 16129 return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3); 16130 }, 16131 9: function _9(n) { 16132 return Number(n >= 2); 16133 }, 16134 10: function _10(n) { 16135 return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4); 16136 }, 16137 11: function _11(n) { 16138 return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3); 16139 }, 16140 12: function _12(n) { 16141 return Number(n % 10 != 1 || n % 100 == 11); 16142 }, 16143 13: function _13(n) { 16144 return Number(n !== 0); 16145 }, 16146 14: function _14(n) { 16147 return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3); 16148 }, 16149 15: function _15(n) { 16150 return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); 16151 }, 16152 16: function _16(n) { 16153 return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2); 16154 }, 16155 17: function _17(n) { 16156 return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1); 16157 }, 16158 18: function _18(n) { 16159 return Number(n == 0 ? 0 : n == 1 ? 1 : 2); 16160 }, 16161 19: function _19(n) { 16162 return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3); 16163 }, 16164 20: function _20(n) { 16165 return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2); 16166 }, 16167 21: function _21(n) { 16168 return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0); 16169 }, 16170 22: function _22(n) { 16171 return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3); 16172 } 16173 }; 16174 function createRules() { 16175 var rules = {}; 16176 sets.forEach(function(set) { 16177 set.lngs.forEach(function(l) { 16178 rules[l] = { 16179 numbers: set.nr, 16180 plurals: _rulesPluralsTypes[set.fc] 16181 }; 16182 }); 16183 }); 16184 return rules; 16185 } 16186 var PluralResolver = function() { 16187 function PluralResolver2(languageUtils) { 16188 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 16189 _classCallCheck(this, PluralResolver2); 16190 this.languageUtils = languageUtils; 16191 this.options = options; 16192 this.logger = baseLogger.create("pluralResolver"); 16193 this.rules = createRules(); 16194 } 16195 _createClass(PluralResolver2, [{ 16196 key: "addRule", 16197 value: function addRule(lng, obj) { 16198 this.rules[lng] = obj; 16199 } 16200 }, { 16201 key: "getRule", 16202 value: function getRule(code) { 16203 return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)]; 16204 } 16205 }, { 16206 key: "needsPlural", 16207 value: function needsPlural(code) { 16208 var rule = this.getRule(code); 16209 return rule && rule.numbers.length > 1; 16210 } 16211 }, { 16212 key: "getPluralFormsOfKey", 16213 value: function getPluralFormsOfKey(code, key) { 16214 return this.getSuffixes(code).map(function(suffix) { 16215 return key + suffix; 16216 }); 16217 } 16218 }, { 16219 key: "getSuffixes", 16220 value: function getSuffixes(code) { 16221 var _this = this; 16222 var rule = this.getRule(code); 16223 if (!rule) { 16224 return []; 16225 } 16226 return rule.numbers.map(function(number) { 16227 return _this.getSuffix(code, number); 16228 }); 16229 } 16230 }, { 16231 key: "getSuffix", 16232 value: function getSuffix(code, count) { 16233 var _this2 = this; 16234 var rule = this.getRule(code); 16235 if (rule) { 16236 var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count)); 16237 var suffix = rule.numbers[idx]; 16238 if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) { 16239 if (suffix === 2) { 16240 suffix = "plural"; 16241 } else if (suffix === 1) { 16242 suffix = ""; 16243 } 16244 } 16245 var returnSuffix = function returnSuffix2() { 16246 return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString(); 16247 }; 16248 if (this.options.compatibilityJSON === "v1") { 16249 if (suffix === 1) return ""; 16250 if (typeof suffix === "number") return "_plural_".concat(suffix.toString()); 16251 return returnSuffix(); 16252 } else if (this.options.compatibilityJSON === "v2") { 16253 return returnSuffix(); 16254 } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) { 16255 return returnSuffix(); 16256 } 16257 return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString(); 16258 } 16259 this.logger.warn("no plural rule found for: ".concat(code)); 16260 return ""; 16261 } 16262 }]); 16263 return PluralResolver2; 16264 }(); 16265 var Interpolator = function() { 16266 function Interpolator2() { 16267 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 16268 _classCallCheck(this, Interpolator2); 16269 this.logger = baseLogger.create("interpolator"); 16270 this.options = options; 16271 this.format = options.interpolation && options.interpolation.format || function(value) { 16272 return value; 16273 }; 16274 this.init(options); 16275 } 16276 _createClass(Interpolator2, [{ 16277 key: "init", 16278 value: function init() { 16279 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 16280 if (!options.interpolation) options.interpolation = { 16281 escapeValue: true 16282 }; 16283 var iOpts = options.interpolation; 16284 this.escape = iOpts.escape !== void 0 ? iOpts.escape : escape; 16285 this.escapeValue = iOpts.escapeValue !== void 0 ? iOpts.escapeValue : true; 16286 this.useRawValueToEscape = iOpts.useRawValueToEscape !== void 0 ? iOpts.useRawValueToEscape : false; 16287 this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || "{{"; 16288 this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || "}}"; 16289 this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ","; 16290 this.unescapePrefix = iOpts.unescapeSuffix ? "" : iOpts.unescapePrefix || "-"; 16291 this.unescapeSuffix = this.unescapePrefix ? "" : iOpts.unescapeSuffix || ""; 16292 this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape("$t("); 16293 this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(")"); 16294 this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ","; 16295 this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1e3; 16296 this.alwaysFormat = iOpts.alwaysFormat !== void 0 ? iOpts.alwaysFormat : false; 16297 this.resetRegExp(); 16298 } 16299 }, { 16300 key: "reset", 16301 value: function reset() { 16302 if (this.options) this.init(this.options); 16303 } 16304 }, { 16305 key: "resetRegExp", 16306 value: function resetRegExp() { 16307 var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix); 16308 this.regexp = new RegExp(regexpStr, "g"); 16309 var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix); 16310 this.regexpUnescape = new RegExp(regexpUnescapeStr, "g"); 16311 var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix); 16312 this.nestingRegexp = new RegExp(nestingRegexpStr, "g"); 16313 } 16314 }, { 16315 key: "interpolate", 16316 value: function interpolate(str, data, lng, options) { 16317 var _this = this; 16318 var match; 16319 var value; 16320 var replaces; 16321 var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}; 16322 function regexSafe(val) { 16323 return val.replace(/\$/g, "$$$$"); 16324 } 16325 var handleFormat = function handleFormat2(key) { 16326 if (key.indexOf(_this.formatSeparator) < 0) { 16327 var path = getPathWithDefaults(data, defaultData, key); 16328 return _this.alwaysFormat ? _this.format(path, void 0, lng) : path; 16329 } 16330 var p = key.split(_this.formatSeparator); 16331 var k = p.shift().trim(); 16332 var f = p.join(_this.formatSeparator).trim(); 16333 return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, options); 16334 }; 16335 this.resetRegExp(); 16336 var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler; 16337 var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables; 16338 var todos = [{ 16339 regex: this.regexpUnescape, 16340 safeValue: function safeValue(val) { 16341 return regexSafe(val); 16342 } 16343 }, { 16344 regex: this.regexp, 16345 safeValue: function safeValue(val) { 16346 return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val); 16347 } 16348 }]; 16349 todos.forEach(function(todo) { 16350 replaces = 0; 16351 while (match = todo.regex.exec(str)) { 16352 value = handleFormat(match[1].trim()); 16353 if (value === void 0) { 16354 if (typeof missingInterpolationHandler === "function") { 16355 var temp = missingInterpolationHandler(str, match, options); 16356 value = typeof temp === "string" ? temp : ""; 16357 } else if (skipOnVariables) { 16358 value = match[0]; 16359 continue; 16360 } else { 16361 _this.logger.warn("missed to pass in variable ".concat(match[1], " for interpolating ").concat(str)); 16362 value = ""; 16363 } 16364 } else if (typeof value !== "string" && !_this.useRawValueToEscape) { 16365 value = makeString(value); 16366 } 16367 str = str.replace(match[0], todo.safeValue(value)); 16368 todo.regex.lastIndex = 0; 16369 replaces++; 16370 if (replaces >= _this.maxReplaces) { 16371 break; 16372 } 16373 } 16374 }); 16375 return str; 16376 } 16377 }, { 16378 key: "nest", 16379 value: function nest(str, fc) { 16380 var _this2 = this; 16381 var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 16382 var match; 16383 var value; 16384 var clonedOptions = _objectSpread({}, options); 16385 clonedOptions.applyPostProcessor = false; 16386 delete clonedOptions.defaultValue; 16387 function handleHasOptions(key, inheritedOptions) { 16388 var sep = this.nestingOptionsSeparator; 16389 if (key.indexOf(sep) < 0) return key; 16390 var c = key.split(new RegExp("".concat(sep, "[ ]*{"))); 16391 var optionsString = "{".concat(c[1]); 16392 key = c[0]; 16393 optionsString = this.interpolate(optionsString, clonedOptions); 16394 optionsString = optionsString.replace(/'/g, '"'); 16395 try { 16396 clonedOptions = JSON.parse(optionsString); 16397 if (inheritedOptions) clonedOptions = _objectSpread({}, inheritedOptions, clonedOptions); 16398 } catch (e) { 16399 this.logger.warn("failed parsing options string in nesting for key ".concat(key), e); 16400 return "".concat(key).concat(sep).concat(optionsString); 16401 } 16402 delete clonedOptions.defaultValue; 16403 return key; 16404 } 16405 while (match = this.nestingRegexp.exec(str)) { 16406 var formatters = []; 16407 var doReduce = false; 16408 if (match[0].includes(this.formatSeparator) && !/{.*}/.test(match[1])) { 16409 var r = match[1].split(this.formatSeparator).map(function(elem) { 16410 return elem.trim(); 16411 }); 16412 match[1] = r.shift(); 16413 formatters = r; 16414 doReduce = true; 16415 } 16416 value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions); 16417 if (value && match[0] === str && typeof value !== "string") return value; 16418 if (typeof value !== "string") value = makeString(value); 16419 if (!value) { 16420 this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str)); 16421 value = ""; 16422 } 16423 if (doReduce) { 16424 value = formatters.reduce(function(v, f) { 16425 return _this2.format(v, f, options.lng, options); 16426 }, value.trim()); 16427 } 16428 str = str.replace(match[0], value); 16429 this.regexp.lastIndex = 0; 16430 } 16431 return str; 16432 } 16433 }]); 16434 return Interpolator2; 16435 }(); 16436 function remove(arr, what) { 16437 var found = arr.indexOf(what); 16438 while (found !== -1) { 16439 arr.splice(found, 1); 16440 found = arr.indexOf(what); 16441 } 16442 } 16443 var Connector = function(_EventEmitter) { 16444 _inherits(Connector2, _EventEmitter); 16445 function Connector2(backend, store, services) { 16446 var _this; 16447 var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 16448 _classCallCheck(this, Connector2); 16449 _this = _possibleConstructorReturn(this, _getPrototypeOf(Connector2).call(this)); 16450 if (isIE10) { 16451 EventEmitter.call(_assertThisInitialized(_this)); 16452 } 16453 _this.backend = backend; 16454 _this.store = store; 16455 _this.services = services; 16456 _this.languageUtils = services.languageUtils; 16457 _this.options = options; 16458 _this.logger = baseLogger.create("backendConnector"); 16459 _this.state = {}; 16460 _this.queue = []; 16461 if (_this.backend && _this.backend.init) { 16462 _this.backend.init(services, options.backend, options); 16463 } 16464 return _this; 16465 } 16466 _createClass(Connector2, [{ 16467 key: "queueLoad", 16468 value: function queueLoad(languages, namespaces, options, callback) { 16469 var _this2 = this; 16470 var toLoad = []; 16471 var pending = []; 16472 var toLoadLanguages = []; 16473 var toLoadNamespaces = []; 16474 languages.forEach(function(lng) { 16475 var hasAllNamespaces = true; 16476 namespaces.forEach(function(ns) { 16477 var name = "".concat(lng, "|").concat(ns); 16478 if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) { 16479 _this2.state[name] = 2; 16480 } else if (_this2.state[name] < 0) ; 16481 else if (_this2.state[name] === 1) { 16482 if (pending.indexOf(name) < 0) pending.push(name); 16483 } else { 16484 _this2.state[name] = 1; 16485 hasAllNamespaces = false; 16486 if (pending.indexOf(name) < 0) pending.push(name); 16487 if (toLoad.indexOf(name) < 0) toLoad.push(name); 16488 if (toLoadNamespaces.indexOf(ns) < 0) toLoadNamespaces.push(ns); 16489 } 16490 }); 16491 if (!hasAllNamespaces) toLoadLanguages.push(lng); 16492 }); 16493 if (toLoad.length || pending.length) { 16494 this.queue.push({ 16495 pending, 16496 loaded: {}, 16497 errors: [], 16498 callback 16499 }); 16500 } 16501 return { 16502 toLoad, 16503 pending, 16504 toLoadLanguages, 16505 toLoadNamespaces 16506 }; 16507 } 16508 }, { 16509 key: "loaded", 16510 value: function loaded(name, err, data) { 16511 var s = name.split("|"); 16512 var lng = s[0]; 16513 var ns = s[1]; 16514 if (err) this.emit("failedLoading", lng, ns, err); 16515 if (data) { 16516 this.store.addResourceBundle(lng, ns, data); 16517 } 16518 this.state[name] = err ? -1 : 2; 16519 var loaded2 = {}; 16520 this.queue.forEach(function(q) { 16521 pushPath(q.loaded, [lng], ns); 16522 remove(q.pending, name); 16523 if (err) q.errors.push(err); 16524 if (q.pending.length === 0 && !q.done) { 16525 Object.keys(q.loaded).forEach(function(l) { 16526 if (!loaded2[l]) loaded2[l] = []; 16527 if (q.loaded[l].length) { 16528 q.loaded[l].forEach(function(ns2) { 16529 if (loaded2[l].indexOf(ns2) < 0) loaded2[l].push(ns2); 16530 }); 16531 } 16532 }); 16533 q.done = true; 16534 if (q.errors.length) { 16535 q.callback(q.errors); 16536 } else { 16537 q.callback(); 16538 } 16539 } 16540 }); 16541 this.emit("loaded", loaded2); 16542 this.queue = this.queue.filter(function(q) { 16543 return !q.done; 16544 }); 16545 } 16546 }, { 16547 key: "read", 16548 value: function read(lng, ns, fcName) { 16549 var _this3 = this; 16550 var tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; 16551 var wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 350; 16552 var callback = arguments.length > 5 ? arguments[5] : void 0; 16553 if (!lng.length) return callback(null, {}); 16554 return this.backend[fcName](lng, ns, function(err, data) { 16555 if (err && data && tried < 5) { 16556 setTimeout(function() { 16557 _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback); 16558 }, wait); 16559 return; 16560 } 16561 callback(err, data); 16562 }); 16563 } 16564 }, { 16565 key: "prepareLoading", 16566 value: function prepareLoading(languages, namespaces) { 16567 var _this4 = this; 16568 var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 16569 var callback = arguments.length > 3 ? arguments[3] : void 0; 16570 if (!this.backend) { 16571 this.logger.warn("No backend was added via i18next.use. Will not load resources."); 16572 return callback && callback(); 16573 } 16574 if (typeof languages === "string") languages = this.languageUtils.toResolveHierarchy(languages); 16575 if (typeof namespaces === "string") namespaces = [namespaces]; 16576 var toLoad = this.queueLoad(languages, namespaces, options, callback); 16577 if (!toLoad.toLoad.length) { 16578 if (!toLoad.pending.length) callback(); 16579 return null; 16580 } 16581 toLoad.toLoad.forEach(function(name) { 16582 _this4.loadOne(name); 16583 }); 16584 } 16585 }, { 16586 key: "load", 16587 value: function load(languages, namespaces, callback) { 16588 this.prepareLoading(languages, namespaces, {}, callback); 16589 } 16590 }, { 16591 key: "reload", 16592 value: function reload(languages, namespaces, callback) { 16593 this.prepareLoading(languages, namespaces, { 16594 reload: true 16595 }, callback); 16596 } 16597 }, { 16598 key: "loadOne", 16599 value: function loadOne(name) { 16600 var _this5 = this; 16601 var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; 16602 var s = name.split("|"); 16603 var lng = s[0]; 16604 var ns = s[1]; 16605 this.read(lng, ns, "read", void 0, void 0, function(err, data) { 16606 if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err); 16607 if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data); 16608 _this5.loaded(name, err, data); 16609 }); 16610 } 16611 }, { 16612 key: "saveMissing", 16613 value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) { 16614 var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}; 16615 if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) { 16616 this.logger.warn('did not save key "'.concat(key, '" as the namespace "').concat(namespace, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); 16617 return; 16618 } 16619 if (key === void 0 || key === null || key === "") return; 16620 if (this.backend && this.backend.create) { 16621 this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread({}, options, { 16622 isUpdate 16623 })); 16624 } 16625 if (!languages || !languages[0]) return; 16626 this.store.addResource(languages[0], namespace, key, fallbackValue); 16627 } 16628 }]); 16629 return Connector2; 16630 }(EventEmitter); 16631 function get() { 16632 return { 16633 debug: false, 16634 initImmediate: true, 16635 ns: ["translation"], 16636 defaultNS: ["translation"], 16637 fallbackLng: ["dev"], 16638 fallbackNS: false, 16639 whitelist: false, 16640 nonExplicitWhitelist: false, 16641 supportedLngs: false, 16642 nonExplicitSupportedLngs: false, 16643 load: "all", 16644 preload: false, 16645 simplifyPluralSuffix: true, 16646 keySeparator: ".", 16647 nsSeparator: ":", 16648 pluralSeparator: "_", 16649 contextSeparator: "_", 16650 partialBundledLanguages: false, 16651 saveMissing: false, 16652 updateMissing: false, 16653 saveMissingTo: "fallback", 16654 saveMissingPlurals: true, 16655 missingKeyHandler: false, 16656 missingInterpolationHandler: false, 16657 postProcess: false, 16658 postProcessPassResolved: false, 16659 returnNull: true, 16660 returnEmptyString: true, 16661 returnObjects: false, 16662 joinArrays: false, 16663 returnedObjectHandler: false, 16664 parseMissingKeyHandler: false, 16665 appendNamespaceToMissingKey: false, 16666 appendNamespaceToCIMode: false, 16667 overloadTranslationOptionHandler: function handle2(args) { 16668 var ret = {}; 16669 if (_typeof(args[1]) === "object") ret = args[1]; 16670 if (typeof args[1] === "string") ret.defaultValue = args[1]; 16671 if (typeof args[2] === "string") ret.tDescription = args[2]; 16672 if (_typeof(args[2]) === "object" || _typeof(args[3]) === "object") { 16673 var options = args[3] || args[2]; 16674 Object.keys(options).forEach(function(key) { 16675 ret[key] = options[key]; 16676 }); 16677 } 16678 return ret; 16679 }, 16680 interpolation: { 16681 escapeValue: true, 16682 format: function format(value, _format, lng, options) { 16683 return value; 16684 }, 16685 prefix: "{{", 16686 suffix: "}}", 16687 formatSeparator: ",", 16688 unescapePrefix: "-", 16689 nestingPrefix: "$t(", 16690 nestingSuffix: ")", 16691 nestingOptionsSeparator: ",", 16692 maxReplaces: 1e3, 16693 skipOnVariables: false 16694 } 16695 }; 16696 } 16697 function transformOptions(options) { 16698 if (typeof options.ns === "string") options.ns = [options.ns]; 16699 if (typeof options.fallbackLng === "string") options.fallbackLng = [options.fallbackLng]; 16700 if (typeof options.fallbackNS === "string") options.fallbackNS = [options.fallbackNS]; 16701 if (options.whitelist) { 16702 if (options.whitelist && options.whitelist.indexOf("cimode") < 0) { 16703 options.whitelist = options.whitelist.concat(["cimode"]); 16704 } 16705 options.supportedLngs = options.whitelist; 16706 } 16707 if (options.nonExplicitWhitelist) { 16708 options.nonExplicitSupportedLngs = options.nonExplicitWhitelist; 16709 } 16710 if (options.supportedLngs && options.supportedLngs.indexOf("cimode") < 0) { 16711 options.supportedLngs = options.supportedLngs.concat(["cimode"]); 16712 } 16713 return options; 16714 } 16715 function noop() { 16716 } 16717 var I18n = function(_EventEmitter) { 16718 _inherits(I18n2, _EventEmitter); 16719 function I18n2() { 16720 var _this; 16721 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 16722 var callback = arguments.length > 1 ? arguments[1] : void 0; 16723 _classCallCheck(this, I18n2); 16724 _this = _possibleConstructorReturn(this, _getPrototypeOf(I18n2).call(this)); 16725 if (isIE10) { 16726 EventEmitter.call(_assertThisInitialized(_this)); 16727 } 16728 _this.options = transformOptions(options); 16729 _this.services = {}; 16730 _this.logger = baseLogger; 16731 _this.modules = { 16732 external: [] 16733 }; 16734 if (callback && !_this.isInitialized && !options.isClone) { 16735 if (!_this.options.initImmediate) { 16736 _this.init(options, callback); 16737 return _possibleConstructorReturn(_this, _assertThisInitialized(_this)); 16738 } 16739 setTimeout(function() { 16740 _this.init(options, callback); 16741 }, 0); 16742 } 16743 return _this; 16744 } 16745 _createClass(I18n2, [{ 16746 key: "init", 16747 value: function init() { 16748 var _this2 = this; 16749 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 16750 var callback = arguments.length > 1 ? arguments[1] : void 0; 16751 if (typeof options === "function") { 16752 callback = options; 16753 options = {}; 16754 } 16755 if (options.whitelist && !options.supportedLngs) { 16756 this.logger.deprecate("whitelist", 'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'); 16757 } 16758 if (options.nonExplicitWhitelist && !options.nonExplicitSupportedLngs) { 16759 this.logger.deprecate("whitelist", 'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'); 16760 } 16761 this.options = _objectSpread({}, get(), this.options, transformOptions(options)); 16762 this.format = this.options.interpolation.format; 16763 if (!callback) callback = noop; 16764 function createClassOnDemand(ClassOrObject) { 16765 if (!ClassOrObject) return null; 16766 if (typeof ClassOrObject === "function") return new ClassOrObject(); 16767 return ClassOrObject; 16768 } 16769 if (!this.options.isClone) { 16770 if (this.modules.logger) { 16771 baseLogger.init(createClassOnDemand(this.modules.logger), this.options); 16772 } else { 16773 baseLogger.init(null, this.options); 16774 } 16775 var lu = new LanguageUtil(this.options); 16776 this.store = new ResourceStore(this.options.resources, this.options); 16777 var s = this.services; 16778 s.logger = baseLogger; 16779 s.resourceStore = this.store; 16780 s.languageUtils = lu; 16781 s.pluralResolver = new PluralResolver(lu, { 16782 prepend: this.options.pluralSeparator, 16783 compatibilityJSON: this.options.compatibilityJSON, 16784 simplifyPluralSuffix: this.options.simplifyPluralSuffix 16785 }); 16786 s.interpolator = new Interpolator(this.options); 16787 s.utils = { 16788 hasLoadedNamespace: this.hasLoadedNamespace.bind(this) 16789 }; 16790 s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options); 16791 s.backendConnector.on("*", function(event) { 16792 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 16793 args[_key - 1] = arguments[_key]; 16794 } 16795 _this2.emit.apply(_this2, [event].concat(args)); 16796 }); 16797 if (this.modules.languageDetector) { 16798 s.languageDetector = createClassOnDemand(this.modules.languageDetector); 16799 s.languageDetector.init(s, this.options.detection, this.options); 16800 } 16801 if (this.modules.i18nFormat) { 16802 s.i18nFormat = createClassOnDemand(this.modules.i18nFormat); 16803 if (s.i18nFormat.init) s.i18nFormat.init(this); 16804 } 16805 this.translator = new Translator(this.services, this.options); 16806 this.translator.on("*", function(event) { 16807 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 16808 args[_key2 - 1] = arguments[_key2]; 16809 } 16810 _this2.emit.apply(_this2, [event].concat(args)); 16811 }); 16812 this.modules.external.forEach(function(m) { 16813 if (m.init) m.init(_this2); 16814 }); 16815 } 16816 if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { 16817 var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); 16818 if (codes.length > 0 && codes[0] !== "dev") this.options.lng = codes[0]; 16819 } 16820 if (!this.services.languageDetector && !this.options.lng) { 16821 this.logger.warn("init: no languageDetector is used and no lng is defined"); 16822 } 16823 var storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"]; 16824 storeApi.forEach(function(fcName) { 16825 _this2[fcName] = function() { 16826 var _this2$store; 16827 return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments); 16828 }; 16829 }); 16830 var storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"]; 16831 storeApiChained.forEach(function(fcName) { 16832 _this2[fcName] = function() { 16833 var _this2$store2; 16834 (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments); 16835 return _this2; 16836 }; 16837 }); 16838 var deferred = defer(); 16839 var load = function load2() { 16840 var finish = function finish2(err, t) { 16841 if (_this2.isInitialized) _this2.logger.warn("init: i18next is already initialized. You should call init just once!"); 16842 _this2.isInitialized = true; 16843 if (!_this2.options.isClone) _this2.logger.log("initialized", _this2.options); 16844 _this2.emit("initialized", _this2.options); 16845 deferred.resolve(t); 16846 callback(err, t); 16847 }; 16848 if (_this2.languages && _this2.options.compatibilityAPI !== "v1" && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2)); 16849 _this2.changeLanguage(_this2.options.lng, finish); 16850 }; 16851 if (this.options.resources || !this.options.initImmediate) { 16852 load(); 16853 } else { 16854 setTimeout(load, 0); 16855 } 16856 return deferred; 16857 } 16858 }, { 16859 key: "loadResources", 16860 value: function loadResources(language) { 16861 var _this3 = this; 16862 var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop; 16863 var usedCallback = callback; 16864 var usedLng = typeof language === "string" ? language : this.language; 16865 if (typeof language === "function") usedCallback = language; 16866 if (!this.options.resources || this.options.partialBundledLanguages) { 16867 if (usedLng && usedLng.toLowerCase() === "cimode") return usedCallback(); 16868 var toLoad = []; 16869 var append = function append2(lng) { 16870 if (!lng) return; 16871 var lngs = _this3.services.languageUtils.toResolveHierarchy(lng); 16872 lngs.forEach(function(l) { 16873 if (toLoad.indexOf(l) < 0) toLoad.push(l); 16874 }); 16875 }; 16876 if (!usedLng) { 16877 var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); 16878 fallbacks.forEach(function(l) { 16879 return append(l); 16880 }); 16881 } else { 16882 append(usedLng); 16883 } 16884 if (this.options.preload) { 16885 this.options.preload.forEach(function(l) { 16886 return append(l); 16887 }); 16888 } 16889 this.services.backendConnector.load(toLoad, this.options.ns, usedCallback); 16890 } else { 16891 usedCallback(null); 16892 } 16893 } 16894 }, { 16895 key: "reloadResources", 16896 value: function reloadResources(lngs, ns, callback) { 16897 var deferred = defer(); 16898 if (!lngs) lngs = this.languages; 16899 if (!ns) ns = this.options.ns; 16900 if (!callback) callback = noop; 16901 this.services.backendConnector.reload(lngs, ns, function(err) { 16902 deferred.resolve(); 16903 callback(err); 16904 }); 16905 return deferred; 16906 } 16907 }, { 16908 key: "use", 16909 value: function use(module) { 16910 if (!module) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()"); 16911 if (!module.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()"); 16912 if (module.type === "backend") { 16913 this.modules.backend = module; 16914 } 16915 if (module.type === "logger" || module.log && module.warn && module.error) { 16916 this.modules.logger = module; 16917 } 16918 if (module.type === "languageDetector") { 16919 this.modules.languageDetector = module; 16920 } 16921 if (module.type === "i18nFormat") { 16922 this.modules.i18nFormat = module; 16923 } 16924 if (module.type === "postProcessor") { 16925 postProcessor.addPostProcessor(module); 16926 } 16927 if (module.type === "3rdParty") { 16928 this.modules.external.push(module); 16929 } 16930 return this; 16931 } 16932 }, { 16933 key: "changeLanguage", 16934 value: function changeLanguage(lng, callback) { 16935 var _this4 = this; 16936 this.isLanguageChangingTo = lng; 16937 var deferred = defer(); 16938 this.emit("languageChanging", lng); 16939 var done = function done2(err, l) { 16940 if (l) { 16941 _this4.language = l; 16942 _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l); 16943 _this4.translator.changeLanguage(l); 16944 _this4.isLanguageChangingTo = void 0; 16945 _this4.emit("languageChanged", l); 16946 _this4.logger.log("languageChanged", l); 16947 } else { 16948 _this4.isLanguageChangingTo = void 0; 16949 } 16950 deferred.resolve(function() { 16951 return _this4.t.apply(_this4, arguments); 16952 }); 16953 if (callback) callback(err, function() { 16954 return _this4.t.apply(_this4, arguments); 16955 }); 16956 }; 16957 var setLng = function setLng2(lngs) { 16958 var l = typeof lngs === "string" ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs); 16959 if (l) { 16960 if (!_this4.language) { 16961 _this4.language = l; 16962 _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l); 16963 } 16964 if (!_this4.translator.language) _this4.translator.changeLanguage(l); 16965 if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l); 16966 } 16967 _this4.loadResources(l, function(err) { 16968 done(err, l); 16969 }); 16970 }; 16971 if (!lng && this.services.languageDetector && !this.services.languageDetector.async) { 16972 setLng(this.services.languageDetector.detect()); 16973 } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) { 16974 this.services.languageDetector.detect(setLng); 16975 } else { 16976 setLng(lng); 16977 } 16978 return deferred; 16979 } 16980 }, { 16981 key: "getFixedT", 16982 value: function getFixedT(lng, ns) { 16983 var _this5 = this; 16984 var fixedT = function fixedT2(key, opts) { 16985 var options; 16986 if (_typeof(opts) !== "object") { 16987 for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { 16988 rest[_key3 - 2] = arguments[_key3]; 16989 } 16990 options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest)); 16991 } else { 16992 options = _objectSpread({}, opts); 16993 } 16994 options.lng = options.lng || fixedT2.lng; 16995 options.lngs = options.lngs || fixedT2.lngs; 16996 options.ns = options.ns || fixedT2.ns; 16997 return _this5.t(key, options); 16998 }; 16999 if (typeof lng === "string") { 17000 fixedT.lng = lng; 17001 } else { 17002 fixedT.lngs = lng; 17003 } 17004 fixedT.ns = ns; 17005 return fixedT; 17006 } 17007 }, { 17008 key: "t", 17009 value: function t() { 17010 var _this$translator; 17011 return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments); 17012 } 17013 }, { 17014 key: "exists", 17015 value: function exists() { 17016 var _this$translator2; 17017 return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments); 17018 } 17019 }, { 17020 key: "setDefaultNamespace", 17021 value: function setDefaultNamespace(ns) { 17022 this.options.defaultNS = ns; 17023 } 17024 }, { 17025 key: "hasLoadedNamespace", 17026 value: function hasLoadedNamespace(ns) { 17027 var _this6 = this; 17028 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 17029 if (!this.isInitialized) { 17030 this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages); 17031 return false; 17032 } 17033 if (!this.languages || !this.languages.length) { 17034 this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages); 17035 return false; 17036 } 17037 var lng = this.languages[0]; 17038 var fallbackLng = this.options ? this.options.fallbackLng : false; 17039 var lastLng = this.languages[this.languages.length - 1]; 17040 if (lng.toLowerCase() === "cimode") return true; 17041 var loadNotPending = function loadNotPending2(l, n) { 17042 var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)]; 17043 return loadState === -1 || loadState === 2; 17044 }; 17045 if (options.precheck) { 17046 var preResult = options.precheck(this, loadNotPending); 17047 if (preResult !== void 0) return preResult; 17048 } 17049 if (this.hasResourceBundle(lng, ns)) return true; 17050 if (!this.services.backendConnector.backend) return true; 17051 if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true; 17052 return false; 17053 } 17054 }, { 17055 key: "loadNamespaces", 17056 value: function loadNamespaces(ns, callback) { 17057 var _this7 = this; 17058 var deferred = defer(); 17059 if (!this.options.ns) { 17060 callback && callback(); 17061 return Promise.resolve(); 17062 } 17063 if (typeof ns === "string") ns = [ns]; 17064 ns.forEach(function(n) { 17065 if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n); 17066 }); 17067 this.loadResources(function(err) { 17068 deferred.resolve(); 17069 if (callback) callback(err); 17070 }); 17071 return deferred; 17072 } 17073 }, { 17074 key: "loadLanguages", 17075 value: function loadLanguages(lngs, callback) { 17076 var deferred = defer(); 17077 if (typeof lngs === "string") lngs = [lngs]; 17078 var preloaded = this.options.preload || []; 17079 var newLngs = lngs.filter(function(lng) { 17080 return preloaded.indexOf(lng) < 0; 17081 }); 17082 if (!newLngs.length) { 17083 if (callback) callback(); 17084 return Promise.resolve(); 17085 } 17086 this.options.preload = preloaded.concat(newLngs); 17087 this.loadResources(function(err) { 17088 deferred.resolve(); 17089 if (callback) callback(err); 17090 }); 17091 return deferred; 17092 } 17093 }, { 17094 key: "dir", 17095 value: function dir(lng) { 17096 if (!lng) lng = this.languages && this.languages.length > 0 ? this.languages[0] : this.language; 17097 if (!lng) return "rtl"; 17098 var rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam"]; 17099 return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) >= 0 ? "rtl" : "ltr"; 17100 } 17101 }, { 17102 key: "createInstance", 17103 value: function createInstance() { 17104 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 17105 var callback = arguments.length > 1 ? arguments[1] : void 0; 17106 return new I18n2(options, callback); 17107 } 17108 }, { 17109 key: "cloneInstance", 17110 value: function cloneInstance() { 17111 var _this8 = this; 17112 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 17113 var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop; 17114 var mergedOptions = _objectSpread({}, this.options, options, { 17115 isClone: true 17116 }); 17117 var clone = new I18n2(mergedOptions); 17118 var membersToCopy = ["store", "services", "language"]; 17119 membersToCopy.forEach(function(m) { 17120 clone[m] = _this8[m]; 17121 }); 17122 clone.services = _objectSpread({}, this.services); 17123 clone.services.utils = { 17124 hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) 17125 }; 17126 clone.translator = new Translator(clone.services, clone.options); 17127 clone.translator.on("*", function(event) { 17128 for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { 17129 args[_key4 - 1] = arguments[_key4]; 17130 } 17131 clone.emit.apply(clone, [event].concat(args)); 17132 }); 17133 clone.init(mergedOptions, callback); 17134 clone.translator.options = clone.options; 17135 clone.translator.backendConnector.services.utils = { 17136 hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) 17137 }; 17138 return clone; 17139 } 17140 }]); 17141 return I18n2; 17142 }(EventEmitter); 17143 var i18next = new I18n(); 17144 var i18next_default = i18next; 17145 17146
17146// app/javascript/i18n-js/locales/locales.json 17147 var locales_default = { 17148 en: { 17149 stimulus: { 17150 application: null, 17151 admin_editor: { 17152 confirm_message: "You have made changes to this blog post, are you sure you want to proceed? This can't be undone.", 17153 save_button_text: "Save Changes", 17154 save_reload_button_text: "Save & Reload" 17155 }, 17156 clipboard_copy: { 17157 click_to_copy: "Click To Copy" 17158 }, 17159 sortable: { 17160 sort_order_saved: "Sort order saved", 17161 failed_to_save: "Failed to save sort order" 17162 }, 17163 commons: null, 17164 index_sort: { 17165 a_to_z: "A-Z", 17166 false_first: "false first", 17167 high_to_low: "high to low", 17168 low_to_high: "low to high", 17169 newest_first: "newest first", 17170 oldest_first: "oldest first", 17171 true_fist: "true first", 17172 z_to_a: "Z-A" 17173 }, 17174 web_awesome: { 17175 confirm: { 17176 cancel: "Cancel", 17177 submit: "Proceed", 17178 title: "Are you sure?", 17179 type_to_confirm: "Type %{word} to confirm" 17180 } 17181 }, 17182 simonwep_pickr: { 17183 "aria:btncancel": "cancel and close", 17184 "aria:btnclear": "clear and close", 17185 "aria:btnsave": "save and close", 17186 "aria:hue": "hue selection slider", 17187 "aria:input": "color input field", 17188 "aria:opacity": "selection slider", 17189 "aria:palette": "color selection area", 17190 "btn:cancel": "Cancel", 17191 "btn:clear": "Clear", 17192 "btn:lastcolor": "use previous color", 17193 "btn:save": "Save", 17194 "btn:swatch": "color swatch", 17195 "btn:toggle": "toggle color picker dialog", 17196 "ui:dialog": "color picker dialog" 17197 }, 17198 password_validation: { 17199 min_length: "Must be at least 12 characters long", 17200 uppercase: "Must contain at least one uppercase letter", 17201 lowercase: "Must contain at least one lowercase letter", 17202 number: "Must contain at least one number", 17203 special: "Must contain at least one special character" 17204 }, 17205 shrine_image_uploads: { 17206 limit_exceeded: "You can only upload up to %{limit} images", 17207 file_too_large: "File size must be less than 10 MB", 17208 invalid_file_type: "Only JPEG, PNG, WebP, and GIF images are allowed", 17209 upload_failed: "Failed to upload image" 17210 }, 17211 asset_upload: { 17212 file_rejected: 'File "%{name}" was rejected: %{error}', 17213 error_adding_file: "Error adding file: %{error}", 17214 preparing_upload: "Preparing upload...", 17215 uploading: "Uploading... (%{uploaded} / %{total})", 17216 processing: "Processing...", 17217 upload_completed: "Upload completed successfully", 17218 upload_failed: "Upload failed - %{error}", 17219 failed_to_create: "Failed to save file: %{error}", 17220 created_as: "Added as %{type}", 17221 batch_summary: "Added %{summary}", 17222 upload_failed_count: "%{count} files failed to upload", 17223 types: { 17224 image_one: "%{count} Image", 17225 image_other: "%{count} Images", 17226 video_one: "%{count} Course Video", 17227 video_other: "%{count} Course Videos", 17228 audio_file_one: "%{count} Audio File", 17229 audio_file_other: "%{count} Audio Files", 17230 font_one: "%{count} Font", 17231 font_other: "%{count} Fonts", 17232 download_one: "%{count} File", 17233 download_other: "%{count} Files" 17234 }, 17235 type_names: { 17236 image: "Image", 17237 video: "Course Video", 17238 audio_file: "Audio File", 17239 font: "Font", 17240 download: "File" 17241 }, 17242 uploading_generic: "Uploading...", 17243 file_size: "%{size} %{unit}", 17244 units: { 17245 bytes: "Bytes", 17246 kb: "KB", 17247 mb: "MB", 17248 gb: "GB", 17249 tb: "TB" 17250 } 17251 } 17252 }, 17253 domains: { 17254 wizard: { 17255 continue_button: "Continue with %{domain}" 17256 } 17257 }, 17258 trix: { 17259 GB: "GB", 17260 KB: "KB", 17261 MB: "MB", 17262 PB: "PB", 17263 TB: "TB", 17264 attachFiles: "Attach Files", 17265 bold: "Bold", 17266 bullets: "Bullets", 17267 byte: "Byte", 17268 bytes: "Bytes", 17269 captionPlaceholder: "Add a caption\u2026", 17270 code: "Code", 17271 heading1: "Heading", 17272 indent: "Increase Level", 17273 italic: "Italic", 17274 link: "Link", 17275 numbers: "Numbers",
17276 outdent: "Decrease Level", 17277 quote: "Quote", 17278 redo: "Redo", 17279 remove: "Remove", 17280 strike: "Strikethrough", 17281 undo: "Undo", 17282 unlink: "Unlink", 17283 url: "URL", 17284 urlPlaceholder: "Enter a URL\u2026" 17285 }, 17286 activity_chart_controller: { 17287 commissions: "Commissions", 17288 pageviews: "Pageviews", 17289 trial_starts: "Trial Starts", 17290 optins: "Opt-ins", 17291 conversions: "Conversions" 17292 }, 17293 unsaved_changes_controller: { 17294 haveChanges: "You've made changes that haven't been saved. Clicking 'OK' will discard them. Do you want to continue?", 17295 noChanges: "No Unsaved Changes" 17296 }, 17297 direct_image_uploads_controller: { 17298 limit_exceeded: "You can only upload up to %{limit} files", 17299 too_large: "File size must be less than 10 MB" 17300 }, 17301 discounts: { 17302 amount_required: "Amount is required", 17303 percent_required: "Percent is required" 17304 }, 17305 notifications: { 17306 push_notification_settings: { 17307 title: "Push Notifications", 17308 checking: "Checking...", 17309 checking_status: "Checking notification status...", 17310 open_settings: "Open Notification Settings", 17311 send_test_noticed: "Send Test Push (Noticed)", 17312 send_test_direct: "Send Test Push (Direct)", 17313 no_devices_or_app_id: "No devices found or native app config not configured", 17314 message: { 17315 device_blocked: "Notifications are blocked on this device. Enable them in your device settings to receive notifications.", 17316 app_disabled: "Push notifications are turned off. Turn them on to receive updates.", 17317 enabled: "Push notifications are enabled. You'll receive notifications on this device.", 17318 not_determined: "Allow notifications to stay updated.", 17319 unknown: "Unable to determine notification status." 17320 } 17321 } 17322 } 17323 }, 17324 es: { 17325 stimulus: { 17326 admin_editor: { 17327 confirm_message: "Has realizado cambios en esta publicaci\xF3n del blog, \xBFest\xE1s seguro de que deseas continuar? Esto no se puede deshacer.", 17328 save_button_text: "Guardar Cambios", 17329 save_reload_button_text: "Guardar y Recargar" 17330 }, 17331 clipboard_copy: { 17332 click_to_copy: "Haz clic para copiar" 17333 }, 17334 sortable: { 17335 sort_order_saved: "Orden de clasificaci\xF3n guardado", 17336 failed_to_save: "Error al guardar el orden de clasificaci\xF3n" 17337 }, 17338 index_sort: { 17339 a_to_z: "A-Z", 17340 false_first: "falso primero", 17341 high_to_low: "de alto a bajo", 17342 low_to_high: "bajo a alto", 17343 newest_first: "el m\xE1s reciente primero", 17344 oldest_first: "los m\xE1s antiguos primeros", 17345 true_fist: "verdadero primero", 17346 z_to_a: "Z-A" 17347 }, 17348 web_awesome: { 17349 confirm: { 17350 cancel: "Cancelar", 17351 submit: "Proceder", 17352 title: "\xBFEst\xE1s seguro?", 17353 type_to_confirm: "Escribe %{word} para confirmar" 17354 } 17355 }, 17356 simonwep_pickr: { 17357 "aria:btncancel": "cancelar y cerrar", 17358 "aria:btnclear": "limpiar y cerrar", 17359 "aria:btnsave": "guardar y cerrar", 17360 "aria:hue": "control de selecci\xF3n de tono", 17361 "aria:input": "campo de entrada de color", 17362 "aria:opacity": "control de selecci\xF3n", 17363 "aria:palette": "\xE1rea de selecci\xF3n de color", 17364 "btn:cancel": "Cancelar", 17365 "btn:clear": "Borrar", 17366 "btn:lastcolor": "usar el color anterior", 17367 "btn:save": "Guardar", 17368 "btn:swatch": "muestra de color", 17369 "btn:toggle": "cambiar al cuadro de di\xE1logo del selector de color", 17370 "ui:dialog": "cuadro de di\xE1logo selector de color" 17371 }, 17372 password_validation: { 17373 min_length: "Debe tener al menos 12 caracteres", 17374 uppercase: "Debe contener al menos una letra may\xFAscula", 17375 lowercase: "Debe contener al menos una letra min\xFAscula", 17376 number: "Debe contener al menos un n\xFAmero", 17377 special: "Debe contener al menos un car\xE1cter especial" 17378 } 17379 }, 17380 domains: { 17381 wizard: { 17382 continue_button: "Continuar con %{domain}" 17383 } 17384 }, 17385 trix: { 17386 GB: "GB", 17387 KB: "KB", 17388 MB: "MB", 17389 PB: "PB", 17390 TB: "TB", 17391 attachFiles: "Adjuntar archivos", 17392 bold: "Oscuro", 17393 bullets: "Vi\xF1etas", 17394 byte: "Byte", 17395 bytes: "Bytes", 17396 captionPlaceholder: "Agrega un subt\xEDtulo\u2026", 17397 code: "C\xF3digo", 17398 heading1: "T\xEDtulo", 17399 indent: "Aumentar nivel", 17400 italic: "It\xE1licas", 17401 link: "Enlace", 17402 numbers: "N\xFAmeros",
17403 outdent: "Reducir nivel", 17404 quote: "Citar", 17405 redo: "Rehacer", 17406 remove: "Quitar", 17407 strike: "Tachado", 17408 undo: "Deshacer", 17409 unlink: "Desconectar", 17410 url: "URL", 17411 urlPlaceholder: "Introducir URL..." 17412 }, 17413 activity_chart_controller: { 17414 commissions: "Comisiones", 17415 pageviews: "Vistas de p\xE1gina", 17416 trial_starts: "Inicios de prueba", 17417 conversions: "Conversiones" 17418 }, 17419 unsaved_changes_controller: { 17420 haveChanges: "Tiene cambios no guardados, por favor confirme.", 17421 noChanges: "Sin cambios no guardados" 17422 }, 17423 direct_image_uploads_controller: { 17424 limit_exceeded: "Solo puede subir hasta %{limit} archivos", 17425 too_large: "El tama\xF1o del archivo debe ser menor a 10 MB" 17426 }, 17427 discounts: { 17428 amount_required: "El monto es requerido", 17429 percent_required: "El porcentaje es requerido" 17430 } 17431 }, 17432 ja: { 17433 stimulus: { 17434 admin_editor: { 17435 confirm_message: "\u30D6\u30ED\u30B0\u6295\u7A3F\u306B\u5909\u66F4\u3092\u52A0\u3048\u307E\u3057\u305F\u3002\u7D9A\u884C\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F\u3053\u306E\u64CD\u4F5C\u306F\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002", 17436 save_button_text: "\u5909\u66F4\u3092\u4FDD\u5B58", 17437 save_reload_button_text: "\u4FDD\u5B58\u3057\u3066\u518D\u8AAD\u307F\u8FBC\u307F" 17438 }, 17439 clipboard_copy: { 17440 click_to_copy: "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30B3\u30D4\u30FC" 17441 }, 17442 sortable: { 17443 sort_order_saved: "\u4E26\u3073\u9806\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F", 17444 failed_to_save: "\u4E26\u3073\u9806\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F" 17445 }, 17446 index_sort: { 17447 a_to_z: "A-Z", 17448 false_first: "false\u512A\u5148", 17449 high_to_low: "\u9AD8\u3044\u9806", 17450 low_to_high: "\u4F4E\u3044\u9806", 17451 newest_first: "\u65B0\u3057\u3044\u9806", 17452 oldest_first: "\u53E4\u3044\u9806", 17453 true_fist: "true\u512A\u5148", 17454 z_to_a: "Z-A" 17455 }, 17456 web_awesome: { 17457 confirm: { 17458 cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB", 17459 submit: "\u7D9A\u884C", 17460 title: "\u78BA\u8A8D", 17461 type_to_confirm: "\u78BA\u8A8D\u3059\u308B\u306B\u306F%{word}\u3068\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044" 17462 } 17463 }, 17464 simonwep_pickr: { 17465 "aria:btncancel": "\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u3066\u9589\u3058\u308B", 17466 "aria:btnclear": "\u30AF\u30EA\u30A2\u3057\u3066\u9589\u3058\u308B", 17467 "aria:btnsave": "\u4FDD\u5B58\u3057\u3066\u9589\u3058\u308B", 17468 "aria:hue": "\u8272\u76F8\u9078\u629E\u30B9\u30E9\u30A4\u30C0\u30FC", 17469 "aria:input": "\u8272\u5165\u529B\u30D5\u30A3\u30FC\u30EB\u30C9", 17470 "aria:opacity": "\u9078\u629E\u30B9\u30E9\u30A4\u30C0\u30FC", 17471 "aria:palette": "\u8272\u9078\u629E\u30A8\u30EA\u30A2", 17472 "btn:cancel": "\u30AD\u30E3\u30F3\u30BB\u30EB", 17473 "btn:clear": "\u30AF\u30EA\u30A2", 17474 "btn:lastcolor": "\u524D\u56DE\u306E\u8272\u3092\u4F7F\u7528", 17475 "btn:save": "\u4FDD\u5B58", 17476 "btn:swatch": "\u30AB\u30E9\u30FC\u30B9\u30A6\u30A9\u30C3\u30C1", 17477 "btn:toggle": "\u30AB\u30E9\u30FC\u30D4\u30C3\u30AB\u30FC\u30C0\u30A4\u30A2\u30ED\u30B0\u306E\u5207\u308A\u66FF\u3048", 17478 "ui:dialog": "\u30AB\u30E9\u30FC\u30D4\u30C3\u30AB\u30FC\u30C0\u30A4\u30A2\u30ED\u30B0" 17479 }, 17480 password_validation: { 17481 min_length: "12\u6587\u5B57\u4EE5\u4E0A\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044", 17482 uppercase: "\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u5927\u6587\u5B57\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", 17483 lowercase: "\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u5C0F\u6587\u5B57\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", 17484 number: "\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u6570\u5B57\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", 17485 special: "\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u7279\u6B8A\u6587\u5B57\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059" 17486 }, 17487 shrine_image_uploads: { 17488 limit_exceeded: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u308B\u753B\u50CF\u306F\u6700\u5927%{limit}\u679A\u3067\u3059", 17489 file_too_large: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u306F10MB\u672A\u6E80\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", 17490 invalid_file_type: "JPEG\u3001PNG\u3001WebP\u3001GIF\u753B\u50CF\u306E\u307F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059", 17491 upload_failed: "\u753B\u50CF\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F" 17492 }, 17493 asset_upload: { 17494 file_rejected: "\u30D5\u30A1\u30A4\u30EB\u300C%{name}\u300D\u306F\u62D2\u5426\u3055\u308C\u307E\u3057\u305F: %{error}", 17495 error_adding_file: "\u30D5\u30A1\u30A4\u30EB\u8FFD\u52A0\u30A8\u30E9\u30FC: %{error}", 17496 preparing_upload: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E96\u5099\u4E2D...", 17497 uploading: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D... (%{uploaded} / %{total})", 17498 processing: "\u51E6\u7406\u4E2D...", 17499 upload_completed: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F", 17500 upload_failed: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5931\u6557 - %{error}", 17501 failed_to_create: "\u30D5\u30A1\u30A4\u30EB\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F: %{error}", 17502 created_as: "%{type}\u3068\u3057\u3066\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F", 17503 batch_summary: "%{summary}\u3092\u8FFD\u52A0\u3057\u307E\u3057\u305F", 17504 upload_failed_count: "%{count}\u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F", 17505 types: { 17506 image_one: "\u753B\u50CF%{count}\u4EF6", 17507 image_other: "\u753B\u50CF%{count}\u4EF6",
17508 video_one: "\u30B3\u30FC\u30B9\u30D3\u30C7\u30AA%{count}\u4EF6", 17509 video_other: "\u30B3\u30FC\u30B9\u30D3\u30C7\u30AA%{count}\u4EF6", 17510 audio_file_one: "\u30AA\u30FC\u30C7\u30A3\u30AA\u30D5\u30A1\u30A4\u30EB%{count}\u4EF6", 17511 audio_file_other: "\u30AA\u30FC\u30C7\u30A3\u30AA\u30D5\u30A1\u30A4\u30EB%{count}\u4EF6", 17512 font_one: "\u30D5\u30A9\u30F3\u30C8%{count}\u4EF6", 17513 font_other: "\u30D5\u30A9\u30F3\u30C8%{count}\u4EF6", 17514 download_one: "\u30D5\u30A1\u30A4\u30EB%{count}\u4EF6", 17515 download_other: "\u30D5\u30A1\u30A4\u30EB%{count}\u4EF6" 17516 }, 17517 type_names: { 17518 image: "\u753B\u50CF", 17519 video: "\u30B3\u30FC\u30B9\u30D3\u30C7\u30AA", 17520 audio_file: "\u30AA\u30FC\u30C7\u30A3\u30AA\u30D5\u30A1\u30A4\u30EB", 17521 font: "\u30D5\u30A9\u30F3\u30C8", 17522 download: "\u30D5\u30A1\u30A4\u30EB" 17523 }, 17524 uploading_generic: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...", 17525 file_size: "%{size} %{unit}", 17526 units: { 17527 bytes: "\u30D0\u30A4\u30C8", 17528 kb: "KB", 17529 mb: "MB", 17530 gb: "GB", 17531 tb: "TB" 17532 } 17533 } 17534 }, 17535 domains: { 17536 wizard: { 17537 continue_button: "%{domain}\u3067\u7D9A\u884C" 17538 } 17539 }, 17540 trix: { 17541 GB: "GB", 17542 KB: "KB", 17543 MB: "MB", 17544 PB: "PB", 17545 TB: "TB", 17546 attachFiles: "\u30D5\u30A1\u30A4\u30EB\u3092\u6DFB\u4ED8", 17547 bold: "\u592A\u5B57", 17548 bullets: "\u7B87\u6761\u66F8\u304D", 17549 byte: "\u30D0\u30A4\u30C8", 17550 bytes: "\u30D0\u30A4\u30C8", 17551 captionPlaceholder: "\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3\u3092\u8FFD\u52A0...", 17552 code: "\u30B3\u30FC\u30C9", 17553 heading1: "\u898B\u51FA\u3057", 17554 indent: "\u30A4\u30F3\u30C7\u30F3\u30C8\u3092\u5897\u3084\u3059", 17555 italic: "\u659C\u4F53", 17556 link: "\u30EA\u30F3\u30AF", 17557 numbers: "\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8", 17558 outdent: "\u30A4\u30F3\u30C7\u30F3\u30C8\u3092\u6E1B\u3089\u3059", 17559 quote: "\u5F15\u7528", 17560 redo: "\u3084\u308A\u76F4\u3057", 17561 remove: "\u524A\u9664", 17562 strike: "\u53D6\u308A\u6D88\u3057\u7DDA", 17563 undo: "\u5143\u306B\u623B\u3059", 17564 unlink: "\u30EA\u30F3\u30AF\u89E3\u9664", 17565 url: "URL", 17566 urlPlaceholder: "URL\u3092\u5165\u529B..." 17567 }, 17568 activity_chart_controller: { 17569 commissions: "\u30B3\u30DF\u30C3\u30B7\u30E7\u30F3", 17570 pageviews: "\u30DA\u30FC\u30B8\u30D3\u30E5\u30FC", 17571 trial_starts: "\u30C8\u30E9\u30A4\u30A2\u30EB\u958B\u59CB", 17572 optins: "\u30AA\u30D7\u30C8\u30A4\u30F3", 17573 conversions: "\u30B3\u30F3\u30D0\u30FC\u30B8\u30E7\u30F3" 17574 }, 17575 unsaved_changes_controller: { 17576 haveChanges: "\u4FDD\u5B58\u3055\u308C\u3066\u3044\u306A\u3044\u5909\u66F4\u304C\u3042\u308A\u307E\u3059\u3002'OK'\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u7834\u68C4\u3055\u308C\u307E\u3059\u3002\u7D9A\u884C\u3057\u307E\u3059\u304B\uFF1F", 17577 noChanges: "\u672A\u4FDD\u5B58\u306E\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093" 17578 }, 17579 direct_image_uploads_controller: { 17580 limit_exceeded: "\u6700\u5927%{limit}\u30D5\u30A1\u30A4\u30EB\u307E\u3067\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u3059", 17581 too_large: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u306F10MB\u672A\u6E80\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059" 17582 }, 17583 discounts: { 17584 amount_required: "\u91D1\u984D\u306F\u5FC5\u9808\u3067\u3059", 17585 percent_required: "\u30D1\u30FC\u30BB\u30F3\u30C8\u306F\u5FC5\u9808\u3067\u3059" 17586 }, 17587 notifications: { 17588 push_notification_settings: { 17589 title: "\u30D7\u30C3\u30B7\u30E5\u901A\u77E5", 17590 checking: "\u78BA\u8A8D\u4E2D...", 17591 checking_status: "\u901A\u77E5\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u78BA\u8A8D\u4E2D...", 17592 open_settings: "\u901A\u77E5\u8A2D\u5B9A\u3092\u958B\u304F", 17593 send_test_noticed: "\u30C6\u30B9\u30C8\u30D7\u30C3\u30B7\u30E5\u3092\u9001\u4FE1\uFF08Noticed\uFF09", 17594 send_test_direct: "\u30C6\u30B9\u30C8\u30D7\u30C3\u30B7\u30E5\u3092\u9001\u4FE1\uFF08\u76F4\u63A5\uFF09", 17595 no_devices_or_app_id: "\u30C7\u30D0\u30A4\u30B9\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u30CD\u30A4\u30C6\u30A3\u30D6\u30A2\u30D7\u30EA\u8A2D\u5B9A\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093", 17596 message: { 17597 device_blocked: "\u3053\u306E\u30C7\u30D0\u30A4\u30B9\u3067\u901A\u77E5\u304C\u30D6\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u901A\u77E5\u3092\u53D7\u3051\u53D6\u308B\u306B\u306F\u3001\u30C7\u30D0\u30A4\u30B9\u306E\u8A2D\u5B9A\u3067\u6709\u52B9\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002", 17598 app_disabled: "\u30D7\u30C3\u30B7\u30E5\u901A\u77E5\u306F\u30AA\u30D5\u3067\u3059\u3002\u6700\u65B0\u60C5\u5831\u3092\u53D7\u3051\u53D6\u308B\u306B\u306F\u30AA\u30F3\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002", 17599 enabled: "\u30D7\u30C3\u30B7\u30E5\u901A\u77E5\u304C\u6709\u52B9\u3067\u3059\u3002\u3053\u306E\u30C7\u30D0\u30A4\u30B9\u3067\u901A\u77E5\u3092\u53D7\u3051\u53D6\u308A\u307E\u3059\u3002", 17600 not_determined: "\u6700\u65B0\u60C5\u5831\u3092\u53D7\u3051\u53D6\u308B\u306B\u306F\u901A\u77E5\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002", 17601 unknown: "\u901A\u77E5\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002" 17602 } 17603 } 17604 } 17605 }, 17606 pt: { 17607 stimulus: { 17608 admin_editor: { 17609 confirm_message: "Voc\xEA fez altera\xE7\xF5es nesta postagem do blog, tem certeza de que deseja continuar? Isso n\xE3o pode ser desfeito.", 17610 save_button_text: "Salvar Altera\xE7\xF5es", 17611 save_reload_button_text: "Salvar e Recarregar" 17612 }, 17613 clipboard_copy: { 17614 click_to_copy: "Clique para copiar" 17615 }, 17616 sortable: { 17617 sort_order_saved: "Ordem de classifica\xE7\xE3o salva", 17618 failed_to_save: "Falha ao salvar a ordem de classifica\xE7\xE3o" 17619 }, 17620 index_sort: { 17621 a_to_z: "A-Z", 17622 false_first: "falso primeiro", 17623 high_to_low: "maior para menor", 17624 low_to_high: "menor para maior", 17625 newest_first: "mais recente primeiro", 17626 oldest_first: "mais antigo primeiro", 17627 true_fist: "verdadeiro primeiro", 17628 z_to_a: "Z-A" 17629 }, 17630 web_awesome: { 17631 confirm: { 17632 cancel: "Cancelar", 17633 submit: "Continuar", 17634 title: "Tem certeza?", 17635 type_to_confirm: "Digite %{word} para confirmar" 17636 } 17637 }, 17638 simonwep_pickr: { 17639 "aria:btncancel": "cancelar e fechar", 17640 "aria:btnclear": "limpar e fechar", 17641 "aria:btnsave": "salvar e fechar", 17642 "aria:hue": "controle deslizante de sele\xE7\xE3o de matiz", 17643 "aria:input": "campo de entrada de cor", 17644 "aria:opacity": "controle deslizante de sele\xE7\xE3o", 17645 "aria:palette": "\xE1rea de sele\xE7\xE3o de cor", 17646 "btn:cancel": "Cancelar", 17647 "btn:clear": "Limpar", 17648 "btn:lastcolor": "usar cor anterior", 17649 "btn:save": "Salvar", 17650 "btn:swatch": "amostra de cor", 17651 "btn:toggle": "alternar di\xE1logo do seletor de cor", 17652 "ui:dialog": "di\xE1logo do seletor de cor" 17653 } 17654 }, 17655 domains: { 17656 wizard: { 17657 continue_button: "Continuar com %{domain}" 17658 } 17659 }, 17660 trix: { 17661 GB: "GB", 17662 KB: "KB", 17663 MB: "MB", 17664 PB: "PB", 17665 TB: "TB", 17666 attachFiles: "Anexar arquivos", 17667 bold: "Negrito", 17668 bullets: "Marcadores", 17669 byte: "Byte", 17670 bytes: "Bytes", 17671 captionPlaceholder: "Adicione uma legenda...", 17672 code: "C\xF3digo", 17673 heading1: "T\xEDtulo", 17674 indent: "Aumentar recuo", 17675 italic: "It\xE1lico", 17676 link: "Link", 17677 numbers: "N\xFAmeros",
17678 outdent: "Diminuir recuo", 17679 quote: "Cita\xE7\xE3o", 17680 redo: "Refazer", 17681 remove: "Remover", 17682 strike: "Tachado", 17683 undo: "Desfazer", 17684 unlink: "Remover link", 17685 url: "URL", 17686 urlPlaceholder: "Digite uma URL..." 17687 }, 17688 activity_chart_controller: { 17689 commissions: "Comiss\xF5es", 17690 pageviews: "Visualiza\xE7\xF5es", 17691 trial_starts: "In\xEDcios de teste", 17692 conversions: "Convers\xF5es" 17693 }, 17694 unsaved_changes_controller: { 17695 haveChanges: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas. Clicar em 'OK' ir\xE1 descart\xE1-las. Deseja continuar?", 17696 noChanges: "Sem altera\xE7\xF5es n\xE3o salvas" 17697 }, 17698 direct_image_uploads_controller: { 17699 limit_exceeded: "Voc\xEA s\xF3 pode fazer upload de at\xE9 %{limit} arquivos", 17700 too_large: "O tamanho do arquivo deve ser menor que 10 MB" 17701 }, 17702 discounts: { 17703 amount_required: "O valor \xE9 obrigat\xF3rio", 17704 percent_required: "A porcentagem \xE9 obrigat\xF3ria" 17705 } 17706 } 17707 }; 17708 17709
17709// app/javascript/i18n-js/config.js 17710 Object.keys(locales_default).forEach((key) => locales_default[key] = { translation: locales_default[key] }); 17711 var availableLocales = ["en", "es", "ja", "pt"]; 17712 i18next_default.init({ 17713 lng: "en", 17714 fallbackLng: "en", 17715 whitelist: availableLocales, 17716 preload: availableLocales, 17717 resources: locales_default, 17718 interpolation: { 17719 escapeValue: false, 17720 // React already escapes values 17721 prefix: "%{", 17722 suffix: "}" 17723 } 17724 }); 17725 17726
17726// app/javascript/omni/controllers/ai_chat_controller.js 17727 var _scrollObserver, _statusIntervals, _dotsIntervals, _isGlobalTypingVisible, _eventAbortController, _currentInputContext, _pendingActionButtonExchange, _notificationTimeout, _lastActionButtonContext, _instances3, createExchange_fn, prepareNewExchangeForViewport_fn, addErrorToExchange_fn, showLoadingScreen_fn, stopStatusRotation_fn, startStatusRotation_fn, loadHistory_fn, showWelcome_fn, setupInputMonitoring_fn, autoGrowInput_fn, setupScrollObserver_fn, setupEventListeners_fn, getChatMessage_fn, clearInput_fn, hasValidInput_fn, enhanceMessageWithContext_fn, submitForm_fn, generateExchangeId_fn, createExchangeContainer_fn, createUserMessage_fn, createErrorMessage_fn, clearTemporarySystemMessages_fn, insertExchangeContainer_fn, addUserMessageToExchange_fn, appendToExchange_fn, animatePreviousExchange_fn, scrollToExchange_fn, calculateAvailableMessagesHeight_fn, ensureExchangeScrollability_fn, scrollToUserMessage_fn, scrollWithPrecision_fn, scrollWithFallback_fn, scrollToLastUserMessage_fn, scrollToBottom_fn, createExchangeFallback_fn, escapeHtml_fn, fetchHistory_fn, handleEmptyHistory_fn, handleHistoryError_fn, renderWelcomeMessage_fn, getWelcomeTemplate_fn, getSimpleWelcomeMessage_fn, updateLoadingState_fn, showErrorMessage_fn, applyEnabledButtonStyle_fn, applyDisabledButtonStyle_fn, cleanupScrollObserver_fn, cleanupEventListeners_fn, cleanupStatusIndicators_fn, getCsrfToken_fn, removeAllActionButtons_fn, handleContextReceived_fn, handleSendMessage_fn, removeTemporarySuggestions_fn, handleStreamComplete_fn, handleStartIndicator_fn, handleConversationLoaded_fn, handleIntercomError_fn, handleDelphiError_fn, handleOnboardingCompleted_fn, handleContextLimitReached_fn, disableInputForContextLimit_fn, enableInputFromContextLimit_fn, getFieldLabel_fn, showContextBubbles_fn, showActionButtons_fn, handleRewriteAction_fn, handleCopy_fn, handleFillInput_fn2, getAIResponseText_fn, showCopyNotification_fn, dispatchEvent_fn, isChatEmpty_fn, updateNewChatButtonState_fn; 17728 var ai_chat_controller_default = class extends application_controller_default { 17729 constructor() { 17730 super(...arguments); 17731 __privateAdd(this, _instances3); 17732 __privateAdd(this, _scrollObserver, null); 17733 __privateAdd(this, _statusIntervals, /* @__PURE__ */ new Map()); 17734 __privateAdd(this, _dotsIntervals, /* @__PURE__ */ new Map()); 17735 __privateAdd(this, _isGlobalTypingVisible, false); 17736 __privateAdd(this, _eventAbortController, null); 17737 __privateAdd(this, _currentInputContext, null); 17738 __privateAdd(this, _pendingActionButtonExchange, null); 17739 __privateAdd(this, _notificationTimeout, null); 17740 __privateAdd(this, _lastActionButtonContext, null); 17741 } 17742 /** 17743 * Initialize the controller and set up all functionality 17744 */ 17745 connect() { 17746 i18next_default.addResourceBundle(i18next_default.language, "ai_chat_panel", this.translationsValue, true, true); 17747 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this, { clearContext: true }); 17748 __privateMethod(this, _instances3, setupInputMonitoring_fn).call(this); 17749 __privateMethod(this, _instances3, setupScrollObserver_fn).call(this); 17750 __privateMethod(this, _instances3, setupEventListeners_fn).call(this); 17751 this.updateButtonState(); 17752 __privateMethod(this, _instances3, updateNewChatButtonState_fn).call(this); 17753 if (!this.hasLoadedHistoryValue && this.shouldLoadHistoryValue) { 17754 __privateMethod(this, _instances3, loadHistory_fn).call(this); 17755 } else if (!this.shouldLoadHistoryValue) { 17756 __privateMethod(this, _instances3, showWelcome_fn).call(this); 17757 } 17758 this.element.addEventListener("omni:context-received", __privateMethod(this, _instances3, handleContextReceived_fn).bind(this)); 17759 this._handleSendMessageBound = __privateMethod(this, _instances3, handleSendMessage_fn).bind(this); 17760 this.element.addEventListener("ai-chat:send-message", this._handleSendMessageBound); 17761 this._handlePanelExpandedBound = () => __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this, { clearContext: true }); 17762 this._handlePanelCollapsedBound = () => { 17763 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this, { clearContext: true }); 17764 __privateMethod(this, _instances3, removeAllActionButtons_fn).call(this); 17765 }; 17766 this._handleStreamCompleteBound = __privateMethod(this, _instances3, handleStreamComplete_fn).bind(this); 17767 this._handleStartIndicatorBound = __privateMethod(this, _instances3, handleStartIndicator_fn).bind(this); 17768 this._handleConversationLoadedBound = __privateMethod(this, _instances3, handleConversationLoaded_fn).bind(this); 17769 this._handleIntercomErrorBound = __privateMethod(this, _instances3, handleIntercomError_fn).bind(this); 17770 this._handleDelphiErrorBound = __privateMethod(this, _instances3, handleDelphiError_fn).bind(this); 17771 this._handleOnboardingCompletedBound = __privateMethod(this, _instances3, handleOnboardingCompleted_fn).bind(this); 17772 this._handleContextLimitReachedBound = __privateMethod(this, _instances3, handleContextLimitReached_fn).bind(this); 17773 document.addEventListener("ai-chat-panel:expanded", this._handlePanelExpandedBound); 17774 document.addEventListener("ai-chat-panel:collapsed", this._handlePanelCollapsedBound); 17775 document.addEventListener("ai-chat:stream-complete", this._handleStreamCompleteBound); 17776 document.addEventListener("ai-chat:start-indicator", this._handleStartIndicatorBound); 17777 document.addEventListener("ai-chat:conversation-loaded", this._handleConversationLoadedBound); 17778 document.addEventListener("ai-chat:intercom-error", this._handleIntercomErrorBound); 17779 document.addEventListener("ai-chat:delphi-error", this._handleDelphiErrorBound); 17780 document.addEventListener("ai-chat:onboarding-completed", this._handleOnboardingCompletedBound); 17781 document.addEventListener("ai-chat:context-limit-reached", this._handleContextLimitReachedBound); 17782 } 17783 /** 17784 * Clean up when controller disconnects 17785 */ 17786 disconnect() { 17787 __privateMethod(this, _instances3, cleanupScrollObserver_fn).call(this); 17788 __privateMethod(this, _instances3, cleanupEventListeners_fn).call(this); 17789 __privateMethod(this, _instances3, cleanupStatusIndicators_fn).c
17789all(this); 17790 if (__privateGet(this, _notificationTimeout)) { 17791 clearTimeout(__privateGet(this, _notificationTimeout)); 17792 } 17793 this.element.removeEventListener("ai-chat:send-message", this._handleSendMessageBound); 17794 document.removeEventListener("ai-chat-panel:expanded", this._handlePanelExpandedBound); 17795 document.removeEventListener("ai-chat-panel:collapsed", this._handlePanelCollapsedBound); 17796 document.removeEventListener("ai-chat:stream-complete", this._handleStreamCompleteBound); 17797 document.removeEventListener("ai-chat:start-indicator", this._handleStartIndicatorBound); 17798 document.removeEventListener("ai-chat:conversation-loaded", this._handleConversationLoadedBound); 17799 document.removeEventListener("ai-chat:intercom-error", this._handleIntercomErrorBound); 17800 document.removeEventListener("ai-chat:delphi-error", this._handleDelphiErrorBound); 17801 document.removeEventListener("ai-chat:onboarding-completed", this._handleOnboardingCompletedBound); 17802 document.removeEventListener("ai-chat:context-limit-reached", this._handleContextLimitReachedBound); 17803 } 17804 /** 17805 * Handle form submission 17806 * @param {Event} event - Form submit event 17807 */ 17808 handleSubmit(event) { 17809 event.preventDefault(); 17810 event.stopPropagation(); 17811 const chatMessage = __privateMethod(this, _instances3, getChatMessage_fn).call(this); 17812 if (!chatMessage) return; 17813 const beforeSubmitEvent = new CustomEvent("ai-chat:before-submit", { 17814 bubbles: true, 17815 cancelable: true 17816 }); 17817 document.dispatchEvent(beforeSubmitEvent); 17818 if (beforeSubmitEvent.defaultPrevented) { 17819 return; 17820 } 17821 const enhancedMessage = __privateMethod(this, _instances3, enhanceMessageWithContext_fn).call(this, chatMessage); 17822 __privateMethod(this, _instances3, clearTemporarySystemMessages_fn).call(this); 17823 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this); 17824 __privateMethod(this, _instances3, clearInput_fn).call(this); 17825 this.updateButtonState(); 17826 __privateMethod(this, _instances3, createExchange_fn).call(this, enhancedMessage).then((exchangeId) => { 17827 if (exchangeId) { 17828 if (__privateGet(this, _currentInputContext)) { 17829 __privateSet(this, _pendingActionButtonExchange, exchangeId); 17830 } 17831 __privateMethod(this, _instances3, submitForm_fn).call(this, enhancedMessage, exchangeId); 17832 } 17833 }).catch(() => { 17834 this.updateButtonState(); 17835 }); 17836 } 17837 /** 17838 * Handle keyboard events in input field 17839 * @param {KeyboardEvent} event - Keyboard event 17840 */ 17841 handleKeyPress(event) { 17842 if (event.key === "Enter" && !event.shiftKey) { 17843 event.preventDefault(); 17844 if (__privateMethod(this, _instances3, hasValidInput_fn).call(this)) { 17845 this.formTarget.dispatchEvent( 17846 new Event("submit", { 17847 bubbles: true, 17848 cancelable: true 17849 }) 17850 ); 17851 } 17852 } 17853 } 17854 /** 17855 * Update button state based on input content 17856 */ 17857 updateButtonState() { 17858 if (!this.hasInputTarget || !this.hasSendButtonTarget) return; 17859 const hasText = __privateMethod(this, _instances3, hasValidInput_fn).call(this); 17860 this.sendButtonTarget.disabled = !hasText; 17861 if (hasText) { 17862 __privateMethod(this, _instances3, applyEnabledButtonStyle_fn).call(this); 17863 } else { 17864 __privateMethod(this, _instances3, applyDisabledButtonStyle_fn).call(this); 17865 } 17866 } 17867 /** 17868 * Update the current chat ID 17869 * @param {string} chatId - The ID of the selected chat 17870 * @public 17871 */ 17872 setChatId(chatId) { 17873 if (this.hasChatIdFieldTarget) { 17874 this.chatIdFieldTarget.value = chatId; 17875 } 17876 } 17877 /** 17878 * Handle new conversation click - clear messages immediately 17879 * @public 17880 */ 17881 handleNewConversation(event) { 17882 if (__privateMethod(this, _instances3, isChatEmpty_fn).call(this)) { 17883 event.preventDefault(); 17884 return; 17885 } 17886 this.clearMessagesImmediately(); 17887 if (this.contextLimitReachedValue) { 17888 __privateMethod(this, _instances3, enableInputFromContextLimit_fn).call(this); 17889 } 17890 if (this.hasInputTarget) { 17891 requestAnimationFrame(() => {
17892 this.inputTarget.focus(); 17893 }); 17894 } 17895 } 17896 /** 17897 * Fill chat input with suggestion text 17898 * @public 17899 * @param {Event} event - Click event from suggestion button 17900 */ 17901 fillSuggestion(event) { 17902 const suggestion = event.currentTarget.dataset.suggestion; 17903 if (!suggestion) return; 17904 if (this.hasInputTarget) { 17905 this.inputTarget.value = suggestion; 17906 this.inputTarget.focus(); 17907 this.inputTarget.dispatchEvent(new Event("input", { bubbles: true })); 17908 } 17909 } 17910 /** 17911 * Dismiss onboarding and show regular welcome screen 17912 * @public 17913 * @param {Event} event - Click event from "Try it now" button 17914 */ 17915 dismissOnboarding(event) { 17916 event.preventDefault(); 17917 if (!this.hasUserIdValue) return; 17918 fetch(`/account/users/${this.userIdValue}/complete_omni_onboarding`, { 17919 method: "POST", 17920 headers: { 17921 "Content-Type": "application/json", 17922 "X-CSRF-Token": __privateMethod(this, _instances3, getCsrfToken_fn).call(this) 17923 } 17924 }).then((response) => response.json()).then((data) => { 17925 if (data.success) { 17926 this.showOnboardingValue = false; 17927 __privateMethod(this, _instances3, showWelcome_fn).call(this); 17928 } 17929 }).catch((error2) => { 17930 console.error("Failed to dismiss onboarding:", error2); 17931 this.showOnboardingValue = false; 17932 __privateMethod(this, _instances3, showWelcome_fn).call(this); 17933 }); 17934 } 17935 /** 17936 * Clear messages immediately without animation (for conversation switching) 17937 * @public 17938 */ 17939 clearMessagesImmediately() { 17940 if (!this.hasMessagesTarget) return; 17941 this.messagesTarget.innerHTML = ""; 17942 this.hideGlobalTyping(); 17943 __privateMethod(this, _instances3, cleanupStatusIndicators_fn).call(this); 17944 __privateMethod(this, _instances3, showLoadingScreen_fn).call(this); 17945 __privateMethod(this, _instances3, updateNewChatButtonState_fn).call(this); 17946 } 17947 /** 17948 * Hide loading screen 17949 * @public (called from conversation list controller) 17950 */ 17951 hideLoadingScreen() { 17952 if (!this.hasMessagesTarget) return; 17953 const loadingScreen = this.messagesTarget.querySelector(".loading-screen"); 17954 if (loadingScreen) { 17955 loadingScreen.remove(); 17956 } 17957 __privateMethod(this, _instances3, updateNewChatButtonState_fn).call(this); 17958 } 17959 /** 17960 * Show global typing indicator 17961 * @public 17962 */ 17963 showGlobalTyping() { 17964 if (__privateGet(this, _isGlobalTypingVisible) || !this.hasGlobalTypingTarget) return; 17965 const template = document.getElementById("ai-chat-typing-indicator-template"); 17966 if (!template) return; 17967 const clone = template.content.cloneNode(true); 17968 this.globalTypingTarget.innerHTML = ""; 17969 this.globalTypingTarget.appendChild(clone); 17970 __privateSet(this, _isGlobalTypingVisible, true); 17971 __privateMethod(this, _instances3, startStatusRotation_fn).call(this, "global"); 17972 } 17973 /** 17974 * Hide global typing indicator 17975 * @public 17976 */ 17977 hideGlobalTyping() { 17978 if (!__privateGet(this, _isGlobalTypingVisible) || !this.hasGlobalTypingTarget) return; 17979 __privateMethod(this, _instances3, stopStatusRotation_fn).call(this, "global"); 17980 this.globalTypingTarget.innerHTML = ""; 17981 __privateSet(this, _isGlobalTypingVisible, false); 17982 } 17983 /** 17984 * Add temporary system message to chat (using single absolutely-positioned notification) 17985 * @param {string} message - The system message to display 17986 * @param {number} duration - Time in milliseconds before auto-removal (optional) 17987 */ 17988 addTemporarySystemMessage(message, duration = 5e3) { 17989 const notification = document.getElementById("ai-notification-container"); 17990 if (__privateGet(this, _notificationTimeout)) { 17991 clearTimeout(__privateGet(this, _notificationTimeout)); 17992 } 17993 notification.textContent = message; 17994 notification.style.display = "block"; 17995 if (duration > 0) { 17996 __privateSet(this, _notificationTimeout, setTimeout(() => { 17997 notification.style.display = "none"; 17998 }, duration)); 17999 } 18000 __privateMethod(this, _instances3, dispatchEvent_fn).call(this, "ai-chat:system-message-added", { message, duration }); 18001 } 18002 /** 18003 * Toggle rewrite dropdown 18004 * @public 18005 * @param {Event} event 18006 */ 18007 toggleRewriteDropdown(event) { 18008 event.preventDefault(); 18009 event.stopPropagation(); 18010 const button = event.currentTarget; 18011 const container = button.closest(".action-rewrite-container"); 18012 const dropdown = container?.querySelector(".rewrite-dropdown"); 18013 if (dropdown) { 18014 const isVisible = !dropdown.classList.contains("g:hidden"); 18015 dropdown.classList.toggle("g:hidden"); 18016 if (!isVisible) { 18017 const closeDropdown = () => { 18018 dropdown.classList.add("g:hidden"); 18019 document.removeEventListener("click", closeDropdown); 18020 }; 18021 setTimeout(() => document.addEventListener("click", closeDropdown), 0); 18022 } 18023 } 18024 } 18025 /** 18026 * Handle rewrite option selection 18027 * @public 18028 * @param {Event} event 18029 */ 18030 handleRewriteOption(event) { 18031 event.preventDefault(); 18032 event.stopPropagation(); 18033 const button = event.currentTarget; 18034 const action = button.dataset.rewriteAction; 18035 const container = button.closest(".action-rewrite-container"); 18036 const dropdown = container?.querySelector(".rewrite-dropdown"); 18037 const exchangeId = container?.dataset.exchangeId; 18038 if (dropdown) dropdown.style.display = "none"; 18039 const fieldLabel = __privateMethod(this, _instances3, getFieldLabel_fn).call(this, __privateGet(this, _lastActionButtonContext)); 18040 __privateMethod(this, _instances3, handleRewriteAction_fn).call(this, action, fieldLabel, exchangeId); 18041 } 18042 /** 18043 * Handle copy action 18044 * @public 18045 * @param {Event} event 18046 */ 18047 handleCopyAction(event) { 18048 event.preventDefault(); 18049 const exchangeId = event.currentTarget.dataset.exchangeId; 18050 __privateMethod(this, _instances3, handleCopy_fn).call(this, exch
18050angeId); 18051 } 18052 /** 18053 * Handle copy individual message 18054 * @public 18055 * @param {Event} event 18056 */ 18057 handleCopyMessage(event) { 18058 event.preventDefault(); 18059 const messageText = event.currentTarget.dataset.messageText; 18060 if (messageText) { 18061 navigator.clipboard.writeText(messageText).then(() => { 18062 __privateMethod(this, _instances3, showCopyNotification_fn).call(this); 18063 }).catch(() => { 18064 const textArea = document.createElement("textarea"); 18065 textArea.value = messageText; 18066 document.body.appendChild(textArea); 18067 textArea.select(); 18068 try { 18069 document.execCommand("copy"); 18070 __privateMethod(this, _instances3, showCopyNotification_fn).call(this); 18071 } catch { 18072 this.addTemporarySystemMessage(this.translationsValue.notifications.copy_failed, 3e3); 18073 } 18074 document.body.removeChild(textArea); 18075 }); 18076 } 18077 } 18078 /** 18079 * Handle feedback on AI response 18080 * @public 18081 * @param {Event} event 18082 */ 18083 handleFeedback(event) { 18084 event.preventDefault(); 18085 const button = event.currentTarget; 18086 const parentContainer = button.closest(".g\\:flex"); 18087 const allFeedbackButtons = parentContainer.querySelectorAll(".feedback-btn"); 18088 allFeedbackButtons.forEach((btn) => { 18089 btn.classList.add("g:opacity-50", "g:pointer-events-none"); 18090 }); 18091 button.classList.remove("g:text-coolGray-400", "g:opacity-50"); 18092 button.classList.add("g:text-purple-600", "g:opacity-100"); 18093 this.addTemporarySystemMessage( 18094 this.translationsValue.notifications?.feedback_received || "Thank you for your feedback!", 18095 3e3 18096 ); 18097 } 18098 /** 18099 * Handle fill action 18100 * @public 18101 * @param {Event} event 18102 */ 18103 handleFillAction(event) { 18104 event.preventDefault(); 18105 const exchangeId = event.currentTarget.dataset.exchangeId; 18106 __privateMethod(this, _instances3, handleFillInput_fn2).call(this, exchangeId); 18107 } 18108 }; 18109 _scrollObserver = new WeakMap(); 18110 _statusIntervals = new WeakMap(); 18111 _dotsIntervals = new WeakMap(); 18112 _isGlobalTypingVisible = new WeakMap(); 18113 _eventAbortController = new WeakMap(); 18114 _currentInputContext = new WeakMap(); 18115 _pendingActionButtonExchange = new WeakMap(); 18116 _notificationTimeout = new WeakMap(); 18117 _lastActionButtonContext = new WeakMap(); 18118 _instances3 = new WeakSet(); 18119 createExchange_fn = async function(userMessage) { 18120 const exchangeId = __privateMethod(this, _instances3, generateExchangeId_fn).call(this); 18121 try { 18122 const exchangeElement = __privateMethod(this, _instances3, createExchangeContainer_fn).call(this, exchangeId); 18123 __privateMethod(this, _instances3, prepareNewExchangeForViewport_fn).call(this, exchangeElement); 18124 __privateMethod(this, _instances3, insertExchangeContainer_fn).call(this, exchangeElement); 18125 __privateMethod(this, _instances3, addUserMessageToExchange_fn).call(this, userMessage, exchangeId); 18126 await __privateMethod(this, _instances3, animatePreviousExchange_fn).call(this, exchangeId); 18127 __privateMethod(this, _instances3, scrollToExchange_fn).call(this, exchangeId); 18128 return exchangeId; 18129 } catch { 18130 return __privateMethod(this, _instances3, createExchangeFallback_fn).call(this, userMessage, exchangeId); 18131 } 18132 }; 18133 /** 18134 * Ensure a newly created exchange is tall enough to occupy the viewport when scrolled into view 18135 * @private 18136 * @param {DocumentFragment|HTMLElement} exchangeFragment 18137 */ 18138 prepareNewExchangeForViewport_fn = function(exchangeFragment) { 18139 const container = exchangeFragment.querySelector?.(".exchange-container"); 18140 if (!container) return; 18141 const availableHeight = __privateMethod(this, _instances3, calculateAvailableMessagesHeight_fn).call(this); 18142 if (availableHeight <= 0) return; 18143 container.style.minHeight = `${availableHeight}px`; 18144 }; 18145 /** 18146 * Add an error message to a specific exchange 18147 * @param {string} errorMessage - Error message text 18148 * @param {string} exchangeId - Target exchange ID 18149 */ 18150 addErrorToExchange_fn = function(errorMessage, exchangeId) { 18151 try { 18152 const errorElement = __privateMethod(this, _instances3, createErrorMessage_fn).call(this, errorMessage); 18153 __privateMethod(this, _instances3, appendToExchange_fn).call(this, errorElement, exchangeId); 18154 __privateMethod(this, _instances3, scrollToBottom_fn).call(this); 18155 } catch { 18156 } 18157 }; 18158 /** 18159 * Show loading screen while content loads 18160 * @private 18161 */ 18162 showLoadingScreen_fn = function() { 18163 if (!this.hasMessagesTarget) return; 18164 const template = document.getElementById("ai-chat-loading-screen-template"); 18165 if (!template) return; 18166 const clone = template.content.cloneNode(true); 18167 this.messagesTarget.appendChild(clone); 18168 }; 18169 /** 18170 * Stop status rotation for an exchange 18171 * @param {string} exchangeId - Exchange ID or 'global' 18172 */ 18173 stopStatusRotation_fn = function(exchangeId) { 18174 if (__privateGet(this, _statusIntervals).has(exchangeId)) { 18175 clearInterval(__privateGet(this, _statusIntervals).get(exchangeId)); 18176 __privateGet(this, _statusIntervals).delete(exchangeId); 18177 } 18178 if (__privateGet(this, _dotsIntervals).has(exchangeId)) { 18179 clearInterval(__privateGet(this, _dotsIntervals).get(exchangeId)); 18180 __privateGet(this, _dotsIntervals).delete(exchangeId); 18181 } 18182 }; 18183 /** 18184 * Start status rotation for a stream indicator 18185 * @param {string} streamId - Stream ID (from assistant-xxx) 18186 */ 18187 startStatusRotation_fn = function(streamId) { 18188 const indicatorId = `${streamId}-indicator`; 18189 const container = document.getElementById(indicatorId); 18190 if (!container) return; 18191 const statusTextElement = container.querySelector(".status-text"); 18192 const statusDotsElement = container.querySelector(".status-dots"); 18193 if (!statusTextElement || !statusDotsElement) return; 18194 let statusIndex = 0; 18195 const messages = this.statusMessagesValue; 18196 if (messages.length === 0) return; 18197 statusTextElement.textContent = messages[0]; 18198 const statusInterval = setInterval(() => { 18199 statusIndex = (statusIndex + 1) % messages.length; 18200 statusTextElement.textContent = messages[statusIndex]; 18201 }, this.statusRotationIntervalValue); 18202 __privateGet(this, _statusIntervals).set(streamId, statusInterval); 18203 let dotsCount = 0; 18204 const dotsInterval = setInterval(() => { 18205 dotsCount = (dotsCount + 1) % 4; 18206 statusDotsElement.textContent = ".".repeat(dotsCount); 18207 }, this.dotsAnimationIntervalValue); 18208 __privateGet(this, _dotsIntervals).set(streamId, dotsInterval); 18209 }; 18210 loadHistory_fn = async function(forceReload = false) { 18211 if (this.hasLoadedHistoryValue && !forceReload) { 18212 return; 18213 } 18214 if (this.isLoadingValue) { 18215 return; 18216 } 18217 this.isLoadingValue = true; 18218 __privateMethod(this, _instances3, updateLoadingState_fn).call(this, true); 18219 try { 18220 const response = await __privateMethod(this, _instances3, fetchHistory_fn).c
18220all(this); 18221 if (!response.ok) { 18222 throw new Error(`Failed to load history: ${response.statusText}`); 18223 } 18224 const turboStreamText = await response.text(); 18225 if (turboStreamText.trim()) { 18226 window.Turbo.renderStreamMessage(turboStreamText); 18227 this.hasLoadedHistoryValue = true; 18228 requestAnimationFrame(() => { 18229 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this, { clearContext: true }); 18230 __privateMethod(this, _instances3, scrollToLastUserMessage_fn).call(this); 18231 }); 18232 } else { 18233 await __privateMethod(this, _instances3, handleEmptyHistory_fn).call(this); 18234 } 18235 } catch (error2) { 18236 __privateMethod(this, _instances3, handleHistoryError_fn).call(this, error2); 18237 } finally { 18238 this.isLoadingValue = false; 18239 __privateMethod(this, _instances3, updateLoadingState_fn).call(this, false); 18240 } 18241 }; 18242 showWelcome_fn = async function() { 18243 if (!this.showWelcomeOnEmptyValue) { 18244 return; 18245 } 18246 this.hideGlobalTyping(); 18247 await __privateMethod(this, _instances3, renderWelcomeMessage_fn).call(this); 18248 this.hasLoadedHistoryValue = true; 18249 }; 18250 /** 18251 * Set up input field event listeners 18252 * @private 18253 */ 18254 setupInputMonitoring_fn = function() { 18255 if (!this.hasInputTarget) return; 18256 const events = ["input", "paste", "cut"]; 18257 events.forEach((eventType) => { 18258 this.inputTarget.addEventListener(eventType, () => { 18259 const delay = eventType === "input" ? 0 : 10; 18260 setTimeout(() => { 18261 this.updateButtonState(); 18262 __privateMethod(this, _instances3, autoGrowInput_fn).call(this); 18263 }, delay); 18264 }); 18265 }); 18266 __privateMethod(this, _instances3, autoGrowInput_fn).call(this); 18267 }; 18268 /** 18269 * Auto-grow the input textarea based on content 18270 * @private 18271 */ 18272 autoGrowInput_fn = function() { 18273 if (!this.hasInputTarget) return; 18274 const input = this.inputTarget; 18275 const minHeight = 56; 18276 const maxHeight = 200; 18277 input.style.height = `${minHeight}px`; 18278 const newHeight = Math.min(Math.max(input.scrollHeight, minHeight), maxHeight); 18279 input.style.height = `${newHeight}px`; 18280 input.style.overflowY = input.scrollHeight > maxHeight ? "auto" : "hidden"; 18281 }; 18282 /** 18283 * Set up scroll observer for auto-scroll behavior 18284 * @private 18285 */ 18286 setupScrollObserver_fn = function() { 18287 if (!this.hasMessagesTarget || !("IntersectionObserver" in window)) return; 18288 __privateSet(this, _scrollObserver, new IntersectionObserver( 18289 (entries) => { 18290 entries.forEach((entry) => { 18291 if (entry.isIntersecting) { 18292 this.autoScrollValue = true; 18293 } 18294 }); 18295 }, 18296 { threshold: 0.1 } 18297 )); 18298 }; 18299 /** 18300 * Set up event listeners for custom events 18301 * @private 18302 */ 18303 setupEventListeners_fn = function() { 18304 __privateSet(this, _eventAbortController, new AbortController()); 18305 const { signal } = __privateGet(this, _eventAbortController); 18306 this.element.addEventListener( 18307 "ai-chat:message-added", 18308 (event) => { 18309 if (event.detail?.type !== "user") { 18310 __privateMethod(this, _instances3, scrollToBottom_fn).call(this); 18311 } 18312 }, 18313 { signal } 18314 ); 18315 }; 18316 /** 18317 * Get trimmed chat message from input 18318 * @private 18319 * @returns {string} Trimmed message or empty string 18320 */ 18321 getChatMessage_fn = function() { 18322 return this.inputTarget?.value?.trim() || ""; 18323 }; 18324 /** 18325 * Clear the input field 18326 * @private 18327 */ 18328 clearInput_fn = function() { 18329 if (this.hasInputTarget) { 18330 this.inputTarget.value = ""; 18331 __privateMethod(this, _instances3, autoGrowInput_fn).call(this); 18332 } 18333 }; 18334 /** 18335 * Check if input has valid content 18336 * @private 18337 * @returns {boolean} 18338 */ 18339 hasValidInput_fn = function() { 18340 return __privateMethod(this, _instances3, getChatMessage_fn).call(this).length > 0; 18341 }; 18342 /** 18343 * Enhance message with context from related fields 18344 * Language-agnostic - just prepends the context name 18345 * @private 18346 * @param {string} message - Original user message 18347 * @returns {string} Enhanced message with context 18348 */ 18349 enhanceMessageWithContext_fn = function(message) { 18350 if (!__privateGet(this, _currentInputContext)?.relatedFields) { 18351 return message; 18352 } 18353 const relatedFields = __privateGet(this, _currentInputContext).relatedFields; 18354 const contextName = relatedFields.name || relatedFields.title; 18355 if (!contextName) { 18356 return message; 18357 } 18358 return `"${contextName}": ${message}`; 18359 }; 18360 /** 18361 * Submit form data to server 18362 * @private 18363 * @param {string} chatMessage - The user's message (already enhanced) 18364 * @param {string} exchangeId - Exchange container ID 18365 */
18366 submitForm_fn = function(chatMessage, exchangeId) { 18367 const formData = new FormData(this.formTarget); 18368 formData.set("chat_message", chatMessage); 18369 formData.set("exchange_id", exchangeId); 18370 formData.set("streaming", "true"); 18371 if (__privateGet(this, _currentInputContext)?.relatedFields) { 18372 formData.set("related_fields", JSON.stringify(__privateGet(this, _currentInputContext).relatedFields)); 18373 } 18374 if (__privateGet(this, _currentInputContext)?.maxLength) { 18375 formData.set("max_length", __privateGet(this, _currentInputContext).maxLength); 18376 } 18377 if (__privateGet(this, _currentInputContext)?.contentToRewrite) { 18378 formData.set("content_to_rewrite", __privateGet(this, _currentInputContext).contentToRewrite); 18379 } 18380 if (__privateGet(this, _currentInputContext)?.plainText) { 18381 formData.set("plain_text", "true"); 18382 } 18383 fetch(this.formTarget.action, { 18384 method: "POST", 18385 headers: { 18386 Accept: "text/vnd.turbo-stream.html", 18387 "X-CSRF-Token": __privateMethod(this, _instances3, getCsrfToken_fn).call(this) 18388 }, 18389 body: formData 18390 }).then((response) => { 18391 if (!response.ok) { 18392 throw new Error(`HTTP error! status: ${response.status}`); 18393 } 18394 return response.text(); 18395 }).then((html) => { 18396 window.Turbo.renderStreamMessage(html); 18397 setTimeout(() => { 18398 __privateMethod(this, _instances3, stopStatusRotation_fn).call(this, exchangeId); 18399 }, 100); 18400 }).catch(() => { 18401 __privateMethod(this, _instances3, stopStatusRotation_fn).call(this, exchangeId); 18402 const errorMessage = this.translationsValue.error_submitting || "Sorry, there was an error. Please try again."; 18403 __privateMethod(this, _instances3, addErrorToExchange_fn).call(this, errorMessage, exchangeId); 18404 }); 18405 }; 18406 /** 18407 * Generate unique exchange ID 18408 * @private 18409 * @returns {string} 18410 */ 18411 generateExchangeId_fn = function() { 18412 const timestamp = Date.now(); 18413 const random = Math.random().toString(36).substring(2, 10); 18414 return `exchange-${timestamp}-${random}`; 18415 }; 18416 /** 18417 * Create exchange container from template 18418 * @private 18419 * @param {string} exchangeId 18420 * @returns {Element} 18421 */ 18422 createExchangeContainer_fn = function(exchangeId) { 18423 const template = document.getElementById("ai-chat-exchange-container-template"); 18424 if (!template) { 18425 throw new Error("Exchange container template not found"); 18426 } 18427 const clone = template.content.cloneNode(true); 18428 const container = clone.querySelector(".exchange-container"); 18429 if (container) { 18430 container.id = exchangeId; 18431 container.dataset.exchangeId = exchangeId; 18432 } 18433 return clone; 18434 }; 18435 /** 18436 * Create user message element from template 18437 * @private 18438 * @param {string} message 18439 * @returns {Element} 18440 */ 18441 createUserMessage_fn = function(message) { 18442 const template = document.getElementById("ai-chat-user-message-template"); 18443 if (!template) { 18444 throw new Error("User message template not found"); 18445 } 18446 const clone = template.content.cloneNode(true); 18447 const messageElement = clone.querySelector("p"); 18448 const copyButton = clone.querySelector("button[data-message-text]"); 18449 if (messageElement) { 18450 messageElement.textContent = message; 18451 } 18452 if (copyButton) { 18453 copyButton.setAttribute("data-message-text", message); 18454 } 18455 return clone; 18456 }; 18457 /** 18458 * Create error message element from template 18459 * @private 18460 * @param {string} errorMessage 18461 * @returns {Element} 18462 */ 18463 createErrorMessage_fn = function(errorMessage) { 18464 const template = document.getElementById("ai-chat-error-message-template"); 18465 if (!template) { 18466 throw new Error("Error message template not found"); 18467 } 18468 const clone = template.content.cloneNode(true); 18469 const messageElement = clone.querySelector("p"); 18470 if (messageElement) { 18471 messageElement.textContent = errorMessage; 18472 } 18473 return clone; 18474 }; 18475 /** 18476 * Clear temporary system messages 18477 * @private 18478 */ 18479 clearTemporarySystemMessages_fn = function() { 18480 const notification = document.getElementById("ai-notification-container"); 18481 if (notification) { 18482 notification.style.display = "none"; 18483 } 18484 if (__privateGet(this, _notificationTimeout)) { 18485 clearTimeout(__privateGet(this, _notificationTimeout)); 18486 __privateSet(this, _notificationTimeout, null); 18487 } 18488 if (!this.hasMessagesTarget) return; 18489 const temporaryMessages = this.messagesTarget.querySelectorAll( 18490 '[data-message-type="system"][data-temporary="true"]' 18491 );
18492 temporaryMessages.forEach((message) => { 18493 message.remove(); 18494 }); 18495 }; 18496 /** 18497 * Insert exchange container into messages 18498 * @private 18499 * @param {Element} exchangeElement 18500 */ 18501 insertExchangeContainer_fn = function(exchangeElement) { 18502 if (!this.hasMessagesTarget) return; 18503 const hasExistingExchanges = this.messagesTarget.querySelectorAll(".exchange-container").length > 0; 18504 if (!hasExistingExchanges) { 18505 this.messagesTarget.innerHTML = ""; 18506 } 18507 this.messagesTarget.appendChild(exchangeElement); 18508 __privateMethod(this, _instances3, dispatchEvent_fn).call(this, "ai-chat:exchange-created", { 18509 exchangeId: exchangeElement.querySelector(".exchange-container")?.id 18510 }); 18511 }; 18512 /** 18513 * Add user message to exchange 18514 * @private 18515 * @param {string} message 18516 * @param {string} exchangeId 18517 */ 18518 addUserMessageToExchange_fn = function(message, exchangeId) { 18519 const exchangeContainer = document.getElementById(exchangeId); 18520 if (!exchangeContainer) return; 18521 const userMessage = __privateMethod(this, _instances3, createUserMessage_fn).call(this, message); 18522 exchangeContainer.appendChild(userMessage); 18523 __privateMethod(this, _instances3, dispatchEvent_fn).call(this, "ai-chat:message-added", { 18524 exchangeId, 18525 type: "user", 18526 message 18527 }); 18528 __privateMethod(this, _instances3, updateNewChatButtonState_fn).call(this); 18529 }; 18530 /** 18531 * Append element to exchange 18532 * @private 18533 * @param {Element} element 18534 * @param {string} exchangeId 18535 */ 18536 appendToExchange_fn = function(element, exchangeId) { 18537 const exchangeContainer = document.getElementById(exchangeId); 18538 if (exchangeContainer) { 18539 exchangeContainer.appendChild(element); 18540 } 18541 }; 18542 /** 18543 * Animate previous exchange to minimum height 18544 * @private 18545 * @returns {Promise} 18546 */ 18547 animatePreviousExchange_fn = function(newExchangeId) { 18548 return new Promise((resolve) => { 18549 if (!this.hasMessagesTarget) { 18550 resolve(); 18551 return; 18552 } 18553 const exchanges = Array.from(this.messagesTarget.querySelectorAll(".exchange-container")); 18554 if (exchanges.length < 1) { 18555 resolve(); 18556 return; 18557 } 18558 let previousExchange; 18559 if (newExchangeId) { 18560 const foundIndex = exchanges.findIndex((exchange) => exchange.id === newExchangeId); 18561 if (foundIndex !== -1 && foundIndex > 0) { 18562 previousExchange = exchanges[foundIndex - 1]; 18563 } else { 18564 resolve(); 18565 return; 18566 } 18567 } else { 18568 previousExchange = exchanges[exchanges.length - 1]; 18569 } 18570 if (!previousExchange) { 18571 resolve(); 18572 return; 18573 } 18574 const startHeight = previousExchange.getBoundingClientRect().height; 18575 const targetHeight = Math.max(previousExchange.scrollHeight, 1); 18576 if (!Number.isFinite(startHeight) || !Number.isFinite(targetHeight) || startHeight <= targetHeight + 1) { 18577 previousExchange.style.removeProperty("min-height"); 18578 resolve(); 18579 return; 18580 } 18581 const originalTransition = previousExchange.style.transition; 18582 const originalWillChange = previousExchange.style.willChange; 18583 let resolved = false; 18584 const cleanup = () => { 18585 if (resolved) return; 18586 resolved = true; 18587 previousExchange.removeEventListener("transitionend", handleTransitionEnd); 18588 previousExchange.style.transition = originalTransition; 18589 previousExchange.style.willChange = originalWillChange; 18590 previousExchange.style.removeProperty("min-height"); 18591 resolve(); 18592 }; 18593 const handleTransitionEnd = (event) => { 18594 if (event.target !== previousExchange) return; 18595 cleanup(); 18596 }; 18597 previousExchange.addEventListener("transitionend", handleTransitionEnd); 18598 previousExchange.style.transition = `min-height ${this.animationDurationValue}ms ease-out`; 18599 previousExchange.style.willChange = "min-height"; 18600 previousExchange.style.minHeight = `${startHeight}px`; 18601 requestAnimationFrame(() => { 18602 previousExchange.style.minHeight = `${targetHeight}px`; 18603 }); 18604 setTimeout(cleanup, this.animationDurationValue + 50); 18605 }); 18606 }; 18607 /** 18608 * Scroll to specific exchange, positioning the user message at the top of the viewport 18609 * @private 18610 * @param {string} exchangeId - ID of the exchange container to scroll to 18611 */ 18612 scrollToExchange_fn = function(exchangeId) { 18613 const exchange = document.getElementById(exchangeId); 18614 if (!exchange || !this.autoScrollValue) return; 18615 const messagesContainer = this.messagesTarget; 18616 __privateMethod(this, _instances3, ensureExchangeScrollability_fn).c
18616all(this, exchange); 18617 requestAnimationFrame(() => { 18618 __privateMethod(this, _instances3, scrollToUserMessage_fn).call(this, exchange, messagesContainer, this.messageTopOffsetValue, this.fallbackVisualBufferValue); 18619 }); 18620 }; 18621 /** 18622 * Calculate available height for messages by measuring chatWindow and subtracting fixed elements 18623 * @private 18624 * @returns {number} Available height in pixels 18625 */ 18626 calculateAvailableMessagesHeight_fn = function() { 18627 if (!this.hasChatWindowTarget || !this.hasMessagesTarget) return 0; 18628 const totalHeight = this.chatWindowTarget.clientHeight; 18629 const header = this.chatWindowTarget.querySelector(".g\\:border-b.g\\:border-coolGray-150")?.offsetHeight || 0; 18630 const form = this.formTarget?.closest(".g\\:bg-cloudNine-50.g\\:px-3.g\\:pb-2")?.offsetHeight || 0; 18631 const globalTyping = this.hasGlobalTypingTarget ? this.globalTypingTarget.offsetHeight : 0; 18632 const messagesStyles = window.getComputedStyle(this.messagesTarget); 18633 const messagesPadding = parseFloat(messagesStyles.paddingTop) + parseFloat(messagesStyles.paddingBottom); 18634 return totalHeight - header - form - globalTyping - messagesPadding; 18635 }; 18636 /** 18637 * Ensures the exchange container has sufficient height for proper scrolling 18638 * @private 18639 * @param {HTMLElement} exchange - The exchange container element 18640 */ 18641 ensureExchangeScrollability_fn = function(exchange) { 18642 const availableHeight = __privateMethod(this, _instances3, calculateAvailableMessagesHeight_fn).call(this); 18643 const currentHeight = exchange.offsetHeight; 18644 if (currentHeight < availableHeight) { 18645 exchange.style.minHeight = `${availableHeight}px`; 18646 } 18647 }; 18648 /** 18649 * Scrolls to position the user message at the desired offset from top 18650 * @private 18651 * @param {HTMLElement} exchange - The exchange container 18652 * @param {HTMLElement} container - The messages container 18653 * @param {number} desiredTopOffset - Desired pixels from top 18654 * @param {number} fallbackBuffer - Buffer to use if precise positioning fails 18655 */ 18656 scrollToUserMessage_fn = function(exchange, container, desiredTopOffset, fallbackBuffer) { 18657 const userMessage = exchange.querySelector(".g\\:flex.g\\:justify-end"); 18658 if (userMessage) { 18659 __privateMethod(this, _instances3, scrollWithPrecision_fn).call(this, userMessage, container, desiredTopOffset); 18660 } else { 18661 __privateMethod(this, _instances3, scrollWithFallback_fn).call(this, exchange, container, fallbackBuffer); 18662 } 18663 }; 18664 /** 18665 * Performs precise scroll positioning using bounding rectangles 18666 * @private 18667 * @param {HTMLElement} userMessage - The user message element 18668 * @param {HTMLElement} container - The messages container 18669 * @param {number} desiredTopOffset - Desired offset from top 18670 */ 18671 scrollWithPrecision_fn = function(userMessage, container, desiredTopOffset) { 18672 const messageRect = userMessage.getBoundingClientRect(); 18673 const containerRect = container.getBoundingClientRect(); 18674 const currentOffset = messageRect.top - containerRect.top; 18675 const scrollAdjustment = currentOffset - desiredTopOffset; 18676 const newScrollTop = container.scrollTop + scrollAdjustment; 18677 container.scrollTo({ 18678 top: Math.max(0, newScrollTop), 18679 behavior: this.scrollBehaviorValue 18680 }); 18681 }; 18682 /** 18683 * Performs fallback scroll positioning based on element offsets 18684 * @private 18685 * @param {HTMLElement} exchange - The exchange container 18686 * @param {HTMLElement} container - The messages container 18687 * @param {number} visualBuffer - Buffer from top of viewport 18688 */ 18689 scrollWithFallback_fn = function(exchange, container, visualBuffer) { 18690 const scrollPosition = Math.max(0, exchange.offsetTop - visualBuffer); 18691 container.scrollTo({ 18692 top: scrollPosition, 18693 behavior: this.scrollBehaviorValue 18694 }); 18695 }; 18696 /** 18697 * Scroll to the last user message in the conversation 18698 * @private 18699 */ 18700 scrollToLastUserMessage_fn = function() { 18701 if (!this.hasMessagesTarget) return; 18702 const messagesContainer = this.messagesTarget; 18703 const exchanges = messagesContainer.querySelectorAll(".exchange-container"); 18704 if (exchanges.length === 0) return; 18705 let lastUserExchange = null; 18706 for (let i = exchanges.length - 1; i >= 0; i--) { 18707 const exchange = exchanges[i]; 18708 const userMessage = exchange.querySelector(".g\\:flex.g\\:justify-end"); 18709 if (userMessage) { 18710 lastUserExchange = exchange; 18711 break; 18712 } 18713 } 18714 if (lastUserExchange) { 18715 __privateMethod(this, _instances3, ensureExchangeScrollability_fn).c
18715all(this, lastUserExchange); 18716 requestAnimationFrame(() => { 18717 __privateMethod(this, _instances3, scrollToUserMessage_fn).call(this, lastUserExchange, messagesContainer, this.messageTopOffsetValue, this.fallbackVisualBufferValue); 18718 }); 18719 } else { 18720 __privateMethod(this, _instances3, scrollToBottom_fn).call(this); 18721 } 18722 }; 18723 /** 18724 * Scroll messages to bottom 18725 * @private 18726 */ 18727 scrollToBottom_fn = function() { 18728 if (!this.hasMessagesTarget || !this.autoScrollValue) return; 18729 this.messagesTarget.scrollTo({ 18730 top: this.messagesTarget.scrollHeight, 18731 behavior: this.scrollBehaviorValue 18732 }); 18733 }; 18734 /** 18735 * Create exchange fallback when template fails 18736 * @private 18737 * @param {string} userMessage 18738 * @param {string} exchangeId 18739 * @returns {string} 18740 */ 18741 createExchangeFallback_fn = function(userMessage, exchangeId) { 18742 if (!this.hasMessagesTarget) return exchangeId; 18743 const messageStyle = "background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-color: rgba(139, 92, 246, 0.2);"; 18744 const exchangeHtml = ` 18745 <div id="${exchangeId}" class="exchange-container" data-exchange-id="${exchangeId}"> 18746 <div class="g:flex g:justify-end g:mb-4"> 18747 <div class="g:w-full"> 18748 <div class="g:rounded-lg g:px-4 g:py-2 g:border g:shadow-md" style="${messageStyle}"> 18749 <p class="g:text-sm g:font-medium">${__privateMethod(this, _instances3, escapeHtml_fn).call(this, userMessage)}</p> 18750 </div> 18751 </div> 18752 </div> 18753 </div> 18754 `; 18755 this.messagesTarget.insertAdjacentHTML("beforeend", exchangeHtml); 18756 __privateMethod(this, _instances3, scrollToBottom_fn).call(this); 18757 return exchangeId; 18758 }; 18759 /** 18760 * Escape HTML for safe rendering 18761 * @private 18762 * @param {string} text 18763 * @returns {string} 18764 */ 18765 escapeHtml_fn = function(text) { 18766 const div = document.createElement("div"); 18767 div.textContent = text; 18768 return div.innerHTML; 18769 }; 18770 fetchHistory_fn = async function() { 18771 const url = this.historyUrlValue; 18772 if (!url) { 18773 throw new Error("History URL not configured"); 18774 } 18775 return await fetch(url, { 18776 method: "GET", 18777 headers: { 18778 Accept: "text/vnd.turbo-stream.html", 18779 "X-Requested-With": "XMLHttpRequest" 18780 }, 18781 credentials: "same-origin" 18782 }); 18783 }; 18784 handleEmptyHistory_fn = async function() { 18785 if (this.showWelcomeOnEmptyValue) { 18786 await __privateMethod(this, _instances3, showWelcome_fn).call(this); 18787 } 18788 this.hasLoadedHistoryValue = true; 18789 __privateMethod(this, _instances3, dispatchEvent_fn).call(this, "ai-chat:history-empty"); 18790 }; 18791 /** 18792 * Handle history loading error 18793 * @private 18794 * @param {Error} error 18795 */ 18796 handleHistoryError_fn = function(error2) { 18797 __privateMethod(this, _instances3, showErrorMessage_fn).call(this, "Failed to load conversation history"); 18798 __privateMethod(this, _instances3, dispatchEvent_fn).call(this, "ai-chat:history-error", { error: error2.message }); 18799 }; 18800 renderWelcomeMessage_fn = async function() { 18801 if (!this.hasMessagesTarget) return; 18802 this.messagesTarget.innerHTML = await __privateMethod(this, _instances3, getWelcomeTemplate_fn).call(this); 18803 }; 18804 getWelcomeTemplate_fn = async function() { 18805 try { 18806 const response = await fetch(this.historyUrlValue, { 18807 method: "GET", 18808 headers: { 18809 Accept: "text/vnd.turbo-stream.html", 18810 "X-Requested-With": "XMLHttpRequest" 18811 }, 18812 credentials: "same-origin" 18813 }); 18814 if (!response.ok) { 18815 throw new Error(`Failed to fetch welcome: ${response.statusText}`); 18816 } 18817 const turboStreamText = await response.text(); 18818 const tempDiv = document.createElement("div"); 18819 tempDiv.innerHTML = turboStreamText; 18820 const turboAction = tempDiv.querySelector('turbo-stream[action="update"][target="ai-chat-messages"]'); 18821 if (turboAction) { 18822 const template = turboAction.querySelector("template"); 18823 if (template) { 18824 return template.innerHTML; 18825 } 18826 } 18827 return __privateMethod(this, _instances3, getSimpleWelcomeMessage_fn).call(this); 18828 } catch { 18829 return __privateMethod(this, _instances3, getSimpleWelcomeMessage_fn).call(this); 18830 } 18831 }; 18832 /** 18833 * Get simple fallback welcome message 18834 * @private 18835 * @returns {string} 18836 */ 18837 getSimpleWelcomeMessage_fn = function() { 18838 return ` 18839 <div class="ai-welcome-message g:text-center g:py-8"> 18840 <h3 class="g:text-lg g:font-semibold g:mb-3">Welcome to AI Assistant</h3> 18841 <p class="g:text-gray-600">
18841I'm here to help you with your ClickFunnels account and questions.</p> 18842 </div> 18843 `; 18844 }; 18845 /** 18846 * Update loading state in UI (for history loading - no typing indicators) 18847 * @private 18848 * @param {boolean} isLoading 18849 */ 18850 updateLoadingState_fn = function(isLoading) { 18851 if (this.hasLoadingClass) { 18852 this.element.classList.toggle(this.loadingClass, isLoading); 18853 } 18854 if (!isLoading) { 18855 this.hideGlobalTyping(); 18856 } 18857 }; 18858 /** 18859 * Show error message 18860 * @private 18861 * @param {string} message 18862 */ 18863 showErrorMessage_fn = function() { 18864 }; 18865 /** 18866 * Apply enabled button styling 18867 * @private 18868 */ 18869 applyEnabledButtonStyle_fn = function() { 18870 if (this.hasEnabledClass) { 18871 this.sendButtonTarget.className = this.enabledClass; 18872 } else { 18873 this.sendButtonTarget.className = [ 18874 "g:w-6 g:h-6 g:rounded-full g:flex g:items-center g:justify-center", 18875 "g:bg-purple-600 g:text-white g:hover:bg-purple-700", 18876 "g:focus:ring-2 g:focus:ring-purple-500 g:focus:ring-offset-2", 18877 "g:transition-colors g:cursor-pointer" 18878 ].join(" "); 18879 } 18880 }; 18881 /** 18882 * Apply disabled button styling 18883 * @private 18884 */ 18885 applyDisabledButtonStyle_fn = function() { 18886 if (this.hasDisabledClass) { 18887 this.sendButtonTarget.className = this.disabledClass; 18888 } else { 18889 this.sendButtonTarget.className = [ 18890 "g:w-6 g:h-6 g:rounded-full g:flex g:items-center g:justify-center", 18891 "g:text-gray-300 g:cursor-not-allowed" 18892 ].join(" "); 18893 } 18894 }; 18895 /** 18896 * Clean up scroll observer 18897 * @private 18898 */ 18899 cleanupScrollObserver_fn = function() { 18900 if (__privateGet(this, _scrollObserver)) { 18901 __privateGet(this, _scrollObserver).disconnect(); 18902 __privateSet(this, _scrollObserver, null); 18903 } 18904 }; 18905 /** 18906 * Clean up event listeners 18907 * @private 18908 */ 18909 cleanupEventListeners_fn = function() { 18910 if (__privateGet(this, _eventAbortController)) { 18911 __privateGet(this, _eventAbortController).abort(); 18912 __privateSet(this, _eventAbortController, null); 18913 } 18914 }; 18915 /** 18916 * Clean up all status indicators 18917 * @private 18918 */ 18919 cleanupStatusIndicators_fn = function() { 18920 this.hideGlobalTyping(); 18921 __privateGet(this, _statusIntervals).forEach((interval) => clearInterval(interval)); 18922 __privateGet(this, _dotsIntervals).forEach((interval) => clearInterval(interval)); 18923 __privateGet(this, _statusIntervals).clear(); 18924 __privateGet(this, _dotsIntervals).clear(); 18925 __privateSet(this, _isGlobalTypingVisible, false); 18926 }; 18927 /** 18928 * Get CSRF token from meta tag 18929 * @private 18930 * @returns {string} 18931 */ 18932 getCsrfToken_fn = function() { 18933 return document.querySelector('meta[name="csrf-token"]')?.content || ""; 18934 }; 18935 /** 18936 * Remove all action buttons from the chat 18937 * @private 18938 */ 18939 removeAllActionButtons_fn = function() { 18940 if (!this.hasMessagesTarget) return; 18941 const allActionButtons = this.messagesTarget.querySelectorAll(".ai-action-buttons"); 18942 allActionButtons.forEach((button) => button.remove()); 18943 }; 18944 /** 18945 * Handle context received from omni input controller 18946 * @private 18947 * @param {CustomEvent} event 18948 * @param {Object} event.detail - Omni field context 18949 * @param {('omni-button')} event.detail.source - Context type 18950 */ 18951 handleContextReceived_fn = function(event) { 18952 const context = event.detail; 18953 if (context.source === "omni-button") { 18954 __privateMethod(this, _instances3, removeAllActionButtons_fn).call(this); 18955 __privateMethod(this, _instances3, showContextBubbles_fn).call(this, context); 18956 __privateSet(this, _currentInputContext, context); 18957 } 18958 }; 18959 /** 18960 * Handle programmatic message sending 18961 * @private 18962 * @param {CustomEvent} event 18963 */ 18964 handleSendMessage_fn = function(event) { 18965 const { message } = event.detail; 18966 if (!message || !this.hasInputTarget) return; 18967 this.inputTarget.value = message; 18968 requestAnimationFrame(() => { 18969 if (this.hasFormTarget) { 18970 this.formTarget.requestSubmit(); 18971 } 18972 }); 18973 }; 18974 /** 18975 * Remove temporary suggestion exchanges 18976 * @private 18977 * @param {Object} options 18978 * @param {boolean} options.clearContext - Whether to clear input context 18979 */ 18980 removeTemporarySuggestions_fn = function({ clearContext = false } = {}) { 18981 if (!this.hasMessagesTarget) return; 18982 if (clearContext) { 18983 __privateSet(this, _currentInputContext, null); 18984 } 18985 const tempExchanges = this.messagesTarget.querySelectorAll('[data-temporary="true"]');
18986 tempExchanges.forEach((exchange) => exchange.remove()); 18987 }; 18988 /** 18989 * Handle stream completion event to show action buttons 18990 * @private 18991 * @param {CustomEvent} event 18992 */ 18993 handleStreamComplete_fn = function(event) { 18994 const { exchangeId, streamId } = event.detail; 18995 if (streamId) { 18996 const indicatorId = `${streamId}-indicator`; 18997 const indicator = document.getElementById(indicatorId); 18998 if (indicator) { 18999 __privateMethod(this, _instances3, stopStatusRotation_fn).call(this, streamId); 19000 indicator.remove(); 19001 } 19002 } 19003 if (exchangeId === __privateGet(this, _pendingActionButtonExchange) && __privateGet(this, _currentInputContext)) { 19004 __privateMethod(this, _instances3, showActionButtons_fn).call(this, exchangeId); 19005 __privateSet(this, _pendingActionButtonExchange, null); 19006 __privateSet(this, _lastActionButtonContext, __privateGet(this, _currentInputContext)); 19007 __privateSet(this, _currentInputContext, null); 19008 } 19009 }; 19010 /** 19011 * Handle start indicator event 19012 * @private 19013 * @param {CustomEvent} event 19014 */ 19015 handleStartIndicator_fn = function(event) { 19016 const { streamId } = event.detail; 19017 if (streamId) { 19018 __privateMethod(this, _instances3, startStatusRotation_fn).call(this, streamId); 19019 } 19020 }; 19021 /** 19022 * Handle conversation loaded event to scroll to last message 19023 * @private 19024 */ 19025 handleConversationLoaded_fn = function() { 19026 if (this.contextLimitReachedValue) { 19027 __privateMethod(this, _instances3, enableInputFromContextLimit_fn).call(this); 19028 } 19029 __privateMethod(this, _instances3, updateNewChatButtonState_fn).call(this); 19030 if (!this.hasMessagesTarget) return; 19031 const exchanges = this.messagesTarget.querySelectorAll('[id^="exchange-"]'); 19032 if (exchanges.length === 0) return; 19033 const lastExchange = exchanges[exchanges.length - 1]; 19034 const exchangeId = lastExchange.id; 19035 requestAnimationFrame(() => { 19036 __privateMethod(this, _instances3, scrollToExchange_fn).call(this, exchangeId); 19037 }); 19038 }; 19039 /** 19040 * Handle Intercom error event from handoff controller 19041 * @private 19042 */ 19043 handleIntercomError_fn = function() { 19044 const userMessage = this.translationsValue.messages?.error_intercom_connection || "Unable to connect to support. Please refresh the page and try again."; 19045 const exchangeId = `exchange-error-${Date.now()}`; 19046 __privateMethod(this, _instances3, addErrorToExchange_fn).call(this, userMessage, exchangeId); 19047 }; 19048 /** 19049 * Handle Delphi error event from handoff controller 19050 * @private 19051 */ 19052 handleDelphiError_fn = function() { 19053 const userMessage = this.translationsValue.messages?.error_delphi_connection || "Unable to connect to Delphi. Please refresh the page and try again."; 19054 const exchangeId = `exchange-error-${Date.now()}`; 19055 __privateMethod(this, _instances3, addErrorToExchange_fn).call(this, userMessage, exchangeId); 19056 }; 19057 /** 19058 * Handle onboarding completed event 19059 * @private 19060 */ 19061 handleOnboardingCompleted_fn = function() { 19062 __privateMethod(this, _instances3, showWelcome_fn).call(this); 19063 }; 19064 /** 19065 * Handle context limit reached event - disable input 19066 * @private 19067 */ 19068 handleContextLimitReached_fn = function() { 19069 this.contextLimitReachedValue = true; 19070 __privateMethod(this, _instances3, disableInputForContextLimit_fn).call(this); 19071 }; 19072 /** 19073 * Disable input when context limit is reached 19074 * @private 19075 */ 19076 disableInputForContextLimit_fn = function() { 19077 if (this.hasInputTarget) { 19078 this.inputTarget.disabled = true; 19079 this.inputTarget.placeholder = ""; 19080 } 19081 if (this.hasSendButtonTarget) { 19082 this.sendButtonTarget.disabled = true; 19083 } 19084 }; 19085 /** 19086 * Enable input (reset from context limit state) 19087 * @private 19088 */ 19089 enableInputFromContextLimit_fn = function() { 19090 this.contextLimitReachedValue = false; 19091 if (this.hasInputTarget) { 19092 this.inputTarget.disabled = false; 19093 this.inputTarget.placeholder = i18next_default.t("ai_chat_panel:placeholder", { 19094 defaultValue: "Plan, build, search or ask anything about ClickFunnels..." 19095 }); 19096 } 19097 this.updateButtonState(); 19098 }; 19099 /** 19100 * Get descriptive field label from context 19101 * @private 19102 * @param {Object} context 19103 * @returns {string} 19104 */ 19105 getFieldLabel_fn = function(context) { 19106 const defaultText = this.translationsValue.field_fallback?.content; 19107 if (!context) return defaultText; 19108 const omniPageContext = context.omniPageContext; 19109 const fieldLabel = context.fieldLabel; 19110 if (omniPageContext && fieldLabel) { 19111 const template = this.translationsValue.field_label?.model_field || "%{field}"; 19112 return template.replace("%{model}", omniPageContext).replace("%{field}", fieldLabel.toLowerCase()); 19113 } 19114 if (fieldLabel) { 19115 return fieldLabel.toLowerCase(); 19116 } 19117 return defaultText; 19118 }; 19119 showContextBubbles_fn = async function(context) { 19120 if (!this.messagesTarget) { 19121 return; 19122 } 19123 let bubbles; 19124 if (!context) { 19125 bubbles = [ 19126 { 19127 text: this.translationsValue.suggestions.write_content, 19128 primary: true 19129 } 19130 ]; 19131 } else { 19132 const hasContent = context.value && context.value.trim().length > 0; 19133 const fieldLabel = __privateMethod(this, _instances3, getFieldLabel_fn).call(this, context); 19134 if (hasContent) { 19135 bubbles = [ 19136 { 19137 text: i18next_default.t("ai_chat_panel:suggestions.make_longer", { 19138 field: fieldLabel 19139 }), 19140 primary: false 19141 }, 19142 { 19143 text: i18next_default.t("ai_chat_panel:suggestions.make_shorter", { 19144 field: fieldLabel 19145 }), 19146 primary: false 19147 }, 19148 { 19149 text: i18next_default.t("ai_chat_panel:suggestions.make_professional", { 19150 field: fieldLabel 19151 }), 19152 primary: false 19153 }, 19154 { 19155 text: i18next_default.t("ai_chat_panel:suggestions.make_playful", { 19156 field: fieldLabel 19157 }), 19158 primary: false 19159 }, 19160 { 19161 text: i18next_default.t("ai_chat_panel:suggestions.make_luxury", { 19162 field: fieldLabel 19163 }), 19164 primary: false 19165 }, 19166 { 19167 text: i18next_default.t("ai_chat_panel:suggestions.make_minimalist", { 19168 field: fieldLabel 19169 }), 19170 primary: false 19171 } 19172 ]; 19173 } else { 19174 bubbles = [ 19175 { 19176 text: i18next_default.t("ai_chat_panel:suggestions.write_professional", { 19177 field: fieldLabel 19178 }), 19179 primary: false 19180 }, 19181 { 19182 text: i18next_default.t("ai_chat_panel:suggestions.write_luxury", { 19183 field: fieldLabel 19184 }), 19185 primary: false 19186 }, 19187 { 19188 text: i18next_default.t("ai_chat_panel:suggestions.write_playful", { 19189 field: fieldLabel 19190 }), 19191 primary: false 19192 }, 19193 { 19194 text: i18next_default.t("ai_chat_panel:suggestions.write_minimalist", { 19195 field: fieldLabel 19196 }), 19197 primary: false 19198 } 19199 ]; 19200 } 19201 } 19202 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this); 19203 await __privateMethod(this, _instances3, animatePreviousExchange_fn).call(this); 19204 const wrapperTemplate = document.getElementById("ai-chat-suggestion-wrapper-template"); 19205 if (!wrapperTemplate) { 19206 throw new Error("Suggestion wrapper template not found"); 19207 } 19208 const wrapperClone = wrapperTemplate.content.cloneNode(true); 19209 const exchangeContainer = wrapperClone.querySelector(".exchange-container"); 19210 const suggestionsContainer = wrapperClone.querySelector(".suggestions-container"); 19211 const exchangeId = `temp-suggestions-${Date.now()}`; 19212 exchangeContainer.id = exchangeId; 19213 const buttonTemplate = document.getElementById("ai-chat-suggestion-button-template"); 19214 if (!buttonTemplate) { 19215 throw new Error("Suggestion button template not found"); 19216 }
19217 bubbles.forEach((bubble) => { 19218 const buttonClone = buttonTemplate.content.cloneNode(true); 19219 const button = buttonClone.querySelector("button"); 19220 button.textContent = bubble.text; 19221 if (bubble.primary) { 19222 button.style.background = "#2563EB"; 19223 button.style.color = "white"; 19224 button.style.border = "1px solid #2563EB"; 19225 } else { 19226 button.style.background = "white"; 19227 button.style.color = "#374151"; 19228 button.style.border = "1px solid #D1D5DB"; 19229 } 19230 button.addEventListener("click", () => { 19231 const command = button.textContent; 19232 __privateMethod(this, _instances3, removeTemporarySuggestions_fn).call(this); 19233 const currentContent = __privateGet(this, _currentInputContext)?.value; 19234 if (currentContent) { 19235 let maxLength = currentContent.length; 19236 if (command.toLowerCase().includes("longer")) { 19237 maxLength = Math.round(currentContent.length * 1.5); 19238 } else if (command.toLowerCase().includes("shorter")) { 19239 maxLength = Math.round(currentContent.length * 0.7); 19240 } 19241 __privateSet(this, _currentInputContext, { 19242 ...__privateGet(this, _currentInputContext), 19243 contentToRewrite: currentContent, 19244 maxLength 19245 }); 19246 } 19247 if (this.hasInputTarget) { 19248 this.inputTarget.value = command; 19249 if (this.hasFormTarget) { 19250 this.formTarget.requestSubmit(); 19251 } 19252 } 19253 }); 19254 suggestionsContainer.appendChild(buttonClone); 19255 }); 19256 this.messagesTarget.appendChild(wrapperClone); 19257 requestAnimationFrame(() => { 19258 const exchange = document.getElementById(exchangeId); 19259 if (exchange) { 19260 __privateMethod(this, _instances3, ensureExchangeScrollability_fn).call(this, exchange); 19261 } 19262 const wrapper = this.messagesTarget.querySelector(".temporary-suggestion-wrapper"); 19263 if (wrapper) { 19264 wrapper.scrollIntoView({ behavior: "smooth", block: "start" }); 19265 } 19266 }); 19267 }; 19268 /** 19269 * Show action buttons after AI response 19270 * @private 19271 * @param {string} exchangeId 19272 */ 19273 showActionButtons_fn = function(exchangeId) { 19274 if (!__privateGet(this, _currentInputContext)) return; 19275 const exchange = document.getElementById(exchangeId); 19276 if (!exchange) return; 19277 const aiMessage = exchange.querySelector('[id^="assistant-"]'); 19278 if (!aiMessage) { 19279 return; 19280 } 19281 const nextSibling = aiMessage.nextElementSibling; 19282 if (nextSibling && nextSibling.classList.contains("ai-action-buttons")) { 19283 return; 19284 } 19285 const template = document.getElementById("ai-chat-action-buttons-template"); 19286 if (!template) { 19287 throw new Error("Action buttons template not found"); 19288 } 19289 const clone = template.content.cloneNode(true); 19290 const actionContainer = clone.querySelector(".ai-action-buttons"); 19291 const fieldLabel = __privateMethod(this, _instances3, getFieldLabel_fn).call(this, __privateGet(this, _currentInputContext)); 19292 const rewriteLabel = actionContainer.querySelector(".rewrite-label"); 19293 const fillLabel = actionContainer.querySelector(".fill-label"); 19294 if (rewriteLabel) 19295 rewriteLabel.textContent = i18next_default.t("ai_chat_panel:actions.rewrite_field", { 19296 field: fieldLabel 19297 }); 19298 if (fillLabel) 19299 fillLabel.textContent = i18next_default.t("ai_chat_panel:actions.fill_field", { 19300 field: fieldLabel 19301 }); 19302 const rewriteContainer = actionContainer.querySelector(".action-rewrite-container"); 19303 const copyBtn = actionContainer.querySelector(".action-copy"); 19304 const fillBtn = actionContainer.querySelector(".action-fill"); 19305 if (rewriteContainer) rewriteContainer.dataset.exchangeId = exchangeId; 19306 if (copyBtn) copyBtn.dataset.exchangeId = exchangeId; 19307 if (fillBtn) fillBtn.dataset.exchangeId = exchangeId; 19308 aiMessage.insertAdjacentElement("afterend", actionContainer); 19309 }; 19310 /** 19311 * Handle rewrite action with specific modification 19312 * @private 19313 * @param {string} action - The type of rewrite action 19314 * @param {string} fieldLabel - The field label for context 19315 * @param {string} exchangeId - The exchange ID to get AI response from 19316 */ 19317 handleRewriteAction_fn = function(action, fieldLabel, exchangeId) { 19318 __privateMethod(this, _instances3, removeAllActionButtons_fn).call(this); 19319 const actionMap = { 19320 rewrite: i18next_default.t("ai_chat_panel:actions.rewrite_field", { 19321 field: fieldLabel 19322 }), 19323 longer: i18next_default.t("ai_chat_panel:suggestions.make_longer", { 19324 field: fieldLabel 19325 }), 19326 shorter: i18next_default.t("ai_chat_panel:suggestions.make_shorter", { 19327 field: fieldLabel 19328 }), 19329 professional: i18next_default.t("ai_chat_panel:suggestions.make_professional", { 19330 field: fieldLabel 19331 }), 19332 playful: i18next_default.t("ai_chat_panel:suggestions.make_playful", { 19333 field: fieldLabel 19334 }), 19335 luxury: i18next_default.t("ai_chat_panel:suggestions.make_luxury", { 19336 field: fieldLabel 19337 }), 19338 minimalist: i18next_default.t("ai_chat_panel:suggestions.make_minimalist", { 19339 field: fieldLabel 19340 }) 19341 }; 19342 const command = actionMap[action] || i18next_default.t("ai_chat_panel:actions.rewrite_field", { field: fieldLabel }); 19343 if (exchangeId) { 19344 const aiResponse = __privateMethod(this, _instances3, getAIResponseText_fn).call(this, document.getElementById(exchangeId)); 19345 if (aiResponse) { 19346 let maxLength = aiResponse.length; 19347 if (action === "longer") { 19348 maxLength = Math.round(aiResponse.length * 1.5); 19349 } else if (action === "shorter") { 19350 maxLength = Math.round(aiResponse.length * 0.7); 19351 } 19352 __privateSet(this, _currentInputContext, { 19353 ...__privateGet(this, _lastActionButtonContext), 19354 contentToRewrite: aiResponse, 19355 maxLength 19356 }); 19357 } 19358 } 19359 if (this.hasInputTarget) { 19360 this.inputTarget.value = command; 19361 this.updateButtonState(); 19362 if (this.hasFormTarget) { 19363 this.formTarget.dispatchEvent( 19364 new Event("submit", { 19365 bubbles: true, 19366 cancelable: true 19367 }) 19368 ); 19369 } 19370 } 19371 }; 19372 /** 19373 * Handle copy action 19374 * @private 19375 * @param {string} exchangeId 19376 */ 19377 handleCopy_fn = function(exchangeId) { 19378 const exchange = document.getElementById(exchangeId); 19379 if (!exchange) { 19380 return; 19381 } 19382 const aiResponse = __privateMethod(this, _instances3, getAIResponseText_fn).call(this, exch
19382ange); 19383 if (aiResponse) { 19384 navigator.clipboard.writeText(aiResponse).then(() => { 19385 __privateMethod(this, _instances3, showCopyNotification_fn).call(this); 19386 }).catch(() => { 19387 const textArea = document.createElement("textarea"); 19388 textArea.value = aiResponse; 19389 document.body.appendChild(textArea); 19390 textArea.select(); 19391 try { 19392 document.execCommand("copy"); 19393 __privateMethod(this, _instances3, showCopyNotification_fn).call(this); 19394 } catch { 19395 this.addTemporarySystemMessage(this.translationsValue.notifications.copy_failed, 3e3); 19396 } 19397 document.body.removeChild(textArea); 19398 }); 19399 } 19400 }; 19401 /** 19402 * Handle fill input action 19403 * @private 19404 * @param {string} exchangeId 19405 */ 19406 handleFillInput_fn2 = function(exchangeId) { 19407 const exchange = document.getElementById(exchangeId); 19408 if (!exchange) { 19409 return; 19410 } 19411 if (!__privateGet(this, _lastActionButtonContext)) { 19412 return; 19413 } 19414 const aiResponse = __privateMethod(this, _instances3, getAIResponseText_fn).call(this, exchange); 19415 if (aiResponse) { 19416 const fillEvent = new CustomEvent("ai-chat:fill-input", { 19417 bubbles: true, 19418 detail: { 19419 content: aiResponse, 19420 context: __privateGet(this, _lastActionButtonContext) 19421 } 19422 }); 19423 document.dispatchEvent(fillEvent); 19424 this.addTemporarySystemMessage(this.translationsValue.notifications.content_filled, 5e3); 19425 } 19426 }; 19427 /** 19428 * Get AI response text from exchange 19429 * @private 19430 * @param {HTMLElement} exchange 19431 * @returns {string} 19432 */ 19433 getAIResponseText_fn = function(exchange) { 19434 const aiMessage = exchange.querySelector('[id^="assistant-"]'); 19435 const responseContent = aiMessage?.querySelector(".ai-response-content"); 19436 return responseContent?.textContent?.trim() || ""; 19437 }; 19438 /** 19439 * Show copy notification 19440 * @private 19441 */ 19442 showCopyNotification_fn = function() { 19443 this.addTemporarySystemMessage(this.translationsValue.notifications.content_copied, 3e3); 19444 }; 19445 /** 19446 * Dispatch custom event 19447 * @private 19448 * @param {string} eventName 19449 * @param {Object} detail 19450 */ 19451 dispatchEvent_fn = function(eventName, detail = {}) { 19452 const event = new CustomEvent(eventName, { 19453 bubbles: true, 19454 cancelable: true, 19455 detail: { 19456 controller: this, 19457 ...detail 19458 } 19459 }); 19460 this.element.dispatchEvent(event); 19461 }; 19462 /** 19463 * Check if chat is empty (no user messages) 19464 * @private 19465 * @returns {boolean} 19466 */ 19467 isChatEmpty_fn = function() { 19468 if (!this.hasMessagesTarget) return true; 19469 const exchanges = this.messagesTarget.querySelectorAll(".exchange-container"); 19470 return exchanges.length === 0; 19471 }; 19472 /** 19473 * Update new chat button state based on whether chat is empty 19474 * @private 19475 */ 19476 updateNewChatButtonState_fn = function() { 19477 if (!this.hasNewChatButtonTarget) return; 19478 const isEmpty = __privateMethod(this, _instances3, isChatEmpty_fn).call(this); 19479 if (isEmpty) { 19480 this.newChatButtonTarget.classList.add("g:opacity-50", "g:pointer-events-none"); 19481 this.newChatButtonTarget.classList.remove("g:hover:text-midnightOil-700"); 19482 } else { 19483 this.newChatButtonTarget.classList.remove("g:opacity-50", "g:pointer-events-none"); 19484 this.newChatButtonTarget.classList.add("g:hover:text-midnightOil-700"); 19485 } 19486 }; 19487 __publicField(ai_chat_controller_default, "targets", [ 19488 "input", 19489 "sendButton", 19490 "form", 19491 "messages", 19492 "globalTyping", 19493 "chatWindow", 19494 "chatIdField", 19495 "newChatButton" 19496 ]); 19497 __publicField(ai_chat_controller_default, "values", { 19498 translations: { type: Object, default: {} }, 19499 isOpen: { type: Boolean, default: false }, 19500 historyUrl: { type: String, default: "/account/ai_chats/load_history" }, 19501 hasLoadedHistory: { type: Boolean, default: false }, 19502 isLoading: { type: Boolean, default: false }, 19503 showWelcomeOnEmpty: { type: Boolean, default: true }, 19504 autoScroll: { type: Boolean, default: true }, 19505 scrollBehavior: { type: String, default: "smooth" }, 19506 scrollBufferExtra: { type: Number, default: 100 }, 19507 messageTopOffset: { type: Number, default: 20 }, 19508 fallbackVisualBuffer: { type: Number, default: 80 }, 19509 animationDuration: { type: Number, default: 300 }, 19510 exchangeMinHeight: { type: Number, default: 100 }, 19511 statusRotationInterval: { type: Number, default: 2e3 }, 19512 dotsAnimationInterval: { type: Number, default: 500 }, 19513 shouldLoadHistory: { type: Boolean, default: true }, 19514 userId: String, 19515 showOnboarding: { type: Boolean, default: false }, 19516 statusMessages: { type: Array, default: [] }, 19517 contextLimitReached: { type: Boolean, default: false } 19518 }); 19519 __publicField(ai_chat_controller_default, "classes", ["enabled", "disabled", "exchangeContainer", "loading", "error"]); 19520 19521
19521// app/javascript/omni/controllers/ai_chat_panel_controller.js 19522 init_define_process(); 19523 init_jquery(); 19524 var _instances4, initializePanelState_fn, updatePanelLayout_fn, updateIcon_fn, dispatchPanelEvent_fn, setupEventListeners_fn2, removeEventListeners_fn, focusChatInput_fn, setupKeyboardShortcut_fn, removeKeyboardShortcut_fn; 19525 var ai_chat_panel_controller_default = class extends application_controller_default { 19526 constructor() { 19527 super(...arguments); 19528 __privateAdd(this, _instances4); 19529 } 19530 /** 19531 * Initialize controller when connected to DOM 19532 * Sets up initial panel state and accessibility attributes 19533 */ 19534 connect() { 19535 __privateMethod(this, _instances4, initializePanelState_fn).call(this); 19536 __privateMethod(this, _instances4, setupEventListeners_fn2).call(this); 19537 __privateMethod(this, _instances4, setupKeyboardShortcut_fn).call(this); 19538 } 19539 /** 19540 * Clean up when controller disconnects 19541 */ 19542 disconnect() { 19543 __privateMethod(this, _instances4, removeEventListeners_fn).call(this); 19544 __privateMethod(this, _instances4, removeKeyboardShortcut_fn).call(this); 19545 } 19546 /**
19547 * Toggle panel between expanded and collapsed states 19548 * @param {Event} event - The triggering event 19549 */ 19550 toggle(event) { 19551 event?.preventDefault(); 19552 if (this.expandedValue) { 19553 this.collapse(); 19554 } else { 19555 this.expand(); 19556 } 19557 } 19558 /** 19559 * Expand the AI chat panel 19560 * Shows flyout panel with slide animation 19561 */ 19562 expand() { 19563 if (this.expandedValue) return; 19564 this.expandedValue = true; 19565 __privateMethod(this, _instances4, updatePanelLayout_fn).call(this, true); 19566 __privateMethod(this, _instances4, updateIcon_fn).call(this); 19567 document.body.dataset.omniPanelExpanded = "true"; 19568 if (typeof window.hideDelphiWidget === "function") { 19569 window.hideDelphiWidget(); 19570 } 19571 __privateMethod(this, _instances4, dispatchPanelEvent_fn).call(this, "ai-chat-panel:expanded"); 19572 __privateMethod(this, _instances4, focusChatInput_fn).call(this); 19573 } 19574 /** 19575 * Collapse the AI chat panel 19576 * Hides flyout panel with slide animation 19577 */ 19578 collapse() { 19579 if (!this.expandedValue) return; 19580 this.expandedValue = false; 19581 __privateMethod(this, _instances4, updatePanelLayout_fn).call(this, false); 19582 __privateMethod(this, _instances4, updateIcon_fn).call(this); 19583 delete document.body.dataset.omniPanelExpanded; 19584 if (typeof window.showDelphiWidget === "function" && window.delphi?.coachEnabled) { 19585 window.showDelphiWidget(); 19586 } 19587 __privateMethod(this, _instances4, dispatchPanelEvent_fn).call(this, "ai-chat-panel:collapsed"); 19588 } 19589 }; 19590 _instances4 = new WeakSet(); 19591 // Private Methods 19592 /** 19593 * Set up initial panel state based on data attributes 19594 * @private 19595 */ 19596 initializePanelState_fn = function() { 19597 const initialExpanded = this.element.dataset.expanded === "true"; 19598 if (initialExpanded !== this.expandedValue) { 19599 this.expandedValue = initialExpanded; 19600 } 19601 __privateMethod(this, _instances4, updatePanelLayout_fn).call(this, this.expandedValue); 19602 __privateMethod(this, _instances4, updateIcon_fn).call(this); 19603 }; 19604 /** 19605 * Update the panel layout based on expanded state 19606 * @private 19607 * @param {boolean} expanded - Whether panel should be expanded 19608 */ 19609 updatePanelLayout_fn = function(expanded) { 19610 if (!this.hasFlyoutPanelTarget) { 19611 return; 19612 } 19613 if (expanded) { 19614 this.flyoutPanelTarget.classList.remove("g:translate-x-full", "g:md:translate-x-[calc(100%+0.25rem)]"); 19615 this.flyoutPanelTarget.classList.add("g:translate-x-0"); 19616 } else { 19617 this.flyoutPanelTarget.classList.remove("g:translate-x-0"); 19618 this.flyoutPanelTarget.classList.add("g:translate-x-full", "g:md:translate-x-[calc(100%+0.25rem)]"); 19619 } 19620 }; 19621 /** 19622 * Update the toggle icon appearance 19623 * @private 19624 */ 19625 updateIcon_fn = function() { 19626 const iconEvent = new CustomEvent("ai-chat-panel:state-changed", { 19627 bubbles: true, 19628 detail: { expanded: this.expandedValue } 19629 }); 19630 document.dispatchEvent(iconEvent); 19631 }; 19632 /** 19633 * Dispatch custom events for panel state changes 19634 * @private 19635 * @param {string} eventName - Name of the event to dispatch 19636 * @param {Object} detail - Additional event data 19637 */ 19638 dispatchPanelEvent_fn = function(eventName, detail = {}) { 19639 const event = new CustomEvent(eventName, { 19640 bubbles: true, 19641 cancelable: true, 19642 detail: { 19643 expanded: this.expandedValue, 19644 controller: this, 19645 ...detail 19646 } 19647 }); 19648 this.element.dispatchEvent(event); 19649 }; 19650 /** 19651 * Set up global event listeners 19652 * @private 19653 */ 19654 setupEventListeners_fn2 = function() { 19655 this.toggleHandler = () => { 19656 this.toggle(); 19657 }; 19658 document.addEventListener("ai-chat-panel:toggle", this.toggleHandler); 19659 }; 19660 /** 19661 * Remove global event listeners 19662 * @private 19663 */ 19664 removeEventListeners_fn = function() { 19665 if (this.toggleHandler) { 19666 document.removeEventListener("ai-chat-panel:toggle", this.toggleHandler); 19667 } 19668 }; 19669 /** 19670 * Focus the chat input field 19671 * @private 19672 */ 19673 focusChatInput_fn = function() { 19674 requestAnimationFrame(() => { 19675 if (this.hasChatInputTarget) {
19676 this.chatInputTarget.focus(); 19677 } 19678 }); 19679 }; 19680 /** 19681 * Set up keyboard shortcut (Cmd/Ctrl + Shift + O) 19682 * @private 19683 */ 19684 setupKeyboardShortcut_fn = function() { 19685 this.keyboardShortcutHandler = (event) => { 19686 const isOKey = event.key === "O" || event.key === "o"; 19687 if ((event.metaKey || event.ctrlKey) && event.shiftKey && isOKey) { 19688 event.preventDefault(); 19689 this.toggle(); 19690 } 19691 }; 19692 document.addEventListener("keydown", this.keyboardShortcutHandler); 19693 }; 19694 /** 19695 * Remove keyboard shortcut listener 19696 * @private 19697 */ 19698 removeKeyboardShortcut_fn = function() { 19699 if (this.keyboardShortcutHandler) { 19700 document.removeEventListener("keydown", this.keyboardShortcutHandler); 19701 } 19702 }; 19703 __publicField(ai_chat_panel_controller_default, "targets", ["flyoutPanel", "chatInput"]); 19704 __publicField(ai_chat_panel_controller_default, "values", { 19705 expanded: { type: Boolean, default: false } 19706 }); 19707 19708
19708// app/javascript/omni/controllers/ai_chat_panel_trigger_controller.js 19709 init_define_process(); 19710 init_jquery(); 19711 var _instances5, handleOnboardingCompleted_fn2, sendMessage_fn, updateButtonState_fn; 19712 var ai_chat_panel_trigger_controller_default = class extends application_controller_default { 19713 constructor() { 19714 super(...arguments); 19715 __privateAdd(this, _instances5); 19716 } 19717 connect() { 19718 if (!this.hasIndicatorTarget) return; 19719 this._handleOnboardingCompletedBound = __privateMethod(this, _instances5, handleOnboardingCompleted_fn2).bind(this); 19720 document.addEventListener("ai-chat:onboarding-completed", this._handleOnboardingCompletedBound); 19721 } 19722 disconnect() { 19723 if (!this._handleOnboardingCompletedBound) return; 19724 document.removeEventListener("ai-chat:onboarding-completed", this._handleOnboardingCompletedBound); 19725 } 19726 /** 19727 * Toggle the AI chat panel by dispatching a global event 19728 * @param {Event} event - The click event 19729 */ 19730 toggle(event) { 19731 event?.preventDefault(); 19732 const toggleEvent = new CustomEvent("ai-chat-panel:toggle", { 19733 bubbles: true, 19734 detail: { source: "trigger-button" } 19735 }); 19736 document.dispatchEvent(toggleEvent); 19737 if (this.hasMessageValue && this.messageValue) { 19738 __privateMethod(this, _instances5, sendMessage_fn).call(this, this.messageValue); 19739 } 19740 __privateMethod(this, _instances5, updateButtonState_fn).call(this); 19741 } 19742 }; 19743 _instances5 = new WeakSet(); 19744 /** 19745 * Hide the notification dot once onboarding has been completed elsewhere 19746 * (the onboarding controller already persisted this server-side). 19747 * @private 19748 */ 19749 handleOnboardingCompleted_fn2 = function() { 19750 this.showOnboardingValue = false; 19751 if (this.hasIndicatorTarget) { 19752 this.indicatorTarget.style.display = "none"; 19753 } 19754 }; 19755 /** 19756 * Send a message to the AI chat 19757 * @private 19758 * @param {string} message - The message to send 19759 */ 19760 sendMessage_fn = function(message) { 19761 requestAnimationFrame(() => { 19762 const aiChatElement = document.querySelector('[data-controller="ai-chat"]'); 19763 if (aiChatElement) { 19764 aiChatElement.dispatchEvent( 19765 new CustomEvent("ai-chat:send-message", { 19766 bubbles: true, 19767 detail: { message } 19768 }) 19769 ); 19770 } 19771 }); 19772 }; 19773 /** 19774 * Update button visual state based on panel state 19775 * @private 19776 */ 19777 updateButtonState_fn = function() { 19778 if (!this.hasButtonTarget) return; 19779 }; 19780 __publicField(ai_chat_panel_trigger_controller_default, "targets", ["button", "indicator"]); 19781 __publicField(ai_chat_panel_trigger_controller_default, "values", { 19782 message: String, 19783 showOnboarding: Boolean, 19784 userId: String 19785 }); 19786 19787
19787// app/javascript/omni/controllers/ai_chat_panel_resize_controller.js 19788 init_define_process(); 19789 init_jquery(); 19790 var import_lodash = __toESM(require_lodash()); 19791 var _isResizing, _startX, _startWidth, _handleResizeBound, _stopResizeBound, _debouncedSaveWidth, _instances6, handleResize_fn, stopResize_fn, applyWidth_fn, loadSavedWidth_fn, saveWidth_fn, setupEventListeners_fn3, removeEventListeners_fn2, isMobileOrTablet_fn; 19792 var ai_chat_panel_resize_controller_default = class extends application_controller_default { 19793 constructor() { 19794 super(...arguments); 19795 __privateAdd(this, _instances6); 19796 __privateAdd(this, _isResizing, false); 19797 __privateAdd(this, _startX, 0); 19798 __privateAdd(this, _startWidth, 0); 19799 __privateAdd(this, _handleResizeBound, null); 19800 __privateAdd(this, _stopResizeBound, null); 19801 __privateAdd(this, _debouncedSaveWidth, null); 19802 } 19803 /** 19804 * Initialize controller 19805 */ 19806 connect() { 19807 if (__privateMethod(this, _instances6, isMobileOrTablet_fn).call(this)) { 19808 return; 19809 } 19810 __privateSet(this, _debouncedSaveWidth, (0, import_lodash.debounce)(__privateMethod(this, _instances6, saveWidth_fn).bind(this), 500)); 19811 __privateMethod(this, _instances6, loadSavedWidth_fn).call(this); 19812 __privateMethod(this, _instances6, applyWidth_fn).call(this); 19813 __privateMethod(this, _instances6, setupEventListeners_fn3).call(this); 19814 } 19815 /** 19816 * Clean up when controller disconnects 19817 */ 19818 disconnect() { 19819 __privateMethod(this, _instances6, removeEventListeners_fn2).call(this); 19820 } 19821 /** 19822 * Start resizing when user clicks resize handle 19823 * @param {MouseEvent} event 19824 */ 19825 startResize(event) { 19826 event.preventDefault(); 19827 __privateSet(this, _isResizing, true); 19828 __privateSet(this, _startX, event.clientX); 19829 __privateSet(this, _startWidth, this.widthValue); 19830 document.body.style.cursor = "col-resize"; 19831 document.body.style.userSelect = "none"; 19832 } 19833 }; 19834 _isResizing = new WeakMap(); 19835 _startX = new WeakMap(); 19836 _startWidth = new WeakMap(); 19837 _handleResizeBound = new WeakMap(); 19838 _stopResizeBound = new WeakMap(); 19839 _debouncedSaveWidth = new WeakMap(); 19840 _instances6 = new WeakSet(); 19841 /** 19842 * Handle resize drag 19843 * @private 19844 * @param {MouseEvent} event 19845 */ 19846 handleResize_fn = function(event) { 19847 if (!__privateGet(this, _isResizing)) return; 19848 const deltaX = __privateGet(this, _startX) - event.clientX; 19849 const newWidth = __privateGet(this, _startWidth) + deltaX; 19850 this.widthValue = Math.max(this.minWidthValue, Math.min(this.maxWidthValue, newWidth)); 19851 __privateMethod(this, _instances6, applyWidth_fn).call(this); 19852 if (__privateGet(this, _debouncedSaveWidth)) { 19853 __privateGet(this, _debouncedSaveWidth).call(this); 19854 } 19855 }; 19856 /** 19857 * Stop resizing 19858 * @private 19859 */ 19860 stopResize_fn = function() { 19861 if (!__privateGet(this, _isResizing)) return; 19862 __privateSet(this, _isResizing, false); 19863 document.body.style.cursor = ""; 19864 document.body.style.userSelect = ""; 19865 if (__privateGet(this, _debouncedSaveWidth)) { 19866 __privateGet(this, _debouncedSaveWidth).cancel(); 19867 } 19868 __privateMethod(this, _instances6, saveWidth_fn).call(this); 19869 }; 19870 /** 19871 * Apply current width to panel 19872 * @private 19873 */ 19874 applyWidth_fn = function() { 19875 if (!this.hasPanelTarget) return; 19876 this.panelTarget.style.width = `${this.widthValue}px`; 19877 }; 19878 /** 19879 * Load saved width from localStorage 19880 * @private 19881 */ 19882 loadSavedWidth_fn = function() { 19883 try { 19884 const savedWidth = localStorage.getItem("omni_panel_width"); 19885 if (savedWidth) { 19886 const width = parseInt(savedWidth, 10); 19887 if (width >= this.minWidthValue && width <= this.maxWidthValue) { 19888 this.widthValue = width; 19889 } 19890 } 19891 } catch { 19892 } 19893 }; 19894 /** 19895 * Save width to localStorage 19896 * @private 19897 */ 19898 saveWidth_fn = function() { 19899 try { 19900 localStorage.setItem("omni_panel_width", this.widthValue.toString()); 19901 } catch { 19902 } 19903 }; 19904 /** 19905 * Set up event listeners for resize 19906 * @private 19907 */ 19908 setupEventListeners_fn3 = function() { 19909 __privateSet(this, _handleResizeBound, __privateMethod(this, _instances6, handleResize_fn).bind(this)); 19910 __privateSet(this, _stopResizeBound, __privateMethod(this, _instances6, stopResize_fn).bind(this)); 19911 document.addEventListener("mousemove", __privateGet(this, _handleResizeBound)); 19912 document.addEventListener("mouseup", __privateGet(this, _stopResizeBound)); 19913 }; 19914 /** 19915 * Remove event listeners 19916 * @private 19917 */ 19918 removeEventListeners_fn2 = function() { 19919 if (__privateGet(this, _handleResizeBound)) { 19920 document.removeEventListener("mousemove", __privateGet(this, _handleResizeBound)); 19921 } 19922 if (__privateGet(this, _stopResizeBound)) { 19923 document.removeEventListener("mouseup", __privateGet(this, _stopResizeBound)); 19924 } 19925 }; 19926 /** 19927 * Check if device is mobile or tablet 19928 * @private 19929 * @returns {boolean} 19930 */ 19931 isMobileOrTablet_fn = function() { 19932 return window.innerWidth < this.constructor.MOBILE_BREAKPOINT; 19933 }; 19934 __publicField(ai_chat_panel_resize_controller_default, "targets", ["panel", "resizeHandle"]); 19935 __publicField(ai_chat_panel_resize_controller_default, "values", { 19936 width: { type: Number, default: 440 }, 19937 minWidth: { type: Number, default: 400 },
19938 maxWidth: { type: Number, default: 1200 } 19939 }); 19940 // Tailwind md breakpoint 19941 __publicField(ai_chat_panel_resize_controller_default, "MOBILE_BREAKPOINT", 768); 19942 19943
19943// app/javascript/omni/controllers/ai_chat_onboarding_controller.js 19944 init_define_process(); 19945 init_jquery(); 19946 var _selectedQuestionKey, _stepNames, _instances7, handleSendIntercept_fn, showPillDots_fn, enableQuestionPills_fn, updateStep2Hint_fn, updatePlaceholder_fn, disableInput_fn, enableInput_fn, addSendButtonDot_fn, removeSendButtonDot_fn, addChevronDot_fn, removeChevronDot_fn, addNewChatDot_fn, removeNewChatDot_fn, addCloseDot_fn, removeCloseDot_fn, disableCloseButton_fn, enableCloseButton_fn, populateResponseStep_fn, hideOnboarding_fn, trackStepShown_fn, trackOnboardingCompleted_fn, getChatController_fn, getCsrfToken_fn2; 19947 var ai_chat_onboarding_controller_default = class extends application_controller_default { 19948 constructor() { 19949 super(...arguments); 19950 __privateAdd(this, _instances7); 19951 __privateAdd(this, _selectedQuestionKey, null); 19952 __privateAdd(this, _stepNames, { 19953 1: "Welcome", 19954 2: "Try Asking", 19955 3: "See Response", 19956 4: "Capabilities", 19957 5: "Chat History", 19958 6: "Managing Chats", 19959 7: "Wrap Up" 19960 }); 19961 } 19962 /** 19963 * Initialize controller 19964 */ 19965 connect() { 19966 this.showStep(this.currentStepValue); 19967 this.updateProgress(); 19968 __privateMethod(this, _instances7, disableInput_fn).call(this); 19969 this._handleSendInterceptBound = __privateMethod(this, _instances7, handleSendIntercept_fn).bind(this); 19970 document.addEventListener("ai-chat:before-submit", this._handleSendInterceptBound); 19971 } 19972 /** 19973 * Clean up when controller disconnects 19974 */ 19975 disconnect() { 19976 if (this._handleSendInterceptBound) { 19977 document.removeEventListener("ai-chat:before-submit", this._handleSendInterceptBound); 19978 } 19979 } 19980 /** 19981 * Show specific step 19982 * @param {number} stepNumber - Step to display (1-7) 19983 */ 19984 showStep(stepNumber) { 19985 this.stepTargets.forEach((step) => { 19986 const stepNum = parseInt(step.dataset.step); 19987 if (stepNum === stepNumber) { 19988 step.classList.remove("g:hidden"); 19989 step.style.opacity = "0"; 19990 requestAnimationFrame(() => { 19991 step.style.transition = "opacity 300ms ease-in"; 19992 step.style.opacity = "1"; 19993 }); 19994 } else { 19995 step.classList.add("g:hidden"); 19996 } 19997 }); 19998 this.currentStepValue = stepNumber; 19999 this.updateProgress(); 20000 __privateMethod(this, _instances7, trackStepShown_fn).call(this, stepNumber); 20001 __privateMethod(this, _instances7, updatePlaceholder_fn).call(this, stepNumber); 20002 if (stepNumber === 2) { 20003 __privateMethod(this, _instances7, showPillDots_fn).call(this); 20004 __privateMethod(this, _instances7, removeSendButtonDot_fn).call(this); 20005 __privateMethod(this, _instances7, updateStep2Hint_fn).call(this, "click"); 20006 __privateMethod(this, _instances7, enableQuestionPills_fn).call(this); 20007 } 20008 if (stepNumber === 3 && __privateGet(this, _selectedQuestionKey)) { 20009 __privateMethod(this, _instances7, populateResponseStep_fn).call(this); 20010 } 20011 if (stepNumber === 5) { 20012 __privateMethod(this, _instances7, addChevronDot_fn).call(this); 20013 } else { 20014 __privateMethod(this, _instances7, removeChevronDot_fn).call(this); 20015 } 20016 if (stepNumber === 6) { 20017 __privateMethod(this, _instances7, addNewChatDot_fn).call(this); 20018 __privateMethod(this, _instances7, addCloseDot_fn).call(this); 20019 __privateMethod(this, _instances7, disableCloseButton_fn).call(this); 20020 } else { 20021 __privateMethod(this, _instances7, removeNewChatDot_fn).call(this); 20022 __privateMethod(this, _instances7, removeCloseDot_fn).call(this); 20023 __privateMethod(this, _instances7, enableCloseButton_fn).call(this); 20024 } 20025 if (this.hasSkipButtonTarget) { 20026 if (stepNumber === 7) { 20027 this.skipButtonTarget.style.display = "none"; 20028 } else { 20029 this.skipButtonTarget.style.display = "block"; 20030 } 20031 } 20032 if (stepNumber !== 2) { 20033 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20034 if (chatController?.hasInputTarget) { 20035 chatController.inputTarget.value = ""; 20036 chatController.updateButtonState(); 20037 } 20038 } 20039 } 20040 /** 20041 * Handle question pill selection 20042 * @public 20043 */ 20044 selectQuestion(event) { 20045 event.preventDefault(); 20046 const button = event.currentTarget; 20047 const questionKey = button.dataset.question; 20048 const questionText = button.dataset.text; 20049 if (!questionKey || !questionText) return; 20050 __privateSet(this, _selectedQuestionKey, questionKey);
20051 this.pillDotTargets.forEach((dot) => { 20052 dot.style.display = "none"; 20053 }); 20054 this.questionPillTargets.forEach((pill) => { 20055 pill.classList.add("g:opacity-50", "g:pointer-events-none"); 20056 }); 20057 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20058 if (chatController && chatController.hasInputTarget) { 20059 chatController.inputTarget.value = questionText; 20060 chatController.updateButtonState(); 20061 } 20062 __privateMethod(this, _instances7, updateStep2Hint_fn).call(this, "send"); 20063 __privateMethod(this, _instances7, addSendButtonDot_fn).call(this); 20064 } 20065 /** 20066 * Advance to next step 20067 * @public 20068 */ 20069 nextStep(event) { 20070 event?.preventDefault(); 20071 if (this.currentStepValue < this.totalStepsValue) { 20072 this.showStep(this.currentStepValue + 1); 20073 } else { 20074 this.complete(event); 20075 } 20076 } 20077 /** 20078 * Go to previous step 20079 * @public 20080 */ 20081 previousStep(event) { 20082 event?.preventDefault(); 20083 if (this.currentStepValue > 1) { 20084 this.showStep(this.currentStepValue - 1); 20085 } 20086 } 20087 /** 20088 * Skip entire walkthrough 20089 * @public 20090 */ 20091 skip(event) { 20092 event?.preventDefault(); 20093 this.complete(event, "skipped"); 20094 } 20095 /** 20096 * Complete onboarding 20097 * @public 20098 * @param {Event} event - Click event 20099 * @param {string} completionType - 'finished' or 'skipped' 20100 */ 20101 complete(event, completionType = "finished") { 20102 event?.preventDefault(); 20103 __privateMethod(this, _instances7, trackOnboardingCompleted_fn).call(this, completionType); 20104 if (!this.hasUserIdValue) { 20105 __privateMethod(this, _instances7, hideOnboarding_fn).call(this); 20106 __privateMethod(this, _instances7, enableInput_fn).call(this); 20107 __privateMethod(this, _instances7, enableCloseButton_fn).call(this); 20108 return; 20109 } 20110 fetch(`/account/users/${this.userIdValue}/complete_omni_onboarding`, { 20111 method: "POST", 20112 headers: { 20113 "Content-Type": "application/json", 20114 "X-CSRF-Token": __privateMethod(this, _instances7, getCsrfToken_fn2).call(this) 20115 } 20116 }).then((response) => response.json()).then((data) => { 20117 if (data.success) { 20118 __privateMethod(this, _instances7, hideOnboarding_fn).call(this); 20119 __privateMethod(this, _instances7, enableInput_fn).call(this); 20120 __privateMethod(this, _instances7, enableCloseButton_fn).call(this); 20121 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20122 if (chatController) { 20123 chatController.showOnboardingValue = false; 20124 } 20125 document.dispatchEvent(new CustomEvent("ai-chat:onboarding-completed")); 20126 } 20127 }).catch((error2) => { 20128 console.error("Omni onboarding completion failed:", error2); 20129 __privateMethod(this, _instances7, hideOnboarding_fn).call(this); 20130 __privateMethod(this, _instances7, enableInput_fn).call(this); 20131 __privateMethod(this, _instances7, enableCloseButton_fn).call(this); 20132 }); 20133 } 20134 /** 20135 * Update progress indicator 20136 * @private 20137 */ 20138 updateProgress() { 20139 if (!this.hasProgressTextTarget) return; 20140 const template = this.progressTextTarget.dataset.template || "Step %{current} of %{total}"; 20141 const progress = template.replace("%{current}", this.currentStepValue).replace("%{total}", this.totalStepsValue); 20142 this.progressTextTarget.textContent = progress; 20143 } 20144 }; 20145 _selectedQuestionKey = new WeakMap(); 20146 _stepNames = new WeakMap(); 20147 _instances7 = new WeakSet(); 20148 /** 20149 * Intercept send button on step 2 20150 * @private 20151 */ 20152 handleSendIntercept_fn = function(event) { 20153 if (this.currentStepValue === 2 && __privateGet(this, _selectedQuestionKey)) { 20154 event.preventDefault(); 20155 event.stopImmediatePropagation(); 20156 __privateMethod(this, _instances7, removeSendButtonDot_fn).call(this); 20157 this.showStep(3); 20158 } 20159 }; 20160 /** 20161 * Show notification dots on question pills 20162 * @private 20163 */ 20164 showPillDots_fn = function() {
20165 this.pillDotTargets.forEach((dot) => { 20166 dot.style.display = "block"; 20167 }); 20168 }; 20169 /** 20170 * Enable question pills 20171 * @private 20172 */ 20173 enableQuestionPills_fn = function() { 20174 this.questionPillTargets.forEach((pill) => { 20175 pill.classList.remove("g:opacity-50", "g:pointer-events-none"); 20176 }); 20177 }; 20178 /** 20179 * Update step 2 hint text 20180 * @private 20181 * @param {string} mode - 'click' or 'send' 20182 */ 20183 updateStep2Hint_fn = function(mode) { 20184 if (!this.hasStep2HintTarget) return; 20185 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20186 if (!chatController) return; 20187 if (mode === "send") { 20188 const sendHint = chatController.translationsValue?.onboarding?.steps?.try_asking?.send_hint || "Press the send button below"; 20189 this.step2HintTarget.textContent = sendHint; 20190 if (this.hasUpArrowTarget) this.upArrowTarget.classList.add("g:hidden"); 20191 if (this.hasDownArrowTarget) this.downArrowTarget.classList.remove("g:hidden"); 20192 } else { 20193 const clickHint = chatController.translationsValue?.onboarding?.steps?.try_asking?.click_hint || "Click a question"; 20194 this.step2HintTarget.textContent = clickHint; 20195 if (this.hasUpArrowTarget) this.upArrowTarget.classList.remove("g:hidden"); 20196 if (this.hasDownArrowTarget) this.downArrowTarget.classList.add("g:hidden"); 20197 } 20198 }; 20199 /** 20200 * Update placeholder based on current step 20201 * @private 20202 */ 20203 updatePlaceholder_fn = function(stepNumber) { 20204 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20205 if (!chatController || !chatController.hasInputTarget) return; 20206 if (stepNumber === 2) { 20207 const placeholder = chatController.translationsValue?.onboarding?.steps?.try_asking?.placeholder || "Click a question above..."; 20208 chatController.inputTarget.placeholder = placeholder; 20209 } 20210 }; 20211 /** 20212 * Disable input field during onboarding 20213 * @private 20214 */ 20215 disableInput_fn = function() { 20216 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20217 if (!chatController || !chatController.hasInputTarget) return; 20218 chatController.inputTarget.disabled = true; 20219 }; 20220 /** 20221 * Enable input field after onboarding 20222 * @private 20223 */ 20224 enableInput_fn = function() { 20225 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20226 if (!chatController || !chatController.hasInputTarget) return; 20227 chatController.inputTarget.disabled = false; 20228 chatController.inputTarget.placeholder = chatController.translationsValue.placeholder || "Ask me anything..."; 20229 }; 20230 /** 20231 * Add pulsing notification dot to send button 20232 * @private 20233 */ 20234 addSendButtonDot_fn = function() { 20235 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20236 if (!chatController || !chatController.hasSendButtonTarget) return; 20237 if (chatController.sendButtonTarget.querySelector(".onboarding-send-dot")) return; 20238 const dot = document.createElement("span"); 20239 dot.className = "onboarding-notification-dot onboarding-send-dot g:absolute g:-top-1 g:-right-1 g:w-3 g:h-3 g:bg-green-500 g:rounded-full"; 20240 chatController.sendButtonTarget.style.position = "relative"; 20241 chatController.sendButtonTarget.appendChild(dot); 20242 }; 20243 /** 20244 * Remove notification dot from send button 20245 * @private 20246 */ 20247 removeSendButtonDot_fn = function() { 20248 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20249 if (!chatController || !chatController.hasSendButtonTarget) return; 20250 const dot = chatController.sendButtonTarget.querySelector(".onboarding-send-dot"); 20251 if (dot) { 20252 dot.remove(); 20253 } 20254 }; 20255 /** 20256 * Add pulsing notification dot to chevron 20257 * @private 20258 */ 20259 addChevronDot_fn = function() { 20260 const titleContainer = document.querySelector('wa-dropdown [slot="trigger"] .g\\:flex.g\\:items-center'); 20261 if (!titleContainer) return; 20262 if (document.querySelector(".onboarding-chevron-dot")) return; 20263 const dot = document.createElement("span"); 20264 dot.className = "onboarding-notification-dot onboarding-chevron-dot g:absolute g:-top-1 g:-left-1 g:w-3 g:h-3 g:bg-green-500 g:rounded-full"; 20265 dot.style.zIndex = "1000"; 20266 titleContainer.style.position = "relative"; 20267 titleContainer.appendChild(dot); 20268 }; 20269 /** 20270 * Remove notification dot from chevron 20271 * @private 20272 */ 20273 removeChevronDot_fn = function() { 20274 const dot = document.querySelector(".onboarding-chevron-dot"); 20275 if (dot) { 20276 dot.remove(); 20277 } 20278 }; 20279 /** 20280 * Add pulsing notification dot to new chat button 20281 * @private 20282 */ 20283 addNewChatDot_fn = function() { 20284 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20285 if (!chatController || !chatController.hasNewChatButtonTarget) return; 20286 if (document.querySelector(".onboarding-new-chat-dot")) return; 20287 const parent = chatController.newChatButtonTarget.parentElement; 20288 if (!parent) return; 20289 const dot = document.createElement("span"); 20290 dot.className = "onboarding-notification-dot onboarding-new-chat-dot g:absolute g:-top-1 g:-right-1 g:w-3 g:h-3 g:bg-green-500 g:rounded-full"; 20291 dot.style.zIndex = "1000"; 20292 dot.style.pointerEvents = "none"; 20293 parent.style.position = "relative"; 20294 parent.appendChild(dot); 20295 }; 20296 /** 20297 * Remove notification dot from new chat button 20298 * @private 20299 */ 20300 removeNewChatDot_fn = function() { 20301 const dot = document.querySelector(".onboarding-new-chat-dot"); 20302 if (dot) { 20303 dot.remove(); 20304 } 20305 }; 20306 /** 20307 * Add pulsing notification dot to close button 20308 * @private 20309 */ 20310 addCloseDot_fn = function() { 20311 const closeButton = document.querySelector('[data-action*="ai-chat-panel#collapse"]'); 20312 if (!closeButton) return; 20313 if (document.querySelector(".onboarding-close-dot")) return; 20314 const parent = closeButton.parentElement; 20315 if (!parent) return; 20316 const dot = document.createElement("span"); 20317 dot.className = "onboarding-notification-dot onboarding-close-dot g:absolute g:-top-1 g:-right-1 g:w-3 g:h-3 g:bg-green-500 g:rounded-full"; 20318 dot.style.zIndex = "1000"; 20319 dot.style.pointerEvents = "none"; 20320 parent.style.position = "relative"; 20321 parent.appendChild(dot); 20322 }; 20323 /** 20324 * Remove notification dot from close button 20325 * @private 20326 */ 20327 removeCloseDot_fn = function() { 20328 const dot = document.querySelector(".onboarding-close-dot"); 20329 if (dot) { 20330 dot.remove(); 20331 } 20332 }; 20333 /** 20334 * Disable close button to prevent exiting during step 6 20335 * @private 20336 */ 20337 disableCloseButton_fn = function() { 20338 const closeButton = document.querySelector('[data-action*="ai-chat-panel#collapse"]'); 20339 if (!closeButton) return; 20340 closeButton.disabled = true; 20341 closeButton.style.opacity = "0.5"; 20342 closeButton.style.cursor = "not-allowed"; 20343 }; 20344 /** 20345 * Re-enable close button after step 6 20346 * @private 20347 */ 20348 enableCloseButton_fn = function() { 20349 const closeButton = document.querySelector('[data-action*="ai-chat-panel#collapse"]'); 20350 if (!closeButton) return; 20351 closeButton.disabled = false;
20352 closeButton.style.opacity = ""; 20353 closeButton.style.cursor = ""; 20354 }; 20355 /** 20356 * Populate step 3 with selected question and response 20357 * @private 20358 */ 20359 populateResponseStep_fn = function() { 20360 if (!this.hasMockQuestionTarget || !this.hasMockResponseTarget) return; 20361 const chatController = __privateMethod(this, _instances7, getChatController_fn).call(this); 20362 if (!chatController) return; 20363 const questionText = chatController.translationsValue?.onboarding?.steps?.try_asking?.examples?.[__privateGet(this, _selectedQuestionKey)] || ""; 20364 const responseText = chatController.translationsValue?.onboarding?.steps?.try_asking?.responses?.[__privateGet(this, _selectedQuestionKey)] || "Thanks for trying! Now let me show you what else I can do."; 20365 this.mockQuestionTarget.textContent = questionText; 20366 this.mockResponseTarget.textContent = responseText; 20367 }; 20368 /** 20369 * Hide onboarding UI 20370 * @private 20371 */ 20372 hideOnboarding_fn = function() { 20373 this.element.style.transition = "opacity 300ms ease-out"; 20374 this.element.style.opacity = "0"; 20375 setTimeout(() => { 20376 this.element.style.display = "none"; 20377 }, 300); 20378 }; 20379 /** 20380 * Track step shown event 20381 * @private 20382 * @param {number} stepNumber - Step number being shown 20383 */ 20384 trackStepShown_fn = function(stepNumber) { 20385 if (typeof mixpanel === "undefined") return; 20386 mixpanel.track("Omni Onboarding Step Shown", { 20387 step_number: stepNumber, 20388 step_name: __privateGet(this, _stepNames)[stepNumber], 20389 user_id: this.userIdValue, 20390 group_id: this.groupIdValue 20391 }); 20392 }; 20393 /** 20394 * Track onboarding completion event 20395 * @private 20396 * @param {string} completionType - 'finished' or 'skipped' 20397 */ 20398 trackOnboardingCompleted_fn = function(completionType) { 20399 if (typeof mixpanel === "undefined") return; 20400 mixpanel.track("Omni Onboarding Completed", { 20401 completion_type: completionType, 20402 completed_at_step: this.currentStepValue, 20403 user_id: this.userIdValue, 20404 group_id: this.groupIdValue 20405 }); 20406 }; 20407 /** 20408 * Get main chat controller 20409 * @private 20410 * @returns {Object|null} 20411 */ 20412 getChatController_fn = function() { 20413 const chatElement = document.querySelector('[data-controller~="ai-chat"]'); 20414 if (!chatElement) return null; 20415 return this.application.getControllerForElementAndIdentifier(chatElement, "ai-chat"); 20416 }; 20417 /** 20418 * Get CSRF token 20419 * @private 20420 * @returns {string} 20421 */ 20422 getCsrfToken_fn2 = function() { 20423 return document.querySelector('meta[name="csrf-token"]')?.content || ""; 20424 }; 20425 __publicField(ai_chat_onboarding_controller_default, "targets", [ 20426 "step", 20427 "progressIndicator", 20428 "progressText", 20429 "skipButton", 20430 "mockQuestion", 20431 "mockResponse", 20432 "questionPill", 20433 "pillDot", 20434 "step2Hint", 20435 "upArrow", 20436 "downArrow" 20437 ]); 20438 __publicField(ai_chat_onboarding_controller_default, "values", { 20439 currentStep: { type: Number, default: 1 }, 20440 totalSteps: { type: Number, default: 7 }, 20441 userId: String, 20442 groupId: String 20443 }); 20444 20445
20445// app/javascript/omni/controllers/ai_chat_delphi_handoff_controller.js 20446 init_define_process(); 20447 init_jquery(); 20448 var _instances8, openDelphi_fn, waitForDelphiReady_fn, handleError_fn, closeOmniPanel_fn; 20449 var ai_chat_delphi_handoff_controller_default = class extends application_controller_default { 20450 constructor() { 20451 super(...arguments); 20452 __privateAdd(this, _instances8); 20453 } 20454 /** 20455 * Called when controller connects to DOM 20456 */ 20457 connect() { 20458 __privateMethod(this, _instances8, waitForDelphiReady_fn).call(this, __privateMethod(this, _instances8, openDelphi_fn).bind(this), 0); 20459 } 20460 }; 20461 _instances8 = new WeakSet(); 20462 /** 20463 * Open Delphi widget 20464 * @private 20465 */ 20466 openDelphi_fn = function() { 20467 try { 20468 window.showDelphiWidget(); 20469 window.toggleDelphiWidget(true); 20470 setTimeout(() => { 20471 __privateMethod(this, _instances8, closeOmniPanel_fn).call(this); 20472 }, this.constructor.CLOSE_PANEL_DELAY_MS); 20473 } catch (error2) { 20474 console.error("[DelphiHandoff] Error opening Delphi:", error2); 20475 __privateMethod(this, _instances8, handleError_fn).call(this, "Failed to open Delphi widget"); 20476 } 20477 }; 20478 /** 20479 * Wait for Delphi to be fully initialized and ready 20480 * @private 20481 * @param {Function} callback - Function to call when Delphi is ready 20482 * @param {number} retries - Current retry count 20483 */ 20484 waitForDelphiReady_fn = function(callback, retries) { 20485 if (typeof window.toggleDelphiWidget === "function") { 20486 callback(); 20487 } else if (retries < this.constructor.MAX_RETRIES) { 20488 setTimeout(() => { 20489 __privateMethod(this, _instances8, waitForDelphiReady_fn).call(this, callback, retries + 1); 20490 }, this.constructor.RETRY_DELAY_MS); 20491 } else { 20492 console.error("[DelphiHandoff] Delphi failed to initialize after maximum retries"); 20493 __privateMethod(this, _instances8, handleError_fn).call(this, "Delphi is not available after retries"); 20494 } 20495 }; 20496 /** 20497 * Handle Delphi initialization errors 20498 * @private 20499 * @param {string} errorMessage - The error message 20500 */ 20501 handleError_fn = function(errorMessage) { 20502 console.error("[DelphiHandoff] Error:", errorMessage); 20503 this.dispatch("delphi-error", { 20504 detail: { message: errorMessage }, 20505 prefix: "ai-chat" 20506 }); 20507 }; 20508 /** 20509 * Close the Omni panel 20510 * @private 20511 */ 20512 closeOmniPanel_fn = function() { 20513 document.dispatchEvent(new CustomEvent("ai-chat-panel:toggle")); 20514 }; 20515 __publicField(ai_chat_delphi_handoff_controller_default, "MAX_RETRIES", 10); 20516 __publicField(ai_chat_delphi_handoff_controller_default, "RETRY_DELAY_MS", 200); 20517 __publicField(ai_chat_delphi_handoff_controller_default, "CLOSE_PANEL_DELAY_MS", 600); 20518 20519
20519// app/javascript/omni/controllers/ai_chat_intercom_handoff_controller.js 20520 init_define_process(); 20521 init_jquery(); 20522 var _instances9, openIntercomWithSummary_fn, waitForIntercomReady_fn, handleError_fn2, closeOmniPanel_fn2; 20523 var ai_chat_intercom_handoff_controller_default = class extends application_controller_default { 20524 constructor() { 20525 super(...arguments); 20526 __privateAdd(this, _instances9); 20527 } 20528 confirm() { 20529 if (this.hasConfirmButtonTarget) { 20530 if (this.confirmButtonTarget.disabled) return; 20531 this.confirmButtonTarget.disabled = true; 20532 } 20533 __privateMethod(this, _instances9, waitForIntercomReady_fn).call(this, __privateMethod(this, _instances9, openIntercomWithSummary_fn).bind(this), 0); 20534 } 20535 dismiss() { 20536 if (this.hasOfferTarget) { 20537 this.offerTarget.classList.add("g:hidden"); 20538 } 20539 if (this.hasDismissedTarget) { 20540 this.dismissedTarget.classList.remove("g:hidden"); 20541 } 20542 } 20543 }; 20544 _instances9 = new WeakSet(); 20545 /** 20546 * Open Intercom with the conversation summary 20547 * Uses a workaround for Intercom: show -> hide -> showNewMessage 20548 * @private 20549 */ 20550 openIntercomWithSummary_fn = function() { 20551 if (this.localeValue && this.localeValue !== "en") { 20552 try { 20553 window.Intercom("update", { language_override: this.localeValue }); 20554 } catch (error2) { 20555 console.warn("Failed to set Intercom locale:", error2); 20556 } 20557 } 20558 window.Intercom("show"); 20559 setTimeout(() => { 20560 window.Intercom("hide"); 20561 setTimeout(() => { 20562 window.Intercom("showNewMessage", this.summaryValue); 20563 setTimeout(() => { 20564 __privateMethod(this, _instances9, closeOmniPanel_fn2).call(this); 20565 }, this.constructor.CLOSE_PANEL_DELAY_MS); 20566 }, this.constructor.RETRY_DELAY_MS); 20567 }, this.constructor.INTERCOM_SHOW_DELAY_MS); 20568 }; 20569 /** 20570 * Wait for Intercom to be fully initialized and ready 20571 * @private 20572 * @param {Function} callback - Function to call when Intercom is ready 20573 * @param {number} retries - Current retry count 20574 */ 20575 waitForIntercomReady_fn = function(callback, retries) { 20576 if (typeof window.Intercom === "function") { 20577 try { 20578 window.Intercom("update"); 20579 callback(); 20580 } catch { 20581 if (retries < this.constructor.MAX_RETRIES) { 20582 setTimeout(() => { 20583 __privateMethod(this, _instances9, waitForIntercomReady_fn).call(this, callback, retries + 1); 20584 }, this.constructor.RETRY_DELAY_MS); 20585 } else { 20586 __privateMethod(this, _instances9, handleError_fn2).call(this, "Intercom failed to initialize after retries"); 20587 } 20588 } 20589 } else if (retries < this.constructor.MAX_RETRIES) { 20590 setTimeout(() => { 20591 __privateMethod(this, _instances9, waitForIntercomReady_fn).call(this, callback, retries + 1); 20592 }, this.constructor.RETRY_DELAY_MS); 20593 } else { 20594 __privateMethod(this, _instances9, handleError_fn2).call(this, "Intercom is not available after retries"); 20595 } 20596 }; 20597 /** 20598 * Handle Intercom initialization errors 20599 * @private 20600 * @param {string} errorMessage - The error message 20601 */ 20602 handleError_fn2 = function(errorMessage) { 20603 if (this.hasConfirmButtonTarget) { 20604 this.confirmButtonTarget.disabled = false; 20605 } 20606 this.dispatch("intercom-error", { 20607 detail: { message: errorMessage }, 20608 prefix: "ai-chat" 20609 }); 20610 }; 20611 /** 20612 * Close the Omni panel 20613 * @private 20614 */ 20615 closeOmniPanel_fn2 = function() { 20616 document.dispatchEvent(new CustomEvent("ai-chat-panel:toggle")); 20617 }; 20618 __publicField(ai_chat_intercom_handoff_controller_default, "targets", ["offer", "dismissed", "confirmButton"]); 20619 __publicField(ai_chat_intercom_handoff_controller_default, "values", { 20620 summary: String, 20621 locale: String 20622 }); 20623 __publicField(ai_chat_intercom_handoff_controller_default, "MAX_RETRIES", 10); 20624 __publicField(ai_chat_intercom_handoff_controller_default, "RETRY_DELAY_MS", 200); 20625 __publicField(ai_chat_intercom_handoff_controller_default, "CLOSE_PANEL_DELAY_MS", 600); 20626 __publicField(ai_chat_intercom_handoff_controller_default, "INTERCOM_SHOW_DELAY_MS", 150); 20627 20628
20628// app/javascript/omni/controllers/ai_conversation_list_controller.js 20629 init_define_process(); 20630 init_jquery(); 20631 var import_stimulus2 = __toESM(require_stimulus_umd()); 20632 var ai_conversation_list_controller_default = class extends import_stimulus2.Controller { 20633 connect() { 20634 this.searchDebounced = this.debounce(this.performSearch.bind(this), 300); 20635 this.selectedIndex = -1; 20636 const dropdown = this.element.closest("wa-dropdown"); 20637 if (dropdown) { 20638 this.dropdownShowHandler = () => { 20639 requestAnimationFrame(() => { 20640 if (this.hasSearchInputTarget) { 20641 this.searchInputTarget.focus(); 20642 } 20643 }); 20644 }; 20645 dropdown.addEventListener("wa-after-show", this.dropdownShowHandler); 20646 if (dropdown.open) { 20647 requestAnimationFrame(() => { 20648 if (this.hasSearchInputTarget) { 20649 this.searchInputTarget.focus(); 20650 } 20651 }); 20652 } 20653 } 20654 this.restoreActiveConversation(); 20655 } 20656 disconnect() { 20657 const dropdown = this.element.closest("wa-dropdown"); 20658 if (dropdown && this.dropdownShowHandler) { 20659 dropdown.removeEventListener("wa-after-show", this.dropdownShowHandler); 20660 } 20661 } 20662 restoreActiveConversation() { 20663 try { 20664 const activeConversationId = localStorage.getItem("omni_active_conversation_id"); 20665 if (activeConversationId) { 20666 const activeButton = this.element.querySelector(`[data-conversation-id="${activeConversationId}"]`); 20667 if (activeButton) { 20668 activeButton.classList.add("g:bg-blue-50", "g:border-blue-500"); 20669 } 20670 } 20671 } catch { 20672 } 20673 } 20674 handleKeydown(event) { 20675 const conversationButtons = this.getConversationButtons(); 20676 if (event.key === "ArrowDown") { 20677 event.preventDefault(); 20678 this.selectedIndex = Math.min(this.selectedIndex + 1, conversationButtons.length - 1); 20679 this.updateSelection(conversationButtons); 20680 } else if (event.key === "ArrowUp") { 20681 event.preventDefault(); 20682 this.selectedIndex = Math.max(this.selectedIndex - 1, -1); 20683 this.updateSelection(conversationButtons); 20684 } else if (event.key === "Enter" && this.selectedIndex >= 0) { 20685 event.preventDefault(); 20686 const selectedButton = conversationButtons[this.selectedIndex]; 20687 if (selectedButton) { 20688 const conversationId = selectedButton.dataset.conversationId; 20689 this.clearKeyboardHighlight(); 20690 this.setActiveConversation(conversationId); 20691 selectedButton.click(); 20692 } 20693 } else if (event.key === "Escape") { 20694 event.preventDefault(); 20695 const dropdown = this.element.closest("wa-dropdown"); 20696 if (dropdown) { 20697 dropdown.open = false; 20698 } 20699 } 20700 } 20701 getConversationButtons() { 20702 return Array.from(this.element.querySelectorAll("[data-conversation-id]")); 20703 } 20704 updateSelection(conversationButtons) { 20705 conversationButtons.forEach((button, index) => { 20706 if (index === this.selectedIndex) { 20707 button.classList.add("g:bg-blue-50", "g:ring-2", "g:ring-blue-500"); 20708 button.scrollIntoView({ block: "nearest", behavior: "smooth" }); 20709 } else { 20710 button.classList.remove("g:bg-blue-50", "g:ring-2", "g:ring-blue-500"); 20711 } 20712 }); 20713 } 20714 search(event) { 20715 const query = event.target.value; 20716 this.selectedIndex = -1; 20717 if (query.length === 0 || query.length >= 2) { 20718 this.searchDebounced(query); 20719 } 20720 } 20721 performSearch(query) { 20722 const url = `/account/ai_chats/search?query=${encodeURIComponent(query)}`; 20723 fetch(url, { 20724 headers: { 20725 Accept: "text/vnd.turbo-stream.html" 20726 } 20727 }).then((response) => { 20728 if (response.ok) { 20729 return response.text(); 20730 } 20731 throw new Error(`Search failed: ${response.status}`); 20732 }).then((html) => { 20733 if (html) { 20734 Turbo.renderStreamMessage(html); 20735 } 20736 }).catch((error2) => { 20737 console.error("Conversation search error:", error2); 20738 }); 20739 } 20740 debounce(func, wait) { 20741 let timeout; 20742 return function(...args) { 20743 clearTimeout(timeout); 20744 timeout = setTimeout(() => func.apply(this, args), wait); 20745 }; 20746 } 20747 async selectConversation(event) { 20748 const conversationId = event.currentTarget.dataset.conversationId; 20749 const conversationTitle = event.currentTarget.querySelector("span")?.textContent || this.newConversationValue; 20750 this.clearKeyboardHighlight(); 20751 this.setActiveConversation(conversationId); 20752 const chatController = this.application.getControllerForElementAndIdentifier( 20753 document.querySelector('[data-controller~="ai-chat"]'), 20754 "ai-chat" 20755 ); 20756 if (chatController) { 20757 chatController.setChatId(conversationId); 20758 chatController.clearMessagesImmediately(); 20759 } 20760 const titleElement = document.getElementById("conversation-title"); 20761 if (titleElement) { 20762 titleElement.textContent = conversationTitle; 20763 } 20764 const dropdown = this.element.closest("wa-dropdown"); 20765 if (dropdown) { 20766 dropdown.open = false;
20767 } 20768 const response = await fetch(`/account/ai_chats/${conversationId}`, { 20769 headers: { 20770 Accept: "text/vnd.turbo-stream.html" 20771 }, 20772 cache: "no-cache" 20773 }); 20774 if (response.ok) { 20775 const html = await response.text(); 20776 if (html) { 20777 Turbo.renderStreamMessage(html); 20778 } 20779 } 20780 if (chatController) { 20781 chatController.hideLoadingScreen(); 20782 } 20783 requestAnimationFrame(() => { 20784 document.dispatchEvent( 20785 new CustomEvent("ai-chat:conversation-loaded", { 20786 detail: { conversationId } 20787 }) 20788 ); 20789 }); 20790 setTimeout(() => { 20791 const chatInput = document.querySelector('[data-ai-chat-target="input"]'); 20792 if (chatInput) { 20793 chatInput.focus(); 20794 } 20795 }, 100); 20796 } 20797 clearKeyboardHighlight() { 20798 const conversationButtons = this.getConversationButtons(); 20799 conversationButtons.forEach((button) => { 20800 button.classList.remove("g:bg-blue-50", "g:ring-2", "g:ring-blue-500"); 20801 }); 20802 this.selectedIndex = -1; 20803 } 20804 setActiveConversation(conversationId) { 20805 const conversationButtons = this.getConversationButtons(); 20806 conversationButtons.forEach((button) => { 20807 button.classList.remove("g:bg-blue-50", "g:border-blue-500"); 20808 }); 20809 const selectedButton = this.element.querySelector(`[data-conversation-id="${conversationId}"]`); 20810 if (selectedButton) { 20811 selectedButton.classList.add("g:bg-blue-50", "g:border-blue-500"); 20812 } 20813 try { 20814 localStorage.setItem("omni_active_conversation_id", conversationId); 20815 } catch { 20816 } 20817 } 20818 loadMore(event) { 20819 const button = event.currentTarget; 20820 const query = button.dataset.aiConversationListQueryParam || ""; 20821 const page = button.dataset.aiConversationListPageParam; 20822 button.disabled = true; 20823 button.textContent = this.loadingValue; 20824 const url = `/account/ai_chats/search?query=${encodeURIComponent(query)}&page=${page}`; 20825 fetch(url, { 20826 headers: { 20827 Accept: "text/vnd.turbo-stream.html" 20828 } 20829 }).then((response) => { 20830 if (response.ok) { 20831 return response.text(); 20832 } 20833 throw new Error(`Load more failed: ${response.status}`); 20834 }).then((html) => { 20835 if (html) { 20836 Turbo.renderStreamMessage(html); 20837 } 20838 }).catch((error2) => { 20839 console.error("Load more error:", error2); 20840 button.disabled = false; 20841 button.textContent = this.loadMoreValue; 20842 }); 20843 } 20844 }; 20845 __publicField(ai_conversation_list_controller_default, "targets", ["searchInput"]); 20846 __publicField(ai_conversation_list_controller_default, "values", { 20847 newConversation: String, 20848 loading: String, 20849 loadMore: String 20850 }); 20851 20852
20852// app/javascript/utils/omni_editor_integration.js 20853 init_define_process(); 20854 init_jquery(); 20855 function initializeOmniEditorIntegration() { 20856 console.log("[Omni] Initializing editor integration"); 20857 window.addEventListener("message", (event) => { 20858 const message = event.data; 20859 if (message.type === "omni:context" && message.context) { 20860 const context = message.context; 20861 console.debug("[Omni][Parent] Received context from editor:", context); 20862 const toggleEvent = new CustomEvent("ai-chat-panel:toggle", { 20863 detail: { forceOpen: true }, 20864 bubbles: true 20865 }); 20866 document.dispatchEvent(toggleEvent); 20867 setTimeout(() => { 20868 const aiChatElement = document.querySelector('[data-controller="ai-chat"]'); 20869 if (aiChatElement) { 20870 const contextEvent = new CustomEvent("omni:context-received", { 20871 detail: context, 20872 bubbles: true 20873 }); 20874 aiChatElement.dispatchEvent(contextEvent); 20875 } else { 20876 console.warn("[Omni][Parent] ai-chat element not found"); 20877 } 20878 }, 100); 20879 } 20880 }); 20881 document.addEventListener("ai-chat-panel:expanded", () => { 20882 sendPanelStateToEditor(true); 20883 }); 20884 document.addEventListener("ai-chat-panel:collapsed", () => { 20885 sendPanelStateToEditor(false); 20886 }); 20887 function sendPanelStateToEditor(expanded) { 20888 const editorIframe = document.querySelector('iframe[id*="editor"]'); 20889 if (editorIframe?.contentWindow) { 20890 console.debug("[Omni][Parent] Sending panel state to editor:", { 20891 expanded 20892 }); 20893 editorIframe.contentWindow.postMessage({ type: "omni:panel-state", expanded }, "*"); 20894 } 20895 } 20896 document.addEventListener("ai-chat:fill-input", (event) => { 20897 const { content, context } = event.detail; 20898 if (context.editorNodeId) { 20899 console.debug("[Omni][Parent] Sending fill to editor:", { 20900 content, 20901 context 20902 }); 20903 const editorIframe = document.querySelector('iframe[id*="editor"]'); 20904 if (editorIframe && editorIframe.contentWindow) { 20905 editorIframe.contentWindow.postMessage( 20906 { 20907 type: "omni:fill", 20908 content, 20909 context 20910 }, 20911 "*" 20912 ); 20913 } else { 20914 console.warn("[Omni][Parent] Editor iframe not found"); 20915 } 20916 } 20917 }); 20918 } 20919 20920
20920// app/javascript/entrypoints/account/omni.js 20921 var application = window.Stimulus || import_stimulus3.Application.start(); 20922 application.register("omni-input", omni_input_controller_default); 20923 application.register("omni-capabilities", omni_capabilities_controller_default); 20924 application.register("ai-chat", ai_chat_controller_default); 20925 application.register("ai-chat-panel", ai_chat_panel_controller_default); 20926 application.register("ai-chat-panel-trigger", ai_chat_panel_trigger_controller_default); 20927 application.register("ai-chat-panel-resize", ai_chat_panel_resize_controller_default); 20928 application.register("ai-chat-onboarding", ai_chat_onboarding_controller_default); 20929 application.register("ai-chat-delphi-handoff", ai_chat_delphi_handoff_controller_default); 20930 application.register("ai-chat-intercom-handoff", ai_chat_intercom_handoff_controller_default); 20931 application.register("ai-conversation-list", ai_conversation_list_controller_default); 20932 window.Stimulus = application; 20933 initializeOmniEditorIntegration(); 20934})(); 20935/*! Bundled license information: 20936 20937jquery/dist/jquery.js: 20938 (*! 20939 * jQuery JavaScript Library v3.5.1 20940 * https://jquery.com/ 20941 * 20942 * Includes Sizzle.js 20943 * https://sizzlejs.com/ 20944 * 20945 * Copyright JS Foundation and other contributors 20946 * Released under the MIT license 20947 * https://jquery.org/license 20948 * 20949 * Date: 2020-05-04T22:49Z 20950 *) 20951 20952lodash/lodash.js: 20953 (** 20954 * @license 20955 * Lodash <https://lodash.com/> 20956 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 20957 * Released under MIT license <https://lodash.com/license> 20958 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 20959 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 20960 *) 20961*/ 20962//# sourceMappingURL=/assets/omni.js-0796e210884d1f9aff5b0895518c9de91e1c95a4369cd98f743d913ebefe9a5c.map 20963//! 20964;
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.