1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) 10/******/ return installedModules[moduleId].exports; 11 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ exports: {}, 15/******/ id: moduleId, 16/******/ loaded: false 17/******/ }; 18 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 22/******/ // Flag the module as loaded 23/******/ module.loaded = true; 24 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28 29 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35 36/******/ // __webpack_public_path__ 37/******/ __webpack_require__.p = ""; 38 39/******/ // Load entry module and return exports 40/******/ return __webpack_require__(0); 41/******/ }) 42/************************************************************************/ 43/******/ ([ 44/* 0 */ 45/***/ (function(module, exports, __webpack_require__) { 46 47 __webpack_require__(1); 48 module.exports = __webpack_require__(297); 49 50 51/***/ }), 52/* 1 */ 53/***/ (function(module, exports, __webpack_require__) { 54 55 /* WEBPACK VAR INJECTION */(function(global) {"use strict"; 56 57 __webpack_require__(2); 58 59 __webpack_require__(293); 60 61 __webpack_require__(294); 62 63 if (global._babelPolyfill) { 64 throw new Error("only one instance of babel-polyfill is allowed"); 65 } 66 global._babelPolyfill = true; 67 68 var DEFINE_PROPERTY = "defineProperty"; 69 function define(O, key, value) { 70 O[key] || Object[DEFINE_PROPERTY](O, key, { 71 writable: true, 72 configurable: true, 73 value: value 74 }); 75 } 76 77 define(String.prototype, "padLeft", "".padStart); 78 define(String.prototype, "padRight", "".padEnd); 79 80 "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) { 81 [][key] && define(Array, key, Function.call.bind([][key])); 82 }); 83 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 84 85/***/ }), 86/* 2 */ 87/***/ (function(module, exports, __webpack_require__) { 88 89 __webpack_require__(3); 90 __webpack_require__(52); 91 __webpack_require__(53); 92 __webpack_require__(54); 93 __webpack_require__(55); 94 __webpack_require__(57); 95 __webpack_require__(60); 96 __webpack_require__(61); 97 __webpack_require__(62); 98 __webpack_require__(63); 99 __webpack_require__(64); 100 __webpack_require__(65); 101 __webpack_require__(66); 102 __webpack_require__(67); 103 __webpack_require__(68); 104 __webpack_require__(70); 105 __webpack_require__(72); 106 __webpack_require__(74); 107 __webpack_require__(76); 108 __webpack_require__(79); 109 __webpack_require__(80); 110 __webpack_require__(81); 111 __webpack_require__(85); 112 __webpack_require__(87); 113 __webpack_require__(89); 114 __webpack_require__(92); 115 __webpack_require__(93); 116 __webpack_require__(94); 117 __webpack_require__(95); 118 __webpack_require__(97); 119 __webpack_require__(98); 120 __webpack_require__(99); 121 __webpack_require__(100); 122 __webpack_require__(101); 123 __webpack_require__(102); 124 __webpack_require__(103); 125 __webpack_require__(105); 126 __webpack_require__(106); 127 __webpack_require__(107); 128 __webpack_require__(109); 129 __webpack_require__(110); 130 __webpack_require__(111); 131 __webpack_require__(113); 132 __webpack_require__(114); 133 __webpack_require__(115); 134 __webpack_require__(116); 135 __webpack_require__(117); 136 __webpack_require__(118); 137 __webpack_require__(119); 138 __webpack_require__(120); 139 __webpack_require__(121); 140 __webpack_require__(122); 141 __webpack_require__(123); 142 __webpack_require__(124); 143 __webpack_require__(125); 144 __webpack_require__(126); 145 __webpack_require__(131); 146 __webpack_require__(132); 147 __webpack_require__(136); 148 __webpack_require__(137); 149 __webpack_require__(138); 150 __webpack_require__(139); 151 __webpack_require__(141); 152 __webpack_require__(142); 153 __webpack_require__(143); 154 __webpack_require__(144); 155 __webpack_require__(145); 156 __webpack_require__(146); 157 __webpack_require__(147); 158 __webpack_require__(148); 159 __webpack_require__(149); 160 __webpack_require__(150); 161 __webpack_require__(151); 162 __webpack_require__(152); 163 __webpack_require__(153); 164 __webpack_require__(154); 165 __webpack_require__(155); 166 __webpack_require__(156); 167 __webpack_require__(157); 168 __webpack_require__(159); 169 __webpack_require__(160); 170 __webpack_require__(166); 171 __webpack_require__(167); 172 __webpack_require__(169); 173 __webpack_require__(170); 174 __webpack_require__(171); 175 __webpack_require__(175); 176 __webpack_require__(176); 177 __webpack_require__(177); 178 __webpack_require__(178); 179 __webpack_require__(179); 180 __webpack_require__(181); 181 __webpack_require__(182); 182 __webpack_require__(183); 183 __webpack_require__(184); 184 __webpack_require__(187); 185 __webpack_require__(189); 186 __webpack_require__(190); 187 __webpack_require__(191); 188 __webpack_require__(193); 189 __webpack_require__(195); 190 __webpack_require__(197); 191 __webpack_require__(198); 192 __webpack_require__(199); 193 __webpack_require__(201); 194 __webpack_require__(202); 195 __webpack_require__(203); 196 __webpack_require__(204); 197 __webpack_require__(211); 198 __webpack_require__(214); 199 __webpack_require__(215); 200 __webpack_require__(217); 201 __webpack_require__(218); 202 __webpack_require__(221); 203 __webpack_require__(222); 204 __webpack_require__(224); 205 __webpack_require__(225); 206 __webpack_require__(226); 207 __webpack_require__(227); 208 __webpack_require__(228); 209 __webpack_require__(229); 210 __webpack_require__(230); 211 __webpack_require__(231); 212 __webpack_require__(232); 213 __webpack_require__(233); 214 __webpack_require__(234); 215 __webpack_require__(235); 216 __webpack_require__(236); 217 __webpack_require__(237); 218 __webpack_require__(238); 219 __webpack_require__(239); 220 __webpack_require__(240); 221 __webpack_require__(241); 222 __webpack_require__(242); 223 __webpack_require__(244); 224 __webpack_require__(245); 225 __webpack_require__(246); 226 __webpack_require__(247); 227 __webpack_require__(248); 228 __webpack_require__(249); 229 __webpack_require__(251); 230 __webpack_require__(252); 231 __webpack_require__(253); 232 __webpack_require__(254); 233 __webpack_require__(255); 234 __webpack_require__(256); 235 __webpack_require__(257); 236 __webpack_require__(258); 237 __webpack_require__(260); 238 __webpack_require__(261); 239 __webpack_require__(263); 240 __webpack_require__(264); 241 __webpack_require__(265); 242 __webpack_require__(266); 243 __webpack_require__(269); 244 __webpack_require__(270); 245 __webpack_require__(271); 246 __webpack_require__(272); 247 __webpack_require__(273); 248 __webpack_require__(274); 249 __webpack_require__(275); 250 __webpack_require__(276); 251 __webpack_require__(278); 252 __webpack_require__(279); 253 __webpack_require__(280); 254 __webpack_require__(281); 255 __webpack_require__(282); 256 __webpack_require__(283); 257 __webpack_require__(284); 258 __webpack_require__(285); 259 __webpack_require__(286); 260 __webpack_require__(287); 261 __webpack_require__(288); 262 __webpack_require__(291); 263 __webpack_require__(292); 264 module.exports = __webpack_require__(9); 265 266/***/ }), 267/* 3 */ 268/***/ (function(module, exports, __webpack_require__) { 269 270 'use strict'; 271 // ECMAScript 6 symbols shim 272 var global = __webpack_require__(4) 273 , has = __webpack_require__(5) 274 , DESCRIPTORS = __webpack_require__(6) 275 , $export = __webpack_require__(8) 276 , redefine = __webpack_require__(18) 277 , META = __webpack_require__(22).KEY 278 , $fails = __webpack_require__(7) 279 , shared = __webpack_require__(23) 280 , setToStringTag = __webpack_require__(24) 281 , uid = __webpack_require__(19) 282 , wks = __webpack_require__(25) 283 , wksExt = __webpack_require__(26) 284 , wksDefine = __webpack_require__(27) 285 , keyOf = __webpack_require__(29) 286 , enumKeys = __webpack_require__(42) 287 , isArray = __webpack_require__(45) 288 , anObject = __webpack_require__(12) 289 , toIObject = __webpack_require__(32) 290 , toPrimitive = __webpack_require__(16) 291 , createDesc = __webpack_require__(17) 292 , _create = __webpack_require__(46) 293 , gOPNExt = __webpack_require__(49) 294 , $GOPD = __webpack_require__(51) 295 , $DP = __webpack_require__(11) 296 , $keys = __webpack_require__(30) 297 , gOPD = $GOPD.f 298 , dP = $DP.f 299 , gOPN = gOPNExt.f 300 , $Symbol = global.Symbol 301 , $JSON = global.JSON 302 , _stringify = $JSON && $JSON.stringify 303 , PROTOTYPE = 'prototype' 304 , HIDDEN = wks('_hidden') 305 , TO_PRIMITIVE = wks('toPrimitive') 306 , isEnum = {}.propertyIsEnumerable 307 , SymbolRegistry = shared('symbol-registry') 308 , AllSymbols = shared('symbols')
vendor: 9,146 bytes, lines 309-562
309 , OPSymbols = shared('op-symbols') 310 , ObjectProto = Object[PROTOTYPE] 311 , USE_NATIVE = typeof $Symbol == 'function' 312 , QObject = global.QObject; 313 // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 314 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; 315 316 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 317 var setSymbolDesc = DESCRIPTORS && $fails(function(){ 318 return _create(dP({}, 'a', { 319 get: function(){ return dP(this, 'a', {value: 7}).a; } 320 })).a != 7; 321 }) ? function(it, key, D){ 322 var protoDesc = gOPD(ObjectProto, key); 323 if(protoDesc)delete ObjectProto[key]; 324 dP(it, key, D); 325 if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); 326 } : dP; 327 328 var wrap = function(tag){ 329 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); 330 sym._k = tag; 331 return sym; 332 }; 333 334 var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ 335 return typeof it == 'symbol'; 336 } : function(it){ 337 return it instanceof $Symbol; 338 }; 339 340 var $defineProperty = function defineProperty(it, key, D){ 341 if(it === ObjectProto)$defineProperty(OPSymbols, key, D); 342 anObject(it); 343 key = toPrimitive(key, true); 344 anObject(D); 345 if(has(AllSymbols, key)){ 346 if(!D.enumerable){ 347 if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); 348 it[HIDDEN][key] = true; 349 } else { 350 if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; 351 D = _create(D, {enumerable: createDesc(0, false)}); 352 } return setSymbolDesc(it, key, D); 353 } return dP(it, key, D); 354 }; 355 var $defineProperties = function defineProperties(it, P){ 356 anObject(it); 357 var keys = enumKeys(P = toIObject(P)) 358 , i = 0 359 , l = keys.length 360 , key; 361 while(l > i)$defineProperty(it, key = keys[i++], P[key]); 362 return it; 363 }; 364 var $create = function create(it, P){ 365 return P === undefined ? _create(it) : $defineProperties(_create(it), P); 366 }; 367 var $propertyIsEnumerable = function propertyIsEnumerable(key){ 368 var E = isEnum.call(this, key = toPrimitive(key, true)); 369 if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; 370 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; 371 }; 372 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ 373 it = toIObject(it); 374 key = toPrimitive(key, true); 375 if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; 376 var D = gOPD(it, key); 377 if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; 378 return D; 379 }; 380 var $getOwnPropertyNames = function getOwnPropertyNames(it){ 381 var names = gOPN(toIObject(it)) 382 , result = [] 383 , i = 0 384 , key; 385 while(names.length > i){ 386 if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); 387 } return result; 388 }; 389 var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ 390 var IS_OP = it === ObjectProto 391 , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) 392 , result = [] 393 , i = 0 394 , key; 395 while(names.length > i){ 396 if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); 397 } return result; 398 }; 399 400 // 19.4.1.1 Symbol([description]) 401 if(!USE_NATIVE){ 402 $Symbol = function Symbol(){ 403 if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); 404 var tag = uid(arguments.length > 0 ? arguments[0] : undefined); 405 var $set = function(value){ 406 if(this === ObjectProto)$set.call(OPSymbols, value); 407 if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; 408 setSymbolDesc(this, tag, createDesc(1, value)); 409 }; 410 if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); 411 return wrap(tag); 412 }; 413 redefine($Symbol[PROTOTYPE], 'toString', function toString(){ 414 return this._k; 415 }); 416 417 $GOPD.f = $getOwnPropertyDescriptor; 418 $DP.f = $defineProperty; 419 __webpack_require__(50).f = gOPNExt.f = $getOwnPropertyNames; 420 __webpack_require__(44).f = $propertyIsEnumerable; 421 __webpack_require__(43).f = $getOwnPropertySymbols; 422 423 if(DESCRIPTORS && !__webpack_require__(28)){ 424 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); 425 } 426 427 wksExt.f = function(name){ 428 return wrap(wks(name)); 429 } 430 } 431 432 $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); 433 434 for(var symbols = ( 435 // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 436 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' 437 ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); 438 439 for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); 440 441 $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { 442 // 19.4.2.1 Symbol.for(key) 443 'for': function(key){ 444 return has(SymbolRegistry, key += '') 445 ? SymbolRegistry[key] 446 : SymbolRegistry[key] = $Symbol(key); 447 }, 448 // 19.4.2.5 Symbol.keyFor(sym) 449 keyFor: function keyFor(key){ 450 if(isSymbol(key))return keyOf(SymbolRegistry, key); 451 throw TypeError(key + ' is not a symbol!'); 452 }, 453 useSetter: function(){ setter = true; }, 454 useSimple: function(){ setter = false; } 455 }); 456 457 $export($export.S + $export.F * !USE_NATIVE, 'Object', { 458 // 19.1.2.2 Object.create(O [, Properties]) 459 create: $create, 460 // 19.1.2.4 Object.defineProperty(O, P, Attributes) 461 defineProperty: $defineProperty, 462 // 19.1.2.3 Object.defineProperties(O, Properties) 463 defineProperties: $defineProperties, 464 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 465 getOwnPropertyDescriptor: $getOwnPropertyDescriptor, 466 // 19.1.2.7 Object.getOwnPropertyNames(O) 467 getOwnPropertyNames: $getOwnPropertyNames, 468 // 19.1.2.8 Object.getOwnPropertySymbols(O) 469 getOwnPropertySymbols: $getOwnPropertySymbols 470 }); 471 472 // 24.3.2 JSON.stringify(value [, replacer [, space]]) 473 $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ 474 var S = $Symbol(); 475 // MS Edge converts symbol values to JSON as {} 476 // WebKit converts symbol values to JSON as null 477 // V8 throws on boxed symbols 478 return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; 479 })), 'JSON', { 480 stringify: function stringify(it){ 481 if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined 482 var args = [it] 483 , i = 1 484 , replacer, $replacer; 485 while(arguments.length > i)args.push(arguments[i++]); 486 replacer = args[1]; 487 if(typeof replacer == 'function')$replacer = replacer; 488 if($replacer || !isArray(replacer))replacer = function(key, value){ 489 if($replacer)value = $replacer.call(this, key, value); 490 if(!isSymbol(value))return value; 491 }; 492 args[1] = replacer; 493 return _stringify.apply($JSON, args); 494 } 495 }); 496 497 // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) 498 $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(10)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); 499 // 19.4.3.5 Symbol.prototype[@@toStringTag] 500 setToStringTag($Symbol, 'Symbol'); 501 // 20.2.1.9 Math[@@toStringTag] 502 setToStringTag(Math, 'Math', true); 503 // 24.3.3 JSON[@@toStringTag] 504 setToStringTag(global.JSON, 'JSON', true); 505 506/***/ }), 507/* 4 */ 508/***/ (function(module, exports) { 509 510 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 511 var global = module.exports = typeof window != 'undefined' && window.Math == Math 512 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); 513 if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef 514 515/***/ }), 516/* 5 */ 517/***/ (function(module, exports) { 518 519 var hasOwnProperty = {}.hasOwnProperty; 520 module.exports = function(it, key){ 521 return hasOwnProperty.call(it, key); 522 }; 523 524/***/ }), 525/* 6 */ 526/***/ (function(module, exports, __webpack_require__) { 527 528 // Thank's IE8 for his funny defineProperty 529 module.exports = !__webpack_require__(7)(function(){ 530 return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; 531 }); 532 533/***/ }), 534/* 7 */ 535/***/ (function(module, exports) { 536 537 module.exports = function(exec){ 538 try { 539 return !!exec(); 540 } catch(e){ 541 return true; 542 } 543 }; 544 545/***/ }), 546/* 8 */ 547/***/ (function(module, exports, __webpack_require__) { 548 549 var global = __webpack_require__(4) 550 , core = __webpack_require__(9) 551 , hide = __webpack_require__(10) 552 , redefine = __webpack_require__(18) 553 , ctx = __webpack_require__(20) 554 , PROTOTYPE = 'prototype'; 555 556 var $export = function(type, name, source){ 557 var IS_FORCED = type & $export.F 558 , IS_GLOBAL = type & $export.G 559 , IS_STATIC = type & $export.S 560 , IS_PROTO = type & $export.P 561 , IS_BIND = type & $export.B 562 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
vendor: 4,115 bytes, lines 563-690
563 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) 564 , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) 565 , key, own, out, exp; 566 if(IS_GLOBAL)source = name; 567 for(key in source){ 568 // contains in native 569 own = !IS_FORCED && target && target[key] !== undefined; 570 // export native or passed 571 out = (own ? target : source)[key]; 572 // bind timers to global for call from export context 573 exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 574 // extend global 575 if(target)redefine(target, key, out, type & $export.U); 576 // export 577 if(exports[key] != out)hide(exports, key, exp); 578 if(IS_PROTO && expProto[key] != out)expProto[key] = out; 579 } 580 }; 581 global.core = core; 582 // type bitmap 583 $export.F = 1; // forced 584 $export.G = 2; // global 585 $export.S = 4; // static 586 $export.P = 8; // proto 587 $export.B = 16; // bind 588 $export.W = 32; // wrap 589 $export.U = 64; // safe 590 $export.R = 128; // real proto method for `library` 591 module.exports = $export; 592 593/***/ }), 594/* 9 */ 595/***/ (function(module, exports) { 596 597 var core = module.exports = {version: '2.4.0'}; 598 if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef 599 600/***/ }), 601/* 10 */ 602/***/ (function(module, exports, __webpack_require__) { 603 604 var dP = __webpack_require__(11) 605 , createDesc = __webpack_require__(17); 606 module.exports = __webpack_require__(6) ? function(object, key, value){ 607 return dP.f(object, key, createDesc(1, value)); 608 } : function(object, key, value){ 609 object[key] = value; 610 return object; 611 }; 612 613/***/ }), 614/* 11 */ 615/***/ (function(module, exports, __webpack_require__) { 616 617 var anObject = __webpack_require__(12) 618 , IE8_DOM_DEFINE = __webpack_require__(14) 619 , toPrimitive = __webpack_require__(16) 620 , dP = Object.defineProperty; 621 622 exports.f = __webpack_require__(6) ? Object.defineProperty : function defineProperty(O, P, Attributes){ 623 anObject(O); 624 P = toPrimitive(P, true); 625 anObject(Attributes); 626 if(IE8_DOM_DEFINE)try { 627 return dP(O, P, Attributes); 628 } catch(e){ /* empty */ } 629 if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); 630 if('value' in Attributes)O[P] = Attributes.value; 631 return O; 632 }; 633 634/***/ }), 635/* 12 */ 636/***/ (function(module, exports, __webpack_require__) { 637 638 var isObject = __webpack_require__(13); 639 module.exports = function(it){ 640 if(!isObject(it))throw TypeError(it + ' is not an object!'); 641 return it; 642 }; 643 644/***/ }), 645/* 13 */ 646/***/ (function(module, exports) { 647 648 module.exports = function(it){ 649 return typeof it === 'object' ? it !== null : typeof it === 'function'; 650 }; 651 652/***/ }), 653/* 14 */ 654/***/ (function(module, exports, __webpack_require__) { 655 656 module.exports = !__webpack_require__(6) && !__webpack_require__(7)(function(){ 657 return Object.defineProperty(__webpack_require__(15)('div'), 'a', {get: function(){ return 7; }}).a != 7; 658 }); 659 660/***/ }), 661/* 15 */ 662/***/ (function(module, exports, __webpack_require__) { 663 664 var isObject = __webpack_require__(13) 665 , document = __webpack_require__(4).document 666 // in old IE typeof document.createElement is 'object' 667 , is = isObject(document) && isObject(document.createElement); 668 module.exports = function(it){ 669 return is ? document.createElement(it) : {}; 670 }; 671 672/***/ }), 673/* 16 */ 674/***/ (function(module, exports, __webpack_require__) { 675 676 // 7.1.1 ToPrimitive(input [, PreferredType]) 677 var isObject = __webpack_require__(13); 678 // instead of the ES6 spec version, we didn't implement @@toPrimitive case 679 // and the second argument - flag - preferred type is a string 680 module.exports = function(it, S){ 681 if(!isObject(it))return it; 682 var fn, val; 683 if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; 684 if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; 685 if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; 686 throw TypeError("Can't convert object to primitive value"); 687 }; 688 689/***/ }), 690/* 17 */
691/***/ (function(module, exports) { 692 693 module.exports = function(bitmap, value){ 694 return { 695 enumerable : !(bitmap & 1), 696 configurable: !(bitmap & 2), 697 writable : !(bitmap & 4), 698 value : value 699 }; 700 }; 701 702/***/ }), 703/* 18 */ 704/***/ (function(module, exports, __webpack_require__) { 705 706 var global = __webpack_require__(4) 707 , hide = __webpack_require__(10) 708 , has = __webpack_require__(5) 709 , SRC = __webpack_require__(19)('src') 710 , TO_STRING = 'toString' 711 , $toString = Function[TO_STRING] 712 , TPL = ('' + $toString).split(TO_STRING); 713 714 __webpack_require__(9).inspectSource = function(it){ 715 return $toString.call(it); 716 }; 717 718 (module.exports = function(O, key, val, safe){ 719 var isFunction = typeof val == 'function'; 720 if(isFunction)has(val, 'name') || hide(val, 'name', key); 721 if(O[key] === val)return; 722 if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); 723 if(O === global){ 724 O[key] = val; 725 } else { 726 if(!safe){ 727 delete O[key]; 728 hide(O, key, val); 729 } else { 730 if(O[key])O[key] = val; 731 else hide(O, key, val); 732 } 733 } 734 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 735 })(Function.prototype, TO_STRING, function toString(){ 736 return typeof this == 'function' && this[SRC] || $toString.call(this); 737 }); 738 739/***/ }), 740/* 19 */ 741/***/ (function(module, exports) { 742 743 var id = 0 744 , px = Math.random(); 745 module.exports = function(key){ 746 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 747 }; 748 749/***/ }), 750/* 20 */ 751/***/ (function(module, exports, __webpack_require__) { 752 753 // optional / simple context binding 754 var aFunction = __webpack_require__(21); 755 module.exports = function(fn, that, length){ 756 aFunction(fn); 757 if(that === undefined)return fn; 758 switch(length){ 759 case 1: return function(a){ 760 return fn.call(that, a); 761 }; 762 case 2: return function(a, b){ 763 return fn.call(that, a, b); 764 }; 765 case 3: return function(a, b, c){ 766 return fn.call(that, a, b, c); 767 }; 768 } 769 return function(/* ...args */){ 770 return fn.apply(that, arguments); 771 }; 772 }; 773 774/***/ }), 775/* 21 */ 776/***/ (function(module, exports) { 777 778 module.exports = function(it){ 779 if(typeof it != 'function')throw TypeError(it + ' is not a function!'); 780 return it; 781 }; 782 783/***/ }), 784/* 22 */ 785/***/ (function(module, exports, __webpack_require__) { 786 787 var META = __webpack_require__(19)('meta') 788 , isObject = __webpack_require__(13) 789 , has = __webpack_require__(5) 790 , setDesc = __webpack_require__(11).f 791 , id = 0; 792 var isExtensible = Object.isExtensible || function(){ 793 return true; 794 }; 795 var FREEZE = !__webpack_require__(7)(function(){ 796 return isExtensible(Object.preventExtensions({})); 797 }); 798 var setMeta = function(it){ 799 setDesc(it, META, {value: { 800 i: 'O' + ++id, // object ID 801 w: {} // weak collections IDs 802 }}); 803 }; 804 var fastKey = function(it, create){ 805 // return primitive with prefix 806 if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; 807 if(!has(it, META)){ 808 // can't set metadata to uncaught frozen object 809 if(!isExtensible(it))return 'F'; 810 // not necessary to add metadata 811 if(!create)return 'E'; 812 // add missing metadata 813 setMeta(it); 814 // return object ID 815 } return it[META].i; 816 }; 817 var getWeak = function(it, create){ 818 if(!has(it, META)){ 819 // can't set metadata to uncaught frozen object 820 if(!isExtensible(it))return true; 821 // not necessary to add metadata 822 if(!create)return false; 823 // add missing metadata 824 setMeta(it); 825 // return hash weak collections IDs 826 } return it[META].w; 827 }; 828 // add metadata on freeze-family methods calling 829 var onFreeze = function(it){ 830 if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); 831 return it; 832 }; 833 var meta = module.exports = { 834 KEY: META, 835 NEED: false, 836 fastKey: fastKey, 837 getWeak: getWeak, 838 onFreeze: onFreeze 839 }; 840 841/***/ }), 842/* 23 */ 843/***/ (function(module, exports, __webpack_require__) { 844 845 var global = __webpack_require__(4)
vendor: 12,585 bytes, lines 846-1287
846 , SHARED = '__core-js_shared__' 847 , store = global[SHARED] || (global[SHARED] = {}); 848 module.exports = function(key){ 849 return store[key] || (store[key] = {}); 850 }; 851 852/***/ }), 853/* 24 */ 854/***/ (function(module, exports, __webpack_require__) { 855 856 var def = __webpack_require__(11).f 857 , has = __webpack_require__(5) 858 , TAG = __webpack_require__(25)('toStringTag'); 859 860 module.exports = function(it, tag, stat){ 861 if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); 862 }; 863 864/***/ }), 865/* 25 */ 866/***/ (function(module, exports, __webpack_require__) { 867 868 var store = __webpack_require__(23)('wks') 869 , uid = __webpack_require__(19) 870 , Symbol = __webpack_require__(4).Symbol 871 , USE_SYMBOL = typeof Symbol == 'function'; 872 873 var $exports = module.exports = function(name){ 874 return store[name] || (store[name] = 875 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); 876 }; 877 878 $exports.store = store; 879 880/***/ }), 881/* 26 */ 882/***/ (function(module, exports, __webpack_require__) { 883 884 exports.f = __webpack_require__(25); 885 886/***/ }), 887/* 27 */ 888/***/ (function(module, exports, __webpack_require__) { 889 890 var global = __webpack_require__(4) 891 , core = __webpack_require__(9) 892 , LIBRARY = __webpack_require__(28) 893 , wksExt = __webpack_require__(26) 894 , defineProperty = __webpack_require__(11).f; 895 module.exports = function(name){ 896 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); 897 if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); 898 }; 899 900/***/ }), 901/* 28 */ 902/***/ (function(module, exports) { 903 904 module.exports = false; 905 906/***/ }), 907/* 29 */ 908/***/ (function(module, exports, __webpack_require__) { 909 910 var getKeys = __webpack_require__(30) 911 , toIObject = __webpack_require__(32); 912 module.exports = function(object, el){ 913 var O = toIObject(object) 914 , keys = getKeys(O) 915 , length = keys.length 916 , index = 0 917 , key; 918 while(length > index)if(O[key = keys[index++]] === el)return key; 919 }; 920 921/***/ }), 922/* 30 */ 923/***/ (function(module, exports, __webpack_require__) { 924 925 // 19.1.2.14 / 15.2.3.14 Object.keys(O) 926 var $keys = __webpack_require__(31) 927 , enumBugKeys = __webpack_require__(41); 928 929 module.exports = Object.keys || function keys(O){ 930 return $keys(O, enumBugKeys); 931 }; 932 933/***/ }), 934/* 31 */ 935/***/ (function(module, exports, __webpack_require__) { 936 937 var has = __webpack_require__(5) 938 , toIObject = __webpack_require__(32) 939 , arrayIndexOf = __webpack_require__(36)(false) 940 , IE_PROTO = __webpack_require__(40)('IE_PROTO'); 941 942 module.exports = function(object, names){ 943 var O = toIObject(object) 944 , i = 0 945 , result = [] 946 , key; 947 for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); 948 // Don't enum bug & hidden keys 949 while(names.length > i)if(has(O, key = names[i++])){ 950 ~arrayIndexOf(result, key) || result.push(key); 951 } 952 return result; 953 }; 954 955/***/ }), 956/* 32 */ 957/***/ (function(module, exports, __webpack_require__) { 958 959 // to indexed object, toObject with fallback for non-array-like ES3 strings 960 var IObject = __webpack_require__(33) 961 , defined = __webpack_require__(35); 962 module.exports = function(it){ 963 return IObject(defined(it)); 964 }; 965 966/***/ }), 967/* 33 */ 968/***/ (function(module, exports, __webpack_require__) { 969 970 // fallback for non-array-like ES3 and non-enumerable old V8 strings 971 var cof = __webpack_require__(34); 972 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ 973 return cof(it) == 'String' ? it.split('') : Object(it); 974 }; 975 976/***/ }), 977/* 34 */ 978/***/ (function(module, exports) { 979 980 var toString = {}.toString; 981 982 module.exports = function(it){ 983 return toString.call(it).slice(8, -1); 984 }; 985 986/***/ }), 987/* 35 */ 988/***/ (function(module, exports) { 989 990 // 7.2.1 RequireObjectCoercible(argument) 991 module.exports = function(it){ 992 if(it == undefined)throw TypeError("Can't call method on " + it); 993 return it; 994 }; 995 996/***/ }), 997/* 36 */ 998/***/ (function(module, exports, __webpack_require__) { 999 1000 // false -> Array#indexOf 1001 // true -> Array#includes 1002 var toIObject = __webpack_require__(32) 1003 , toLength = __webpack_require__(37) 1004 , toIndex = __webpack_require__(39); 1005 module.exports = function(IS_INCLUDES){ 1006 return function($this, el, fromIndex){ 1007 var O = toIObject($this) 1008 , length = toLength(O.length) 1009 , index = toIndex(fromIndex, length) 1010 , value; 1011 // Array#includes uses SameValueZero equality algorithm 1012 if(IS_INCLUDES && el != el)while(length > index){ 1013 value = O[index++]; 1014 if(value != value)return true; 1015 // Array#toIndex ignores holes, Array#includes - not 1016 } else for(;length > index; index++)if(IS_INCLUDES || index in O){ 1017 if(O[index] === el)return IS_INCLUDES || index || 0; 1018 } return !IS_INCLUDES && -1; 1019 }; 1020 }; 1021 1022/***/ }), 1023/* 37 */ 1024/***/ (function(module, exports, __webpack_require__) { 1025 1026 // 7.1.15 ToLength 1027 var toInteger = __webpack_require__(38) 1028 , min = Math.min; 1029 module.exports = function(it){ 1030 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 1031 }; 1032 1033/***/ }), 1034/* 38 */ 1035/***/ (function(module, exports) { 1036 1037 // 7.1.4 ToInteger 1038 var ceil = Math.ceil 1039 , floor = Math.floor; 1040 module.exports = function(it){ 1041 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 1042 }; 1043 1044/***/ }), 1045/* 39 */ 1046/***/ (function(module, exports, __webpack_require__) { 1047 1048 var toInteger = __webpack_require__(38) 1049 , max = Math.max 1050 , min = Math.min; 1051 module.exports = function(index, length){ 1052 index = toInteger(index); 1053 return index < 0 ? max(index + length, 0) : min(index, length); 1054 }; 1055 1056/***/ }), 1057/* 40 */ 1058/***/ (function(module, exports, __webpack_require__) { 1059 1060 var shared = __webpack_require__(23)('keys') 1061 , uid = __webpack_require__(19); 1062 module.exports = function(key){ 1063 return shared[key] || (shared[key] = uid(key)); 1064 }; 1065 1066/***/ }), 1067/* 41 */ 1068/***/ (function(module, exports) { 1069 1070 // IE 8- don't enum bug keys 1071 module.exports = ( 1072 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' 1073 ).split(','); 1074 1075/***/ }), 1076/* 42 */ 1077/***/ (function(module, exports, __webpack_require__) { 1078 1079 // all enumerable object keys, includes symbols 1080 var getKeys = __webpack_require__(30) 1081 , gOPS = __webpack_require__(43) 1082 , pIE = __webpack_require__(44); 1083 module.exports = function(it){ 1084 var result = getKeys(it) 1085 , getSymbols = gOPS.f; 1086 if(getSymbols){ 1087 var symbols = getSymbols(it) 1088 , isEnum = pIE.f 1089 , i = 0 1090 , key; 1091 while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); 1092 } return result; 1093 }; 1094 1095/***/ }), 1096/* 43 */ 1097/***/ (function(module, exports) { 1098 1099 exports.f = Object.getOwnPropertySymbols; 1100 1101/***/ }), 1102/* 44 */ 1103/***/ (function(module, exports) { 1104 1105 exports.f = {}.propertyIsEnumerable; 1106 1107/***/ }), 1108/* 45 */ 1109/***/ (function(module, exports, __webpack_require__) { 1110 1111 // 7.2.2 IsArray(argument) 1112 var cof = __webpack_require__(34); 1113 module.exports = Array.isArray || function isArray(arg){ 1114 return cof(arg) == 'Array'; 1115 }; 1116 1117/***/ }), 1118/* 46 */ 1119/***/ (function(module, exports, __webpack_require__) { 1120 1121 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 1122 var anObject = __webpack_require__(12) 1123 , dPs = __webpack_require__(47) 1124 , enumBugKeys = __webpack_require__(41) 1125 , IE_PROTO = __webpack_require__(40)('IE_PROTO') 1126 , Empty = function(){ /* empty */ } 1127 , PROTOTYPE = 'prototype'; 1128 1129 // Create object with fake `null` prototype: use iframe Object with cleared prototype 1130 var createDict = function(){ 1131 // Thrash, waste and sodomy: IE GC bug 1132 var iframe = __webpack_require__(15)('iframe') 1133 , i = enumBugKeys.length 1134 , lt = '<' 1135 , gt = '>' 1136 , iframeDocument; 1137 iframe.style.display = 'none'; 1138 __webpack_require__(48).appendChild(iframe); 1139 iframe.src = 'javascript:'; // eslint-disable-line no-script-url 1140 // createDict = iframe.contentWindow.Object; 1141 // html.removeChild(iframe); 1142 iframeDocument = iframe.contentWindow.document; 1143 iframeDocument.open(); 1144 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); 1145 iframeDocument.close(); 1146 createDict = iframeDocument.F; 1147 while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; 1148 return createDict(); 1149 }; 1150 1151 module.exports = Object.create || function create(O, Properties){ 1152 var result; 1153 if(O !== null){ 1154 Empty[PROTOTYPE] = anObject(O); 1155 result = new Empty; 1156 Empty[PROTOTYPE] = null; 1157 // add "__proto__" for Object.getPrototypeOf polyfill 1158 result[IE_PROTO] = O; 1159 } else result = createDict(); 1160 return Properties === undefined ? result : dPs(result, Properties); 1161 }; 1162 1163 1164/***/ }), 1165/* 47 */ 1166/***/ (function(module, exports, __webpack_require__) { 1167 1168 var dP = __webpack_require__(11) 1169 , anObject = __webpack_require__(12) 1170 , getKeys = __webpack_require__(30); 1171 1172 module.exports = __webpack_require__(6) ? Object.defineProperties : function defineProperties(O, Properties){ 1173 anObject(O); 1174 var keys = getKeys(Properties) 1175 , length = keys.length 1176 , i = 0 1177 , P; 1178 while(length > i)dP.f(O, P = keys[i++], Properties[P]); 1179 return O; 1180 }; 1181 1182/***/ }), 1183/* 48 */ 1184/***/ (function(module, exports, __webpack_require__) { 1185 1186 module.exports = __webpack_require__(4).document && document.documentElement; 1187 1188/***/ }), 1189/* 49 */ 1190/***/ (function(module, exports, __webpack_require__) { 1191 1192 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window 1193 var toIObject = __webpack_require__(32) 1194 , gOPN = __webpack_require__(50).f 1195 , toString = {}.toString; 1196 1197 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames 1198 ? Object.getOwnPropertyNames(window) : []; 1199 1200 var getWindowNames = function(it){ 1201 try { 1202 return gOPN(it); 1203 } catch(e){ 1204 return windowNames.slice(); 1205 } 1206 }; 1207 1208 module.exports.f = function getOwnPropertyNames(it){ 1209 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); 1210 }; 1211 1212 1213/***/ }), 1214/* 50 */ 1215/***/ (function(module, exports, __webpack_require__) { 1216 1217 // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) 1218 var $keys = __webpack_require__(31) 1219 , hiddenKeys = __webpack_require__(41).concat('length', 'prototype'); 1220 1221 exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ 1222 return $keys(O, hiddenKeys); 1223 }; 1224 1225/***/ }), 1226/* 51 */ 1227/***/ (function(module, exports, __webpack_require__) { 1228 1229 var pIE = __webpack_require__(44) 1230 , createDesc = __webpack_require__(17) 1231 , toIObject = __webpack_require__(32) 1232 , toPrimitive = __webpack_require__(16) 1233 , has = __webpack_require__(5) 1234 , IE8_DOM_DEFINE = __webpack_require__(14) 1235 , gOPD = Object.getOwnPropertyDescriptor; 1236 1237 exports.f = __webpack_require__(6) ? gOPD : function getOwnPropertyDescriptor(O, P){ 1238 O = toIObject(O); 1239 P = toPrimitive(P, true); 1240 if(IE8_DOM_DEFINE)try { 1241 return gOPD(O, P); 1242 } catch(e){ /* empty */ } 1243 if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); 1244 }; 1245 1246/***/ }), 1247/* 52 */ 1248/***/ (function(module, exports, __webpack_require__) { 1249 1250 var $export = __webpack_require__(8) 1251 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 1252 $export($export.S, 'Object', {create: __webpack_require__(46)}); 1253 1254/***/ }), 1255/* 53 */ 1256/***/ (function(module, exports, __webpack_require__) { 1257 1258 var $export = __webpack_require__(8); 1259 // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) 1260 $export($export.S + $export.F * !__webpack_require__(6), 'Object', {defineProperty: __webpack_require__(11).f}); 1261 1262/***/ }), 1263/* 54 */ 1264/***/ (function(module, exports, __webpack_require__) { 1265 1266 var $export = __webpack_require__(8); 1267 // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) 1268 $export($export.S + $export.F * !__webpack_require__(6), 'Object', {defineProperties: __webpack_require__(47)}); 1269 1270/***/ }), 1271/* 55 */ 1272/***/ (function(module, exports, __webpack_require__) { 1273 1274 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 1275 var toIObject = __webpack_require__(32) 1276 , $getOwnPropertyDescriptor = __webpack_require__(51).f; 1277 1278 __webpack_require__(56)('getOwnPropertyDescriptor', function(){ 1279 return function getOwnPropertyDescriptor(it, key){ 1280 return $getOwnPropertyDescriptor(toIObject(it), key); 1281 }; 1282 }); 1283 1284/***/ }), 1285/* 56 */ 1286/***/ (function(module, exports, __webpack_require__) { 1287
1288 // most Object methods by ES6 should accept primitives 1289 var $export = __webpack_require__(8) 1290 , core = __webpack_require__(9) 1291 , fails = __webpack_require__(7); 1292 module.exports = function(KEY, exec){ 1293 var fn = (core.Object || {})[KEY] || Object[KEY] 1294 , exp = {}; 1295 exp[KEY] = exec(fn); 1296 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); 1297 }; 1298 1299/***/ }), 1300/* 57 */ 1301/***/ (function(module, exports, __webpack_require__) { 1302 1303 // 19.1.2.9 Object.getPrototypeOf(O) 1304 var toObject = __webpack_require__(58) 1305 , $getPrototypeOf = __webpack_require__(59); 1306 1307 __webpack_require__(56)('getPrototypeOf', function(){ 1308 return function getPrototypeOf(it){ 1309 return $getPrototypeOf(toObject(it)); 1310 }; 1311 }); 1312 1313/***/ }), 1314/* 58 */ 1315/***/ (function(module, exports, __webpack_require__) { 1316 1317 // 7.1.13 ToObject(argument) 1318 var defined = __webpack_require__(35); 1319 module.exports = function(it){ 1320 return Object(defined(it)); 1321 }; 1322 1323/***/ }), 1324/* 59 */ 1325/***/ (function(module, exports, __webpack_require__) { 1326 1327 // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) 1328 var has = __webpack_require__(5) 1329 , toObject = __webpack_require__(58) 1330 , IE_PROTO = __webpack_require__(40)('IE_PROTO') 1331 , ObjectProto = Object.prototype; 1332 1333 module.exports = Object.getPrototypeOf || function(O){ 1334 O = toObject(O); 1335 if(has(O, IE_PROTO))return O[IE_PROTO]; 1336 if(typeof O.constructor == 'function' && O instanceof O.constructor){ 1337 return O.constructor.prototype; 1338 } return O instanceof Object ? ObjectProto : null; 1339 }; 1340 1341/***/ }), 1342/* 60 */ 1343/***/ (function(module, exports, __webpack_require__) { 1344 1345 // 19.1.2.14 Object.keys(O) 1346 var toObject = __webpack_require__(58) 1347 , $keys = __webpack_require__(30); 1348 1349 __webpack_require__(56)('keys', function(){ 1350 return function keys(it){ 1351 return $keys(toObject(it)); 1352 }; 1353 }); 1354 1355/***/ }), 1356/* 61 */ 1357/***/ (function(module, exports, __webpack_require__) { 1358 1359 // 19.1.2.7 Object.getOwnPropertyNames(O) 1360 __webpack_require__(56)('getOwnPropertyNames', function(){ 1361 return __webpack_require__(49).f; 1362 }); 1363 1364/***/ }), 1365/* 62 */ 1366/***/ (function(module, exports, __webpack_require__) { 1367 1368 // 19.1.2.5 Object.freeze(O) 1369 var isObject = __webpack_require__(13) 1370 , meta = __webpack_require__(22).onFreeze; 1371 1372 __webpack_require__(56)('freeze', function($freeze){ 1373 return function freeze(it){ 1374 return $freeze && isObject(it) ? $freeze(meta(it)) : it; 1375 }; 1376 }); 1377 1378/***/ }), 1379/* 63 */ 1380/***/ (function(module, exports, __webpack_require__) { 1381 1382 // 19.1.2.17 Object.seal(O) 1383 var isObject = __webpack_require__(13) 1384 , meta = __webpack_require__(22).onFreeze; 1385 1386 __webpack_require__(56)('seal', function($seal){ 1387 return function seal(it){ 1388 return $seal && isObject(it) ? $seal(meta(it)) : it; 1389 }; 1390 }); 1391 1392/***/ }), 1393/* 64 */ 1394/***/ (function(module, exports, __webpack_require__) { 1395 1396 // 19.1.2.15 Object.preventExtensions(O) 1397 var isObject = __webpack_require__(13) 1398 , meta = __webpack_require__(22).onFreeze; 1399 1400 __webpack_require__(56)('preventExtensions', function($preventExtensions){ 1401 return function preventExtensions(it){ 1402 return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; 1403 }; 1404 }); 1405 1406/***/ }), 1407/* 65 */ 1408/***/ (function(module, exports, __webpack_require__) { 1409 1410 // 19.1.2.12 Object.isFrozen(O) 1411 var isObject = __webpack_require__(13); 1412 1413 __webpack_require__(56)('isFrozen', function($isFrozen){ 1414 return function isFrozen(it){ 1415 return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; 1416 }; 1417 }); 1418 1419/***/ }), 1420/* 66 */ 1421/***/ (function(module, exports, __webpack_require__) { 1422 1423 // 19.1.2.13 Object.isSealed(O) 1424 var isObject = __webpack_require__(13); 1425 1426 __webpack_require__(56)('isSealed', function($isSealed){ 1427 return function isSealed(it){ 1428 return isObject(it) ? $isSealed ? $isSealed(it) : false : true; 1429 }; 1430 }); 1431 1432/***/ }), 1433/* 67 */ 1434/***/ (function(module, exports, __webpack_require__) { 1435 1436 // 19.1.2.11 Object.isExtensible(O) 1437 var isObject = __webpack_require__(13); 1438 1439 __webpack_require__(56)('isExtensible', function($isExtensible){ 1440 return function isExtensible(it){ 1441 return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
vendor: 4,099 bytes, lines 1442-1580
1442 }; 1443 }); 1444 1445/***/ }), 1446/* 68 */ 1447/***/ (function(module, exports, __webpack_require__) { 1448 1449 // 19.1.3.1 Object.assign(target, source) 1450 var $export = __webpack_require__(8); 1451 1452 $export($export.S + $export.F, 'Object', {assign: __webpack_require__(69)}); 1453 1454/***/ }), 1455/* 69 */ 1456/***/ (function(module, exports, __webpack_require__) { 1457 1458 'use strict'; 1459 // 19.1.2.1 Object.assign(target, source, ...) 1460 var getKeys = __webpack_require__(30) 1461 , gOPS = __webpack_require__(43) 1462 , pIE = __webpack_require__(44) 1463 , toObject = __webpack_require__(58) 1464 , IObject = __webpack_require__(33) 1465 , $assign = Object.assign; 1466 1467 // should work with symbols and should have deterministic property order (V8 bug) 1468 module.exports = !$assign || __webpack_require__(7)(function(){ 1469 var A = {} 1470 , B = {} 1471 , S = Symbol() 1472 , K = 'abcdefghijklmnopqrst'; 1473 A[S] = 7; 1474 K.split('').forEach(function(k){ B[k] = k; }); 1475 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; 1476 }) ? function assign(target, source){ // eslint-disable-line no-unused-vars 1477 var T = toObject(target) 1478 , aLen = arguments.length 1479 , index = 1 1480 , getSymbols = gOPS.f 1481 , isEnum = pIE.f; 1482 while(aLen > index){ 1483 var S = IObject(arguments[index++]) 1484 , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) 1485 , length = keys.length 1486 , j = 0 1487 , key; 1488 while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; 1489 } return T; 1490 } : $assign; 1491 1492/***/ }), 1493/* 70 */ 1494/***/ (function(module, exports, __webpack_require__) { 1495 1496 // 19.1.3.10 Object.is(value1, value2) 1497 var $export = __webpack_require__(8); 1498 $export($export.S, 'Object', {is: __webpack_require__(71)}); 1499 1500/***/ }), 1501/* 71 */ 1502/***/ (function(module, exports) { 1503 1504 // 7.2.9 SameValue(x, y) 1505 module.exports = Object.is || function is(x, y){ 1506 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; 1507 }; 1508 1509/***/ }), 1510/* 72 */ 1511/***/ (function(module, exports, __webpack_require__) { 1512 1513 // 19.1.3.19 Object.setPrototypeOf(O, proto) 1514 var $export = __webpack_require__(8); 1515 $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(73).set}); 1516 1517/***/ }), 1518/* 73 */ 1519/***/ (function(module, exports, __webpack_require__) { 1520 1521 // Works with __proto__ only. Old v8 can't work with null proto objects. 1522 /* eslint-disable no-proto */ 1523 var isObject = __webpack_require__(13) 1524 , anObject = __webpack_require__(12); 1525 var check = function(O, proto){ 1526 anObject(O); 1527 if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); 1528 }; 1529 module.exports = { 1530 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line 1531 function(test, buggy, set){ 1532 try { 1533 set = __webpack_require__(20)(Function.call, __webpack_require__(51).f(Object.prototype, '__proto__').set, 2); 1534 set(test, []); 1535 buggy = !(test instanceof Array); 1536 } catch(e){ buggy = true; } 1537 return function setPrototypeOf(O, proto){ 1538 check(O, proto); 1539 if(buggy)O.__proto__ = proto; 1540 else set(O, proto); 1541 return O; 1542 }; 1543 }({}, false) : undefined), 1544 check: check 1545 }; 1546 1547/***/ }), 1548/* 74 */ 1549/***/ (function(module, exports, __webpack_require__) { 1550 1551 'use strict'; 1552 // 19.1.3.6 Object.prototype.toString() 1553 var classof = __webpack_require__(75) 1554 , test = {}; 1555 test[__webpack_require__(25)('toStringTag')] = 'z'; 1556 if(test + '' != '[object z]'){ 1557 __webpack_require__(18)(Object.prototype, 'toString', function toString(){ 1558 return '[object ' + classof(this) + ']'; 1559 }, true); 1560 } 1561 1562/***/ }), 1563/* 75 */ 1564/***/ (function(module, exports, __webpack_require__) { 1565 1566 // getting tag from 19.1.3.6 Object.prototype.toString() 1567 var cof = __webpack_require__(34) 1568 , TAG = __webpack_require__(25)('toStringTag') 1569 // ES3 wrong here 1570 , ARG = cof(function(){ return arguments; }()) == 'Arguments'; 1571 1572 // fallback for IE11 Script Access Denied error 1573 var tryGet = function(it, key){ 1574 try { 1575 return it[key]; 1576 } catch(e){ /* empty */ } 1577 }; 1578 1579 module.exports = function(it){ 1580 var O, T, B;
1581 return it === undefined ? 'Undefined' : it === null ? 'Null' 1582 // @@toStringTag case 1583 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T 1584 // builtinTag case 1585 : ARG ? cof(O) 1586 // ES3 arguments fallback 1587 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; 1588 }; 1589 1590/***/ }), 1591/* 76 */ 1592/***/ (function(module, exports, __webpack_require__) { 1593 1594 // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) 1595 var $export = __webpack_require__(8); 1596 1597 $export($export.P, 'Function', {bind: __webpack_require__(77)}); 1598 1599/***/ }), 1600/* 77 */ 1601/***/ (function(module, exports, __webpack_require__) { 1602 1603 'use strict'; 1604 var aFunction = __webpack_require__(21) 1605 , isObject = __webpack_require__(13) 1606 , invoke = __webpack_require__(78) 1607 , arraySlice = [].slice 1608 , factories = {}; 1609 1610 var construct = function(F, len, args){ 1611 if(!(len in factories)){ 1612 for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; 1613 factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); 1614 } return factories[len](F, args); 1615 }; 1616 1617 module.exports = Function.bind || function bind(that /*, args... */){ 1618 var fn = aFunction(this) 1619 , partArgs = arraySlice.call(arguments, 1); 1620 var bound = function(/* args... */){ 1621 var args = partArgs.concat(arraySlice.call(arguments)); 1622 return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); 1623 }; 1624 if(isObject(fn.prototype))bound.prototype = fn.prototype; 1625 return bound; 1626 }; 1627 1628/***/ }), 1629/* 78 */ 1630/***/ (function(module, exports) { 1631 1632 // fast apply, http://jsperf.lnkit.com/fast-apply/5 1633 module.exports = function(fn, args, that){ 1634 var un = that === undefined; 1635 switch(args.length){ 1636 case 0: return un ? fn() 1637 : fn.call(that); 1638 case 1: return un ? fn(args[0]) 1639 : fn.call(that, args[0]); 1640 case 2: return un ? fn(args[0], args[1]) 1641 : fn.call(that, args[0], args[1]); 1642 case 3: return un ? fn(args[0], args[1], args[2]) 1643 : fn.call(that, args[0], args[1], args[2]); 1644 case 4: return un ? fn(args[0], args[1], args[2], args[3]) 1645 : fn.call(that, args[0], args[1], args[2], args[3]); 1646 } return fn.apply(that, args); 1647 }; 1648 1649/***/ }), 1650/* 79 */ 1651/***/ (function(module, exports, __webpack_require__) { 1652 1653 var dP = __webpack_require__(11).f 1654 , createDesc = __webpack_require__(17) 1655 , has = __webpack_require__(5) 1656 , FProto = Function.prototype 1657 , nameRE = /^\s*function ([^ (]*)/ 1658 , NAME = 'name'; 1659 1660 var isExtensible = Object.isExtensible || function(){ 1661 return true; 1662 }; 1663 1664 // 19.2.4.2 name 1665 NAME in FProto || __webpack_require__(6) && dP(FProto, NAME, { 1666 configurable: true, 1667 get: function(){ 1668 try { 1669 var that = this 1670 , name = ('' + that).match(nameRE)[1]; 1671 has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name)); 1672 return name; 1673 } catch(e){ 1674 return ''; 1675 } 1676 } 1677 }); 1678 1679/***/ }), 1680/* 80 */ 1681/***/ (function(module, exports, __webpack_require__) { 1682 1683 'use strict'; 1684 var isObject = __webpack_require__(13) 1685 , getPrototypeOf = __webpack_require__(59) 1686 , HAS_INSTANCE = __webpack_require__(25)('hasInstance') 1687 , FunctionProto = Function.prototype; 1688 // 19.2.3.6 Function.prototype[@@hasInstance](V) 1689 if(!(HAS_INSTANCE in FunctionProto))__webpack_require__(11).f(FunctionProto, HAS_INSTANCE, {value: function(O){ 1690 if(typeof this != 'function' || !isObject(O))return false; 1691 if(!isObject(this.prototype))return O instanceof this; 1692 // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: 1693 while(O = getPrototypeOf(O))if(this.prototype === O)return true; 1694 return false; 1695 }}); 1696 1697/***/ }), 1698/* 81 */ 1699/***/ (function(module, exports, __webpack_require__) { 1700 1701 var $export = __webpack_require__(8) 1702 , $parseInt = __webpack_require__(82); 1703 // 18.2.5 parseInt(string, radix) 1704 $export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt}); 1705 1706/***/ }), 1707/* 82 */ 1708/***/ (function(module, exports, __webpack_require__) { 1709 1710 var $parseInt = __webpack_require__(4).parseInt 1711 , $trim = __webpack_require__(83).trim 1712 , ws = __webpack_require__(84) 1713 , hex = /^[\-+]?0[xX]/; 1714 1715 module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){ 1716 var string = $trim(String(str), 3); 1717 return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); 1718 } : $parseInt; 1719 1720/***/ }), 1721/* 83 */ 1722/***/ (function(module, exports, __webpack_require__) { 1723 1724 var $export = __webpack_require__(8) 1725 , defined = __webpack_require__(35) 1726 , fails = __webpack_require__(7) 1727 , spaces = __webpack_require__(84) 1728 , space = '[' + spaces + ']' 1729 , non = '\u200b\u0085' 1730 , ltrim = RegExp('^' + space + space + '*') 1731 , rtrim = RegExp(space + space + '*$'); 1732 1733 var exporter = function(KEY, exec, ALIAS){ 1734 var exp = {}; 1735 var FORCE = fails(function(){ 1736 return !!spaces[KEY]() || non[KEY]() != non; 1737 }); 1738 var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; 1739 if(ALIAS)exp[ALIAS] = fn; 1740 $export($export.P + $export.F * FORCE, 'String', exp); 1741 }; 1742 1743 // 1 -> String#trimLeft 1744 // 2 -> String#trimRight 1745 // 3 -> String#trim 1746 var trim = exporter.trim = function(string, TYPE){ 1747 string = String(defined(string)); 1748 if(TYPE & 1)string = string.replace(ltrim, ''); 1749 if(TYPE & 2)string = string.replace(rtrim, ''); 1750 return string; 1751 }; 1752 1753 module.exports = exporter; 1754 1755/***/ }), 1756/* 84 */
vendor: 6,739 bytes, lines 1757-1963
1757/***/ (function(module, exports) { 1758 1759 module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + 1760 '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 1761 1762/***/ }), 1763/* 85 */ 1764/***/ (function(module, exports, __webpack_require__) { 1765 1766 var $export = __webpack_require__(8) 1767 , $parseFloat = __webpack_require__(86); 1768 // 18.2.4 parseFloat(string) 1769 $export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat}); 1770 1771/***/ }), 1772/* 86 */ 1773/***/ (function(module, exports, __webpack_require__) { 1774 1775 var $parseFloat = __webpack_require__(4).parseFloat 1776 , $trim = __webpack_require__(83).trim; 1777 1778 module.exports = 1 / $parseFloat(__webpack_require__(84) + '-0') !== -Infinity ? function parseFloat(str){ 1779 var string = $trim(String(str), 3) 1780 , result = $parseFloat(string); 1781 return result === 0 && string.charAt(0) == '-' ? -0 : result; 1782 } : $parseFloat; 1783 1784/***/ }), 1785/* 87 */ 1786/***/ (function(module, exports, __webpack_require__) { 1787 1788 'use strict'; 1789 var global = __webpack_require__(4) 1790 , has = __webpack_require__(5) 1791 , cof = __webpack_require__(34) 1792 , inheritIfRequired = __webpack_require__(88) 1793 , toPrimitive = __webpack_require__(16) 1794 , fails = __webpack_require__(7) 1795 , gOPN = __webpack_require__(50).f 1796 , gOPD = __webpack_require__(51).f 1797 , dP = __webpack_require__(11).f 1798 , $trim = __webpack_require__(83).trim 1799 , NUMBER = 'Number' 1800 , $Number = global[NUMBER] 1801 , Base = $Number 1802 , proto = $Number.prototype 1803 // Opera ~12 has broken Object#toString 1804 , BROKEN_COF = cof(__webpack_require__(46)(proto)) == NUMBER 1805 , TRIM = 'trim' in String.prototype; 1806 1807 // 7.1.3 ToNumber(argument) 1808 var toNumber = function(argument){ 1809 var it = toPrimitive(argument, false); 1810 if(typeof it == 'string' && it.length > 2){ 1811 it = TRIM ? it.trim() : $trim(it, 3); 1812 var first = it.charCodeAt(0) 1813 , third, radix, maxCode; 1814 if(first === 43 || first === 45){ 1815 third = it.charCodeAt(2); 1816 if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix 1817 } else if(first === 48){ 1818 switch(it.charCodeAt(1)){ 1819 case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i 1820 case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i 1821 default : return +it; 1822 } 1823 for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){ 1824 code = digits.charCodeAt(i); 1825 // parseInt parses a string to a first unavailable symbol 1826 // but ToNumber should return NaN if a string contains unavailable symbols 1827 if(code < 48 || code > maxCode)return NaN; 1828 } return parseInt(digits, radix); 1829 } 1830 } return +it; 1831 }; 1832 1833 if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){ 1834 $Number = function Number(value){ 1835 var it = arguments.length < 1 ? 0 : value 1836 , that = this; 1837 return that instanceof $Number 1838 // check on 1..constructor(foo) case 1839 && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER) 1840 ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); 1841 }; 1842 for(var keys = __webpack_require__(6) ? gOPN(Base) : ( 1843 // ES3: 1844 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + 1845 // ES6 (in case, if modules with ES6 Number statics required before): 1846 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 1847 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' 1848 ).split(','), j = 0, key; keys.length > j; j++){ 1849 if(has(Base, key = keys[j]) && !has($Number, key)){ 1850 dP($Number, key, gOPD(Base, key)); 1851 } 1852 } 1853 $Number.prototype = proto; 1854 proto.constructor = $Number; 1855 __webpack_require__(18)(global, NUMBER, $Number); 1856 } 1857 1858/***/ }), 1859/* 88 */ 1860/***/ (function(module, exports, __webpack_require__) { 1861 1862 var isObject = __webpack_require__(13) 1863 , setPrototypeOf = __webpack_require__(73).set; 1864 module.exports = function(that, target, C){ 1865 var P, S = target.constructor; 1866 if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){ 1867 setPrototypeOf(that, P); 1868 } return that; 1869 }; 1870 1871/***/ }), 1872/* 89 */ 1873/***/ (function(module, exports, __webpack_require__) { 1874 1875 'use strict'; 1876 var $export = __webpack_require__(8) 1877 , toInteger = __webpack_require__(38) 1878 , aNumberValue = __webpack_require__(90) 1879 , repeat = __webpack_require__(91) 1880 , $toFixed = 1..toFixed 1881 , floor = Math.floor 1882 , data = [0, 0, 0, 0, 0, 0] 1883 , ERROR = 'Number.toFixed: incorrect invocation!' 1884 , ZERO = '0'; 1885 1886 var multiply = function(n, c){ 1887 var i = -1 1888 , c2 = c; 1889 while(++i < 6){ 1890 c2 += n * data[i]; 1891 data[i] = c2 % 1e7; 1892 c2 = floor(c2 / 1e7); 1893 } 1894 }; 1895 var divide = function(n){ 1896 var i = 6 1897 , c = 0; 1898 while(--i >= 0){ 1899 c += data[i]; 1900 data[i] = floor(c / n); 1901 c = (c % n) * 1e7; 1902 } 1903 }; 1904 var numToString = function(){ 1905 var i = 6 1906 , s = ''; 1907 while(--i >= 0){ 1908 if(s !== '' || i === 0 || data[i] !== 0){ 1909 var t = String(data[i]); 1910 s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; 1911 } 1912 } return s; 1913 }; 1914 var pow = function(x, n, acc){ 1915 return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); 1916 }; 1917 var log = function(x){ 1918 var n = 0 1919 , x2 = x; 1920 while(x2 >= 4096){ 1921 n += 12; 1922 x2 /= 4096; 1923 } 1924 while(x2 >= 2){ 1925 n += 1; 1926 x2 /= 2; 1927 } return n; 1928 }; 1929 1930 $export($export.P + $export.F * (!!$toFixed && ( 1931 0.00008.toFixed(3) !== '0.000' || 1932 0.9.toFixed(0) !== '1' || 1933 1.255.toFixed(2) !== '1.25' || 1934 1000000000000000128..toFixed(0) !== '1000000000000000128' 1935 ) || !__webpack_require__(7)(function(){ 1936 // V8 ~ Android 4.3- 1937 $toFixed.call({}); 1938 })), 'Number', { 1939 toFixed: function toFixed(fractionDigits){ 1940 var x = aNumberValue(this, ERROR) 1941 , f = toInteger(fractionDigits) 1942 , s = '' 1943 , m = ZERO 1944 , e, z, j, k; 1945 if(f < 0 || f > 20)throw RangeError(ERROR); 1946 if(x != x)return 'NaN'; 1947 if(x <= -1e21 || x >= 1e21)return String(x); 1948 if(x < 0){ 1949 s = '-'; 1950 x = -x; 1951 } 1952 if(x > 1e-21){ 1953 e = log(x * pow(2, 69, 1)) - 69; 1954 z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); 1955 z *= 0x10000000000000; 1956 e = 52 - e; 1957 if(e > 0){ 1958 multiply(0, z); 1959 j = f; 1960 while(j >= 7){ 1961 multiply(1e7, 0); 1962 j -= 7; 1963 }
vendor: 9,993 bytes, lines 1964-2351
1964 multiply(pow(10, j, 1), 0); 1965 j = e - 1; 1966 while(j >= 23){ 1967 divide(1 << 23); 1968 j -= 23; 1969 } 1970 divide(1 << j); 1971 multiply(1, 1); 1972 divide(2); 1973 m = numToString(); 1974 } else { 1975 multiply(0, z); 1976 multiply(1 << -e, 0); 1977 m = numToString() + repeat.call(ZERO, f); 1978 } 1979 } 1980 if(f > 0){ 1981 k = m.length; 1982 m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); 1983 } else { 1984 m = s + m; 1985 } return m; 1986 } 1987 }); 1988 1989/***/ }), 1990/* 90 */ 1991/***/ (function(module, exports, __webpack_require__) { 1992 1993 var cof = __webpack_require__(34); 1994 module.exports = function(it, msg){ 1995 if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg); 1996 return +it; 1997 }; 1998 1999/***/ }), 2000/* 91 */ 2001/***/ (function(module, exports, __webpack_require__) { 2002 2003 'use strict'; 2004 var toInteger = __webpack_require__(38) 2005 , defined = __webpack_require__(35); 2006 2007 module.exports = function repeat(count){ 2008 var str = String(defined(this)) 2009 , res = '' 2010 , n = toInteger(count); 2011 if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); 2012 for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; 2013 return res; 2014 }; 2015 2016/***/ }), 2017/* 92 */ 2018/***/ (function(module, exports, __webpack_require__) { 2019 2020 'use strict'; 2021 var $export = __webpack_require__(8) 2022 , $fails = __webpack_require__(7) 2023 , aNumberValue = __webpack_require__(90) 2024 , $toPrecision = 1..toPrecision; 2025 2026 $export($export.P + $export.F * ($fails(function(){ 2027 // IE7- 2028 return $toPrecision.call(1, undefined) !== '1'; 2029 }) || !$fails(function(){ 2030 // V8 ~ Android 4.3- 2031 $toPrecision.call({}); 2032 })), 'Number', { 2033 toPrecision: function toPrecision(precision){ 2034 var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); 2035 return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); 2036 } 2037 }); 2038 2039/***/ }), 2040/* 93 */ 2041/***/ (function(module, exports, __webpack_require__) { 2042 2043 // 20.1.2.1 Number.EPSILON 2044 var $export = __webpack_require__(8); 2045 2046 $export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); 2047 2048/***/ }), 2049/* 94 */ 2050/***/ (function(module, exports, __webpack_require__) { 2051 2052 // 20.1.2.2 Number.isFinite(number) 2053 var $export = __webpack_require__(8) 2054 , _isFinite = __webpack_require__(4).isFinite; 2055 2056 $export($export.S, 'Number', { 2057 isFinite: function isFinite(it){ 2058 return typeof it == 'number' && _isFinite(it); 2059 } 2060 }); 2061 2062/***/ }), 2063/* 95 */ 2064/***/ (function(module, exports, __webpack_require__) { 2065 2066 // 20.1.2.3 Number.isInteger(number) 2067 var $export = __webpack_require__(8); 2068 2069 $export($export.S, 'Number', {isInteger: __webpack_require__(96)}); 2070 2071/***/ }), 2072/* 96 */ 2073/***/ (function(module, exports, __webpack_require__) { 2074 2075 // 20.1.2.3 Number.isInteger(number) 2076 var isObject = __webpack_require__(13) 2077 , floor = Math.floor; 2078 module.exports = function isInteger(it){ 2079 return !isObject(it) && isFinite(it) && floor(it) === it; 2080 }; 2081 2082/***/ }), 2083/* 97 */ 2084/***/ (function(module, exports, __webpack_require__) { 2085 2086 // 20.1.2.4 Number.isNaN(number) 2087 var $export = __webpack_require__(8); 2088 2089 $export($export.S, 'Number', { 2090 isNaN: function isNaN(number){ 2091 return number != number; 2092 } 2093 }); 2094 2095/***/ }), 2096/* 98 */ 2097/***/ (function(module, exports, __webpack_require__) { 2098 2099 // 20.1.2.5 Number.isSafeInteger(number) 2100 var $export = __webpack_require__(8) 2101 , isInteger = __webpack_require__(96) 2102 , abs = Math.abs; 2103 2104 $export($export.S, 'Number', { 2105 isSafeInteger: function isSafeInteger(number){ 2106 return isInteger(number) && abs(number) <= 0x1fffffffffffff; 2107 } 2108 }); 2109 2110/***/ }), 2111/* 99 */ 2112/***/ (function(module, exports, __webpack_require__) { 2113 2114 // 20.1.2.6 Number.MAX_SAFE_INTEGER 2115 var $export = __webpack_require__(8); 2116 2117 $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); 2118 2119/***/ }), 2120/* 100 */ 2121/***/ (function(module, exports, __webpack_require__) { 2122 2123 // 20.1.2.10 Number.MIN_SAFE_INTEGER 2124 var $export = __webpack_require__(8); 2125 2126 $export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); 2127 2128/***/ }), 2129/* 101 */ 2130/***/ (function(module, exports, __webpack_require__) { 2131 2132 var $export = __webpack_require__(8) 2133 , $parseFloat = __webpack_require__(86); 2134 // 20.1.2.12 Number.parseFloat(string) 2135 $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat}); 2136 2137/***/ }), 2138/* 102 */ 2139/***/ (function(module, exports, __webpack_require__) { 2140 2141 var $export = __webpack_require__(8) 2142 , $parseInt = __webpack_require__(82); 2143 // 20.1.2.13 Number.parseInt(string, radix) 2144 $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt}); 2145 2146/***/ }), 2147/* 103 */ 2148/***/ (function(module, exports, __webpack_require__) { 2149 2150 // 20.2.2.3 Math.acosh(x) 2151 var $export = __webpack_require__(8) 2152 , log1p = __webpack_require__(104) 2153 , sqrt = Math.sqrt 2154 , $acosh = Math.acosh; 2155 2156 $export($export.S + $export.F * !($acosh 2157 // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 2158 && Math.floor($acosh(Number.MAX_VALUE)) == 710 2159 // Tor Browser bug: Math.acosh(Infinity) -> NaN 2160 && $acosh(Infinity) == Infinity 2161 ), 'Math', { 2162 acosh: function acosh(x){ 2163 return (x = +x) < 1 ? NaN : x > 94906265.62425156 2164 ? Math.log(x) + Math.LN2 2165 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); 2166 } 2167 }); 2168 2169/***/ }), 2170/* 104 */ 2171/***/ (function(module, exports) { 2172 2173 // 20.2.2.20 Math.log1p(x) 2174 module.exports = Math.log1p || function log1p(x){ 2175 return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); 2176 }; 2177 2178/***/ }), 2179/* 105 */ 2180/***/ (function(module, exports, __webpack_require__) { 2181 2182 // 20.2.2.5 Math.asinh(x) 2183 var $export = __webpack_require__(8) 2184 , $asinh = Math.asinh; 2185 2186 function asinh(x){ 2187 return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); 2188 } 2189 2190 // Tor Browser bug: Math.asinh(0) -> -0 2191 $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh}); 2192 2193/***/ }), 2194/* 106 */ 2195/***/ (function(module, exports, __webpack_require__) { 2196 2197 // 20.2.2.7 Math.atanh(x) 2198 var $export = __webpack_require__(8) 2199 , $atanh = Math.atanh; 2200 2201 // Tor Browser bug: Math.atanh(-0) -> 0 2202 $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { 2203 atanh: function atanh(x){ 2204 return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; 2205 } 2206 }); 2207 2208/***/ }), 2209/* 107 */ 2210/***/ (function(module, exports, __webpack_require__) { 2211 2212 // 20.2.2.9 Math.cbrt(x) 2213 var $export = __webpack_require__(8) 2214 , sign = __webpack_require__(108); 2215 2216 $export($export.S, 'Math', { 2217 cbrt: function cbrt(x){ 2218 return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); 2219 } 2220 }); 2221 2222/***/ }), 2223/* 108 */ 2224/***/ (function(module, exports) { 2225 2226 // 20.2.2.28 Math.sign(x) 2227 module.exports = Math.sign || function sign(x){ 2228 return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; 2229 }; 2230 2231/***/ }), 2232/* 109 */ 2233/***/ (function(module, exports, __webpack_require__) { 2234 2235 // 20.2.2.11 Math.clz32(x) 2236 var $export = __webpack_require__(8); 2237 2238 $export($export.S, 'Math', { 2239 clz32: function clz32(x){ 2240 return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; 2241 } 2242 }); 2243 2244/***/ }), 2245/* 110 */ 2246/***/ (function(module, exports, __webpack_require__) { 2247 2248 // 20.2.2.12 Math.cosh(x) 2249 var $export = __webpack_require__(8) 2250 , exp = Math.exp; 2251 2252 $export($export.S, 'Math', { 2253 cosh: function cosh(x){ 2254 return (exp(x = +x) + exp(-x)) / 2; 2255 } 2256 }); 2257 2258/***/ }), 2259/* 111 */ 2260/***/ (function(module, exports, __webpack_require__) { 2261 2262 // 20.2.2.14 Math.expm1(x) 2263 var $export = __webpack_require__(8) 2264 , $expm1 = __webpack_require__(112); 2265 2266 $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1}); 2267 2268/***/ }), 2269/* 112 */ 2270/***/ (function(module, exports) { 2271 2272 // 20.2.2.14 Math.expm1(x) 2273 var $expm1 = Math.expm1; 2274 module.exports = (!$expm1 2275 // Old FF bug 2276 || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 2277 // Tor Browser bug 2278 || $expm1(-2e-17) != -2e-17 2279 ) ? function expm1(x){ 2280 return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; 2281 } : $expm1; 2282 2283/***/ }), 2284/* 113 */ 2285/***/ (function(module, exports, __webpack_require__) { 2286 2287 // 20.2.2.16 Math.fround(x) 2288 var $export = __webpack_require__(8) 2289 , sign = __webpack_require__(108) 2290 , pow = Math.pow 2291 , EPSILON = pow(2, -52) 2292 , EPSILON32 = pow(2, -23) 2293 , MAX32 = pow(2, 127) * (2 - EPSILON32) 2294 , MIN32 = pow(2, -126); 2295 2296 var roundTiesToEven = function(n){ 2297 return n + 1 / EPSILON - 1 / EPSILON; 2298 }; 2299 2300 2301 $export($export.S, 'Math', { 2302 fround: function fround(x){ 2303 var $abs = Math.abs(x) 2304 , $sign = sign(x) 2305 , a, result; 2306 if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; 2307 a = (1 + EPSILON32 / EPSILON) * $abs; 2308 result = a - (a - $abs); 2309 if(result > MAX32 || result != result)return $sign * Infinity; 2310 return $sign * result; 2311 } 2312 }); 2313 2314/***/ }), 2315/* 114 */ 2316/***/ (function(module, exports, __webpack_require__) { 2317 2318 // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) 2319 var $export = __webpack_require__(8) 2320 , abs = Math.abs; 2321 2322 $export($export.S, 'Math', { 2323 hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars 2324 var sum = 0 2325 , i = 0 2326 , aLen = arguments.length 2327 , larg = 0 2328 , arg, div; 2329 while(i < aLen){ 2330 arg = abs(arguments[i++]); 2331 if(larg < arg){ 2332 div = larg / arg; 2333 sum = sum * div * div + 1; 2334 larg = arg; 2335 } else if(arg > 0){ 2336 div = arg / larg; 2337 sum += div * div; 2338 } else sum += arg; 2339 } 2340 return larg === Infinity ? Infinity : larg * Math.sqrt(sum); 2341 } 2342 }); 2343 2344/***/ }), 2345/* 115 */ 2346/***/ (function(module, exports, __webpack_require__) { 2347 2348 // 20.2.2.18 Math.imul(x, y) 2349 var $export = __webpack_require__(8) 2350 , $imul = Math.imul; 2351
vendor: 5,232 bytes, lines 2352-2552
2352 // some WebKit versions fails with big numbers, some has wrong arity 2353 $export($export.S + $export.F * __webpack_require__(7)(function(){ 2354 return $imul(0xffffffff, 5) != -5 || $imul.length != 2; 2355 }), 'Math', { 2356 imul: function imul(x, y){ 2357 var UINT16 = 0xffff 2358 , xn = +x 2359 , yn = +y 2360 , xl = UINT16 & xn 2361 , yl = UINT16 & yn; 2362 return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); 2363 } 2364 }); 2365 2366/***/ }), 2367/* 116 */ 2368/***/ (function(module, exports, __webpack_require__) { 2369 2370 // 20.2.2.21 Math.log10(x) 2371 var $export = __webpack_require__(8); 2372 2373 $export($export.S, 'Math', { 2374 log10: function log10(x){ 2375 return Math.log(x) / Math.LN10; 2376 } 2377 }); 2378 2379/***/ }), 2380/* 117 */ 2381/***/ (function(module, exports, __webpack_require__) { 2382 2383 // 20.2.2.20 Math.log1p(x) 2384 var $export = __webpack_require__(8); 2385 2386 $export($export.S, 'Math', {log1p: __webpack_require__(104)}); 2387 2388/***/ }), 2389/* 118 */ 2390/***/ (function(module, exports, __webpack_require__) { 2391 2392 // 20.2.2.22 Math.log2(x) 2393 var $export = __webpack_require__(8); 2394 2395 $export($export.S, 'Math', { 2396 log2: function log2(x){ 2397 return Math.log(x) / Math.LN2; 2398 } 2399 }); 2400 2401/***/ }), 2402/* 119 */ 2403/***/ (function(module, exports, __webpack_require__) { 2404 2405 // 20.2.2.28 Math.sign(x) 2406 var $export = __webpack_require__(8); 2407 2408 $export($export.S, 'Math', {sign: __webpack_require__(108)}); 2409 2410/***/ }), 2411/* 120 */ 2412/***/ (function(module, exports, __webpack_require__) { 2413 2414 // 20.2.2.30 Math.sinh(x) 2415 var $export = __webpack_require__(8) 2416 , expm1 = __webpack_require__(112) 2417 , exp = Math.exp; 2418 2419 // V8 near Chromium 38 has a problem with very small numbers 2420 $export($export.S + $export.F * __webpack_require__(7)(function(){ 2421 return !Math.sinh(-2e-17) != -2e-17; 2422 }), 'Math', { 2423 sinh: function sinh(x){ 2424 return Math.abs(x = +x) < 1 2425 ? (expm1(x) - expm1(-x)) / 2 2426 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); 2427 } 2428 }); 2429 2430/***/ }), 2431/* 121 */ 2432/***/ (function(module, exports, __webpack_require__) { 2433 2434 // 20.2.2.33 Math.tanh(x) 2435 var $export = __webpack_require__(8) 2436 , expm1 = __webpack_require__(112) 2437 , exp = Math.exp; 2438 2439 $export($export.S, 'Math', { 2440 tanh: function tanh(x){ 2441 var a = expm1(x = +x) 2442 , b = expm1(-x); 2443 return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); 2444 } 2445 }); 2446 2447/***/ }), 2448/* 122 */ 2449/***/ (function(module, exports, __webpack_require__) { 2450 2451 // 20.2.2.34 Math.trunc(x) 2452 var $export = __webpack_require__(8); 2453 2454 $export($export.S, 'Math', { 2455 trunc: function trunc(it){ 2456 return (it > 0 ? Math.floor : Math.ceil)(it); 2457 } 2458 }); 2459 2460/***/ }), 2461/* 123 */ 2462/***/ (function(module, exports, __webpack_require__) { 2463 2464 var $export = __webpack_require__(8) 2465 , toIndex = __webpack_require__(39) 2466 , fromCharCode = String.fromCharCode 2467 , $fromCodePoint = String.fromCodePoint; 2468 2469 // length should be 1, old FF problem 2470 $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { 2471 // 21.1.2.2 String.fromCodePoint(...codePoints) 2472 fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars 2473 var res = [] 2474 , aLen = arguments.length 2475 , i = 0 2476 , code; 2477 while(aLen > i){ 2478 code = +arguments[i++]; 2479 if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); 2480 res.push(code < 0x10000 2481 ? fromCharCode(code) 2482 : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) 2483 ); 2484 } return res.join(''); 2485 } 2486 }); 2487 2488/***/ }), 2489/* 124 */ 2490/***/ (function(module, exports, __webpack_require__) { 2491 2492 var $export = __webpack_require__(8) 2493 , toIObject = __webpack_require__(32) 2494 , toLength = __webpack_require__(37); 2495 2496 $export($export.S, 'String', { 2497 // 21.1.2.4 String.raw(callSite, ...substitutions) 2498 raw: function raw(callSite){ 2499 var tpl = toIObject(callSite.raw) 2500 , len = toLength(tpl.length) 2501 , aLen = arguments.length 2502 , res = [] 2503 , i = 0; 2504 while(len > i){ 2505 res.push(String(tpl[i++])); 2506 if(i < aLen)res.push(String(arguments[i])); 2507 } return res.join(''); 2508 } 2509 }); 2510 2511/***/ }), 2512/* 125 */ 2513/***/ (function(module, exports, __webpack_require__) { 2514 2515 'use strict'; 2516 // 21.1.3.25 String.prototype.trim() 2517 __webpack_require__(83)('trim', function($trim){ 2518 return function trim(){ 2519 return $trim(this, 3); 2520 }; 2521 }); 2522 2523/***/ }), 2524/* 126 */ 2525/***/ (function(module, exports, __webpack_require__) { 2526 2527 'use strict'; 2528 var $at = __webpack_require__(127)(true); 2529 2530 // 21.1.3.27 String.prototype[@@iterator]() 2531 __webpack_require__(128)(String, 'String', function(iterated){ 2532 this._t = String(iterated); // target 2533 this._i = 0; // next index 2534 // 21.1.5.2.1 %StringIteratorPrototype%.next() 2535 }, function(){ 2536 var O = this._t 2537 , index = this._i 2538 , point; 2539 if(index >= O.length)return {value: undefined, done: true}; 2540 point = $at(O, index); 2541 this._i += point.length; 2542 return {value: point, done: false}; 2543 }); 2544 2545/***/ }), 2546/* 127 */ 2547/***/ (function(module, exports, __webpack_require__) { 2548 2549 var toInteger = __webpack_require__(38) 2550 , defined = __webpack_require__(35); 2551 // true -> String#at 2552 // false ->
2552 String#codePointAt 2553 module.exports = function(TO_STRING){ 2554 return function(that, pos){ 2555 var s = String(defined(that)) 2556 , i = toInteger(pos) 2557 , l = s.length 2558 , a, b; 2559 if(i < 0 || i >= l)return TO_STRING ? '' : undefined; 2560 a = s.charCodeAt(i); 2561 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff 2562 ? TO_STRING ? s.charAt(i) : a 2563 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; 2564 }; 2565 }; 2566 2567/***/ }), 2568/* 128 */ 2569/***/ (function(module, exports, __webpack_require__) { 2570 2571 'use strict'; 2572 var LIBRARY = __webpack_require__(28) 2573 , $export = __webpack_require__(8) 2574 , redefine = __webpack_require__(18) 2575 , hide = __webpack_require__(10) 2576 , has = __webpack_require__(5) 2577 , Iterators = __webpack_require__(129) 2578 , $iterCreate = __webpack_require__(130) 2579 , setToStringTag = __webpack_require__(24) 2580 , getPrototypeOf = __webpack_require__(59) 2581 , ITERATOR = __webpack_require__(25)('iterator') 2582 , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` 2583 , FF_ITERATOR = '@@iterator' 2584 , KEYS = 'keys' 2585 , VALUES = 'values'; 2586 2587 var returnThis = function(){ return this; }; 2588 2589 module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ 2590 $iterCreate(Constructor, NAME, next); 2591 var getMethod = function(kind){ 2592 if(!BUGGY && kind in proto)return proto[kind]; 2593 switch(kind){ 2594 case KEYS: return function keys(){ return new Constructor(this, kind); }; 2595 case VALUES: return function values(){ return new Constructor(this, kind); }; 2596 } return function entries(){ return new Constructor(this, kind); }; 2597 }; 2598 var TAG = NAME + ' Iterator' 2599 , DEF_VALUES = DEFAULT == VALUES 2600 , VALUES_BUG = false 2601 , proto = Base.prototype 2602 , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] 2603 , $default = $native || getMethod(DEFAULT) 2604 , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined 2605 , $anyNative = NAME == 'Array' ? proto.entries || $native : $native 2606 , methods, key, IteratorPrototype; 2607 // Fix native 2608 if($anyNative){ 2609 IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); 2610 if(IteratorPrototype !== Object.prototype){ 2611 // Set @@toStringTag to native iterators 2612 setToStringTag(IteratorPrototype, TAG, true); 2613 // fix for some old engines 2614 if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); 2615 } 2616 } 2617 // fix Array#{values, @@iterator}.name in V8 / FF 2618 if(DEF_VALUES && $native && $native.name !== VALUES){ 2619 VALUES_BUG = true; 2620 $default = function values(){ return $native.call(this); }; 2621 } 2622 // Define iterator 2623 if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ 2624 hide(proto, ITERATOR, $default); 2625 } 2626 // Plug for library 2627 Iterators[NAME] = $default; 2628 Iterators[TAG] = returnThis; 2629 if(DEFAULT){ 2630 methods = { 2631 values: DEF_VALUES ? $default : getMethod(VALUES), 2632 keys: IS_SET ? $default : getMethod(KEYS), 2633 entries: $entries 2634 }; 2635 if(FORCED)for(key in methods){ 2636 if(!(key in proto))redefine(proto, key, methods[key]); 2637 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); 2638 } 2639 return methods; 2640 }; 2641 2642/***/ }), 2643/* 129 */ 2644/***/ (function(module, exports) { 2645 2646 module.exports = {}; 2647 2648/***/ }), 2649/* 130 */ 2650/***/ (function(module, exports, __webpack_require__) { 2651 2652 'use strict'; 2653 var create = __webpack_require__(46) 2654 , descriptor = __webpack_require__(17) 2655 , setToStringTag = __webpack_require__(24) 2656 , IteratorPrototype = {}; 2657 2658 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() 2659 __webpack_require__(10)(IteratorPrototype, __webpack_require__(25)('iterator'), function(){ return this; }); 2660 2661 module.exports = function(Constructor, NAME, next){ 2662 Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); 2663 setToStringTag(Constructor, NAME + ' Iterator'); 2664 }; 2665 2666/***/ }), 2667/* 131 */ 2668/***/ (function(module, exports, __webpack_require__) { 2669 2670 'use strict'; 2671 var $export = __webpack_require__(8) 2672 , $at = __webpack_require__(127)(false); 2673 $export($export.P, 'String', { 2674 // 21.1.3.3 String.prototype.codePointAt(pos) 2675 codePointAt: function codePointAt(pos){ 2676 return $at(this, pos); 2677 } 2678 }); 2679 2680/***/ }), 2681/* 132 */ 2682/***/ (function(module, exports, __webpack_require__) { 2683 2684 // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) 2685 'use strict'; 2686 var $export = __webpack_require__(8) 2687 , toLength = __webpack_require__(37) 2688 , context = __webpack_require__(133) 2689 , ENDS_WITH = 'endsWith' 2690 , $endsWith = ''[ENDS_WITH]; 2691 2692 $export($export.P + $export.F * __webpack_require__(135)(ENDS_WITH), 'String', { 2693 endsWith: function endsWith(searchString /*, endPosition = @length */){ 2694 var that = context(this, searchString, ENDS_WITH) 2695 , endPosition = arguments.length > 1 ? arguments[1] : undefined 2696 , len = toLength(that.length) 2697 , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) 2698 , search = String(searchString); 2699 return $endsWith 2700 ? $endsWith.call(that, search, end) 2701 : that.slice(end - search.length, end) === search; 2702 } 2703 }); 2704 2705/***/ }), 2706/* 133 */ 2707/***/ (function(module, exports, __webpack_require__) { 2708 2709 // helper for String#{startsWith, endsWith, includes} 2710 var isRegExp = __webpack_require__(134) 2711 , defined = __webpack_require__(35); 2712 2713 module.exports = function(that, searchString, NAME){ 2714 if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); 2715 return String(defined(that)); 2716 }; 2717 2718/***/ }), 2719/* 134 */ 2720/***/ (function(module, exports, __webpack_require__) { 2721 2722 // 7.2.8 IsRegExp(argument) 2723 var isObject = __webpack_require__(13) 2724 , cof = __webpack_require__(34) 2725 , MATCH = __webpack_require__(25)('match'); 2726 module.exports = function(it){ 2727 var isRegExp; 2728 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); 2729 }; 2730 2731/***/ }), 2732/* 135 */ 2733/***/ (function(module, exports, __webpack_require__) { 2734 2735 var MATCH = __webpack_require__(25)('match'); 2736 module.exports = function(KEY){ 2737 var re = /./; 2738 try { 2739 '/./'[KEY](re); 2740 } catch(e){ 2741 try { 2742 re[MATCH] = false;
2743 return !'/./'[KEY](re); 2744 } catch(f){ /* empty */ } 2745 } return true; 2746 }; 2747 2748/***/ }), 2749/* 136 */ 2750/***/ (function(module, exports, __webpack_require__) { 2751 2752 // 21.1.3.7 String.prototype.includes(searchString, position = 0) 2753 'use strict'; 2754 var $export = __webpack_require__(8) 2755 , context = __webpack_require__(133) 2756 , INCLUDES = 'includes'; 2757 2758 $export($export.P + $export.F * __webpack_require__(135)(INCLUDES), 'String', { 2759 includes: function includes(searchString /*, position = 0 */){ 2760 return !!~context(this, searchString, INCLUDES) 2761 .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); 2762 } 2763 }); 2764 2765/***/ }), 2766/* 137 */ 2767/***/ (function(module, exports, __webpack_require__) { 2768 2769 var $export = __webpack_require__(8); 2770 2771 $export($export.P, 'String', { 2772 // 21.1.3.13 String.prototype.repeat(count) 2773 repeat: __webpack_require__(91) 2774 }); 2775 2776/***/ }), 2777/* 138 */ 2778/***/ (function(module, exports, __webpack_require__) { 2779 2780 // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) 2781 'use strict'; 2782 var $export = __webpack_require__(8) 2783 , toLength = __webpack_require__(37) 2784 , context = __webpack_require__(133) 2785 , STARTS_WITH = 'startsWith' 2786 , $startsWith = ''[STARTS_WITH]; 2787 2788 $export($export.P + $export.F * __webpack_require__(135)(STARTS_WITH), 'String', { 2789 startsWith: function startsWith(searchString /*, position = 0 */){ 2790 var that = context(this, searchString, STARTS_WITH) 2791 , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) 2792 , search = String(searchString); 2793 return $startsWith 2794 ? $startsWith.call(that, search, index) 2795 : that.slice(index, index + search.length) === search; 2796 } 2797 }); 2798 2799/***/ }), 2800/* 139 */ 2801/***/ (function(module, exports, __webpack_require__) { 2802 2803 'use strict'; 2804 // B.2.3.2 String.prototype.anchor(name) 2805 __webpack_require__(140)('anchor', function(createHTML){ 2806 return function anchor(name){ 2807 return createHTML(this, 'a', 'name', name); 2808 } 2809 }); 2810 2811/***/ }), 2812/* 140 */ 2813/***/ (function(module, exports, __webpack_require__) { 2814 2815 var $export = __webpack_require__(8) 2816 , fails = __webpack_require__(7) 2817 , defined = __webpack_require__(35) 2818 , quot = /"/g; 2819 // B.2.3.2.1 CreateHTML(string, tag, attribute, value) 2820 var createHTML = function(string, tag, attribute, value) { 2821 var S = String(defined(string)) 2822 , p1 = '<' + tag; 2823 if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; 2824 return p1 + '>' + S + '</' + tag + '>'; 2825 }; 2826 module.exports = function(NAME, exec){ 2827 var O = {}; 2828 O[NAME] = exec(createHTML); 2829 $export($export.P + $export.F * fails(function(){ 2830 var test = ''[NAME]('"'); 2831 return test !== test.toLowerCase() || test.split('"').length > 3; 2832 }), 'String', O); 2833 }; 2834 2835/***/ }), 2836/* 141 */ 2837/***/ (function(module, exports, __webpack_require__) { 2838 2839 'use strict'; 2840 // B.2.3.3 String.prototype.big() 2841 __webpack_require__(140)('big', function(createHTML){ 2842 return function big(){ 2843 return createHTML(this, 'big', '', ''); 2844 } 2845 }); 2846 2847/***/ }), 2848/* 142 */ 2849/***/ (function(module, exports, __webpack_require__) { 2850 2851 'use strict'; 2852 // B.2.3.4 String.prototype.blink() 2853 __webpack_require__(140)('blink', function(createHTML){ 2854 return function blink(){ 2855 return createHTML(this, 'blink', '', ''); 2856 } 2857 }); 2858 2859/***/ }), 2860/* 143 */ 2861/***/ (function(module, exports, __webpack_require__) { 2862 2863 'use strict'; 2864 // B.2.3.5 String.prototype.bold() 2865 __webpack_require__(140)('bold', function(createHTML){ 2866 return function bold(){ 2867 return createHTML(this, 'b', '', ''); 2868 } 2869 }); 2870 2871/***/ }), 2872/* 144 */ 2873/***/ (function(module, exports, __webpack_require__) { 2874 2875 'use strict'; 2876 // B.2.3.6 String.prototype.fixed() 2877 __webpack_require__(140)('fixed', function(createHTML){ 2878 return function fixed(){ 2879 return createHTML(this, 'tt', '', ''); 2880 } 2881 }); 2882 2883/***/ }), 2884/* 145 */ 2885/***/ (function(module, exports, __webpack_require__) { 2886 2887 'use strict'; 2888 // B.2.3.7 String.prototype.fontcolor(color) 2889 __webpack_require__(140)('fontcolor', function(createHTML){
vendor: 8,915 bytes, lines 2890-3192
2890 return function fontcolor(color){ 2891 return createHTML(this, 'font', 'color', color); 2892 } 2893 }); 2894 2895/***/ }), 2896/* 146 */ 2897/***/ (function(module, exports, __webpack_require__) { 2898 2899 'use strict'; 2900 // B.2.3.8 String.prototype.fontsize(size) 2901 __webpack_require__(140)('fontsize', function(createHTML){ 2902 return function fontsize(size){ 2903 return createHTML(this, 'font', 'size', size); 2904 } 2905 }); 2906 2907/***/ }), 2908/* 147 */ 2909/***/ (function(module, exports, __webpack_require__) { 2910 2911 'use strict'; 2912 // B.2.3.9 String.prototype.italics() 2913 __webpack_require__(140)('italics', function(createHTML){ 2914 return function italics(){ 2915 return createHTML(this, 'i', '', ''); 2916 } 2917 }); 2918 2919/***/ }), 2920/* 148 */ 2921/***/ (function(module, exports, __webpack_require__) { 2922 2923 'use strict'; 2924 // B.2.3.10 String.prototype.link(url) 2925 __webpack_require__(140)('link', function(createHTML){ 2926 return function link(url){ 2927 return createHTML(this, 'a', 'href', url); 2928 } 2929 }); 2930 2931/***/ }), 2932/* 149 */ 2933/***/ (function(module, exports, __webpack_require__) { 2934 2935 'use strict'; 2936 // B.2.3.11 String.prototype.small() 2937 __webpack_require__(140)('small', function(createHTML){ 2938 return function small(){ 2939 return createHTML(this, 'small', '', ''); 2940 } 2941 }); 2942 2943/***/ }), 2944/* 150 */ 2945/***/ (function(module, exports, __webpack_require__) { 2946 2947 'use strict'; 2948 // B.2.3.12 String.prototype.strike() 2949 __webpack_require__(140)('strike', function(createHTML){ 2950 return function strike(){ 2951 return createHTML(this, 'strike', '', ''); 2952 } 2953 }); 2954 2955/***/ }), 2956/* 151 */ 2957/***/ (function(module, exports, __webpack_require__) { 2958 2959 'use strict'; 2960 // B.2.3.13 String.prototype.sub() 2961 __webpack_require__(140)('sub', function(createHTML){ 2962 return function sub(){ 2963 return createHTML(this, 'sub', '', ''); 2964 } 2965 }); 2966 2967/***/ }), 2968/* 152 */ 2969/***/ (function(module, exports, __webpack_require__) { 2970 2971 'use strict'; 2972 // B.2.3.14 String.prototype.sup() 2973 __webpack_require__(140)('sup', function(createHTML){ 2974 return function sup(){ 2975 return createHTML(this, 'sup', '', ''); 2976 } 2977 }); 2978 2979/***/ }), 2980/* 153 */ 2981/***/ (function(module, exports, __webpack_require__) { 2982 2983 // 20.3.3.1 / 15.9.4.4 Date.now() 2984 var $export = __webpack_require__(8); 2985 2986 $export($export.S, 'Date', {now: function(){ return new Date().getTime(); }}); 2987 2988/***/ }), 2989/* 154 */ 2990/***/ (function(module, exports, __webpack_require__) { 2991 2992 'use strict'; 2993 var $export = __webpack_require__(8) 2994 , toObject = __webpack_require__(58) 2995 , toPrimitive = __webpack_require__(16); 2996 2997 $export($export.P + $export.F * __webpack_require__(7)(function(){ 2998 return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1; 2999 }), 'Date', { 3000 toJSON: function toJSON(key){ 3001 var O = toObject(this) 3002 , pv = toPrimitive(O); 3003 return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); 3004 } 3005 }); 3006 3007/***/ }), 3008/* 155 */ 3009/***/ (function(module, exports, __webpack_require__) { 3010 3011 'use strict'; 3012 // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() 3013 var $export = __webpack_require__(8) 3014 , fails = __webpack_require__(7) 3015 , getTime = Date.prototype.getTime; 3016 3017 var lz = function(num){ 3018 return num > 9 ? num : '0' + num; 3019 }; 3020 3021 // PhantomJS / old WebKit has a broken implementations 3022 $export($export.P + $export.F * (fails(function(){ 3023 return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z'; 3024 }) || !fails(function(){ 3025 new Date(NaN).toISOString(); 3026 })), 'Date', { 3027 toISOString: function toISOString(){ 3028 if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value'); 3029 var d = this 3030 , y = d.getUTCFullYear() 3031 , m = d.getUTCMilliseconds() 3032 , s = y < 0 ? '-' : y > 9999 ? '+' : ''; 3033 return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + 3034 '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 3035 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + 3036 ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; 3037 } 3038 }); 3039 3040/***/ }), 3041/* 156 */ 3042/***/ (function(module, exports, __webpack_require__) { 3043 3044 var DateProto = Date.prototype 3045 , INVALID_DATE = 'Invalid Date' 3046 , TO_STRING = 'toString' 3047 , $toString = DateProto[TO_STRING] 3048 , getTime = DateProto.getTime; 3049 if(new Date(NaN) + '' != INVALID_DATE){ 3050 __webpack_require__(18)(DateProto, TO_STRING, function toString(){ 3051 var value = getTime.call(this); 3052 return value === value ? $toString.call(this) : INVALID_DATE; 3053 }); 3054 } 3055 3056/***/ }), 3057/* 157 */ 3058/***/ (function(module, exports, __webpack_require__) { 3059 3060 var TO_PRIMITIVE = __webpack_require__(25)('toPrimitive') 3061 , proto = Date.prototype; 3062 3063 if(!(TO_PRIMITIVE in proto))__webpack_require__(10)(proto, TO_PRIMITIVE, __webpack_require__(158)); 3064 3065/***/ }), 3066/* 158 */ 3067/***/ (function(module, exports, __webpack_require__) { 3068 3069 'use strict'; 3070 var anObject = __webpack_require__(12) 3071 , toPrimitive = __webpack_require__(16) 3072 , NUMBER = 'number'; 3073 3074 module.exports = function(hint){ 3075 if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint'); 3076 return toPrimitive(anObject(this), hint != NUMBER); 3077 }; 3078 3079/***/ }), 3080/* 159 */ 3081/***/ (function(module, exports, __webpack_require__) { 3082 3083 // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) 3084 var $export = __webpack_require__(8); 3085 3086 $export($export.S, 'Array', {isArray: __webpack_require__(45)}); 3087 3088/***/ }), 3089/* 160 */ 3090/***/ (function(module, exports, __webpack_require__) { 3091 3092 'use strict'; 3093 var ctx = __webpack_require__(20) 3094 , $export = __webpack_require__(8) 3095 , toObject = __webpack_require__(58) 3096 , call = __webpack_require__(161) 3097 , isArrayIter = __webpack_require__(162) 3098 , toLength = __webpack_require__(37) 3099 , createProperty = __webpack_require__(163) 3100 , getIterFn = __webpack_require__(164); 3101 3102 $export($export.S + $export.F * !__webpack_require__(165)(function(iter){ Array.from(iter); }), 'Array', { 3103 // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) 3104 from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ 3105 var O = toObject(arrayLike) 3106 , C = typeof this == 'function' ? this : Array 3107 , aLen = arguments.length 3108 , mapfn = aLen > 1 ? arguments[1] : undefined 3109 , mapping = mapfn !== undefined 3110 , index = 0 3111 , iterFn = getIterFn(O) 3112 , length, result, step, iterator; 3113 if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); 3114 // if object isn't iterable or it's array with default iterator - use simple case 3115 if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ 3116 for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ 3117 createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); 3118 } 3119 } else { 3120 length = toLength(O.length); 3121 for(result = new C(length); length > index; index++){ 3122 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); 3123 } 3124 } 3125 result.length = index; 3126 return result; 3127 } 3128 }); 3129 3130 3131/***/ }), 3132/* 161 */ 3133/***/ (function(module, exports, __webpack_require__) { 3134 3135 // call something on iterator step with safe closing on error 3136 var anObject = __webpack_require__(12); 3137 module.exports = function(iterator, fn, value, entries){ 3138 try { 3139 return entries ? fn(anObject(value)[0], value[1]) : fn(value); 3140 // 7.4.6 IteratorClose(iterator, completion) 3141 } catch(e){ 3142 var ret = iterator['return']; 3143 if(ret !== undefined)anObject(ret.call(iterator)); 3144 throw e; 3145 } 3146 }; 3147 3148/***/ }), 3149/* 162 */ 3150/***/ (function(module, exports, __webpack_require__) { 3151 3152 // check on default Array iterator 3153 var Iterators = __webpack_require__(129) 3154 , ITERATOR = __webpack_require__(25)('iterator') 3155 , ArrayProto = Array.prototype; 3156 3157 module.exports = function(it){ 3158 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); 3159 }; 3160 3161/***/ }), 3162/* 163 */ 3163/***/ (function(module, exports, __webpack_require__) { 3164 3165 'use strict'; 3166 var $defineProperty = __webpack_require__(11) 3167 , createDesc = __webpack_require__(17); 3168 3169 module.exports = function(object, index, value){ 3170 if(index in object)$defineProperty.f(object, index, createDesc(0, value)); 3171 else object[index] = value; 3172 }; 3173 3174/***/ }), 3175/* 164 */ 3176/***/ (function(module, exports, __webpack_require__) { 3177 3178 var classof = __webpack_require__(75) 3179 , ITERATOR = __webpack_require__(25)('iterator') 3180 , Iterators = __webpack_require__(129); 3181 module.exports = __webpack_require__(9).getIteratorMethod = function(it){ 3182 if(it != undefined)return it[ITERATOR] 3183 || it['@@iterator'] 3184 || Iterators[classof(it)]; 3185 }; 3186 3187/***/ }), 3188/* 165 */ 3189/***/ (function(module, exports, __webpack_require__) { 3190 3191 var ITERATOR = __webpack_require__(25)('iterator') 3192 , SAFE_CLOSING = false;
vendor: 2,926 bytes, lines 3193-3291
3193 3194 try { 3195 var riter = [7][ITERATOR](); 3196 riter['return'] = function(){ SAFE_CLOSING = true; }; 3197 Array.from(riter, function(){ throw 2; }); 3198 } catch(e){ /* empty */ } 3199 3200 module.exports = function(exec, skipClosing){ 3201 if(!skipClosing && !SAFE_CLOSING)return false; 3202 var safe = false; 3203 try { 3204 var arr = [7] 3205 , iter = arr[ITERATOR](); 3206 iter.next = function(){ return {done: safe = true}; }; 3207 arr[ITERATOR] = function(){ return iter; }; 3208 exec(arr); 3209 } catch(e){ /* empty */ } 3210 return safe; 3211 }; 3212 3213/***/ }), 3214/* 166 */ 3215/***/ (function(module, exports, __webpack_require__) { 3216 3217 'use strict'; 3218 var $export = __webpack_require__(8) 3219 , createProperty = __webpack_require__(163); 3220 3221 // WebKit Array.of isn't generic 3222 $export($export.S + $export.F * __webpack_require__(7)(function(){ 3223 function F(){} 3224 return !(Array.of.call(F) instanceof F); 3225 }), 'Array', { 3226 // 22.1.2.3 Array.of( ...items) 3227 of: function of(/* ...args */){ 3228 var index = 0 3229 , aLen = arguments.length 3230 , result = new (typeof this == 'function' ? this : Array)(aLen); 3231 while(aLen > index)createProperty(result, index, arguments[index++]); 3232 result.length = aLen; 3233 return result; 3234 } 3235 }); 3236 3237/***/ }), 3238/* 167 */ 3239/***/ (function(module, exports, __webpack_require__) { 3240 3241 'use strict'; 3242 // 22.1.3.13 Array.prototype.join(separator) 3243 var $export = __webpack_require__(8) 3244 , toIObject = __webpack_require__(32) 3245 , arrayJoin = [].join; 3246 3247 // fallback for not array-like strings 3248 $export($export.P + $export.F * (__webpack_require__(33) != Object || !__webpack_require__(168)(arrayJoin)), 'Array', { 3249 join: function join(separator){ 3250 return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); 3251 } 3252 }); 3253 3254/***/ }), 3255/* 168 */ 3256/***/ (function(module, exports, __webpack_require__) { 3257 3258 var fails = __webpack_require__(7); 3259 3260 module.exports = function(method, arg){ 3261 return !!method && fails(function(){ 3262 arg ? method.call(null, function(){}, 1) : method.call(null); 3263 }); 3264 }; 3265 3266/***/ }), 3267/* 169 */ 3268/***/ (function(module, exports, __webpack_require__) { 3269 3270 'use strict'; 3271 var $export = __webpack_require__(8) 3272 , html = __webpack_require__(48) 3273 , cof = __webpack_require__(34) 3274 , toIndex = __webpack_require__(39) 3275 , toLength = __webpack_require__(37) 3276 , arraySlice = [].slice; 3277 3278 // fallback for not array-like ES3 strings and DOM objects 3279 $export($export.P + $export.F * __webpack_require__(7)(function(){ 3280 if(html)arraySlice.call(html); 3281 }), 'Array', { 3282 slice: function slice(begin, end){ 3283 var len = toLength(this.length) 3284 , klass = cof(this); 3285 end = end === undefined ? len : end; 3286 if(klass == 'Array')return arraySlice.call(this, begin, end); 3287 var start = toIndex(begin, len) 3288 , upTo = toIndex(end, len) 3289 , size = toLength(upTo - start) 3290 , cloned = Array(size) 3291 , i = 0;
3292 for(; i < size; i++)cloned[i] = klass == 'String' 3293 ? this.charAt(start + i) 3294 : this[start + i]; 3295 return cloned; 3296 } 3297 }); 3298 3299/***/ }), 3300/* 170 */ 3301/***/ (function(module, exports, __webpack_require__) { 3302 3303 'use strict'; 3304 var $export = __webpack_require__(8) 3305 , aFunction = __webpack_require__(21) 3306 , toObject = __webpack_require__(58) 3307 , fails = __webpack_require__(7) 3308 , $sort = [].sort 3309 , test = [1, 2, 3]; 3310 3311 $export($export.P + $export.F * (fails(function(){ 3312 // IE8- 3313 test.sort(undefined); 3314 }) || !fails(function(){ 3315 // V8 bug 3316 test.sort(null); 3317 // Old WebKit 3318 }) || !__webpack_require__(168)($sort)), 'Array', { 3319 // 22.1.3.25 Array.prototype.sort(comparefn) 3320 sort: function sort(comparefn){ 3321 return comparefn === undefined 3322 ? $sort.call(toObject(this)) 3323 : $sort.call(toObject(this), aFunction(comparefn)); 3324 } 3325 }); 3326 3327/***/ }), 3328/* 171 */ 3329/***/ (function(module, exports, __webpack_require__) { 3330 3331 'use strict'; 3332 var $export = __webpack_require__(8) 3333 , $forEach = __webpack_require__(172)(0) 3334 , STRICT = __webpack_require__(168)([].forEach, true); 3335 3336 $export($export.P + $export.F * !STRICT, 'Array', { 3337 // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) 3338 forEach: function forEach(callbackfn /* , thisArg */){ 3339 return $forEach(this, callbackfn, arguments[1]); 3340 } 3341 }); 3342 3343/***/ }), 3344/* 172 */ 3345/***/ (function(module, exports, __webpack_require__) { 3346 3347 // 0 -> Array#forEach 3348 // 1 -> Array#map 3349 // 2 -> Array#filter 3350 // 3 -> Array#some 3351 // 4 -> Array#every 3352 // 5 -> Array#find 3353 // 6 -> Array#findIndex 3354 var ctx = __webpack_require__(20) 3355 , IObject = __webpack_require__(33) 3356 , toObject = __webpack_require__(58) 3357 , toLength = __webpack_require__(37) 3358 , asc = __webpack_require__(173); 3359 module.exports = function(TYPE, $create){ 3360 var IS_MAP = TYPE == 1 3361 , IS_FILTER = TYPE == 2 3362 , IS_SOME = TYPE == 3 3363 , IS_EVERY = TYPE == 4 3364 , IS_FIND_INDEX = TYPE == 6 3365 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX 3366 , create = $create || asc; 3367 return function($this, callbackfn, that){ 3368 var O = toObject($this) 3369 , self = IObject(O) 3370 , f = ctx(callbackfn, that, 3) 3371 , length = toLength(self.length) 3372 , index = 0 3373 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined 3374 , val, res;
vendor: 4,464 bytes, lines 3375-3522
3375 for(;length > index; index++)if(NO_HOLES || index in self){ 3376 val = self[index]; 3377 res = f(val, index, O); 3378 if(TYPE){ 3379 if(IS_MAP)result[index] = res; // map 3380 else if(res)switch(TYPE){ 3381 case 3: return true; // some 3382 case 5: return val; // find 3383 case 6: return index; // findIndex 3384 case 2: result.push(val); // filter 3385 } else if(IS_EVERY)return false; // every 3386 } 3387 } 3388 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; 3389 }; 3390 }; 3391 3392/***/ }), 3393/* 173 */ 3394/***/ (function(module, exports, __webpack_require__) { 3395 3396 // 9.4.2.3 ArraySpeciesCreate(originalArray, length) 3397 var speciesConstructor = __webpack_require__(174); 3398 3399 module.exports = function(original, length){ 3400 return new (speciesConstructor(original))(length); 3401 }; 3402 3403/***/ }), 3404/* 174 */ 3405/***/ (function(module, exports, __webpack_require__) { 3406 3407 var isObject = __webpack_require__(13) 3408 , isArray = __webpack_require__(45) 3409 , SPECIES = __webpack_require__(25)('species'); 3410 3411 module.exports = function(original){ 3412 var C; 3413 if(isArray(original)){ 3414 C = original.constructor; 3415 // cross-realm fallback 3416 if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; 3417 if(isObject(C)){ 3418 C = C[SPECIES]; 3419 if(C === null)C = undefined; 3420 } 3421 } return C === undefined ? Array : C; 3422 }; 3423 3424/***/ }), 3425/* 175 */ 3426/***/ (function(module, exports, __webpack_require__) { 3427 3428 'use strict'; 3429 var $export = __webpack_require__(8) 3430 , $map = __webpack_require__(172)(1); 3431 3432 $export($export.P + $export.F * !__webpack_require__(168)([].map, true), 'Array', { 3433 // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) 3434 map: function map(callbackfn /* , thisArg */){ 3435 return $map(this, callbackfn, arguments[1]); 3436 } 3437 }); 3438 3439/***/ }), 3440/* 176 */ 3441/***/ (function(module, exports, __webpack_require__) { 3442 3443 'use strict'; 3444 var $export = __webpack_require__(8) 3445 , $filter = __webpack_require__(172)(2); 3446 3447 $export($export.P + $export.F * !__webpack_require__(168)([].filter, true), 'Array', { 3448 // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) 3449 filter: function filter(callbackfn /* , thisArg */){ 3450 return $filter(this, callbackfn, arguments[1]); 3451 } 3452 }); 3453 3454/***/ }), 3455/* 177 */ 3456/***/ (function(module, exports, __webpack_require__) { 3457 3458 'use strict'; 3459 var $export = __webpack_require__(8) 3460 , $some = __webpack_require__(172)(3); 3461 3462 $export($export.P + $export.F * !__webpack_require__(168)([].some, true), 'Array', { 3463 // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) 3464 some: function some(callbackfn /* , thisArg */){ 3465 return $some(this, callbackfn, arguments[1]); 3466 } 3467 }); 3468 3469/***/ }), 3470/* 178 */ 3471/***/ (function(module, exports, __webpack_require__) { 3472 3473 'use strict'; 3474 var $export = __webpack_require__(8) 3475 , $every = __webpack_require__(172)(4); 3476 3477 $export($export.P + $export.F * !__webpack_require__(168)([].every, true), 'Array', { 3478 // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) 3479 every: function every(callbackfn /* , thisArg */){ 3480 return $every(this, callbackfn, arguments[1]); 3481 } 3482 }); 3483 3484/***/ }), 3485/* 179 */ 3486/***/ (function(module, exports, __webpack_require__) { 3487 3488 'use strict'; 3489 var $export = __webpack_require__(8) 3490 , $reduce = __webpack_require__(180); 3491 3492 $export($export.P + $export.F * !__webpack_require__(168)([].reduce, true), 'Array', { 3493 // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) 3494 reduce: function reduce(callbackfn /* , initialValue */){ 3495 return $reduce(this, callbackfn, arguments.length, arguments[1], false); 3496 } 3497 }); 3498 3499/***/ }), 3500/* 180 */ 3501/***/ (function(module, exports, __webpack_require__) { 3502 3503 var aFunction = __webpack_require__(21) 3504 , toObject = __webpack_require__(58) 3505 , IObject = __webpack_require__(33) 3506 , toLength = __webpack_require__(37); 3507 3508 module.exports = function(that, callbackfn, aLen, memo, isRight){ 3509 aFunction(callbackfn); 3510 var O = toObject(that) 3511 , self = IObject(O) 3512 , length = toLength(O.length) 3513 , index = isRight ? length - 1 : 0 3514 , i = isRight ? -1 : 1; 3515 if(aLen < 2)for(;;){ 3516 if(index in self){ 3517 memo = self[index]; 3518 index += i; 3519 break; 3520 } 3521 index += i; 3522 if(isRight ? index < 0 : length <= index){
vendor: 8,201 bytes, lines 3523-3781
3523 throw TypeError('Reduce of empty array with no initial value'); 3524 } 3525 } 3526 for(;isRight ? index >= 0 : length > index; index += i)if(index in self){ 3527 memo = callbackfn(memo, self[index], index, O); 3528 } 3529 return memo; 3530 }; 3531 3532/***/ }), 3533/* 181 */ 3534/***/ (function(module, exports, __webpack_require__) { 3535 3536 'use strict'; 3537 var $export = __webpack_require__(8) 3538 , $reduce = __webpack_require__(180); 3539 3540 $export($export.P + $export.F * !__webpack_require__(168)([].reduceRight, true), 'Array', { 3541 // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) 3542 reduceRight: function reduceRight(callbackfn /* , initialValue */){ 3543 return $reduce(this, callbackfn, arguments.length, arguments[1], true); 3544 } 3545 }); 3546 3547/***/ }), 3548/* 182 */ 3549/***/ (function(module, exports, __webpack_require__) { 3550 3551 'use strict'; 3552 var $export = __webpack_require__(8) 3553 , $indexOf = __webpack_require__(36)(false) 3554 , $native = [].indexOf 3555 , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; 3556 3557 $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), 'Array', { 3558 // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) 3559 indexOf: function indexOf(searchElement /*, fromIndex = 0 */){ 3560 return NEGATIVE_ZERO 3561 // convert -0 to +0 3562 ? $native.apply(this, arguments) || 0 3563 : $indexOf(this, searchElement, arguments[1]); 3564 } 3565 }); 3566 3567/***/ }), 3568/* 183 */ 3569/***/ (function(module, exports, __webpack_require__) { 3570 3571 'use strict'; 3572 var $export = __webpack_require__(8) 3573 , toIObject = __webpack_require__(32) 3574 , toInteger = __webpack_require__(38) 3575 , toLength = __webpack_require__(37) 3576 , $native = [].lastIndexOf 3577 , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; 3578 3579 $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), 'Array', { 3580 // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) 3581 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){ 3582 // convert -0 to +0 3583 if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0; 3584 var O = toIObject(this) 3585 , length = toLength(O.length) 3586 , index = length - 1; 3587 if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1])); 3588 if(index < 0)index = length + index; 3589 for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0; 3590 return -1; 3591 } 3592 }); 3593 3594/***/ }), 3595/* 184 */ 3596/***/ (function(module, exports, __webpack_require__) { 3597 3598 // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 3599 var $export = __webpack_require__(8); 3600 3601 $export($export.P, 'Array', {copyWithin: __webpack_require__(185)}); 3602 3603 __webpack_require__(186)('copyWithin'); 3604 3605/***/ }), 3606/* 185 */ 3607/***/ (function(module, exports, __webpack_require__) { 3608 3609 // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 3610 'use strict'; 3611 var toObject = __webpack_require__(58) 3612 , toIndex = __webpack_require__(39) 3613 , toLength = __webpack_require__(37); 3614 3615 module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ 3616 var O = toObject(this) 3617 , len = toLength(O.length) 3618 , to = toIndex(target, len) 3619 , from = toIndex(start, len) 3620 , end = arguments.length > 2 ? arguments[2] : undefined 3621 , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) 3622 , inc = 1; 3623 if(from < to && to < from + count){ 3624 inc = -1; 3625 from += count - 1; 3626 to += count - 1; 3627 } 3628 while(count-- > 0){ 3629 if(from in O)O[to] = O[from]; 3630 else delete O[to]; 3631 to += inc; 3632 from += inc; 3633 } return O; 3634 }; 3635 3636/***/ }), 3637/* 186 */ 3638/***/ (function(module, exports, __webpack_require__) { 3639 3640 // 22.1.3.31 Array.prototype[@@unscopables] 3641 var UNSCOPABLES = __webpack_require__(25)('unscopables') 3642 , ArrayProto = Array.prototype; 3643 if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(10)(ArrayProto, UNSCOPABLES, {}); 3644 module.exports = function(key){ 3645 ArrayProto[UNSCOPABLES][key] = true; 3646 }; 3647 3648/***/ }), 3649/* 187 */ 3650/***/ (function(module, exports, __webpack_require__) { 3651 3652 // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 3653 var $export = __webpack_require__(8); 3654 3655 $export($export.P, 'Array', {fill: __webpack_require__(188)}); 3656 3657 __webpack_require__(186)('fill'); 3658 3659/***/ }), 3660/* 188 */ 3661/***/ (function(module, exports, __webpack_require__) { 3662 3663 // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 3664 'use strict'; 3665 var toObject = __webpack_require__(58) 3666 , toIndex = __webpack_require__(39) 3667 , toLength = __webpack_require__(37); 3668 module.exports = function fill(value /*, start = 0, end = @length */){ 3669 var O = toObject(this) 3670 , length = toLength(O.length) 3671 , aLen = arguments.length 3672 , index = toIndex(aLen > 1 ? arguments[1] : undefined, length) 3673 , end = aLen > 2 ? arguments[2] : undefined 3674 , endPos = end === undefined ? length : toIndex(end, length); 3675 while(endPos > index)O[index++] = value; 3676 return O; 3677 }; 3678 3679/***/ }), 3680/* 189 */ 3681/***/ (function(module, exports, __webpack_require__) { 3682 3683 'use strict'; 3684 // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) 3685 var $export = __webpack_require__(8) 3686 , $find = __webpack_require__(172)(5) 3687 , KEY = 'find' 3688 , forced = true; 3689 // Shouldn't skip holes 3690 if(KEY in [])Array(1)[KEY](function(){ forced = false; }); 3691 $export($export.P + $export.F * forced, 'Array', { 3692 find: function find(callbackfn/*, that = undefined */){ 3693 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 3694 } 3695 }); 3696 __webpack_require__(186)(KEY); 3697 3698/***/ }), 3699/* 190 */ 3700/***/ (function(module, exports, __webpack_require__) { 3701 3702 'use strict'; 3703 // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) 3704 var $export = __webpack_require__(8) 3705 , $find = __webpack_require__(172)(6) 3706 , KEY = 'findIndex' 3707 , forced = true; 3708 // Shouldn't skip holes 3709 if(KEY in [])Array(1)[KEY](function(){ forced = false; }); 3710 $export($export.P + $export.F * forced, 'Array', { 3711 findIndex: function findIndex(callbackfn/*, that = undefined */){ 3712 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 3713 } 3714 }); 3715 __webpack_require__(186)(KEY); 3716 3717/***/ }), 3718/* 191 */ 3719/***/ (function(module, exports, __webpack_require__) { 3720 3721 __webpack_require__(192)('Array'); 3722 3723/***/ }), 3724/* 192 */ 3725/***/ (function(module, exports, __webpack_require__) { 3726 3727 'use strict'; 3728 var global = __webpack_require__(4) 3729 , dP = __webpack_require__(11) 3730 , DESCRIPTORS = __webpack_require__(6) 3731 , SPECIES = __webpack_require__(25)('species'); 3732 3733 module.exports = function(KEY){ 3734 var C = global[KEY]; 3735 if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, { 3736 configurable: true, 3737 get: function(){ return this; } 3738 }); 3739 }; 3740 3741/***/ }), 3742/* 193 */ 3743/***/ (function(module, exports, __webpack_require__) { 3744 3745 'use strict'; 3746 var addToUnscopables = __webpack_require__(186) 3747 , step = __webpack_require__(194) 3748 , Iterators = __webpack_require__(129) 3749 , toIObject = __webpack_require__(32); 3750 3751 // 22.1.3.4 Array.prototype.entries() 3752 // 22.1.3.13 Array.prototype.keys() 3753 // 22.1.3.29 Array.prototype.values() 3754 // 22.1.3.30 Array.prototype[@@iterator]() 3755 module.exports = __webpack_require__(128)(Array, 'Array', function(iterated, kind){ 3756 this._t = toIObject(iterated); // target 3757 this._i = 0; // next index 3758 this._k = kind; // kind 3759 // 22.1.5.2.1 %ArrayIteratorPrototype%.next() 3760 }, function(){ 3761 var O = this._t 3762 , kind = this._k 3763 , index = this._i++; 3764 if(!O || index >= O.length){ 3765 this._t = undefined; 3766 return step(1); 3767 } 3768 if(kind == 'keys' )return step(0, index); 3769 if(kind == 'values')return step(0, O[index]); 3770 return step(0, [index, O[index]]); 3771 }, 'values'); 3772 3773 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) 3774 Iterators.Arguments = Iterators.Array; 3775 3776 addToUnscopables('keys'); 3777 addToUnscopables('values'); 3778 addToUnscopables('entries'); 3779 3780/***/ }), 3781/* 194 */
vendor: 19,238 bytes, lines 3782-4323
3782/***/ (function(module, exports) { 3783 3784 module.exports = function(done, value){ 3785 return {value: value, done: !!done}; 3786 }; 3787 3788/***/ }), 3789/* 195 */ 3790/***/ (function(module, exports, __webpack_require__) { 3791 3792 var global = __webpack_require__(4) 3793 , inheritIfRequired = __webpack_require__(88) 3794 , dP = __webpack_require__(11).f 3795 , gOPN = __webpack_require__(50).f 3796 , isRegExp = __webpack_require__(134) 3797 , $flags = __webpack_require__(196) 3798 , $RegExp = global.RegExp 3799 , Base = $RegExp 3800 , proto = $RegExp.prototype 3801 , re1 = /a/g 3802 , re2 = /a/g 3803 // "new" creates a new object, old webkit buggy here 3804 , CORRECT_NEW = new $RegExp(re1) !== re1; 3805 3806 if(__webpack_require__(6) && (!CORRECT_NEW || __webpack_require__(7)(function(){ 3807 re2[__webpack_require__(25)('match')] = false; 3808 // RegExp constructor can alter flags and IsRegExp works correct with @@match 3809 return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; 3810 }))){ 3811 $RegExp = function RegExp(p, f){ 3812 var tiRE = this instanceof $RegExp 3813 , piRE = isRegExp(p) 3814 , fiU = f === undefined; 3815 return !tiRE && piRE && p.constructor === $RegExp && fiU ? p 3816 : inheritIfRequired(CORRECT_NEW 3817 ? new Base(piRE && !fiU ? p.source : p, f) 3818 : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) 3819 , tiRE ? this : proto, $RegExp); 3820 }; 3821 var proxy = function(key){ 3822 key in $RegExp || dP($RegExp, key, { 3823 configurable: true, 3824 get: function(){ return Base[key]; }, 3825 set: function(it){ Base[key] = it; } 3826 }); 3827 }; 3828 for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]); 3829 proto.constructor = $RegExp; 3830 $RegExp.prototype = proto; 3831 __webpack_require__(18)(global, 'RegExp', $RegExp); 3832 } 3833 3834 __webpack_require__(192)('RegExp'); 3835 3836/***/ }), 3837/* 196 */ 3838/***/ (function(module, exports, __webpack_require__) { 3839 3840 'use strict'; 3841 // 21.2.5.3 get RegExp.prototype.flags 3842 var anObject = __webpack_require__(12); 3843 module.exports = function(){ 3844 var that = anObject(this) 3845 , result = ''; 3846 if(that.global) result += 'g'; 3847 if(that.ignoreCase) result += 'i'; 3848 if(that.multiline) result += 'm'; 3849 if(that.unicode) result += 'u'; 3850 if(that.sticky) result += 'y'; 3851 return result; 3852 }; 3853 3854/***/ }), 3855/* 197 */ 3856/***/ (function(module, exports, __webpack_require__) { 3857 3858 'use strict'; 3859 __webpack_require__(198); 3860 var anObject = __webpack_require__(12) 3861 , $flags = __webpack_require__(196) 3862 , DESCRIPTORS = __webpack_require__(6) 3863 , TO_STRING = 'toString' 3864 , $toString = /./[TO_STRING]; 3865 3866 var define = function(fn){ 3867 __webpack_require__(18)(RegExp.prototype, TO_STRING, fn, true); 3868 }; 3869 3870 // 21.2.5.14 RegExp.prototype.toString() 3871 if(__webpack_require__(7)(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){ 3872 define(function toString(){ 3873 var R = anObject(this); 3874 return '/'.concat(R.source, '/', 3875 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); 3876 }); 3877 // FF44- RegExp#toString has a wrong name 3878 } else if($toString.name != TO_STRING){ 3879 define(function toString(){ 3880 return $toString.call(this); 3881 }); 3882 } 3883 3884/***/ }), 3885/* 198 */ 3886/***/ (function(module, exports, __webpack_require__) { 3887 3888 // 21.2.5.3 get RegExp.prototype.flags() 3889 if(__webpack_require__(6) && /./g.flags != 'g')__webpack_require__(11).f(RegExp.prototype, 'flags', { 3890 configurable: true, 3891 get: __webpack_require__(196) 3892 }); 3893 3894/***/ }), 3895/* 199 */ 3896/***/ (function(module, exports, __webpack_require__) { 3897 3898 // @@match logic 3899 __webpack_require__(200)('match', 1, function(defined, MATCH, $match){ 3900 // 21.1.3.11 String.prototype.match(regexp) 3901 return [function match(regexp){ 3902 'use strict'; 3903 var O = defined(this) 3904 , fn = regexp == undefined ? undefined : regexp[MATCH]; 3905 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); 3906 }, $match]; 3907 }); 3908 3909/***/ }), 3910/* 200 */ 3911/***/ (function(module, exports, __webpack_require__) { 3912 3913 'use strict'; 3914 var hide = __webpack_require__(10) 3915 , redefine = __webpack_require__(18) 3916 , fails = __webpack_require__(7) 3917 , defined = __webpack_require__(35) 3918 , wks = __webpack_require__(25); 3919 3920 module.exports = function(KEY, length, exec){ 3921 var SYMBOL = wks(KEY) 3922 , fns = exec(defined, SYMBOL, ''[KEY]) 3923 , strfn = fns[0] 3924 , rxfn = fns[1]; 3925 if(fails(function(){ 3926 var O = {}; 3927 O[SYMBOL] = function(){ return 7; }; 3928 return ''[KEY](O) != 7; 3929 })){ 3930 redefine(String.prototype, KEY, strfn); 3931 hide(RegExp.prototype, SYMBOL, length == 2 3932 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) 3933 // 21.2.5.11 RegExp.prototype[@@split](string, limit) 3934 ? function(string, arg){ return rxfn.call(string, this, arg); } 3935 // 21.2.5.6 RegExp.prototype[@@match](string) 3936 // 21.2.5.9 RegExp.prototype[@@search](string) 3937 : function(string){ return rxfn.call(string, this); } 3938 ); 3939 } 3940 }; 3941 3942/***/ }), 3943/* 201 */ 3944/***/ (function(module, exports, __webpack_require__) { 3945 3946 // @@replace logic 3947 __webpack_require__(200)('replace', 2, function(defined, REPLACE, $replace){ 3948 // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) 3949 return [function replace(searchValue, replaceValue){ 3950 'use strict'; 3951 var O = defined(this) 3952 , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; 3953 return fn !== undefined 3954 ? fn.call(searchValue, O, replaceValue) 3955 : $replace.call(String(O), searchValue, replaceValue); 3956 }, $replace]; 3957 }); 3958 3959/***/ }), 3960/* 202 */ 3961/***/ (function(module, exports, __webpack_require__) { 3962 3963 // @@search logic 3964 __webpack_require__(200)('search', 1, function(defined, SEARCH, $search){ 3965 // 21.1.3.15 String.prototype.search(regexp) 3966 return [function search(regexp){ 3967 'use strict'; 3968 var O = defined(this) 3969 , fn = regexp == undefined ? undefined : regexp[SEARCH]; 3970 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); 3971 }, $search]; 3972 }); 3973 3974/***/ }), 3975/* 203 */ 3976/***/ (function(module, exports, __webpack_require__) { 3977 3978 // @@split logic 3979 __webpack_require__(200)('split', 2, function(defined, SPLIT, $split){ 3980 'use strict'; 3981 var isRegExp = __webpack_require__(134) 3982 , _split = $split 3983 , $push = [].push 3984 , $SPLIT = 'split' 3985 , LENGTH = 'length' 3986 , LAST_INDEX = 'lastIndex'; 3987 if( 3988 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 3989 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 3990 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || 3991 '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || 3992 '.'[$SPLIT](/()()/)[LENGTH] > 1 || 3993 ''[$SPLIT](/.?/)[LENGTH] 3994 ){ 3995 var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group 3996 // based on es5-shim implementation, need to rework it 3997 $split = function(separator, limit){ 3998 var string = String(this); 3999 if(separator === undefined && limit === 0)return []; 4000 // If `separator` is not a regex, use native split 4001 if(!isRegExp(separator))return _split.call(string, separator, limit); 4002 var output = []; 4003 var flags = (separator.ignoreCase ? 'i' : '') + 4004 (separator.multiline ? 'm' : '') + 4005 (separator.unicode ? 'u' : '') + 4006 (separator.sticky ? 'y' : ''); 4007 var lastLastIndex = 0; 4008 var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; 4009 // Make `global` and avoid `lastIndex` issues by working with a copy 4010 var separatorCopy = new RegExp(separator.source, flags + 'g'); 4011 var separator2, match, lastIndex, lastLength, i; 4012 // Doesn't need flags gy, but they don't hurt 4013 if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); 4014 while(match = separatorCopy.exec(string)){ 4015 // `separatorCopy.lastIndex` is not reliable cross-browser 4016 lastIndex = match.index + match[0][LENGTH]; 4017 if(lastIndex > lastLastIndex){ 4018 output.push(string.slice(lastLastIndex, match.index)); 4019 // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG 4020 if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){ 4021 for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined; 4022 }); 4023 if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1)); 4024 lastLength = match[0][LENGTH]; 4025 lastLastIndex = lastIndex; 4026 if(output[LENGTH] >= splitLimit)break; 4027 } 4028 if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop 4029 } 4030 if(lastLastIndex === string[LENGTH]){ 4031 if(lastLength || !separatorCopy.test(''))output.push(''); 4032 } else output.push(string.slice(lastLastIndex)); 4033 return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; 4034 }; 4035 // Chakra, V8 4036 } else if('0'[$SPLIT](undefined, 0)[LENGTH]){ 4037 $split = function(separator, limit){ 4038 return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); 4039 }; 4040 } 4041 // 21.1.3.17 String.prototype.split(separator, limit) 4042 return [function split(separator, limit){ 4043 var O = defined(this) 4044 , fn = separator == undefined ? undefined : separator[SPLIT]; 4045 return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); 4046 }, $split]; 4047 }); 4048 4049/***/ }), 4050/* 204 */ 4051/***/ (function(module, exports, __webpack_require__) { 4052 4053 'use strict'; 4054 var LIBRARY = __webpack_require__(28) 4055 , global = __webpack_require__(4) 4056 , ctx = __webpack_require__(20) 4057 , classof = __webpack_require__(75) 4058 , $export = __webpack_require__(8) 4059 , isObject = __webpack_require__(13) 4060 , aFunction = __webpack_require__(21) 4061 , anInstance = __webpack_require__(205) 4062 , forOf = __webpack_require__(206) 4063 , speciesConstructor = __webpack_require__(207) 4064 , task = __webpack_require__(208).set 4065 , microtask = __webpack_require__(209)() 4066 , PROMISE = 'Promise' 4067 , TypeError = global.TypeError 4068 , process = global.process 4069 , $Promise = global[PROMISE] 4070 , process = global.process 4071 , isNode = classof(process) == 'process' 4072 , empty = function(){ /* empty */ } 4073 , Internal, GenericPromiseCapability, Wrapper; 4074 4075 var USE_NATIVE = !!function(){ 4076 try { 4077 // correct subclassing with @@species support 4078 var promise = $Promise.resolve(1) 4079 , FakePromise = (promise.constructor = {})[__webpack_require__(25)('species')] = function(exec){ exec(empty, empty); }; 4080 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test 4081 return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; 4082 } catch(e){ /* empty */ } 4083 }(); 4084 4085 // helpers 4086 var sameConstructor = function(a, b){ 4087 // with library wrapper special case 4088 return a === b || a === $Promise && b === Wrapper; 4089 }; 4090 var isThenable = function(it){ 4091 var then; 4092 return isObject(it) && typeof (then = it.then) == 'function' ? then : false; 4093 }; 4094 var newPromiseCapability = function(C){ 4095 return sameConstructor($Promise, C) 4096 ? new PromiseCapability(C) 4097 : new GenericPromiseCapability(C); 4098 }; 4099 var PromiseCapability = GenericPromiseCapability = function(C){ 4100 var resolve, reject; 4101 this.promise = new C(function($$resolve, $$reject){ 4102 if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); 4103 resolve = $$resolve; 4104 reject = $$reject; 4105 }); 4106 this.resolve = aFunction(resolve); 4107 this.reject = aFunction(reject); 4108 }; 4109 var perform = function(exec){ 4110 try { 4111 exec(); 4112 } catch(e){ 4113 return {error: e}; 4114 } 4115 }; 4116 var notify = function(promise, isReject){ 4117 if(promise._n)return; 4118 promise._n = true; 4119 var chain = promise._c; 4120 microtask(function(){ 4121 var value = promise._v 4122 , ok = promise._s == 1 4123 , i = 0; 4124 var run = function(reaction){ 4125 var handler = ok ? reaction.ok : reaction.fail 4126 , resolve = reaction.resolve 4127 , reject = reaction.reject 4128 , domain = reaction.domain 4129 , result, then; 4130 try { 4131 if(handler){ 4132 if(!ok){ 4133 if(promise._h == 2)onHandleUnhandled(promise); 4134 promise._h = 1; 4135 } 4136 if(handler === true)result = value; 4137 else { 4138 if(domain)domain.enter(); 4139 result = handler(value); 4140 if(domain)domain.exit(); 4141 } 4142 if(result === reaction.promise){ 4143 reject(TypeError('Promise-chain cycle')); 4144 } else if(then = isThenable(result)){ 4145 then.call(result, resolve, reject); 4146 } else resolve(result); 4147 } else reject(value); 4148 } catch(e){ 4149 reject(e); 4150 } 4151 }; 4152 while(chain.length > i)run(chain[i++]); // variable length - can't use forEach 4153 promise._c = []; 4154 promise._n = false; 4155 if(isReject && !promise._h)onUnhandled(promise); 4156 }); 4157 }; 4158 var onUnhandled = function(promise){ 4159 task.call(global, function(){ 4160 var value = promise._v 4161 , abrupt, handler, console; 4162 if(isUnhandled(promise)){ 4163 abrupt = perform(function(){ 4164 if(isNode){ 4165 process.emit('unhandledRejection', value, promise); 4166 } else if(handler = global.onunhandledrejection){ 4167 handler({promise: promise, reason: value}); 4168 } else if((console = global.console) && console.error){ 4169 console.error('Unhandled promise rejection', value); 4170 } 4171 }); 4172 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should 4173 promise._h = isNode || isUnhandled(promise) ? 2 : 1; 4174 } promise._a = undefined; 4175 if(abrupt)throw abrupt.error; 4176 }); 4177 }; 4178 var isUnhandled = function(promise){ 4179 if(promise._h == 1)return false; 4180 var chain = promise._a || promise._c 4181 , i = 0 4182 , reaction; 4183 while(chain.length > i){ 4184 reaction = chain[i++]; 4185 if(reaction.fail || !isUnhandled(reaction.promise))return false; 4186 } return true; 4187 }; 4188 var onHandleUnhandled = function(promise){ 4189 task.call(global, function(){ 4190 var handler; 4191 if(isNode){ 4192 process.emit('rejectionHandled', promise); 4193 } else if(handler = global.onrejectionhandled){ 4194 handler({promise: promise, reason: promise._v}); 4195 } 4196 }); 4197 }; 4198 var $reject = function(value){ 4199 var promise = this; 4200 if(promise._d)return; 4201 promise._d = true; 4202 promise = promise._w || promise; // unwrap 4203 promise._v = value; 4204 promise._s = 2; 4205 if(!promise._a)promise._a = promise._c.slice(); 4206 notify(promise, true); 4207 }; 4208 var $resolve = function(value){ 4209 var promise = this 4210 , then; 4211 if(promise._d)return; 4212 promise._d = true; 4213 promise = promise._w || promise; // unwrap 4214 try { 4215 if(promise === value)throw TypeError("Promise can't be resolved itself"); 4216 if(then = isThenable(value)){ 4217 microtask(function(){ 4218 var wrapper = {_w: promise, _d: false}; // wrap 4219 try { 4220 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); 4221 } catch(e){ 4222 $reject.call(wrapper, e); 4223 } 4224 }); 4225 } else { 4226 promise._v = value; 4227 promise._s = 1; 4228 notify(promise, false); 4229 } 4230 } catch(e){ 4231 $reject.call({_w: promise, _d: false}, e); // wrap 4232 } 4233 }; 4234 4235 // constructor polyfill 4236 if(!USE_NATIVE){ 4237 // 25.4.3.1 Promise(executor) 4238 $Promise = function Promise(executor){ 4239 anInstance(this, $Promise, PROMISE, '_h'); 4240 aFunction(executor); 4241 Internal.call(this); 4242 try { 4243 executor(ctx($resolve, this, 1), ctx($reject, this, 1)); 4244 } catch(err){ 4245 $reject.call(this, err); 4246 } 4247 }; 4248 Internal = function Promise(executor){ 4249 this._c = []; // <- awaiting reactions 4250 this._a = undefined; // <- checked in isUnhandled reactions 4251 this._s = 0; // <- state 4252 this._d = false; // <- done 4253 this._v = undefined; // <- value 4254 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled 4255 this._n = false; // <- notify 4256 }; 4257 Internal.prototype = __webpack_require__(210)($Promise.prototype, { 4258 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) 4259 then: function then(onFulfilled, onRejected){ 4260 var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); 4261 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; 4262 reaction.fail = typeof onRejected == 'function' && onRejected; 4263 reaction.domain = isNode ? process.domain : undefined; 4264 this._c.push(reaction); 4265 if(this._a)this._a.push(reaction); 4266 if(this._s)notify(this, false); 4267 return reaction.promise; 4268 }, 4269 // 25.4.5.1 Promise.prototype.catch(onRejected) 4270 'catch': function(onRejected){ 4271 return this.then(undefined, onRejected); 4272 } 4273 }); 4274 PromiseCapability = function(){ 4275 var promise = new Internal; 4276 this.promise = promise; 4277 this.resolve = ctx($resolve, promise, 1); 4278 this.reject = ctx($reject, promise, 1); 4279 }; 4280 } 4281 4282 $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); 4283 __webpack_require__(24)($Promise, PROMISE); 4284 __webpack_require__(192)(PROMISE); 4285 Wrapper = __webpack_require__(9)[PROMISE]; 4286 4287 // statics 4288 $export($export.S + $export.F * !USE_NATIVE, PROMISE, { 4289 // 25.4.4.5 Promise.reject(r) 4290 reject: function reject(r){ 4291 var capability = newPromiseCapability(this) 4292 , $$reject = capability.reject; 4293 $$reject(r); 4294 return capability.promise; 4295 } 4296 }); 4297 $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { 4298 // 25.4.4.6 Promise.resolve(x) 4299 resolve: function resolve(x){ 4300 // instanceof instead of internal slot check because we should fix it without replacement native Promise core 4301 if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; 4302 var capability = newPromiseCapability(this) 4303 , $$resolve = capability.resolve; 4304 $$resolve(x); 4305 return capability.promise; 4306 } 4307 }); 4308 $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(165)(function(iter){ 4309 $Promise.all(iter)['catch'](empty); 4310 })), PROMISE, { 4311 // 25.4.4.1 Promise.all(iterable) 4312 all: function all(iterable){ 4313 var C = this 4314 , capability = newPromiseCapability(C) 4315 , resolve = capability.resolve 4316 , reject = capability.reject; 4317 var abrupt = perform(function(){ 4318 var values = [] 4319 , index = 0 4320 , remaining = 1; 4321 forOf(iterable, false, function(promise){ 4322 var $index = index++ 4323 , alreadyCalled = false;
vendor: 7,973 bytes, lines 4324-4585
4324 values.push(undefined); 4325 remaining++; 4326 C.resolve(promise).then(function(value){ 4327 if(alreadyCalled)return; 4328 alreadyCalled = true; 4329 values[$index] = value; 4330 --remaining || resolve(values); 4331 }, reject); 4332 }); 4333 --remaining || resolve(values); 4334 }); 4335 if(abrupt)reject(abrupt.error); 4336 return capability.promise; 4337 }, 4338 // 25.4.4.4 Promise.race(iterable) 4339 race: function race(iterable){ 4340 var C = this 4341 , capability = newPromiseCapability(C) 4342 , reject = capability.reject; 4343 var abrupt = perform(function(){ 4344 forOf(iterable, false, function(promise){ 4345 C.resolve(promise).then(capability.resolve, reject); 4346 }); 4347 }); 4348 if(abrupt)reject(abrupt.error); 4349 return capability.promise; 4350 } 4351 }); 4352 4353/***/ }), 4354/* 205 */ 4355/***/ (function(module, exports) { 4356 4357 module.exports = function(it, Constructor, name, forbiddenField){ 4358 if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ 4359 throw TypeError(name + ': incorrect invocation!'); 4360 } return it; 4361 }; 4362 4363/***/ }), 4364/* 206 */ 4365/***/ (function(module, exports, __webpack_require__) { 4366 4367 var ctx = __webpack_require__(20) 4368 , call = __webpack_require__(161) 4369 , isArrayIter = __webpack_require__(162) 4370 , anObject = __webpack_require__(12) 4371 , toLength = __webpack_require__(37) 4372 , getIterFn = __webpack_require__(164) 4373 , BREAK = {} 4374 , RETURN = {}; 4375 var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ 4376 var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) 4377 , f = ctx(fn, that, entries ? 2 : 1) 4378 , index = 0 4379 , length, step, iterator, result; 4380 if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); 4381 // fast case for arrays with default iterator 4382 if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ 4383 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); 4384 if(result === BREAK || result === RETURN)return result; 4385 } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ 4386 result = call(iterator, f, step.value, entries); 4387 if(result === BREAK || result === RETURN)return result; 4388 } 4389 }; 4390 exports.BREAK = BREAK; 4391 exports.RETURN = RETURN; 4392 4393/***/ }), 4394/* 207 */ 4395/***/ (function(module, exports, __webpack_require__) { 4396 4397 // 7.3.20 SpeciesConstructor(O, defaultConstructor) 4398 var anObject = __webpack_require__(12) 4399 , aFunction = __webpack_require__(21) 4400 , SPECIES = __webpack_require__(25)('species'); 4401 module.exports = function(O, D){ 4402 var C = anObject(O).constructor, S; 4403 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); 4404 }; 4405 4406/***/ }), 4407/* 208 */ 4408/***/ (function(module, exports, __webpack_require__) { 4409 4410 var ctx = __webpack_require__(20) 4411 , invoke = __webpack_require__(78) 4412 , html = __webpack_require__(48) 4413 , cel = __webpack_require__(15) 4414 , global = __webpack_require__(4) 4415 , process = global.process 4416 , setTask = global.setImmediate 4417 , clearTask = global.clearImmediate 4418 , MessageChannel = global.MessageChannel 4419 , counter = 0 4420 , queue = {} 4421 , ONREADYSTATECHANGE = 'onreadystatechange' 4422 , defer, channel, port; 4423 var run = function(){ 4424 var id = +this; 4425 if(queue.hasOwnProperty(id)){ 4426 var fn = queue[id]; 4427 delete queue[id]; 4428 fn(); 4429 } 4430 }; 4431 var listener = function(event){ 4432 run.call(event.data); 4433 }; 4434 // Node.js 0.9+ & IE10+ has setImmediate, otherwise: 4435 if(!setTask || !clearTask){ 4436 setTask = function setImmediate(fn){ 4437 var args = [], i = 1; 4438 while(arguments.length > i)args.push(arguments[i++]); 4439 queue[++counter] = function(){ 4440 invoke(typeof fn == 'function' ? fn : Function(fn), args); 4441 }; 4442 defer(counter); 4443 return counter; 4444 }; 4445 clearTask = function clearImmediate(id){ 4446 delete queue[id]; 4447 }; 4448 // Node.js 0.8- 4449 if(__webpack_require__(34)(process) == 'process'){ 4450 defer = function(id){ 4451 process.nextTick(ctx(run, id, 1)); 4452 }; 4453 // Browsers with MessageChannel, includes WebWorkers 4454 } else if(MessageChannel){ 4455 channel = new MessageChannel; 4456 port = channel.port2; 4457 channel.port1.onmessage = listener; 4458 defer = ctx(port.postMessage, port, 1); 4459 // Browsers with postMessage, skip WebWorkers 4460 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' 4461 } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ 4462 defer = function(id){ 4463 global.postMessage(id + '', '*'); 4464 }; 4465 global.addEventListener('message', listener, false); 4466 // IE8- 4467 } else if(ONREADYSTATECHANGE in cel('script')){ 4468 defer = function(id){ 4469 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ 4470 html.removeChild(this); 4471 run.call(id); 4472 }; 4473 }; 4474 // Rest old browsers 4475 } else { 4476 defer = function(id){ 4477 setTimeout(ctx(run, id, 1), 0); 4478 }; 4479 } 4480 } 4481 module.exports = { 4482 set: setTask, 4483 clear: clearTask 4484 }; 4485 4486/***/ }), 4487/* 209 */ 4488/***/ (function(module, exports, __webpack_require__) { 4489 4490 var global = __webpack_require__(4) 4491 , macrotask = __webpack_require__(208).set 4492 , Observer = global.MutationObserver || global.WebKitMutationObserver 4493 , process = global.process 4494 , Promise = global.Promise 4495 , isNode = __webpack_require__(34)(process) == 'process'; 4496 4497 module.exports = function(){ 4498 var head, last, notify; 4499 4500 var flush = function(){ 4501 var parent, fn; 4502 if(isNode && (parent = process.domain))parent.exit(); 4503 while(head){ 4504 fn = head.fn; 4505 head = head.next; 4506 try { 4507 fn(); 4508 } catch(e){ 4509 if(head)notify(); 4510 else last = undefined; 4511 throw e; 4512 } 4513 } last = undefined; 4514 if(parent)parent.enter(); 4515 }; 4516 4517 // Node.js 4518 if(isNode){ 4519 notify = function(){ 4520 process.nextTick(flush); 4521 }; 4522 // browsers with MutationObserver 4523 } else if(Observer){ 4524 var toggle = true 4525 , node = document.createTextNode(''); 4526 new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new 4527 notify = function(){ 4528 node.data = toggle = !toggle; 4529 }; 4530 // environments with maybe non-completely correct, but existent Promise 4531 } else if(Promise && Promise.resolve){ 4532 var promise = Promise.resolve(); 4533 notify = function(){ 4534 promise.then(flush); 4535 }; 4536 // for other environments - macrotask based on: 4537 // - setImmediate 4538 // - MessageChannel 4539 // - window.postMessag 4540 // - onreadystatechange 4541 // - setTimeout 4542 } else { 4543 notify = function(){ 4544 // strange IE + webpack dev server bug - use .call(global) 4545 macrotask.call(global, flush); 4546 }; 4547 } 4548 4549 return function(fn){ 4550 var task = {fn: fn, next: undefined}; 4551 if(last)last.next = task; 4552 if(!head){ 4553 head = task; 4554 notify(); 4555 } last = task; 4556 }; 4557 }; 4558 4559/***/ }), 4560/* 210 */ 4561/***/ (function(module, exports, __webpack_require__) { 4562 4563 var redefine = __webpack_require__(18); 4564 module.exports = function(target, src, safe){ 4565 for(var key in src)redefine(target, key, src[key], safe); 4566 return target; 4567 }; 4568 4569/***/ }), 4570/* 211 */ 4571/***/ (function(module, exports, __webpack_require__) { 4572 4573 'use strict'; 4574 var strong = __webpack_require__(212); 4575 4576 // 23.1 Map Objects 4577 module.exports = __webpack_require__(213)('Map', function(get){ 4578 return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 4579 }, { 4580 // 23.1.3.6 Map.prototype.get(key) 4581 get: function get(key){ 4582 var entry = strong.getEntry(this, key); 4583 return entry && entry.v; 4584 }, 4585 // 23.1.3.9 Map.prototype.set(key, value)
vendor: 6,446 bytes, lines 4586-4769
4586 set: function set(key, value){ 4587 return strong.def(this, key === 0 ? 0 : key, value); 4588 } 4589 }, strong, true); 4590 4591/***/ }), 4592/* 212 */ 4593/***/ (function(module, exports, __webpack_require__) { 4594 4595 'use strict'; 4596 var dP = __webpack_require__(11).f 4597 , create = __webpack_require__(46) 4598 , redefineAll = __webpack_require__(210) 4599 , ctx = __webpack_require__(20) 4600 , anInstance = __webpack_require__(205) 4601 , defined = __webpack_require__(35) 4602 , forOf = __webpack_require__(206) 4603 , $iterDefine = __webpack_require__(128) 4604 , step = __webpack_require__(194) 4605 , setSpecies = __webpack_require__(192) 4606 , DESCRIPTORS = __webpack_require__(6) 4607 , fastKey = __webpack_require__(22).fastKey 4608 , SIZE = DESCRIPTORS ? '_s' : 'size'; 4609 4610 var getEntry = function(that, key){ 4611 // fast case 4612 var index = fastKey(key), entry; 4613 if(index !== 'F')return that._i[index]; 4614 // frozen object case 4615 for(entry = that._f; entry; entry = entry.n){ 4616 if(entry.k == key)return entry; 4617 } 4618 }; 4619 4620 module.exports = { 4621 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ 4622 var C = wrapper(function(that, iterable){ 4623 anInstance(that, C, NAME, '_i'); 4624 that._i = create(null); // index 4625 that._f = undefined; // first entry 4626 that._l = undefined; // last entry 4627 that[SIZE] = 0; // size 4628 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); 4629 }); 4630 redefineAll(C.prototype, { 4631 // 23.1.3.1 Map.prototype.clear() 4632 // 23.2.3.2 Set.prototype.clear() 4633 clear: function clear(){ 4634 for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ 4635 entry.r = true; 4636 if(entry.p)entry.p = entry.p.n = undefined; 4637 delete data[entry.i]; 4638 } 4639 that._f = that._l = undefined; 4640 that[SIZE] = 0; 4641 }, 4642 // 23.1.3.3 Map.prototype.delete(key) 4643 // 23.2.3.4 Set.prototype.delete(value) 4644 'delete': function(key){ 4645 var that = this 4646 , entry = getEntry(that, key); 4647 if(entry){ 4648 var next = entry.n 4649 , prev = entry.p; 4650 delete that._i[entry.i]; 4651 entry.r = true; 4652 if(prev)prev.n = next; 4653 if(next)next.p = prev; 4654 if(that._f == entry)that._f = next; 4655 if(that._l == entry)that._l = prev; 4656 that[SIZE]--; 4657 } return !!entry; 4658 }, 4659 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) 4660 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) 4661 forEach: function forEach(callbackfn /*, that = undefined */){ 4662 anInstance(this, C, 'forEach'); 4663 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) 4664 , entry; 4665 while(entry = entry ? entry.n : this._f){ 4666 f(entry.v, entry.k, this); 4667 // revert to the last existing entry 4668 while(entry && entry.r)entry = entry.p; 4669 } 4670 }, 4671 // 23.1.3.7 Map.prototype.has(key) 4672 // 23.2.3.7 Set.prototype.has(value) 4673 has: function has(key){ 4674 return !!getEntry(this, key); 4675 } 4676 }); 4677 if(DESCRIPTORS)dP(C.prototype, 'size', { 4678 get: function(){ 4679 return defined(this[SIZE]); 4680 } 4681 }); 4682 return C; 4683 }, 4684 def: function(that, key, value){ 4685 var entry = getEntry(that, key) 4686 , prev, index; 4687 // change existing entry 4688 if(entry){ 4689 entry.v = value; 4690 // create new entry 4691 } else { 4692 that._l = entry = { 4693 i: index = fastKey(key, true), // <- index 4694 k: key, // <- key 4695 v: value, // <- value 4696 p: prev = that._l, // <- previous entry 4697 n: undefined, // <- next entry 4698 r: false // <- removed 4699 }; 4700 if(!that._f)that._f = entry; 4701 if(prev)prev.n = entry; 4702 that[SIZE]++; 4703 // add to index 4704 if(index !== 'F')that._i[index] = entry; 4705 } return that; 4706 }, 4707 getEntry: getEntry, 4708 setStrong: function(C, NAME, IS_MAP){ 4709 // add .keys, .values, .entries, [@@iterator] 4710 // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 4711 $iterDefine(C, NAME, function(iterated, kind){ 4712 this._t = iterated; // target 4713 this._k = kind; // kind 4714 this._l = undefined; // previous 4715 }, function(){ 4716 var that = this 4717 , kind = that._k 4718 , entry = that._l; 4719 // revert to the last existing entry 4720 while(entry && entry.r)entry = entry.p; 4721 // get next entry 4722 if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ 4723 // or finish the iteration 4724 that._t = undefined; 4725 return step(1); 4726 } 4727 // return step by kind 4728 if(kind == 'keys' )return step(0, entry.k); 4729 if(kind == 'values')return step(0, entry.v); 4730 return step(0, [entry.k, entry.v]); 4731 }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); 4732 4733 // add [@@species], 23.1.2.2, 23.2.2.2 4734 setSpecies(NAME); 4735 } 4736 }; 4737 4738/***/ }), 4739/* 213 */ 4740/***/ (function(module, exports, __webpack_require__) { 4741 4742 'use strict'; 4743 var global = __webpack_require__(4) 4744 , $export = __webpack_require__(8) 4745 , redefine = __webpack_require__(18) 4746 , redefineAll = __webpack_require__(210) 4747 , meta = __webpack_require__(22) 4748 , forOf = __webpack_require__(206) 4749 , anInstance = __webpack_require__(205) 4750 , isObject = __webpack_require__(13) 4751 , fails = __webpack_require__(7) 4752 , $iterDetect = __webpack_require__(165) 4753 , setToStringTag = __webpack_require__(24) 4754 , inheritIfRequired = __webpack_require__(88); 4755 4756 module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ 4757 var Base = global[NAME] 4758 , C = Base 4759 , ADDER = IS_MAP ? 'set' : 'add' 4760 , proto = C && C.prototype 4761 , O = {}; 4762 var fixMethod = function(KEY){ 4763 var fn = proto[KEY]; 4764 redefine(proto, KEY, 4765 KEY == 'delete' ? function(a){ 4766 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); 4767 } : KEY == 'has' ? function has(a){ 4768 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); 4769 } : KEY == 'get' ? function get(a){
4770 return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); 4771 } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } 4772 : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } 4773 ); 4774 }; 4775 if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ 4776 new C().entries().next(); 4777 }))){ 4778 // create collection constructor 4779 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); 4780 redefineAll(C.prototype, methods); 4781 meta.NEED = true; 4782 } else { 4783 var instance = new C 4784 // early implementations not supports chaining 4785 , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance 4786 // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false 4787 , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) 4788 // most early implementations doesn't supports iterables, most modern - not close it correctly 4789 , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new 4790 // for early implementations -0 and +0 not the same 4791 , BUGGY_ZERO = !IS_WEAK && fails(function(){ 4792 // V8 ~ Chromium 42- fails only with 5+ elements 4793 var $instance = new C() 4794 , index = 5; 4795 while(index--)$instance[ADDER](index, index); 4796 return !$instance.has(-0); 4797 }); 4798 if(!ACCEPT_ITERABLES){ 4799 C = wrapper(function(target, iterable){ 4800 anInstance(target, C, NAME); 4801 var that = inheritIfRequired(new Base, target, C); 4802 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); 4803 return that; 4804 }); 4805 C.prototype = proto; 4806 proto.constructor = C; 4807 } 4808 if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ 4809 fixMethod('delete'); 4810 fixMethod('has'); 4811 IS_MAP && fixMethod('get'); 4812 } 4813 if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); 4814 // weak collections should not contains .clear method 4815 if(IS_WEAK && proto.clear)delete proto.clear; 4816 } 4817 4818 setToStringTag(C, NAME); 4819 4820 O[NAME] = C; 4821 $export($export.G + $export.W + $export.F * (C != Base), O); 4822 4823 if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); 4824 4825 return C; 4826 }; 4827 4828/***/ }), 4829/* 214 */ 4830/***/ (function(module, exports, __webpack_require__) { 4831 4832 'use strict'; 4833 var strong = __webpack_require__(212); 4834 4835 // 23.2 Set Objects 4836 module.exports = __webpack_require__(213)('Set', function(get){ 4837 return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 4838 }, { 4839 // 23.2.3.1 Set.prototype.add(value) 4840 add: function add(value){ 4841 return strong.def(this, value = value === 0 ? 0 : value, value); 4842 } 4843 }, strong); 4844 4845/***/ }), 4846/* 215 */ 4847/***/ (function(module, exports, __webpack_require__) { 4848 4849 'use strict'; 4850 var each = __webpack_require__(172)(0) 4851 , redefine = __webpack_require__(18) 4852 , meta = __webpack_require__(22) 4853 , assign = __webpack_require__(69) 4854 , weak = __webpack_require__(216) 4855 , isObject = __webpack_require__(13) 4856 , getWeak = meta.getWeak 4857 , isExtensible = Object.isExtensible 4858 , uncaughtFrozenStore = weak.ufstore 4859 , tmp = {} 4860 , InternalMap; 4861 4862 var wrapper = function(get){ 4863 return function WeakMap(){ 4864 return get(this, arguments.length > 0 ? arguments[0] : undefined); 4865 }; 4866 }; 4867 4868 var methods = { 4869 // 23.3.3.3 WeakMap.prototype.get(key) 4870 get: function get(key){ 4871 if(isObject(key)){ 4872 var data = getWeak(key); 4873 if(data === true)return uncaughtFrozenStore(this).get(key); 4874 return data ? data[this._i] : undefined; 4875 } 4876 }, 4877 // 23.3.3.5 WeakMap.prototype.set(key, value) 4878 set: function set(key, value){ 4879 return weak.def(this, key, value); 4880 } 4881 }; 4882 4883 // 23.3 WeakMap Objects 4884 var $WeakMap = module.exports = __webpack_require__(213)('WeakMap', wrapper, methods, weak, true, true); 4885 4886 // IE11 WeakMap frozen keys fix 4887 if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ 4888 InternalMap = weak.getConstructor(wrapper); 4889 assign(InternalMap.prototype, methods); 4890 meta.NEED = true; 4891 each(['delete', 'has', 'get', 'set'], function(key){ 4892 var proto = $WeakMap.prototype 4893 , method = proto[key]; 4894 redefine(proto, key, function(a, b){ 4895 // store frozen objects on internal weakmap shim 4896 if(isObject(a) && !isExtensible(a)){ 4897 if(!this._f)this._f = new InternalMap; 4898 var result = this._f[key](a, b); 4899 return key == 'set' ? this : result; 4900 // store all the rest on native weakmap 4901 } return method.call(this, a, b); 4902 }); 4903 }); 4904 } 4905 4906/***/ }), 4907/* 216 */ 4908/***/ (function(module, exports, __webpack_require__) { 4909 4910 'use strict'; 4911 var redefineAll = __webpack_require__(210) 4912 , getWeak = __webpack_require__(22).getWeak 4913 , anObject = __webpack_require__(12) 4914 , isObject = __webpack_require__(13) 4915 , anInstance = __webpack_require__(205) 4916 , forOf = __webpack_require__(206) 4917 , createArrayMethod = __webpack_require__(172) 4918 , $has = __webpack_require__(5) 4919 , arrayFind = createArrayMethod(5) 4920 , arrayFindIndex = createArrayMethod(6) 4921 , id = 0; 4922
vendor: 4,850 bytes, lines 4923-5069
4923 // fallback for uncaught frozen keys 4924 var uncaughtFrozenStore = function(that){ 4925 return that._l || (that._l = new UncaughtFrozenStore); 4926 }; 4927 var UncaughtFrozenStore = function(){ 4928 this.a = []; 4929 }; 4930 var findUncaughtFrozen = function(store, key){ 4931 return arrayFind(store.a, function(it){ 4932 return it[0] === key; 4933 }); 4934 }; 4935 UncaughtFrozenStore.prototype = { 4936 get: function(key){ 4937 var entry = findUncaughtFrozen(this, key); 4938 if(entry)return entry[1]; 4939 }, 4940 has: function(key){ 4941 return !!findUncaughtFrozen(this, key); 4942 }, 4943 set: function(key, value){ 4944 var entry = findUncaughtFrozen(this, key); 4945 if(entry)entry[1] = value; 4946 else this.a.push([key, value]); 4947 }, 4948 'delete': function(key){ 4949 var index = arrayFindIndex(this.a, function(it){ 4950 return it[0] === key; 4951 }); 4952 if(~index)this.a.splice(index, 1); 4953 return !!~index; 4954 } 4955 }; 4956 4957 module.exports = { 4958 getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ 4959 var C = wrapper(function(that, iterable){ 4960 anInstance(that, C, NAME, '_i'); 4961 that._i = id++; // collection id 4962 that._l = undefined; // leak store for uncaught frozen objects 4963 if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); 4964 }); 4965 redefineAll(C.prototype, { 4966 // 23.3.3.2 WeakMap.prototype.delete(key) 4967 // 23.4.3.3 WeakSet.prototype.delete(value) 4968 'delete': function(key){ 4969 if(!isObject(key))return false; 4970 var data = getWeak(key); 4971 if(data === true)return uncaughtFrozenStore(this)['delete'](key); 4972 return data && $has(data, this._i) && delete data[this._i]; 4973 }, 4974 // 23.3.3.4 WeakMap.prototype.has(key) 4975 // 23.4.3.4 WeakSet.prototype.has(value) 4976 has: function has(key){ 4977 if(!isObject(key))return false; 4978 var data = getWeak(key); 4979 if(data === true)return uncaughtFrozenStore(this).has(key); 4980 return data && $has(data, this._i); 4981 } 4982 }); 4983 return C; 4984 }, 4985 def: function(that, key, value){ 4986 var data = getWeak(anObject(key), true); 4987 if(data === true)uncaughtFrozenStore(that).set(key, value); 4988 else data[that._i] = value; 4989 return that; 4990 }, 4991 ufstore: uncaughtFrozenStore 4992 }; 4993 4994/***/ }), 4995/* 217 */ 4996/***/ (function(module, exports, __webpack_require__) { 4997 4998 'use strict'; 4999 var weak = __webpack_require__(216); 5000 5001 // 23.4 WeakSet Objects 5002 __webpack_require__(213)('WeakSet', function(get){ 5003 return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 5004 }, { 5005 // 23.4.3.1 WeakSet.prototype.add(value) 5006 add: function add(value){ 5007 return weak.def(this, value, true); 5008 } 5009 }, weak, false, true); 5010 5011/***/ }), 5012/* 218 */ 5013/***/ (function(module, exports, __webpack_require__) { 5014 5015 'use strict'; 5016 var $export = __webpack_require__(8) 5017 , $typed = __webpack_require__(219) 5018 , buffer = __webpack_require__(220) 5019 , anObject = __webpack_require__(12) 5020 , toIndex = __webpack_require__(39) 5021 , toLength = __webpack_require__(37) 5022 , isObject = __webpack_require__(13) 5023 , ArrayBuffer = __webpack_require__(4).ArrayBuffer 5024 , speciesConstructor = __webpack_require__(207) 5025 , $ArrayBuffer = buffer.ArrayBuffer 5026 , $DataView = buffer.DataView 5027 , $isView = $typed.ABV && ArrayBuffer.isView 5028 , $slice = $ArrayBuffer.prototype.slice 5029 , VIEW = $typed.VIEW 5030 , ARRAY_BUFFER = 'ArrayBuffer'; 5031 5032 $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer}); 5033 5034 $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { 5035 // 24.1.3.1 ArrayBuffer.isView(arg) 5036 isView: function isView(it){ 5037 return $isView && $isView(it) || isObject(it) && VIEW in it; 5038 } 5039 }); 5040 5041 $export($export.P + $export.U + $export.F * __webpack_require__(7)(function(){ 5042 return !new $ArrayBuffer(2).slice(1, undefined).byteLength; 5043 }), ARRAY_BUFFER, { 5044 // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) 5045 slice: function slice(start, end){ 5046 if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix 5047 var len = anObject(this).byteLength 5048 , first = toIndex(start, len) 5049 , final = toIndex(end === undefined ? len : end, len) 5050 , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first)) 5051 , viewS = new $DataView(this) 5052 , viewT = new $DataView(result) 5053 , index = 0; 5054 while(first < final){ 5055 viewT.setUint8(index++, viewS.getUint8(first++)); 5056 } return result; 5057 } 5058 }); 5059 5060 __webpack_require__(192)(ARRAY_BUFFER); 5061 5062/***/ }), 5063/* 219 */ 5064/***/ (function(module, exports, __webpack_require__) { 5065 5066 var global = __webpack_require__(4) 5067 , hide = __webpack_require__(10) 5068 , uid = __webpack_require__(19) 5069 , TYPED = uid('typed_array')
5070 , VIEW = uid('view') 5071 , ABV = !!(global.ArrayBuffer && global.DataView) 5072 , CONSTR = ABV 5073 , i = 0, l = 9, Typed; 5074 5075 var TypedArrayConstructors = ( 5076 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' 5077 ).split(','); 5078 5079 while(i < l){ 5080 if(Typed = global[TypedArrayConstructors[i++]]){ 5081 hide(Typed.prototype, TYPED, true); 5082 hide(Typed.prototype, VIEW, true); 5083 } else CONSTR = false; 5084 } 5085 5086 module.exports = { 5087 ABV: ABV, 5088 CONSTR: CONSTR, 5089 TYPED: TYPED, 5090 VIEW: VIEW 5091 }; 5092 5093/***/ }), 5094/* 220 */ 5095/***/ (function(module, exports, __webpack_require__) { 5096 5097 'use strict'; 5098 var global = __webpack_require__(4) 5099 , DESCRIPTORS = __webpack_require__(6) 5100 , LIBRARY = __webpack_require__(28) 5101 , $typed = __webpack_require__(219) 5102 , hide = __webpack_require__(10) 5103 , redefineAll = __webpack_require__(210) 5104 , fails = __webpack_require__(7) 5105 , anInstance = __webpack_require__(205) 5106 , toInteger = __webpack_require__(38) 5107 , toLength = __webpack_require__(37) 5108 , gOPN = __webpack_require__(50).f 5109 , dP = __webpack_require__(11).f 5110 , arrayFill = __webpack_require__(188) 5111 , setToStringTag = __webpack_require__(24) 5112 , ARRAY_BUFFER = 'ArrayBuffer' 5113 , DATA_VIEW = 'DataView' 5114 , PROTOTYPE = 'prototype' 5115 , WRONG_LENGTH = 'Wrong length!' 5116 , WRONG_INDEX = 'Wrong index!' 5117 , $ArrayBuffer = global[ARRAY_BUFFER] 5118 , $DataView = global[DATA_VIEW] 5119 , Math = global.Math 5120 , RangeError = global.RangeError 5121 , Infinity = global.Infinity 5122 , BaseBuffer = $ArrayBuffer 5123 , abs = Math.abs 5124 , pow = Math.pow 5125 , floor = Math.floor 5126 , log = Math.log 5127 , LN2 = Math.LN2 5128 , BUFFER = 'buffer' 5129 , BYTE_LENGTH = 'byteLength' 5130 , BYTE_OFFSET = 'byteOffset' 5131 , $BUFFER = DESCRIPTORS ? '_b' : BUFFER 5132 , $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH 5133 , $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; 5134 5135 // IEEE754 conversions based on https://github.com/feross/ieee754 5136 var packIEEE754 = function(value, mLen, nBytes){ 5137 var buffer = Array(nBytes) 5138 , eLen = nBytes * 8 - mLen - 1 5139 , eMax = (1 << eLen) - 1 5140 , eBias = eMax >> 1 5141 , rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0 5142 , i = 0 5143 , s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0 5144 , e, m, c; 5145 value = abs(value) 5146 if(value != value || value === Infinity){ 5147 m = value != value ? 1 : 0; 5148 e = eMax; 5149 } else { 5150 e = floor(log(value) / LN2); 5151 if(value * (c = pow(2, -e)) < 1){ 5152 e--; 5153 c *= 2; 5154 } 5155 if(e + eBias >= 1){ 5156 value += rt / c; 5157 } else { 5158 value += rt * pow(2, 1 - eBias); 5159 } 5160 if(value * c >= 2){ 5161 e++; 5162 c /= 2; 5163 } 5164 if(e + eBias >= eMax){ 5165 m = 0; 5166 e = eMax; 5167 } else if(e + eBias >= 1){ 5168 m = (value * c - 1) * pow(2, mLen); 5169 e = e + eBias; 5170 } else { 5171 m = value * pow(2, eBias - 1) * pow(2, mLen); 5172 e = 0; 5173 } 5174 } 5175 for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); 5176 e = e << mLen | m; 5177 eLen += mLen; 5178 for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); 5179 buffer[--i] |= s * 128; 5180 return buffer; 5181 }; 5182 var unpackIEEE754 = function(buffer, mLen, nBytes){ 5183 var eLen = nBytes * 8 - mLen - 1 5184 , eMax = (1 << eLen) - 1 5185 , eBias = eMax >> 1 5186 , nBits = eLen - 7 5187 , i = nBytes - 1 5188 , s = buffer[i--] 5189 , e = s & 127 5190 , m; 5191 s >>= 7; 5192 for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); 5193 m = e & (1 << -nBits) - 1; 5194 e >>= -nBits; 5195 nBits += mLen; 5196 for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); 5197 if(e === 0){ 5198 e = 1 - eBias; 5199 } else if(e === eMax){ 5200 return m ? NaN : s ? -Infinity : Infinity; 5201 } else { 5202 m = m + pow(2, mLen); 5203 e = e - eBias; 5204 } return (s ? -1 : 1) * m * pow(2, e - mLen); 5205 }; 5206 5207 var unpackI32 = function(bytes){
5208 return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; 5209 }; 5210 var packI8 = function(it){ 5211 return [it & 0xff]; 5212 }; 5213 var packI16 = function(it){ 5214 return [it & 0xff, it >> 8 & 0xff]; 5215 }; 5216 var packI32 = function(it){ 5217 return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; 5218 }; 5219 var packF64 = function(it){ 5220 return packIEEE754(it, 52, 8); 5221 }; 5222 var packF32 = function(it){ 5223 return packIEEE754(it, 23, 4); 5224 }; 5225 5226 var addGetter = function(C, key, internal){ 5227 dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }}); 5228 }; 5229 5230 var get = function(view, bytes, index, isLittleEndian){ 5231 var numIndex = +index 5232 , intIndex = toInteger(numIndex); 5233 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); 5234 var store = view[$BUFFER]._b 5235 , start = intIndex + view[$OFFSET] 5236 , pack = store.slice(start, start + bytes); 5237 return isLittleEndian ? pack : pack.reverse(); 5238 }; 5239 var set = function(view, bytes, index, conversion, value, isLittleEndian){ 5240 var numIndex = +index 5241 , intIndex = toInteger(numIndex); 5242 if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); 5243 var store = view[$BUFFER]._b 5244 , start = intIndex + view[$OFFSET] 5245 , pack = conversion(+value); 5246 for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; 5247 }; 5248 5249 var validateArrayBufferArguments = function(that, length){ 5250 anInstance(that, $ArrayBuffer, ARRAY_BUFFER); 5251 var numberLength = +length 5252 , byteLength = toLength(numberLength); 5253 if(numberLength != byteLength)throw RangeError(WRONG_LENGTH); 5254 return byteLength; 5255 }; 5256 5257 if(!$typed.ABV){ 5258 $ArrayBuffer = function ArrayBuffer(length){ 5259 var byteLength = validateArrayBufferArguments(this, length); 5260 this._b = arrayFill.call(Array(byteLength), 0); 5261 this[$LENGTH] = byteLength; 5262 }; 5263 5264 $DataView = function DataView(buffer, byteOffset, byteLength){ 5265 anInstance(this, $DataView, DATA_VIEW); 5266 anInstance(buffer, $ArrayBuffer, DATA_VIEW); 5267 var bufferLength = buffer[$LENGTH] 5268 , offset = toInteger(byteOffset); 5269 if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!'); 5270 byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); 5271 if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH); 5272 this[$BUFFER] = buffer; 5273 this[$OFFSET] = offset; 5274 this[$LENGTH] = byteLength; 5275 }; 5276 5277 if(DESCRIPTORS){ 5278 addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); 5279 addGetter($DataView, BUFFER, '_b'); 5280 addGetter($DataView, BYTE_LENGTH, '_l'); 5281 addGetter($DataView, BYTE_OFFSET, '_o'); 5282 } 5283 5284 redefineAll($DataView[PROTOTYPE], { 5285 getInt8: function getInt8(byteOffset){ 5286 return get(this, 1, byteOffset)[0] << 24 >> 24; 5287 }, 5288 getUint8: function getUint8(byteOffset){ 5289 return get(this, 1, byteOffset)[0]; 5290 }, 5291 getInt16: function getInt16(byteOffset /*, littleEndian */){ 5292 var bytes = get(this, 2, byteOffset, arguments[1]); 5293 return (bytes[1] << 8 | bytes[0]) << 16 >> 16; 5294 }, 5295 getUint16: function getUint16(byteOffset /*, littleEndian */){ 5296 var bytes = get(this, 2, byteOffset, arguments[1]); 5297 return bytes[1] << 8 | bytes[0]; 5298 }, 5299 getInt32: function getInt32(byteOffset /*, littleEndian */){ 5300 return unpackI32(get(this, 4, byteOffset, arguments[1])); 5301 }, 5302 getUint32: function getUint32(byteOffset /*, littleEndian */){ 5303 return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; 5304 }, 5305 getFloat32: function getFloat32(byteOffset /*, littleEndian */){ 5306 return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); 5307 }, 5308 getFloat64: function getFloat64(byteOffset /*, littleEndian */){ 5309 return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); 5310 }, 5311 setInt8: function setInt8(byteOffset, value){ 5312 set(this, 1, byteOffset, packI8, value); 5313 }, 5314 setUint8: function setUint8(byteOffset, value){ 5315 set(this, 1, byteOffset, packI8, value); 5316 }, 5317 setInt16: function setInt16(byteOffset, value /*, littleEndian */){ 5318 set(this, 2, byteOffset, packI16, value, arguments[2]); 5319 }, 5320 setUint16: function setUint16(byteOffset, value /*, littleEndian */){ 5321 set(this, 2, byteOffset, packI16, value, arguments[2]); 5322 }, 5323 setInt32: function setInt32(byteOffset, value /*, littleEndian */){ 5324 set(this, 4, byteOffset, packI32, value, arguments[2]); 5325 }, 5326 setUint32: function setUint32(byteOffset, value /*, littleEndian */){ 5327 set(this, 4, byteOffset, packI32, value, arguments[2]); 5328 }, 5329 setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){ 5330 set(this, 4, byteOffset, packF32, value, arguments[2]); 5331 }, 5332 setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){ 5333 set(this, 8, byteOffset, packF64, value, arguments[2]); 5334 } 5335 }); 5336 } else { 5337 if(!fails(function(){ 5338 new $ArrayBuffer; // eslint-disable-line no-new 5339 }) || !fails(function(){ 5340 new $ArrayBuffer(.5); // eslint-disable-line no-new 5341 })){ 5342 $ArrayBuffer = function ArrayBuffer(length){ 5343 return new BaseBuffer(validateArrayBufferArguments(this, length)); 5344 }; 5345 var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
vendor: 5,036 bytes, lines 5346-5463
5346 for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){ 5347 if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]); 5348 }; 5349 if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer; 5350 } 5351 // iOS Safari 7.x bug 5352 var view = new $DataView(new $ArrayBuffer(2)) 5353 , $setInt8 = $DataView[PROTOTYPE].setInt8; 5354 view.setInt8(0, 2147483648); 5355 view.setInt8(1, 2147483649); 5356 if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], { 5357 setInt8: function setInt8(byteOffset, value){ 5358 $setInt8.call(this, byteOffset, value << 24 >> 24); 5359 }, 5360 setUint8: function setUint8(byteOffset, value){ 5361 $setInt8.call(this, byteOffset, value << 24 >> 24); 5362 } 5363 }, true); 5364 } 5365 setToStringTag($ArrayBuffer, ARRAY_BUFFER); 5366 setToStringTag($DataView, DATA_VIEW); 5367 hide($DataView[PROTOTYPE], $typed.VIEW, true); 5368 exports[ARRAY_BUFFER] = $ArrayBuffer; 5369 exports[DATA_VIEW] = $DataView; 5370 5371/***/ }), 5372/* 221 */ 5373/***/ (function(module, exports, __webpack_require__) { 5374 5375 var $export = __webpack_require__(8); 5376 $export($export.G + $export.W + $export.F * !__webpack_require__(219).ABV, { 5377 DataView: __webpack_require__(220).DataView 5378 }); 5379 5380/***/ }), 5381/* 222 */ 5382/***/ (function(module, exports, __webpack_require__) { 5383 5384 __webpack_require__(223)('Int8', 1, function(init){ 5385 return function Int8Array(data, byteOffset, length){ 5386 return init(this, data, byteOffset, length); 5387 }; 5388 }); 5389 5390/***/ }), 5391/* 223 */ 5392/***/ (function(module, exports, __webpack_require__) { 5393 5394 'use strict'; 5395 if(__webpack_require__(6)){ 5396 var LIBRARY = __webpack_require__(28) 5397 , global = __webpack_require__(4) 5398 , fails = __webpack_require__(7) 5399 , $export = __webpack_require__(8) 5400 , $typed = __webpack_require__(219) 5401 , $buffer = __webpack_require__(220) 5402 , ctx = __webpack_require__(20) 5403 , anInstance = __webpack_require__(205) 5404 , propertyDesc = __webpack_require__(17) 5405 , hide = __webpack_require__(10) 5406 , redefineAll = __webpack_require__(210) 5407 , toInteger = __webpack_require__(38) 5408 , toLength = __webpack_require__(37) 5409 , toIndex = __webpack_require__(39) 5410 , toPrimitive = __webpack_require__(16) 5411 , has = __webpack_require__(5) 5412 , same = __webpack_require__(71) 5413 , classof = __webpack_require__(75) 5414 , isObject = __webpack_require__(13) 5415 , toObject = __webpack_require__(58) 5416 , isArrayIter = __webpack_require__(162) 5417 , create = __webpack_require__(46) 5418 , getPrototypeOf = __webpack_require__(59) 5419 , gOPN = __webpack_require__(50).f 5420 , getIterFn = __webpack_require__(164) 5421 , uid = __webpack_require__(19) 5422 , wks = __webpack_require__(25) 5423 , createArrayMethod = __webpack_require__(172) 5424 , createArrayIncludes = __webpack_require__(36) 5425 , speciesConstructor = __webpack_require__(207) 5426 , ArrayIterators = __webpack_require__(193) 5427 , Iterators = __webpack_require__(129) 5428 , $iterDetect = __webpack_require__(165) 5429 , setSpecies = __webpack_require__(192) 5430 , arrayFill = __webpack_require__(188) 5431 , arrayCopyWithin = __webpack_require__(185) 5432 , $DP = __webpack_require__(11) 5433 , $GOPD = __webpack_require__(51) 5434 , dP = $DP.f 5435 , gOPD = $GOPD.f 5436 , RangeError = global.RangeError 5437 , TypeError = global.TypeError 5438 , Uint8Array = global.Uint8Array 5439 , ARRAY_BUFFER = 'ArrayBuffer' 5440 , SHARED_BUFFER = 'Shared' + ARRAY_BUFFER 5441 , BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT' 5442 , PROTOTYPE = 'prototype' 5443 , ArrayProto = Array[PROTOTYPE] 5444 , $ArrayBuffer = $buffer.ArrayBuffer 5445 , $DataView = $buffer.DataView 5446 , arrayForEach = createArrayMethod(0) 5447 , arrayFilter = createArrayMethod(2) 5448 , arraySome = createArrayMethod(3) 5449 , arrayEvery = createArrayMethod(4) 5450 , arrayFind = createArrayMethod(5) 5451 , arrayFindIndex = createArrayMethod(6) 5452 , arrayIncludes = createArrayIncludes(true) 5453 , arrayIndexOf = createArrayIncludes(false) 5454 , arrayValues = ArrayIterators.values 5455 , arrayKeys = ArrayIterators.keys 5456 , arrayEntries = ArrayIterators.entries 5457 , arrayLastIndexOf = ArrayProto.lastIndexOf 5458 , arrayReduce = ArrayProto.reduce 5459 , arrayReduceRight = ArrayProto.reduceRight 5460 , arrayJoin = ArrayProto.join 5461 , arraySort = ArrayProto.sort 5462 , arraySlice = ArrayProto.slice 5463 , arrayToString = ArrayProto.toString
vendor: 4,387 bytes, lines 5464-5580
5464 , arrayToLocaleString = ArrayProto.toLocaleString 5465 , ITERATOR = wks('iterator') 5466 , TAG = wks('toStringTag') 5467 , TYPED_CONSTRUCTOR = uid('typed_constructor') 5468 , DEF_CONSTRUCTOR = uid('def_constructor') 5469 , ALL_CONSTRUCTORS = $typed.CONSTR 5470 , TYPED_ARRAY = $typed.TYPED 5471 , VIEW = $typed.VIEW 5472 , WRONG_LENGTH = 'Wrong length!'; 5473 5474 var $map = createArrayMethod(1, function(O, length){ 5475 return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); 5476 }); 5477 5478 var LITTLE_ENDIAN = fails(function(){ 5479 return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; 5480 }); 5481 5482 var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){ 5483 new Uint8Array(1).set({}); 5484 }); 5485 5486 var strictToLength = function(it, SAME){ 5487 if(it === undefined)throw TypeError(WRONG_LENGTH); 5488 var number = +it 5489 , length = toLength(it); 5490 if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH); 5491 return length; 5492 }; 5493 5494 var toOffset = function(it, BYTES){ 5495 var offset = toInteger(it); 5496 if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!'); 5497 return offset; 5498 }; 5499 5500 var validate = function(it){ 5501 if(isObject(it) && TYPED_ARRAY in it)return it; 5502 throw TypeError(it + ' is not a typed array!'); 5503 }; 5504 5505 var allocate = function(C, length){ 5506 if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){ 5507 throw TypeError('It is not a typed array constructor!'); 5508 } return new C(length); 5509 }; 5510 5511 var speciesFromList = function(O, list){ 5512 return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); 5513 }; 5514 5515 var fromList = function(C, list){ 5516 var index = 0 5517 , length = list.length 5518 , result = allocate(C, length); 5519 while(length > index)result[index] = list[index++]; 5520 return result; 5521 }; 5522 5523 var addGetter = function(it, key, internal){ 5524 dP(it, key, {get: function(){ return this._d[internal]; }}); 5525 }; 5526 5527 var $from = function from(source /*, mapfn, thisArg */){ 5528 var O = toObject(source) 5529 , aLen = arguments.length 5530 , mapfn = aLen > 1 ? arguments[1] : undefined 5531 , mapping = mapfn !== undefined 5532 , iterFn = getIterFn(O) 5533 , i, length, values, result, step, iterator; 5534 if(iterFn != undefined && !isArrayIter(iterFn)){ 5535 for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){ 5536 values.push(step.value); 5537 } O = values; 5538 } 5539 if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2); 5540 for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){ 5541 result[i] = mapping ? mapfn(O[i], i) : O[i]; 5542 } 5543 return result; 5544 }; 5545 5546 var $of = function of(/*...items*/){ 5547 var index = 0 5548 , length = arguments.length 5549 , result = allocate(this, length); 5550 while(length > index)result[index] = arguments[index++]; 5551 return result; 5552 }; 5553 5554 // iOS Safari 6.x fails here 5555 var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); }); 5556 5557 var $toLocaleString = function toLocaleString(){ 5558 return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); 5559 }; 5560 5561 var proto = { 5562 copyWithin: function copyWithin(target, start /*, end */){ 5563 return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); 5564 }, 5565 every: function every(callbackfn /*, thisArg */){ 5566 return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 5567 }, 5568 fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars 5569 return arrayFill.apply(validate(this), arguments); 5570 }, 5571 filter: function filter(callbackfn /*, thisArg */){ 5572 return speciesFromList(this, arrayFilter(validate(this), callbackfn, 5573 arguments.length > 1 ? arguments[1] : undefined)); 5574 }, 5575 find: function find(predicate /*, thisArg */){ 5576 return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); 5577 }, 5578 findIndex: function findIndex(predicate /*, thisArg */){ 5579 return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); 5580 },
5581 forEach: function forEach(callbackfn /*, thisArg */){ 5582 arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 5583 }, 5584 indexOf: function indexOf(searchElement /*, fromIndex */){ 5585 return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); 5586 }, 5587 includes: function includes(searchElement /*, fromIndex */){ 5588 return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); 5589 }, 5590 join: function join(separator){ // eslint-disable-line no-unused-vars 5591 return arrayJoin.apply(validate(this), arguments); 5592 }, 5593 lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars 5594 return arrayLastIndexOf.apply(validate(this), arguments); 5595 }, 5596 map: function map(mapfn /*, thisArg */){ 5597 return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); 5598 }, 5599 reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars 5600 return arrayReduce.apply(validate(this), arguments); 5601 }, 5602 reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars 5603 return arrayReduceRight.apply(validate(this), arguments); 5604 }, 5605 reverse: function reverse(){ 5606 var that = this 5607 , length = validate(that).length 5608 , middle = Math.floor(length / 2) 5609 , index = 0 5610 , value; 5611 while(index < middle){ 5612 value = that[index]; 5613 that[index++] = that[--length]; 5614 that[length] = value; 5615 } return that; 5616 }, 5617 some: function some(callbackfn /*, thisArg */){ 5618 return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 5619 }, 5620 sort: function sort(comparefn){ 5621 return arraySort.call(validate(this), comparefn); 5622 }, 5623 subarray: function subarray(begin, end){ 5624 var O = validate(this) 5625 , length = O.length 5626 , $begin = toIndex(begin, length); 5627 return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( 5628 O.buffer, 5629 O.byteOffset + $begin * O.BYTES_PER_ELEMENT, 5630 toLength((end === undefined ? length : toIndex(end, length)) - $begin) 5631 ); 5632 } 5633 }; 5634 5635 var $slice = function slice(start, end){ 5636 return speciesFromList(this, arraySlice.call(validate(this), start, end)); 5637 }; 5638 5639 var $set = function set(arrayLike /*, offset */){ 5640 validate(this); 5641 var offset = toOffset(arguments[1], 1) 5642 , length = this.length 5643 , src = toObject(arrayLike) 5644 , len = toLength(src.length) 5645 , index = 0; 5646 if(len + offset > length)throw RangeError(WRONG_LENGTH); 5647 while(index < len)this[offset + index] = src[index++]; 5648 }; 5649 5650 var $iterators = {
vendor: 1,291 bytes, lines 5651-5694
5651 entries: function entries(){ 5652 return arrayEntries.call(validate(this)); 5653 }, 5654 keys: function keys(){ 5655 return arrayKeys.call(validate(this)); 5656 }, 5657 values: function values(){ 5658 return arrayValues.call(validate(this)); 5659 } 5660 }; 5661 5662 var isTAIndex = function(target, key){ 5663 return isObject(target) 5664 && target[TYPED_ARRAY] 5665 && typeof key != 'symbol' 5666 && key in target 5667 && String(+key) == String(key); 5668 }; 5669 var $getDesc = function getOwnPropertyDescriptor(target, key){ 5670 return isTAIndex(target, key = toPrimitive(key, true)) 5671 ? propertyDesc(2, target[key]) 5672 : gOPD(target, key); 5673 }; 5674 var $setDesc = function defineProperty(target, key, desc){ 5675 if(isTAIndex(target, key = toPrimitive(key, true)) 5676 && isObject(desc) 5677 && has(desc, 'value') 5678 && !has(desc, 'get') 5679 && !has(desc, 'set') 5680 // TODO: add validation descriptor w/o calling accessors 5681 && !desc.configurable 5682 && (!has(desc, 'writable') || desc.writable) 5683 && (!has(desc, 'enumerable') || desc.enumerable) 5684 ){ 5685 target[key] = desc.value; 5686 return target; 5687 } else return dP(target, key, desc); 5688 }; 5689 5690 if(!ALL_CONSTRUCTORS){ 5691 $GOPD.f = $getDesc; 5692 $DP.f = $setDesc; 5693 } 5694
vendor: 4,958 bytes, lines 5695-5816
5695 $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { 5696 getOwnPropertyDescriptor: $getDesc, 5697 defineProperty: $setDesc 5698 }); 5699 5700 if(fails(function(){ arrayToString.call({}); })){ 5701 arrayToString = arrayToLocaleString = function toString(){ 5702 return arrayJoin.call(this); 5703 } 5704 } 5705 5706 var $TypedArrayPrototype$ = redefineAll({}, proto); 5707 redefineAll($TypedArrayPrototype$, $iterators); 5708 hide($TypedArrayPrototype$, ITERATOR, $iterators.values); 5709 redefineAll($TypedArrayPrototype$, { 5710 slice: $slice, 5711 set: $set, 5712 constructor: function(){ /* noop */ }, 5713 toString: arrayToString, 5714 toLocaleString: $toLocaleString 5715 }); 5716 addGetter($TypedArrayPrototype$, 'buffer', 'b'); 5717 addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); 5718 addGetter($TypedArrayPrototype$, 'byteLength', 'l'); 5719 addGetter($TypedArrayPrototype$, 'length', 'e'); 5720 dP($TypedArrayPrototype$, TAG, { 5721 get: function(){ return this[TYPED_ARRAY]; } 5722 }); 5723 5724 module.exports = function(KEY, BYTES, wrapper, CLAMPED){ 5725 CLAMPED = !!CLAMPED; 5726 var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array' 5727 , ISNT_UINT8 = NAME != 'Uint8Array' 5728 , GETTER = 'get' + KEY 5729 , SETTER = 'set' + KEY 5730 , TypedArray = global[NAME] 5731 , Base = TypedArray || {} 5732 , TAC = TypedArray && getPrototypeOf(TypedArray) 5733 , FORCED = !TypedArray || !$typed.ABV 5734 , O = {} 5735 , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; 5736 var getter = function(that, index){ 5737 var data = that._d; 5738 return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); 5739 }; 5740 var setter = function(that, index, value){ 5741 var data = that._d; 5742 if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; 5743 data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); 5744 }; 5745 var addElement = function(that, index){ 5746 dP(that, index, { 5747 get: function(){ 5748 return getter(this, index); 5749 }, 5750 set: function(value){ 5751 return setter(this, index, value); 5752 }, 5753 enumerable: true 5754 }); 5755 }; 5756 if(FORCED){ 5757 TypedArray = wrapper(function(that, data, $offset, $length){ 5758 anInstance(that, TypedArray, NAME, '_d'); 5759 var index = 0 5760 , offset = 0 5761 , buffer, byteLength, length, klass; 5762 if(!isObject(data)){ 5763 length = strictToLength(data, true) 5764 byteLength = length * BYTES; 5765 buffer = new $ArrayBuffer(byteLength); 5766 } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ 5767 buffer = data; 5768 offset = toOffset($offset, BYTES); 5769 var $len = data.byteLength; 5770 if($length === undefined){ 5771 if($len % BYTES)throw RangeError(WRONG_LENGTH); 5772 byteLength = $len - offset; 5773 if(byteLength < 0)throw RangeError(WRONG_LENGTH); 5774 } else { 5775 byteLength = toLength($length) * BYTES; 5776 if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH); 5777 } 5778 length = byteLength / BYTES; 5779 } else if(TYPED_ARRAY in data){ 5780 return fromList(TypedArray, data); 5781 } else { 5782 return $from.call(TypedArray, data); 5783 } 5784 hide(that, '_d', { 5785 b: buffer, 5786 o: offset, 5787 l: byteLength, 5788 e: length, 5789 v: new $DataView(buffer) 5790 }); 5791 while(index < length)addElement(that, index++); 5792 }); 5793 TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); 5794 hide(TypedArrayPrototype, 'constructor', TypedArray); 5795 } else if(!$iterDetect(function(iter){ 5796 // V8 works with iterators, but fails in many other cases 5797 // https://code.google.com/p/v8/issues/detail?id=4552 5798 new TypedArray(null); // eslint-disable-line no-new 5799 new TypedArray(iter); // eslint-disable-line no-new 5800 }, true)){ 5801 TypedArray = wrapper(function(that, data, $offset, $length){ 5802 anInstance(that, TypedArray, NAME); 5803 var klass; 5804 // `ws` module bug, temporarily remove validation length for Uint8Array 5805 // https://github.com/websockets/ws/pull/645 5806 if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8)); 5807 if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ 5808 return $length !== undefined 5809 ? new Base(data, toOffset($offset, BYTES), $length) 5810 : $offset !== undefined 5811 ? new Base(data, toOffset($offset, BYTES)) 5812 : new Base(data); 5813 } 5814 if(TYPED_ARRAY in data)return fromList(TypedArray, data); 5815 return $from.call(TypedArray, data); 5816 });
vendor: 4,864 bytes, lines 5817-5970
5817 arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){ 5818 if(!(key in TypedArray))hide(TypedArray, key, Base[key]); 5819 }); 5820 TypedArray[PROTOTYPE] = TypedArrayPrototype; 5821 if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray; 5822 } 5823 var $nativeIterator = TypedArrayPrototype[ITERATOR] 5824 , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined) 5825 , $iterator = $iterators.values; 5826 hide(TypedArray, TYPED_CONSTRUCTOR, true); 5827 hide(TypedArrayPrototype, TYPED_ARRAY, NAME); 5828 hide(TypedArrayPrototype, VIEW, true); 5829 hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); 5830 5831 if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){ 5832 dP(TypedArrayPrototype, TAG, { 5833 get: function(){ return NAME; } 5834 }); 5835 } 5836 5837 O[NAME] = TypedArray; 5838 5839 $export($export.G + $export.W + $export.F * (TypedArray != Base), O); 5840 5841 $export($export.S, NAME, { 5842 BYTES_PER_ELEMENT: BYTES, 5843 from: $from, 5844 of: $of 5845 }); 5846 5847 if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); 5848 5849 $export($export.P, NAME, proto); 5850 5851 setSpecies(NAME); 5852 5853 $export($export.P + $export.F * FORCED_SET, NAME, {set: $set}); 5854 5855 $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); 5856 5857 $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString}); 5858 5859 $export($export.P + $export.F * fails(function(){ 5860 new TypedArray(1).slice(); 5861 }), NAME, {slice: $slice}); 5862 5863 $export($export.P + $export.F * (fails(function(){ 5864 return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString() 5865 }) || !fails(function(){ 5866 TypedArrayPrototype.toLocaleString.call([1, 2]); 5867 })), NAME, {toLocaleString: $toLocaleString}); 5868 5869 Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; 5870 if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator); 5871 }; 5872 } else module.exports = function(){ /* empty */ }; 5873 5874/***/ }), 5875/* 224 */ 5876/***/ (function(module, exports, __webpack_require__) { 5877 5878 __webpack_require__(223)('Uint8', 1, function(init){ 5879 return function Uint8Array(data, byteOffset, length){ 5880 return init(this, data, byteOffset, length); 5881 }; 5882 }); 5883 5884/***/ }), 5885/* 225 */ 5886/***/ (function(module, exports, __webpack_require__) { 5887 5888 __webpack_require__(223)('Uint8', 1, function(init){ 5889 return function Uint8ClampedArray(data, byteOffset, length){ 5890 return init(this, data, byteOffset, length); 5891 }; 5892 }, true); 5893 5894/***/ }), 5895/* 226 */ 5896/***/ (function(module, exports, __webpack_require__) { 5897 5898 __webpack_require__(223)('Int16', 2, function(init){ 5899 return function Int16Array(data, byteOffset, length){ 5900 return init(this, data, byteOffset, length); 5901 }; 5902 }); 5903 5904/***/ }), 5905/* 227 */ 5906/***/ (function(module, exports, __webpack_require__) { 5907 5908 __webpack_require__(223)('Uint16', 2, function(init){ 5909 return function Uint16Array(data, byteOffset, length){ 5910 return init(this, data, byteOffset, length); 5911 }; 5912 }); 5913 5914/***/ }), 5915/* 228 */ 5916/***/ (function(module, exports, __webpack_require__) { 5917 5918 __webpack_require__(223)('Int32', 4, function(init){ 5919 return function Int32Array(data, byteOffset, length){ 5920 return init(this, data, byteOffset, length); 5921 }; 5922 }); 5923 5924/***/ }), 5925/* 229 */ 5926/***/ (function(module, exports, __webpack_require__) { 5927 5928 __webpack_require__(223)('Uint32', 4, function(init){ 5929 return function Uint32Array(data, byteOffset, length){ 5930 return init(this, data, byteOffset, length); 5931 }; 5932 }); 5933 5934/***/ }), 5935/* 230 */ 5936/***/ (function(module, exports, __webpack_require__) { 5937 5938 __webpack_require__(223)('Float32', 4, function(init){ 5939 return function Float32Array(data, byteOffset, length){ 5940 return init(this, data, byteOffset, length); 5941 }; 5942 }); 5943 5944/***/ }), 5945/* 231 */ 5946/***/ (function(module, exports, __webpack_require__) { 5947 5948 __webpack_require__(223)('Float64', 8, function(init){ 5949 return function Float64Array(data, byteOffset, length){ 5950 return init(this, data, byteOffset, length); 5951 }; 5952 }); 5953 5954/***/ }), 5955/* 232 */ 5956/***/ (function(module, exports, __webpack_require__) { 5957 5958 // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) 5959 var $export = __webpack_require__(8) 5960 , aFunction = __webpack_require__(21) 5961 , anObject = __webpack_require__(12) 5962 , rApply = (__webpack_require__(4).Reflect || {}).apply 5963 , fApply = Function.apply; 5964 // MS Edge argumentsList argument is optional 5965 $export($export.S + $export.F * !__webpack_require__(7)(function(){ 5966 rApply(function(){}); 5967 }), 'Reflect', { 5968 apply: function apply(target, thisArgument, argumentsList){ 5969 var T = aFunction(target) 5970 , L = anObject(argumentsList);
vendor: 8,052 bytes, lines 5971-6226
5971 return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); 5972 } 5973 }); 5974 5975/***/ }), 5976/* 233 */ 5977/***/ (function(module, exports, __webpack_require__) { 5978 5979 // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) 5980 var $export = __webpack_require__(8) 5981 , create = __webpack_require__(46) 5982 , aFunction = __webpack_require__(21) 5983 , anObject = __webpack_require__(12) 5984 , isObject = __webpack_require__(13) 5985 , fails = __webpack_require__(7) 5986 , bind = __webpack_require__(77) 5987 , rConstruct = (__webpack_require__(4).Reflect || {}).construct; 5988 5989 // MS Edge supports only 2 arguments and argumentsList argument is optional 5990 // FF Nightly sets third argument as `new.target`, but does not create `this` from it 5991 var NEW_TARGET_BUG = fails(function(){ 5992 function F(){} 5993 return !(rConstruct(function(){}, [], F) instanceof F); 5994 }); 5995 var ARGS_BUG = !fails(function(){ 5996 rConstruct(function(){}); 5997 }); 5998 5999 $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { 6000 construct: function construct(Target, args /*, newTarget*/){ 6001 aFunction(Target); 6002 anObject(args); 6003 var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); 6004 if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget); 6005 if(Target == newTarget){ 6006 // w/o altered newTarget, optimization for 0-4 arguments 6007 switch(args.length){ 6008 case 0: return new Target; 6009 case 1: return new Target(args[0]); 6010 case 2: return new Target(args[0], args[1]); 6011 case 3: return new Target(args[0], args[1], args[2]); 6012 case 4: return new Target(args[0], args[1], args[2], args[3]); 6013 } 6014 // w/o altered newTarget, lot of arguments case 6015 var $args = [null]; 6016 $args.push.apply($args, args); 6017 return new (bind.apply(Target, $args)); 6018 } 6019 // with altered newTarget, not support built-in constructors 6020 var proto = newTarget.prototype 6021 , instance = create(isObject(proto) ? proto : Object.prototype) 6022 , result = Function.apply.call(Target, instance, args); 6023 return isObject(result) ? result : instance; 6024 } 6025 }); 6026 6027/***/ }), 6028/* 234 */ 6029/***/ (function(module, exports, __webpack_require__) { 6030 6031 // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) 6032 var dP = __webpack_require__(11) 6033 , $export = __webpack_require__(8) 6034 , anObject = __webpack_require__(12) 6035 , toPrimitive = __webpack_require__(16); 6036 6037 // MS Edge has broken Reflect.defineProperty - throwing instead of returning false 6038 $export($export.S + $export.F * __webpack_require__(7)(function(){ 6039 Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2}); 6040 }), 'Reflect', { 6041 defineProperty: function defineProperty(target, propertyKey, attributes){ 6042 anObject(target); 6043 propertyKey = toPrimitive(propertyKey, true); 6044 anObject(attributes); 6045 try { 6046 dP.f(target, propertyKey, attributes); 6047 return true; 6048 } catch(e){ 6049 return false; 6050 } 6051 } 6052 }); 6053 6054/***/ }), 6055/* 235 */ 6056/***/ (function(module, exports, __webpack_require__) { 6057 6058 // 26.1.4 Reflect.deleteProperty(target, propertyKey) 6059 var $export = __webpack_require__(8) 6060 , gOPD = __webpack_require__(51).f 6061 , anObject = __webpack_require__(12); 6062 6063 $export($export.S, 'Reflect', { 6064 deleteProperty: function deleteProperty(target, propertyKey){ 6065 var desc = gOPD(anObject(target), propertyKey); 6066 return desc && !desc.configurable ? false : delete target[propertyKey]; 6067 } 6068 }); 6069 6070/***/ }), 6071/* 236 */ 6072/***/ (function(module, exports, __webpack_require__) { 6073 6074 'use strict'; 6075 // 26.1.5 Reflect.enumerate(target) 6076 var $export = __webpack_require__(8) 6077 , anObject = __webpack_require__(12); 6078 var Enumerate = function(iterated){ 6079 this._t = anObject(iterated); // target 6080 this._i = 0; // next index 6081 var keys = this._k = [] // keys 6082 , key; 6083 for(key in iterated)keys.push(key); 6084 }; 6085 __webpack_require__(130)(Enumerate, 'Object', function(){ 6086 var that = this 6087 , keys = that._k 6088 , key; 6089 do { 6090 if(that._i >= keys.length)return {value: undefined, done: true}; 6091 } while(!((key = keys[that._i++]) in that._t)); 6092 return {value: key, done: false}; 6093 }); 6094 6095 $export($export.S, 'Reflect', { 6096 enumerate: function enumerate(target){ 6097 return new Enumerate(target); 6098 } 6099 }); 6100 6101/***/ }), 6102/* 237 */ 6103/***/ (function(module, exports, __webpack_require__) { 6104 6105 // 26.1.6 Reflect.get(target, propertyKey [, receiver]) 6106 var gOPD = __webpack_require__(51) 6107 , getPrototypeOf = __webpack_require__(59) 6108 , has = __webpack_require__(5) 6109 , $export = __webpack_require__(8) 6110 , isObject = __webpack_require__(13) 6111 , anObject = __webpack_require__(12); 6112 6113 function get(target, propertyKey/*, receiver*/){ 6114 var receiver = arguments.length < 3 ? target : arguments[2] 6115 , desc, proto; 6116 if(anObject(target) === receiver)return target[propertyKey]; 6117 if(desc = gOPD.f(target, propertyKey))return has(desc, 'value') 6118 ? desc.value 6119 : desc.get !== undefined 6120 ? desc.get.call(receiver) 6121 : undefined; 6122 if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver); 6123 } 6124 6125 $export($export.S, 'Reflect', {get: get}); 6126 6127/***/ }), 6128/* 238 */ 6129/***/ (function(module, exports, __webpack_require__) { 6130 6131 // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) 6132 var gOPD = __webpack_require__(51) 6133 , $export = __webpack_require__(8) 6134 , anObject = __webpack_require__(12); 6135 6136 $export($export.S, 'Reflect', { 6137 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){ 6138 return gOPD.f(anObject(target), propertyKey); 6139 } 6140 }); 6141 6142/***/ }), 6143/* 239 */ 6144/***/ (function(module, exports, __webpack_require__) { 6145 6146 // 26.1.8 Reflect.getPrototypeOf(target) 6147 var $export = __webpack_require__(8) 6148 , getProto = __webpack_require__(59) 6149 , anObject = __webpack_require__(12); 6150 6151 $export($export.S, 'Reflect', { 6152 getPrototypeOf: function getPrototypeOf(target){ 6153 return getProto(anObject(target)); 6154 } 6155 }); 6156 6157/***/ }), 6158/* 240 */ 6159/***/ (function(module, exports, __webpack_require__) { 6160 6161 // 26.1.9 Reflect.has(target, propertyKey) 6162 var $export = __webpack_require__(8); 6163 6164 $export($export.S, 'Reflect', { 6165 has: function has(target, propertyKey){ 6166 return propertyKey in target; 6167 } 6168 }); 6169 6170/***/ }), 6171/* 241 */ 6172/***/ (function(module, exports, __webpack_require__) { 6173 6174 // 26.1.10 Reflect.isExtensible(target) 6175 var $export = __webpack_require__(8) 6176 , anObject = __webpack_require__(12) 6177 , $isExtensible = Object.isExtensible; 6178 6179 $export($export.S, 'Reflect', { 6180 isExtensible: function isExtensible(target){ 6181 anObject(target); 6182 return $isExtensible ? $isExtensible(target) : true; 6183 } 6184 }); 6185 6186/***/ }), 6187/* 242 */ 6188/***/ (function(module, exports, __webpack_require__) { 6189 6190 // 26.1.11 Reflect.ownKeys(target) 6191 var $export = __webpack_require__(8); 6192 6193 $export($export.S, 'Reflect', {ownKeys: __webpack_require__(243)}); 6194 6195/***/ }), 6196/* 243 */ 6197/***/ (function(module, exports, __webpack_require__) { 6198 6199 // all object keys, includes non-enumerable and symbols 6200 var gOPN = __webpack_require__(50) 6201 , gOPS = __webpack_require__(43) 6202 , anObject = __webpack_require__(12) 6203 , Reflect = __webpack_require__(4).Reflect; 6204 module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ 6205 var keys = gOPN.f(anObject(it)) 6206 , getSymbols = gOPS.f; 6207 return getSymbols ? keys.concat(getSymbols(it)) : keys; 6208 }; 6209 6210/***/ }), 6211/* 244 */ 6212/***/ (function(module, exports, __webpack_require__) { 6213 6214 // 26.1.12 Reflect.preventExtensions(target) 6215 var $export = __webpack_require__(8) 6216 , anObject = __webpack_require__(12) 6217 , $preventExtensions = Object.preventExtensions; 6218 6219 $export($export.S, 'Reflect', { 6220 preventExtensions: function preventExtensions(target){ 6221 anObject(target); 6222 try { 6223 if($preventExtensions)$preventExtensions(target); 6224 return true; 6225 } catch(e){ 6226 return false;
6227 } 6228 } 6229 }); 6230 6231/***/ }), 6232/* 245 */ 6233/***/ (function(module, exports, __webpack_require__) { 6234 6235 // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) 6236 var dP = __webpack_require__(11) 6237 , gOPD = __webpack_require__(51) 6238 , getPrototypeOf = __webpack_require__(59) 6239 , has = __webpack_require__(5) 6240 , $export = __webpack_require__(8) 6241 , createDesc = __webpack_require__(17) 6242 , anObject = __webpack_require__(12) 6243 , isObject = __webpack_require__(13); 6244 6245 function set(target, propertyKey, V/*, receiver*/){ 6246 var receiver = arguments.length < 4 ? target : arguments[3] 6247 , ownDesc = gOPD.f(anObject(target), propertyKey) 6248 , existingDescriptor, proto; 6249 if(!ownDesc){ 6250 if(isObject(proto = getPrototypeOf(target))){ 6251 return set(proto, propertyKey, V, receiver); 6252 } 6253 ownDesc = createDesc(0); 6254 } 6255 if(has(ownDesc, 'value')){ 6256 if(ownDesc.writable === false || !isObject(receiver))return false; 6257 existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); 6258 existingDescriptor.value = V; 6259 dP.f(receiver, propertyKey, existingDescriptor); 6260 return true; 6261 } 6262 return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); 6263 } 6264 6265 $export($export.S, 'Reflect', {set: set}); 6266 6267/***/ }), 6268/* 246 */ 6269/***/ (function(module, exports, __webpack_require__) { 6270 6271 // 26.1.14 Reflect.setPrototypeOf(target, proto) 6272 var $export = __webpack_require__(8) 6273 , setProto = __webpack_require__(73); 6274 6275 if(setProto)$export($export.S, 'Reflect', { 6276 setPrototypeOf: function setPrototypeOf(target, proto){ 6277 setProto.check(target, proto); 6278 try { 6279 setProto.set(target, proto); 6280 return true; 6281 } catch(e){ 6282 return false; 6283 } 6284 } 6285 }); 6286 6287/***/ }), 6288/* 247 */ 6289/***/ (function(module, exports, __webpack_require__) { 6290 6291 'use strict'; 6292 // https://github.com/tc39/Array.prototype.includes 6293 var $export = __webpack_require__(8) 6294 , $includes = __webpack_require__(36)(true); 6295 6296 $export($export.P, 'Array', { 6297 includes: function includes(el /*, fromIndex = 0 */){ 6298 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); 6299 } 6300 }); 6301 6302 __webpack_require__(186)('includes'); 6303 6304/***/ }), 6305/* 248 */ 6306/***/ (function(module, exports, __webpack_require__) { 6307 6308 'use strict'; 6309 // https://github.com/mathiasbynens/String.prototype.at 6310 var $export = __webpack_require__(8) 6311 , $at = __webpack_require__(127)(true); 6312 6313 $export($export.P, 'String', { 6314 at: function at(pos){ 6315 return $at(this, pos); 6316 } 6317 }); 6318 6319/***/ }), 6320/* 249 */ 6321/***/ (function(module, exports, __webpack_require__) { 6322 6323 'use strict'; 6324 // https://github.com/tc39/proposal-string-pad-start-end 6325 var $export = __webpack_require__(8) 6326 , $pad = __webpack_require__(250); 6327 6328 $export($export.P, 'String', { 6329 padStart: function padStart(maxLength /*, fillString = ' ' */){ 6330 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); 6331 } 6332 }); 6333 6334/***/ }), 6335/* 250 */ 6336/***/ (function(module, exports, __webpack_require__) { 6337 6338 // https://github.com/tc39/proposal-string-pad-start-end 6339 var toLength = __webpack_require__(37) 6340 , repeat = __webpack_require__(91) 6341 , defined = __webpack_require__(35); 6342 6343 module.exports = function(that, maxLength, fillString, left){ 6344 var S = String(defined(that)) 6345 , stringLength = S.length 6346 , fillStr = fillString === undefined ? ' ' : String(fillString) 6347 , intMaxLength = toLength(maxLength); 6348 if(intMaxLength <= stringLength || fillStr == '')return S; 6349 var fillLen = intMaxLength - stringLength 6350 , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); 6351 if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen); 6352 return left ? stringFiller + S : S + stringFiller; 6353 }; 6354 6355 6356/***/ }), 6357/* 251 */ 6358/***/ (function(module, exports, __webpack_require__) { 6359 6360 'use strict'; 6361 // https://github.com/tc39/proposal-string-pad-start-end 6362 var $export = __webpack_require__(8) 6363 , $pad = __webpack_require__(250); 6364 6365 $export($export.P, 'String', { 6366 padEnd: function padEnd(maxLength /*, fillString = ' ' */){ 6367 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); 6368 } 6369 }); 6370 6371/***/ }), 6372/* 252 */ 6373/***/ (function(module, exports, __webpack_require__) { 6374 6375 'use strict'; 6376 // https://github.com/sebmarkbage/ecmascript-string-left-right-trim 6377 __webpack_require__(83)('trimLeft', function($trim){ 6378 return function trimLeft(){ 6379 return $trim(this, 1); 6380 }; 6381 }, 'trimStart'); 6382 6383/***/ }), 6384/* 253 */ 6385/***/ (function(module, exports, __webpack_require__) { 6386 6387 'use strict'; 6388 // https://github.com/sebmarkbage/ecmascript-string-left-right-trim 6389 __webpack_require__(83)('trimRight', function($trim){ 6390 return function trimRight(){ 6391 return $trim(this, 2); 6392 }; 6393 }, 'trimEnd'); 6394 6395/***/ }), 6396/* 254 */ 6397/***/ (function(module, exports, __webpack_require__) { 6398 6399 'use strict'; 6400 // https://tc39.github.io/String.prototype.matchAll/ 6401 var $export = __webpack_require__(8) 6402 , defined = __webpack_require__(35) 6403 , toLength = __webpack_require__(37) 6404 , isRegExp = __webpack_require__(134) 6405 , getFlags = __webpack_require__(196) 6406 , RegExpProto = RegExp.prototype; 6407 6408 var $RegExpStringIterator = function(regexp, string){ 6409 this._r = regexp; 6410 this._s = string; 6411 }; 6412 6413 __webpack_require__(130)($RegExpStringIterator, 'RegExp String', function next(){ 6414 var match = this._r.exec(this._s); 6415 return {value: match, done: match === null}; 6416 }); 6417 6418 $export($export.P, 'String', { 6419 matchAll: function matchAll(regexp){ 6420 defined(this); 6421 if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!'); 6422 var S = String(this) 6423 , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp) 6424 , rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); 6425 rx.lastIndex = toLength(regexp.lastIndex); 6426 return new $RegExpStringIterator(rx, S); 6427 } 6428 }); 6429 6430/***/ }), 6431/* 255 */ 6432/***/ (function(module, exports, __webpack_require__) { 6433 6434 __webpack_require__(27)('asyncIterator'); 6435 6436/***/ }), 6437/* 256 */ 6438/***/ (function(module, exports, __webpack_require__) { 6439 6440 __webpack_require__(27)('observable'); 6441 6442/***/ }), 6443/* 257 */ 6444/***/ (function(module, exports, __webpack_require__) { 6445 6446 // https://github.com/tc39/proposal-object-getownpropertydescriptors 6447 var $export = __webpack_require__(8) 6448 , ownKeys = __webpack_require__(243) 6449 , toIObject = __webpack_require__(32) 6450 , gOPD = __webpack_require__(51) 6451 , createProperty = __webpack_require__(163); 6452 6453 $export($export.S, 'Object', { 6454 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ 6455 var O = toIObject(object)
vendor: 9,267 bytes, lines 6456-6779
6456 , getDesc = gOPD.f 6457 , keys = ownKeys(O) 6458 , result = {} 6459 , i = 0 6460 , key; 6461 while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); 6462 return result; 6463 } 6464 }); 6465 6466/***/ }), 6467/* 258 */ 6468/***/ (function(module, exports, __webpack_require__) { 6469 6470 // https://github.com/tc39/proposal-object-values-entries 6471 var $export = __webpack_require__(8) 6472 , $values = __webpack_require__(259)(false); 6473 6474 $export($export.S, 'Object', { 6475 values: function values(it){ 6476 return $values(it); 6477 } 6478 }); 6479 6480/***/ }), 6481/* 259 */ 6482/***/ (function(module, exports, __webpack_require__) { 6483 6484 var getKeys = __webpack_require__(30) 6485 , toIObject = __webpack_require__(32) 6486 , isEnum = __webpack_require__(44).f; 6487 module.exports = function(isEntries){ 6488 return function(it){ 6489 var O = toIObject(it) 6490 , keys = getKeys(O) 6491 , length = keys.length 6492 , i = 0 6493 , result = [] 6494 , key; 6495 while(length > i)if(isEnum.call(O, key = keys[i++])){ 6496 result.push(isEntries ? [key, O[key]] : O[key]); 6497 } return result; 6498 }; 6499 }; 6500 6501/***/ }), 6502/* 260 */ 6503/***/ (function(module, exports, __webpack_require__) { 6504 6505 // https://github.com/tc39/proposal-object-values-entries 6506 var $export = __webpack_require__(8) 6507 , $entries = __webpack_require__(259)(true); 6508 6509 $export($export.S, 'Object', { 6510 entries: function entries(it){ 6511 return $entries(it); 6512 } 6513 }); 6514 6515/***/ }), 6516/* 261 */ 6517/***/ (function(module, exports, __webpack_require__) { 6518 6519 'use strict'; 6520 var $export = __webpack_require__(8) 6521 , toObject = __webpack_require__(58) 6522 , aFunction = __webpack_require__(21) 6523 , $defineProperty = __webpack_require__(11); 6524 6525 // B.2.2.2 Object.prototype.__defineGetter__(P, getter) 6526 __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { 6527 __defineGetter__: function __defineGetter__(P, getter){ 6528 $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true}); 6529 } 6530 }); 6531 6532/***/ }), 6533/* 262 */ 6534/***/ (function(module, exports, __webpack_require__) { 6535 6536 // Forced replacement prototype accessors methods 6537 module.exports = __webpack_require__(28)|| !__webpack_require__(7)(function(){ 6538 var K = Math.random(); 6539 // In FF throws only define methods 6540 __defineSetter__.call(null, K, function(){ /* empty */}); 6541 delete __webpack_require__(4)[K]; 6542 }); 6543 6544/***/ }), 6545/* 263 */ 6546/***/ (function(module, exports, __webpack_require__) { 6547 6548 'use strict'; 6549 var $export = __webpack_require__(8) 6550 , toObject = __webpack_require__(58) 6551 , aFunction = __webpack_require__(21) 6552 , $defineProperty = __webpack_require__(11); 6553 6554 // B.2.2.3 Object.prototype.__defineSetter__(P, setter) 6555 __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { 6556 __defineSetter__: function __defineSetter__(P, setter){ 6557 $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true}); 6558 } 6559 }); 6560 6561/***/ }), 6562/* 264 */ 6563/***/ (function(module, exports, __webpack_require__) { 6564 6565 'use strict'; 6566 var $export = __webpack_require__(8) 6567 , toObject = __webpack_require__(58) 6568 , toPrimitive = __webpack_require__(16) 6569 , getPrototypeOf = __webpack_require__(59) 6570 , getOwnPropertyDescriptor = __webpack_require__(51).f; 6571 6572 // B.2.2.4 Object.prototype.__lookupGetter__(P) 6573 __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { 6574 __lookupGetter__: function __lookupGetter__(P){ 6575 var O = toObject(this) 6576 , K = toPrimitive(P, true) 6577 , D; 6578 do { 6579 if(D = getOwnPropertyDescriptor(O, K))return D.get; 6580 } while(O = getPrototypeOf(O)); 6581 } 6582 }); 6583 6584/***/ }), 6585/* 265 */ 6586/***/ (function(module, exports, __webpack_require__) { 6587 6588 'use strict'; 6589 var $export = __webpack_require__(8) 6590 , toObject = __webpack_require__(58) 6591 , toPrimitive = __webpack_require__(16) 6592 , getPrototypeOf = __webpack_require__(59) 6593 , getOwnPropertyDescriptor = __webpack_require__(51).f; 6594 6595 // B.2.2.5 Object.prototype.__lookupSetter__(P) 6596 __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { 6597 __lookupSetter__: function __lookupSetter__(P){ 6598 var O = toObject(this) 6599 , K = toPrimitive(P, true) 6600 , D; 6601 do { 6602 if(D = getOwnPropertyDescriptor(O, K))return D.set; 6603 } while(O = getPrototypeOf(O)); 6604 } 6605 }); 6606 6607/***/ }), 6608/* 266 */ 6609/***/ (function(module, exports, __webpack_require__) { 6610 6611 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 6612 var $export = __webpack_require__(8); 6613 6614 $export($export.P + $export.R, 'Map', {toJSON: __webpack_require__(267)('Map')}); 6615 6616/***/ }), 6617/* 267 */ 6618/***/ (function(module, exports, __webpack_require__) { 6619 6620 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 6621 var classof = __webpack_require__(75) 6622 , from = __webpack_require__(268); 6623 module.exports = function(NAME){ 6624 return function toJSON(){ 6625 if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); 6626 return from(this); 6627 }; 6628 }; 6629 6630/***/ }), 6631/* 268 */ 6632/***/ (function(module, exports, __webpack_require__) { 6633 6634 var forOf = __webpack_require__(206); 6635 6636 module.exports = function(iter, ITERATOR){ 6637 var result = []; 6638 forOf(iter, false, result.push, result, ITERATOR); 6639 return result; 6640 }; 6641 6642 6643/***/ }), 6644/* 269 */ 6645/***/ (function(module, exports, __webpack_require__) { 6646 6647 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 6648 var $export = __webpack_require__(8); 6649 6650 $export($export.P + $export.R, 'Set', {toJSON: __webpack_require__(267)('Set')}); 6651 6652/***/ }), 6653/* 270 */ 6654/***/ (function(module, exports, __webpack_require__) { 6655 6656 // https://github.com/ljharb/proposal-global 6657 var $export = __webpack_require__(8); 6658 6659 $export($export.S, 'System', {global: __webpack_require__(4)}); 6660 6661/***/ }), 6662/* 271 */ 6663/***/ (function(module, exports, __webpack_require__) { 6664 6665 // https://github.com/ljharb/proposal-is-error 6666 var $export = __webpack_require__(8) 6667 , cof = __webpack_require__(34); 6668 6669 $export($export.S, 'Error', { 6670 isError: function isError(it){ 6671 return cof(it) === 'Error'; 6672 } 6673 }); 6674 6675/***/ }), 6676/* 272 */ 6677/***/ (function(module, exports, __webpack_require__) { 6678 6679 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 6680 var $export = __webpack_require__(8); 6681 6682 $export($export.S, 'Math', { 6683 iaddh: function iaddh(x0, x1, y0, y1){ 6684 var $x0 = x0 >>> 0 6685 , $x1 = x1 >>> 0 6686 , $y0 = y0 >>> 0; 6687 return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; 6688 } 6689 }); 6690 6691/***/ }), 6692/* 273 */ 6693/***/ (function(module, exports, __webpack_require__) { 6694 6695 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 6696 var $export = __webpack_require__(8); 6697 6698 $export($export.S, 'Math', { 6699 isubh: function isubh(x0, x1, y0, y1){ 6700 var $x0 = x0 >>> 0 6701 , $x1 = x1 >>> 0 6702 , $y0 = y0 >>> 0; 6703 return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; 6704 } 6705 }); 6706 6707/***/ }), 6708/* 274 */ 6709/***/ (function(module, exports, __webpack_require__) { 6710 6711 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 6712 var $export = __webpack_require__(8); 6713 6714 $export($export.S, 'Math', { 6715 imulh: function imulh(u, v){ 6716 var UINT16 = 0xffff 6717 , $u = +u 6718 , $v = +v 6719 , u0 = $u & UINT16 6720 , v0 = $v & UINT16 6721 , u1 = $u >> 16 6722 , v1 = $v >> 16 6723 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); 6724 return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); 6725 } 6726 }); 6727 6728/***/ }), 6729/* 275 */ 6730/***/ (function(module, exports, __webpack_require__) { 6731 6732 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 6733 var $export = __webpack_require__(8); 6734 6735 $export($export.S, 'Math', { 6736 umulh: function umulh(u, v){ 6737 var UINT16 = 0xffff 6738 , $u = +u 6739 , $v = +v 6740 , u0 = $u & UINT16 6741 , v0 = $v & UINT16 6742 , u1 = $u >>> 16 6743 , v1 = $v >>> 16 6744 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); 6745 return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); 6746 } 6747 }); 6748 6749/***/ }), 6750/* 276 */ 6751/***/ (function(module, exports, __webpack_require__) { 6752 6753 var metadata = __webpack_require__(277) 6754 , anObject = __webpack_require__(12) 6755 , toMetaKey = metadata.key 6756 , ordinaryDefineOwnMetadata = metadata.set; 6757 6758 metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){ 6759 ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); 6760 }}); 6761 6762/***/ }), 6763/* 277 */ 6764/***/ (function(module, exports, __webpack_require__) { 6765 6766 var Map = __webpack_require__(211) 6767 , $export = __webpack_require__(8) 6768 , shared = __webpack_require__(23)('metadata') 6769 , store = shared.store || (shared.store = new (__webpack_require__(215))); 6770 6771 var getOrCreateMetadataMap = function(target, targetKey, create){ 6772 var targetMetadata = store.get(target); 6773 if(!targetMetadata){ 6774 if(!create)return undefined; 6775 store.set(target, targetMetadata = new Map); 6776 } 6777 var keyMetadata = targetMetadata.get(targetKey); 6778 if(!keyMetadata){ 6779 if(!create)return undefined;
vendor: 9,955 bytes, lines 6780-7070
6780 targetMetadata.set(targetKey, keyMetadata = new Map); 6781 } return keyMetadata; 6782 }; 6783 var ordinaryHasOwnMetadata = function(MetadataKey, O, P){ 6784 var metadataMap = getOrCreateMetadataMap(O, P, false); 6785 return metadataMap === undefined ? false : metadataMap.has(MetadataKey); 6786 }; 6787 var ordinaryGetOwnMetadata = function(MetadataKey, O, P){ 6788 var metadataMap = getOrCreateMetadataMap(O, P, false); 6789 return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); 6790 }; 6791 var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){ 6792 getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); 6793 }; 6794 var ordinaryOwnMetadataKeys = function(target, targetKey){ 6795 var metadataMap = getOrCreateMetadataMap(target, targetKey, false) 6796 , keys = []; 6797 if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); }); 6798 return keys; 6799 }; 6800 var toMetaKey = function(it){ 6801 return it === undefined || typeof it == 'symbol' ? it : String(it); 6802 }; 6803 var exp = function(O){ 6804 $export($export.S, 'Reflect', O); 6805 }; 6806 6807 module.exports = { 6808 store: store, 6809 map: getOrCreateMetadataMap, 6810 has: ordinaryHasOwnMetadata, 6811 get: ordinaryGetOwnMetadata, 6812 set: ordinaryDefineOwnMetadata, 6813 keys: ordinaryOwnMetadataKeys, 6814 key: toMetaKey, 6815 exp: exp 6816 }; 6817 6818/***/ }), 6819/* 278 */ 6820/***/ (function(module, exports, __webpack_require__) { 6821 6822 var metadata = __webpack_require__(277) 6823 , anObject = __webpack_require__(12) 6824 , toMetaKey = metadata.key 6825 , getOrCreateMetadataMap = metadata.map 6826 , store = metadata.store; 6827 6828 metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){ 6829 var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]) 6830 , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); 6831 if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false; 6832 if(metadataMap.size)return true; 6833 var targetMetadata = store.get(target); 6834 targetMetadata['delete'](targetKey); 6835 return !!targetMetadata.size || store['delete'](target); 6836 }}); 6837 6838/***/ }), 6839/* 279 */ 6840/***/ (function(module, exports, __webpack_require__) { 6841 6842 var metadata = __webpack_require__(277) 6843 , anObject = __webpack_require__(12) 6844 , getPrototypeOf = __webpack_require__(59) 6845 , ordinaryHasOwnMetadata = metadata.has 6846 , ordinaryGetOwnMetadata = metadata.get 6847 , toMetaKey = metadata.key; 6848 6849 var ordinaryGetMetadata = function(MetadataKey, O, P){ 6850 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); 6851 if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P); 6852 var parent = getPrototypeOf(O); 6853 return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; 6854 }; 6855 6856 metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){ 6857 return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 6858 }}); 6859 6860/***/ }), 6861/* 280 */ 6862/***/ (function(module, exports, __webpack_require__) { 6863 6864 var Set = __webpack_require__(214) 6865 , from = __webpack_require__(268) 6866 , metadata = __webpack_require__(277) 6867 , anObject = __webpack_require__(12) 6868 , getPrototypeOf = __webpack_require__(59) 6869 , ordinaryOwnMetadataKeys = metadata.keys 6870 , toMetaKey = metadata.key; 6871 6872 var ordinaryMetadataKeys = function(O, P){ 6873 var oKeys = ordinaryOwnMetadataKeys(O, P) 6874 , parent = getPrototypeOf(O); 6875 if(parent === null)return oKeys; 6876 var pKeys = ordinaryMetadataKeys(parent, P); 6877 return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; 6878 }; 6879 6880 metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){ 6881 return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); 6882 }}); 6883 6884/***/ }), 6885/* 281 */ 6886/***/ (function(module, exports, __webpack_require__) { 6887 6888 var metadata = __webpack_require__(277) 6889 , anObject = __webpack_require__(12) 6890 , ordinaryGetOwnMetadata = metadata.get 6891 , toMetaKey = metadata.key; 6892 6893 metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){ 6894 return ordinaryGetOwnMetadata(metadataKey, anObject(target) 6895 , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 6896 }}); 6897 6898/***/ }), 6899/* 282 */ 6900/***/ (function(module, exports, __webpack_require__) { 6901 6902 var metadata = __webpack_require__(277) 6903 , anObject = __webpack_require__(12) 6904 , ordinaryOwnMetadataKeys = metadata.keys 6905 , toMetaKey = metadata.key; 6906 6907 metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){ 6908 return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); 6909 }}); 6910 6911/***/ }), 6912/* 283 */ 6913/***/ (function(module, exports, __webpack_require__) { 6914 6915 var metadata = __webpack_require__(277) 6916 , anObject = __webpack_require__(12) 6917 , getPrototypeOf = __webpack_require__(59) 6918 , ordinaryHasOwnMetadata = metadata.has 6919 , toMetaKey = metadata.key; 6920 6921 var ordinaryHasMetadata = function(MetadataKey, O, P){ 6922 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); 6923 if(hasOwn)return true; 6924 var parent = getPrototypeOf(O); 6925 return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; 6926 }; 6927 6928 metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){ 6929 return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 6930 }}); 6931 6932/***/ }), 6933/* 284 */ 6934/***/ (function(module, exports, __webpack_require__) { 6935 6936 var metadata = __webpack_require__(277) 6937 , anObject = __webpack_require__(12) 6938 , ordinaryHasOwnMetadata = metadata.has 6939 , toMetaKey = metadata.key; 6940 6941 metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){ 6942 return ordinaryHasOwnMetadata(metadataKey, anObject(target) 6943 , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 6944 }}); 6945 6946/***/ }), 6947/* 285 */ 6948/***/ (function(module, exports, __webpack_require__) { 6949 6950 var metadata = __webpack_require__(277) 6951 , anObject = __webpack_require__(12) 6952 , aFunction = __webpack_require__(21) 6953 , toMetaKey = metadata.key 6954 , ordinaryDefineOwnMetadata = metadata.set; 6955 6956 metadata.exp({metadata: function metadata(metadataKey, metadataValue){ 6957 return function decorator(target, targetKey){ 6958 ordinaryDefineOwnMetadata( 6959 metadataKey, metadataValue, 6960 (targetKey !== undefined ? anObject : aFunction)(target), 6961 toMetaKey(targetKey) 6962 ); 6963 }; 6964 }}); 6965 6966/***/ }), 6967/* 286 */ 6968/***/ (function(module, exports, __webpack_require__) { 6969 6970 // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask 6971 var $export = __webpack_require__(8) 6972 , microtask = __webpack_require__(209)() 6973 , process = __webpack_require__(4).process 6974 , isNode = __webpack_require__(34)(process) == 'process'; 6975 6976 $export($export.G, { 6977 asap: function asap(fn){ 6978 var domain = isNode && process.domain; 6979 microtask(domain ? domain.bind(fn) : fn); 6980 } 6981 }); 6982 6983/***/ }), 6984/* 287 */ 6985/***/ (function(module, exports, __webpack_require__) { 6986 6987 'use strict'; 6988 // https://github.com/zenparsing/es-observable 6989 var $export = __webpack_require__(8) 6990 , global = __webpack_require__(4) 6991 , core = __webpack_require__(9) 6992 , microtask = __webpack_require__(209)() 6993 , OBSERVABLE = __webpack_require__(25)('observable') 6994 , aFunction = __webpack_require__(21) 6995 , anObject = __webpack_require__(12) 6996 , anInstance = __webpack_require__(205) 6997 , redefineAll = __webpack_require__(210) 6998 , hide = __webpack_require__(10) 6999 , forOf = __webpack_require__(206) 7000 , RETURN = forOf.RETURN; 7001 7002 var getMethod = function(fn){ 7003 return fn == null ? undefined : aFunction(fn); 7004 }; 7005 7006 var cleanupSubscription = function(subscription){ 7007 var cleanup = subscription._c; 7008 if(cleanup){ 7009 subscription._c = undefined; 7010 cleanup(); 7011 } 7012 }; 7013 7014 var subscriptionClosed = function(subscription){ 7015 return subscription._o === undefined; 7016 }; 7017 7018 var closeSubscription = function(subscription){ 7019 if(!subscriptionClosed(subscription)){ 7020 subscription._o = undefined; 7021 cleanupSubscription(subscription); 7022 } 7023 }; 7024 7025 var Subscription = function(observer, subscriber){ 7026 anObject(observer); 7027 this._c = undefined; 7028 this._o = observer; 7029 observer = new SubscriptionObserver(this); 7030 try { 7031 var cleanup = subscriber(observer) 7032 , subscription = cleanup; 7033 if(cleanup != null){ 7034 if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); }; 7035 else aFunction(cleanup); 7036 this._c = cleanup; 7037 } 7038 } catch(e){ 7039 observer.error(e); 7040 return; 7041 } if(subscriptionClosed(this))cleanupSubscription(this); 7042 }; 7043 7044 Subscription.prototype = redefineAll({}, { 7045 unsubscribe: function unsubscribe(){ closeSubscription(this); } 7046 }); 7047 7048 var SubscriptionObserver = function(subscription){ 7049 this._s = subscription; 7050 }; 7051 7052 SubscriptionObserver.prototype = redefineAll({}, { 7053 next: function next(value){ 7054 var subscription = this._s; 7055 if(!subscriptionClosed(subscription)){ 7056 var observer = subscription._o; 7057 try { 7058 var m = getMethod(observer.next); 7059 if(m)return m.call(observer, value); 7060 } catch(e){ 7061 try { 7062 closeSubscription(subscription); 7063 } finally { 7064 throw e; 7065 } 7066 } 7067 } 7068 }, 7069 error: function error(value){ 7070 var subscription = this._s;
vendor: 4,168 bytes, lines 7071-7216
7071 if(subscriptionClosed(subscription))throw value; 7072 var observer = subscription._o; 7073 subscription._o = undefined; 7074 try { 7075 var m = getMethod(observer.error); 7076 if(!m)throw value; 7077 value = m.call(observer, value); 7078 } catch(e){ 7079 try { 7080 cleanupSubscription(subscription); 7081 } finally { 7082 throw e; 7083 } 7084 } cleanupSubscription(subscription); 7085 return value; 7086 }, 7087 complete: function complete(value){ 7088 var subscription = this._s; 7089 if(!subscriptionClosed(subscription)){ 7090 var observer = subscription._o; 7091 subscription._o = undefined; 7092 try { 7093 var m = getMethod(observer.complete); 7094 value = m ? m.call(observer, value) : undefined; 7095 } catch(e){ 7096 try { 7097 cleanupSubscription(subscription); 7098 } finally { 7099 throw e; 7100 } 7101 } cleanupSubscription(subscription); 7102 return value; 7103 } 7104 } 7105 }); 7106 7107 var $Observable = function Observable(subscriber){ 7108 anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); 7109 }; 7110 7111 redefineAll($Observable.prototype, { 7112 subscribe: function subscribe(observer){ 7113 return new Subscription(observer, this._f); 7114 }, 7115 forEach: function forEach(fn){ 7116 var that = this; 7117 return new (core.Promise || global.Promise)(function(resolve, reject){ 7118 aFunction(fn); 7119 var subscription = that.subscribe({ 7120 next : function(value){ 7121 try { 7122 return fn(value); 7123 } catch(e){ 7124 reject(e); 7125 subscription.unsubscribe(); 7126 } 7127 }, 7128 error: reject, 7129 complete: resolve 7130 }); 7131 }); 7132 } 7133 }); 7134 7135 redefineAll($Observable, { 7136 from: function from(x){ 7137 var C = typeof this === 'function' ? this : $Observable; 7138 var method = getMethod(anObject(x)[OBSERVABLE]); 7139 if(method){ 7140 var observable = anObject(method.call(x)); 7141 return observable.constructor === C ? observable : new C(function(observer){ 7142 return observable.subscribe(observer); 7143 }); 7144 } 7145 return new C(function(observer){ 7146 var done = false; 7147 microtask(function(){ 7148 if(!done){ 7149 try { 7150 if(forOf(x, false, function(it){ 7151 observer.next(it); 7152 if(done)return RETURN; 7153 }) === RETURN)return; 7154 } catch(e){ 7155 if(done)throw e; 7156 observer.error(e); 7157 return; 7158 } observer.complete(); 7159 } 7160 }); 7161 return function(){ done = true; }; 7162 }); 7163 }, 7164 of: function of(){ 7165 for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++]; 7166 return new (typeof this === 'function' ? this : $Observable)(function(observer){ 7167 var done = false; 7168 microtask(function(){ 7169 if(!done){ 7170 for(var i = 0; i < items.length; ++i){ 7171 observer.next(items[i]); 7172 if(done)return; 7173 } observer.complete(); 7174 } 7175 }); 7176 return function(){ done = true; }; 7177 }); 7178 } 7179 }); 7180 7181 hide($Observable.prototype, OBSERVABLE, function(){ return this; }); 7182 7183 $export($export.G, {Observable: $Observable}); 7184 7185 __webpack_require__(192)('Observable'); 7186 7187/***/ }), 7188/* 288 */ 7189/***/ (function(module, exports, __webpack_require__) { 7190 7191 // ie9- setTimeout & setInterval additional parameters fix 7192 var global = __webpack_require__(4) 7193 , $export = __webpack_require__(8) 7194 , invoke = __webpack_require__(78) 7195 , partial = __webpack_require__(289) 7196 , navigator = global.navigator 7197 , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check 7198 var wrap = function(set){ 7199 return MSIE ? function(fn, time /*, ...args */){ 7200 return set(invoke( 7201 partial, 7202 [].slice.call(arguments, 2), 7203 typeof fn == 'function' ? fn : Function(fn) 7204 ), time); 7205 } : set; 7206 }; 7207 $export($export.G + $export.B + $export.F * MSIE, { 7208 setTimeout: wrap(global.setTimeout), 7209 setInterval: wrap(global.setInterval) 7210 }); 7211 7212/***/ }), 7213/* 289 */ 7214/***/ (function(module, exports, __webpack_require__) { 7215 7216 'use strict';
vendor: 2,045 bytes, lines 7217-7279
7217 var path = __webpack_require__(290) 7218 , invoke = __webpack_require__(78) 7219 , aFunction = __webpack_require__(21); 7220 module.exports = function(/* ...pargs */){ 7221 var fn = aFunction(this) 7222 , length = arguments.length 7223 , pargs = Array(length) 7224 , i = 0 7225 , _ = path._ 7226 , holder = false; 7227 while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true; 7228 return function(/* ...args */){ 7229 var that = this 7230 , aLen = arguments.length 7231 , j = 0, k = 0, args; 7232 if(!holder && !aLen)return invoke(fn, pargs, that); 7233 args = pargs.slice(); 7234 if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++]; 7235 while(aLen > k)args.push(arguments[k++]); 7236 return invoke(fn, args, that); 7237 }; 7238 }; 7239 7240/***/ }), 7241/* 290 */ 7242/***/ (function(module, exports, __webpack_require__) { 7243 7244 module.exports = __webpack_require__(4); 7245 7246/***/ }), 7247/* 291 */ 7248/***/ (function(module, exports, __webpack_require__) { 7249 7250 var $export = __webpack_require__(8) 7251 , $task = __webpack_require__(208); 7252 $export($export.G + $export.B, { 7253 setImmediate: $task.set, 7254 clearImmediate: $task.clear 7255 }); 7256 7257/***/ }), 7258/* 292 */ 7259/***/ (function(module, exports, __webpack_require__) { 7260 7261 var $iterators = __webpack_require__(193) 7262 , redefine = __webpack_require__(18) 7263 , global = __webpack_require__(4) 7264 , hide = __webpack_require__(10) 7265 , Iterators = __webpack_require__(129) 7266 , wks = __webpack_require__(25) 7267 , ITERATOR = wks('iterator') 7268 , TO_STRING_TAG = wks('toStringTag') 7269 , ArrayValues = Iterators.Array; 7270 7271 for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ 7272 var NAME = collections[i] 7273 , Collection = global[NAME] 7274 , proto = Collection && Collection.prototype 7275 , key; 7276 if(proto){ 7277 if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues); 7278 if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); 7279 Iterators[NAME] = ArrayValues;
vendor: 8,280 bytes, lines 7280-7481
7280 for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true); 7281 } 7282 } 7283 7284/***/ }), 7285/* 293 */ 7286/***/ (function(module, exports) { 7287 7288 /* WEBPACK VAR INJECTION */(function(global) {/** 7289 * Copyright (c) 2014, Facebook, Inc. 7290 * All rights reserved. 7291 * 7292 * This source code is licensed under the BSD-style license found in the 7293 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An 7294 * additional grant of patent rights can be found in the PATENTS file in 7295 * the same directory. 7296 */ 7297 7298 !(function(global) { 7299 "use strict"; 7300 7301 var Op = Object.prototype; 7302 var hasOwn = Op.hasOwnProperty; 7303 var undefined; // More compressible than void 0. 7304 var $Symbol = typeof Symbol === "function" ? Symbol : {}; 7305 var iteratorSymbol = $Symbol.iterator || "@@iterator"; 7306 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; 7307 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 7308 7309 var inModule = typeof module === "object"; 7310 var runtime = global.regeneratorRuntime; 7311 if (runtime) { 7312 if (inModule) { 7313 // If regeneratorRuntime is defined globally and we're in a module, 7314 // make the exports object identical to regeneratorRuntime. 7315 module.exports = runtime; 7316 } 7317 // Don't bother evaluating the rest of this file if the runtime was 7318 // already defined globally. 7319 return; 7320 } 7321 7322 // Define the runtime globally (as expected by generated code) as either 7323 // module.exports (if we're in a module) or a new, empty object. 7324 runtime = global.regeneratorRuntime = inModule ? module.exports : {}; 7325 7326 function wrap(innerFn, outerFn, self, tryLocsList) { 7327 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. 7328 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; 7329 var generator = Object.create(protoGenerator.prototype); 7330 var context = new Context(tryLocsList || []); 7331 7332 // The ._invoke method unifies the implementations of the .next, 7333 // .throw, and .return methods. 7334 generator._invoke = makeInvokeMethod(innerFn, self, context); 7335 7336 return generator; 7337 } 7338 runtime.wrap = wrap; 7339 7340 // Try/catch helper to minimize deoptimizations. Returns a completion 7341 // record like context.tryEntries[i].completion. This interface could 7342 // have been (and was previously) designed to take a closure to be 7343 // invoked without arguments, but in all the cases we care about we 7344 // already have an existing method we want to call, so there's no need 7345 // to create a new function object. We can even get away with assuming 7346 // the method takes exactly one argument, since that happens to be true 7347 // in every case, so we don't have to touch the arguments object. The 7348 // only additional allocation required is the completion record, which 7349 // has a stable shape and so hopefully should be cheap to allocate. 7350 function tryCatch(fn, obj, arg) { 7351 try { 7352 return { type: "normal", arg: fn.call(obj, arg) }; 7353 } catch (err) { 7354 return { type: "throw", arg: err }; 7355 } 7356 } 7357 7358 var GenStateSuspendedStart = "suspendedStart"; 7359 var GenStateSuspendedYield = "suspendedYield"; 7360 var GenStateExecuting = "executing"; 7361 var GenStateCompleted = "completed"; 7362 7363 // Returning this object from the innerFn has the same effect as 7364 // breaking out of the dispatch switch statement. 7365 var ContinueSentinel = {}; 7366 7367 // Dummy constructor functions that we use as the .constructor and 7368 // .constructor.prototype properties for functions that return Generator 7369 // objects. For full spec compliance, you may wish to configure your 7370 // minifier not to mangle the names of these two functions. 7371 function Generator() {} 7372 function GeneratorFunction() {} 7373 function GeneratorFunctionPrototype() {} 7374 7375 // This is a polyfill for %IteratorPrototype% for environments that 7376 // don't natively support it. 7377 var IteratorPrototype = {}; 7378 IteratorPrototype[iteratorSymbol] = function () { 7379 return this; 7380 }; 7381 7382 var getProto = Object.getPrototypeOf; 7383 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 7384 if (NativeIteratorPrototype && 7385 NativeIteratorPrototype !== Op && 7386 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { 7387 // This environment has a native %IteratorPrototype%; use it instead 7388 // of the polyfill. 7389 IteratorPrototype = NativeIteratorPrototype; 7390 } 7391 7392 var Gp = GeneratorFunctionPrototype.prototype = 7393 Generator.prototype = Object.create(IteratorPrototype); 7394 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; 7395 GeneratorFunctionPrototype.constructor = GeneratorFunction; 7396 GeneratorFunctionPrototype[toStringTagSymbol] = 7397 GeneratorFunction.displayName = "GeneratorFunction"; 7398 7399 // Helper for defining the .next, .throw, and .return methods of the 7400 // Iterator interface in terms of a single ._invoke method. 7401 function defineIteratorMethods(prototype) { 7402 ["next", "throw", "return"].forEach(function(method) { 7403 prototype[method] = function(arg) { 7404 return this._invoke(method, arg); 7405 }; 7406 }); 7407 } 7408 7409 runtime.isGeneratorFunction = function(genFun) { 7410 var ctor = typeof genFun === "function" && genFun.constructor; 7411 return ctor 7412 ? ctor === GeneratorFunction || 7413 // For the native GeneratorFunction constructor, the best we can 7414 // do is to check its .name property. 7415 (ctor.displayName || ctor.name) === "GeneratorFunction" 7416 : false; 7417 }; 7418 7419 runtime.mark = function(genFun) { 7420 if (Object.setPrototypeOf) { 7421 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); 7422 } else { 7423 genFun.__proto__ = GeneratorFunctionPrototype; 7424 if (!(toStringTagSymbol in genFun)) { 7425 genFun[toStringTagSymbol] = "GeneratorFunction"; 7426 } 7427 } 7428 genFun.prototype = Object.create(Gp); 7429 return genFun; 7430 }; 7431 7432 // Within the body of any async function, `await x` is transformed to 7433 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 7434 // `hasOwn.call(value, "__await")` to determine if the yielded value is 7435 // meant to be awaited. 7436 runtime.awrap = function(arg) { 7437 return { __await: arg }; 7438 }; 7439 7440 function AsyncIterator(generator) { 7441 function invoke(method, arg, resolve, reject) { 7442 var record = tryCatch(generator[method], generator, arg); 7443 if (record.type === "throw") { 7444 reject(record.arg); 7445 } else { 7446 var result = record.arg; 7447 var value = result.value; 7448 if (value && 7449 typeof value === "object" && 7450 hasOwn.call(value, "__await")) { 7451 return Promise.resolve(value.__await).then(function(value) { 7452 invoke("next", value, resolve, reject); 7453 }, function(err) { 7454 invoke("throw", err, resolve, reject); 7455 }); 7456 } 7457 7458 return Promise.resolve(value).then(function(unwrapped) { 7459 // When a yielded Promise is resolved, its final value becomes 7460 // the .value of the Promise<{value,done}> result for the 7461 // current iteration. If the Promise is rejected, however, the 7462 // result for this iteration will be rejected with the same 7463 // reason. Note that rejections of yielded Promises are not 7464 // thrown back into the generator function, as is the case 7465 // when an awaited Promise is rejected. This difference in 7466 // behavior between yield and await is important, because it 7467 // allows the consumer to decide what to do with the yielded 7468 // rejection (swallow it and continue, manually .throw it back 7469 // into the generator, abandon iteration, whatever). With 7470 // await, by contrast, there is no opportunity to examine the 7471 // rejection reason outside the generator function, so the 7472 // only option is to throw it from the await expression, and 7473 // let the generator function handle the exception. 7474 result.value = unwrapped; 7475 resolve(result); 7476 }, reject); 7477 } 7478 } 7479 7480 if (typeof global.process === "object" && global.process.domain) { 7481 invoke = global.process.domain.bind(invoke);
vendor: 16,642 bytes, lines 7481-8017
7481 7482 } 7483 7484 var previousPromise; 7485 7486 function enqueue(method, arg) { 7487 function callInvokeWithMethodAndArg() { 7488 return new Promise(function(resolve, reject) { 7489 invoke(method, arg, resolve, reject); 7490 }); 7491 } 7492 7493 return previousPromise = 7494 // If enqueue has been called before, then we want to wait until 7495 // all previous Promises have been resolved before calling invoke, 7496 // so that results are always delivered in the correct order. If 7497 // enqueue has not been called before, then it is important to 7498 // call invoke immediately, without waiting on a callback to fire, 7499 // so that the async generator function has the opportunity to do 7500 // any necessary setup in a predictable way. This predictability 7501 // is why the Promise constructor synchronously invokes its 7502 // executor callback, and why async functions synchronously 7503 // execute code before the first await. Since we implement simple 7504 // async functions in terms of async generators, it is especially 7505 // important to get this right, even though it requires care. 7506 previousPromise ? previousPromise.then( 7507 callInvokeWithMethodAndArg, 7508 // Avoid propagating failures to Promises returned by later 7509 // invocations of the iterator. 7510 callInvokeWithMethodAndArg 7511 ) : callInvokeWithMethodAndArg(); 7512 } 7513 7514 // Define the unified helper method that is used to implement .next, 7515 // .throw, and .return (see defineIteratorMethods). 7516 this._invoke = enqueue; 7517 } 7518 7519 defineIteratorMethods(AsyncIterator.prototype); 7520 AsyncIterator.prototype[asyncIteratorSymbol] = function () { 7521 return this; 7522 }; 7523 runtime.AsyncIterator = AsyncIterator; 7524 7525 // Note that simple async functions are implemented on top of 7526 // AsyncIterator objects; they just return a Promise for the value of 7527 // the final result produced by the iterator. 7528 runtime.async = function(innerFn, outerFn, self, tryLocsList) { 7529 var iter = new AsyncIterator( 7530 wrap(innerFn, outerFn, self, tryLocsList) 7531 ); 7532 7533 return runtime.isGeneratorFunction(outerFn) 7534 ? iter // If outerFn is a generator, return the full iterator. 7535 : iter.next().then(function(result) { 7536 return result.done ? result.value : iter.next(); 7537 }); 7538 }; 7539 7540 function makeInvokeMethod(innerFn, self, context) { 7541 var state = GenStateSuspendedStart; 7542 7543 return function invoke(method, arg) { 7544 if (state === GenStateExecuting) { 7545 throw new Error("Generator is already running"); 7546 } 7547 7548 if (state === GenStateCompleted) { 7549 if (method === "throw") { 7550 throw arg; 7551 } 7552 7553 // Be forgiving, per 25.3.3.3.3 of the spec: 7554 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 7555 return doneResult(); 7556 } 7557 7558 context.method = method; 7559 context.arg = arg; 7560 7561 while (true) { 7562 var delegate = context.delegate; 7563 if (delegate) { 7564 var delegateResult = maybeInvokeDelegate(delegate, context); 7565 if (delegateResult) { 7566 if (delegateResult === ContinueSentinel) continue; 7567 return delegateResult; 7568 } 7569 } 7570 7571 if (context.method === "next") { 7572 // Setting context._sent for legacy support of Babel's 7573 // function.sent implementation. 7574 context.sent = context._sent = context.arg; 7575 7576 } else if (context.method === "throw") { 7577 if (state === GenStateSuspendedStart) { 7578 state = GenStateCompleted; 7579 throw context.arg; 7580 } 7581 7582 context.dispatchException(context.arg); 7583 7584 } else if (context.method === "return") { 7585 context.abrupt("return", context.arg); 7586 } 7587 7588 state = GenStateExecuting; 7589 7590 var record = tryCatch(innerFn, self, context); 7591 if (record.type === "normal") { 7592 // If an exception is thrown from innerFn, we leave state === 7593 // GenStateExecuting and loop back for another invocation. 7594 state = context.done 7595 ? GenStateCompleted 7596 : GenStateSuspendedYield; 7597 7598 if (record.arg === ContinueSentinel) { 7599 continue; 7600 } 7601 7602 return { 7603 value: record.arg, 7604 done: context.done 7605 }; 7606 7607 } else if (record.type === "throw") { 7608 state = GenStateCompleted; 7609 // Dispatch the exception by looping back around to the 7610 // context.dispatchException(context.arg) call above. 7611 context.method = "throw"; 7612 context.arg = record.arg; 7613 } 7614 } 7615 }; 7616 } 7617 7618 // Call delegate.iterator[context.method](context.arg) and handle the 7619 // result, either by returning a { value, done } result from the 7620 // delegate iterator, or by modifying context.method and context.arg, 7621 // setting context.delegate to null, and returning the ContinueSentinel. 7622 function maybeInvokeDelegate(delegate, context) { 7623 var method = delegate.iterator[context.method]; 7624 if (method === undefined) { 7625 // A .throw or .return when the delegate iterator has no .throw 7626 // method always terminates the yield* loop. 7627 context.delegate = null; 7628 7629 if (context.method === "throw") { 7630 if (delegate.iterator.return) { 7631 // If the delegate iterator has a return method, give it a 7632 // chance to clean up. 7633 context.method = "return"; 7634 context.arg = undefined; 7635 maybeInvokeDelegate(delegate, context); 7636 7637 if (context.method === "throw") { 7638 // If maybeInvokeDelegate(context) changed context.method from 7639 // "return" to "throw", let that override the TypeError below. 7640 return ContinueSentinel; 7641 } 7642 } 7643 7644 context.method = "throw"; 7645 context.arg = new TypeError( 7646 "The iterator does not provide a 'throw' method"); 7647 } 7648 7649 return ContinueSentinel; 7650 } 7651 7652 var record = tryCatch(method, delegate.iterator, context.arg); 7653 7654 if (record.type === "throw") { 7655 context.method = "throw"; 7656 context.arg = record.arg; 7657 context.delegate = null; 7658 return ContinueSentinel; 7659 } 7660 7661 var info = record.arg; 7662 7663 if (! info) { 7664 context.method = "throw"; 7665 context.arg = new TypeError("iterator result is not an object"); 7666 context.delegate = null; 7667 return ContinueSentinel; 7668 } 7669 7670 if (info.done) { 7671 // Assign the result of the finished delegate to the temporary 7672 // variable specified by delegate.resultName (see delegateYield). 7673 context[delegate.resultName] = info.value; 7674 7675 // Resume execution at the desired location (see delegateYield). 7676 context.next = delegate.nextLoc; 7677 7678 // If context.method was "throw" but the delegate handled the 7679 // exception, let the outer generator proceed normally. If 7680 // context.method was "next", forget context.arg since it has been 7681 // "consumed" by the delegate iterator. If context.method was 7682 // "return", allow the original .return call to continue in the 7683 // outer generator. 7684 if (context.method !== "return") { 7685 context.method = "next"; 7686 context.arg = undefined; 7687 } 7688 7689 } else { 7690 // Re-yield the result returned by the delegate method. 7691 return info; 7692 } 7693 7694 // The delegate iterator is finished, so forget it and continue with 7695 // the outer generator. 7696 context.delegate = null; 7697 return ContinueSentinel; 7698 } 7699 7700 // Define Generator.prototype.{next,throw,return} in terms of the 7701 // unified ._invoke helper method. 7702 defineIteratorMethods(Gp); 7703 7704 Gp[toStringTagSymbol] = "Generator"; 7705 7706 // A Generator should always return itself as the iterator object when the 7707 // @@iterator function is called on it. Some browsers' implementations of the 7708 // iterator prototype chain incorrectly implement this, causing the Generator 7709 // object to not be returned from this call. This ensures that doesn't happen. 7710 // See https://github.com/facebook/regenerator/issues/274 for more details. 7711 Gp[iteratorSymbol] = function() { 7712 return this; 7713 }; 7714 7715 Gp.toString = function() { 7716 return "[object Generator]"; 7717 }; 7718 7719 function pushTryEntry(locs) { 7720 var entry = { tryLoc: locs[0] }; 7721 7722 if (1 in locs) { 7723 entry.catchLoc = locs[1]; 7724 } 7725 7726 if (2 in locs) { 7727 entry.finallyLoc = locs[2]; 7728 entry.afterLoc = locs[3]; 7729 } 7730 7731 this.tryEntries.push(entry); 7732 } 7733 7734 function resetTryEntry(entry) { 7735 var record = entry.completion || {}; 7736 record.type = "normal"; 7737 delete record.arg; 7738 entry.completion = record; 7739 } 7740 7741 function Context(tryLocsList) { 7742 // The root entry object (effectively a try statement without a catch 7743 // or a finally block) gives us a place to store values thrown from 7744 // locations where there is no enclosing try statement. 7745 this.tryEntries = [{ tryLoc: "root" }]; 7746 tryLocsList.forEach(pushTryEntry, this); 7747 this.reset(true); 7748 } 7749 7750 runtime.keys = function(object) { 7751 var keys = []; 7752 for (var key in object) { 7753 keys.push(key); 7754 } 7755 keys.reverse(); 7756 7757 // Rather than returning an object with a next method, we keep 7758 // things simple and return the next function itself. 7759 return function next() { 7760 while (keys.length) { 7761 var key = keys.pop(); 7762 if (key in object) { 7763 next.value = key; 7764 next.done = false; 7765 return next; 7766 } 7767 } 7768 7769 // To avoid creating an additional object, we just hang the .value 7770 // and .done properties off the next function object itself. This 7771 // also ensures that the minifier will not anonymize the function. 7772 next.done = true; 7773 return next; 7774 }; 7775 }; 7776 7777 function values(iterable) { 7778 if (iterable) { 7779 var iteratorMethod = iterable[iteratorSymbol]; 7780 if (iteratorMethod) { 7781 return iteratorMethod.call(iterable); 7782 } 7783 7784 if (typeof iterable.next === "function") { 7785 return iterable; 7786 } 7787 7788 if (!isNaN(iterable.length)) { 7789 var i = -1, next = function next() { 7790 while (++i < iterable.length) { 7791 if (hasOwn.call(iterable, i)) { 7792 next.value = iterable[i]; 7793 next.done = false; 7794 return next; 7795 } 7796 } 7797 7798 next.value = undefined; 7799 next.done = true; 7800 7801 return next; 7802 }; 7803 7804 return next.next = next; 7805 } 7806 } 7807 7808 // Return an iterator with no values. 7809 return { next: doneResult }; 7810 } 7811 runtime.values = values; 7812 7813 function doneResult() { 7814 return { value: undefined, done: true }; 7815 } 7816 7817 Context.prototype = { 7818 constructor: Context, 7819 7820 reset: function(skipTempReset) { 7821 this.prev = 0; 7822 this.next = 0; 7823 // Resetting context._sent for legacy support of Babel's 7824 // function.sent implementation. 7825 this.sent = this._sent = undefined; 7826 this.done = false; 7827 this.delegate = null; 7828 7829 this.method = "next"; 7830 this.arg = undefined; 7831 7832 this.tryEntries.forEach(resetTryEntry); 7833 7834 if (!skipTempReset) { 7835 for (var name in this) { 7836 // Not sure about the optimal order of these conditions: 7837 if (name.charAt(0) === "t" && 7838 hasOwn.call(this, name) && 7839 !isNaN(+name.slice(1))) { 7840 this[name] = undefined; 7841 } 7842 } 7843 } 7844 }, 7845 7846 stop: function() { 7847 this.done = true; 7848 7849 var rootEntry = this.tryEntries[0]; 7850 var rootRecord = rootEntry.completion; 7851 if (rootRecord.type === "throw") { 7852 throw rootRecord.arg; 7853 } 7854 7855 return this.rval; 7856 }, 7857 7858 dispatchException: function(exception) { 7859 if (this.done) { 7860 throw exception; 7861 } 7862 7863 var context = this; 7864 function handle(loc, caught) { 7865 record.type = "throw"; 7866 record.arg = exception; 7867 context.next = loc; 7868 7869 if (caught) { 7870 // If the dispatched exception was caught by a catch block, 7871 // then let that catch block handle the exception normally. 7872 context.method = "next"; 7873 context.arg = undefined; 7874 } 7875 7876 return !! caught; 7877 } 7878 7879 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7880 var entry = this.tryEntries[i]; 7881 var record = entry.completion; 7882 7883 if (entry.tryLoc === "root") { 7884 // Exception thrown outside of any try block that could handle 7885 // it, so set the completion value of the entire function to 7886 // throw the exception. 7887 return handle("end"); 7888 } 7889 7890 if (entry.tryLoc <= this.prev) { 7891 var hasCatch = hasOwn.call(entry, "catchLoc"); 7892 var hasFinally = hasOwn.call(entry, "finallyLoc"); 7893 7894 if (hasCatch && hasFinally) { 7895 if (this.prev < entry.catchLoc) { 7896 return handle(entry.catchLoc, true); 7897 } else if (this.prev < entry.finallyLoc) { 7898 return handle(entry.finallyLoc); 7899 } 7900 7901 } else if (hasCatch) { 7902 if (this.prev < entry.catchLoc) { 7903 return handle(entry.catchLoc, true); 7904 } 7905 7906 } else if (hasFinally) { 7907 if (this.prev < entry.finallyLoc) { 7908 return handle(entry.finallyLoc); 7909 } 7910 7911 } else { 7912 throw new Error("try statement without catch or finally"); 7913 } 7914 } 7915 } 7916 }, 7917 7918 abrupt: function(type, arg) { 7919 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7920 var entry = this.tryEntries[i]; 7921 if (entry.tryLoc <= this.prev && 7922 hasOwn.call(entry, "finallyLoc") && 7923 this.prev < entry.finallyLoc) { 7924 var finallyEntry = entry; 7925 break; 7926 } 7927 } 7928 7929 if (finallyEntry && 7930 (type === "break" || 7931 type === "continue") && 7932 finallyEntry.tryLoc <= arg && 7933 arg <= finallyEntry.finallyLoc) { 7934 // Ignore the finally entry if control is not jumping to a 7935 // location outside the try/catch block. 7936 finallyEntry = null; 7937 } 7938 7939 var record = finallyEntry ? finallyEntry.completion : {}; 7940 record.type = type; 7941 record.arg = arg; 7942 7943 if (finallyEntry) { 7944 this.method = "next"; 7945 this.next = finallyEntry.finallyLoc; 7946 return ContinueSentinel; 7947 } 7948 7949 return this.complete(record); 7950 }, 7951 7952 complete: function(record, afterLoc) { 7953 if (record.type === "throw") { 7954 throw record.arg; 7955 } 7956 7957 if (record.type === "break" || 7958 record.type === "continue") { 7959 this.next = record.arg; 7960 } else if (record.type === "return") { 7961 this.rval = this.arg = record.arg; 7962 this.method = "return"; 7963 this.next = "end"; 7964 } else if (record.type === "normal" && afterLoc) { 7965 this.next = afterLoc; 7966 } 7967 7968 return ContinueSentinel; 7969 }, 7970 7971 finish: function(finallyLoc) { 7972 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7973 var entry = this.tryEntries[i]; 7974 if (entry.finallyLoc === finallyLoc) { 7975 this.complete(entry.completion, entry.afterLoc); 7976 resetTryEntry(entry); 7977 return ContinueSentinel; 7978 } 7979 } 7980 }, 7981 7982 "catch": function(tryLoc) { 7983 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7984 var entry = this.tryEntries[i]; 7985 if (entry.tryLoc === tryLoc) { 7986 var record = entry.completion; 7987 if (record.type === "throw") { 7988 var thrown = record.arg; 7989 resetTryEntry(entry); 7990 } 7991 return thrown; 7992 } 7993 } 7994 7995 // The context.catch method must only be called with a location 7996 // argument that corresponds to a known catch block. 7997 throw new Error("illegal catch attempt"); 7998 }, 7999 8000 delegateYield: function(iterable, resultName, nextLoc) { 8001 this.delegate = { 8002 iterator: values(iterable), 8003 resultName: resultName, 8004 nextLoc: nextLoc 8005 }; 8006 8007 if (this.method === "next") { 8008 // Deliberately forget the last sent value so that we don't 8009 // accidentally pass it on to the delegate. 8010 this.arg = undefined; 8011 } 8012 8013 return ContinueSentinel; 8014 } 8015 }; 8016 })( 8017 //
8017Among the various tricks for obtaining a reference to the global 8018 // object, this seems to be the most reliable technique that does not 8019 // use indirect eval (which violates Content Security Policy). 8020 typeof global === "object" ? global : 8021 typeof window === "object" ? window : 8022 typeof self === "object" ? self : this 8023 ); 8024 8025 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 8026 8027/***/ }), 8028/* 294 */ 8029/***/ (function(module, exports, __webpack_require__) { 8030 8031 __webpack_require__(295); 8032 module.exports = __webpack_require__(9).RegExp.escape; 8033 8034/***/ }), 8035/* 295 */ 8036/***/ (function(module, exports, __webpack_require__) { 8037 8038 // https://github.com/benjamingr/RexExp.escape 8039 var $export = __webpack_require__(8) 8040 , $re = __webpack_require__(296)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); 8041 8042 $export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }}); 8043 8044 8045/***/ }), 8046/* 296 */ 8047/***/ (function(module, exports) { 8048 8049 module.exports = function(regExp, replace){ 8050 var replacer = replace === Object(replace) ? function(part){ 8051 return replace[part]; 8052 } : replace; 8053 return function(it){ 8054 return String(it).replace(regExp, replacer); 8055 }; 8056 }; 8057 8058/***/ }), 8059/* 297 */ 8060/***/ (function(module, exports, __webpack_require__) { 8061 8062 "use strict"; 8063 8064 var _velocityAnimate = __webpack_require__(298); 8065 8066 var _velocityAnimate2 = _interopRequireDefault(_velocityAnimate); 8067 8068 var _bgm = __webpack_require__(299); 8069 8070 var _bgm2 = _interopRequireDefault(_bgm); 8071 8072 var _events = __webpack_require__(301); 8073 8074 var _events2 = _interopRequireDefault(_events); 8075 8076 var _jquery = __webpack_require__(303); 8077 8078 var _jquery2 = _interopRequireDefault(_jquery); 8079 8080 var _mobileDetect = __webpack_require__(304); 8081 8082 var _mobileDetect2 = _interopRequireDefault(_mobileDetect); 8083 8084 var _menu = __webpack_require__(306); 8085 8086 var _menu2 = _interopRequireDefault(_menu); 8087 8088 var _topVisual = __webpack_require__(309); 8089 8090 var _topVisual2 = _interopRequireDefault(_topVisual); 8091 8092 var _pages = __webpack_require__(312); 8093 8094 var _pageVisibility = __webpack_require__(313); 8095 8096 var _pageVisibility2 = _interopRequireDefault(_pageVisibility); 8097 8098 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8099 8100 var maxNo = 8; 8101 var skip = false; 8102 var charaNo = _.random(1, maxNo); 8103 var isSp = window.innerWidth < 750; 8104 8105 // faster setup ----------- 8106 var md = new _mobileDetect2.default(window.navigator.userAgent); 8107 if (md.tablet()) { 8108 (0, _jquery2.default)("meta[name=viewport]").attr("content", "width=1200"); 8109 } 8110 8111 (0, _jquery2.default)("html").addClass("page-chara-" + charaNo); 8112 8113 window.addEventListener("DOMContentLoaded", function () { 8114 (0, _pages.setupPages)(); 8115 (0, _pages.reloadPage)(window.location.hash); 8116 window.addEventListener("hashchange", _pages.reloadPage); 8117 8118 var topVisual = new _topVisual2.default({ 8119 isSp: isSp, charaNo: charaNo, 8120 width: window.innerWidth, 8121 height: isSp ? 500 : window.innerHeight 8122 }); 8123 8124 var menu = new _menu2.default({ 8125 menuToggle: document.querySelectorAll(".js-toggle-menu"), 8126 menuItems: document.querySelectorAll(".js-menu-item"), 8127 menu: document.querySelectorAll(".js-menu") 8128 }); 8129 8130 // splash ------------------------------------------------- 8131 var $splash = (0, _jquery2.default)(".splash"); 8132 var $loading = $splash.find(".splash__loading"); 8133 var $bg = $splash.find(".splash__bg"); 8134 var $logo = $splash.find(".splash__logo"); 8135 var $soundView = $splash.find(".splash__sound"); 8136 8137 var name = (0, _pages.currentPageName)(window.location.hash); 8138 if (!skip && name === "front") { 8139 (0, _velocityAnimate2.default)($logo, { opacity: 1 }, { 8140 duration: 900, delay: 2500, complete: function complete() { 8141 Velocity($logo, { opacity: 0 }, { 8142 duration: 900, delay: 1200, complete: function complete() { 8143 Velocity($soundView, { opacity: 1 }, { duration: 1000 }); 8144 var $on = $splash.find(".splash__on"); 8145 var $off = $splash.find(".splash__off"); 8146 var selected = function selected(flag) { 8147 Velocity($splash, { opacity: 0 }, 1000, function () { 8148 $splash.css({ display: "none" }); 8149 _events2.default.emit("start", flag); 8150 topVisual.setup(); 8151 }); 8152 }; 8153 $on.one("click", selected.bind(null, true)); 8154 $off.one("click", selected.bind(null, false)); 8155 } 8156 }); 8157 } 8158 }); 8159 } else { 8160 (0, _jquery2.default)("html").addClass("page-front_started"); 8161 $splash.css({ display: "none" }); 8162 _.delay(function () { 8163 _events2.default.emit("start", false); 8164 }, 100); 8165 if (skip) { 8166 topVisual.setup(); 8167 } 8168 } 8169 8170 // selected sound 8171 var started = false;
8172 _events2.default.on("start", function (sound) { 8173 _bgm2.default.setup(); 8174 _events2.default.emit("bgmToggle", sound); 8175 if (sound) { 8176 _bgm2.default.play(); 8177 } else { 8178 _bgm2.default.pause(); 8179 } 8180 }); 8181 8182 _events2.default.on("showFront", function () { 8183 var $html = (0, _jquery2.default)("html"); 8184 $html.removeClass("page-chara-" + charaNo); 8185 var newCharaNo = _.random(1, maxNo); 8186 8187 $html.addClass("page-chara-" + newCharaNo); 8188 topVisual.changeChara(newCharaNo); 8189 charaNo = newCharaNo; 8190 }); 8191 _events2.default.on("hideFront", function () { 8192 topVisual.inactive(); 8193 }); 8194 8195 _events2.default.on("selectMenu", function (href) { 8196 var pageName = (0, _pages.currentPageName)(window.location.hash); 8197 8198 if ((href === "" || href === "#") && pageName === "front") { 8199 _events2.default.emit("showFront"); 8200 } 8201 }); 8202 8203 // bgm ---------------------------------------------------- 8204 var $toggleButton = (0, _jquery2.default)(".js-sound-toggle"); 8205 $toggleButton.on("click", function () { 8206 _bgm2.default.toggle(); 8207 }); 8208 8209 _events2.default.on("bgmToggle", function (flag) { 8210 if (flag) { 8211 $toggleButton.removeClass("js-sound-toggle--disable"); 8212 } else { 8213 $toggleButton.addClass("js-sound-toggle--disable"); 8214 } 8215 }); 8216 // cast --------------------------------------------------- 8217 var $characters = (0, _jquery2.default)(".characters"); 8218 var $buttons = $characters.find(".js-characters-button"); 8219 var names = _.map($buttons, function (el) { 8220 return (0, _jquery2.default)(el).data("name"); 8221 }); 8222 $buttons.on("click", function (e) { 8223 var name = (0, _jquery2.default)(e.currentTarget).data("name"); 8224 $characters.attr("data-name", name); 8225 }); 8226 $characters.find(".js-characters-next").on("click", function (e) { 8227 var name = $characters.attr("data-name"); 8228 var index = _.indexOf(names, name); 8229 var nextIndex = index + 1; 8230 if (nextIndex >= names.length) { 8231 nextIndex = 0; 8232 } 8233 $characters.attr("data-name", names[nextIndex]); 8234 }); 8235 $characters.find(".js-characters-prev").on("click", function (e) { 8236 var name = $characters.attr("data-name"); 8237 var index = _.indexOf(names, name); 8238 var prevIndex = index - 1; 8239 if (prevIndex < 0) { 8240 prevIndex = names.length - 1; 8241 } 8242 $characters.attr("data-name", names[prevIndex]); 8243 }); 8244 8245 // goods -------------------------------------------------- 8246 _.forEach((0, _jquery2.default)(".js-item-shops"), function (el) { 8247 var $el = (0, _jquery2.default)(el); 8248 var $banners = $el.find(".item__banners"); 8249 var $close = $el.find(".item__close"); 8250 $banners.on("click", function (e) { 8251 if (e.currentTarget === e.target) { 8252 $banners.attr("data-show-shop", 0); 8253 } 8254 }); 8255 $el.on("click", function (e) { 8256 if (e.currentTarget === e.target) { 8257 $banners.attr("data-show-shop", "1"); 8258 } 8259 }); 8260 $close.on("click", function () { 8261 $banners.attr("data-show-shop", "0"); 8262 }); 8263 }); 8264 8265 // fixed scroll ------------------------------------------- 8266 if (!isSp) { 8267 var $fixedScroll = (0, _jquery2.default)(".footer, .bg, .page-title"); 8268 var $w = (0, _jquery2.default)(window); 8269 $w.on("scroll", function (e) { 8270 var left = $w.scrollLeft();
vendor: 204,773 bytes, lines 8271-13018
8271 $fixedScroll.css({ transform: "translateX(" + -left + "px)" }); 8272 }); 8273 } 8274 8275 // page visibility ------------------------------------------- 8276 var soundFlag = false; 8277 _pageVisibility2.default.on(function (flag, name) { 8278 if (flag) { 8279 soundFlag = _bgm2.default.isPlaying(); 8280 _bgm2.default.pause(); 8281 } else { 8282 if (soundFlag) { 8283 _bgm2.default.play(); 8284 } 8285 } 8286 }); 8287 }); 8288 8289/***/ }), 8290/* 298 */ 8291/***/ (function(module, exports, __webpack_require__) { 8292 8293 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ 8294 8295 /************************* 8296 Velocity jQuery Shim 8297 *************************/ 8298 8299 /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ 8300 8301 /* This file contains the jQuery functions that Velocity relies on, thereby removing Velocity's dependency on a full copy of jQuery, and allowing it to work in any environment. */ 8302 /* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */ 8303 /* Browser support: Using this shim instead of jQuery proper removes support for IE8. */ 8304 8305 (function(window) { 8306 "use strict"; 8307 /*************** 8308 Setup 8309 ***************/ 8310 8311 /* If jQuery is already loaded, there's no point in loading this shim. */ 8312 if (window.jQuery) { 8313 return; 8314 } 8315 8316 /* jQuery base. */ 8317 var $ = function(selector, context) { 8318 return new $.fn.init(selector, context); 8319 }; 8320 8321 /******************** 8322 Private Methods 8323 ********************/ 8324 8325 /* jQuery */ 8326 $.isWindow = function(obj) { 8327 /* jshint eqeqeq: false */ 8328 return obj && obj === obj.window; 8329 }; 8330 8331 /* jQuery */ 8332 $.type = function(obj) { 8333 if (!obj) { 8334 return obj + ""; 8335 } 8336 8337 return typeof obj === "object" || typeof obj === "function" ? 8338 class2type[toString.call(obj)] || "object" : 8339 typeof obj; 8340 }; 8341 8342 /* jQuery */ 8343 $.isArray = Array.isArray || function(obj) { 8344 return $.type(obj) === "array"; 8345 }; 8346 8347 /* jQuery */ 8348 function isArraylike(obj) { 8349 var length = obj.length, 8350 type = $.type(obj); 8351 8352 if (type === "function" || $.isWindow(obj)) { 8353 return false; 8354 } 8355 8356 if (obj.nodeType === 1 && length) { 8357 return true; 8358 } 8359 8360 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj; 8361 } 8362 8363 /*************** 8364 $ Methods 8365 ***************/ 8366 8367 /* jQuery: Support removed for IE<9. */ 8368 $.isPlainObject = function(obj) { 8369 var key; 8370 8371 if (!obj || $.type(obj) !== "object" || obj.nodeType || $.isWindow(obj)) { 8372 return false; 8373 } 8374 8375 try { 8376 if (obj.constructor && 8377 !hasOwn.call(obj, "constructor") && 8378 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 8379 return false; 8380 } 8381 } catch (e) { 8382 return false; 8383 } 8384 8385 for (key in obj) { 8386 } 8387 8388 return key === undefined || hasOwn.call(obj, key); 8389 }; 8390 8391 /* jQuery */ 8392 $.each = function(obj, callback, args) { 8393 var value, 8394 i = 0, 8395 length = obj.length, 8396 isArray = isArraylike(obj); 8397 8398 if (args) { 8399 if (isArray) { 8400 for (; i < length; i++) { 8401 value = callback.apply(obj[i], args); 8402 8403 if (value === false) { 8404 break; 8405 } 8406 } 8407 } else { 8408 for (i in obj) { 8409 if (!obj.hasOwnProperty(i)) { 8410 continue; 8411 } 8412 value = callback.apply(obj[i], args); 8413 8414 if (value === false) { 8415 break; 8416 } 8417 } 8418 } 8419 8420 } else { 8421 if (isArray) { 8422 for (; i < length; i++) { 8423 value = callback.call(obj[i], i, obj[i]); 8424 8425 if (value === false) { 8426 break; 8427 } 8428 } 8429 } else { 8430 for (i in obj) { 8431 if (!obj.hasOwnProperty(i)) { 8432 continue; 8433 } 8434 value = callback.call(obj[i], i, obj[i]); 8435 8436 if (value === false) { 8437 break; 8438 } 8439 } 8440 } 8441 } 8442 8443 return obj; 8444 }; 8445 8446 /* Custom */ 8447 $.data = function(node, key, value) { 8448 /* $.getData() */ 8449 if (value === undefined) { 8450 var getId = node[$.expando], 8451 store = getId && cache[getId]; 8452 8453 if (key === undefined) { 8454 return store; 8455 } else if (store) { 8456 if (key in store) { 8457 return store[key]; 8458 } 8459 } 8460 /* $.setData() */ 8461 } else if (key !== undefined) { 8462 var setId = node[$.expando] || (node[$.expando] = ++$.uuid); 8463 8464 cache[setId] = cache[setId] || {}; 8465 cache[setId][key] = value; 8466 8467 return value; 8468 } 8469 }; 8470 8471 /* Custom */ 8472 $.removeData = function(node, keys) { 8473 var id = node[$.expando], 8474 store = id && cache[id]; 8475 8476 if (store) { 8477 // Cleanup the entire store if no keys are provided. 8478 if (!keys) { 8479 delete cache[id]; 8480 } else { 8481 $.each(keys, function(_, key) { 8482 delete store[key]; 8483 }); 8484 } 8485 } 8486 }; 8487 8488 /* jQuery */ 8489 $.extend = function() { 8490 var src, copyIsArray, copy, name, options, clone, 8491 target = arguments[0] || {}, 8492 i = 1, 8493 length = arguments.length, 8494 deep = false; 8495 8496 if (typeof target === "boolean") { 8497 deep = target; 8498 8499 target = arguments[i] || {}; 8500 i++; 8501 } 8502 8503 if (typeof target !== "object" && $.type(target) !== "function") { 8504 target = {}; 8505 } 8506 8507 if (i === length) { 8508 target = this; 8509 i--; 8510 } 8511 8512 for (; i < length; i++) { 8513 if ((options = arguments[i])) { 8514 for (name in options) { 8515 if (!options.hasOwnProperty(name)) { 8516 continue; 8517 } 8518 src = target[name]; 8519 copy = options[name]; 8520 8521 if (target === copy) { 8522 continue; 8523 } 8524 8525 if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) { 8526 if (copyIsArray) { 8527 copyIsArray = false; 8528 clone = src && $.isArray(src) ? src : []; 8529 8530 } else { 8531 clone = src && $.isPlainObject(src) ? src : {}; 8532 } 8533 8534 target[name] = $.extend(deep, clone, copy); 8535 8536 } else if (copy !== undefined) { 8537 target[name] = copy; 8538 } 8539 } 8540 } 8541 } 8542 8543 return target; 8544 }; 8545 8546 /* jQuery 1.4.3 */ 8547 $.queue = function(elem, type, data) { 8548 function $makeArray(arr, results) { 8549 var ret = results || []; 8550 8551 if (arr) { 8552 if (isArraylike(Object(arr))) { 8553 /* $.merge */ 8554 (function(first, second) { 8555 var len = +second.length, 8556 j = 0, 8557 i = first.length; 8558 8559 while (j < len) { 8560 first[i++] = second[j++]; 8561 } 8562 8563 if (len !== len) { 8564 while (second[j] !== undefined) { 8565 first[i++] = second[j++]; 8566 } 8567 } 8568 8569 first.length = i; 8570 8571 return first; 8572 })(ret, typeof arr === "string" ? [arr] : arr); 8573 } else { 8574 [].push.call(ret, arr); 8575 } 8576 } 8577 8578 return ret; 8579 } 8580 8581 if (!elem) { 8582 return; 8583 } 8584 8585 type = (type || "fx") + "queue"; 8586 8587 var q = $.data(elem, type); 8588 8589 if (!data) { 8590 return q || []; 8591 } 8592 8593 if (!q || $.isArray(data)) { 8594 q = $.data(elem, type, $makeArray(data)); 8595 } else { 8596 q.push(data); 8597 } 8598 8599 return q; 8600 }; 8601 8602 /* jQuery 1.4.3 */ 8603 $.dequeue = function(elems, type) { 8604 /* Custom: Embed element iteration. */ 8605 $.each(elems.nodeType ? [elems] : elems, function(i, elem) { 8606 type = type || "fx"; 8607 8608 var queue = $.queue(elem, type), 8609 fn = queue.shift(); 8610 8611 if (fn === "inprogress") { 8612 fn = queue.shift(); 8613 } 8614 8615 if (fn) { 8616 if (type === "fx") { 8617 queue.unshift("inprogress"); 8618 } 8619 8620 fn.call(elem, function() { 8621 $.dequeue(elem, type); 8622 }); 8623 } 8624 }); 8625 }; 8626 8627 /****************** 8628 $.fn Methods 8629 ******************/ 8630 8631 /* jQuery */ 8632 $.fn = $.prototype = { 8633 init: function(selector) { 8634 /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */ 8635 if (selector.nodeType) { 8636 this[0] = selector; 8637 8638 return this; 8639 } else { 8640 throw new Error("Not a DOM node."); 8641 } 8642 }, 8643 offset: function() { 8644 /* jQuery altered code: Dropped disconnected DOM node checking. */ 8645 var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : {top: 0, left: 0}; 8646 8647 return { 8648 top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), 8649 left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) 8650 }; 8651 }, 8652 position: function() { 8653 /* jQuery */ 8654 function offsetParentFn(elem) { 8655 var offsetParent = elem.offsetParent; 8656 8657 while (offsetParent && offsetParent.nodeName.toLowerCase() !== "html" && offsetParent.style && offsetParent.style.position === "static") { 8658 offsetParent = offsetParent.offsetParent; 8659 } 8660 8661 return offsetParent || document; 8662 } 8663 8664 /* Zepto */ 8665 var elem = this[0], 8666 offsetParent = offsetParentFn(elem), 8667 offset = this.offset(), 8668 parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? {top: 0, left: 0} : $(offsetParent).offset(); 8669 8670 offset.top -= parseFloat(elem.style.marginTop) || 0; 8671 offset.left -= parseFloat(elem.style.marginLeft) || 0; 8672 8673 if (offsetParent.style) { 8674 parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0; 8675 parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0; 8676 } 8677 8678 return { 8679 top: offset.top - parentOffset.top, 8680 left: offset.left - parentOffset.left 8681 }; 8682 } 8683 }; 8684 8685 /********************** 8686 Private Variables 8687 **********************/ 8688 8689 /* For $.data() */ 8690 var cache = {}; 8691 $.expando = "velocity" + (new Date().getTime()); 8692 $.uuid = 0; 8693 8694 /* For $.queue() */ 8695 var class2type = {}, 8696 hasOwn = class2type.hasOwnProperty, 8697 toString = class2type.toString; 8698 8699 var types = "Boolean Number String Function Array Date RegExp Object Error".split(" "); 8700 for (var i = 0; i < types.length; i++) { 8701 class2type["[object " + types[i] + "]"] = types[i].toLowerCase(); 8702 } 8703 8704 /* Makes $(node) possible, without having to call init. */ 8705 $.fn.init.prototype = $.fn; 8706 8707 /* Globalize Velocity onto the window, and assign its Utilities property. */ 8708 window.Velocity = {Utilities: $}; 8709 })(window); 8710 8711 /****************** 8712 Velocity.js 8713 ******************/ 8714 8715 (function(factory) { 8716 "use strict"; 8717 /* CommonJS module. */ 8718 if (typeof module === "object" && typeof module.exports === "object") { 8719 module.exports = factory(); 8720 /* AMD module. */ 8721 } else if (true) { 8722 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 8723 /* Browser globals. */ 8724 } else { 8725 factory(); 8726 } 8727 }(function() { 8728 "use strict"; 8729 return function(global, window, document, undefined) { 8730 8731 /*************** 8732 Summary 8733 ***************/ 8734 8735 /* 8736 - CSS: CSS stack that works independently from the rest of Velocity. 8737 - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. 8738 - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. 8739 - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. 8740 Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). 8741 - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 8742 - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. 8743 - completeCall(): Handles the cleanup process for each Velocity call. 8744 */ 8745 8746 /********************* 8747 Helper Functions 8748 *********************/ 8749 8750 /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ 8751 var IE = (function() { 8752 if (document.documentMode) { 8753 return document.documentMode; 8754 } else { 8755 for (var i = 7; i > 4; i--) { 8756 var div = document.createElement("div"); 8757 8758 div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; 8759 8760 if (div.getElementsByTagName("span").length) { 8761 div = null; 8762 8763 return i; 8764 } 8765 } 8766 } 8767 8768 return undefined; 8769 })(); 8770 8771 /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ 8772 var rAFShim = (function() { 8773 var timeLast = 0; 8774 8775 return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { 8776 var timeCurrent = (new Date()).getTime(), 8777 timeDelta; 8778 8779 /* Dynamically set delay on a per-tick basis to match 60fps. */ 8780 /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ 8781 timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); 8782 timeLast = timeCurrent + timeDelta; 8783 8784 return setTimeout(function() { 8785 callback(timeCurrent + timeDelta); 8786 }, timeDelta); 8787 }; 8788 })(); 8789 8790 var performance = (function() { 8791 var perf = window.performance || {}; 8792 8793 if (typeof perf.now !== "function") { 8794 var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : (new Date()).getTime(); 8795 8796 perf.now = function() { 8797 return (new Date()).getTime() - nowOffset; 8798 }; 8799 } 8800 return perf; 8801 })(); 8802 8803 /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ 8804 function compactSparseArray(array) { 8805 var index = -1, 8806 length = array ? array.length : 0, 8807 result = []; 8808 8809 while (++index < length) { 8810 var value = array[index]; 8811 8812 if (value) { 8813 result.push(value); 8814 } 8815 } 8816 8817 return result; 8818 } 8819 8820 /** 8821 * Shim for "fixing" IE's lack of support (IE < 9) for applying slice 8822 * on host objects like NamedNodeMap, NodeList, and HTMLCollection 8823 * (technically, since host objects have been implementation-dependent, 8824 * at least before ES2015, IE hasn't needed to work this way). 8825 * Also works on strings, fixes IE < 9 to allow an explicit undefined 8826 * for the 2nd argument (as in Firefox), and prevents errors when 8827 * called on other DOM objects. 8828 */ 8829 var _slice = (function() { 8830 var slice = Array.prototype.slice; 8831 8832 try { 8833 // Can't be used with DOM elements in IE < 9 8834 slice.call(document.documentElement); 8835 return slice; 8836 } catch (e) { // Fails in IE < 9 8837 8838 // This will work for genuine arrays, array-like objects, 8839 // NamedNodeMap (attributes, entities, notations), 8840 // NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes), 8841 // and will not fail on other DOM objects (as do DOM elements in IE < 9) 8842 return function(begin, end) { 8843 var len = this.length; 8844 8845 if (typeof begin !== "number") { 8846 begin = 0; 8847 } 8848 // IE < 9 gets unhappy with an undefined end argument 8849 if (typeof end !== "number") { 8850 end = len; 8851 } 8852 // For native Array objects, we use the native slice function 8853 if (this.slice) { 8854 return slice.call(this, begin, end); 8855 } 8856 // For array like object we handle it ourselves. 8857 var i, 8858 cloned = [], 8859 // Handle negative value for "begin" 8860 start = (begin >= 0) ? begin : Math.max(0, len + begin), 8861 // Handle negative value for "end" 8862 upTo = end < 0 ? len + end : Math.min(end, len), 8863 // Actual expected size of the slice 8864 size = upTo - start; 8865 8866 if (size > 0) { 8867 cloned = new Array(size); 8868 if (this.charAt) { 8869 for (i = 0; i < size; i++) { 8870 cloned[i] = this.charAt(start + i); 8871 } 8872 } else { 8873 for (i = 0; i < size; i++) { 8874 cloned[i] = this[start + i]; 8875 } 8876 } 8877 } 8878 return cloned; 8879 }; 8880 } 8881 })(); 8882 8883 /* .indexOf doesn't exist in IE<9 */ 8884 var _inArray = (function() { 8885 if (Array.prototype.includes) { 8886 return function(arr, val) { 8887 return arr.includes(val); 8888 }; 8889 } 8890 if (Array.prototype.indexOf) { 8891 return function(arr, val) { 8892 return arr.indexOf(val) >= 0; 8893 }; 8894 } 8895 return function(arr, val) { 8896 for (var i = 0; i < arr.length; i++) { 8897 if (arr[i] === val) { 8898 return true; 8899 } 8900 } 8901 return false; 8902 }; 8903 }); 8904 8905 function sanitizeElements(elements) { 8906 /* Unwrap jQuery/Zepto objects. */ 8907 if (Type.isWrapped(elements)) { 8908 elements = _slice.call(elements); 8909 /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */ 8910 } else if (Type.isNode(elements)) { 8911 elements = [elements]; 8912 } 8913 8914 return elements; 8915 } 8916 8917 var Type = { 8918 isNumber: function(variable) { 8919 return (typeof variable === "number"); 8920 }, 8921 isString: function(variable) { 8922 return (typeof variable === "string"); 8923 }, 8924 isArray: Array.isArray || function(variable) { 8925 return Object.prototype.toString.call(variable) === "[object Array]"; 8926 }, 8927 isFunction: function(variable) { 8928 return Object.prototype.toString.call(variable) === "[object Function]"; 8929 }, 8930 isNode: function(variable) { 8931 return variable && variable.nodeType; 8932 }, 8933 /* Determine if variable is an array-like wrapped jQuery, Zepto or similar element, or even a NodeList etc. */ 8934 /* NOTE: HTMLFormElements also have a length. */ 8935 isWrapped: function(variable) { 8936 return variable 8937 && variable !== window 8938 && Type.isNumber(variable.length) 8939 && !Type.isString(variable) 8940 && !Type.isFunction(variable) 8941 && !Type.isNode(variable) 8942 && (variable.length === 0 || Type.isNode(variable[0])); 8943 }, 8944 isSVG: function(variable) { 8945 return window.SVGElement && (variable instanceof window.SVGElement); 8946 }, 8947 isEmptyObject: function(variable) { 8948 for (var name in variable) { 8949 if (variable.hasOwnProperty(name)) { 8950 return false; 8951 } 8952 } 8953 8954 return true; 8955 } 8956 }; 8957 8958 /***************** 8959 Dependencies 8960 *****************/ 8961 8962 var $, 8963 isJQuery = false; 8964 8965 if (global.fn && global.fn.jquery) { 8966 $ = global; 8967 isJQuery = true; 8968 } else { 8969 $ = window.Velocity.Utilities; 8970 } 8971 8972 if (IE <= 8 && !isJQuery) { 8973 throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); 8974 } else if (IE <= 7) { 8975 /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */ 8976 jQuery.fn.velocity = jQuery.fn.animate; 8977 8978 /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ 8979 return; 8980 } 8981 8982 /***************** 8983 Constants 8984 *****************/ 8985 8986 var DURATION_DEFAULT = 400, 8987 EASING_DEFAULT = "swing"; 8988 8989 /************* 8990 State 8991 *************/ 8992 8993 var Velocity = { 8994 /* Container for page-wide Velocity state data. */ 8995 State: { 8996 /* Detect mobile devices to determine if mobileHA should be turned on. */ 8997 isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 8998 /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ 8999 isAndroid: /Android/i.test(navigator.userAgent), 9000 isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), 9001 isChrome: window.chrome, 9002 isFirefox: /Firefox/i.test(navigator.userAgent), 9003 /* Create a cached element for re-use when checking for CSS property prefixes. */ 9004 prefixElement: document.createElement("div"), 9005 /* Cache every prefix match to avoid repeating lookups. */ 9006 prefixMatches: {}, 9007 /* Cache the anchor used for animating window scrolling. */ 9008 scrollAnchor: null, 9009 /* Cache the browser-specific property names associated with the scroll anchor. */ 9010 scrollPropertyLeft: null, 9011 scrollPropertyTop: null, 9012 /* Keep track of whether our RAF tick is running. */ 9013 isTicking: false, 9014 /* Container for every in-progress call to Velocity. */ 9015 calls: [], 9016 delayedElements: { 9017 count: 0 9018 } 9019 }, 9020 /* Velocity's custom CSS stack. Made global for unit testing. */ 9021 CSS: {/* Defined below. */}, 9022 /* A shim of the jQuery utility functions used by Velocity -- provided by Velocity's optional jQuery shim. */ 9023 Utilities: $, 9024 /* Container for the user's custom animation redirects that are referenced by name in place of the properties map argument. */ 9025 Redirects: {/* Manually registered by the user. */}, 9026 Easings: {/* Defined below. */}, 9027 /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */ 9028 Promise: window.Promise, 9029 /* Velocity option defaults, which can be overriden by the user. */ 9030 defaults: { 9031 queue: "", 9032 duration: DURATION_DEFAULT, 9033 easing: EASING_DEFAULT, 9034 begin: undefined, 9035 complete: undefined, 9036 progress: undefined, 9037 display: undefined, 9038 visibility: undefined, 9039 loop: false, 9040 delay: false, 9041 mobileHA: true, 9042 /* Advanced: Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */ 9043 _cacheValues: true, 9044 /* Advanced: Set to false if the promise should always resolve on empty element lists. */ 9045 promiseRejectEmpty: true 9046 }, 9047 /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache. */ 9048 init: function(element) { 9049 $.data(element, "velocity", { 9050 /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ 9051 isSVG: Type.isSVG(element), 9052 /* Keep track of whether the element is currently being animated by Velocity. 9053 This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ 9054 isAnimating: false, 9055 /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 9056 computedStyle: null, 9057 /* Tween data is cached for each animation on the element so that data can be passed across calls -- 9058 in particular, end values are used as subsequent start values in consecutive Velocity calls. */ 9059 tweensContainer: null, 9060 /* The full root property values of each CSS hook being animated on this element are cached so that: 9061 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 9062 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ 9063 rootPropertyValueCache: {}, 9064 /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ 9065 transformCache: {} 9066 }); 9067 }, 9068 /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ 9069 hook: null, /* Defined below. */ 9070 /* Velocity-wide animation time remapping for testing purposes. */ 9071 mock: false, 9072 version: {major: 1, minor: 5, patch: 0}, 9073 /* Set to 1 or 2 (most verbose) to output debug info to console. */ 9074 debug: false, 9075 /* Use rAF high resolution timestamp when available */ 9076 timestamp: true, 9077 /* Pause all animations */ 9078 pauseAll: function(queueName) { 9079 var currentTime = (new Date()).getTime(); 9080 9081 $.each(Velocity.State.calls, function(i, activeCall) { 9082 9083 if (activeCall) { 9084 9085 /* If we have a queueName and this call is not on that queue, skip */ 9086 if (queueName !== undefined && ((activeCall[2].queue !== queueName) || (activeCall[2].queue === false))) { 9087 return true; 9088 } 9089 9090 /* Set call to paused */ 9091 activeCall[5] = { 9092 resume: false 9093 }; 9094 } 9095 }); 9096 9097 /* Pause timers on any currently delayed calls */ 9098 $.each(Velocity.State.delayedElements, function(k, element) { 9099 if (!element) { 9100 return; 9101 } 9102 pauseDelayOnElement(element, currentTime); 9103 }); 9104 }, 9105 /* Resume all animations */ 9106 resumeAll: function(queueName) { 9107 var currentTime = (new Date()).getTime(); 9108 9109 $.each(Velocity.State.calls, function(i, activeCall) { 9110 9111 if (activeCall) { 9112 9113 /* If we have a queueName and this call is not on that queue, skip */ 9114 if (queueName !== undefined && ((activeCall[2].queue !== queueName) || (activeCall[2].queue === false))) { 9115 return true; 9116 } 9117 9118 /* Set call to resumed if it was paused */ 9119 if (activeCall[5]) { 9120 activeCall[5].resume = true; 9121 } 9122 } 9123 }); 9124 /* Resume timers on any currently delayed calls */ 9125 $.each(Velocity.State.delayedElements, function(k, element) { 9126 if (!element) { 9127 return; 9128 } 9129 resumeDelayOnElement(element, currentTime); 9130 }); 9131 } 9132 }; 9133 9134 /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ 9135 if (window.pageYOffset !== undefined) { 9136 Velocity.State.scrollAnchor = window; 9137 Velocity.State.scrollPropertyLeft = "pageXOffset"; 9138 Velocity.State.scrollPropertyTop = "pageYOffset"; 9139 } else { 9140 Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; 9141 Velocity.State.scrollPropertyLeft = "scrollLeft"; 9142 Velocity.State.scrollPropertyTop = "scrollTop"; 9143 } 9144 9145 /* Shorthand alias for jQuery's $.data() utility. */ 9146 function Data(element) { 9147 /* Hardcode a reference to the plugin name. */ 9148 var response = $.data(element, "velocity"); 9149 9150 /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ 9151 return response === null ? undefined : response; 9152 } 9153 9154 /************** 9155 Delay Timer 9156 **************/ 9157 9158 function pauseDelayOnElement(element, currentTime) { 9159 /* Check for any delay timers, and pause the set timeouts (while preserving time data) 9160 to be resumed when the "resume" command is issued */ 9161 var data = Data(element); 9162 if (data && data.delayTimer && !data.delayPaused) { 9163 data.delayRemaining = data.delay - currentTime + data.delayBegin; 9164 data.delayPaused = true; 9165 clearTimeout(data.delayTimer.setTimeout); 9166 } 9167 } 9168 9169 function resumeDelayOnElement(element, currentTime) { 9170 /* Check for any paused timers and resume */ 9171 var data = Data(element); 9172 if (data && data.delayTimer && data.delayPaused) { 9173 /* If the element was mid-delay, re initiate the timeout with the remaining delay */ 9174 data.delayPaused = false; 9175 data.delayTimer.setTimeout = setTimeout(data.delayTimer.next, data.delayRemaining); 9176 } 9177 } 9178 9179 9180 9181 /************** 9182 Easing 9183 **************/ 9184 9185 /* Step easing generator. */ 9186 function generateStep(steps) { 9187 return function(p) { 9188 return Math.round(p * steps) * (1 / steps); 9189 }; 9190 } 9191 9192 /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 9193 function generateBezier(mX1, mY1, mX2, mY2) { 9194 var NEWTON_ITERATIONS = 4, 9195 NEWTON_MIN_SLOPE = 0.001, 9196 SUBDIVISION_PRECISION = 0.0000001, 9197 SUBDIVISION_MAX_ITERATIONS = 10, 9198 kSplineTableSize = 11, 9199 kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), 9200 float32ArraySupported = "Float32Array" in window; 9201 9202 /* Must contain four arguments. */ 9203 if (arguments.length !== 4) { 9204 return false; 9205 } 9206 9207 /* Arguments must be numbers. */ 9208 for (var i = 0; i < 4; ++i) { 9209 if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { 9210 return false; 9211 } 9212 } 9213 9214 /* X values must be in the [0, 1] range. */ 9215 mX1 = Math.min(mX1, 1); 9216 mX2 = Math.min(mX2, 1); 9217 mX1 = Math.max(mX1, 0); 9218 mX2 = Math.max(mX2, 0); 9219 9220 var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 9221 9222 function A(aA1, aA2) { 9223 return 1.0 - 3.0 * aA2 + 3.0 * aA1; 9224 } 9225 function B(aA1, aA2) { 9226 return 3.0 * aA2 - 6.0 * aA1; 9227 } 9228 function C(aA1) { 9229 return 3.0 * aA1; 9230 } 9231 9232 function calcBezier(aT, aA1, aA2) { 9233 return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; 9234 } 9235 9236 function getSlope(aT, aA1, aA2) { 9237 return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); 9238 } 9239 9240 function newtonRaphsonIterate(aX, aGuessT) { 9241 for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 9242 var currentSlope = getSlope(aGuessT, mX1, mX2); 9243 9244 if (currentSlope === 0.0) { 9245 return aGuessT; 9246 } 9247 9248 var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 9249 aGuessT -= currentX / currentSlope; 9250 } 9251 9252 return aGuessT; 9253 } 9254 9255 function calcSampleValues() { 9256 for (var i = 0; i < kSplineTableSize; ++i) { 9257 mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 9258 } 9259 } 9260 9261 function binarySubdivide(aX, aA, aB) { 9262 var currentX, currentT, i = 0; 9263 9264 do { 9265 currentT = aA + (aB - aA) / 2.0; 9266 currentX = calcBezier(currentT, mX1, mX2) - aX; 9267 if (currentX > 0.0) { 9268 aB = currentT; 9269 } else { 9270 aA = currentT; 9271 } 9272 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 9273 9274 return currentT; 9275 } 9276 9277 function getTForX(aX) { 9278 var intervalStart = 0.0, 9279 currentSample = 1, 9280 lastSample = kSplineTableSize - 1; 9281 9282 for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { 9283 intervalStart += kSampleStepSize; 9284 } 9285 9286 --currentSample; 9287 9288 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), 9289 guessForT = intervalStart + dist * kSampleStepSize, 9290 initialSlope = getSlope(guessForT, mX1, mX2); 9291 9292 if (initialSlope >= NEWTON_MIN_SLOPE) { 9293 return newtonRaphsonIterate(aX, guessForT); 9294 } else if (initialSlope === 0.0) { 9295 return guessForT; 9296 } else { 9297 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); 9298 } 9299 } 9300 9301 var _precomputed = false; 9302 9303 function precompute() { 9304 _precomputed = true; 9305 if (mX1 !== mY1 || mX2 !== mY2) { 9306 calcSampleValues(); 9307 } 9308 } 9309 9310 var f = function(aX) { 9311 if (!_precomputed) { 9312 precompute(); 9313 } 9314 if (mX1 === mY1 && mX2 === mY2) { 9315 return aX; 9316 } 9317 if (aX === 0) { 9318 return 0; 9319 } 9320 if (aX === 1) { 9321 return 1; 9322 } 9323 9324 return calcBezier(getTForX(aX), mY1, mY2); 9325 }; 9326 9327 f.getControlPoints = function() { 9328 return [{x: mX1, y: mY1}, {x: mX2, y: mY2}]; 9329 }; 9330 9331 var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; 9332 f.toString = function() { 9333 return str; 9334 }; 9335 9336 return f; 9337 } 9338 9339 /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 9340 /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass 9341 then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ 9342 var generateSpringRK4 = (function() { 9343 function springAccelerationForState(state) { 9344 return (-state.tension * state.x) - (state.friction * state.v); 9345 } 9346 9347 function springEvaluateStateWithDerivative(initialState, dt, derivative) { 9348 var state = { 9349 x: initialState.x + derivative.dx * dt, 9350 v: initialState.v + derivative.dv * dt, 9351 tension: initialState.tension, 9352 friction: initialState.friction 9353 }; 9354 9355 return {dx: state.v, dv: springAccelerationForState(state)}; 9356 } 9357 9358 function springIntegrateState(state, dt) { 9359 var a = { 9360 dx: state.v, 9361 dv: springAccelerationForState(state) 9362 }, 9363 b = springEvaluateStateWithDerivative(state, dt * 0.5, a), 9364 c = springEvaluateStateWithDerivative(state, dt * 0.5, b), 9365 d = springEvaluateStateWithDerivative(state, dt, c), 9366 dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), 9367 dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); 9368 9369 state.x = state.x + dxdt * dt; 9370 state.v = state.v + dvdt * dt; 9371 9372 return state; 9373 } 9374 9375 return function springRK4Factory(tension, friction, duration) { 9376 9377 var initState = { 9378 x: -1, 9379 v: 0, 9380 tension: null, 9381 friction: null 9382 }, 9383 path = [0], 9384 time_lapsed = 0, 9385 tolerance = 1 / 10000, 9386 DT = 16 / 1000, 9387 have_duration, dt, last_state; 9388 9389 tension = parseFloat(tension) || 500; 9390 friction = parseFloat(friction) || 20; 9391 duration = duration || null; 9392 9393 initState.tension = tension; 9394 initState.friction = friction; 9395 9396 have_duration = duration !== null; 9397 9398 /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ 9399 if (have_duration) { 9400 /* Run the simulation without a duration. */ 9401 time_lapsed = springRK4Factory(tension, friction); 9402 /* Compute the adjusted time delta. */ 9403 dt = time_lapsed / duration * DT; 9404 } else { 9405 dt = DT; 9406 } 9407 9408 while (true) { 9409 /* Next/step function .*/ 9410 last_state = springIntegrateState(last_state || initState, dt); 9411 /* Store the position. */ 9412 path.push(1 + last_state.x); 9413 time_lapsed += 16; 9414 /* If the change threshold is reached, break. */ 9415 if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { 9416 break; 9417 } 9418 } 9419 9420 /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the 9421 computed path and returns a snapshot of the position according to a given percentComplete. */ 9422 return !have_duration ? time_lapsed : function(percentComplete) { 9423 return path[ (percentComplete * (path.length - 1)) | 0 ]; 9424 }; 9425 }; 9426 }()); 9427 9428 /* jQuery easings. */ 9429 Velocity.Easings = { 9430 linear: function(p) { 9431 return p; 9432 }, 9433 swing: function(p) { 9434 return 0.5 - Math.cos(p * Math.PI) / 2; 9435 }, 9436 /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ 9437 spring: function(p) { 9438 return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); 9439 } 9440 }; 9441 9442 /* CSS3 and Robert Penner easings. */ 9443 $.each( 9444 [ 9445 ["ease", [0.25, 0.1, 0.25, 1.0]], 9446 ["ease-in", [0.42, 0.0, 1.00, 1.0]], 9447 ["ease-out", [0.00, 0.0, 0.58, 1.0]], 9448 ["ease-in-out", [0.42, 0.0, 0.58, 1.0]], 9449 ["easeInSine", [0.47, 0, 0.745, 0.715]], 9450 ["easeOutSine", [0.39, 0.575, 0.565, 1]], 9451 ["easeInOutSine", [0.445, 0.05, 0.55, 0.95]], 9452 ["easeInQuad", [0.55, 0.085, 0.68, 0.53]], 9453 ["easeOutQuad", [0.25, 0.46, 0.45, 0.94]], 9454 ["easeInOutQuad", [0.455, 0.03, 0.515, 0.955]], 9455 ["easeInCubic", [0.55, 0.055, 0.675, 0.19]], 9456 ["easeOutCubic", [0.215, 0.61, 0.355, 1]], 9457 ["easeInOutCubic", [0.645, 0.045, 0.355, 1]], 9458 ["easeInQuart", [0.895, 0.03, 0.685, 0.22]], 9459 ["easeOutQuart", [0.165, 0.84, 0.44, 1]], 9460 ["easeInOutQuart", [0.77, 0, 0.175, 1]], 9461 ["easeInQuint", [0.755, 0.05, 0.855, 0.06]], 9462 ["easeOutQuint", [0.23, 1, 0.32, 1]], 9463 ["easeInOutQuint", [0.86, 0, 0.07, 1]], 9464 ["easeInExpo", [0.95, 0.05, 0.795, 0.035]], 9465 ["easeOutExpo", [0.19, 1, 0.22, 1]], 9466 ["easeInOutExpo", [1, 0, 0, 1]], 9467 ["easeInCirc", [0.6, 0.04, 0.98, 0.335]], 9468 ["easeOutCirc", [0.075, 0.82, 0.165, 1]], 9469 ["easeInOutCirc", [0.785, 0.135, 0.15, 0.86]] 9470 ], function(i, easingArray) { 9471 Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); 9472 }); 9473 9474 /* Determine the appropriate easing type given an easing input. */ 9475 function getEasing(value, duration) { 9476 var easing = value; 9477 9478 /* The easing option can either be a string that references a pre-registered easing, 9479 or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ 9480 if (Type.isString(value)) { 9481 /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ 9482 if (!Velocity.Easings[value]) { 9483 easing = false; 9484 } 9485 } else if (Type.isArray(value) && value.length === 1) { 9486 easing = generateStep.apply(null, value); 9487 } else if (Type.isArray(value) && value.length === 2) { 9488 /* springRK4 must be passed the animation's duration. */ 9489 /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing 9490 function generated with default tension and friction values. */ 9491 easing = generateSpringRK4.apply(null, value.concat([duration])); 9492 } else if (Type.isArray(value) && value.length === 4) { 9493 /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ 9494 easing = generateBezier.apply(null, value); 9495 } else { 9496 easing = false; 9497 } 9498 9499 /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) 9500 if the Velocity-wide default has been incorrectly modified. */ 9501 if (easing === false) { 9502 if (Velocity.Easings[Velocity.defaults.easing]) { 9503 easing = Velocity.defaults.easing; 9504 } else { 9505 easing = EASING_DEFAULT; 9506 } 9507 } 9508 9509 return easing; 9510 } 9511 9512 /***************** 9513 CSS Stack 9514 *****************/ 9515 9516 /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. 9517 It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ 9518 /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ 9519 var CSS = Velocity.CSS = { 9520 /************* 9521 RegEx 9522 *************/ 9523 9524 RegEx: { 9525 isHex: /^#([A-f\d]{3}){1,2}$/i, 9526 /* Unwrap a property value's surrounding text, e.g. "rgba(4, 3, 2, 1)" ==> "4, 3, 2, 1" and "rect(4px 3px 2px 1px)" ==> "4px 3px 2px 1px". */ 9527 valueUnwrap: /^[A-z]+\((.*)\)$/i, 9528 wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, 9529 /* Split a multi-value property into an array of subvalues, e.g. "rgba(4, 3, 2, 1) 4px 3px 2px 1px" ==> [ "rgba(4, 3, 2, 1)", "4px", "3px", "2px", "1px" ]. */ 9530 valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig 9531 }, 9532 /************ 9533 Lists 9534 ************/ 9535 9536 Lists: { 9537 colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], 9538 transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], 9539 transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"], 9540 units: [ 9541 "%", // relative 9542 "em", "ex", "ch", "rem", // font relative 9543 "vw", "vh", "vmin", "vmax", // viewport relative 9544 "cm", "mm", "Q", "in", "pc", "pt", "px", // absolute lengths 9545 "deg", "grad", "rad", "turn", // angles 9546 "s", "ms" // time 9547 ], 9548 colorNames: { 9549 "aliceblue": "240,248,255", 9550 "antiquewhite": "250,235,215", 9551 "aquamarine": "127,255,212", 9552 "aqua": "0,255,255", 9553 "azure": "240,255,255", 9554 "beige": "245,245,220", 9555 "bisque": "255,228,196", 9556 "black": "0,0,0", 9557 "blanchedalmond": "255,235,205", 9558 "blueviolet": "138,43,226", 9559 "blue": "0,0,255", 9560 "brown": "165,42,42", 9561 "burlywood": "222,184,135", 9562 "cadetblue": "95,158,160", 9563 "chartreuse": "127,255,0", 9564 "chocolate": "210,105,30", 9565 "coral": "255,127,80", 9566 "cornflowerblue": "100,149,237", 9567 "cornsilk": "255,248,220", 9568 "crimson": "220,20,60", 9569 "cyan": "0,255,255", 9570 "darkblue": "0,0,139", 9571 "darkcyan": "0,139,139", 9572 "darkgoldenrod": "184,134,11", 9573 "darkgray": "169,169,169", 9574 "darkgrey": "169,169,169", 9575 "darkgreen": "0,100,0", 9576 "darkkhaki": "189,183,107", 9577 "darkmagenta": "139,0,139", 9578 "darkolivegreen": "85,107,47", 9579 "darkorange": "255,140,0", 9580 "darkorchid": "153,50,204", 9581 "darkred": "139,0,0", 9582 "darksalmon": "233,150,122", 9583 "darkseagreen": "143,188,143", 9584 "darkslateblue": "72,61,139", 9585 "darkslategray": "47,79,79", 9586 "darkturquoise": "0,206,209", 9587 "darkviolet": "148,0,211", 9588 "deeppink": "255,20,147", 9589 "deepskyblue": "0,191,255", 9590 "dimgray": "105,105,105", 9591 "dimgrey": "105,105,105", 9592 "dodgerblue": "30,144,255", 9593 "firebrick": "178,34,34", 9594 "floralwhite": "255,250,240", 9595 "forestgreen": "34,139,34", 9596 "fuchsia": "255,0,255", 9597 "gainsboro": "220,220,220", 9598 "ghostwhite": "248,248,255", 9599 "gold": "255,215,0", 9600 "goldenrod": "218,165,32", 9601 "gray": "128,128,128", 9602 "grey": "128,128,128", 9603 "greenyellow": "173,255,47", 9604 "green": "0,128,0", 9605 "honeydew": "240,255,240", 9606 "hotpink": "255,105,180", 9607 "indianred": "205,92,92", 9608 "indigo": "75,0,130", 9609 "ivory": "255,255,240", 9610 "khaki": "240,230,140", 9611 "lavenderblush": "255,240,245", 9612 "lavender": "230,230,250", 9613 "lawngreen": "124,252,0", 9614 "lemonchiffon": "255,250,205", 9615 "lightblue": "173,216,230", 9616 "lightcoral": "240,128,128", 9617 "lightcyan": "224,255,255", 9618 "lightgoldenrodyellow": "250,250,210", 9619 "lightgray": "211,211,211", 9620 "lightgrey": "211,211,211", 9621 "lightgreen": "144,238,144", 9622 "lightpink": "255,182,193", 9623 "lightsalmon": "255,160,122", 9624 "lightseagreen": "32,178,170", 9625 "lightskyblue": "135,206,250", 9626 "lightslategray": "119,136,153", 9627 "lightsteelblue": "176,196,222", 9628 "lightyellow": "255,255,224", 9629 "limegreen": "50,205,50", 9630 "lime": "0,255,0", 9631 "linen": "250,240,230", 9632 "magenta": "255,0,255", 9633 "maroon": "128,0,0", 9634 "mediumaquamarine": "102,205,170", 9635 "mediumblue": "0,0,205", 9636 "mediumorchid": "186,85,211", 9637 "mediumpurple": "147,112,219", 9638 "mediumseagreen": "60,179,113", 9639 "mediumslateblue": "123,104,238", 9640 "mediumspringgreen": "0,250,154", 9641 "mediumturquoise": "72,209,204", 9642 "mediumvioletred": "199,21,133", 9643 "midnightblue": "25,25,112", 9644 "mintcream": "245,255,250", 9645 "mistyrose": "255,228,225", 9646 "moccasin": "255,228,181", 9647 "navajowhite": "255,222,173", 9648 "navy": "0,0,128", 9649 "oldlace": "253,245,230", 9650 "olivedrab": "107,142,35", 9651 "olive": "128,128,0", 9652 "orangered": "255,69,0", 9653 "orange": "255,165,0", 9654 "orchid": "218,112,214", 9655 "palegoldenrod": "238,232,170", 9656 "palegreen": "152,251,152", 9657 "paleturquoise": "175,238,238", 9658 "palevioletred": "219,112,147", 9659 "papayawhip": "255,239,213", 9660 "peachpuff": "255,218,185", 9661 "peru": "205,133,63", 9662 "pink": "255,192,203", 9663 "plum": "221,160,221", 9664 "powderblue": "176,224,230", 9665 "purple": "128,0,128", 9666 "red": "255,0,0", 9667 "rosybrown": "188,143,143", 9668 "royalblue": "65,105,225", 9669 "saddlebrown": "139,69,19", 9670 "salmon": "250,128,114", 9671 "sandybrown": "244,164,96", 9672 "seagreen": "46,139,87", 9673 "seashell": "255,245,238", 9674 "sienna": "160,82,45", 9675 "silver": "192,192,192", 9676 "skyblue": "135,206,235", 9677 "slateblue": "106,90,205", 9678 "slategray": "112,128,144", 9679 "snow": "255,250,250", 9680 "springgreen": "0,255,127", 9681 "steelblue": "70,130,180", 9682 "tan": "210,180,140", 9683 "teal": "0,128,128", 9684 "thistle": "216,191,216", 9685 "tomato": "255,99,71", 9686 "turquoise": "64,224,208", 9687 "violet": "238,130,238", 9688 "wheat": "245,222,179", 9689 "whitesmoke": "245,245,245", 9690 "white": "255,255,255", 9691 "yellowgreen": "154,205,50", 9692 "yellow": "255,255,0" 9693 } 9694 }, 9695 /************ 9696 Hooks 9697 ************/ 9698 9699 /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property 9700 (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ 9701 /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only 9702 tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ 9703 Hooks: { 9704 /******************** 9705 Registration 9706 ********************/ 9707 9708 /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ 9709 /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ 9710 templates: { 9711 "textShadow": ["Color X Y Blur", "black 0px 0px 0px"], 9712 "boxShadow": ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], 9713 "clip": ["Top Right Bottom Left", "0px 0px 0px 0px"], 9714 "backgroundPosition": ["X Y", "0% 0%"], 9715 "transformOrigin": ["X Y Z", "50% 50% 0px"], 9716 "perspectiveOrigin": ["X Y", "50% 50%"] 9717 }, 9718 /* A "registered" hook is one that has been converted from its template form into a live, 9719 tweenable property. It contains data to associate it with its root property. */ 9720 registered: { 9721 /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], 9722 which consists of the subproperty's name, the associated root property's name, 9723 and the subproperty's position in the root's value. */ 9724 }, 9725 /* Convert the templates into individual hooks then append them to the registered object above. */ 9726 register: function() { 9727 /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are 9728 currently set to "transparent" default to their respective template below when color-animated, 9729 and white is typically a closer match to transparent than black is. An exception is made for text ("color"), 9730 which is almost always set closer to black than white. */ 9731 for (var i = 0; i < CSS.Lists.colors.length; i++) { 9732 var rgbComponents = (CSS.Lists.colors[i] === "color") ? "0 0 0 1" : "255 255 255 1"; 9733 CSS.Hooks.templates[CSS.Lists.colors[i]] = ["Red Green Blue Alpha", rgbComponents]; 9734 } 9735 9736 var rootProperty, 9737 hookTemplate, 9738 hookNames; 9739 9740 /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. 9741 Thus, we re-arrange the templates accordingly. */ 9742 if (IE) { 9743 for (rootProperty in CSS.Hooks.templates) { 9744 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 9745 continue; 9746 } 9747 hookTemplate = CSS.Hooks.templates[rootProperty]; 9748 hookNames = hookTemplate[0].split(" "); 9749 9750 var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); 9751 9752 if (hookNames[0] === "Color") { 9753 /* Reposition both the hook's name and its default value to the end of their respective strings. */ 9754 hookNames.push(hookNames.shift()); 9755 defaultValues.push(defaultValues.shift()); 9756 9757 /* Replace the existing template for the hook's root property. */ 9758 CSS.Hooks.templates[rootProperty] = [hookNames.join(" "), defaultValues.join(" ")]; 9759 } 9760 } 9761 } 9762 9763 /* Hook registration. */ 9764 for (rootProperty in CSS.Hooks.templates) { 9765 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 9766 continue; 9767 } 9768 hookTemplate = CSS.Hooks.templates[rootProperty]; 9769 hookNames = hookTemplate[0].split(" "); 9770 9771 for (var j in hookNames) { 9772 if (!hookNames.hasOwnProperty(j)) { 9773 continue; 9774 } 9775 var fullHookName = rootProperty + hookNames[j], 9776 hookPosition = j; 9777 9778 /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) 9779 and the hook's position in its template's default value string. */ 9780 CSS.Hooks.registered[fullHookName] = [rootProperty, hookPosition]; 9781 } 9782 } 9783 }, 9784 /***************************** 9785 Injection and Extraction 9786 *****************************/ 9787 9788 /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ 9789 /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */ 9790 getRoot: function(property) { 9791 var hookData = CSS.Hooks.registered[property]; 9792 9793 if (hookData) { 9794 return hookData[0]; 9795 } else { 9796 /* If there was no hook match, return the property name untouched. */ 9797 return property; 9798 } 9799 }, 9800 getUnit: function(str, start) { 9801 var unit = (str.substr(start || 0, 5).match(/^[a-z%]+/) || [])[0] || ""; 9802 9803 if (unit && _inArray(CSS.Lists.units, unit)) { 9804 return unit; 9805 } 9806 return ""; 9807 }, 9808 fixColors: function(str) { 9809 return str.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g, function($0, $1, $2) { 9810 if (CSS.Lists.colorNames.hasOwnProperty($2)) { 9811 return ($1 ? $1 : "rgba(") + CSS.Lists.colorNames[$2] + ($1 ? "" : ",1)"); 9812 } 9813 return $1 + $2; 9814 }); 9815 }, 9816 /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that 9817 the targeted hook can be injected or extracted at its standard position. */ 9818 cleanRootPropertyValue: function(rootProperty, rootPropertyValue) { 9819 /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ 9820 if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { 9821 rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1]; 9822 } 9823 9824 /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), 9825 default to the root's default value as defined in CSS.Hooks.templates. */ 9826 /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their 9827 zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ 9828 if (CSS.Values.isCSSNullValue(rootPropertyValue)) { 9829 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 9830 } 9831 9832 return rootPropertyValue; 9833 }, 9834 /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ 9835 extractValue: function(fullHookName, rootPropertyValue) { 9836 var hookData = CSS.Hooks.registered[fullHookName]; 9837 9838 if (hookData) { 9839 var hookRoot = hookData[0], 9840 hookPosition = hookData[1]; 9841 9842 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 9843 9844 /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ 9845 return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; 9846 } else { 9847 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 9848 return rootPropertyValue; 9849 } 9850 }, 9851 /* Inject the hook's value into its root property's value. This is used to piece back together the root property 9852 once Velocity has updated one of its individually hooked values through tweening. */ 9853 injectValue: function(fullHookName, hookValue, rootPropertyValue) { 9854 var hookData = CSS.Hooks.registered[fullHookName]; 9855 9856 if (hookData) { 9857 var hookRoot = hookData[0], 9858 hookPosition = hookData[1], 9859 rootPropertyValueParts, 9860 rootPropertyValueUpdated; 9861 9862 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 9863 9864 /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, 9865 then reconstruct the rootPropertyValue string. */ 9866 rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); 9867 rootPropertyValueParts[hookPosition] = hookValue; 9868 rootPropertyValueUpdated = rootPropertyValueParts.join(" "); 9869 9870 return rootPropertyValueUpdated; 9871 } else { 9872 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 9873 return rootPropertyValue; 9874 } 9875 } 9876 }, 9877 /******************* 9878 Normalizations 9879 *******************/ 9880 9881 /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) 9882 and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ 9883 Normalizations: { 9884 /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), 9885 the targeted element (which may need to be queried), and the targeted property value. */ 9886 registered: { 9887 clip: function(type, element, propertyValue) { 9888 switch (type) { 9889 case "name": 9890 return "clip"; 9891 /* Clip needs to be unwrapped and stripped of its commas during extraction. */ 9892 case "extract": 9893 var extracted; 9894 9895 /* If Velocity also extracted this value, skip extraction. */ 9896 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 9897 extracted = propertyValue; 9898 } else { 9899 /* Remove the "rect()" wrapper. */ 9900 extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap); 9901 9902 /* Strip off commas. */ 9903 extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; 9904 } 9905 9906 return extracted; 9907 /* Clip needs to be re-wrapped during injection. */ 9908 case "inject": 9909 return "rect(" + propertyValue + ")"; 9910 } 9911 }, 9912 blur: function(type, element, propertyValue) { 9913 switch (type) { 9914 case "name": 9915 return Velocity.State.isFirefox ? "filter" : "-webkit-filter"; 9916 case "extract": 9917 var extracted = parseFloat(propertyValue); 9918 9919 /* If extracted is NaN, meaning the value isn't already extracted. */ 9920 if (!(extracted || extracted === 0)) { 9921 var blurComponent = propertyValue.toString().match(/blur\(([0-9]+[A-z]+)\)/i); 9922 9923 /* If the filter string had a blur component, return just the blur value and unit type. */ 9924 if (blurComponent) { 9925 extracted = blurComponent[1]; 9926 /* If the component doesn't exist, default blur to 0. */ 9927 } else { 9928 extracted = 0; 9929 } 9930 } 9931 9932 return extracted; 9933 /* Blur needs to be re-wrapped during injection. */ 9934 case "inject": 9935 /* For the blur effect to be fully de-applied, it needs to be set to "none" instead of 0. */ 9936 if (!parseFloat(propertyValue)) { 9937 return "none"; 9938 } else { 9939 return "blur(" + propertyValue + ")"; 9940 } 9941 } 9942 }, 9943 /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ 9944 opacity: function(type, element, propertyValue) { 9945 if (IE <= 8) { 9946 switch (type) { 9947 case "name": 9948 return "filter"; 9949 case "extract": 9950 /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". 9951 Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ 9952 var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); 9953 9954 if (extracted) { 9955 /* Convert to decimal value. */ 9956 propertyValue = extracted[1] / 100; 9957 } else { 9958 /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */ 9959 propertyValue = 1; 9960 } 9961 9962 return propertyValue; 9963 case "inject": 9964 /* Opacified elements are required to have their zoom property set to a non-zero value. */ 9965 element.style.zoom = 1; 9966 9967 /* Setting the filter property on elements with certain font property combinations can result in a 9968 highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the 9969 value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ 9970 if (parseFloat(propertyValue) >= 1) { 9971 return ""; 9972 } else { 9973 /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ 9974 return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; 9975 } 9976 } 9977 /* With all other browsers, normalization is not required; return the same values that were passed in. */ 9978 } else { 9979 switch (type) { 9980 case "name": 9981 return "opacity"; 9982 case "extract": 9983 return propertyValue; 9984 case "inject": 9985 return propertyValue; 9986 } 9987 } 9988 } 9989 }, 9990 /***************************** 9991 Batched Registrations 9992 *****************************/ 9993 9994 /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ 9995 register: function() { 9996 9997 /***************** 9998 Transforms 9999 *****************/ 10000 10001 /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization 10002 so that they can be referenced in a properties map by their individual names. */ 10003 /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform 10004 setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. 10005 Transform setting is batched in this way to improve performance: the transform style only needs to be updated 10006 once when multiple transform subproperties are being animated simultaneously. */ 10007 /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported 10008 transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values 10009 from being normalized for these browsers so that tweening skips these properties altogether 10010 (since it will ignore them as being unsupported by the browser.) */ 10011 if ((!IE || IE > 9) && !Velocity.State.isGingerbread) { 10012 /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty 10013 share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ 10014 CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D); 10015 } 10016 10017 for (var i = 0; i < CSS.Lists.transformsBase.length; i++) { 10018 /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is 10019 paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ 10020 (function() { 10021 var transformName = CSS.Lists.transformsBase[i]; 10022 10023 CSS.Normalizations.registered[transformName] = function(type, element, propertyValue) { 10024 switch (type) { 10025 /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ 10026 case "name": 10027 return "transform"; 10028 /* Transform values are cached onto a per-element transformCache object. */ 10029 case "extract": 10030 /* If this transform has yet to be assigned a value, return its null value. */ 10031 if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) { 10032 /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */ 10033 return /^scale/i.test(transformName) ? 1 : 0; 10034 /* When transform values are set, they are wrapped in parentheses as per the CSS spec. 10035 Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ 10036 } 10037 return Data(element).transformCache[transformName].replace(/[()]/g, ""); 10038 case "inject": 10039 var invalid = false; 10040 10041 /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. 10042 Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ 10043 /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ 10044 switch (transformName.substr(0, transformName.length - 1)) { 10045 /* Whitelist unit types for each transform. */ 10046 case "translate": 10047 invalid = !/(%|px|em|rem|vw|vh|\d)$/i.test(propertyValue); 10048 break; 10049 /* Since an axis-free "scale" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */ 10050 case "scal": 10051 case "scale": 10052 /* Chrome on Android has a bug in which scaled elements blur if their initial scale 10053 value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property 10054 and ensure that its first value is always 1. More info: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */ 10055 if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) { 10056 propertyValue = 1; 10057 } 10058 10059 invalid = !/(\d)$/i.test(propertyValue); 10060 break; 10061 case "skew": 10062 invalid = !/(deg|\d)$/i.test(propertyValue); 10063 break; 10064 case "rotate": 10065 invalid = !/(deg|\d)$/i.test(propertyValue); 10066 break; 10067 } 10068 10069 if (!invalid) { 10070 /* As per the CSS spec, wrap the value in parentheses. */ 10071 Data(element).transformCache[transformName] = "(" + propertyValue + ")"; 10072 } 10073 10074 /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ 10075 return Data(element).transformCache[transformName]; 10076 } 10077 }; 10078 })(); 10079 } 10080 10081 /************* 10082 Colors 10083 *************/ 10084 10085 /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. 10086 Accordingly, color values must be normalized (e.g. "#ff0000", "red", and "rgb(255, 0, 0)" ==> "255 0 0 1") so that their components can be injected/extracted by CSS.Hooks logic. */ 10087 for (var j = 0; j < CSS.Lists.colors.length; j++) { 10088 /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. 10089 (Otherwise, all functions would take the final for loop's colorName.) */ 10090 (function() { 10091 var colorName = CSS.Lists.colors[j]; 10092 10093 /* Note: In IE<=8, which support rgb but not rgba, color properties are reverted to rgb by stripping off the alpha component. */ 10094 CSS.Normalizations.registered[colorName] = function(type, element, propertyValue) { 10095 switch (type) { 10096 case "name": 10097 return colorName; 10098 /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ 10099 case "extract": 10100 var extracted; 10101 10102 /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ 10103 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 10104 extracted = propertyValue; 10105 } else { 10106 var converted, 10107 colorNames = { 10108 black: "rgb(0, 0, 0)", 10109 blue: "rgb(0, 0, 255)", 10110 gray: "rgb(128, 128, 128)", 10111 green: "rgb(0, 128, 0)", 10112 red: "rgb(255, 0, 0)", 10113 white: "rgb(255, 255, 255)" 10114 }; 10115 10116 /* Convert color names to rgb. */ 10117 if (/^[A-z]+$/i.test(propertyValue)) { 10118 if (colorNames[propertyValue] !== undefined) { 10119 converted = colorNames[propertyValue]; 10120 } else { 10121 /* If an unmatched color name is provided, default to black. */ 10122 converted = colorNames.black; 10123 } 10124 /* Convert hex values to rgb. */ 10125 } else if (CSS.RegEx.isHex.test(propertyValue)) { 10126 converted = "rgb(" + CSS.Values.hexToRgb(propertyValue).join(" ") + ")"; 10127 /* If the provided color doesn't match any of the accepted color formats, default to black. */ 10128 } else if (!(/^rgba?\(/i.test(propertyValue))) { 10129 converted = colorNames.black; 10130 } 10131 10132 /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip 10133 repeated spaces (in case the value included spaces to begin with). */ 10134 extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); 10135 } 10136 10137 /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 10138 if ((!IE || IE > 8) && extracted.split(" ").length === 3) { 10139 extracted += " 1"; 10140 } 10141 10142 return extracted; 10143 case "inject": 10144 /* If we have a pattern then it might already have the right values */ 10145 if (/^rgb/.test(propertyValue)) { 10146 return propertyValue; 10147 } 10148 10149 /* If this is IE<=8 and an alpha component exists, strip it off. */ 10150 if (IE <= 8) { 10151 if (propertyValue.split(" ").length === 4) { 10152 propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); 10153 } 10154 /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 10155 } else if (propertyValue.split(" ").length === 3) { 10156 propertyValue += " 1"; 10157 } 10158 10159 /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units 10160 on all values but the fourth (R, G, and B only accept whole numbers). */ 10161 return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; 10162 } 10163 }; 10164 })(); 10165 } 10166 10167 /************** 10168 Dimensions 10169 **************/ 10170 function augmentDimension(name, element, wantInner) { 10171 var isBorderBox = CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() === "border-box"; 10172 10173 if (isBorderBox === (wantInner || false)) { 10174 /* in box-sizing mode, the CSS width / height accessors already give the outerWidth / outerHeight. */ 10175 var i, 10176 value, 10177 augment = 0, 10178 sides = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"], 10179 fields = ["padding" + sides[0], "padding" + sides[1], "border" + sides[0] + "Width", "border" + sides[1] + "Width"]; 10180 10181 for (i = 0; i < fields.length; i++) { 10182 value = parseFloat(CSS.getPropertyValue(element, fields[i])); 10183 if (!isNaN(value)) { 10184 augment += value; 10185 } 10186 } 10187 return wantInner ? -augment : augment; 10188 } 10189 return 0; 10190 } 10191 function getDimension(name, wantInner) { 10192 return function(type, element, propertyValue) { 10193 switch (type) { 10194 case "name": 10195 return name; 10196 case "extract": 10197 return parseFloat(propertyValue) + augmentDimension(name, element, wantInner); 10198 case "inject": 10199 return (parseFloat(propertyValue) - augmentDimension(name, element, wantInner)) + "px"; 10200 } 10201 }; 10202 } 10203 CSS.Normalizations.registered.innerWidth = getDimension("width", true); 10204 CSS.Normalizations.registered.innerHeight = getDimension("height", true); 10205 CSS.Normalizations.registered.outerWidth = getDimension("width"); 10206 CSS.Normalizations.registered.outerHeight = getDimension("height"); 10207 } 10208 }, 10209 /************************ 10210 CSS Property Names 10211 ************************/ 10212 10213 Names: { 10214 /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). 10215 Camelcasing is used to normalize property names between and across calls. */ 10216 camelCase: function(property) { 10217 return property.replace(/-(\w)/g, function(match, subMatch) { 10218 return subMatch.toUpperCase(); 10219 }); 10220 }, 10221 /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */ 10222 SVGAttribute: function(property) { 10223 var SVGAttributes = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; 10224 10225 /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */ 10226 if (IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) { 10227 SVGAttributes += "|transform"; 10228 } 10229 10230 return new RegExp("^(" + SVGAttributes + ")$", "i").test(property); 10231 }, 10232 /* Determine whether a property should be set with a vendor prefix. */ 10233 /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. 10234 If the property is not at all supported by the browser, return a false flag. */ 10235 prefixCheck: function(property) { 10236 /* If this property has already been checked, return the cached value. */ 10237 if (Velocity.State.prefixMatches[property]) { 10238 return [Velocity.State.prefixMatches[property], true]; 10239 } else { 10240 var vendors = ["", "Webkit", "Moz", "ms", "O"]; 10241 10242 for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { 10243 var propertyPrefixed; 10244 10245 if (i === 0) { 10246 propertyPrefixed = property; 10247 } else { 10248 /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ 10249 propertyPrefixed = vendors[i] + property.replace(/^\w/, function(match) { 10250 return match.toUpperCase(); 10251 }); 10252 } 10253 10254 /* Check if the browser supports this property as prefixed. */ 10255 if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) { 10256 /* Cache the match. */ 10257 Velocity.State.prefixMatches[property] = propertyPrefixed; 10258 10259 return [propertyPrefixed, true]; 10260 } 10261 } 10262 10263 /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ 10264 return [property, false]; 10265 } 10266 } 10267 }, 10268 /************************ 10269 CSS Property Values 10270 ************************/ 10271 10272 Values: { 10273 /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ 10274 hexToRgb: function(hex) { 10275 var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, 10276 longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, 10277 rgbParts; 10278 10279 hex = hex.replace(shortformRegex, function(m, r, g, b) { 10280 return r + r + g + g + b + b; 10281 }); 10282 10283 rgbParts = longformRegex.exec(hex); 10284 10285 return rgbParts ? [parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16)] : [0, 0, 0]; 10286 }, 10287 isCSSNullValue: function(value) { 10288 /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. 10289 Thus, we check for both falsiness and these special strings. */ 10290 /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook 10291 templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ 10292 /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ 10293 return (!value || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value)); 10294 }, 10295 /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ 10296 getUnitType: function(property) { 10297 if (/^(rotate|skew)/i.test(property)) { 10298 return "deg"; 10299 } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) { 10300 /* The above properties are unitless. */ 10301 return ""; 10302 } else { 10303 /* Default to px for all other properties. */ 10304 return "px"; 10305 } 10306 }, 10307 /* HTML elements default to an associated display type when they're not set to display:none. */ 10308 /* Note: This function is used for correctly setting the non-"none" display value in certain Velocity redirects, such as fadeIn/Out. */ 10309 getDisplayType: function(element) { 10310 var tagName = element && element.tagName.toString().toLowerCase(); 10311 10312 if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) { 10313 return "inline"; 10314 } else if (/^(li)$/i.test(tagName)) { 10315 return "list-item"; 10316 } else if (/^(tr)$/i.test(tagName)) { 10317 return "table-row"; 10318 } else if (/^(table)$/i.test(tagName)) { 10319 return "table"; 10320 } else if (/^(tbody)$/i.test(tagName)) { 10321 return "table-row-group"; 10322 /* Default to "block" when no match is found. */ 10323 } else { 10324 return "block"; 10325 } 10326 }, 10327 /* The class add/remove functions are used to temporarily apply a "velocity-animating" class to elements while they're animating. */ 10328 addClass: function(element, className) { 10329 if (element) { 10330 if (element.classList) { 10331 element.classList.add(className); 10332 } else if (Type.isString(element.className)) { 10333 // Element.className is around 15% faster then set/getAttribute 10334 element.className += (element.className.length ? " " : "") + className; 10335 } else { 10336 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 10337 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 10338 10339 element.setAttribute("class", currentClass + (currentClass ? " " : "") + className); 10340 } 10341 } 10342 }, 10343 removeClass: function(element, className) { 10344 if (element) { 10345 if (element.classList) { 10346 element.classList.remove(className); 10347 } else if (Type.isString(element.className)) { 10348 // Element.className is around 15% faster then set/getAttribute 10349 // TODO: Need some jsperf tests on performance - can we get rid of the regex and maybe use split / array manipulation? 10350 element.className = element.className.toString().replace(new RegExp("(^|\\s)" + className.split(" ").join("|") + "(\\s|$)", "gi"), " "); 10351 } else { 10352 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 10353 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 10354 10355 element.setAttribute("class", currentClass.replace(new RegExp("(^|\s)" + className.split(" ").join("|") + "(\s|$)", "gi"), " ")); 10356 } 10357 } 10358 } 10359 }, 10360 /**************************** 10361 Style Getting & Setting 10362 ****************************/ 10363 10364 /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 10365 getPropertyValue: function(element, property, rootPropertyValue, forceStyleLookup) { 10366 /* Get an element's computed property value. */ 10367 /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's 10368 style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's 10369 *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 10370 function computePropertyValue(element, property) { 10371 /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an 10372 element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate 10373 offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. 10374 We subtract border and padding to get the sum of interior + scrollbar. */ 10375 var computedValue = 0; 10376 10377 /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array 10378 of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the 10379 codebase for a dying browser. The performance repercussions of using jQuery here are minimal since 10380 Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ 10381 if (IE <= 8) { 10382 computedValue = $.css(element, property); /* GET */ 10383 /* All other browsers support getComputedStyle. The returned live object reference is cached onto its 10384 associated element so that it does not need to be refetched upon every GET. */ 10385 } else { 10386 /* Browsers do not return height and width values for elements that are set to display:"none". Thus, we temporarily 10387 toggle display to the element type's default value. */ 10388 var toggleDisplay = false; 10389 10390 if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, "display") === 0) { 10391 toggleDisplay = true; 10392 CSS.setPropertyValue(element, "display", CSS.Values.getDisplayType(element)); 10393 } 10394 10395 var revertDisplay = function() { 10396 if (toggleDisplay) { 10397 CSS.setPropertyValue(element, "display", "none"); 10398 } 10399 }; 10400 10401 if (!forceStyleLookup) { 10402 if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 10403 var contentBoxHeight = element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, "borderTopWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderBottomWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingTop")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingBottom")) || 0); 10404 revertDisplay(); 10405 10406 return contentBoxHeight; 10407 } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 10408 var contentBoxWidth = element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, "borderLeftWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderRightWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingRight")) || 0); 10409 revertDisplay(); 10410 10411 return contentBoxWidth; 10412 } 10413 } 10414 10415 var computedStyle; 10416 10417 /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf 10418 of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ 10419 if (Data(element) === undefined) { 10420 computedStyle = window.getComputedStyle(element, null); /* GET */ 10421 /* If the computedStyle object has yet to be cached, do so now. */ 10422 } else if (!Data(element).computedStyle) { 10423 computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null); /* GET */ 10424 /* If computedStyle is cached, use it. */ 10425 } else { 10426 computedStyle = Data(element).computedStyle; 10427 } 10428 10429 /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. 10430 Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse. 10431 So, as a polyfill for querying individual border side colors, we just return the top border's color and animate all borders from that value. */ 10432 if (property === "borderColor") { 10433 property = "borderTopColor"; 10434 } 10435 10436 /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method 10437 instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ 10438 if (IE === 9 && property === "filter") { 10439 computedValue = computedStyle.getPropertyValue(property); /* GET */ 10440 } else { 10441 computedValue = computedStyle[property]; 10442 } 10443 10444 /* Fall back to the property's style value (if defined) when computedValue returns nothing, 10445 which can happen when the element hasn't been painted. */ 10446 if (computedValue === "" || computedValue === null) { 10447 computedValue = element.style[property]; 10448 } 10449 10450 revertDisplay(); 10451 } 10452 10453 /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, 10454 defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same 10455 effect as being set to 0, so no conversion is necessary.) */ 10456 /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" 10457 property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative 10458 to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ 10459 if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { 10460 var position = computePropertyValue(element, "position"); /* GET */ 10461 10462 /* For absolute positioning, jQuery's $.position() only returns values for top and left; 10463 right and bottom will have their "auto" value reverted to 0. */ 10464 /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). 10465 Not a big deal since we're currently in a GET batch anyway. */ 10466 if (position === "fixed" || (position === "absolute" && /top|left/i.test(property))) { 10467 /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ 10468 computedValue = $(element).position()[property] + "px"; /* GET */ 10469 } 10470 } 10471 10472 return computedValue; 10473 } 10474 10475 var propertyValue; 10476 10477 /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), 10478 extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ 10479 if (CSS.Hooks.registered[property]) { 10480 var hook = property, 10481 hookRoot = CSS.Hooks.getRoot(hook); 10482 10483 /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), 10484 query the DOM for the root property's value. */ 10485 if (rootPropertyValue === undefined) { 10486 /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ 10487 rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ 10488 } 10489 10490 /* If this root has a normalization registered, peform the associated normalization extraction. */ 10491 if (CSS.Normalizations.registered[hookRoot]) { 10492 rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); 10493 } 10494 10495 /* Extract the hook's value. */ 10496 propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); 10497 10498 /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), 10499 normalize the property's name and value, and handle the special case of transforms. */ 10500 /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly 10501 numerical and therefore do not require normalization extraction. */ 10502 } else if (CSS.Normalizations.registered[property]) { 10503 var normalizedPropertyName, 10504 normalizedPropertyValue; 10505 10506 normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); 10507 10508 /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. 10509 At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. 10510 This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; 10511 thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ 10512 if (normalizedPropertyName !== "transform") { 10513 normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ 10514 10515 /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */ 10516 if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { 10517 normalizedPropertyValue = CSS.Hooks.templates[property][1]; 10518 } 10519 } 10520 10521 propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); 10522 } 10523 10524 /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */ 10525 if (!/^[\d-]/.test(propertyValue)) { 10526 /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via 10527 their HTML attribute values instead of their CSS style values. */ 10528 var data = Data(element); 10529 10530 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 10531 /* Since the height/width attribute values must be set manually, they don't reflect computed values. 10532 Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */ 10533 if (/^(height|width)$/i.test(property)) { 10534 /* Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. */ 10535 try { 10536 propertyValue = element.getBBox()[property]; 10537 } catch (error) { 10538 propertyValue = 0; 10539 } 10540 /* Otherwise, access the attribute value directly. */ 10541 } else { 10542 propertyValue = element.getAttribute(property); 10543 } 10544 } else { 10545 propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ 10546 } 10547 } 10548 10549 /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), 10550 convert CSS null-values to an integer of value 0. */ 10551 if (CSS.Values.isCSSNullValue(propertyValue)) { 10552 propertyValue = 0; 10553 } 10554 10555 if (Velocity.debug >= 2) { 10556 console.log("Get " + property + ": " + propertyValue); 10557 } 10558 10559 return propertyValue; 10560 }, 10561 /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 10562 setPropertyValue: function(element, property, propertyValue, rootPropertyValue, scrollData) { 10563 var propertyName = property; 10564 10565 /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */ 10566 if (property === "scroll") { 10567 /* If a container option is present, scroll the container instead of the browser window. */ 10568 if (scrollData.container) { 10569 scrollData.container["scroll" + scrollData.direction] = propertyValue; 10570 /* Otherwise, Velocity defaults to scrolling the browser window. */ 10571 } else { 10572 if (scrollData.direction === "Left") { 10573 window.scrollTo(propertyValue, scrollData.alternateValue); 10574 } else { 10575 window.scrollTo(scrollData.alternateValue, propertyValue); 10576 } 10577 } 10578 } else { 10579 /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). 10580 Thus, for now, we merely cache transforms being SET. */ 10581 if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { 10582 /* Perform a normalization injection. */ 10583 /* Note: The normalization logic handles the transformCache updating. */ 10584 CSS.Normalizations.registered[property]("inject", element, propertyValue); 10585 10586 propertyName = "transform"; 10587 propertyValue = Data(element).transformCache[property]; 10588 } else { 10589 /* Inject hooks. */ 10590 if (CSS.Hooks.registered[property]) { 10591 var hookName = property, 10592 hookRoot = CSS.Hooks.getRoot(property); 10593 10594 /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ 10595 rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ 10596 10597 propertyValue = CSS.Hooks.injectValue(hookName, propertyValue, rootPropertyValue); 10598 property = hookRoot; 10599 } 10600 10601 /* Normalize names and values. */ 10602 if (CSS.Normalizations.registered[property]) { 10603 propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); 10604 property = CSS.Normalizations.registered[property]("name", element); 10605 } 10606 10607 /* Assign the appropriate vendor prefix before performing an official style update. */ 10608 propertyName = CSS.Names.prefixCheck(property)[0]; 10609 10610 /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. 10611 Try/catch is avoided for other browsers since it incurs a performance overhead. */ 10612 if (IE <= 8) { 10613 try { 10614 element.style[propertyName] = propertyValue; 10615 } catch (error) { 10616 if (Velocity.debug) { 10617 console.log("Browser does not support [" + propertyValue + "] for [" + propertyName + "]"); 10618 } 10619 } 10620 /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */ 10621 /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */ 10622 } else { 10623 var data = Data(element); 10624 10625 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 10626 /* Note: For SVG attributes, vendor-prefixed property names are never used. */ 10627 /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */ 10628 element.setAttribute(property, propertyValue); 10629 } else { 10630 element.style[propertyName] = propertyValue; 10631 } 10632 } 10633 10634 if (Velocity.debug >= 2) { 10635 console.log("Set " + property + " (" + propertyName + "): " + propertyValue); 10636 } 10637 } 10638 } 10639 10640 /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */ 10641 return [propertyName, propertyValue]; 10642 }, 10643 /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ 10644 /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */ 10645 flushTransformCache: function(element) { 10646 var transformString = "", 10647 data = Data(element); 10648 10649 /* Certain browsers require that SVG transforms be applied as an attribute. However, the SVG transform attribute takes a modified version of CSS's transform string 10650 (units are dropped and, except for skewX/Y, subproperties are merged into their master property -- e.g. scaleX and scaleY are merged into scale(X Y). */ 10651 if ((IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) && data && data.isSVG) { 10652 /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values. 10653 Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */ 10654 var getTransformFloat = function(transformProperty) { 10655 return parseFloat(CSS.getPropertyValue(element, transformProperty)); 10656 }; 10657 10658 /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple, 10659 we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */ 10660 var SVGTransforms = { 10661 translate: [getTransformFloat("translateX"), getTransformFloat("translateY")], 10662 skewX: [getTransformFloat("skewX")], skewY: [getTransformFloat("skewY")], 10663 /* If the scale property is set (non-1), use that value for the scaleX and scaleY values 10664 (this behavior mimics the result of animating all these properties at once on HTML elements). */ 10665 scale: getTransformFloat("scale") !== 1 ? [getTransformFloat("scale"), getTransformFloat("scale")] : [getTransformFloat("scaleX"), getTransformFloat("scaleY")], 10666 /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values 10667 defining the rotation's origin point. We ignore the origin values (default them to 0). */ 10668 rotate: [getTransformFloat("rotateZ"), 0, 0] 10669 }; 10670 10671 /* Iterate through the transform properties in the user-defined property map order. 10672 (This mimics the behavior of non-SVG transform animation.) */ 10673 $.each(Data(element).transformCache, function(transformName) { 10674 /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master 10675 properties so that they match up with SVG's accepted transform properties. */ 10676 if (/^translate/i.test(transformName)) { 10677 transformName = "translate"; 10678 } else if (/^scale/i.test(transformName)) { 10679 transformName = "scale"; 10680 } else if (/^rotate/i.test(transformName)) { 10681 transformName = "rotate"; 10682 } 10683 10684 /* Check that we haven't yet deleted the property from the SVGTransforms container. */ 10685 if (SVGTransforms[transformName]) { 10686 /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */ 10687 transformString += transformName + "(" + SVGTransforms[transformName].join(" ") + ")" + " "; 10688 10689 /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't 10690 re-insert the same master property if we encounter another one of its axis-specific properties. */ 10691 delete SVGTransforms[transformName]; 10692 } 10693 }); 10694 } else { 10695 var transformValue, 10696 perspective; 10697 10698 /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ 10699 $.each(Data(element).transformCache, function(transformName) { 10700 transformValue = Data(element).transformCache[transformName]; 10701 10702 /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */ 10703 if (transformName === "transformPerspective") { 10704 perspective = transformValue; 10705 return true; 10706 } 10707 10708 /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ 10709 if (IE === 9 && transformName === "rotateZ") { 10710 transformName = "rotate"; 10711 } 10712 10713 transformString += transformName + transformValue + " "; 10714 }); 10715 10716 /* If present, set the perspective subproperty first. */ 10717 if (perspective) { 10718 transformString = "perspective" + perspective + " " + transformString; 10719 } 10720 } 10721 10722 CSS.setPropertyValue(element, "transform", transformString); 10723 } 10724 }; 10725 10726 /* Register hooks and normalizations. */ 10727 CSS.Hooks.register(); 10728 CSS.Normalizations.register(); 10729 10730 /* Allow hook setting in the same fashion as jQuery's $.css(). */ 10731 Velocity.hook = function(elements, arg2, arg3) { 10732 var value; 10733 10734 elements = sanitizeElements(elements); 10735 10736 $.each(elements, function(i, element) { 10737 /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ 10738 if (Data(element) === undefined) { 10739 Velocity.init(element); 10740 } 10741 10742 /* Get property value. If an element set was passed in, only return the value for the first element. */ 10743 if (arg3 === undefined) { 10744 if (value === undefined) { 10745 value = CSS.getPropertyValue(element, arg2); 10746 } 10747 /* Set property value. */ 10748 } else { 10749 /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ 10750 var adjustedSet = CSS.setPropertyValue(element, arg2, arg3); 10751 10752 /* Transform properties don't automatically set. They have to be flushed to the DOM. */ 10753 if (adjustedSet[0] === "transform") { 10754 Velocity.CSS.flushTransformCache(element); 10755 } 10756 10757 value = adjustedSet; 10758 } 10759 }); 10760 10761 return value; 10762 }; 10763 10764 /***************** 10765 Animation 10766 *****************/ 10767 10768 var animate = function() { 10769 var opts; 10770 10771 /****************** 10772 Call Chain 10773 ******************/ 10774 10775 /* Logic for determining what to return to the call stack when exiting out of Velocity. */ 10776 function getChain() { 10777 /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected, 10778 default to null instead of returning the targeted elements so that utility function's return value is standardized. */ 10779 if (isUtility) { 10780 return promiseData.promise || null; 10781 /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */ 10782 } else { 10783 return elementsWrapped; 10784 } 10785 } 10786 10787 /************************* 10788 Arguments Assignment 10789 *************************/ 10790 10791 /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "elements" (or "e"), "properties" (or "p"), and "options" (or "o") 10792 objects are defined on a container object that's passed in as Velocity's sole argument. */ 10793 /* Note: Some browsers automatically populate arguments with a "properties" object. We detect it by checking for its default "names" property. */ 10794 var syntacticSugar = (arguments[0] && (arguments[0].p || (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties)))), 10795 /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ 10796 isUtility, 10797 /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly 10798 passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ 10799 elementsWrapped, 10800 argumentIndex; 10801 10802 var elements, 10803 propertiesMap, 10804 options; 10805 10806 /* Detect jQuery/Zepto elements being animated via the $.fn method. */ 10807 if (Type.isWrapped(this)) { 10808 isUtility = false; 10809 10810 argumentIndex = 0; 10811 elements = this; 10812 elementsWrapped = this; 10813 /* Otherwise, raw elements are being animated via the utility function. */ 10814 } else { 10815 isUtility = true; 10816 10817 argumentIndex = 1; 10818 elements = syntacticSugar ? (arguments[0].elements || arguments[0].e) : arguments[0]; 10819 } 10820 10821 /*************** 10822 Promises 10823 ***************/ 10824 10825 var promiseData = { 10826 promise: null, 10827 resolver: null, 10828 rejecter: null 10829 }; 10830 10831 /* If this call was made via the utility function (which is the default method of invocation when jQuery/Zepto are not being used), and if 10832 promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve 10833 method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated 10834 call cleanup and promise resolving logic. The reject method is used when an invalid set of arguments is passed into a Velocity call. */ 10835 /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that 10836 triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are 10837 grouped together for the purposes of resolving and rejecting a promise. */ 10838 if (isUtility && Velocity.Promise) { 10839 promiseData.promise = new Velocity.Promise(function(resolve, reject) { 10840 promiseData.resolver = resolve; 10841 promiseData.rejecter = reject; 10842 }); 10843 } 10844 10845 if (syntacticSugar) { 10846 propertiesMap = arguments[0].properties || arguments[0].p; 10847 options = arguments[0].options || arguments[0].o; 10848 } else { 10849 propertiesMap = arguments[argumentIndex]; 10850 options = arguments[argumentIndex + 1]; 10851 } 10852 10853 elements = sanitizeElements(elements); 10854 10855 if (!elements) { 10856 if (promiseData.promise) { 10857 if (!propertiesMap || !options || options.promiseRejectEmpty !== false) { 10858 promiseData.rejecter(); 10859 } else { 10860 promiseData.resolver(); 10861 } 10862 } 10863 return; 10864 } 10865 10866 /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a 10867 single raw DOM element is passed in (which doesn't contain a length property). */ 10868 var elementsLength = elements.length, 10869 elementsIndex = 0; 10870 10871 /*************************** 10872 Argument Overloading 10873 ***************************/ 10874 10875 /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). 10876 Overloading is detected by checking for the absence of an object being passed into options. */ 10877 /* Note: The stop/finish/pause/resume actions do not accept animation options, and are therefore excluded from this check. */ 10878 if (!/^(stop|finish|finishAll|pause|resume)$/i.test(propertiesMap) && !$.isPlainObject(options)) { 10879 /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ 10880 var startingArgumentPosition = argumentIndex + 1; 10881 10882 options = {}; 10883 10884 /* Iterate through all options arguments */ 10885 for (var i = startingArgumentPosition; i < arguments.length; i++) { 10886 /* Treat a number as a duration. Parse it out. */ 10887 /* Note: The following RegEx will return true if passed an array with a number as its first item. 10888 Thus, arrays are skipped from this check. */ 10889 if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\d/.test(arguments[i]))) { 10890 options.duration = arguments[i]; 10891 /* Treat strings and arrays as easings. */ 10892 } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) { 10893 options.easing = arguments[i]; 10894 /* Treat a function as a complete callback. */ 10895 } else if (Type.isFunction(arguments[i])) { 10896 options.complete = arguments[i]; 10897 } 10898 } 10899 } 10900 10901 /********************* 10902 Action Detection 10903 *********************/ 10904 10905 /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, 10906 or they can be started, stopped, paused, resumed, or reversed . If a literal or referenced properties map is passed in as Velocity's 10907 first argument, the associated action is "start". Alternatively, "scroll", "reverse", "pause", "resume" or "stop" can be passed in 10908 instead of a properties map. */ 10909 var action; 10910 10911 switch (propertiesMap) { 10912 case "scroll": 10913 action = "scroll"; 10914 break; 10915 10916 case "reverse": 10917 action = "reverse"; 10918 break; 10919 10920 case "pause": 10921 10922 /******************* 10923 Action: Pause 10924 *******************/ 10925 10926 var currentTime = (new Date()).getTime(); 10927 10928 /* Handle delay timers */ 10929 $.each(elements, function(i, element) { 10930 pauseDelayOnElement(element, currentTime); 10931 }); 10932 10933 /* Pause and Resume are call-wide (not on a per element basis). Thus, calling pause or resume on a 10934 single element will cause any calls that containt tweens for that element to be paused/resumed 10935 as well. */ 10936 10937 /* Iterate through all calls and pause any that contain any of our elements */ 10938 $.each(Velocity.State.calls, function(i, activeCall) { 10939 10940 var found = false; 10941 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 10942 if (activeCall) { 10943 /* Iterate through the active call's targeted elements. */ 10944 $.each(activeCall[1], function(k, activeElement) { 10945 var queueName = (options === undefined) ? "" : options; 10946 10947 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 10948 return true; 10949 } 10950 10951 /* Iterate through the calls targeted by the stop command. */ 10952 $.each(elements, function(l, element) { 10953 /* Check that this call was applied to the target element. */ 10954 if (element === activeElement) { 10955 10956 /* Set call to paused */ 10957 activeCall[5] = { 10958 resume: false 10959 }; 10960 10961 /* Once we match an element, we can bounce out to the next call entirely */ 10962 found = true; 10963 return false; 10964 } 10965 }); 10966 10967 /* Proceed to check next call if we have already matched */ 10968 if (found) { 10969 return false; 10970 } 10971 }); 10972 } 10973 10974 }); 10975 10976 /* Since pause creates no new tweens, exit out of Velocity. */ 10977 return getChain(); 10978 10979 case "resume": 10980 10981 /******************* 10982 Action: Resume 10983 *******************/ 10984 10985 /* Handle delay timers */ 10986 $.each(elements, function(i, element) { 10987 resumeDelayOnElement(element, currentTime); 10988 }); 10989 10990 /* Pause and Resume are call-wide (not on a per elemnt basis). Thus, calling pause or resume on a 10991 single element will cause any calls that containt tweens for that element to be paused/resumed 10992 as well. */ 10993 10994 /* Iterate through all calls and pause any that contain any of our elements */ 10995 $.each(Velocity.State.calls, function(i, activeCall) { 10996 var found = false; 10997 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 10998 if (activeCall) { 10999 /* Iterate through the active call's targeted elements. */ 11000 $.each(activeCall[1], function(k, activeElement) { 11001 var queueName = (options === undefined) ? "" : options; 11002 11003 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 11004 return true; 11005 } 11006 11007 /* Skip any calls that have never been paused */ 11008 if (!activeCall[5]) { 11009 return true; 11010 } 11011 11012 /* Iterate through the calls targeted by the stop command. */ 11013 $.each(elements, function(l, element) { 11014 /* Check that this call was applied to the target element. */ 11015 if (element === activeElement) { 11016 11017 /* Flag a pause object to be resumed, which will occur during the next tick. In 11018 addition, the pause object will at that time be deleted */ 11019 activeCall[5].resume = true; 11020 11021 /* Once we match an element, we can bounce out to the next call entirely */ 11022 found = true; 11023 return false; 11024 } 11025 }); 11026 11027 /* Proceed to check next call if we have already matched */ 11028 if (found) { 11029 return false; 11030 } 11031 }); 11032 } 11033 11034 }); 11035 11036 /* Since resume creates no new tweens, exit out of Velocity. */ 11037 return getChain(); 11038 11039 case "finish": 11040 case "finishAll": 11041 case "stop": 11042 /******************* 11043 Action: Stop 11044 *******************/ 11045 11046 /* Clear the currently-active delay on each targeted element. */ 11047 $.each(elements, function(i, element) { 11048 if (Data(element) && Data(element).delayTimer) { 11049 /* Stop the timer from triggering its cached next() function. */ 11050 clearTimeout(Data(element).delayTimer.setTimeout); 11051 11052 /* Manually call the next() function so that the subsequent queue items can progress. */ 11053 if (Data(element).delayTimer.next) { 11054 Data(element).delayTimer.next(); 11055 } 11056 11057 delete Data(element).delayTimer; 11058 } 11059 11060 /* If we want to finish everything in the queue, we have to iterate through it 11061 and call each function. This will make them active calls below, which will 11062 cause them to be applied via the duration setting. */ 11063 if (propertiesMap === "finishAll" && (options === true || Type.isString(options))) { 11064 /* Iterate through the items in the element's queue. */ 11065 $.each($.queue(element, Type.isString(options) ? options : ""), function(_, item) { 11066 /* The queue array can contain an "inprogress" string, which we skip. */ 11067 if (Type.isFunction(item)) { 11068 item(); 11069 } 11070 }); 11071 11072 /* Clearing the $.queue() array is achieved by resetting it to []. */ 11073 $.queue(element, Type.isString(options) ? options : "", []); 11074 } 11075 }); 11076 11077 var callsToStop = []; 11078 11079 /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have 11080 been applied to multiple elements, in which case all of the call's elements will be stopped. When an element 11081 is stopped, the next item in its animation queue is immediately triggered. */ 11082 /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) 11083 or a custom queue string can be passed in. */ 11084 /* Note: The stop command runs prior to Velocity's Queueing phase since its behavior is intended to take effect *immediately*, 11085 regardless of the element's current queue state. */ 11086 11087 /* Iterate through every active call. */ 11088 $.each(Velocity.State.calls, function(i, activeCall) { 11089 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 11090 if (activeCall) { 11091 /* Iterate through the active call's targeted elements. */ 11092 $.each(activeCall[1], function(k, activeElement) { 11093 /* If true was passed in as a secondary argument, clear absolutely all calls on this element. Otherwise, only 11094 clear calls associated with the relevant queue. */ 11095 /* Call stopping logic works as follows: 11096 - options === true --> stop current default queue calls (and queue:false calls), including remaining queued ones. 11097 - options === undefined --> stop current queue:"" call and all queue:false calls. 11098 - options === false --> stop only queue:false calls. 11099 - options === "custom" --> stop current queue:"custom" call, including remaining queued ones (there is no functionality to only clear the currently-running queue:"custom" call). */ 11100 var queueName = (options === undefined) ? "" : options; 11101 11102 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 11103 return true; 11104 } 11105 11106 /* Iterate through the calls targeted by the stop command. */ 11107 $.each(elements, function(l, element) { 11108 /* Check that this call was applied to the target element. */ 11109 if (element === activeElement) { 11110 /* Optionally clear the remaining queued calls. If we're doing "finishAll" this won't find anything, 11111 due to the queue-clearing above. */ 11112 if (options === true || Type.isString(options)) { 11113 /* Iterate through the items in the element's queue. */ 11114 $.each($.queue(element, Type.isString(options) ? options : ""), function(_, item) { 11115 /* The queue array can contain an "inprogress" string, which we skip. */ 11116 if (Type.isFunction(item)) { 11117 /* Pass the item's callback a flag indicating that we want to abort from the queue call. 11118 (Specifically, the queue will resolve the call's associated promise then abort.) */ 11119 item(null, true); 11120 } 11121 }); 11122 11123 /* Clearing the $.queue() array is achieved by resetting it to []. */ 11124 $.queue(element, Type.isString(options) ? options : "", []); 11125 } 11126 11127 if (propertiesMap === "stop") { 11128 /* Since "reverse" uses cached start values (the previous call's endValues), these values must be 11129 changed to reflect the final value that the elements were actually tweened to. */ 11130 /* Note: If only queue:false animations are currently running on an element, it won't have a tweensContainer 11131 object. Also, queue:false animations can't be reversed. */ 11132 var data = Data(element); 11133 if (data && data.tweensContainer && queueName !== false) { 11134 $.each(data.tweensContainer, function(m, activeTween) { 11135 activeTween.endValue = activeTween.currentValue; 11136 }); 11137 } 11138 11139 callsToStop.push(i); 11140 } else if (propertiesMap === "finish" || propertiesMap === "finishAll") { 11141 /* To get active tweens to finish immediately, we forcefully shorten their durations to 1ms so that 11142 they finish upon the next rAf tick then proceed with normal call completion logic. */ 11143 activeCall[2].duration = 1; 11144 } 11145 } 11146 }); 11147 }); 11148 } 11149 }); 11150 11151 /* Prematurely call completeCall() on each matched active call. Pass an additional flag for "stop" to indicate 11152 that the complete callback and display:none setting should be skipped since we're completing prematurely. */ 11153 if (propertiesMap === "stop") { 11154 $.each(callsToStop, function(i, j) { 11155 completeCall(j, true); 11156 }); 11157 11158 if (promiseData.promise) { 11159 /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */ 11160 promiseData.resolver(elements); 11161 } 11162 } 11163 11164 /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */ 11165 return getChain(); 11166 11167 default: 11168 /* Treat a non-empty plain object as a literal properties map. */ 11169 if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) { 11170 action = "start"; 11171 11172 /**************** 11173 Redirects 11174 ****************/ 11175 11176 /* Check if a string matches a registered redirect (see Redirects above). */ 11177 } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) { 11178 opts = $.extend({}, options); 11179 11180 var durationOriginal = opts.duration, 11181 delayOriginal = opts.delay || 0; 11182 11183 /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */ 11184 if (opts.backwards === true) { 11185 elements = $.extend(true, [], elements).reverse(); 11186 } 11187 11188 /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */ 11189 $.each(elements, function(elementIndex, element) { 11190 /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */ 11191 if (parseFloat(opts.stagger)) { 11192 opts.delay = delayOriginal + (parseFloat(opts.stagger) * elementIndex); 11193 } else if (Type.isFunction(opts.stagger)) { 11194 opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength); 11195 } 11196 11197 /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards) 11198 the duration of each element's animation, using floors to prevent producing very short durations. */ 11199 if (opts.drag) { 11200 /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ 11201 opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); 11202 11203 /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, 11204 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). 11205 The end result is a baseline of 75% of the redirect's duration that increases/decreases as the end of the element set is approached. */ 11206 opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex / elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200); 11207 } 11208 11209 /* Pass in the call's opts object so that the redirect can optionally extend it. It defaults to an empty object instead of null to 11210 reduce the opts checking logic required inside the redirect. */ 11211 Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined); 11212 }); 11213 11214 /* Since the animation logic resides within the redirect's own code, abort the remainder of this call. 11215 (The performance overhead up to this point is virtually non-existant.) */ 11216 /* Note: The jQuery call chain is kept intact by returning the complete element set. */ 11217 return getChain(); 11218 } else { 11219 var abortError = "Velocity: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."; 11220 11221 if (promiseData.promise) { 11222 promiseData.rejecter(new Error(abortError)); 11223 } else if (window.console) { 11224 console.log(abortError); 11225 } 11226 11227 return getChain(); 11228 } 11229 } 11230 11231 /************************** 11232 Call-Wide Variables 11233 **************************/ 11234 11235 /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements 11236 being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore 11237 avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale 11238 conversion metrics across Velocity animations that are not immediately consecutively chained. */ 11239 var callUnitConversionData = { 11240 lastParent: null, 11241 lastPosition: null, 11242 lastFontSize: null, 11243 lastPercentToPxWidth: null, 11244 lastPercentToPxHeight: null, 11245 lastEmToPx: null, 11246 remToPx: null, 11247 vwToPx: null, 11248 vhToPx: null 11249 }; 11250 11251 /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide 11252 Velocity.State.calls array that is processed during animation ticking. */ 11253 var call = []; 11254 11255 /************************ 11256 Element Processing 11257 ************************/ 11258 11259 /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications): 11260 1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed. 11261 2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. 11262 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 11263 `elementArrayIndex` allows passing index of the element in the original array to value functions. 11264 If `elementsIndex` were used instead the index would be determined by the elements' per-element queue. 11265 */ 11266 function processElement(element, elementArrayIndex) { 11267 11268 /************************* 11269 Part I: Pre-Queueing 11270 *************************/ 11271 11272 /*************************** 11273 Element-Wide Variables 11274 ***************************/ 11275 11276 var /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ 11277 opts = $.extend({}, Velocity.defaults, options), 11278 /* A container for the processed data associated with each property in the propertyMap. 11279 (Each property in the map produces its own "tween".) */ 11280 tweensContainer = {}, 11281 elementUnitConversionData; 11282 11283 /****************** 11284 Element Init 11285 ******************/ 11286 11287 if (Data(element) === undefined) { 11288 Velocity.init(element); 11289 } 11290 11291 /****************** 11292 Option: Delay 11293 ******************/ 11294 11295 /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ 11296 /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() 11297 (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ 11298 if (parseFloat(opts.delay) && opts.queue !== false) { 11299 $.queue(element, opts.queue, function(next) { 11300 /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ 11301 Velocity.velocityQueueEntryFlag = true; 11302 11303 /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. 11304 The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's "stop" command, and 11305 delayBegin/delayTime is used to ensure we can "pause" and "resume" a tween that is still mid-delay. */ 11306 11307 /* Temporarily store delayed elements to facilite access for global pause/resume */ 11308 var callIndex = Velocity.State.delayedElements.count++; 11309 Velocity.State.delayedElements[callIndex] = element; 11310 11311 var delayComplete = (function(index) { 11312 return function() { 11313 /* Clear the temporary element */ 11314 Velocity.State.delayedElements[index] = false; 11315 11316 /* Finally, issue the call */ 11317 next(); 11318 }; 11319 })(callIndex); 11320 11321 11322 Data(element).delayBegin = (new Date()).getTime(); 11323 Data(element).delay = parseFloat(opts.delay); 11324 Data(element).delayTimer = { 11325 setTimeout: setTimeout(next, parseFloat(opts.delay)), 11326 next: delayComplete 11327 }; 11328 }); 11329 } 11330 11331 /********************* 11332 Option: Duration 11333 *********************/ 11334 11335 /* Support for jQuery's named durations. */ 11336 switch (opts.duration.toString().toLowerCase()) { 11337 case "fast": 11338 opts.duration = 200; 11339 break; 11340 11341 case "normal": 11342 opts.duration = DURATION_DEFAULT; 11343 break; 11344 11345 case "slow": 11346 opts.duration = 600; 11347 break; 11348 11349 default: 11350 /* Remove the potential "ms" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */ 11351 opts.duration = parseFloat(opts.duration) || 1; 11352 } 11353 11354 /************************ 11355 Global Option: Mock 11356 ************************/ 11357 11358 if (Velocity.mock !== false) { 11359 /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick. 11360 Alternatively, a multiplier can be passed in to time remap all delays and durations. */ 11361 if (Velocity.mock === true) { 11362 opts.duration = opts.delay = 1; 11363 } else { 11364 opts.duration *= parseFloat(Velocity.mock) || 1; 11365 opts.delay *= parseFloat(Velocity.mock) || 1; 11366 } 11367 } 11368 11369 /******************* 11370 Option: Easing 11371 *******************/ 11372 11373 opts.easing = getEasing(opts.easing, opts.duration); 11374 11375 /********************** 11376 Option: Callbacks 11377 **********************/ 11378 11379 /* Callbacks must functions. Otherwise, default to null. */ 11380 if (opts.begin && !Type.isFunction(opts.begin)) { 11381 opts.begin = null; 11382 } 11383 11384 if (opts.progress && !Type.isFunction(opts.progress)) { 11385 opts.progress = null; 11386 } 11387 11388 if (opts.complete && !Type.isFunction(opts.complete)) { 11389 opts.complete = null; 11390 } 11391 11392 /********************************* 11393 Option: Display & Visibility 11394 *********************************/ 11395 11396 /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ 11397 /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ 11398 if (opts.display !== undefined && opts.display !== null) { 11399 opts.display = opts.display.toString().toLowerCase(); 11400 11401 /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ 11402 if (opts.display === "auto") { 11403 opts.display = Velocity.CSS.Values.getDisplayType(element); 11404 } 11405 } 11406 11407 if (opts.visibility !== undefined && opts.visibility !== null) { 11408 opts.visibility = opts.visibility.toString().toLowerCase(); 11409 } 11410 11411 /********************** 11412 Option: mobileHA 11413 **********************/ 11414 11415 /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) 11416 on animating elements. HA is removed from the element at the completion of its animation. */ 11417 /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ 11418 /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ 11419 opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread); 11420 11421 /*********************** 11422 Part II: Queueing 11423 ***********************/ 11424 11425 /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it. 11426 In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */ 11427 /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed, 11428 the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ 11429 function buildQueue(next) { 11430 var data, lastTweensContainer; 11431 11432 /******************* 11433 Option: Begin 11434 *******************/ 11435 11436 /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ 11437 if (opts.begin && elementsIndex === 0) { 11438 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 11439 try { 11440 opts.begin.call(elements, elements); 11441 } catch (error) { 11442 setTimeout(function() { 11443 throw error; 11444 }, 1); 11445 } 11446 } 11447 11448 /***************************************** 11449 Tween Data Construction (for Scroll) 11450 *****************************************/ 11451 11452 /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */ 11453 if (action === "scroll") { 11454 /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ 11455 var scrollDirection = (/^x$/i.test(opts.axis) ? "Left" : "Top"), 11456 scrollOffset = parseFloat(opts.offset) || 0, 11457 scrollPositionCurrent, 11458 scrollPositionCurrentAlternate, 11459 scrollPositionEnd; 11460 11461 /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- 11462 as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ 11463 if (opts.container) { 11464 /* Ensure that either a jQuery object or a raw DOM element was passed in. */ 11465 if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) { 11466 /* Extract the raw DOM element from the jQuery wrapper. */ 11467 opts.container = opts.container[0] || opts.container; 11468 /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes 11469 (due to the user's natural interaction with the page). */ 11470 scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ 11471 11472 /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions 11473 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* 11474 the scroll container's current scroll position. */ 11475 scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset; /* GET */ 11476 /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */ 11477 } else { 11478 opts.container = null; 11479 } 11480 } else { 11481 /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using 11482 the appropriate cached property names (which differ based on browser type). */ 11483 scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ 11484 /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */ 11485 scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ 11486 11487 /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- 11488 and therefore end values do not need to be compounded onto current values. */ 11489 scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 11490 } 11491 11492 /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ 11493 tweensContainer = { 11494 scroll: { 11495 rootPropertyValue: false, 11496 startValue: scrollPositionCurrent, 11497 currentValue: scrollPositionCurrent, 11498 endValue: scrollPositionEnd, 11499 unitType: "", 11500 easing: opts.easing, 11501 scrollData: { 11502 container: opts.container, 11503 direction: scrollDirection, 11504 alternateValue: scrollPositionCurrentAlternate 11505 } 11506 }, 11507 element: element 11508 }; 11509 11510 if (Velocity.debug) { 11511 console.log("tweensContainer (scroll): ", tweensContainer.scroll, element); 11512 } 11513 11514 /****************************************** 11515 Tween Data Construction (for Reverse) 11516 ******************************************/ 11517 11518 /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is 11519 that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate 11520 the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */ 11521 /* Note: Reverse can be directly called via the "reverse" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */ 11522 /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; 11523 there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined 11524 as reverting to the element's values as they were prior to the previous *Velocity* call. */ 11525 } else if (action === "reverse") { 11526 data = Data(element); 11527 11528 /* Abort if there is no prior animation data to reverse to. */ 11529 if (!data) { 11530 return; 11531 } 11532 11533 if (!data.tweensContainer) { 11534 /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ 11535 $.dequeue(element, opts.queue); 11536 11537 return; 11538 } else { 11539 /********************* 11540 Options Parsing 11541 *********************/ 11542 11543 /* If the element was hidden via the display option in the previous call, 11544 revert display to "auto" prior to reversal so that the element is visible again. */ 11545 if (data.opts.display === "none") { 11546 data.opts.display = "auto"; 11547 } 11548 11549 if (data.opts.visibility === "hidden") { 11550 data.opts.visibility = "visible"; 11551 } 11552 11553 /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. 11554 Further, remove the previous call's callback options; typically, users do not want these to be refired. */ 11555 data.opts.loop = false; 11556 data.opts.begin = null; 11557 data.opts.complete = null; 11558 11559 /* Since we're extending an opts object that has already been extended with the defaults options object, 11560 we remove non-explicitly-defined properties that are auto-assigned values. */ 11561 if (!options.easing) { 11562 delete opts.easing; 11563 } 11564 11565 if (!options.duration) { 11566 delete opts.duration; 11567 } 11568 11569 /* The opts object used for reversal is an extension of the options object optionally passed into this 11570 reverse call plus the options used in the previous Velocity call. */ 11571 opts = $.extend({}, data.opts, opts); 11572 11573 /************************************* 11574 Tweens Container Reconstruction 11575 *************************************/ 11576 11577 /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ 11578 lastTweensContainer = $.extend(true, {}, data ? data.tweensContainer : null); 11579 11580 /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ 11581 for (var lastTween in lastTweensContainer) { 11582 /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ 11583 if (lastTweensContainer.hasOwnProperty(lastTween) && lastTween !== "element") { 11584 var lastStartValue = lastTweensContainer[lastTween].startValue; 11585 11586 lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; 11587 lastTweensContainer[lastTween].endValue = lastStartValue; 11588 11589 /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). 11590 Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. 11591 The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ 11592 if (!Type.isEmptyObject(options)) { 11593 lastTweensContainer[lastTween].easing = opts.easing; 11594 } 11595 11596 if (Velocity.debug) { 11597 console.log("reverse tweensContainer (" + lastTween + "): " + JSON.stringify(lastTweensContainer[lastTween]), element); 11598 } 11599 } 11600 } 11601 11602 tweensContainer = lastTweensContainer; 11603 } 11604 11605 /***************************************** 11606 Tween Data Construction (for Start) 11607 *****************************************/ 11608 11609 } else if (action === "start") { 11610 11611 /************************* 11612 Value Transferring 11613 *************************/ 11614 11615 /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created 11616 while the element was in the process of being animated by Velocity, then this current call is safe to use 11617 the end values from the prior call as its start values. Velocity attempts to perform this value transfer 11618 process whenever possible in order to avoid requerying the DOM. */ 11619 /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), 11620 then the DOM is queried for the element's current values as a last resort. */ 11621 /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ 11622 11623 data = Data(element); 11624 11625 /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) 11626 to transfer over end values to use as start values. If it's set to true and there is a previous 11627 Velocity call to pull values from, do so. */ 11628 if (data && data.tweensContainer && data.isAnimating === true) { 11629 lastTweensContainer = data.tweensContainer; 11630 } 11631 11632 /*************************** 11633 Tween Data Calculation 11634 ***************************/ 11635 11636 /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ 11637 /* Property map values can either take the form of 1) a single value representing the end value, 11638 or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. 11639 The optional third parameter is a forcefed startValue to be used instead of querying the DOM for 11640 the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ 11641 var parsePropertyValue = function(valueData, skipResolvingEasing) { 11642 var endValue, easing, startValue; 11643 11644 /* If we have a function as the main argument then resolve it first, in case it returns an array that needs to be split */ 11645 if (Type.isFunction(valueData)) { 11646 valueData = valueData.call(element, elementArrayIndex, elementsLength); 11647 } 11648 11649 /* Handle the array format, which can be structured as one of three potential overloads: 11650 A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ 11651 if (Type.isArray(valueData)) { 11652 /* endValue is always the first item in the array. Don't bother validating endValue's value now 11653 since the ensuing property cycling logic does that. */ 11654 endValue = valueData[0]; 11655 11656 /* Two-item array format: If the second item is a number, function, or hex string, treat it as a 11657 start value since easings can only be non-hex strings or arrays. */ 11658 if ((!Type.isArray(valueData[1]) && /^[\d-]/.test(valueData[1])) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) { 11659 startValue = valueData[1]; 11660 /* Two or three-item array: If the second item is a non-hex string easing name or an array, treat it as an easing. */ 11661 } else if ((Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1]) && Velocity.Easings[valueData[1]]) || Type.isArray(valueData[1])) { 11662 easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration); 11663 11664 /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ 11665 startValue = valueData[2]; 11666 } else { 11667 startValue = valueData[1] || valueData[2]; 11668 } 11669 /* Handle the single-value format. */ 11670 } else { 11671 endValue = valueData; 11672 } 11673 11674 /* Default to the call's easing if a per-property easing type was not defined. */ 11675 if (!skipResolvingEasing) { 11676 easing = easing || opts.easing; 11677 } 11678 11679 /* If functions were passed in as values, pass the function the current element as its context, 11680 plus the element's index and the element set's size as arguments. Then, assign the returned value. */ 11681 if (Type.isFunction(endValue)) { 11682 endValue = endValue.call(element, elementArrayIndex, elementsLength); 11683 } 11684 11685 if (Type.isFunction(startValue)) { 11686 startValue = startValue.call(element, elementArrayIndex, elementsLength); 11687 } 11688 11689 /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ 11690 return [endValue || 0, easing, startValue]; 11691 }; 11692 11693 var fixPropertyValue = function(property, valueData) { 11694 /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */ 11695 var rootProperty = CSS.Hooks.getRoot(property), 11696 rootPropertyValue = false, 11697 /* Parse out endValue, easing, and startValue from the property's data. */ 11698 endValue = valueData[0], 11699 easing = valueData[1], 11700 startValue = valueData[2], 11701 pattern; 11702 11703 /************************** 11704 Start Value Sourcing 11705 **************************/ 11706 11707 /* Other than for the dummy tween property, properties that are not supported by the browser (and do not have an associated normalization) will 11708 inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. 11709 Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ 11710 /* Note: Since SVG elements have some of their properties directly applied as HTML attributes, 11711 there is no way to check for their explicit browser support, and so we skip skip this check for them. */ 11712 if ((!data || !data.isSVG) && rootProperty !== "tween" && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { 11713 if (Velocity.debug) { 11714 console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); 11715 } 11716 return; 11717 } 11718 11719 /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being 11720 animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity 11721 a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ 11722 if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility !== undefined && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { 11723 startValue = 0; 11724 } 11725 11726 /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue 11727 for all of the current call's properties that were *also* animated in the previous call. */ 11728 /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ 11729 if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { 11730 if (startValue === undefined) { 11731 startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; 11732 } 11733 11734 /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the 11735 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue 11736 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ 11737 rootPropertyValue = data.rootPropertyValueCache[rootProperty]; 11738 /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ 11739 } else { 11740 /* Handle hooked properties. */ 11741 if (CSS.Hooks.registered[property]) { 11742 if (startValue === undefined) { 11743 rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ 11744 /* Note: The following getPropertyValue() call does not actually trigger a DOM query; 11745 getPropertyValue() will extract the hook from rootPropertyValue. */ 11746 startValue = CSS.getPropertyValue(element, property, rootPropertyValue); 11747 /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; 11748 just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual 11749 root property value (if one is set), but this is acceptable since the primary reason users forcefeed is 11750 to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ 11751 } else { 11752 /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ 11753 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 11754 } 11755 /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ 11756 } else if (startValue === undefined) { 11757 startValue = CSS.getPropertyValue(element, property); /* GET */ 11758 } 11759 } 11760 11761 /************************** 11762 Value Data Extraction 11763 **************************/ 11764 11765 var separatedValue, 11766 endValueUnitType, 11767 startValueUnitType, 11768 operator = false; 11769 11770 /* Separates a property value into its numeric value and its unit type. */ 11771 var separateValue = function(property, value) { 11772 var unitType, 11773 numericValue; 11774 11775 numericValue = (value || "0") 11776 .toString() 11777 .toLowerCase() 11778 /* Match the unit type at the end of the value. */ 11779 .replace(/[%A-z]+$/, function(match) { 11780 /* Grab the unit type. */ 11781 unitType = match; 11782 11783 /* Strip the unit type off of value. */ 11784 return ""; 11785 }); 11786 11787 /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ 11788 if (!unitType) { 11789 unitType = CSS.Values.getUnitType(property); 11790 } 11791 11792 return [numericValue, unitType]; 11793 }; 11794 11795 if (startValue !== endValue && Type.isString(startValue) && Type.isString(endValue)) { 11796 pattern = ""; 11797 var iStart = 0, // index in startValue 11798 iEnd = 0, // index in endValue 11799 aStart = [], // array of startValue numbers 11800 aEnd = [], // array of endValue numbers 11801 inCalc = 0, // Keep track of being inside a "calc()" so we don't duplicate it 11802 inRGB = 0, // Keep track of being inside an RGB as we can't use fractional values 11803 inRGBA = 0; // Keep track of being inside an RGBA as we must pass fractional for the alpha channel 11804 11805 startValue = CSS.Hooks.fixColors(startValue); 11806 endValue = CSS.Hooks.fixColors(endValue); 11807 while (iStart < startValue.length && iEnd < endValue.length) { 11808 var cStart = startValue[iStart], 11809 cEnd = endValue[iEnd]; 11810 11811 if (/[\d\.-]/.test(cStart) && /[\d\.-]/.test(cEnd)) { 11812 var tStart = cStart, // temporary character buffer 11813 tEnd = cEnd, // temporary character buffer 11814 dotStart = ".", // Make sure we can only ever match a single dot in a decimal 11815 dotEnd = "."; // Make sure we can only ever match a single dot in a decimal 11816 11817 while (++iStart < startValue.length) { 11818 cStart = startValue[iStart]; 11819 if (cStart === dotStart) { 11820 dotStart = ".."; // Can never match two characters 11821 } else if (!/\d/.test(cStart)) { 11822 break; 11823 } 11824 tStart += cStart; 11825 } 11826 while (++iEnd < endValue.length) { 11827 cEnd = endValue[iEnd]; 11828 if (cEnd === dotEnd) { 11829 dotEnd = ".."; // Can never match two characters 11830 } else if (!/\d/.test(cEnd)) { 11831 break; 11832 } 11833 tEnd += cEnd; 11834 } 11835 var uStart = CSS.Hooks.getUnit(startValue, iStart), // temporary unit type 11836 uEnd = CSS.Hooks.getUnit(endValue, iEnd); // temporary unit type 11837 11838 iStart += uStart.length; 11839 iEnd += uEnd.length; 11840 if (uStart === uEnd) { 11841 // Same units 11842 if (tStart === tEnd) { 11843 // Same numbers, so just copy over 11844 pattern += tStart + uStart; 11845 } else { 11846 // Different numbers, so store them 11847 pattern += "{" + aStart.length + (inRGB ? "!" : "") + "}" + uStart; 11848 aStart.push(parseFloat(tStart)); 11849 aEnd.push(parseFloat(tEnd)); 11850 } 11851 } else { 11852 // Different units, so put into a "calc(from + to)" and animate each side to/from zero 11853 var nStart = parseFloat(tStart), 11854 nEnd = parseFloat(tEnd); 11855 11856 pattern += (inCalc < 5 ? "calc" : "") + "(" 11857 + (nStart ? "{" + aStart.length + (inRGB ? "!" : "") + "}" : "0") + uStart 11858 + " + " 11859 + (nEnd ? "{" + (aStart.length + (nStart ? 1 : 0)) + (inRGB ? "!" : "") + "}" : "0") + uEnd 11860 + ")"; 11861 if (nStart) { 11862 aStart.push(nStart); 11863 aEnd.push(0); 11864 } 11865 if (nEnd) { 11866 aStart.push(0); 11867 aEnd.push(nEnd); 11868 } 11869 } 11870 } else if (cStart === cEnd) { 11871 pattern += cStart; 11872 iStart++; 11873 iEnd++; 11874 // Keep track of being inside a calc() 11875 if (inCalc === 0 && cStart === "c" 11876 || inCalc === 1 && cStart === "a" 11877 || inCalc === 2 && cStart === "l" 11878 || inCalc === 3 && cStart === "c" 11879 || inCalc >= 4 && cStart === "(" 11880 ) { 11881 inCalc++; 11882 } else if ((inCalc && inCalc < 5) 11883 || inCalc >= 4 && cStart === ")" && --inCalc < 5) { 11884 inCalc = 0; 11885 } 11886 // Keep track of being inside an rgb() / rgba() 11887 if (inRGB === 0 && cStart === "r" 11888 || inRGB === 1 && cStart === "g" 11889 || inRGB === 2 && cStart === "b" 11890 || inRGB === 3 && cStart === "a" 11891 || inRGB >= 3 && cStart === "(" 11892 ) { 11893 if (inRGB === 3 && cStart === "a") { 11894 inRGBA = 1; 11895 } 11896 inRGB++; 11897 } else if (inRGBA && cStart === ",") { 11898 if (++inRGBA > 3) { 11899 inRGB = inRGBA = 0; 11900 } 11901 } else if ((inRGBA && inRGB < (inRGBA ? 5 : 4)) 11902 || inRGB >= (inRGBA ? 4 : 3) && cStart === ")" && --inRGB < (inRGBA ? 5 : 4)) { 11903 inRGB = inRGBA = 0; 11904 } 11905 } else { 11906 inCalc = 0; 11907 // TODO: changing units, fixing colours 11908 break; 11909 } 11910 } 11911 if (iStart !== startValue.length || iEnd !== endValue.length) { 11912 if (Velocity.debug) { 11913 console.error("Trying to pattern match mis-matched strings [\"" + endValue + "\", \"" + startValue + "\"]"); 11914 } 11915 pattern = undefined; 11916 } 11917 if (pattern) { 11918 if (aStart.length) { 11919 if (Velocity.debug) { 11920 console.log("Pattern found \"" + pattern + "\" -> ", aStart, aEnd, "[" + startValue + "," + endValue + "]"); 11921 } 11922 startValue = aStart; 11923 endValue = aEnd; 11924 endValueUnitType = startValueUnitType = ""; 11925 } else { 11926 pattern = undefined; 11927 } 11928 } 11929 } 11930 11931 if (!pattern) { 11932 /* Separate startValue. */ 11933 separatedValue = separateValue(property, startValue); 11934 startValue = separatedValue[0]; 11935 startValueUnitType = separatedValue[1]; 11936 11937 /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ 11938 separatedValue = separateValue(property, endValue); 11939 endValue = separatedValue[0].replace(/^([+-\/*])=/, function(match, subMatch) { 11940 operator = subMatch; 11941 11942 /* Strip the operator off of the value. */ 11943 return ""; 11944 }); 11945 endValueUnitType = separatedValue[1]; 11946 11947 /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ 11948 startValue = parseFloat(startValue) || 0; 11949 endValue = parseFloat(endValue) || 0; 11950 11951 /*************************************** 11952 Property-Specific Value Conversion 11953 ***************************************/ 11954 11955 /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ 11956 if (endValueUnitType === "%") { 11957 /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), 11958 which is identical to the em unit's behavior, so we piggyback off of that. */ 11959 if (/^(fontSize|lineHeight)$/.test(property)) { 11960 /* Convert % into an em decimal value. */ 11961 endValue = endValue / 100; 11962 endValueUnitType = "em"; 11963 /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ 11964 } else if (/^scale/.test(property)) { 11965 endValue = endValue / 100; 11966 endValueUnitType = ""; 11967 /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ 11968 } else if (/(Red|Green|Blue)$/i.test(property)) { 11969 endValue = (endValue / 100) * 255; 11970 endValueUnitType = ""; 11971 } 11972 } 11973 } 11974 11975 /*************************** 11976 Unit Ratio Calculation 11977 ***************************/ 11978 11979 /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of 11980 %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order 11981 for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred 11982 from a previous call, startValue may also not be in pixels. Unit conversion logic therefore consists of two steps: 11983 1) Calculating the ratio of %/em/rem/vh/vw relative to pixels 11984 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ 11985 /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property, 11986 setting values with the target unit type then comparing the returned pixel value. */ 11987 /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead 11988 of batching the SETs and GETs together upfront outweights the potential overhead 11989 of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ 11990 /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ 11991 var calculateUnitRatios = function() { 11992 11993 /************************ 11994 Same Ratio Checks 11995 ************************/ 11996 11997 /* The properties below are used to determine whether the element differs sufficiently from this call's 11998 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those 11999 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, 12000 this is done to minimize DOM querying. */ 12001 var sameRatioIndicators = { 12002 myParent: element.parentNode || document.body, /* GET */ 12003 position: CSS.getPropertyValue(element, "position"), /* GET */ 12004 fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ 12005 }, 12006 /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */ 12007 samePercentRatio = ((sameRatioIndicators.position === callUnitConversionData.lastPosition) && (sameRatioIndicators.myParent === callUnitConversionData.lastParent)), 12008 /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */ 12009 sameEmRatio = (sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize); 12010 12011 /* Store these ratio indicators call-wide for the next element to compare against. */ 12012 callUnitConversionData.lastParent = sameRatioIndicators.myParent; 12013 callUnitConversionData.lastPosition = sameRatioIndicators.position; 12014 callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize; 12015 12016 /*************************** 12017 Element-Specific Units 12018 ***************************/ 12019 12020 /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement 12021 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */ 12022 var measurement = 100, 12023 unitRatios = {}; 12024 12025 if (!sameEmRatio || !samePercentRatio) { 12026 var dummy = data && data.isSVG ? document.createElementNS("http://www.w3.org/2000/svg", "rect") : document.createElement("div"); 12027 12028 Velocity.init(dummy); 12029 sameRatioIndicators.myParent.appendChild(dummy); 12030 12031 /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped. 12032 Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */ 12033 /* Note: Overflow must be also be controlled for per-axis since the overflow property overwrites its per-axis values. */ 12034 $.each(["overflow", "overflowX", "overflowY"], function(i, property) { 12035 Velocity.CSS.setPropertyValue(dummy, property, "hidden"); 12036 }); 12037 Velocity.CSS.setPropertyValue(dummy, "position", sameRatioIndicators.position); 12038 Velocity.CSS.setPropertyValue(dummy, "fontSize", sameRatioIndicators.fontSize); 12039 Velocity.CSS.setPropertyValue(dummy, "boxSizing", "content-box"); 12040 12041 /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ 12042 $.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function(i, property) { 12043 Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); 12044 }); 12045 /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ 12046 Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); 12047 12048 /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ 12049 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ 12050 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, "height", null, true)) || 1) / measurement; /* GET */ 12051 unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, "paddingLeft")) || 1) / measurement; /* GET */ 12052 12053 sameRatioIndicators.myParent.removeChild(dummy); 12054 } else { 12055 unitRatios.emToPx = callUnitConversionData.lastEmToPx; 12056 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth; 12057 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight; 12058 } 12059 12060 /*************************** 12061 Element-Agnostic Units 12062 ***************************/ 12063 12064 /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked 12065 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time 12066 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null, 12067 so we calculate it now. */ 12068 if (callUnitConversionData.remToPx === null) { 12069 /* Default to browsers' default fontSize of 16px in the case of 0. */ 12070 callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ 12071 } 12072 12073 /* Similarly, viewport units are %-relative to the window's inner dimensions. */ 12074 if (callUnitConversionData.vwToPx === null) { 12075 callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100; /* GET */ 12076 callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100; /* GET */ 12077 } 12078 12079 unitRatios.remToPx = callUnitConversionData.remToPx; 12080 unitRatios.vwToPx = callUnitConversionData.vwToPx; 12081 unitRatios.vhToPx = callUnitConversionData.vhToPx; 12082 12083 if (Velocity.debug >= 1) { 12084 console.log("Unit ratios: " + JSON.stringify(unitRatios), element); 12085 } 12086 return unitRatios; 12087 }; 12088 12089 /******************** 12090 Unit Conversion 12091 ********************/ 12092 12093 /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ 12094 if (/[\/*]/.test(operator)) { 12095 endValueUnitType = startValueUnitType; 12096 /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType 12097 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depend 12098 on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio 12099 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ 12100 /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ 12101 } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) { 12102 /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */ 12103 /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively 12104 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility, 12105 which remains past the point of the animation's completion. */ 12106 if (endValue === 0) { 12107 endValueUnitType = startValueUnitType; 12108 } else { 12109 /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). 12110 If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ 12111 elementUnitConversionData = elementUnitConversionData || calculateUnitRatios(); 12112 12113 /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ 12114 /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element. */ 12115 var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === "x") ? "x" : "y"; 12116 12117 /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 12118 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ 12119 switch (startValueUnitType) { 12120 case "%": 12121 /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. 12122 Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value 12123 to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ 12124 startValue *= (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 12125 break; 12126 12127 case "px": 12128 /* px acts as our midpoint in the unit conversion process; do nothing. */ 12129 break; 12130 12131 default: 12132 startValue *= elementUnitConversionData[startValueUnitType + "ToPx"]; 12133 } 12134 12135 /* Invert the px ratios to convert into to the target unit. */ 12136 switch (endValueUnitType) { 12137 case "%": 12138 startValue *= 1 / (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 12139 break; 12140 12141 case "px": 12142 /* startValue is already in px, do nothing; we're done. */ 12143 break; 12144 12145 default: 12146 startValue *= 1 / elementUnitConversionData[endValueUnitType + "ToPx"]; 12147 } 12148 } 12149 } 12150 12151 /********************* 12152 Relative Values 12153 *********************/ 12154 12155 /* Operator logic must be performed last since it requires unit-normalized start and end values. */ 12156 /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" 12157 to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 12158 50 points is added on top of the current % value. */ 12159 switch (operator) { 12160 case "+": 12161 endValue = startValue + endValue; 12162 break; 12163 12164 case "-": 12165 endValue = startValue - endValue; 12166 break; 12167 12168 case "*": 12169 endValue = startValue * endValue; 12170 break; 12171 12172 case "/": 12173 endValue = startValue / endValue; 12174 break; 12175 } 12176 12177 /************************** 12178 tweensContainer Push 12179 **************************/ 12180 12181 /* Construct the per-property tween object, and push it to the element's tweensContainer. */ 12182 tweensContainer[property] = { 12183 rootPropertyValue: rootPropertyValue, 12184 startValue: startValue, 12185 currentValue: startValue, 12186 endValue: endValue, 12187 unitType: endValueUnitType, 12188 easing: easing 12189 }; 12190 if (pattern) { 12191 tweensContainer[property].pattern = pattern; 12192 } 12193 12194 if (Velocity.debug) { 12195 console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); 12196 } 12197 }; 12198 12199 /* Create a tween out of each property, and append its associated data to tweensContainer. */ 12200 for (var property in propertiesMap) { 12201 12202 if (!propertiesMap.hasOwnProperty(property)) { 12203 continue; 12204 } 12205 /* The original property name's format must be used for the parsePropertyValue() lookup, 12206 but we then use its camelCase styling to normalize it for manipulation. */ 12207 var propertyName = CSS.Names.camelCase(property), 12208 valueData = parsePropertyValue(propertiesMap[property]); 12209 12210 /* Find shorthand color properties that have been passed a hex string. */ 12211 /* Would be quicker to use CSS.Lists.colors.includes() if possible */ 12212 if (_inArray(CSS.Lists.colors, propertyName)) { 12213 /* Parse the value data for each shorthand. */ 12214 var endValue = valueData[0], 12215 easing = valueData[1], 12216 startValue = valueData[2]; 12217 12218 if (CSS.RegEx.isHex.test(endValue)) { 12219 /* Convert the hex strings into their RGB component arrays. */ 12220 var colorComponents = ["Red", "Green", "Blue"], 12221 endValueRGB = CSS.Values.hexToRgb(endValue), 12222 startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined; 12223 12224 /* Inject the RGB component tweens into propertiesMap. */ 12225 for (var i = 0; i < colorComponents.length; i++) { 12226 var dataArray = [endValueRGB[i]]; 12227 12228 if (easing) { 12229 dataArray.push(easing); 12230 } 12231 12232 if (startValueRGB !== undefined) { 12233 dataArray.push(startValueRGB[i]); 12234 } 12235 12236 fixPropertyValue(propertyName + colorComponents[i], dataArray); 12237 } 12238 /* If we have replaced a shortcut color value then don't update the standard property name */ 12239 continue; 12240 } 12241 } 12242 fixPropertyValue(propertyName, valueData); 12243 } 12244 12245 /* Along with its property data, store a reference to the element itself onto tweensContainer. */ 12246 tweensContainer.element = element; 12247 } 12248 12249 /***************** 12250 Call Push 12251 *****************/ 12252 12253 /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not 12254 being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */ 12255 if (tweensContainer.element) { 12256 /* Apply the "velocity-animating" indicator class. */ 12257 CSS.Values.addClass(element, "velocity-animating"); 12258 12259 /* The call array houses the tweensContainers for each element being animated in the current call. */ 12260 call.push(tweensContainer); 12261 12262 data = Data(element); 12263 12264 if (data) { 12265 /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */ 12266 if (opts.queue === "") { 12267 12268 data.tweensContainer = tweensContainer; 12269 data.opts = opts; 12270 } 12271 12272 /* Switch on the element's animating flag. */ 12273 data.isAnimating = true; 12274 } 12275 12276 /* Once the final element in this call's element set has been processed, push the call array onto 12277 Velocity.State.calls for the animation tick to immediately begin processing. */ 12278 if (elementsIndex === elementsLength - 1) { 12279 /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container. 12280 Anything on this call container is subjected to tick() processing. */ 12281 Velocity.State.calls.push([call, elements, opts, null, promiseData.resolver, null, 0]); 12282 12283 /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */ 12284 if (Velocity.State.isTicking === false) { 12285 Velocity.State.isTicking = true; 12286 12287 /* Start the tick loop. */ 12288 tick(); 12289 } 12290 } else { 12291 elementsIndex++; 12292 } 12293 } 12294 } 12295 12296 /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ 12297 if (opts.queue === false) { 12298 /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), 12299 we manually inject the delay property here with an explicit setTimeout. */ 12300 if (opts.delay) { 12301 12302 /* Temporarily store delayed elements to facilitate access for global pause/resume */ 12303 var callIndex = Velocity.State.delayedElements.count++; 12304 Velocity.State.delayedElements[callIndex] = element; 12305 12306 var delayComplete = (function(index) { 12307 return function() { 12308 /* Clear the temporary element */ 12309 Velocity.State.delayedElements[index] = false; 12310 12311 /* Finally, issue the call */ 12312 buildQueue(); 12313 }; 12314 })(callIndex); 12315 12316 Data(element).delayBegin = (new Date()).getTime(); 12317 Data(element).delay = parseFloat(opts.delay); 12318 Data(element).delayTimer = { 12319 setTimeout: setTimeout(buildQueue, parseFloat(opts.delay)), 12320 next: delayComplete 12321 }; 12322 } else { 12323 buildQueue(); 12324 } 12325 /* Otherwise, the call undergoes element queueing as normal. */ 12326 /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ 12327 } else { 12328 $.queue(element, opts.queue, function(next, clearQueue) { 12329 /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once, 12330 so it's fine if this is repeatedly triggered for each element in the associated call.) */ 12331 if (clearQueue === true) { 12332 if (promiseData.promise) { 12333 promiseData.resolver(elements); 12334 } 12335 12336 /* Do not continue with animation queueing. */ 12337 return true; 12338 } 12339 12340 /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity. 12341 See completeCall() for further details. */ 12342 Velocity.velocityQueueEntryFlag = true; 12343 12344 buildQueue(next); 12345 }); 12346 } 12347 12348 /********************* 12349 Auto-Dequeuing 12350 *********************/ 12351 12352 /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element 12353 must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking 12354 for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's 12355 queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's 12356 first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ 12357 /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until 12358 each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ 12359 /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. 12360 Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ 12361 if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { 12362 $.dequeue(element); 12363 } 12364 } 12365 12366 /************************** 12367 Element Set Iteration 12368 **************************/ 12369 12370 /* If the "nodeType" property exists on the elements variable, we're animating a single element. 12371 Place it in an array so that $.each() can iterate over it. */ 12372 $.each(elements, function(i, element) { 12373 /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */ 12374 if (Type.isNode(element)) { 12375 processElement(element, i); 12376 } 12377 }); 12378 12379 /****************** 12380 Option: Loop 12381 ******************/ 12382 12383 /* The loop option accepts an integer indicating how many times the element should loop between the values in the 12384 current call's properties map and the element's property values prior to this call. */ 12385 /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs 12386 to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, 12387 which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ 12388 opts = $.extend({}, Velocity.defaults, options); 12389 opts.loop = parseInt(opts.loop, 10); 12390 var reverseCallsCount = (opts.loop * 2) - 1; 12391 12392 if (opts.loop) { 12393 /* Double the loop count to convert it into its appropriate number of "reverse" calls. 12394 Subtract 1 from the resulting value since the current call is included in the total alternation count. */ 12395 for (var x = 0; x < reverseCallsCount; x++) { 12396 /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object 12397 isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse 12398 call so that the delay logic that occurs inside *Pre-Queueing* can process it. */ 12399 var reverseOptions = { 12400 delay: opts.delay, 12401 progress: opts.progress 12402 }; 12403 12404 /* If a complete callback was passed into this call, transfer it to the loop redirect's final "reverse" call 12405 so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */ 12406 if (x === reverseCallsCount - 1) { 12407 reverseOptions.display = opts.display; 12408 reverseOptions.visibility = opts.visibility; 12409 reverseOptions.complete = opts.complete; 12410 } 12411 12412 animate(elements, "reverse", reverseOptions); 12413 } 12414 } 12415 12416 /*************** 12417 Chaining 12418 ***************/ 12419 12420 /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ 12421 return getChain(); 12422 }; 12423 12424 /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ 12425 Velocity = $.extend(animate, Velocity); 12426 /* For legacy support, also expose the literal animate method. */ 12427 Velocity.animate = animate; 12428 12429 /************** 12430 Timing 12431 **************/ 12432 12433 /* Ticker function. */ 12434 var ticker = window.requestAnimationFrame || rAFShim; 12435 12436 /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses. 12437 To get around this, we dynamically switch rAF to setTimeout (which the browser *doesn't* pause) when the tab loses focus. We skip this for mobile 12438 devices to avoid wasting battery power on inactive tabs. */ 12439 /* Note: Tab focus detection doesn't work on older versions of IE, but that's okay since they don't support rAF to begin with. */ 12440 if (!Velocity.State.isMobile && document.hidden !== undefined) { 12441 var updateTicker = function() { 12442 /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */ 12443 if (document.hidden) { 12444 ticker = function(callback) { 12445 /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */ 12446 return setTimeout(function() { 12447 callback(true); 12448 }, 16); 12449 }; 12450 12451 /* The rAF loop has been paused by the browser, so we manually restart the tick. */ 12452 tick(); 12453 } else { 12454 ticker = window.requestAnimationFrame || rAFShim; 12455 } 12456 }; 12457 12458 /* Page could be sitting in the background at this time (i.e. opened as new tab) so making sure we use correct ticker from the start */ 12459 updateTicker(); 12460 12461 /* And then run check again every time visibility changes */ 12462 document.addEventListener("visibilitychange", updateTicker); 12463 } 12464 12465 /************ 12466 Tick 12467 ************/ 12468 12469 /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ 12470 function tick(timestamp) { 12471 /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. 12472 We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever 12473 the browser's next tick sync time occurs, which results in the first elements subjected to Velocity 12474 calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore 12475 the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated 12476 by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ 12477 if (timestamp) { 12478 /* We normally use RAF's high resolution timestamp but as it can be significantly offset when the browser is 12479 under high stress we give the option for choppiness over allowing the browser to drop huge chunks of frames. 12480 We use performance.now() and shim it if it doesn't exist for when the tab is hidden. */ 12481 var timeCurrent = Velocity.timestamp && timestamp !== true ? timestamp : performance.now(); 12482 12483 /******************** 12484 Call Iteration 12485 ********************/ 12486 12487 var callsLength = Velocity.State.calls.length; 12488 12489 /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) 12490 when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation 12491 has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ 12492 if (callsLength > 10000) { 12493 Velocity.State.calls = compactSparseArray(Velocity.State.calls); 12494 callsLength = Velocity.State.calls.length; 12495 } 12496 12497 /* Iterate through each active call. */ 12498 for (var i = 0; i < callsLength; i++) { 12499 /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */ 12500 if (!Velocity.State.calls[i]) { 12501 continue; 12502 } 12503 12504 /************************ 12505 Call-Wide Variables 12506 ************************/ 12507 12508 var callContainer = Velocity.State.calls[i], 12509 call = callContainer[0], 12510 opts = callContainer[2], 12511 timeStart = callContainer[3], 12512 firstTick = !!timeStart, 12513 tweenDummyValue = null, 12514 pauseObject = callContainer[5], 12515 millisecondsEllapsed = callContainer[6]; 12516 12517 12518 12519 /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). 12520 We assign timeStart now so that its value is as close to the real animation start time as possible. 12521 (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay 12522 between that time and now would cause the first few frames of the tween to be skipped since 12523 percentComplete is calculated relative to timeStart.) */ 12524 /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the 12525 first tick iteration isn't wasted by animating at 0% tween completion, which would produce the 12526 same style value as the element's current value. */ 12527 if (!timeStart) { 12528 timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; 12529 } 12530 12531 /* If a pause object is present, skip processing unless it has been set to resume */ 12532 if (pauseObject) { 12533 if (pauseObject.resume === true) { 12534 /* Update the time start to accomodate the paused completion amount */ 12535 timeStart = callContainer[3] = Math.round(timeCurrent - millisecondsEllapsed - 16); 12536 12537 /* Remove pause object after processing */ 12538 callContainer[5] = null; 12539 } else { 12540 continue; 12541 } 12542 } 12543 12544 millisecondsEllapsed = callContainer[6] = timeCurrent - timeStart; 12545 12546 /* The tween's completion percentage is relative to the tween's start time, not the tween's start value 12547 (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). 12548 Accordingly, we ensure that percentComplete does not exceed 1. */ 12549 var percentComplete = Math.min((millisecondsEllapsed) / opts.duration, 1); 12550 12551 /********************** 12552 Element Iteration 12553 **********************/ 12554 12555 /* For every call, iterate through each of the elements in its set. */ 12556 for (var j = 0, callLength = call.length; j < callLength; j++) { 12557 var tweensContainer = call[j], 12558 element = tweensContainer.element; 12559 12560 /* Check to see if this element has been deleted midway through the animation by checking for the 12561 continued existence of its data cache. If it's gone, or the element is currently paused, skip animating this element. */ 12562 if (!Data(element)) { 12563 continue; 12564 } 12565 12566 var transformPropertyExists = false; 12567 12568 /********************************** 12569 Display & Visibility Toggling 12570 **********************************/ 12571 12572 /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. 12573 (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ 12574 if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { 12575 if (opts.display === "flex") { 12576 var flexValues = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"]; 12577 12578 $.each(flexValues, function(i, flexValue) { 12579 CSS.setPropertyValue(element, "display", flexValue); 12580 }); 12581 } 12582 12583 CSS.setPropertyValue(element, "display", opts.display); 12584 } 12585 12586 /* Same goes with the visibility option, but its "none" equivalent is "hidden". */ 12587 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 12588 CSS.setPropertyValue(element, "visibility", opts.visibility); 12589 } 12590 12591 /************************ 12592 Property Iteration 12593 ************************/ 12594 12595 /* For every element, iterate through each property. */ 12596 for (var property in tweensContainer) { 12597 /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ 12598 if (tweensContainer.hasOwnProperty(property) && property !== "element") { 12599 var tween = tweensContainer[property], 12600 currentValue, 12601 /* Easing can either be a pre-genereated function or a string that references a pre-registered easing 12602 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */ 12603 easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing; 12604 12605 /****************************** 12606 Current Value Calculation 12607 ******************************/ 12608 12609 if (Type.isString(tween.pattern)) { 12610 var patternReplace = percentComplete === 1 ? 12611 function($0, index, round) { 12612 var result = tween.endValue[index]; 12613 12614 return round ? Math.round(result) : result; 12615 } : 12616 function($0, index, round) { 12617 var startValue = tween.startValue[index], 12618 tweenDelta = tween.endValue[index] - startValue, 12619 result = startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta)); 12620 12621 return round ? Math.round(result) : result; 12622 }; 12623 12624 currentValue = tween.pattern.replace(/{(\d+)(!)?}/g, patternReplace); 12625 } else if (percentComplete === 1) { 12626 /* If this is the last tick pass (if we've reached 100% completion for this tween), 12627 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ 12628 currentValue = tween.endValue; 12629 } else { 12630 /* Otherwise, calculate currentValue based on the current delta from startValue. */ 12631 var tweenDelta = tween.endValue - tween.startValue; 12632 12633 currentValue = tween.startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta)); 12634 /* If no value change is occurring, don't proceed with DOM updating. */ 12635 } 12636 if (!firstTick && (currentValue === tween.currentValue)) { 12637 continue; 12638 } 12639 12640 tween.currentValue = currentValue; 12641 12642 /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that 12643 it can be passed into the progress callback. */ 12644 if (property === "tween") { 12645 tweenDummyValue = currentValue; 12646 } else { 12647 /****************** 12648 Hooks: Part I 12649 ******************/ 12650 var hookRoot; 12651 12652 /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used 12653 for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated 12654 rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's 12655 updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that 12656 subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ 12657 if (CSS.Hooks.registered[property]) { 12658 hookRoot = CSS.Hooks.getRoot(property); 12659 12660 var rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot]; 12661 12662 if (rootPropertyValueCache) { 12663 tween.rootPropertyValue = rootPropertyValueCache; 12664 } 12665 } 12666 12667 /***************** 12668 DOM Update 12669 *****************/ 12670 12671 /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ 12672 /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ 12673 var adjustedSetData = CSS.setPropertyValue(element, /* SET */ 12674 property, 12675 tween.currentValue + (IE < 9 && parseFloat(currentValue) === 0 ? "" : tween.unitType), 12676 tween.rootPropertyValue, 12677 tween.scrollData); 12678 12679 /******************* 12680 Hooks: Part II 12681 *******************/ 12682 12683 /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */ 12684 if (CSS.Hooks.registered[property]) { 12685 /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */ 12686 if (CSS.Normalizations.registered[hookRoot]) { 12687 Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); 12688 } else { 12689 Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; 12690 } 12691 } 12692 12693 /*************** 12694 Transforms 12695 ***************/ 12696 12697 /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ 12698 if (adjustedSetData[0] === "transform") { 12699 transformPropertyExists = true; 12700 } 12701 12702 } 12703 } 12704 } 12705 12706 /**************** 12707 mobileHA 12708 ****************/ 12709 12710 /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. 12711 It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ 12712 if (opts.mobileHA) { 12713 /* Don't set the null transform hack if we've already done so. */ 12714 if (Data(element).transformCache.translate3d === undefined) { 12715 /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */ 12716 Data(element).transformCache.translate3d = "(0px, 0px, 0px)"; 12717 12718 transformPropertyExists = true; 12719 } 12720 } 12721 12722 if (transformPropertyExists) { 12723 CSS.flushTransformCache(element); 12724 } 12725 } 12726 12727 /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. 12728 Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ 12729 if (opts.display !== undefined && opts.display !== "none") { 12730 Velocity.State.calls[i][2].display = false; 12731 } 12732 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 12733 Velocity.State.calls[i][2].visibility = false; 12734 } 12735 12736 /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */ 12737 if (opts.progress) { 12738 opts.progress.call(callContainer[1], 12739 callContainer[1], 12740 percentComplete, 12741 Math.max(0, (timeStart + opts.duration) - timeCurrent), 12742 timeStart, 12743 tweenDummyValue); 12744 } 12745 12746 /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ 12747 if (percentComplete === 1) { 12748 completeCall(i); 12749 } 12750 } 12751 } 12752 12753 /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ 12754 if (Velocity.State.isTicking) { 12755 ticker(tick); 12756 } 12757 } 12758 12759 /********************** 12760 Call Completion 12761 **********************/ 12762 12763 /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ 12764 function completeCall(callIndex, isStopped) { 12765 /* Ensure the call exists. */ 12766 if (!Velocity.State.calls[callIndex]) { 12767 return false; 12768 } 12769 12770 /* Pull the metadata from the call. */ 12771 var call = Velocity.State.calls[callIndex][0], 12772 elements = Velocity.State.calls[callIndex][1], 12773 opts = Velocity.State.calls[callIndex][2], 12774 resolver = Velocity.State.calls[callIndex][4]; 12775 12776 var remainingCallsExist = false; 12777 12778 /************************* 12779 Element Finalization 12780 *************************/ 12781 12782 for (var i = 0, callLength = call.length; i < callLength; i++) { 12783 var element = call[i].element; 12784 12785 /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ 12786 /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ 12787 /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ 12788 if (!isStopped && !opts.loop) { 12789 if (opts.display === "none") { 12790 CSS.setPropertyValue(element, "display", opts.display); 12791 } 12792 12793 if (opts.visibility === "hidden") { 12794 CSS.setPropertyValue(element, "visibility", opts.visibility); 12795 } 12796 } 12797 12798 /* If the element's queue is empty (if only the "inprogress" item is left at position 0) or if its queue is about to run 12799 a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter 12800 an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity, 12801 we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag 12802 is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ 12803 var data = Data(element); 12804 12805 if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) { 12806 /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ 12807 if (data) { 12808 data.isAnimating = false; 12809 /* Clear the element's rootPropertyValueCache, which will become stale. */ 12810 data.rootPropertyValueCache = {}; 12811 12812 var transformHAPropertyExists = false; 12813 /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */ 12814 $.each(CSS.Lists.transforms3D, function(i, transformName) { 12815 var defaultValue = /^scale/.test(transformName) ? 1 : 0, 12816 currentValue = data.transformCache[transformName]; 12817 12818 if (data.transformCache[transformName] !== undefined && new RegExp("^\\(" + defaultValue + "[^.]").test(currentValue)) { 12819 transformHAPropertyExists = true; 12820 12821 delete data.transformCache[transformName]; 12822 } 12823 }); 12824 12825 /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */ 12826 if (opts.mobileHA) { 12827 transformHAPropertyExists = true; 12828 delete data.transformCache.translate3d; 12829 } 12830 12831 /* Flush the subproperty removals to the DOM. */ 12832 if (transformHAPropertyExists) { 12833 CSS.flushTransformCache(element); 12834 } 12835 12836 /* Remove the "velocity-animating" indicator class. */ 12837 CSS.Values.removeClass(element, "velocity-animating"); 12838 } 12839 } 12840 12841 /********************* 12842 Option: Complete 12843 *********************/ 12844 12845 /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */ 12846 /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ 12847 if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) { 12848 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 12849 try { 12850 opts.complete.call(elements, elements); 12851 } catch (error) { 12852 setTimeout(function() { 12853 throw error; 12854 }, 1); 12855 } 12856 } 12857 12858 /********************** 12859 Promise Resolving 12860 **********************/ 12861 12862 /* Note: Infinite loops don't return promises. */ 12863 if (resolver && opts.loop !== true) { 12864 resolver(elements); 12865 } 12866 12867 /**************************** 12868 Option: Loop (Infinite) 12869 ****************************/ 12870 12871 if (data && opts.loop === true && !isStopped) { 12872 /* If a rotateX/Y/Z property is being animated by 360 deg with loop:true, swap tween start/end values to enable 12873 continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */ 12874 $.each(data.tweensContainer, function(propertyName, tweenContainer) { 12875 if (/^rotate/.test(propertyName) && ((parseFloat(tweenContainer.startValue) - parseFloat(tweenContainer.endValue)) % 360 === 0)) { 12876 var oldStartValue = tweenContainer.startValue; 12877 12878 tweenContainer.startValue = tweenContainer.endValue; 12879 tweenContainer.endValue = oldStartValue; 12880 } 12881 12882 if (/^backgroundPosition/.test(propertyName) && parseFloat(tweenContainer.endValue) === 100 && tweenContainer.unitType === "%") { 12883 tweenContainer.endValue = 0; 12884 tweenContainer.startValue = 100; 12885 } 12886 }); 12887 12888 Velocity(element, "reverse", {loop: true, delay: opts.delay}); 12889 } 12890 12891 /*************** 12892 Dequeueing 12893 ***************/ 12894 12895 /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), 12896 which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached, 12897 $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ 12898 if (opts.queue !== false) { 12899 $.dequeue(element, opts.queue); 12900 } 12901 } 12902 12903 /************************ 12904 Calls Array Cleanup 12905 ************************/ 12906 12907 /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray(). 12908 (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */ 12909 Velocity.State.calls[callIndex] = false; 12910 12911 /* Iterate through the calls array to determine if this was the final in-progress animation. 12912 If so, set a flag to end ticking and clear the calls array. */ 12913 for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { 12914 if (Velocity.State.calls[j] !== false) { 12915 remainingCallsExist = true; 12916 12917 break; 12918 } 12919 } 12920 12921 if (remainingCallsExist === false) { 12922 /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ 12923 Velocity.State.isTicking = false; 12924 12925 /* Clear the calls array so that its length is reset. */ 12926 delete Velocity.State.calls; 12927 Velocity.State.calls = []; 12928 } 12929 } 12930 12931 /****************** 12932 Frameworks 12933 ******************/ 12934 12935 /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. 12936 If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. Velocity 12937 also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are 12938 accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn 12939 (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ 12940 global.Velocity = Velocity; 12941 12942 if (global !== window) { 12943 /* Assign the element function to Velocity's core animate() method. */ 12944 global.fn.velocity = animate; 12945 /* Assign the object function's defaults to Velocity's global defaults object. */ 12946 global.fn.velocity.defaults = Velocity.defaults; 12947 } 12948 12949 /*********************** 12950 Packaged Redirects 12951 ***********************/ 12952 12953 /* slideUp, slideDown */ 12954 $.each(["Down", "Up"], function(i, direction) { 12955 Velocity.Redirects["slide" + direction] = function(element, options, elementsIndex, elementsSize, elements, promiseData) { 12956 var opts = $.extend({}, options), 12957 begin = opts.begin, 12958 complete = opts.complete, 12959 inlineValues = {}, 12960 computedValues = {height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: ""}; 12961 12962 if (opts.display === undefined) { 12963 /* Show the element before slideDown begins and hide the element after slideUp completes. */ 12964 /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ 12965 opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); 12966 } 12967 12968 opts.begin = function() { 12969 /* If the user passed in a begin callback, fire it now. */ 12970 if (elementsIndex === 0 && begin) { 12971 begin.call(elements, elements); 12972 } 12973 12974 /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ 12975 for (var property in computedValues) { 12976 if (!computedValues.hasOwnProperty(property)) { 12977 continue; 12978 } 12979 inlineValues[property] = element.style[property]; 12980 12981 /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, 12982 use forcefeeding to start from computed values and animate down to 0. */ 12983 var propertyValue = CSS.getPropertyValue(element, property); 12984 computedValues[property] = (direction === "Down") ? [propertyValue, 0] : [0, propertyValue]; 12985 } 12986 12987 /* Force vertical overflow content to clip so that sliding works as expected. */ 12988 inlineValues.overflow = element.style.overflow; 12989 element.style.overflow = "hidden"; 12990 }; 12991 12992 opts.complete = function() { 12993 /* Reset element to its pre-slide inline values once its slide animation is complete. */ 12994 for (var property in inlineValues) { 12995 if (inlineValues.hasOwnProperty(property)) { 12996 element.style[property] = inlineValues[property]; 12997 } 12998 } 12999 13000 /* If the user passed in a complete callback, fire it now. */ 13001 if (elementsIndex === elementsSize - 1) { 13002 if (complete) { 13003 complete.call(elements, elements); 13004 } 13005 if (promiseData) { 13006 promiseData.resolver(elements); 13007 } 13008 } 13009 }; 13010 13011 Velocity(element, computedValues, opts); 13012 }; 13013 }); 13014 13015 /* fadeIn, fadeOut */ 13016 $.each(["In", "Out"], function(i, direction) { 13017 Velocity.Redirects["fade" + direction] = function(element, options, elementsIndex, elementsSize, elements, promiseData) { 13018 var opts = $.extend({}, options),
13019 complete = opts.complete, 13020 propertiesMap = {opacity: (direction === "In") ? 1 : 0}; 13021 13022 /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering 13023 callbacks by firing them only when the final element has been reached. */ 13024 if (elementsIndex !== 0) { 13025 opts.begin = null; 13026 } 13027 if (elementsIndex !== elementsSize - 1) { 13028 opts.complete = null; 13029 } else { 13030 opts.complete = function() { 13031 if (complete) { 13032 complete.call(elements, elements); 13033 } 13034 if (promiseData) { 13035 promiseData.resolver(elements); 13036 } 13037 }; 13038 } 13039 13040 /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ 13041 /* Note: We allow users to pass in "null" to skip display setting altogether. */ 13042 if (opts.display === undefined) { 13043 opts.display = (direction === "In" ? "auto" : "none"); 13044 } 13045 13046 Velocity(this, propertiesMap, opts); 13047 }; 13048 }); 13049 13050 return Velocity; 13051 }((window.jQuery || window.Zepto || window), window, (window ? window.document : undefined)); 13052 })); 13053 13054 /****************** 13055 Known Issues 13056 ******************/ 13057 13058 /* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. 13059 Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties 13060 will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ 13061 13062 13063/***/ }), 13064/* 299 */ 13065/***/ (function(module, exports, __webpack_require__) { 13066 13067 "use strict"; 13068 13069 Object.defineProperty(exports, "__esModule", { 13070 value: true 13071 }); 13072 exports.setup = setup; 13073 exports.isPlaying = isPlaying; 13074 exports.toggle = toggle; 13075 exports.play = play; 13076 exports.pause = pause; 13077 exports.active = active; 13078 exports.inactive = inactive; 13079 13080 var _howler = __webpack_require__(300); 13081 13082 var _events = __webpack_require__(301); 13083 13084 var _events2 = _interopRequireDefault(_events); 13085 13086 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13087 13088 var bgm = void 0; 13089 var isActive = false; 13090 13091 function setup(flag) { 13092 bgm = new _howler.Howl({ 13093 src: ["/audio/bgm.mp3"], 13094 loop: true 13095 }); 13096 } 13097 13098 function isPlaying() { 13099 if (bgm) { 13100 return bgm.playing(); 13101 } 13102 return false; 13103 } 13104 13105 function toggle() { 13106 if (bgm) { 13107 if (bgm.playing()) { 13108 pause(); 13109 } else { 13110 play(); 13111 } 13112 } 13113 } 13114 13115 function play() { 13116 if (bgm) { 13117 bgm.play(); 13118 _events2.default.emit("bgmToggle", true); 13119 } 13120 } 13121 13122 function pause() { 13123 if (bgm) { 13124 bgm.pause(); 13125 _events2.default.emit("bgmToggle", false); 13126 } 13127 } 13128 13129 function active() { 13130 if (bgm) { 13131 isActive = true; 13132 if (bgm.playing()) { 13133 var current = bgm.volume(); 13134 bgm.fade(current, 1, 200); 13135 } 13136 } 13137 } 13138 13139 function inactive() { 13140 if (bgm) { 13141 isActive = false; 13142 if (bgm.playing()) { 13143 var current = bgm.volume(); 13144 bgm.fade(current, 0.3, 200); 13145 } 13146 } 13147 } 13148 13149 exports.default = { setup: setup, active: active, inactive: inactive, toggle: toggle, play: play, pause: pause, isPlaying: isPlaying }; 13150 13151/***/ }), 13152/* 300 */ 13153/***/ (function(module, exports, __webpack_require__) { 13154 13155 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global) {/*! 13156 * howler.js v2.0.3 13157 * howlerjs.com 13158 * 13159 * (c) 2013-2017, James Simpson of GoldFire Studios 13160 * goldfirestudios.com 13161 * 13162 * MIT License 13163 */ 13164 13165 (function() { 13166 13167 'use strict'; 13168 13169 /** Global Methods **/ 13170 /***************************************************************************/ 13171 13172 /** 13173 * Create the global controller. All contained methods and properties apply 13174 * to all sounds that are currently playing or will be in the future. 13175 */ 13176 var HowlerGlobal = function() { 13177 this.init(); 13178 }; 13179 HowlerGlobal.prototype = { 13180 /** 13181 * Initialize the global Howler object. 13182 * @return {Howler} 13183 */ 13184 init: function() { 13185 var self = this || Howler; 13186 13187 // Create a global ID counter. 13188 self._counter = 0; 13189 13190 // Internal properties. 13191 self._codecs = {}; 13192 self._howls = []; 13193 self._muted = false;
vendor: 8,132 bytes, lines 13194-13436
13194 self._volume = 1; 13195 self._canPlayEvent = 'canplaythrough'; 13196 self._navigator = (typeof window !== 'undefined' && window.navigator) ? window.navigator : null; 13197 13198 // Public properties. 13199 self.masterGain = null; 13200 self.noAudio = false; 13201 self.usingWebAudio = true; 13202 self.autoSuspend = true; 13203 self.ctx = null; 13204 13205 // Set to false to disable the auto iOS enabler. 13206 self.mobileAutoEnable = true; 13207 13208 // Setup the various state values for global tracking. 13209 self._setup(); 13210 13211 return self; 13212 }, 13213 13214 /** 13215 * Get/set the global volume for all sounds. 13216 * @param {Float} vol Volume from 0.0 to 1.0. 13217 * @return {Howler/Float} Returns self or current volume. 13218 */ 13219 volume: function(vol) { 13220 var self = this || Howler; 13221 vol = parseFloat(vol); 13222 13223 // If we don't have an AudioContext created yet, run the setup. 13224 if (!self.ctx) { 13225 setupAudioContext(); 13226 } 13227 13228 if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) { 13229 self._volume = vol; 13230 13231 // Don't update any of the nodes if we are muted. 13232 if (self._muted) { 13233 return self; 13234 } 13235 13236 // When using Web Audio, we just need to adjust the master gain. 13237 if (self.usingWebAudio) { 13238 self.masterGain.gain.value = vol; 13239 } 13240 13241 // Loop through and change volume for all HTML5 audio nodes. 13242 for (var i=0; i<self._howls.length; i++) { 13243 if (!self._howls[i]._webAudio) { 13244 // Get all of the sounds in this Howl group. 13245 var ids = self._howls[i]._getSoundIds(); 13246 13247 // Loop through all sounds and change the volumes. 13248 for (var j=0; j<ids.length; j++) { 13249 var sound = self._howls[i]._soundById(ids[j]); 13250 13251 if (sound && sound._node) { 13252 sound._node.volume = sound._volume * vol; 13253 } 13254 } 13255 } 13256 } 13257 13258 return self; 13259 } 13260 13261 return self._volume; 13262 }, 13263 13264 /** 13265 * Handle muting and unmuting globally. 13266 * @param {Boolean} muted Is muted or not. 13267 */ 13268 mute: function(muted) { 13269 var self = this || Howler; 13270 13271 // If we don't have an AudioContext created yet, run the setup. 13272 if (!self.ctx) { 13273 setupAudioContext(); 13274 } 13275 13276 self._muted = muted; 13277 13278 // With Web Audio, we just need to mute the master gain. 13279 if (self.usingWebAudio) { 13280 self.masterGain.gain.value = muted ? 0 : self._volume; 13281 } 13282 13283 // Loop through and mute all HTML5 Audio nodes. 13284 for (var i=0; i<self._howls.length; i++) { 13285 if (!self._howls[i]._webAudio) { 13286 // Get all of the sounds in this Howl group. 13287 var ids = self._howls[i]._getSoundIds(); 13288 13289 // Loop through all sounds and mark the audio node as muted. 13290 for (var j=0; j<ids.length; j++) { 13291 var sound = self._howls[i]._soundById(ids[j]); 13292 13293 if (sound && sound._node) { 13294 sound._node.muted = (muted) ? true : sound._muted; 13295 } 13296 } 13297 } 13298 } 13299 13300 return self; 13301 }, 13302 13303 /** 13304 * Unload and destroy all currently loaded Howl objects. 13305 * @return {Howler} 13306 */ 13307 unload: function() { 13308 var self = this || Howler; 13309 13310 for (var i=self._howls.length-1; i>=0; i--) { 13311 self._howls[i].unload(); 13312 } 13313 13314 // Create a new AudioContext to make sure it is fully reset. 13315 if (self.usingWebAudio && self.ctx && typeof self.ctx.close !== 'undefined') { 13316 self.ctx.close(); 13317 self.ctx = null; 13318 setupAudioContext(); 13319 } 13320 13321 return self; 13322 }, 13323 13324 /** 13325 * Check for codec support of specific extension. 13326 * @param {String} ext Audio file extention. 13327 * @return {Boolean} 13328 */ 13329 codecs: function(ext) { 13330 return (this || Howler)._codecs[ext.replace(/^x-/, '')]; 13331 }, 13332 13333 /** 13334 * Setup various state values for global tracking. 13335 * @return {Howler} 13336 */ 13337 _setup: function() { 13338 var self = this || Howler; 13339 13340 // Keeps track of the suspend/resume state of the AudioContext. 13341 self.state = self.ctx ? self.ctx.state || 'running' : 'running'; 13342 13343 // Automatically begin the 30-second suspend process 13344 self._autoSuspend(); 13345 13346 // Check if audio is available. 13347 if (!self.usingWebAudio) { 13348 // No audio is available on this system if noAudio is set to true. 13349 if (typeof Audio !== 'undefined') { 13350 try { 13351 var test = new Audio(); 13352 13353 // Check if the canplaythrough event is available. 13354 if (typeof test.oncanplaythrough === 'undefined') { 13355 self._canPlayEvent = 'canplay'; 13356 } 13357 } catch(e) { 13358 self.noAudio = true; 13359 } 13360 } else { 13361 self.noAudio = true; 13362 } 13363 } 13364 13365 // Test to make sure audio isn't disabled in Internet Explorer. 13366 try { 13367 var test = new Audio(); 13368 if (test.muted) { 13369 self.noAudio = true; 13370 } 13371 } catch (e) {} 13372 13373 // Check for supported codecs. 13374 if (!self.noAudio) { 13375 self._setupCodecs(); 13376 } 13377 13378 return self; 13379 }, 13380 13381 /** 13382 * Check for browser support for various codecs and cache the results. 13383 * @return {Howler} 13384 */ 13385 _setupCodecs: function() { 13386 var self = this || Howler; 13387 var audioTest = null; 13388 13389 // Must wrap in a try/catch because IE11 in server mode throws an error. 13390 try { 13391 audioTest = (typeof Audio !== 'undefined') ? new Audio() : null; 13392 } catch (err) { 13393 return self; 13394 } 13395 13396 if (!audioTest || typeof audioTest.canPlayType !== 'function') { 13397 return self; 13398 } 13399 13400 var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, ''); 13401 13402 // Opera version <33 has mixed MP3 support, so we need to check for and block it. 13403 var checkOpera = self._navigator && self._navigator.userAgent.match(/OPR\/([0-6].)/g); 13404 var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33); 13405 13406 self._codecs = { 13407 mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))), 13408 mpeg: !!mpegTest, 13409 opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''), 13410 ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), 13411 oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), 13412 wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''), 13413 aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''), 13414 caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''), 13415 m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), 13416 mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), 13417 weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), 13418 webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), 13419 dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''), 13420 flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '') 13421 }; 13422 13423 return self; 13424 }, 13425 13426 /** 13427 * Mobile browsers will only allow audio to be played after a user interaction. 13428 * Attempt to automatically unlock audio on the first user interaction. 13429 * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/ 13430 * @return {Howler} 13431 */ 13432 _enableMobileAudio: function() { 13433 var self = this || Howler; 13434 13435 // Only run this on mobile devices if audio isn't already eanbled. 13436 var isMobile = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(self._navigator && self._navigator.userAgent);
13437 var isTouch = !!(('ontouchend' in window) || (self._navigator && self._navigator.maxTouchPoints > 0) || (self._navigator && self._navigator.msMaxTouchPoints > 0)); 13438 if (self._mobileEnabled || !self.ctx || (!isMobile && !isTouch)) { 13439 return; 13440 } 13441 13442 self._mobileEnabled = false; 13443 13444 // Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views. 13445 // Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000. 13446 // By calling Howler.unload(), we create a new AudioContext with the correct sampleRate. 13447 if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) { 13448 self._mobileUnloaded = true; 13449 self.unload(); 13450 } 13451 13452 // Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per: 13453 // http://stackoverflow.com/questions/24119684 13454 self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050); 13455 13456 // Call this method on touch start to create and play a buffer, 13457 // then check if the audio actually played to determine if 13458 // audio has now been unlocked on iOS, Android, etc. 13459 var unlock = function() { 13460 // Create an empty buffer. 13461 var source = self.ctx.createBufferSource(); 13462 source.buffer = self._scratchBuffer; 13463 source.connect(self.ctx.destination); 13464 13465 // Play the empty buffer. 13466 if (typeof source.start === 'undefined') { 13467 source.noteOn(0); 13468 } else { 13469 source.start(0); 13470 } 13471 13472 // Setup a timeout to check that we are unlocked on the next event loop. 13473 source.onended = function() { 13474 source.disconnect(0); 13475 13476 // Update the unlocked state and prevent this check from happening again. 13477 self._mobileEnabled = true; 13478 self.mobileAutoEnable = false; 13479 13480 // Remove the touch start listener. 13481 document.removeEventListener('touchend', unlock, true); 13482 }; 13483 }; 13484 13485 // Setup a touch start listener to attempt an unlock in. 13486 document.addEventListener('touchend', unlock, true); 13487 13488 return self; 13489 }, 13490 13491 /** 13492 * Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds. 13493 * This saves processing/energy and fixes various browser-specific bugs with audio getting stuck. 13494 * @return {Howler} 13495 */ 13496 _autoSuspend: function() { 13497 var self = this; 13498 13499 if (!self.autoSuspend || !self.ctx || typeof self.ctx.suspend === 'undefined' || !Howler.usingWebAudio) { 13500 return; 13501 } 13502 13503 // Check if any sounds are playing. 13504 for (var i=0; i<self._howls.length; i++) { 13505 if (self._howls[i]._webAudio) { 13506 for (var j=0; j<self._howls[i]._sounds.length; j++) { 13507 if (!self._howls[i]._sounds[j]._paused) { 13508 return self; 13509 } 13510 } 13511 } 13512 } 13513 13514 if (self._suspendTimer) { 13515 clearTimeout(self._suspendTimer); 13516 } 13517 13518 // If no sound has played after 30 seconds, suspend the context. 13519 self._suspendTimer = setTimeout(function() { 13520 if (!self.autoSuspend) { 13521 return; 13522 } 13523 13524 self._suspendTimer = null; 13525 self.state = 'suspending'; 13526 self.ctx.suspend().then(function() { 13527 self.state = 'suspended'; 13528 13529 if (self._resumeAfterSuspend) { 13530 delete self._resumeAfterSuspend; 13531 self._autoResume(); 13532 } 13533 }); 13534 }, 30000); 13535 13536 return self; 13537 }, 13538 13539 /** 13540 * Automatically resume the Web Audio AudioContext when a new sound is played. 13541 * @return {Howler} 13542 */ 13543 _autoResume: function() { 13544 var self = this; 13545 13546 if (!self.ctx || typeof self.ctx.resume === 'undefined' || !Howler.usingWebAudio) { 13547 return; 13548 } 13549 13550 if (self.state === 'running' && self._suspendTimer) { 13551 clearTimeout(self._suspendTimer); 13552 self._suspendTimer = null; 13553 } else if (self.state === 'suspended') { 13554 self.state = 'resuming';
vendor: 5,894 bytes, lines 13555-13743
13555 self.ctx.resume().then(function() { 13556 self.state = 'running'; 13557 13558 // Emit to all Howls that the audio has resumed. 13559 for (var i=0; i<self._howls.length; i++) { 13560 self._howls[i]._emit('resume'); 13561 } 13562 }); 13563 13564 if (self._suspendTimer) { 13565 clearTimeout(self._suspendTimer); 13566 self._suspendTimer = null; 13567 } 13568 } else if (self.state === 'suspending') { 13569 self._resumeAfterSuspend = true; 13570 } 13571 13572 return self; 13573 } 13574 }; 13575 13576 // Setup the global audio controller. 13577 var Howler = new HowlerGlobal(); 13578 13579 /** Group Methods **/ 13580 /***************************************************************************/ 13581 13582 /** 13583 * Create an audio group controller. 13584 * @param {Object} o Passed in properties for this group. 13585 */ 13586 var Howl = function(o) { 13587 var self = this; 13588 13589 // Throw an error if no source is provided. 13590 if (!o.src || o.src.length === 0) { 13591 console.error('An array of source files must be passed with any new Howl.'); 13592 return; 13593 } 13594 13595 self.init(o); 13596 }; 13597 Howl.prototype = { 13598 /** 13599 * Initialize a new Howl group object. 13600 * @param {Object} o Passed in properties for this group. 13601 * @return {Howl} 13602 */ 13603 init: function(o) { 13604 var self = this; 13605 13606 // If we don't have an AudioContext created yet, run the setup. 13607 if (!Howler.ctx) { 13608 setupAudioContext(); 13609 } 13610 13611 // Setup user-defined default properties. 13612 self._autoplay = o.autoplay || false; 13613 self._format = (typeof o.format !== 'string') ? o.format : [o.format]; 13614 self._html5 = o.html5 || false; 13615 self._muted = o.mute || false; 13616 self._loop = o.loop || false; 13617 self._pool = o.pool || 5; 13618 self._preload = (typeof o.preload === 'boolean') ? o.preload : true; 13619 self._rate = o.rate || 1; 13620 self._sprite = o.sprite || {}; 13621 self._src = (typeof o.src !== 'string') ? o.src : [o.src]; 13622 self._volume = o.volume !== undefined ? o.volume : 1; 13623 13624 // Setup all other default properties. 13625 self._duration = 0; 13626 self._state = 'unloaded'; 13627 self._sounds = []; 13628 self._endTimers = {}; 13629 self._queue = []; 13630 13631 // Setup event listeners. 13632 self._onend = o.onend ? [{fn: o.onend}] : []; 13633 self._onfade = o.onfade ? [{fn: o.onfade}] : []; 13634 self._onload = o.onload ? [{fn: o.onload}] : []; 13635 self._onloaderror = o.onloaderror ? [{fn: o.onloaderror}] : []; 13636 self._onpause = o.onpause ? [{fn: o.onpause}] : []; 13637 self._onplay = o.onplay ? [{fn: o.onplay}] : []; 13638 self._onstop = o.onstop ? [{fn: o.onstop}] : []; 13639 self._onmute = o.onmute ? [{fn: o.onmute}] : []; 13640 self._onvolume = o.onvolume ? [{fn: o.onvolume}] : []; 13641 self._onrate = o.onrate ? [{fn: o.onrate}] : []; 13642 self._onseek = o.onseek ? [{fn: o.onseek}] : []; 13643 self._onresume = []; 13644 13645 // Web Audio or HTML5 Audio? 13646 self._webAudio = Howler.usingWebAudio && !self._html5; 13647 13648 // Automatically try to enable audio on iOS. 13649 if (typeof Howler.ctx !== 'undefined' && Howler.ctx && Howler.mobileAutoEnable) { 13650 Howler._enableMobileAudio(); 13651 } 13652 13653 // Keep track of this Howl group in the global controller. 13654 Howler._howls.push(self); 13655 13656 // If they selected autoplay, add a play event to the load queue. 13657 if (self._autoplay) { 13658 self._queue.push({ 13659 event: 'play', 13660 action: function() { 13661 self.play(); 13662 } 13663 }); 13664 } 13665 13666 // Load the source file unless otherwise specified. 13667 if (self._preload) { 13668 self.load(); 13669 } 13670 13671 return self; 13672 }, 13673 13674 /** 13675 * Load the audio file. 13676 * @return {Howler} 13677 */ 13678 load: function() { 13679 var self = this; 13680 var url = null; 13681 13682 // If no audio is available, quit immediately. 13683 if (Howler.noAudio) { 13684 self._emit('loaderror', null, 'No audio support.'); 13685 return; 13686 } 13687 13688 // Make sure our source is in an array. 13689 if (typeof self._src === 'string') { 13690 self._src = [self._src]; 13691 } 13692 13693 // Loop through the sources and pick the first one that is compatible. 13694 for (var i=0; i<self._src.length; i++) { 13695 var ext, str; 13696 13697 if (self._format && self._format[i]) { 13698 // If an extension was specified, use that instead. 13699 ext = self._format[i]; 13700 } else { 13701 // Make sure the source is a string. 13702 str = self._src[i]; 13703 if (typeof str !== 'string') { 13704 self._emit('loaderror', null, 'Non-string found in selected audio sources - ignoring.'); 13705 continue; 13706 } 13707 13708 // Extract the file extension from the URL or base64 data URI. 13709 ext = /^data:audio\/([^;,]+);/i.exec(str); 13710 if (!ext) { 13711 ext = /\.([^.]+)$/.exec(str.split('?', 1)[0]); 13712 } 13713 13714 if (ext) { 13715 ext = ext[1].toLowerCase(); 13716 } 13717 } 13718 13719 // Log a warning if no extension was found. 13720 if (!ext) { 13721 console.warn('No file extension was found. Consider using the "format" property or specify an extension.'); 13722 } 13723 13724 // Check if this extension is available. 13725 if (ext && Howler.codecs(ext)) { 13726 url = self._src[i]; 13727 break; 13728 } 13729 } 13730 13731 if (!url) { 13732 self._emit('loaderror', null, 'No codec support for selected audio sources.'); 13733 return; 13734 } 13735 13736 self._src = url; 13737 self._state = 'loading'; 13738 13739 // If the hosting page is HTTPS and the source isn't, 13740 // drop down to HTML5 Audio to avoid Mixed Content errors. 13741 if (window.location.protocol === 'https:' && url.slice(0, 5) === 'http:') { 13742 self._html5 = true; 13743 self._webAudio = false;
13744 } 13745 13746 // Create a new sound object and add it to the pool. 13747 new Sound(self); 13748 13749 // Load and decode the audio data for playback. 13750 if (self._webAudio) { 13751 loadBuffer(self); 13752 } 13753 13754 return self; 13755 }, 13756 13757 /** 13758 * Play a sound or resume previous playback. 13759 * @param {String/Number} sprite Sprite name for sprite playback or sound id to continue previous. 13760 * @param {Boolean} internal Internal Use: true prevents event firing. 13761 * @return {Number} Sound ID. 13762 */ 13763 play: function(sprite, internal) { 13764 var self = this; 13765 var id = null; 13766 13767 // Determine if a sprite, sound id or nothing was passed 13768 if (typeof sprite === 'number') { 13769 id = sprite; 13770 sprite = null; 13771 } else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) { 13772 // If the passed sprite doesn't exist, do nothing. 13773 return null; 13774 } else if (typeof sprite === 'undefined') { 13775 // Use the default sound sprite (plays the full audio length). 13776 sprite = '__default'; 13777 13778 // Check if there is a single paused sound that isn't ended. 13779 // If there is, play that sound. If not, continue as usual. 13780 var num = 0; 13781 for (var i=0; i<self._sounds.length; i++) { 13782 if (self._sounds[i]._paused && !self._sounds[i]._ended) { 13783 num++; 13784 id = self._sounds[i]._id; 13785 } 13786 } 13787 13788 if (num === 1) { 13789 sprite = null; 13790 } else { 13791 id = null; 13792 } 13793 } 13794 13795 // Get the selected node, or get one from the pool. 13796 var sound = id ? self._soundById(id) : self._inactiveSound(); 13797 13798 // If the sound doesn't exist, do nothing. 13799 if (!sound) { 13800 return null; 13801 } 13802 13803 // Select the sprite definition. 13804 if (id && !sprite) { 13805 sprite = sound._sprite || '__default'; 13806 } 13807 13808 // If we have no sprite and the sound hasn't loaded, we must wait 13809 // for the sound to load to get our audio's duration. 13810 if (self._state !== 'loaded' && !self._sprite[sprite]) { 13811 self._queue.push({ 13812 event: 'play', 13813 action: function() { 13814 self.play(self._soundById(sound._id) ? sound._id : undefined); 13815 } 13816 }); 13817 13818 return sound._id; 13819 } 13820 13821 // Don't play the sound if an id was passed and it is already playing. 13822 if (id && !sound._paused) { 13823 // Trigger the play event, in order to keep iterating through queue. 13824 if (!internal) { 13825 setTimeout(function() { 13826 self._emit('play', sound._id); 13827 }, 0); 13828 } 13829 13830 return sound._id; 13831 } 13832 13833 // Make sure the AudioContext isn't suspended, and resume it if it is. 13834 if (self._webAudio) { 13835 Howler._autoResume(); 13836 } 13837 13838 // Determine how long to play for and where to start playing. 13839 var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000); 13840 var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek); 13841 var timeout = (duration * 1000) / Math.abs(sound._rate); 13842 13843 // Update the parameters of the sound 13844 sound._paused = false; 13845 sound._ended = false; 13846 sound._sprite = sprite; 13847 sound._seek = seek; 13848 sound._start = self._sprite[sprite][0] / 1000; 13849 sound._stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000; 13850 sound._loop = !!(sound._loop || self._sprite[sprite][2]); 13851 13852 // Begin the actual playback. 13853 var node = sound._node; 13854 if (self._webAudio) { 13855 // Fire this when the sound is ready to play to begin Web Audio playback. 13856 var playWebAudio = function() { 13857 self._refreshBuffer(sound); 13858 13859 // Setup the playback params. 13860 var vol = (sound._muted || self._muted) ? 0 : sound._volume; 13861 node.gain.setValueAtTime(vol, Howler.ctx.currentTime); 13862 sound._playStart = Howler.ctx.currentTime; 13863 13864 // Play the sound using the supported method. 13865 if (typeof node.bufferSource.start === 'undefined') { 13866 sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration); 13867 } else { 13868 sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration); 13869 } 13870 13871 // Start a new timer if none is present. 13872 if (timeout !== Infinity) { 13873 self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); 13874 } 13875 13876 if (!internal) { 13877 setTimeout(function() { 13878 self._emit('play', sound._id); 13879 }, 0); 13880 } 13881 }; 13882 13883 var isRunning = (Howler.state === 'running'); 13884 if (self._state === 'loaded' && isRunning) { 13885 playWebAudio(); 13886 } else { 13887 // Wait for the audio to load and then begin playback. 13888 var event = !isRunning && self._state === 'loaded' ? 'resume' : 'load'; 13889 self.once(event, playWebAudio, isRunning ? sound._id : null); 13890 13891 // Cancel the end timer. 13892 self._clearTimer(sound._id); 13893 } 13894 } else { 13895 // Fire this when the sound is ready to play to begin HTML5 Audio playback. 13896 var playHtml5 = function() { 13897 node.currentTime = seek; 13898 node.muted = sound._muted || self._muted || Howler._muted || node.muted; 13899 node.volume = sound._volume * Howler.volume(); 13900 node.playbackRate = sound._rate; 13901 node.play(); 13902 13903 // Setup the new end timer. 13904 if (timeout !== Infinity) { 13905 self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); 13906 } 13907 13908 if (!internal) { 13909 self._emit('play', sound._id); 13910 } 13911 }; 13912 13913 // Play immediately if ready, or wait for the 'canplaythrough'e vent. 13914 var loadedNoReadyState = (self._state === 'loaded' && (window && window.ejecta || !node.readyState && Howler._navigator.isCocoonJS)); 13915 if (node.readyState === 4 || loadedNoReadyState) {
13916 playHtml5(); 13917 } else { 13918 var listener = function() { 13919 // Begin playback. 13920 playHtml5(); 13921 13922 // Clear this listener. 13923 node.removeEventListener(Howler._canPlayEvent, listener, false); 13924 }; 13925 node.addEventListener(Howler._canPlayEvent, listener, false); 13926 13927 // Cancel the end timer. 13928 self._clearTimer(sound._id); 13929 } 13930 } 13931 13932 return sound._id; 13933 }, 13934 13935 /** 13936 * Pause playback and save current position. 13937 * @param {Number} id The sound ID (empty to pause all in group). 13938 * @return {Howl} 13939 */ 13940 pause: function(id) { 13941 var self = this; 13942 13943 // If the sound hasn't loaded, add it to the load queue to pause when capable. 13944 if (self._state !== 'loaded') { 13945 self._queue.push({ 13946 event: 'pause', 13947 action: function() { 13948 self.pause(id); 13949 } 13950 }); 13951 13952 return self; 13953 } 13954 13955 // If no id is passed, get all ID's to be paused. 13956 var ids = self._getSoundIds(id); 13957 13958 for (var i=0; i<ids.length; i++) { 13959 // Clear the end timer. 13960 self._clearTimer(ids[i]); 13961 13962 // Get the sound. 13963 var sound = self._soundById(ids[i]); 13964 13965 if (sound && !sound._paused) { 13966 // Reset the seek position. 13967 sound._seek = self.seek(ids[i]); 13968 sound._rateSeek = 0; 13969 sound._paused = true; 13970 13971 // Stop currently running fades. 13972 self._stopFade(ids[i]); 13973 13974 if (sound._node) { 13975 if (self._webAudio) { 13976 // make sure the sound has been created 13977 if (!sound._node.bufferSource) { 13978 return self; 13979 } 13980 13981 if (typeof sound._node.bufferSource.stop === 'undefined') { 13982 sound._node.bufferSource.noteOff(0); 13983 } else { 13984 sound._node.bufferSource.stop(0); 13985 } 13986 13987 // Clean up the buffer source. 13988 self._cleanBuffer(sound._node); 13989 } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) { 13990 sound._node.pause(); 13991 } 13992 } 13993 } 13994 13995 // Fire the pause event, unless `true` is passed as the 2nd argument. 13996 if (!arguments[1]) { 13997 self._emit('pause', sound ? sound._id : null); 13998 } 13999 } 14000 14001 return self; 14002 }, 14003 14004 /** 14005 * Stop playback and reset to start. 14006 * @param {Number} id The sound ID (empty to stop all in group). 14007 * @param {Boolean} internal Internal Use: true prevents event firing. 14008 * @return {Howl} 14009 */ 14010 stop: function(id, internal) { 14011 var self = this; 14012 14013 // If the sound hasn't loaded, add it to the load queue to stop when capable. 14014 if (self._state !== 'loaded') { 14015 self._queue.push({ 14016 event: 'stop', 14017 action: function() { 14018 self.stop(id); 14019 } 14020 }); 14021 14022 return self; 14023 } 14024 14025 // If no id is passed, get all ID's to be stopped. 14026 var ids = self._getSoundIds(id); 14027 14028 for (var i=0; i<ids.length; i++) { 14029 // Clear the end timer. 14030 self._clearTimer(ids[i]); 14031 14032 // Get the sound. 14033 var sound = self._soundById(ids[i]); 14034 14035 if (sound) { 14036 // Reset the seek position. 14037 sound._seek = sound._start || 0; 14038 sound._rateSeek = 0; 14039 sound._paused = true; 14040 sound._ended = true; 14041 14042 // Stop currently running fades. 14043 self._stopFade(ids[i]); 14044 14045 if (sound._node) { 14046 if (self._webAudio) { 14047 // make sure the sound has been created 14048 if (!sound._node.bufferSource) { 14049 if (!internal) { 14050 self._emit('stop', sound._id); 14051 } 14052 14053 return self; 14054 } 14055 14056 if (typeof sound._node.bufferSource.stop === 'undefined') { 14057 sound._node.bufferSource.noteOff(0); 14058 } else { 14059 sound._node.bufferSource.stop(0); 14060 } 14061 14062 // Clean up the buffer source. 14063 self._cleanBuffer(sound._node); 14064 } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) { 14065 sound._node.currentTime = sound._start || 0; 14066 sound._node.pause(); 14067 } 14068 } 14069 } 14070 14071 if (sound && !internal) { 14072 self._emit('stop', sound._id); 14073 } 14074 } 14075 14076 return self; 14077 }, 14078 14079 /** 14080 * Mute/unmute a single sound or all sounds in this Howl group. 14081 * @param {Boolean} muted Set to true to mute and false to unmute. 14082 * @param {Number} id The sound ID to update (omit to mute/unmute all). 14083 * @return {Howl} 14084 */ 14085 mute: function(muted, id) { 14086 var self = this; 14087 14088 // If the sound hasn't loaded, add it to the load queue to mute when capable. 14089 if (self._state !== 'loaded') { 14090 self._queue.push({ 14091 event: 'mute', 14092 action: function() { 14093 self.mute(muted, id); 14094 } 14095 }); 14096 14097 return self; 14098 } 14099 14100 // If applying mute/unmute to all sounds, update the group's value. 14101 if (typeof id === 'undefined') { 14102 if (typeof muted === 'boolean') { 14103 self._muted = muted; 14104 } else { 14105 return self._muted; 14106 } 14107 } 14108 14109 // If no id is passed, get all ID's to be muted. 14110 var ids = self._getSoundIds(id); 14111 14112 for (var i=0; i<ids.length; i++) { 14113 // Get the sound. 14114 var sound = self._soundById(ids[i]); 14115 14116 if (sound) { 14117 sound._muted = muted; 14118 14119 if (self._webAudio && sound._node) { 14120 sound._node.gain.setValueAtTime(muted ? 0 : sound._volume, Howler.ctx.currentTime); 14121 } else if (sound._node) { 14122 sound._node.muted = Howler._muted ? true : muted; 14123 } 14124 14125 self._emit('mute', sound._id); 14126 } 14127 } 14128 14129 return self; 14130 }, 14131 14132 /** 14133 * Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments. 14134 * volume() -> Returns the group's volume value. 14135 * volume(id) -> Returns the sound id's current volume. 14136 * volume(vol) -> Sets the volume of all sounds in this Howl group. 14137 * volume(vol, id) -> Sets the volume of passed sound id. 14138 * @return {Howl/Number} Returns self or current volume. 14139 */ 14140 volume: function() { 14141 var self = this; 14142 var args = arguments; 14143 var vol, id; 14144 14145 // Determine the values based on arguments. 14146 if (args.length === 0) { 14147 // Return the value of the groups' volume. 14148 return self._volume; 14149 } else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') { 14150 // First check if this is an ID, and if not, assume it is a new volume. 14151 var ids = self._getSoundIds(); 14152 var index = ids.indexOf(args[0]); 14153 if (index >= 0) { 14154 id = parseInt(args[0], 10); 14155 } else { 14156 vol = parseFloat(args[0]); 14157 } 14158 } else if (args.length >= 2) { 14159 vol = parseFloat(args[0]); 14160 id = parseInt(args[1], 10); 14161 } 14162 14163 // Update the volume or return the current volume. 14164 var sound; 14165 if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) { 14166 // If the sound hasn't loaded, add it to the load queue to change volume when capable. 14167 if (self._state !== 'loaded') { 14168 self._queue.push({ 14169 event: 'volume', 14170 action: function() { 14171 self.volume.apply(self, args); 14172 } 14173 }); 14174 14175 return self; 14176 } 14177 14178 // Set the group volume. 14179 if (typeof id === 'undefined') { 14180 self._volume = vol; 14181 } 14182 14183 // Update one or all volumes. 14184 id = self._getSoundIds(id); 14185 for (var i=0; i<id.length; i++) { 14186 // Get the sound. 14187 sound = self._soundById(id[i]); 14188 14189 if (sound) { 14190 sound._volume = vol; 14191 14192 // Stop currently running fades. 14193 if (!args[2]) { 14194 self._stopFade(id[i]); 14195 } 14196 14197 if (self._webAudio && sound._node && !sound._muted) { 14198 sound._node.gain.setValueAtTime(vol, Howler.ctx.currentTime); 14199 } else if (sound._node && !sound._muted) { 14200 sound._node.volume = vol * Howler.volume(); 14201 } 14202 14203 self._emit('volume', sound._id); 14204 } 14205 } 14206 } else { 14207 sound = id ? self._soundById(id) : self._sounds[0]; 14208 return sound ? sound._volume : 0; 14209 } 14210 14211 return self; 14212 }, 14213 14214 /** 14215 * Fade a currently playing sound between two volumes (if no id is passsed, all sounds will fade). 14216 * @param {Number} from The value to fade from (0.0 to 1.0). 14217 * @param {Number} to The volume to fade to (0.0 to 1.0). 14218 * @param {Number} len Time in milliseconds to fade. 14219 * @param {Number} id The sound id (omit to fade all sounds). 14220 * @return {Howl} 14221 */ 14222 fade: function(from, to, len, id) { 14223 var self = this; 14224 var diff = Math.abs(from - to); 14225 var dir = from > to ? 'out' : 'in'; 14226 var steps = diff / 0.01; 14227 var stepLen = (steps > 0) ? len / steps : len; 14228 14229 // Since browsers clamp timeouts to 4ms, we need to clamp our steps to that too. 14230 if (stepLen < 4) { 14231 steps = Math.ceil(steps / (4 / stepLen)); 14232 stepLen = 4; 14233 } 14234 14235 // If the sound hasn't loaded, add it to the load queue to fade when capable. 14236 if (self._state !== 'loaded') { 14237 self._queue.push({ 14238 event: 'fade', 14239 action: function() { 14240 self.fade(from, to, len, id); 14241 } 14242 }); 14243 14244 return self; 14245 } 14246 14247 // Set the volume to the start position. 14248 self.volume(from, id); 14249 14250 // Fade the volume of one or all sounds. 14251 var ids = self._getSoundIds(id); 14252 for (var i=0; i<ids.length; i++) { 14253 // Get the sound. 14254 var sound = self._soundById(ids[i]); 14255 14256 // Create a linear fade or fall back to timeouts with HTML5 Audio. 14257 if (sound) { 14258 // Stop the previous fade if no sprite is being used (otherwise, volume handles this). 14259 if (!id) { 14260 self._stopFade(ids[i]); 14261 } 14262 14263 // If we are using Web Audio, let the native methods do the actual fade. 14264 if (self._webAudio && !sound._muted) { 14265 var currentTime = Howler.ctx.currentTime; 14266 var end = currentTime + (len / 1000); 14267 sound._volume = from; 14268 sound._node.gain.setValueAtTime(from, currentTime); 14269 sound._node.gain.linearRampToValueAtTime(to, end); 14270 } 14271 14272 var vol = from; 14273 sound._interval = setInterval(function(soundId, sound) { 14274 // Update the volume amount, but only if the volume should change. 14275 if (steps > 0) { 14276 vol += (dir === 'in' ? 0.01 : -0.01); 14277 } 14278 14279 // Make sure the volume is in the right bounds. 14280 vol = Math.max(0, vol); 14281 vol = Math.min(1, vol); 14282 14283 // Round to within 2 decimal points. 14284 vol = Math.round(vol * 100) / 100; 14285 14286 // Change the volume. 14287 if (self._webAudio) { 14288 if (typeof id === 'undefined') { 14289 self._volume = vol; 14290 } 14291 14292 sound._volume = vol; 14293 } else { 14294 self.volume(vol, soundId, true); 14295 } 14296 14297 // When the fade is complete, stop it and fire event. 14298 if ((to < from && vol <= to) || (to > from && vol >= to)) { 14299 clearInterval(sound._interval); 14300 sound._interval = null; 14301 self.volume(to, soundId); 14302 self._emit('fade', soundId); 14303 } 14304 }.bind(self, ids[i], sound), stepLen); 14305 } 14306 } 14307 14308 return self; 14309 }, 14310 14311 /** 14312 * Internal method that stops the currently playing fade when 14313 * a new fade starts, volume is changed or the sound is stopped. 14314 * @param {Number} id The sound id. 14315 * @return {Howl} 14316 */ 14317 _stopFade: function(id) { 14318 var self = this; 14319 var sound = self._soundById(id); 14320 14321 if (sound && sound._interval) { 14322 if (self._webAudio) { 14323 sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime); 14324 } 14325 14326 clearInterval(sound._interval); 14327 sound._interval = null; 14328 self._emit('fade', id); 14329 } 14330 14331 return self; 14332 }, 14333 14334 /** 14335 * Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments. 14336 * loop() -> Returns the group's loop value. 14337 * loop(id) -> Returns the sound id's loop value. 14338 * loop(loop) -> Sets the loop value for all sounds in this Howl group. 14339 * loop(loop, id) -> Sets the loop value of passed sound id. 14340 * @return {Howl/Boolean} Returns self or current loop value. 14341 */ 14342 loop: function() { 14343 var self = this; 14344 var args = arguments; 14345 var loop, id, sound; 14346 14347 // Determine the values for loop and id. 14348 if (args.length === 0) { 14349 // Return the grou's loop value. 14350 return self._loop; 14351 } else if (args.length === 1) { 14352 if (typeof args[0] === 'boolean') { 14353 loop = args[0]; 14354 self._loop = loop; 14355 } else {
vendor: 6,452 bytes, lines 14356-14540
14356 // Return this sound's loop value. 14357 sound = self._soundById(parseInt(args[0], 10)); 14358 return sound ? sound._loop : false; 14359 } 14360 } else if (args.length === 2) { 14361 loop = args[0]; 14362 id = parseInt(args[1], 10); 14363 } 14364 14365 // If no id is passed, get all ID's to be looped. 14366 var ids = self._getSoundIds(id); 14367 for (var i=0; i<ids.length; i++) { 14368 sound = self._soundById(ids[i]); 14369 14370 if (sound) { 14371 sound._loop = loop; 14372 if (self._webAudio && sound._node && sound._node.bufferSource) { 14373 sound._node.bufferSource.loop = loop; 14374 if (loop) { 14375 sound._node.bufferSource.loopStart = sound._start || 0; 14376 sound._node.bufferSource.loopEnd = sound._stop; 14377 } 14378 } 14379 } 14380 } 14381 14382 return self; 14383 }, 14384 14385 /** 14386 * Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments. 14387 * rate() -> Returns the first sound node's current playback rate. 14388 * rate(id) -> Returns the sound id's current playback rate. 14389 * rate(rate) -> Sets the playback rate of all sounds in this Howl group. 14390 * rate(rate, id) -> Sets the playback rate of passed sound id. 14391 * @return {Howl/Number} Returns self or the current playback rate. 14392 */ 14393 rate: function() { 14394 var self = this; 14395 var args = arguments; 14396 var rate, id; 14397 14398 // Determine the values based on arguments. 14399 if (args.length === 0) { 14400 // We will simply return the current rate of the first node. 14401 id = self._sounds[0]._id; 14402 } else if (args.length === 1) { 14403 // First check if this is an ID, and if not, assume it is a new rate value. 14404 var ids = self._getSoundIds(); 14405 var index = ids.indexOf(args[0]); 14406 if (index >= 0) { 14407 id = parseInt(args[0], 10); 14408 } else { 14409 rate = parseFloat(args[0]); 14410 } 14411 } else if (args.length === 2) { 14412 rate = parseFloat(args[0]); 14413 id = parseInt(args[1], 10); 14414 } 14415 14416 // Update the playback rate or return the current value. 14417 var sound; 14418 if (typeof rate === 'number') { 14419 // If the sound hasn't loaded, add it to the load queue to change playback rate when capable. 14420 if (self._state !== 'loaded') { 14421 self._queue.push({ 14422 event: 'rate', 14423 action: function() { 14424 self.rate.apply(self, args); 14425 } 14426 }); 14427 14428 return self; 14429 } 14430 14431 // Set the group rate. 14432 if (typeof id === 'undefined') { 14433 self._rate = rate; 14434 } 14435 14436 // Update one or all volumes. 14437 id = self._getSoundIds(id); 14438 for (var i=0; i<id.length; i++) { 14439 // Get the sound. 14440 sound = self._soundById(id[i]); 14441 14442 if (sound) { 14443 // Keep track of our position when the rate changed and update the playback 14444 // start position so we can properly adjust the seek position for time elapsed. 14445 sound._rateSeek = self.seek(id[i]); 14446 sound._playStart = self._webAudio ? Howler.ctx.currentTime : sound._playStart; 14447 sound._rate = rate; 14448 14449 // Change the playback rate. 14450 if (self._webAudio && sound._node && sound._node.bufferSource) { 14451 sound._node.bufferSource.playbackRate.value = rate; 14452 } else if (sound._node) { 14453 sound._node.playbackRate = rate; 14454 } 14455 14456 // Reset the timers. 14457 var seek = self.seek(id[i]); 14458 var duration = ((self._sprite[sound._sprite][0] + self._sprite[sound._sprite][1]) / 1000) - seek; 14459 var timeout = (duration * 1000) / Math.abs(sound._rate); 14460 14461 // Start a new end timer if sound is already playing. 14462 if (self._endTimers[id[i]] || !sound._paused) { 14463 self._clearTimer(id[i]); 14464 self._endTimers[id[i]] = setTimeout(self._ended.bind(self, sound), timeout); 14465 } 14466 14467 self._emit('rate', sound._id); 14468 } 14469 } 14470 } else { 14471 sound = self._soundById(id); 14472 return sound ? sound._rate : self._rate; 14473 } 14474 14475 return self; 14476 }, 14477 14478 /** 14479 * Get/set the seek position of a sound. This method can optionally take 0, 1 or 2 arguments. 14480 * seek() -> Returns the first sound node's current seek position. 14481 * seek(id) -> Returns the sound id's current seek position. 14482 * seek(seek) -> Sets the seek position of the first sound node. 14483 * seek(seek, id) -> Sets the seek position of passed sound id. 14484 * @return {Howl/Number} Returns self or the current seek position. 14485 */ 14486 seek: function() { 14487 var self = this; 14488 var args = arguments; 14489 var seek, id; 14490 14491 // Determine the values based on arguments. 14492 if (args.length === 0) { 14493 // We will simply return the current position of the first node. 14494 id = self._sounds[0]._id; 14495 } else if (args.length === 1) { 14496 // First check if this is an ID, and if not, assume it is a new seek position. 14497 var ids = self._getSoundIds(); 14498 var index = ids.indexOf(args[0]); 14499 if (index >= 0) { 14500 id = parseInt(args[0], 10); 14501 } else { 14502 id = self._sounds[0]._id; 14503 seek = parseFloat(args[0]); 14504 } 14505 } else if (args.length === 2) { 14506 seek = parseFloat(args[0]); 14507 id = parseInt(args[1], 10); 14508 } 14509 14510 // If there is no ID, bail out. 14511 if (typeof id === 'undefined') { 14512 return self; 14513 } 14514 14515 // If the sound hasn't loaded, add it to the load queue to seek when capable. 14516 if (self._state !== 'loaded') { 14517 self._queue.push({ 14518 event: 'seek', 14519 action: function() { 14520 self.seek.apply(self, args); 14521 } 14522 }); 14523 14524 return self; 14525 } 14526 14527 // Get the sound. 14528 var sound = self._soundById(id); 14529 14530 if (sound) { 14531 if (typeof seek === 'number' && seek >= 0) { 14532 // Pause the sound and update position for restarting playback. 14533 var playing = self.playing(id); 14534 if (playing) { 14535 self.pause(id, true); 14536 } 14537 14538 // Move the position of the track and cancel timer. 14539 sound._seek = seek; 14540 sound._ended = false;
14541 self._clearTimer(id); 14542 14543 // Restart the playback if the sound was playing. 14544 if (playing) { 14545 self.play(id, true); 14546 } 14547 14548 // Update the seek position for HTML5 Audio. 14549 if (!self._webAudio && sound._node) { 14550 sound._node.currentTime = seek; 14551 } 14552 14553 self._emit('seek', id); 14554 } else { 14555 if (self._webAudio) { 14556 var realTime = self.playing(id) ? Howler.ctx.currentTime - sound._playStart : 0; 14557 var rateSeek = sound._rateSeek ? sound._rateSeek - sound._seek : 0; 14558 return sound._seek + (rateSeek + realTime * Math.abs(sound._rate)); 14559 } else { 14560 return sound._node.currentTime; 14561 } 14562 } 14563 } 14564 14565 return self; 14566 }, 14567 14568 /** 14569 * Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not. 14570 * @param {Number} id The sound id to check. If none is passed, the whole sound group is checked. 14571 * @return {Boolean} True if playing and false if not. 14572 */ 14573 playing: function(id) { 14574 var self = this; 14575 14576 // Check the passed sound ID (if any). 14577 if (typeof id === 'number') { 14578 var sound = self._soundById(id); 14579 return sound ? !sound._paused : false; 14580 } 14581 14582 // Otherwise, loop through all sounds and check if any are playing. 14583 for (var i=0; i<self._sounds.length; i++) { 14584 if (!self._sounds[i]._paused) { 14585 return true; 14586 } 14587 } 14588 14589 return false; 14590 }, 14591 14592 /** 14593 * Get the duration of this sound. Passing a sound id will return the sprite duration. 14594 * @param {Number} id The sound id to check. If none is passed, return full source duration. 14595 * @return {Number} Audio duration in seconds. 14596 */ 14597 duration: function(id) { 14598 var self = this; 14599 var duration = self._duration; 14600 14601 // If we pass an ID, get the sound and return the sprite length. 14602 var sound = self._soundById(id); 14603 if (sound) { 14604 duration = self._sprite[sound._sprite][1] / 1000; 14605 } 14606 14607 return duration; 14608 }, 14609 14610 /** 14611 * Returns the current loaded state of this Howl. 14612 * @return {String} 'unloaded', 'loading', 'loaded' 14613 */ 14614 state: function() { 14615 return this._state; 14616 }, 14617 14618 /** 14619 * Unload and destroy the current Howl object. 14620 * This will immediately stop all sound instances attached to this group. 14621 */ 14622 unload: function() { 14623 var self = this; 14624 14625 // Stop playing any active sounds. 14626 var sounds = self._sounds; 14627 for (var i=0; i<sounds.length; i++) { 14628 // Stop the sound if it is currently playing. 14629 if (!sounds[i]._paused) { 14630 self.stop(sounds[i]._id); 14631 } 14632 14633 // Remove the source or disconnect. 14634 if (!self._webAudio) { 14635 // Set the source to 0-second silence to stop any downloading. 14636 sounds[i]._node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA'; 14637 14638 // Remove any event listeners. 14639 sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false); 14640 sounds[i]._node.removeEventListener(Howler._canPlayEvent, sounds[i]._loadFn, false); 14641 } 14642 14643 // Empty out all of the nodes. 14644 delete sounds[i]._node; 14645 14646 // Make sure all timers are cleared out. 14647 self._clearTimer(sounds[i]._id); 14648 14649 // Remove the references in the global Howler object. 14650 var index = Howler._howls.indexOf(self); 14651 if (index >= 0) { 14652 Howler._howls.splice(index, 1); 14653 } 14654 } 14655 14656 // Delete this sound from the cache (if no other Howl is using it). 14657 var remCache = true; 14658 for (i=0; i<Howler._howls.length; i++) { 14659 if (Howler._howls[i]._src === self._src) { 14660 remCache = false; 14661 break; 14662 } 14663 } 14664 14665 if (cache && remCache) { 14666 delete cache[self._src]; 14667 } 14668 14669 // Clear global errors. 14670 Howler.noAudio = false;
vendor: 40,218 bytes, lines 14671-15898
14671 14672 // Clear out `self`. 14673 self._state = 'unloaded'; 14674 self._sounds = []; 14675 self = null; 14676 14677 return null; 14678 }, 14679 14680 /** 14681 * Listen to a custom event. 14682 * @param {String} event Event name. 14683 * @param {Function} fn Listener to call. 14684 * @param {Number} id (optional) Only listen to events for this sound. 14685 * @param {Number} once (INTERNAL) Marks event to fire only once. 14686 * @return {Howl} 14687 */ 14688 on: function(event, fn, id, once) { 14689 var self = this; 14690 var events = self['_on' + event]; 14691 14692 if (typeof fn === 'function') { 14693 events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn}); 14694 } 14695 14696 return self; 14697 }, 14698 14699 /** 14700 * Remove a custom event. Call without parameters to remove all events. 14701 * @param {String} event Event name. 14702 * @param {Function} fn Listener to remove. Leave empty to remove all. 14703 * @param {Number} id (optional) Only remove events for this sound. 14704 * @return {Howl} 14705 */ 14706 off: function(event, fn, id) { 14707 var self = this; 14708 var events = self['_on' + event]; 14709 var i = 0; 14710 14711 if (fn) { 14712 // Loop through event store and remove the passed function. 14713 for (i=0; i<events.length; i++) { 14714 if (fn === events[i].fn && id === events[i].id) { 14715 events.splice(i, 1); 14716 break; 14717 } 14718 } 14719 } else if (event) { 14720 // Clear out all events of this type. 14721 self['_on' + event] = []; 14722 } else { 14723 // Clear out all events of every type. 14724 var keys = Object.keys(self); 14725 for (i=0; i<keys.length; i++) { 14726 if ((keys[i].indexOf('_on') === 0) && Array.isArray(self[keys[i]])) { 14727 self[keys[i]] = []; 14728 } 14729 } 14730 } 14731 14732 return self; 14733 }, 14734 14735 /** 14736 * Listen to a custom event and remove it once fired. 14737 * @param {String} event Event name. 14738 * @param {Function} fn Listener to call. 14739 * @param {Number} id (optional) Only listen to events for this sound. 14740 * @return {Howl} 14741 */ 14742 once: function(event, fn, id) { 14743 var self = this; 14744 14745 // Setup the event listener. 14746 self.on(event, fn, id, 1); 14747 14748 return self; 14749 }, 14750 14751 /** 14752 * Emit all events of a specific type and pass the sound id. 14753 * @param {String} event Event name. 14754 * @param {Number} id Sound ID. 14755 * @param {Number} msg Message to go with event. 14756 * @return {Howl} 14757 */ 14758 _emit: function(event, id, msg) { 14759 var self = this; 14760 var events = self['_on' + event]; 14761 14762 // Loop through event store and fire all functions. 14763 for (var i=events.length-1; i>=0; i--) { 14764 if (!events[i].id || events[i].id === id || event === 'load') { 14765 setTimeout(function(fn) { 14766 fn.call(this, id, msg); 14767 }.bind(self, events[i].fn), 0); 14768 14769 // If this event was setup with `once`, remove it. 14770 if (events[i].once) { 14771 self.off(event, events[i].fn, events[i].id); 14772 } 14773 } 14774 } 14775 14776 return self; 14777 }, 14778 14779 /** 14780 * Queue of actions initiated before the sound has loaded. 14781 * These will be called in sequence, with the next only firing 14782 * after the previous has finished executing (even if async like play). 14783 * @return {Howl} 14784 */ 14785 _loadQueue: function() { 14786 var self = this; 14787 14788 if (self._queue.length > 0) { 14789 var task = self._queue[0]; 14790 14791 // don't move onto the next task until this one is done 14792 self.once(task.event, function() { 14793 self._queue.shift(); 14794 self._loadQueue(); 14795 }); 14796 14797 task.action(); 14798 } 14799 14800 return self; 14801 }, 14802 14803 /** 14804 * Fired when playback ends at the end of the duration. 14805 * @param {Sound} sound The sound object to work with. 14806 * @return {Howl} 14807 */ 14808 _ended: function(sound) { 14809 var self = this; 14810 var sprite = sound._sprite; 14811 14812 // Should this sound loop? 14813 var loop = !!(sound._loop || self._sprite[sprite][2]); 14814 14815 // Fire the ended event. 14816 self._emit('end', sound._id); 14817 14818 // Restart the playback for HTML5 Audio loop. 14819 if (!self._webAudio && loop) { 14820 self.stop(sound._id, true).play(sound._id); 14821 } 14822 14823 // Restart this timer if on a Web Audio loop. 14824 if (self._webAudio && loop) { 14825 self._emit('play', sound._id); 14826 sound._seek = sound._start || 0; 14827 sound._rateSeek = 0; 14828 sound._playStart = Howler.ctx.currentTime; 14829 14830 var timeout = ((sound._stop - sound._start) * 1000) / Math.abs(sound._rate); 14831 self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); 14832 } 14833 14834 // Mark the node as paused. 14835 if (self._webAudio && !loop) { 14836 sound._paused = true; 14837 sound._ended = true; 14838 sound._seek = sound._start || 0; 14839 sound._rateSeek = 0; 14840 self._clearTimer(sound._id); 14841 14842 // Clean up the buffer source. 14843 self._cleanBuffer(sound._node); 14844 14845 // Attempt to auto-suspend AudioContext if no sounds are still playing. 14846 Howler._autoSuspend(); 14847 } 14848 14849 // When using a sprite, end the track. 14850 if (!self._webAudio && !loop) { 14851 self.stop(sound._id); 14852 } 14853 14854 return self; 14855 }, 14856 14857 /** 14858 * Clear the end timer for a sound playback. 14859 * @param {Number} id The sound ID. 14860 * @return {Howl} 14861 */ 14862 _clearTimer: function(id) { 14863 var self = this; 14864 14865 if (self._endTimers[id]) { 14866 clearTimeout(self._endTimers[id]); 14867 delete self._endTimers[id]; 14868 } 14869 14870 return self; 14871 }, 14872 14873 /** 14874 * Return the sound identified by this ID, or return null. 14875 * @param {Number} id Sound ID 14876 * @return {Object} Sound object or null. 14877 */ 14878 _soundById: function(id) { 14879 var self = this; 14880 14881 // Loop through all sounds and find the one with this ID. 14882 for (var i=0; i<self._sounds.length; i++) { 14883 if (id === self._sounds[i]._id) { 14884 return self._sounds[i]; 14885 } 14886 } 14887 14888 return null; 14889 }, 14890 14891 /** 14892 * Return an inactive sound from the pool or create a new one. 14893 * @return {Sound} Sound playback object. 14894 */ 14895 _inactiveSound: function() { 14896 var self = this; 14897 14898 self._drain(); 14899 14900 // Find the first inactive node to recycle. 14901 for (var i=0; i<self._sounds.length; i++) { 14902 if (self._sounds[i]._ended) { 14903 return self._sounds[i].reset(); 14904 } 14905 } 14906 14907 // If no inactive node was found, create a new one. 14908 return new Sound(self); 14909 }, 14910 14911 /** 14912 * Drain excess inactive sounds from the pool. 14913 */ 14914 _drain: function() { 14915 var self = this; 14916 var limit = self._pool; 14917 var cnt = 0; 14918 var i = 0; 14919 14920 // If there are less sounds than the max pool size, we are done. 14921 if (self._sounds.length < limit) { 14922 return; 14923 } 14924 14925 // Count the number of inactive sounds. 14926 for (i=0; i<self._sounds.length; i++) { 14927 if (self._sounds[i]._ended) { 14928 cnt++; 14929 } 14930 } 14931 14932 // Remove excess inactive sounds, going in reverse order. 14933 for (i=self._sounds.length - 1; i>=0; i--) { 14934 if (cnt <= limit) { 14935 return; 14936 } 14937 14938 if (self._sounds[i]._ended) { 14939 // Disconnect the audio source when using Web Audio. 14940 if (self._webAudio && self._sounds[i]._node) { 14941 self._sounds[i]._node.disconnect(0); 14942 } 14943 14944 // Remove sounds until we have the pool size. 14945 self._sounds.splice(i, 1); 14946 cnt--; 14947 } 14948 } 14949 }, 14950 14951 /** 14952 * Get all ID's from the sounds pool. 14953 * @param {Number} id Only return one ID if one is passed. 14954 * @return {Array} Array of IDs. 14955 */ 14956 _getSoundIds: function(id) { 14957 var self = this; 14958 14959 if (typeof id === 'undefined') { 14960 var ids = []; 14961 for (var i=0; i<self._sounds.length; i++) { 14962 ids.push(self._sounds[i]._id); 14963 } 14964 14965 return ids; 14966 } else { 14967 return [id]; 14968 } 14969 }, 14970 14971 /** 14972 * Load the sound back into the buffer source. 14973 * @param {Sound} sound The sound object to work with. 14974 * @return {Howl} 14975 */ 14976 _refreshBuffer: function(sound) { 14977 var self = this; 14978 14979 // Setup the buffer source for playback. 14980 sound._node.bufferSource = Howler.ctx.createBufferSource(); 14981 sound._node.bufferSource.buffer = cache[self._src]; 14982 14983 // Connect to the correct node. 14984 if (sound._panner) { 14985 sound._node.bufferSource.connect(sound._panner); 14986 } else { 14987 sound._node.bufferSource.connect(sound._node); 14988 } 14989 14990 // Setup looping and playback rate. 14991 sound._node.bufferSource.loop = sound._loop; 14992 if (sound._loop) { 14993 sound._node.bufferSource.loopStart = sound._start || 0; 14994 sound._node.bufferSource.loopEnd = sound._stop; 14995 } 14996 sound._node.bufferSource.playbackRate.value = sound._rate; 14997 14998 return self; 14999 }, 15000 15001 /** 15002 * Prevent memory leaks by cleaning up the buffer source after playback. 15003 * @param {Object} node Sound's audio node containing the buffer source. 15004 * @return {Howl} 15005 */ 15006 _cleanBuffer: function(node) { 15007 var self = this; 15008 15009 if (self._scratchBuffer) { 15010 node.bufferSource.onended = null; 15011 node.bufferSource.disconnect(0); 15012 try { node.bufferSource.buffer = self._scratchBuffer; } catch(e) {} 15013 } 15014 node.bufferSource = null; 15015 15016 return self; 15017 } 15018 }; 15019 15020 /** Single Sound Methods **/ 15021 /***************************************************************************/ 15022 15023 /** 15024 * Setup the sound object, which each node attached to a Howl group is contained in. 15025 * @param {Object} howl The Howl parent group. 15026 */ 15027 var Sound = function(howl) { 15028 this._parent = howl; 15029 this.init(); 15030 }; 15031 Sound.prototype = { 15032 /** 15033 * Initialize a new Sound object. 15034 * @return {Sound} 15035 */ 15036 init: function() { 15037 var self = this; 15038 var parent = self._parent; 15039 15040 // Setup the default parameters. 15041 self._muted = parent._muted; 15042 self._loop = parent._loop; 15043 self._volume = parent._volume; 15044 self._muted = parent._muted; 15045 self._rate = parent._rate; 15046 self._seek = 0; 15047 self._paused = true; 15048 self._ended = true; 15049 self._sprite = '__default'; 15050 15051 // Generate a unique ID for this sound. 15052 self._id = ++Howler._counter; 15053 15054 // Add itself to the parent's pool. 15055 parent._sounds.push(self); 15056 15057 // Create the new node. 15058 self.create(); 15059 15060 return self; 15061 }, 15062 15063 /** 15064 * Create and setup a new sound object, whether HTML5 Audio or Web Audio. 15065 * @return {Sound} 15066 */ 15067 create: function() { 15068 var self = this; 15069 var parent = self._parent; 15070 var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume; 15071 15072 if (parent._webAudio) { 15073 // Create the gain node for controlling volume (the source will connect to this). 15074 self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain(); 15075 self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime); 15076 self._node.paused = true; 15077 self._node.connect(Howler.masterGain); 15078 } else { 15079 self._node = new Audio(); 15080 15081 // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror). 15082 self._errorFn = self._errorListener.bind(self); 15083 self._node.addEventListener('error', self._errorFn, false); 15084 15085 // Listen for 'canplaythrough' event to let us know the sound is ready. 15086 self._loadFn = self._loadListener.bind(self); 15087 self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false); 15088 15089 // Setup the new audio node. 15090 self._node.src = parent._src; 15091 self._node.preload = 'auto'; 15092 self._node.volume = volume * Howler.volume(); 15093 15094 // Begin loading the source. 15095 self._node.load(); 15096 } 15097 15098 return self; 15099 }, 15100 15101 /** 15102 * Reset the parameters of this sound to the original state (for recycle). 15103 * @return {Sound} 15104 */ 15105 reset: function() { 15106 var self = this; 15107 var parent = self._parent; 15108 15109 // Reset all of the parameters of this sound. 15110 self._muted = parent._muted; 15111 self._loop = parent._loop; 15112 self._volume = parent._volume; 15113 self._muted = parent._muted; 15114 self._rate = parent._rate; 15115 self._seek = 0; 15116 self._rateSeek = 0; 15117 self._paused = true; 15118 self._ended = true; 15119 self._sprite = '__default'; 15120 15121 // Generate a new ID so that it isn't confused with the previous sound. 15122 self._id = ++Howler._counter; 15123 15124 return self; 15125 }, 15126 15127 /** 15128 * HTML5 Audio error listener callback. 15129 */ 15130 _errorListener: function() { 15131 var self = this; 15132 15133 // Fire an error event and pass back the code. 15134 self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0); 15135 15136 // Clear the event listener. 15137 self._node.removeEventListener('error', self._errorListener, false); 15138 }, 15139 15140 /** 15141 * HTML5 Audio canplaythrough listener callback. 15142 */ 15143 _loadListener: function() { 15144 var self = this; 15145 var parent = self._parent; 15146 15147 // Round up the duration to account for the lower precision in HTML5 Audio. 15148 parent._duration = Math.ceil(self._node.duration * 10) / 10; 15149 15150 // Setup a sprite if none is defined. 15151 if (Object.keys(parent._sprite).length === 0) { 15152 parent._sprite = {__default: [0, parent._duration * 1000]}; 15153 } 15154 15155 if (parent._state !== 'loaded') { 15156 parent._state = 'loaded'; 15157 parent._emit('load'); 15158 parent._loadQueue(); 15159 } 15160 15161 // Clear the event listener. 15162 self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false); 15163 } 15164 }; 15165 15166 /** Helper Methods **/ 15167 /***************************************************************************/ 15168 15169 var cache = {}; 15170 15171 /** 15172 * Buffer a sound from URL, Data URI or cache and decode to audio source (Web Audio API). 15173 * @param {Howl} self 15174 */ 15175 var loadBuffer = function(self) { 15176 var url = self._src; 15177 15178 // Check if the buffer has already been cached and use it instead. 15179 if (cache[url]) { 15180 // Set the duration from the cache. 15181 self._duration = cache[url].duration; 15182 15183 // Load the sound into this Howl. 15184 loadSound(self); 15185 15186 return; 15187 } 15188 15189 if (/^data:[^;]+;base64,/.test(url)) { 15190 // Decode the base64 data URI without XHR, since some browsers don't support it. 15191 var data = atob(url.split(',')[1]); 15192 var dataView = new Uint8Array(data.length); 15193 for (var i=0; i<data.length; ++i) { 15194 dataView[i] = data.charCodeAt(i); 15195 } 15196 15197 decodeAudioData(dataView.buffer, self); 15198 } else { 15199 // Load the buffer from the URL. 15200 var xhr = new XMLHttpRequest(); 15201 xhr.open('GET', url, true); 15202 xhr.responseType = 'arraybuffer'; 15203 xhr.onload = function() { 15204 // Make sure we get a successful response back. 15205 var code = (xhr.status + '')[0]; 15206 if (code !== '0' && code !== '2' && code !== '3') { 15207 self._emit('loaderror', null, 'Failed loading audio file with status: ' + xhr.status + '.'); 15208 return; 15209 } 15210 15211 decodeAudioData(xhr.response, self); 15212 }; 15213 xhr.onerror = function() { 15214 // If there is an error, switch to HTML5 Audio. 15215 if (self._webAudio) { 15216 self._html5 = true; 15217 self._webAudio = false; 15218 self._sounds = []; 15219 delete cache[url]; 15220 self.load(); 15221 } 15222 }; 15223 safeXhrSend(xhr); 15224 } 15225 }; 15226 15227 /** 15228 * Send the XHR request wrapped in a try/catch. 15229 * @param {Object} xhr XHR to send. 15230 */ 15231 var safeXhrSend = function(xhr) { 15232 try { 15233 xhr.send(); 15234 } catch (e) { 15235 xhr.onerror(); 15236 } 15237 }; 15238 15239 /** 15240 * Decode audio data from an array buffer. 15241 * @param {ArrayBuffer} arraybuffer The audio data. 15242 * @param {Howl} self 15243 */ 15244 var decodeAudioData = function(arraybuffer, self) { 15245 // Decode the buffer into an audio source. 15246 Howler.ctx.decodeAudioData(arraybuffer, function(buffer) { 15247 if (buffer && self._sounds.length > 0) { 15248 cache[self._src] = buffer; 15249 loadSound(self, buffer); 15250 } 15251 }, function() { 15252 self._emit('loaderror', null, 'Decoding audio data failed.'); 15253 }); 15254 }; 15255 15256 /** 15257 * Sound is now loaded, so finish setting everything up and fire the loaded event. 15258 * @param {Howl} self 15259 * @param {Object} buffer The decoded buffer sound source. 15260 */ 15261 var loadSound = function(self, buffer) { 15262 // Set the duration. 15263 if (buffer && !self._duration) { 15264 self._duration = buffer.duration; 15265 } 15266 15267 // Setup a sprite if none is defined. 15268 if (Object.keys(self._sprite).length === 0) { 15269 self._sprite = {__default: [0, self._duration * 1000]}; 15270 } 15271 15272 // Fire the loaded event. 15273 if (self._state !== 'loaded') { 15274 self._state = 'loaded'; 15275 self._emit('load'); 15276 self._loadQueue(); 15277 } 15278 }; 15279 15280 /** 15281 * Setup the audio context when available, or switch to HTML5 Audio mode. 15282 */ 15283 var setupAudioContext = function() { 15284 // Check if we are using Web Audio and setup the AudioContext if we are. 15285 try { 15286 if (typeof AudioContext !== 'undefined') { 15287 Howler.ctx = new AudioContext(); 15288 } else if (typeof webkitAudioContext !== 'undefined') { 15289 Howler.ctx = new webkitAudioContext(); 15290 } else { 15291 Howler.usingWebAudio = false; 15292 } 15293 } catch(e) { 15294 Howler.usingWebAudio = false; 15295 } 15296 15297 // Check if a webview is being used on iOS8 or earlier (rather than the browser). 15298 // If it is, disable Web Audio as it causes crashing. 15299 var iOS = (/iP(hone|od|ad)/.test(Howler._navigator && Howler._navigator.platform)); 15300 var appVersion = Howler._navigator && Howler._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); 15301 var version = appVersion ? parseInt(appVersion[1], 10) : null; 15302 if (iOS && version && version < 9) { 15303 var safari = /safari/.test(Howler._navigator && Howler._navigator.userAgent.toLowerCase()); 15304 if (Howler._navigator && Howler._navigator.standalone && !safari || Howler._navigator && !Howler._navigator.standalone && !safari) { 15305 Howler.usingWebAudio = false; 15306 } 15307 } 15308 15309 // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage). 15310 if (Howler.usingWebAudio) { 15311 Howler.masterGain = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain(); 15312 Howler.masterGain.gain.value = 1; 15313 Howler.masterGain.connect(Howler.ctx.destination); 15314 } 15315 15316 // Re-run the setup on Howler. 15317 Howler._setup(); 15318 }; 15319 15320 // Add support for AMD (Asynchronous Module Definition) libraries such as require.js. 15321 if (true) { 15322 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { 15323 return { 15324 Howler: Howler, 15325 Howl: Howl 15326 }; 15327 }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 15328 } 15329 15330 // Add support for CommonJS libraries such as browserify. 15331 if (true) { 15332 exports.Howler = Howler; 15333 exports.Howl = Howl; 15334 } 15335 15336 // Define globally in case AMD is not available or unused. 15337 if (typeof window !== 'undefined') { 15338 window.HowlerGlobal = HowlerGlobal; 15339 window.Howler = Howler; 15340 window.Howl = Howl; 15341 window.Sound = Sound; 15342 } else if (typeof global !== 'undefined') { // Add to global in Node.js (for testing, etc). 15343 global.HowlerGlobal = HowlerGlobal; 15344 global.Howler = Howler; 15345 global.Howl = Howl; 15346 global.Sound = Sound; 15347 } 15348 })(); 15349 15350 15351 /*! 15352 * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. 15353 * 15354 * howler.js v2.0.3 15355 * howlerjs.com 15356 * 15357 * (c) 2013-2017, James Simpson of GoldFire Studios 15358 * goldfirestudios.com 15359 * 15360 * MIT License 15361 */ 15362 15363 (function() { 15364 15365 'use strict'; 15366 15367 // Setup default properties. 15368 HowlerGlobal.prototype._pos = [0, 0, 0]; 15369 HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0]; 15370 15371 /** Global Methods **/ 15372 /***************************************************************************/ 15373 15374 /** 15375 * Helper method to update the stereo panning position of all current Howls. 15376 * Future Howls will not use this value unless explicitly set. 15377 * @param {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right. 15378 * @return {Howler/Number} Self or current stereo panning value. 15379 */ 15380 HowlerGlobal.prototype.stereo = function(pan) { 15381 var self = this; 15382 15383 // Stop right here if not using Web Audio. 15384 if (!self.ctx || !self.ctx.listener) { 15385 return self; 15386 } 15387 15388 // Loop through all Howls and update their stereo panning. 15389 for (var i=self._howls.length-1; i>=0; i--) { 15390 self._howls[i].stereo(pan); 15391 } 15392 15393 return self; 15394 }; 15395 15396 /** 15397 * Get/set the position of the listener in 3D cartesian space. Sounds using 15398 * 3D position will be relative to the listener's position. 15399 * @param {Number} x The x-position of the listener. 15400 * @param {Number} y The y-position of the listener. 15401 * @param {Number} z The z-position of the listener. 15402 * @return {Howler/Array} Self or current listener position. 15403 */ 15404 HowlerGlobal.prototype.pos = function(x, y, z) { 15405 var self = this; 15406 15407 // Stop right here if not using Web Audio. 15408 if (!self.ctx || !self.ctx.listener) { 15409 return self; 15410 } 15411 15412 // Set the defaults for optional 'y' & 'z'. 15413 y = (typeof y !== 'number') ? self._pos[1] : y; 15414 z = (typeof z !== 'number') ? self._pos[2] : z; 15415 15416 if (typeof x === 'number') { 15417 self._pos = [x, y, z]; 15418 self.ctx.listener.setPosition(self._pos[0], self._pos[1], self._pos[2]); 15419 } else { 15420 return self._pos; 15421 } 15422 15423 return self; 15424 }; 15425 15426 /** 15427 * Get/set the direction the listener is pointing in the 3D cartesian space. 15428 * A front and up vector must be provided. The front is the direction the 15429 * face of the listener is pointing, and up is the direction the top of the 15430 * listener is pointing. Thus, these values are expected to be at right angles 15431 * from each other. 15432 * @param {Number} x The x-orientation of the listener. 15433 * @param {Number} y The y-orientation of the listener. 15434 * @param {Number} z The z-orientation of the listener. 15435 * @param {Number} xUp The x-orientation of the top of the listener. 15436 * @param {Number} yUp The y-orientation of the top of the listener. 15437 * @param {Number} zUp The z-orientation of the top of the listener. 15438 * @return {Howler/Array} Returns self or the current orientation vectors. 15439 */ 15440 HowlerGlobal.prototype.orientation = function(x, y, z, xUp, yUp, zUp) { 15441 var self = this; 15442 15443 // Stop right here if not using Web Audio. 15444 if (!self.ctx || !self.ctx.listener) { 15445 return self; 15446 } 15447 15448 // Set the defaults for optional 'y' & 'z'. 15449 var or = self._orientation; 15450 y = (typeof y !== 'number') ? or[1] : y; 15451 z = (typeof z !== 'number') ? or[2] : z; 15452 xUp = (typeof xUp !== 'number') ? or[3] : xUp; 15453 yUp = (typeof yUp !== 'number') ? or[4] : yUp; 15454 zUp = (typeof zUp !== 'number') ? or[5] : zUp; 15455 15456 if (typeof x === 'number') { 15457 self._orientation = [x, y, z, xUp, yUp, zUp]; 15458 self.ctx.listener.setOrientation(x, y, z, xUp, yUp, zUp); 15459 } else { 15460 return or; 15461 } 15462 15463 return self; 15464 }; 15465 15466 /** Group Methods **/ 15467 /***************************************************************************/ 15468 15469 /** 15470 * Add new properties to the core init. 15471 * @param {Function} _super Core init method. 15472 * @return {Howl} 15473 */ 15474 Howl.prototype.init = (function(_super) { 15475 return function(o) { 15476 var self = this; 15477 15478 // Setup user-defined default properties. 15479 self._orientation = o.orientation || [1, 0, 0]; 15480 self._stereo = o.stereo || null; 15481 self._pos = o.pos || null; 15482 self._pannerAttr = { 15483 coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : 360, 15484 coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : 360, 15485 coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : 0, 15486 distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : 'inverse', 15487 maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : 10000, 15488 panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : 'HRTF', 15489 refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : 1, 15490 rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : 1 15491 }; 15492 15493 // Setup event listeners. 15494 self._onstereo = o.onstereo ? [{fn: o.onstereo}] : []; 15495 self._onpos = o.onpos ? [{fn: o.onpos}] : []; 15496 self._onorientation = o.onorientation ? [{fn: o.onorientation}] : []; 15497 15498 // Complete initilization with howler.js core's init function. 15499 return _super.call(this, o); 15500 }; 15501 })(Howl.prototype.init); 15502 15503 /** 15504 * Get/set the stereo panning of the audio source for this sound or all in the group. 15505 * @param {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right. 15506 * @param {Number} id (optional) The sound ID. If none is passed, all in group will be updated. 15507 * @return {Howl/Number} Returns self or the current stereo panning value. 15508 */ 15509 Howl.prototype.stereo = function(pan, id) { 15510 var self = this; 15511 15512 // Stop right here if not using Web Audio. 15513 if (!self._webAudio) { 15514 return self; 15515 } 15516 15517 // If the sound hasn't loaded, add it to the load queue to change stereo pan when capable. 15518 if (self._state !== 'loaded') { 15519 self._queue.push({ 15520 event: 'stereo', 15521 action: function() { 15522 self.stereo(pan, id); 15523 } 15524 }); 15525 15526 return self; 15527 } 15528 15529 // Check for PannerStereoNode support and fallback to PannerNode if it doesn't exist. 15530 var pannerType = (typeof Howler.ctx.createStereoPanner === 'undefined') ? 'spatial' : 'stereo'; 15531 15532 // Setup the group's stereo panning if no ID is passed. 15533 if (typeof id === 'undefined') { 15534 // Return the group's stereo panning if no parameters are passed. 15535 if (typeof pan === 'number') { 15536 self._stereo = pan; 15537 self._pos = [pan, 0, 0]; 15538 } else { 15539 return self._stereo; 15540 } 15541 } 15542 15543 // Change the streo panning of one or all sounds in group. 15544 var ids = self._getSoundIds(id); 15545 for (var i=0; i<ids.length; i++) { 15546 // Get the sound. 15547 var sound = self._soundById(ids[i]); 15548 15549 if (sound) { 15550 if (typeof pan === 'number') { 15551 sound._stereo = pan; 15552 sound._pos = [pan, 0, 0]; 15553 15554 if (sound._node) { 15555 // If we are falling back, make sure the panningModel is equalpower. 15556 sound._pannerAttr.panningModel = 'equalpower'; 15557 15558 // Check if there is a panner setup and create a new one if not. 15559 if (!sound._panner || !sound._panner.pan) { 15560 setupPanner(sound, pannerType); 15561 } 15562 15563 if (pannerType === 'spatial') { 15564 sound._panner.setPosition(pan, 0, 0); 15565 } else { 15566 sound._panner.pan.value = pan; 15567 } 15568 } 15569 15570 self._emit('stereo', sound._id); 15571 } else { 15572 return sound._stereo; 15573 } 15574 } 15575 } 15576 15577 return self; 15578 }; 15579 15580 /** 15581 * Get/set the 3D spatial position of the audio source for this sound or 15582 * all in the group. The most common usage is to set the 'x' position for 15583 * left/right panning. Setting any value higher than 1.0 will begin to 15584 * decrease the volume of the sound as it moves further away. 15585 * @param {Number} x The x-position of the audio from -1000.0 to 1000.0. 15586 * @param {Number} y The y-position of the audio from -1000.0 to 1000.0. 15587 * @param {Number} z The z-position of the audio from -1000.0 to 1000.0. 15588 * @param {Number} id (optional) The sound ID. If none is passed, all in group will be updated. 15589 * @return {Howl/Array} Returns self or the current 3D spatial position: [x, y, z]. 15590 */ 15591 Howl.prototype.pos = function(x, y, z, id) { 15592 var self = this; 15593 15594 // Stop right here if not using Web Audio. 15595 if (!self._webAudio) { 15596 return self; 15597 } 15598 15599 // If the sound hasn't loaded, add it to the load queue to change position when capable. 15600 if (self._state !== 'loaded') { 15601 self._queue.push({ 15602 event: 'pos', 15603 action: function() { 15604 self.pos(x, y, z, id); 15605 } 15606 }); 15607 15608 return self; 15609 } 15610 15611 // Set the defaults for optional 'y' & 'z'. 15612 y = (typeof y !== 'number') ? 0 : y; 15613 z = (typeof z !== 'number') ? -0.5 : z; 15614 15615 // Setup the group's spatial position if no ID is passed. 15616 if (typeof id === 'undefined') { 15617 // Return the group's spatial position if no parameters are passed. 15618 if (typeof x === 'number') { 15619 self._pos = [x, y, z]; 15620 } else { 15621 return self._pos; 15622 } 15623 } 15624 15625 // Change the spatial position of one or all sounds in group. 15626 var ids = self._getSoundIds(id); 15627 for (var i=0; i<ids.length; i++) { 15628 // Get the sound. 15629 var sound = self._soundById(ids[i]); 15630 15631 if (sound) { 15632 if (typeof x === 'number') { 15633 sound._pos = [x, y, z]; 15634 15635 if (sound._node) { 15636 // Check if there is a panner setup and create a new one if not. 15637 if (!sound._panner || sound._panner.pan) { 15638 setupPanner(sound, 'spatial'); 15639 } 15640 15641 sound._panner.setPosition(x, y, z); 15642 } 15643 15644 self._emit('pos', sound._id); 15645 } else { 15646 return sound._pos; 15647 } 15648 } 15649 } 15650 15651 return self; 15652 }; 15653 15654 /** 15655 * Get/set the direction the audio source is pointing in the 3D cartesian coordinate 15656 * space. Depending on how direction the sound is, based on the `cone` attributes, 15657 * a sound pointing away from the listener can be quiet or silent. 15658 * @param {Number} x The x-orientation of the source. 15659 * @param {Number} y The y-orientation of the source. 15660 * @param {Number} z The z-orientation of the source. 15661 * @param {Number} id (optional) The sound ID. If none is passed, all in group will be updated. 15662 * @return {Howl/Array} Returns self or the current 3D spatial orientation: [x, y, z]. 15663 */ 15664 Howl.prototype.orientation = function(x, y, z, id) { 15665 var self = this; 15666 15667 // Stop right here if not using Web Audio. 15668 if (!self._webAudio) { 15669 return self; 15670 } 15671 15672 // If the sound hasn't loaded, add it to the load queue to change orientation when capable. 15673 if (self._state !== 'loaded') { 15674 self._queue.push({ 15675 event: 'orientation', 15676 action: function() { 15677 self.orientation(x, y, z, id); 15678 } 15679 }); 15680 15681 return self; 15682 } 15683 15684 // Set the defaults for optional 'y' & 'z'. 15685 y = (typeof y !== 'number') ? self._orientation[1] : y; 15686 z = (typeof z !== 'number') ? self._orientation[2] : z; 15687 15688 // Setup the group's spatial orientation if no ID is passed. 15689 if (typeof id === 'undefined') { 15690 // Return the group's spatial orientation if no parameters are passed. 15691 if (typeof x === 'number') { 15692 self._orientation = [x, y, z]; 15693 } else { 15694 return self._orientation; 15695 } 15696 } 15697 15698 // Change the spatial orientation of one or all sounds in group. 15699 var ids = self._getSoundIds(id); 15700 for (var i=0; i<ids.length; i++) { 15701 // Get the sound. 15702 var sound = self._soundById(ids[i]); 15703 15704 if (sound) { 15705 if (typeof x === 'number') { 15706 sound._orientation = [x, y, z]; 15707 15708 if (sound._node) { 15709 // Check if there is a panner setup and create a new one if not. 15710 if (!sound._panner) { 15711 // Make sure we have a position to setup the node with. 15712 if (!sound._pos) { 15713 sound._pos = self._pos || [0, 0, -0.5]; 15714 } 15715 15716 setupPanner(sound, 'spatial'); 15717 } 15718 15719 sound._panner.setOrientation(x, y, z); 15720 } 15721 15722 self._emit('orientation', sound._id); 15723 } else { 15724 return sound._orientation; 15725 } 15726 } 15727 } 15728 15729 return self; 15730 }; 15731 15732 /** 15733 * Get/set the panner node's attributes for a sound or group of sounds. 15734 * This method can optionall take 0, 1 or 2 arguments. 15735 * pannerAttr() -> Returns the group's values. 15736 * pannerAttr(id) -> Returns the sound id's values. 15737 * pannerAttr(o) -> Set's the values of all sounds in this Howl group. 15738 * pannerAttr(o, id) -> Set's the values of passed sound id. 15739 * 15740 * Attributes: 15741 * coneInnerAngle - (360 by default) There will be no volume reduction inside this angle. 15742 * coneOuterAngle - (360 by default) The volume will be reduced to a constant value of 15743 * `coneOuterGain` outside this angle. 15744 * coneOuterGain - (0 by default) The amount of volume reduction outside of `coneOuterAngle`. 15745 * distanceModel - ('inverse' by default) Determines algorithm to use to reduce volume as audio moves 15746 * away from listener. Can be `linear`, `inverse` or `exponential`. 15747 * maxDistance - (10000 by default) Volume won't reduce between source/listener beyond this distance. 15748 * panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio. 15749 * Can be `HRTF` or `equalpower`. 15750 * refDistance - (1 by default) A reference distance for reducing volume as the source 15751 * moves away from the listener. 15752 * rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. 15753 * 15754 * @return {Howl/Object} Returns self or current panner attributes. 15755 */ 15756 Howl.prototype.pannerAttr = function() { 15757 var self = this; 15758 var args = arguments; 15759 var o, id, sound; 15760 15761 // Stop right here if not using Web Audio. 15762 if (!self._webAudio) { 15763 return self; 15764 } 15765 15766 // Determine the values based on arguments. 15767 if (args.length === 0) { 15768 // Return the group's panner attribute values. 15769 return self._pannerAttr; 15770 } else if (args.length === 1) { 15771 if (typeof args[0] === 'object') { 15772 o = args[0]; 15773 15774 // Set the grou's panner attribute values. 15775 if (typeof id === 'undefined') { 15776 self._pannerAttr = { 15777 coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : self._coneInnerAngle, 15778 coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : self._coneOuterAngle, 15779 coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : self._coneOuterGain, 15780 distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : self._distanceModel, 15781 maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : self._maxDistance, 15782 panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : self._panningModel, 15783 refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : self._refDistance, 15784 rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : self._rolloffFactor 15785 }; 15786 } 15787 } else { 15788 // Return this sound's panner attribute values. 15789 sound = self._soundById(parseInt(args[0], 10)); 15790 return sound ? sound._pannerAttr : self._pannerAttr; 15791 } 15792 } else if (args.length === 2) { 15793 o = args[0]; 15794 id = parseInt(args[1], 10); 15795 } 15796 15797 // Update the values of the specified sounds. 15798 var ids = self._getSoundIds(id); 15799 for (var i=0; i<ids.length; i++) { 15800 sound = self._soundById(ids[i]); 15801 15802 if (sound) { 15803 // Merge the new values into the sound. 15804 var pa = sound._pannerAttr; 15805 pa = { 15806 coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : pa.coneInnerAngle, 15807 coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : pa.coneOuterAngle, 15808 coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : pa.coneOuterGain, 15809 distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : pa.distanceModel, 15810 maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : pa.maxDistance, 15811 panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel, 15812 refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : pa.refDistance, 15813 rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : pa.rolloffFactor 15814 }; 15815 15816 // Update the panner values or create a new panner if none exists. 15817 var panner = sound._panner; 15818 if (panner) { 15819 panner.coneInnerAngle = pa.coneInnerAngle; 15820 panner.coneOuterAngle = pa.coneOuterAngle; 15821 panner.coneOuterGain = pa.coneOuterGain; 15822 panner.distanceModel = pa.distanceModel; 15823 panner.maxDistance = pa.maxDistance; 15824 panner.panningModel = pa.panningModel; 15825 panner.refDistance = pa.refDistance; 15826 panner.rolloffFactor = pa.rolloffFactor; 15827 } else { 15828 // Make sure we have a position to setup the node with. 15829 if (!sound._pos) { 15830 sound._pos = self._pos || [0, 0, -0.5]; 15831 } 15832 15833 // Create a new panner node. 15834 setupPanner(sound, 'spatial'); 15835 } 15836 } 15837 } 15838 15839 return self; 15840 }; 15841 15842 /** Single Sound Methods **/ 15843 /***************************************************************************/ 15844 15845 /** 15846 * Add new properties to the core Sound init. 15847 * @param {Function} _super Core Sound init method. 15848 * @return {Sound} 15849 */ 15850 Sound.prototype.init = (function(_super) { 15851 return function() { 15852 var self = this; 15853 var parent = self._parent; 15854 15855 // Setup user-defined default properties. 15856 self._orientation = parent._orientation; 15857 self._stereo = parent._stereo; 15858 self._pos = parent._pos; 15859 self._pannerAttr = parent._pannerAttr; 15860 15861 // Complete initilization with howler.js core Sound's init function. 15862 _super.call(this); 15863 15864 // If a stereo or position was specified, set it up. 15865 if (self._stereo) { 15866 parent.stereo(self._stereo); 15867 } else if (self._pos) { 15868 parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id); 15869 } 15870 }; 15871 })(Sound.prototype.init); 15872 15873 /** 15874 * Override the Sound.reset method to clean up properties from the spatial plugin. 15875 * @param {Function} _super Sound reset method. 15876 * @return {Sound} 15877 */ 15878 Sound.prototype.reset = (function(_super) { 15879 return function() { 15880 var self = this; 15881 var parent = self._parent; 15882 15883 // Reset all spatial plugin properties on this sound. 15884 self._orientation = parent._orientation; 15885 self._pos = parent._pos; 15886 self._pannerAttr = parent._pannerAttr; 15887 15888 // Complete resetting of the sound. 15889 return _super.call(this); 15890 }; 15891 })(Sound.prototype.reset); 15892 15893 /** Helper Methods **/ 15894 /***************************************************************************/ 15895 15896 /** 15897 * Create a new panner node and save it on the sound. 15898 * @param {Sound}
15898 sound Specific sound to setup panning on. 15899 * @param {String} type Type of panner to create: 'stereo' or 'spatial'. 15900 */ 15901 var setupPanner = function(sound, type) { 15902 type = type || 'spatial'; 15903 15904 // Create the new panner node. 15905 if (type === 'spatial') { 15906 sound._panner = Howler.ctx.createPanner(); 15907 sound._panner.coneInnerAngle = sound._pannerAttr.coneInnerAngle; 15908 sound._panner.coneOuterAngle = sound._pannerAttr.coneOuterAngle; 15909 sound._panner.coneOuterGain = sound._pannerAttr.coneOuterGain; 15910 sound._panner.distanceModel = sound._pannerAttr.distanceModel; 15911 sound._panner.maxDistance = sound._pannerAttr.maxDistance; 15912 sound._panner.panningModel = sound._pannerAttr.panningModel; 15913 sound._panner.refDistance = sound._pannerAttr.refDistance; 15914 sound._panner.rolloffFactor = sound._pannerAttr.rolloffFactor; 15915 sound._panner.setPosition(sound._pos[0], sound._pos[1], sound._pos[2]); 15916 sound._panner.setOrientation(sound._orientation[0], sound._orientation[1], sound._orientation[2]); 15917 } else { 15918 sound._panner = Howler.ctx.createStereoPanner(); 15919 sound._panner.pan.value = sound._stereo; 15920 } 15921 15922 sound._panner.connect(sound._node); 15923 15924 // Update the connections. 15925 if (!sound._paused) { 15926 sound._parent.pause(sound._id, true).play(sound._id); 15927 } 15928 }; 15929 })(); 15930 15931 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 15932 15933/***/ }), 15934/* 301 */ 15935/***/ (function(module, exports, __webpack_require__) { 15936 15937 "use strict"; 15938 15939 Object.defineProperty(exports, "__esModule", { 15940 value: true 15941 }); 15942 15943 var _events = __webpack_require__(302); 15944 15945 var _events2 = _interopRequireDefault(_events); 15946 15947 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15948 15949 var events = new _events2.default(); 15950 events.setMaxListeners(10000); 15951 exports.default = events; 15952 15953/***/ }), 15954/* 302 */ 15955/***/ (function(module, exports) { 15956 15957 // Copyright Joyent, Inc. and other Node contributors. 15958 // 15959 // Permission is hereby granted, free of charge, to any person obtaining a 15960 // copy of this software and associated documentation files (the 15961 // "Software"), to deal in the Software without restriction, including 15962 // without limitation the rights to use, copy, modify, merge, publish, 15963 // distribute, sublicense, and/or sell copies of the Software, and to permit 15964 // persons to whom the Software is furnished to do so, subject to the 15965 // following conditions: 15966 // 15967 // The above copyright notice and this permission notice shall be included 15968 // in all copies or substantial portions of the Software. 15969 // 15970 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15971 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15972 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15973 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15974 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 15975 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 15976 // USE OR OTHER DEALINGS IN THE SOFTWARE. 15977 15978 function EventEmitter() { 15979 this._events = this._events || {}; 15980 this._maxListeners = this._maxListeners || undefined; 15981 } 15982 module.exports = EventEmitter; 15983 15984 // Backwards-compat with node 0.10.x 15985 EventEmitter.EventEmitter = EventEmitter; 15986 15987 EventEmitter.prototype._events = undefined; 15988 EventEmitter.prototype._maxListeners = undefined; 15989 15990 // By default EventEmitters will print a warning if more than 10 listeners are 15991 // added to it. This is a useful default which helps finding memory leaks. 15992 EventEmitter.defaultMaxListeners = 10; 15993 15994 // Obviously not all Emitters should be limited to 10. This function allows 15995 // that to be increased. Set to zero for unlimited. 15996 EventEmitter.prototype.setMaxListeners = function(n) { 15997 if (!isNumber(n) || n < 0 || isNaN(n)) 15998 throw TypeError('n must be a positive number'); 15999 this._maxListeners = n; 16000 return this; 16001 }; 16002 16003 EventEmitter.prototype.emit = function(type) { 16004 var er, handler, len, args, i, listeners; 16005 16006 if (!this._events) 16007 this._events = {}; 16008 16009 // If there is no 'error' event listener then throw. 16010 if (type === 'error') { 16011 if (!this._events.error || 16012 (isObject(this._events.error) && !this._events.error.length)) { 16013 er = arguments[1]; 16014 if (er instanceof Error) { 16015 throw er; // Unhandled 'error' event 16016 } else { 16017 // At least give some kind of context to the user 16018 var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); 16019 err.context = er; 16020 throw err; 16021 } 16022 } 16023 } 16024 16025 handler = this._events[type]; 16026 16027 if (isUndefined(handler)) 16028 return false;
vendor: 7,411 bytes, lines 16029-16308
16029 16030 if (isFunction(handler)) { 16031 switch (arguments.length) { 16032 // fast cases 16033 case 1: 16034 handler.call(this); 16035 break; 16036 case 2: 16037 handler.call(this, arguments[1]); 16038 break; 16039 case 3: 16040 handler.call(this, arguments[1], arguments[2]); 16041 break; 16042 // slower 16043 default: 16044 args = Array.prototype.slice.call(arguments, 1); 16045 handler.apply(this, args); 16046 } 16047 } else if (isObject(handler)) { 16048 args = Array.prototype.slice.call(arguments, 1); 16049 listeners = handler.slice(); 16050 len = listeners.length; 16051 for (i = 0; i < len; i++) 16052 listeners[i].apply(this, args); 16053 } 16054 16055 return true; 16056 }; 16057 16058 EventEmitter.prototype.addListener = function(type, listener) { 16059 var m; 16060 16061 if (!isFunction(listener)) 16062 throw TypeError('listener must be a function'); 16063 16064 if (!this._events) 16065 this._events = {}; 16066 16067 // To avoid recursion in the case that type === "newListener"! Before 16068 // adding it to the listeners, first emit "newListener". 16069 if (this._events.newListener) 16070 this.emit('newListener', type, 16071 isFunction(listener.listener) ? 16072 listener.listener : listener); 16073 16074 if (!this._events[type]) 16075 // Optimize the case of one listener. Don't need the extra array object. 16076 this._events[type] = listener; 16077 else if (isObject(this._events[type])) 16078 // If we've already got an array, just append. 16079 this._events[type].push(listener); 16080 else 16081 // Adding the second element, need to change to array. 16082 this._events[type] = [this._events[type], listener]; 16083 16084 // Check for listener leak 16085 if (isObject(this._events[type]) && !this._events[type].warned) { 16086 if (!isUndefined(this._maxListeners)) { 16087 m = this._maxListeners; 16088 } else { 16089 m = EventEmitter.defaultMaxListeners; 16090 } 16091 16092 if (m && m > 0 && this._events[type].length > m) { 16093 this._events[type].warned = true; 16094 console.error('(node) warning: possible EventEmitter memory ' + 16095 'leak detected. %d listeners added. ' + 16096 'Use emitter.setMaxListeners() to increase limit.', 16097 this._events[type].length); 16098 if (typeof console.trace === 'function') { 16099 // not supported in IE 10 16100 console.trace(); 16101 } 16102 } 16103 } 16104 16105 return this; 16106 }; 16107 16108 EventEmitter.prototype.on = EventEmitter.prototype.addListener; 16109 16110 EventEmitter.prototype.once = function(type, listener) { 16111 if (!isFunction(listener)) 16112 throw TypeError('listener must be a function'); 16113 16114 var fired = false; 16115 16116 function g() { 16117 this.removeListener(type, g); 16118 16119 if (!fired) { 16120 fired = true; 16121 listener.apply(this, arguments); 16122 } 16123 } 16124 16125 g.listener = listener; 16126 this.on(type, g); 16127 16128 return this; 16129 }; 16130 16131 // emits a 'removeListener' event iff the listener was removed 16132 EventEmitter.prototype.removeListener = function(type, listener) { 16133 var list, position, length, i; 16134 16135 if (!isFunction(listener)) 16136 throw TypeError('listener must be a function'); 16137 16138 if (!this._events || !this._events[type]) 16139 return this; 16140 16141 list = this._events[type]; 16142 length = list.length; 16143 position = -1; 16144 16145 if (list === listener || 16146 (isFunction(list.listener) && list.listener === listener)) { 16147 delete this._events[type]; 16148 if (this._events.removeListener) 16149 this.emit('removeListener', type, listener); 16150 16151 } else if (isObject(list)) { 16152 for (i = length; i-- > 0;) { 16153 if (list[i] === listener || 16154 (list[i].listener && list[i].listener === listener)) { 16155 position = i; 16156 break; 16157 } 16158 } 16159 16160 if (position < 0) 16161 return this; 16162 16163 if (list.length === 1) { 16164 list.length = 0; 16165 delete this._events[type]; 16166 } else { 16167 list.splice(position, 1); 16168 } 16169 16170 if (this._events.removeListener) 16171 this.emit('removeListener', type, listener); 16172 } 16173 16174 return this; 16175 }; 16176 16177 EventEmitter.prototype.removeAllListeners = function(type) { 16178 var key, listeners; 16179 16180 if (!this._events) 16181 return this; 16182 16183 // not listening for removeListener, no need to emit 16184 if (!this._events.removeListener) { 16185 if (arguments.length === 0) 16186 this._events = {}; 16187 else if (this._events[type]) 16188 delete this._events[type]; 16189 return this; 16190 } 16191 16192 // emit removeListener for all listeners on all events 16193 if (arguments.length === 0) { 16194 for (key in this._events) { 16195 if (key === 'removeListener') continue; 16196 this.removeAllListeners(key); 16197 } 16198 this.removeAllListeners('removeListener'); 16199 this._events = {}; 16200 return this; 16201 } 16202 16203 listeners = this._events[type]; 16204 16205 if (isFunction(listeners)) { 16206 this.removeListener(type, listeners); 16207 } else if (listeners) { 16208 // LIFO order 16209 while (listeners.length) 16210 this.removeListener(type, listeners[listeners.length - 1]); 16211 } 16212 delete this._events[type]; 16213 16214 return this; 16215 }; 16216 16217 EventEmitter.prototype.listeners = function(type) { 16218 var ret; 16219 if (!this._events || !this._events[type]) 16220 ret = []; 16221 else if (isFunction(this._events[type])) 16222 ret = [this._events[type]]; 16223 else 16224 ret = this._events[type].slice(); 16225 return ret; 16226 }; 16227 16228 EventEmitter.prototype.listenerCount = function(type) { 16229 if (this._events) { 16230 var evlistener = this._events[type]; 16231 16232 if (isFunction(evlistener)) 16233 return 1; 16234 else if (evlistener) 16235 return evlistener.length; 16236 } 16237 return 0; 16238 }; 16239 16240 EventEmitter.listenerCount = function(emitter, type) { 16241 return emitter.listenerCount(type); 16242 }; 16243 16244 function isFunction(arg) { 16245 return typeof arg === 'function'; 16246 } 16247 16248 function isNumber(arg) { 16249 return typeof arg === 'number'; 16250 } 16251 16252 function isObject(arg) { 16253 return typeof arg === 'object' && arg !== null; 16254 } 16255 16256 function isUndefined(arg) { 16257 return arg === void 0; 16258 } 16259 16260 16261/***/ }), 16262/* 303 */ 16263/***/ (function(module, exports, __webpack_require__) { 16264 16265 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 16266 * jQuery JavaScript Library v3.2.1 16267 * https://jquery.com/ 16268 * 16269 * Includes Sizzle.js 16270 * https://sizzlejs.com/ 16271 * 16272 * Copyright JS Foundation and other contributors 16273 * Released under the MIT license 16274 * https://jquery.org/license 16275 * 16276 * Date: 2017-03-20T18:59Z 16277 */ 16278 ( function( global, factory ) { 16279 16280 "use strict"; 16281 16282 if ( typeof module === "object" && typeof module.exports === "object" ) { 16283 16284 // For CommonJS and CommonJS-like environments where a proper `window` 16285 // is present, execute the factory and get jQuery. 16286 // For environments that do not have a `window` with a `document` 16287 // (such as Node.js), expose a factory as module.exports. 16288 // This accentuates the need for the creation of a real `window`. 16289 // e.g. var jQuery = require("jquery")(window); 16290 // See ticket #14549 for more info. 16291 module.exports = global.document ? 16292 factory( global, true ) : 16293 function( w ) { 16294 if ( !w.document ) { 16295 throw new Error( "jQuery requires a window with a document" ); 16296 } 16297 return factory( w ); 16298 }; 16299 } else { 16300 factory( global ); 16301 } 16302 16303 // Pass this if window is not defined yet 16304 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 16305 16306 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 16307 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 16308 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), str
vendor: 16,277 bytes, lines 16308-16943
16308ict mode should be common 16309 // enough that all such attempts are guarded in a try block. 16310 "use strict"; 16311 16312 var arr = []; 16313 16314 var document = window.document; 16315 16316 var getProto = Object.getPrototypeOf; 16317 16318 var slice = arr.slice; 16319 16320 var concat = arr.concat; 16321 16322 var push = arr.push; 16323 16324 var indexOf = arr.indexOf; 16325 16326 var class2type = {}; 16327 16328 var toString = class2type.toString; 16329 16330 var hasOwn = class2type.hasOwnProperty; 16331 16332 var fnToString = hasOwn.toString; 16333 16334 var ObjectFunctionString = fnToString.call( Object ); 16335 16336 var support = {}; 16337 16338 16339 16340 function DOMEval( code, doc ) { 16341 doc = doc || document; 16342 16343 var script = doc.createElement( "script" ); 16344 16345 script.text = code; 16346 doc.head.appendChild( script ).parentNode.removeChild( script ); 16347 } 16348 /* global Symbol */ 16349 // Defining this global in .eslintrc.json would create a danger of using the global 16350 // unguarded in another place, it seems safer to define global only for this module 16351 16352 16353 16354 var 16355 version = "3.2.1", 16356 16357 // Define a local copy of jQuery 16358 jQuery = function( selector, context ) { 16359 16360 // The jQuery object is actually just the init constructor 'enhanced' 16361 // Need init if jQuery is called (just allow error to be thrown if not included) 16362 return new jQuery.fn.init( selector, context ); 16363 }, 16364 16365 // Support: Android <=4.0 only 16366 // Make sure we trim BOM and NBSP 16367 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 16368 16369 // Matches dashed string for camelizing 16370 rmsPrefix = /^-ms-/, 16371 rdashAlpha = /-([a-z])/g, 16372 16373 // Used by jQuery.camelCase as callback to replace() 16374 fcamelCase = function( all, letter ) { 16375 return letter.toUpperCase(); 16376 }; 16377 16378 jQuery.fn = jQuery.prototype = { 16379 16380 // The current version of jQuery being used 16381 jquery: version, 16382 16383 constructor: jQuery, 16384 16385 // The default length of a jQuery object is 0 16386 length: 0, 16387 16388 toArray: function() { 16389 return slice.call( this ); 16390 }, 16391 16392 // Get the Nth element in the matched element set OR 16393 // Get the whole matched element set as a clean array 16394 get: function( num ) { 16395 16396 // Return all the elements in a clean array 16397 if ( num == null ) { 16398 return slice.call( this ); 16399 } 16400 16401 // Return just the one element from the set 16402 return num < 0 ? this[ num + this.length ] : this[ num ]; 16403 }, 16404 16405 // Take an array of elements and push it onto the stack 16406 // (returning the new matched element set) 16407 pushStack: function( elems ) { 16408 16409 // Build a new jQuery matched element set 16410 var ret = jQuery.merge( this.constructor(), elems ); 16411 16412 // Add the old object onto the stack (as a reference) 16413 ret.prevObject = this; 16414 16415 // Return the newly-formed element set 16416 return ret; 16417 }, 16418 16419 // Execute a callback for every element in the matched set. 16420 each: function( callback ) { 16421 return jQuery.each( this, callback ); 16422 }, 16423 16424 map: function( callback ) { 16425 return this.pushStack( jQuery.map( this, function( elem, i ) { 16426 return callback.call( elem, i, elem ); 16427 } ) ); 16428 }, 16429 16430 slice: function() { 16431 return this.pushStack( slice.apply( this, arguments ) ); 16432 }, 16433 16434 first: function() { 16435 return this.eq( 0 ); 16436 }, 16437 16438 last: function() { 16439 return this.eq( -1 ); 16440 }, 16441 16442 eq: function( i ) { 16443 var len = this.length, 16444 j = +i + ( i < 0 ? len : 0 ); 16445 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 16446 }, 16447 16448 end: function() { 16449 return this.prevObject || this.constructor(); 16450 }, 16451 16452 // For internal use only. 16453 // Behaves like an Array's method, not like a jQuery method. 16454 push: push, 16455 sort: arr.sort, 16456 splice: arr.splice 16457 }; 16458 16459 jQuery.extend = jQuery.fn.extend = function() { 16460 var options, name, src, copy, copyIsArray, clone, 16461 target = arguments[ 0 ] || {}, 16462 i = 1, 16463 length = arguments.length, 16464 deep = false; 16465 16466 // Handle a deep copy situation 16467 if ( typeof target === "boolean" ) { 16468 deep = target; 16469 16470 // Skip the boolean and the target 16471 target = arguments[ i ] || {}; 16472 i++; 16473 } 16474 16475 // Handle case when target is a string or something (possible in deep copy) 16476 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 16477 target = {}; 16478 } 16479 16480 // Extend jQuery itself if only one argument is passed 16481 if ( i === length ) { 16482 target = this; 16483 i--; 16484 } 16485 16486 for ( ; i < length; i++ ) { 16487 16488 // Only deal with non-null/undefined values 16489 if ( ( options = arguments[ i ] ) != null ) { 16490 16491 // Extend the base object 16492 for ( name in options ) { 16493 src = target[ name ]; 16494 copy = options[ name ]; 16495 16496 // Prevent never-ending loop 16497 if ( target === copy ) { 16498 continue; 16499 } 16500 16501 // Recurse if we're merging plain objects or arrays 16502 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 16503 ( copyIsArray = Array.isArray( copy ) ) ) ) { 16504 16505 if ( copyIsArray ) { 16506 copyIsArray = false; 16507 clone = src && Array.isArray( src ) ? src : []; 16508 16509 } else { 16510 clone = src && jQuery.isPlainObject( src ) ? src : {}; 16511 } 16512 16513 // Never move original objects, clone them 16514 target[ name ] = jQuery.extend( deep, clone, copy ); 16515 16516 // Don't bring in undefined values 16517 } else if ( copy !== undefined ) { 16518 target[ name ] = copy; 16519 } 16520 } 16521 } 16522 } 16523 16524 // Return the modified object 16525 return target; 16526 }; 16527 16528 jQuery.extend( { 16529 16530 // Unique for each copy of jQuery on the page 16531 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 16532 16533 // Assume jQuery is ready without the ready module 16534 isReady: true, 16535 16536 error: function( msg ) { 16537 throw new Error( msg ); 16538 }, 16539 16540 noop: function() {}, 16541 16542 isFunction: function( obj ) { 16543 return jQuery.type( obj ) === "function"; 16544 }, 16545 16546 isWindow: function( obj ) { 16547 return obj != null && obj === obj.window; 16548 }, 16549 16550 isNumeric: function( obj ) { 16551 16552 // As of jQuery 3.0, isNumeric is limited to 16553 // strings and numbers (primitives or objects) 16554 // that can be coerced to finite numbers (gh-2662) 16555 var type = jQuery.type( obj ); 16556 return ( type === "number" || type === "string" ) && 16557 16558 // parseFloat NaNs numeric-cast false positives ("") 16559 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 16560 // subtraction forces infinities to NaN 16561 !isNaN( obj - parseFloat( obj ) ); 16562 }, 16563 16564 isPlainObject: function( obj ) { 16565 var proto, Ctor; 16566 16567 // Detect obvious negatives 16568 // Use toString instead of jQuery.type to catch host objects 16569 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 16570 return false; 16571 } 16572 16573 proto = getProto( obj ); 16574 16575 // Objects with no prototype (e.g., `Object.create( null )`) are plain 16576 if ( !proto ) { 16577 return true; 16578 } 16579 16580 // Objects with prototype are plain iff they were constructed by a global Object function 16581 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 16582 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 16583 }, 16584 16585 isEmptyObject: function( obj ) { 16586 16587 /* eslint-disable no-unused-vars */ 16588 // See https://github.com/eslint/eslint/issues/6125 16589 var name; 16590 16591 for ( name in obj ) { 16592 return false; 16593 } 16594 return true; 16595 }, 16596 16597 type: function( obj ) { 16598 if ( obj == null ) { 16599 return obj + ""; 16600 } 16601 16602 // Support: Android <=2.3 only (functionish RegExp) 16603 return typeof obj === "object" || typeof obj === "function" ? 16604 class2type[ toString.call( obj ) ] || "object" : 16605 typeof obj; 16606 }, 16607 16608 // Evaluates a script in a global context 16609 globalEval: function( code ) { 16610 DOMEval( code ); 16611 }, 16612 16613 // Convert dashed to camelCase; used by the css and data modules 16614 // Support: IE <=9 - 11, Edge 12 - 13 16615 // Microsoft forgot to hump their vendor prefix (#9572) 16616 camelCase: function( string ) { 16617 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 16618 }, 16619 16620 each: function( obj, callback ) { 16621 var length, i = 0; 16622 16623 if ( isArrayLike( obj ) ) { 16624 length = obj.length; 16625 for ( ; i < length; i++ ) { 16626 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 16627 break; 16628 } 16629 } 16630 } else { 16631 for ( i in obj ) { 16632 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 16633 break; 16634 } 16635 } 16636 } 16637 16638 return obj; 16639 }, 16640 16641 // Support: Android <=4.0 only 16642 trim: function( text ) { 16643 return text == null ? 16644 "" : 16645 ( text + "" ).replace( rtrim, "" ); 16646 }, 16647 16648 // results is for internal usage only 16649 makeArray: function( arr, results ) { 16650 var ret = results || []; 16651 16652 if ( arr != null ) { 16653 if ( isArrayLike( Object( arr ) ) ) { 16654 jQuery.merge( ret, 16655 typeof arr === "string" ? 16656 [ arr ] : arr 16657 ); 16658 } else { 16659 push.call( ret, arr ); 16660 } 16661 } 16662 16663 return ret; 16664 }, 16665 16666 inArray: function( elem, arr, i ) { 16667 return arr == null ? -1 : indexOf.call( arr, elem, i ); 16668 }, 16669 16670 // Support: Android <=4.0 only, PhantomJS 1 only 16671 // push.apply(_, arraylike) throws on ancient WebKit 16672 merge: function( first, second ) { 16673 var len = +second.length, 16674 j = 0, 16675 i = first.length; 16676 16677 for ( ; j < len; j++ ) { 16678 first[ i++ ] = second[ j ]; 16679 } 16680 16681 first.length = i; 16682 16683 return first; 16684 }, 16685 16686 grep: function( elems, callback, invert ) { 16687 var callbackInverse, 16688 matches = [], 16689 i = 0, 16690 length = elems.length, 16691 callbackExpect = !invert; 16692 16693 // Go through the array, only saving the items 16694 // that pass the validator function 16695 for ( ; i < length; i++ ) { 16696 callbackInverse = !callback( elems[ i ], i ); 16697 if ( callbackInverse !== callbackExpect ) { 16698 matches.push( elems[ i ] ); 16699 } 16700 } 16701 16702 return matches; 16703 }, 16704 16705 // arg is for internal usage only 16706 map: function( elems, callback, arg ) { 16707 var length, value, 16708 i = 0, 16709 ret = []; 16710 16711 // Go through the array, translating each of the items to their new values 16712 if ( isArrayLike( elems ) ) { 16713 length = elems.length; 16714 for ( ; i < length; i++ ) { 16715 value = callback( elems[ i ], i, arg ); 16716 16717 if ( value != null ) { 16718 ret.push( value ); 16719 } 16720 } 16721 16722 // Go through every key on the object, 16723 } else { 16724 for ( i in elems ) { 16725 value = callback( elems[ i ], i, arg ); 16726 16727 if ( value != null ) { 16728 ret.push( value ); 16729 } 16730 } 16731 } 16732 16733 // Flatten any nested arrays 16734 return concat.apply( [], ret ); 16735 }, 16736 16737 // A global GUID counter for objects 16738 guid: 1, 16739 16740 // Bind a function to a context, optionally partially applying any 16741 // arguments. 16742 proxy: function( fn, context ) { 16743 var tmp, args, proxy; 16744 16745 if ( typeof context === "string" ) { 16746 tmp = fn[ context ]; 16747 context = fn; 16748 fn = tmp; 16749 } 16750 16751 // Quick check to determine if target is callable, in the spec 16752 // this throws a TypeError, but we will just return undefined. 16753 if ( !jQuery.isFunction( fn ) ) { 16754 return undefined; 16755 } 16756 16757 // Simulated bind 16758 args = slice.call( arguments, 2 ); 16759 proxy = function() { 16760 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 16761 }; 16762 16763 // Set the guid of unique handler to the same of original handler, so it can be removed 16764 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 16765 16766 return proxy; 16767 }, 16768 16769 now: Date.now, 16770 16771 // jQuery.support is not used in Core but other projects attach their 16772 // properties to it so it needs to exist. 16773 support: support 16774 } ); 16775 16776 if ( typeof Symbol === "function" ) { 16777 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 16778 } 16779 16780 // Populate the class2type map 16781 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 16782 function( i, name ) { 16783 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 16784 } ); 16785 16786 function isArrayLike( obj ) { 16787 16788 // Support: real iOS 8.2 only (not reproducible in simulator) 16789 // `in` check used to prevent JIT error (gh-2145) 16790 // hasOwn isn't used here due to false negatives 16791 // regarding Nodelist length in IE 16792 var length = !!obj && "length" in obj && obj.length, 16793 type = jQuery.type( obj ); 16794 16795 if ( type === "function" || jQuery.isWindow( obj ) ) { 16796 return false; 16797 } 16798 16799 return type === "array" || length === 0 || 16800 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 16801 } 16802 var Sizzle = 16803 /*! 16804 * Sizzle CSS Selector Engine v2.3.3 16805 * https://sizzlejs.com/ 16806 * 16807 * Copyright jQuery Foundation and other contributors 16808 * Released under the MIT license 16809 * http://jquery.org/license 16810 * 16811 * Date: 2016-08-08 16812 */ 16813 (function( window ) { 16814 16815 var i, 16816 support, 16817 Expr, 16818 getText, 16819 isXML, 16820 tokenize, 16821 compile, 16822 select, 16823 outermostContext, 16824 sortInput, 16825 hasDuplicate, 16826 16827 // Local document vars 16828 setDocument, 16829 document, 16830 docElem, 16831 documentIsHTML, 16832 rbuggyQSA, 16833 rbuggyMatches, 16834 matches, 16835 contains, 16836 16837 // Instance-specific data 16838 expando = "sizzle" + 1 * new Date(), 16839 preferredDoc = window.document, 16840 dirruns = 0, 16841 done = 0, 16842 classCache = createCache(), 16843 tokenCache = createCache(), 16844 compilerCache = createCache(), 16845 sortOrder = function( a, b ) { 16846 if ( a === b ) { 16847 hasDuplicate = true; 16848 } 16849 return 0; 16850 }, 16851 16852 // Instance methods 16853 hasOwn = ({}).hasOwnProperty, 16854 arr = [], 16855 pop = arr.pop, 16856 push_native = arr.push, 16857 push = arr.push, 16858 slice = arr.slice, 16859 // Use a stripped-down indexOf as it's faster than native 16860 // https://jsperf.com/thor-indexof-vs-for/5 16861 indexOf = function( list, elem ) { 16862 var i = 0, 16863 len = list.length; 16864 for ( ; i < len; i++ ) { 16865 if ( list[i] === elem ) { 16866 return i; 16867 } 16868 } 16869 return -1; 16870 }, 16871 16872 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 16873 16874 // Regular expressions 16875 16876 // http://www.w3.org/TR/css3-selectors/#whitespace 16877 whitespace = "[\\x20\\t\\r\\n\\f]", 16878 16879 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 16880 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 16881 16882 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 16883 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 16884 // Operator (capture 2) 16885 "*([*^$|!~]?=)" + whitespace + 16886 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 16887 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 16888 "*\\]", 16889 16890 pseudos = ":(" + identifier + ")(?:\\((" + 16891 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 16892 // 1. quoted (capture 3; capture 4 or capture 5) 16893 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 16894 // 2. simple (capture 6) 16895 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 16896 // 3. anything else (capture 2) 16897 ".*" + 16898 ")\\)|)", 16899 16900 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 16901 rwhitespace = new RegExp( whitespace + "+", "g" ), 16902 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 16903 16904 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 16905 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 16906 16907 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 16908 16909 rpseudo = new RegExp( pseudos ), 16910 ridentifier = new RegExp( "^" + identifier + "$" ), 16911 16912 matchExpr = { 16913 "ID": new RegExp( "^#(" + identifier + ")" ), 16914 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 16915 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 16916 "ATTR": new RegExp( "^" + attributes ), 16917 "PSEUDO": new RegExp( "^" + pseudos ), 16918 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 16919 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 16920 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 16921 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 16922 // For use in libraries implementing .is() 16923 // We use this for POS matching in `select` 16924 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 16925 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 16926 }, 16927 16928 rinputs = /^(?:input|select|textarea|button)$/i, 16929 rheader = /^h\d$/i, 16930 16931 rnative = /^[^{]+\{\s*\[native \w/, 16932 16933 // Easily-parseable/retrievable ID or TAG or CLASS selectors 16934 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 16935 16936 rsibling = /[+~]/, 16937 16938 // CSS escapes 16939 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 16940 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 16941 funescape = function( _, escaped, escapedWhitespace ) { 16942 var high = "0x" + escaped - 0x10000; 16943 // NaN means non-codepoint
vendor: 18,864 bytes, lines 16944-17574
16944 // Support: Firefox<24 16945 // Workaround erroneous numeric interpretation of +"0x" 16946 return high !== high || escapedWhitespace ? 16947 escaped : 16948 high < 0 ? 16949 // BMP codepoint 16950 String.fromCharCode( high + 0x10000 ) : 16951 // Supplemental Plane codepoint (surrogate pair) 16952 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 16953 }, 16954 16955 // CSS string/identifier serialization 16956 // https://drafts.csswg.org/cssom/#common-serializing-idioms 16957 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 16958 fcssescape = function( ch, asCodePoint ) { 16959 if ( asCodePoint ) { 16960 16961 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 16962 if ( ch === "\0" ) { 16963 return "\uFFFD"; 16964 } 16965 16966 // Control characters and (dependent upon position) numbers get escaped as code points 16967 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 16968 } 16969 16970 // Other potentially-special ASCII characters get backslash-escaped 16971 return "\\" + ch; 16972 }, 16973 16974 // Used for iframes 16975 // See setDocument() 16976 // Removing the function wrapper causes a "Permission Denied" 16977 // error in IE 16978 unloadHandler = function() { 16979 setDocument(); 16980 }, 16981 16982 disabledAncestor = addCombinator( 16983 function( elem ) { 16984 return elem.disabled === true && ("form" in elem || "label" in elem); 16985 }, 16986 { dir: "parentNode", next: "legend" } 16987 ); 16988 16989 // Optimize for push.apply( _, NodeList ) 16990 try { 16991 push.apply( 16992 (arr = slice.call( preferredDoc.childNodes )), 16993 preferredDoc.childNodes 16994 ); 16995 // Support: Android<4.0 16996 // Detect silently failing push.apply 16997 arr[ preferredDoc.childNodes.length ].nodeType; 16998 } catch ( e ) { 16999 push = { apply: arr.length ? 17000 17001 // Leverage slice if possible 17002 function( target, els ) { 17003 push_native.apply( target, slice.call(els) ); 17004 } : 17005 17006 // Support: IE<9 17007 // Otherwise append directly 17008 function( target, els ) { 17009 var j = target.length, 17010 i = 0; 17011 // Can't trust NodeList.length 17012 while ( (target[j++] = els[i++]) ) {} 17013 target.length = j - 1; 17014 } 17015 }; 17016 } 17017 17018 function Sizzle( selector, context, results, seed ) { 17019 var m, i, elem, nid, match, groups, newSelector, 17020 newContext = context && context.ownerDocument, 17021 17022 // nodeType defaults to 9, since context defaults to document 17023 nodeType = context ? context.nodeType : 9; 17024 17025 results = results || []; 17026 17027 // Return early from calls with invalid selector or context 17028 if ( typeof selector !== "string" || !selector || 17029 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 17030 17031 return results; 17032 } 17033 17034 // Try to shortcut find operations (as opposed to filters) in HTML documents 17035 if ( !seed ) { 17036 17037 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 17038 setDocument( context ); 17039 } 17040 context = context || document; 17041 17042 if ( documentIsHTML ) { 17043 17044 // If the selector is sufficiently simple, try using a "get*By*" DOM method 17045 // (excepting DocumentFragment context, where the methods don't exist) 17046 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 17047 17048 // ID selector 17049 if ( (m = match[1]) ) { 17050 17051 // Document context 17052 if ( nodeType === 9 ) { 17053 if ( (elem = context.getElementById( m )) ) { 17054 17055 // Support: IE, Opera, Webkit 17056 // TODO: identify versions 17057 // getElementById can match elements by name instead of ID 17058 if ( elem.id === m ) { 17059 results.push( elem ); 17060 return results; 17061 } 17062 } else { 17063 return results; 17064 } 17065 17066 // Element context 17067 } else { 17068 17069 // Support: IE, Opera, Webkit 17070 // TODO: identify versions 17071 // getElementById can match elements by name instead of ID 17072 if ( newContext && (elem = newContext.getElementById( m )) && 17073 contains( context, elem ) && 17074 elem.id === m ) { 17075 17076 results.push( elem ); 17077 return results; 17078 } 17079 } 17080 17081 // Type selector 17082 } else if ( match[2] ) { 17083 push.apply( results, context.getElementsByTagName( selector ) ); 17084 return results; 17085 17086 // Class selector 17087 } else if ( (m = match[3]) && support.getElementsByClassName && 17088 context.getElementsByClassName ) { 17089 17090 push.apply( results, context.getElementsByClassName( m ) ); 17091 return results; 17092 } 17093 } 17094 17095 // Take advantage of querySelectorAll 17096 if ( support.qsa && 17097 !compilerCache[ selector + " " ] && 17098 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 17099 17100 if ( nodeType !== 1 ) { 17101 newContext = context; 17102 newSelector = selector; 17103 17104 // qSA looks outside Element context, which is not what we want 17105 // Thanks to Andrew Dupont for this workaround technique 17106 // Support: IE <=8 17107 // Exclude object elements 17108 } else if ( context.nodeName.toLowerCase() !== "object" ) { 17109 17110 // Capture the context ID, setting it first if necessary 17111 if ( (nid = context.getAttribute( "id" )) ) { 17112 nid = nid.replace( rcssescape, fcssescape ); 17113 } else { 17114 context.setAttribute( "id", (nid = expando) ); 17115 } 17116 17117 // Prefix every selector in the list 17118 groups = tokenize( selector ); 17119 i = groups.length; 17120 while ( i-- ) { 17121 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 17122 } 17123 newSelector = groups.join( "," ); 17124 17125 // Expand context for sibling selectors 17126 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 17127 context; 17128 } 17129 17130 if ( newSelector ) { 17131 try { 17132 push.apply( results, 17133 newContext.querySelectorAll( newSelector ) 17134 ); 17135 return results; 17136 } catch ( qsaError ) { 17137 } finally { 17138 if ( nid === expando ) { 17139 context.removeAttribute( "id" ); 17140 } 17141 } 17142 } 17143 } 17144 } 17145 } 17146 17147 // All others 17148 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 17149 } 17150 17151 /** 17152 * Create key-value caches of limited size 17153 * @returns {function(string, object)} Returns the Object data after storing it on itself with 17154 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 17155 * deleting the oldest entry 17156 */ 17157 function createCache() { 17158 var keys = []; 17159 17160 function cache( key, value ) { 17161 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 17162 if ( keys.push( key + " " ) > Expr.cacheLength ) { 17163 // Only keep the most recent entries 17164 delete cache[ keys.shift() ]; 17165 } 17166 return (cache[ key + " " ] = value); 17167 } 17168 return cache; 17169 } 17170 17171 /** 17172 * Mark a function for special use by Sizzle 17173 * @param {Function} fn The function to mark 17174 */ 17175 function markFunction( fn ) { 17176 fn[ expando ] = true; 17177 return fn; 17178 } 17179 17180 /** 17181 * Support testing using an element 17182 * @param {Function} fn Passed the created element and returns a boolean result 17183 */ 17184 function assert( fn ) { 17185 var el = document.createElement("fieldset"); 17186 17187 try { 17188 return !!fn( el ); 17189 } catch (e) { 17190 return false; 17191 } finally { 17192 // Remove from its parent by default 17193 if ( el.parentNode ) { 17194 el.parentNode.removeChild( el ); 17195 } 17196 // release memory in IE 17197 el = null; 17198 } 17199 } 17200 17201 /** 17202 * Adds the same handler for all of the specified attrs 17203 * @param {String} attrs Pipe-separated list of attributes 17204 * @param {Function} handler The method that will be applied 17205 */ 17206 function addHandle( attrs, handler ) { 17207 var arr = attrs.split("|"), 17208 i = arr.length; 17209 17210 while ( i-- ) { 17211 Expr.attrHandle[ arr[i] ] = handler; 17212 } 17213 } 17214 17215 /** 17216 * Checks document order of two siblings 17217 * @param {Element} a 17218 * @param {Element} b 17219 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 17220 */ 17221 function siblingCheck( a, b ) { 17222 var cur = b && a, 17223 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 17224 a.sourceIndex - b.sourceIndex; 17225 17226 // Use IE sourceIndex if available on both nodes 17227 if ( diff ) { 17228 return diff; 17229 } 17230 17231 // Check if b follows a 17232 if ( cur ) { 17233 while ( (cur = cur.nextSibling) ) { 17234 if ( cur === b ) { 17235 return -1; 17236 } 17237 } 17238 } 17239 17240 return a ? 1 : -1; 17241 } 17242 17243 /** 17244 * Returns a function to use in pseudos for input types 17245 * @param {String} type 17246 */ 17247 function createInputPseudo( type ) { 17248 return function( elem ) { 17249 var name = elem.nodeName.toLowerCase(); 17250 return name === "input" && elem.type === type; 17251 }; 17252 } 17253 17254 /** 17255 * Returns a function to use in pseudos for buttons 17256 * @param {String} type 17257 */ 17258 function createButtonPseudo( type ) { 17259 return function( elem ) { 17260 var name = elem.nodeName.toLowerCase(); 17261 return (name === "input" || name === "button") && elem.type === type; 17262 }; 17263 } 17264 17265 /** 17266 * Returns a function to use in pseudos for :enabled/:disabled 17267 * @param {Boolean} disabled true for :disabled; false for :enabled 17268 */ 17269 function createDisabledPseudo( disabled ) { 17270 17271 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 17272 return function( elem ) { 17273 17274 // Only certain elements can match :enabled or :disabled 17275 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 17276 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 17277 if ( "form" in elem ) { 17278 17279 // Check for inherited disabledness on relevant non-disabled elements: 17280 // * listed form-associated elements in a disabled fieldset 17281 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 17282 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 17283 // * option elements in a disabled optgroup 17284 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 17285 // All such elements have a "form" property. 17286 if ( elem.parentNode && elem.disabled === false ) { 17287 17288 // Option elements defer to a parent optgroup if present 17289 if ( "label" in elem ) { 17290 if ( "label" in elem.parentNode ) { 17291 return elem.parentNode.disabled === disabled; 17292 } else { 17293 return elem.disabled === disabled; 17294 } 17295 } 17296 17297 // Support: IE 6 - 11 17298 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 17299 return elem.isDisabled === disabled || 17300 17301 // Where there is no isDisabled, check manually 17302 /* jshint -W018 */ 17303 elem.isDisabled !== !disabled && 17304 disabledAncestor( elem ) === disabled; 17305 } 17306 17307 return elem.disabled === disabled; 17308 17309 // Try to winnow out elements that can't be disabled before trusting the disabled property. 17310 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 17311 // even exist on them, let alone have a boolean value. 17312 } else if ( "label" in elem ) { 17313 return elem.disabled === disabled; 17314 } 17315 17316 // Remaining elements are neither :enabled nor :disabled 17317 return false; 17318 }; 17319 } 17320 17321 /** 17322 * Returns a function to use in pseudos for positionals 17323 * @param {Function} fn 17324 */ 17325 function createPositionalPseudo( fn ) { 17326 return markFunction(function( argument ) { 17327 argument = +argument; 17328 return markFunction(function( seed, matches ) { 17329 var j, 17330 matchIndexes = fn( [], seed.length, argument ), 17331 i = matchIndexes.length; 17332 17333 // Match elements found at the specified indexes 17334 while ( i-- ) { 17335 if ( seed[ (j = matchIndexes[i]) ] ) { 17336 seed[j] = !(matches[j] = seed[j]); 17337 } 17338 } 17339 }); 17340 }); 17341 } 17342 17343 /** 17344 * Checks a node for validity as a Sizzle context 17345 * @param {Element|Object=} context 17346 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 17347 */ 17348 function testContext( context ) { 17349 return context && typeof context.getElementsByTagName !== "undefined" && context; 17350 } 17351 17352 // Expose support vars for convenience 17353 support = Sizzle.support = {}; 17354 17355 /** 17356 * Detects XML nodes 17357 * @param {Element|Object} elem An element or a document 17358 * @returns {Boolean} True iff elem is a non-HTML XML node 17359 */ 17360 isXML = Sizzle.isXML = function( elem ) { 17361 // documentElement is verified for cases where it doesn't yet exist 17362 // (such as loading iframes in IE - #4833) 17363 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 17364 return documentElement ? documentElement.nodeName !== "HTML" : false; 17365 }; 17366 17367 /** 17368 * Sets document-related variables once based on the current document 17369 * @param {Element|Object} [doc] An element or document object to use to set the document 17370 * @returns {Object} Returns the current document 17371 */ 17372 setDocument = Sizzle.setDocument = function( node ) { 17373 var hasCompare, subWindow, 17374 doc = node ? node.ownerDocument || node : preferredDoc; 17375 17376 // Return early if doc is invalid or already selected 17377 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 17378 return document; 17379 } 17380 17381 // Update global variables 17382 document = doc; 17383 docElem = document.documentElement; 17384 documentIsHTML = !isXML( document ); 17385 17386 // Support: IE 9-11, Edge 17387 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 17388 if ( preferredDoc !== document && 17389 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 17390 17391 // Support: IE 11, Edge 17392 if ( subWindow.addEventListener ) { 17393 subWindow.addEventListener( "unload", unloadHandler, false ); 17394 17395 // Support: IE 9 - 10 only 17396 } else if ( subWindow.attachEvent ) { 17397 subWindow.attachEvent( "onunload", unloadHandler ); 17398 } 17399 } 17400 17401 /* Attributes 17402 ---------------------------------------------------------------------- */ 17403 17404 // Support: IE<8 17405 // Verify that getAttribute really returns attributes and not properties 17406 // (excepting IE8 booleans) 17407 support.attributes = assert(function( el ) { 17408 el.className = "i"; 17409 return !el.getAttribute("className"); 17410 }); 17411 17412 /* getElement(s)By* 17413 ---------------------------------------------------------------------- */ 17414 17415 // Check if getElementsByTagName("*") returns only elements 17416 support.getElementsByTagName = assert(function( el ) { 17417 el.appendChild( document.createComment("") ); 17418 return !el.getElementsByTagName("*").length; 17419 }); 17420 17421 // Support: IE<9 17422 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 17423 17424 // Support: IE<10 17425 // Check if getElementById returns elements by name 17426 // The broken getElementById methods don't pick up programmatically-set names, 17427 // so use a roundabout getElementsByName test 17428 support.getById = assert(function( el ) { 17429 docElem.appendChild( el ).id = expando; 17430 return !document.getElementsByName || !document.getElementsByName( expando ).length; 17431 }); 17432 17433 // ID filter and find 17434 if ( support.getById ) { 17435 Expr.filter["ID"] = function( id ) { 17436 var attrId = id.replace( runescape, funescape ); 17437 return function( elem ) { 17438 return elem.getAttribute("id") === attrId; 17439 }; 17440 }; 17441 Expr.find["ID"] = function( id, context ) { 17442 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 17443 var elem = context.getElementById( id ); 17444 return elem ? [ elem ] : []; 17445 } 17446 }; 17447 } else { 17448 Expr.filter["ID"] = function( id ) { 17449 var attrId = id.replace( runescape, funescape ); 17450 return function( elem ) { 17451 var node = typeof elem.getAttributeNode !== "undefined" && 17452 elem.getAttributeNode("id"); 17453 return node && node.value === attrId; 17454 }; 17455 }; 17456 17457 // Support: IE 6 - 7 only 17458 // getElementById is not reliable as a find shortcut 17459 Expr.find["ID"] = function( id, context ) { 17460 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 17461 var node, i, elems, 17462 elem = context.getElementById( id ); 17463 17464 if ( elem ) { 17465 17466 // Verify the id attribute 17467 node = elem.getAttributeNode("id"); 17468 if ( node && node.value === id ) { 17469 return [ elem ]; 17470 } 17471 17472 // Fall back on getElementsByName 17473 elems = context.getElementsByName( id ); 17474 i = 0; 17475 while ( (elem = elems[i++]) ) { 17476 node = elem.getAttributeNode("id"); 17477 if ( node && node.value === id ) { 17478 return [ elem ]; 17479 } 17480 } 17481 } 17482 17483 return []; 17484 } 17485 }; 17486 } 17487 17488 // Tag 17489 Expr.find["TAG"] = support.getElementsByTagName ? 17490 function( tag, context ) { 17491 if ( typeof context.getElementsByTagName !== "undefined" ) { 17492 return context.getElementsByTagName( tag ); 17493 17494 // DocumentFragment nodes don't have gEBTN 17495 } else if ( support.qsa ) { 17496 return context.querySelectorAll( tag ); 17497 } 17498 } : 17499 17500 function( tag, context ) { 17501 var elem, 17502 tmp = [], 17503 i = 0, 17504 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 17505 results = context.getElementsByTagName( tag ); 17506 17507 // Filter out possible comments 17508 if ( tag === "*" ) { 17509 while ( (elem = results[i++]) ) { 17510 if ( elem.nodeType === 1 ) { 17511 tmp.push( elem ); 17512 } 17513 } 17514 17515 return tmp; 17516 } 17517 return results; 17518 }; 17519 17520 // Class 17521 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 17522 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 17523 return context.getElementsByClassName( className ); 17524 } 17525 }; 17526 17527 /* QSA/matchesSelector 17528 ---------------------------------------------------------------------- */ 17529 17530 // QSA and matchesSelector support 17531 17532 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 17533 rbuggyMatches = []; 17534 17535 // qSa(:focus) reports false when true (Chrome 21) 17536 // We allow this because of a bug in IE8/9 that throws an error 17537 // whenever `document.activeElement` is accessed on an iframe 17538 // So, we allow :focus to pass through QSA all the time to avoid the IE error 17539 // See https://bugs.jquery.com/ticket/13378 17540 rbuggyQSA = []; 17541 17542 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 17543 // Build QSA regex 17544 // Regex strategy adopted from Diego Perini 17545 assert(function( el ) { 17546 // Select is set to empty string on purpose 17547 // This is to test IE's treatment of not explicitly 17548 // setting a boolean content attribute, 17549 // since its presence should be enough 17550 // https://bugs.jquery.com/ticket/12359 17551 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 17552 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 17553 "<option selected=''></option></select>"; 17554 17555 // Support: IE8, Opera 11-12.16 17556 // Nothing should be selected when empty strings follow ^= or $= or *= 17557 // The test attribute must be unknown in Opera but "safe" for WinRT 17558 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 17559 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 17560 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 17561 } 17562 17563 // Support: IE8 17564 // Boolean attributes and "value" are not treated correctly 17565 if ( !el.querySelectorAll("[selected]").length ) { 17566 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 17567 } 17568 17569 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 17570 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 17571 rbuggyQSA.push("~="); 17572 } 17573 17574 // Webkit/Opera - :checked should return selected option elements
vendor: 25,806 bytes, lines 17575-18458
17575 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 17576 // IE8 throws error here and will not see later tests 17577 if ( !el.querySelectorAll(":checked").length ) { 17578 rbuggyQSA.push(":checked"); 17579 } 17580 17581 // Support: Safari 8+, iOS 8+ 17582 // https://bugs.webkit.org/show_bug.cgi?id=136851 17583 // In-page `selector#id sibling-combinator selector` fails 17584 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 17585 rbuggyQSA.push(".#.+[+~]"); 17586 } 17587 }); 17588 17589 assert(function( el ) { 17590 el.innerHTML = "<a href='' disabled='disabled'></a>" + 17591 "<select disabled='disabled'><option/></select>"; 17592 17593 // Support: Windows 8 Native Apps 17594 // The type and name attributes are restricted during .innerHTML assignment 17595 var input = document.createElement("input"); 17596 input.setAttribute( "type", "hidden" ); 17597 el.appendChild( input ).setAttribute( "name", "D" ); 17598 17599 // Support: IE8 17600 // Enforce case-sensitivity of name attribute 17601 if ( el.querySelectorAll("[name=d]").length ) { 17602 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 17603 } 17604 17605 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 17606 // IE8 throws error here and will not see later tests 17607 if ( el.querySelectorAll(":enabled").length !== 2 ) { 17608 rbuggyQSA.push( ":enabled", ":disabled" ); 17609 } 17610 17611 // Support: IE9-11+ 17612 // IE's :disabled selector does not pick up the children of disabled fieldsets 17613 docElem.appendChild( el ).disabled = true; 17614 if ( el.querySelectorAll(":disabled").length !== 2 ) { 17615 rbuggyQSA.push( ":enabled", ":disabled" ); 17616 } 17617 17618 // Opera 10-11 does not throw on post-comma invalid pseudos 17619 el.querySelectorAll("*,:x"); 17620 rbuggyQSA.push(",.*:"); 17621 }); 17622 } 17623 17624 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 17625 docElem.webkitMatchesSelector || 17626 docElem.mozMatchesSelector || 17627 docElem.oMatchesSelector || 17628 docElem.msMatchesSelector) )) ) { 17629 17630 assert(function( el ) { 17631 // Check to see if it's possible to do matchesSelector 17632 // on a disconnected node (IE 9) 17633 support.disconnectedMatch = matches.call( el, "*" ); 17634 17635 // This should fail with an exception 17636 // Gecko does not error, returns false instead 17637 matches.call( el, "[s!='']:x" ); 17638 rbuggyMatches.push( "!=", pseudos ); 17639 }); 17640 } 17641 17642 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 17643 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 17644 17645 /* Contains 17646 ---------------------------------------------------------------------- */ 17647 hasCompare = rnative.test( docElem.compareDocumentPosition ); 17648 17649 // Element contains another 17650 // Purposefully self-exclusive 17651 // As in, an element does not contain itself 17652 contains = hasCompare || rnative.test( docElem.contains ) ? 17653 function( a, b ) { 17654 var adown = a.nodeType === 9 ? a.documentElement : a, 17655 bup = b && b.parentNode; 17656 return a === bup || !!( bup && bup.nodeType === 1 && ( 17657 adown.contains ? 17658 adown.contains( bup ) : 17659 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 17660 )); 17661 } : 17662 function( a, b ) { 17663 if ( b ) { 17664 while ( (b = b.parentNode) ) { 17665 if ( b === a ) { 17666 return true; 17667 } 17668 } 17669 } 17670 return false; 17671 }; 17672 17673 /* Sorting 17674 ---------------------------------------------------------------------- */ 17675 17676 // Document order sorting 17677 sortOrder = hasCompare ? 17678 function( a, b ) { 17679 17680 // Flag for duplicate removal 17681 if ( a === b ) { 17682 hasDuplicate = true; 17683 return 0; 17684 } 17685 17686 // Sort on method existence if only one input has compareDocumentPosition 17687 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 17688 if ( compare ) { 17689 return compare; 17690 } 17691 17692 // Calculate position if both inputs belong to the same document 17693 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 17694 a.compareDocumentPosition( b ) : 17695 17696 // Otherwise we know they are disconnected 17697 1; 17698 17699 // Disconnected nodes 17700 if ( compare & 1 || 17701 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 17702 17703 // Choose the first element that is related to our preferred document 17704 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 17705 return -1; 17706 } 17707 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 17708 return 1; 17709 } 17710 17711 // Maintain original order 17712 return sortInput ? 17713 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 17714 0; 17715 } 17716 17717 return compare & 4 ? -1 : 1; 17718 } : 17719 function( a, b ) { 17720 // Exit early if the nodes are identical 17721 if ( a === b ) { 17722 hasDuplicate = true; 17723 return 0; 17724 } 17725 17726 var cur, 17727 i = 0, 17728 aup = a.parentNode, 17729 bup = b.parentNode, 17730 ap = [ a ], 17731 bp = [ b ]; 17732 17733 // Parentless nodes are either documents or disconnected 17734 if ( !aup || !bup ) { 17735 return a === document ? -1 : 17736 b === document ? 1 : 17737 aup ? -1 : 17738 bup ? 1 : 17739 sortInput ? 17740 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 17741 0; 17742 17743 // If the nodes are siblings, we can do a quick check 17744 } else if ( aup === bup ) { 17745 return siblingCheck( a, b ); 17746 } 17747 17748 // Otherwise we need full lists of their ancestors for comparison 17749 cur = a; 17750 while ( (cur = cur.parentNode) ) { 17751 ap.unshift( cur ); 17752 } 17753 cur = b; 17754 while ( (cur = cur.parentNode) ) { 17755 bp.unshift( cur ); 17756 } 17757 17758 // Walk down the tree looking for a discrepancy 17759 while ( ap[i] === bp[i] ) { 17760 i++; 17761 } 17762 17763 return i ? 17764 // Do a sibling check if the nodes have a common ancestor 17765 siblingCheck( ap[i], bp[i] ) : 17766 17767 // Otherwise nodes in our document sort first 17768 ap[i] === preferredDoc ? -1 : 17769 bp[i] === preferredDoc ? 1 : 17770 0; 17771 }; 17772 17773 return document; 17774 }; 17775 17776 Sizzle.matches = function( expr, elements ) { 17777 return Sizzle( expr, null, null, elements ); 17778 }; 17779 17780 Sizzle.matchesSelector = function( elem, expr ) { 17781 // Set document vars if needed 17782 if ( ( elem.ownerDocument || elem ) !== document ) { 17783 setDocument( elem ); 17784 } 17785 17786 // Make sure that attribute selectors are quoted 17787 expr = expr.replace( rattributeQuotes, "='$1']" ); 17788 17789 if ( support.matchesSelector && documentIsHTML && 17790 !compilerCache[ expr + " " ] && 17791 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 17792 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 17793 17794 try { 17795 var ret = matches.call( elem, expr ); 17796 17797 // IE 9's matchesSelector returns false on disconnected nodes 17798 if ( ret || support.disconnectedMatch || 17799 // As well, disconnected nodes are said to be in a document 17800 // fragment in IE 9 17801 elem.document && elem.document.nodeType !== 11 ) { 17802 return ret; 17803 } 17804 } catch (e) {} 17805 } 17806 17807 return Sizzle( expr, document, null, [ elem ] ).length > 0; 17808 }; 17809 17810 Sizzle.contains = function( context, elem ) { 17811 // Set document vars if needed 17812 if ( ( context.ownerDocument || context ) !== document ) { 17813 setDocument( context ); 17814 } 17815 return contains( context, elem ); 17816 }; 17817 17818 Sizzle.attr = function( elem, name ) { 17819 // Set document vars if needed 17820 if ( ( elem.ownerDocument || elem ) !== document ) { 17821 setDocument( elem ); 17822 } 17823 17824 var fn = Expr.attrHandle[ name.toLowerCase() ], 17825 // Don't get fooled by Object.prototype properties (jQuery #13807) 17826 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 17827 fn( elem, name, !documentIsHTML ) : 17828 undefined; 17829 17830 return val !== undefined ? 17831 val : 17832 support.attributes || !documentIsHTML ? 17833 elem.getAttribute( name ) : 17834 (val = elem.getAttributeNode(name)) && val.specified ? 17835 val.value : 17836 null; 17837 }; 17838 17839 Sizzle.escape = function( sel ) { 17840 return (sel + "").replace( rcssescape, fcssescape ); 17841 }; 17842 17843 Sizzle.error = function( msg ) { 17844 throw new Error( "Syntax error, unrecognized expression: " + msg ); 17845 }; 17846 17847 /** 17848 * Document sorting and removing duplicates 17849 * @param {ArrayLike} results 17850 */ 17851 Sizzle.uniqueSort = function( results ) { 17852 var elem, 17853 duplicates = [], 17854 j = 0, 17855 i = 0; 17856 17857 // Unless we *know* we can detect duplicates, assume their presence 17858 hasDuplicate = !support.detectDuplicates; 17859 sortInput = !support.sortStable && results.slice( 0 ); 17860 results.sort( sortOrder ); 17861 17862 if ( hasDuplicate ) { 17863 while ( (elem = results[i++]) ) { 17864 if ( elem === results[ i ] ) { 17865 j = duplicates.push( i ); 17866 } 17867 } 17868 while ( j-- ) { 17869 results.splice( duplicates[ j ], 1 ); 17870 } 17871 } 17872 17873 // Clear input after sorting to release objects 17874 // See https://github.com/jquery/sizzle/pull/225 17875 sortInput = null; 17876 17877 return results; 17878 }; 17879 17880 /** 17881 * Utility function for retrieving the text value of an array of DOM nodes 17882 * @param {Array|Element} elem 17883 */ 17884 getText = Sizzle.getText = function( elem ) { 17885 var node, 17886 ret = "", 17887 i = 0, 17888 nodeType = elem.nodeType; 17889 17890 if ( !nodeType ) { 17891 // If no nodeType, this is expected to be an array 17892 while ( (node = elem[i++]) ) { 17893 // Do not traverse comment nodes 17894 ret += getText( node ); 17895 } 17896 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 17897 // Use textContent for elements 17898 // innerText usage removed for consistency of new lines (jQuery #11153) 17899 if ( typeof elem.textContent === "string" ) { 17900 return elem.textContent; 17901 } else { 17902 // Traverse its children 17903 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 17904 ret += getText( elem ); 17905 } 17906 } 17907 } else if ( nodeType === 3 || nodeType === 4 ) { 17908 return elem.nodeValue; 17909 } 17910 // Do not include comment or processing instruction nodes 17911 17912 return ret; 17913 }; 17914 17915 Expr = Sizzle.selectors = { 17916 17917 // Can be adjusted by the user 17918 cacheLength: 50, 17919 17920 createPseudo: markFunction, 17921 17922 match: matchExpr, 17923 17924 attrHandle: {}, 17925 17926 find: {}, 17927 17928 relative: { 17929 ">": { dir: "parentNode", first: true }, 17930 " ": { dir: "parentNode" }, 17931 "+": { dir: "previousSibling", first: true }, 17932 "~": { dir: "previousSibling" } 17933 }, 17934 17935 preFilter: { 17936 "ATTR": function( match ) { 17937 match[1] = match[1].replace( runescape, funescape ); 17938 17939 // Move the given value to match[3] whether quoted or unquoted 17940 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 17941 17942 if ( match[2] === "~=" ) { 17943 match[3] = " " + match[3] + " "; 17944 } 17945 17946 return match.slice( 0, 4 ); 17947 }, 17948 17949 "CHILD": function( match ) { 17950 /* matches from matchExpr["CHILD"] 17951 1 type (only|nth|...) 17952 2 what (child|of-type) 17953 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 17954 4 xn-component of xn+y argument ([+-]?\d*n|) 17955 5 sign of xn-component 17956 6 x of xn-component 17957 7 sign of y-component 17958 8 y of y-component 17959 */ 17960 match[1] = match[1].toLowerCase(); 17961 17962 if ( match[1].slice( 0, 3 ) === "nth" ) { 17963 // nth-* requires argument 17964 if ( !match[3] ) { 17965 Sizzle.error( match[0] ); 17966 } 17967 17968 // numeric x and y parameters for Expr.filter.CHILD 17969 // remember that false/true cast respectively to 0/1 17970 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 17971 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 17972 17973 // other types prohibit arguments 17974 } else if ( match[3] ) { 17975 Sizzle.error( match[0] ); 17976 } 17977 17978 return match; 17979 }, 17980 17981 "PSEUDO": function( match ) { 17982 var excess, 17983 unquoted = !match[6] && match[2]; 17984 17985 if ( matchExpr["CHILD"].test( match[0] ) ) { 17986 return null; 17987 } 17988 17989 // Accept quoted arguments as-is 17990 if ( match[3] ) { 17991 match[2] = match[4] || match[5] || ""; 17992 17993 // Strip excess characters from unquoted arguments 17994 } else if ( unquoted && rpseudo.test( unquoted ) && 17995 // Get excess from tokenize (recursively) 17996 (excess = tokenize( unquoted, true )) && 17997 // advance to the next closing parenthesis 17998 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 17999 18000 // excess is a negative index 18001 match[0] = match[0].slice( 0, excess ); 18002 match[2] = unquoted.slice( 0, excess ); 18003 } 18004 18005 // Return only captures needed by the pseudo filter method (type and argument) 18006 return match.slice( 0, 3 ); 18007 } 18008 }, 18009 18010 filter: { 18011 18012 "TAG": function( nodeNameSelector ) { 18013 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 18014 return nodeNameSelector === "*" ? 18015 function() { return true; } : 18016 function( elem ) { 18017 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 18018 }; 18019 }, 18020 18021 "CLASS": function( className ) { 18022 var pattern = classCache[ className + " " ]; 18023 18024 return pattern || 18025 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 18026 classCache( className, function( elem ) { 18027 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 18028 }); 18029 }, 18030 18031 "ATTR": function( name, operator, check ) { 18032 return function( elem ) { 18033 var result = Sizzle.attr( elem, name ); 18034 18035 if ( result == null ) { 18036 return operator === "!="; 18037 } 18038 if ( !operator ) { 18039 return true; 18040 } 18041 18042 result += ""; 18043 18044 return operator === "=" ? result === check : 18045 operator === "!=" ? result !== check : 18046 operator === "^=" ? check && result.indexOf( check ) === 0 : 18047 operator === "*=" ? check && result.indexOf( check ) > -1 : 18048 operator === "$=" ? check && result.slice( -check.length ) === check : 18049 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 18050 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 18051 false; 18052 }; 18053 }, 18054 18055 "CHILD": function( type, what, argument, first, last ) { 18056 var simple = type.slice( 0, 3 ) !== "nth", 18057 forward = type.slice( -4 ) !== "last", 18058 ofType = what === "of-type"; 18059 18060 return first === 1 && last === 0 ? 18061 18062 // Shortcut for :nth-*(n) 18063 function( elem ) { 18064 return !!elem.parentNode; 18065 } : 18066 18067 function( elem, context, xml ) { 18068 var cache, uniqueCache, outerCache, node, nodeIndex, start, 18069 dir = simple !== forward ? "nextSibling" : "previousSibling", 18070 parent = elem.parentNode, 18071 name = ofType && elem.nodeName.toLowerCase(), 18072 useCache = !xml && !ofType, 18073 diff = false; 18074 18075 if ( parent ) { 18076 18077 // :(first|last|only)-(child|of-type) 18078 if ( simple ) { 18079 while ( dir ) { 18080 node = elem; 18081 while ( (node = node[ dir ]) ) { 18082 if ( ofType ? 18083 node.nodeName.toLowerCase() === name : 18084 node.nodeType === 1 ) { 18085 18086 return false; 18087 } 18088 } 18089 // Reverse direction for :only-* (if we haven't yet done so) 18090 start = dir = type === "only" && !start && "nextSibling"; 18091 } 18092 return true; 18093 } 18094 18095 start = [ forward ? parent.firstChild : parent.lastChild ]; 18096 18097 // non-xml :nth-child(...) stores cache data on `parent` 18098 if ( forward && useCache ) { 18099 18100 // Seek `elem` from a previously-cached index 18101 18102 // ...in a gzip-friendly way 18103 node = parent; 18104 outerCache = node[ expando ] || (node[ expando ] = {}); 18105 18106 // Support: IE <9 only 18107 // Defend against cloned attroperties (jQuery gh-1709) 18108 uniqueCache = outerCache[ node.uniqueID ] || 18109 (outerCache[ node.uniqueID ] = {}); 18110 18111 cache = uniqueCache[ type ] || []; 18112 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 18113 diff = nodeIndex && cache[ 2 ]; 18114 node = nodeIndex && parent.childNodes[ nodeIndex ]; 18115 18116 while ( (node = ++nodeIndex && node && node[ dir ] || 18117 18118 // Fallback to seeking `elem` from the start 18119 (diff = nodeIndex = 0) || start.pop()) ) { 18120 18121 // When found, cache indexes on `parent` and break 18122 if ( node.nodeType === 1 && ++diff && node === elem ) { 18123 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 18124 break; 18125 } 18126 } 18127 18128 } else { 18129 // Use previously-cached element index if available 18130 if ( useCache ) { 18131 // ...in a gzip-friendly way 18132 node = elem; 18133 outerCache = node[ expando ] || (node[ expando ] = {}); 18134 18135 // Support: IE <9 only 18136 // Defend against cloned attroperties (jQuery gh-1709) 18137 uniqueCache = outerCache[ node.uniqueID ] || 18138 (outerCache[ node.uniqueID ] = {}); 18139 18140 cache = uniqueCache[ type ] || []; 18141 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 18142 diff = nodeIndex; 18143 } 18144 18145 // xml :nth-child(...) 18146 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 18147 if ( diff === false ) { 18148 // Use the same loop as above to seek `elem` from the start 18149 while ( (node = ++nodeIndex && node && node[ dir ] || 18150 (diff = nodeIndex = 0) || start.pop()) ) { 18151 18152 if ( ( ofType ? 18153 node.nodeName.toLowerCase() === name : 18154 node.nodeType === 1 ) && 18155 ++diff ) { 18156 18157 // Cache the index of each encountered element 18158 if ( useCache ) { 18159 outerCache = node[ expando ] || (node[ expando ] = {}); 18160 18161 // Support: IE <9 only 18162 // Defend against cloned attroperties (jQuery gh-1709) 18163 uniqueCache = outerCache[ node.uniqueID ] || 18164 (outerCache[ node.uniqueID ] = {}); 18165 18166 uniqueCache[ type ] = [ dirruns, diff ]; 18167 } 18168 18169 if ( node === elem ) { 18170 break; 18171 } 18172 } 18173 } 18174 } 18175 } 18176 18177 // Incorporate the offset, then check against cycle size 18178 diff -= last; 18179 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 18180 } 18181 }; 18182 }, 18183 18184 "PSEUDO": function( pseudo, argument ) { 18185 // pseudo-class names are case-insensitive 18186 // http://www.w3.org/TR/selectors/#pseudo-classes 18187 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 18188 // Remember that setFilters inherits from pseudos 18189 var args, 18190 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 18191 Sizzle.error( "unsupported pseudo: " + pseudo ); 18192 18193 // The user may use createPseudo to indicate that 18194 // arguments are needed to create the filter function 18195 // just as Sizzle does 18196 if ( fn[ expando ] ) { 18197 return fn( argument ); 18198 } 18199 18200 // But maintain support for old signatures 18201 if ( fn.length > 1 ) { 18202 args = [ pseudo, pseudo, "", argument ]; 18203 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 18204 markFunction(function( seed, matches ) { 18205 var idx, 18206 matched = fn( seed, argument ), 18207 i = matched.length; 18208 while ( i-- ) { 18209 idx = indexOf( seed, matched[i] ); 18210 seed[ idx ] = !( matches[ idx ] = matched[i] ); 18211 } 18212 }) : 18213 function( elem ) { 18214 return fn( elem, 0, args ); 18215 }; 18216 } 18217 18218 return fn; 18219 } 18220 }, 18221 18222 pseudos: { 18223 // Potentially complex pseudos 18224 "not": markFunction(function( selector ) { 18225 // Trim the selector passed to compile 18226 // to avoid treating leading and trailing 18227 // spaces as combinators 18228 var input = [], 18229 results = [], 18230 matcher = compile( selector.replace( rtrim, "$1" ) ); 18231 18232 return matcher[ expando ] ? 18233 markFunction(function( seed, matches, context, xml ) { 18234 var elem, 18235 unmatched = matcher( seed, null, xml, [] ), 18236 i = seed.length; 18237 18238 // Match elements unmatched by `matcher` 18239 while ( i-- ) { 18240 if ( (elem = unmatched[i]) ) { 18241 seed[i] = !(matches[i] = elem); 18242 } 18243 } 18244 }) : 18245 function( elem, context, xml ) { 18246 input[0] = elem; 18247 matcher( input, null, xml, results ); 18248 // Don't keep the element (issue #299) 18249 input[0] = null; 18250 return !results.pop(); 18251 }; 18252 }), 18253 18254 "has": markFunction(function( selector ) { 18255 return function( elem ) { 18256 return Sizzle( selector, elem ).length > 0; 18257 }; 18258 }), 18259 18260 "contains": markFunction(function( text ) { 18261 text = text.replace( runescape, funescape ); 18262 return function( elem ) { 18263 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 18264 }; 18265 }), 18266 18267 // "Whether an element is represented by a :lang() selector 18268 // is based solely on the element's language value 18269 // being equal to the identifier C, 18270 // or beginning with the identifier C immediately followed by "-". 18271 // The matching of C against the element's language value is performed case-insensitively. 18272 // The identifier C does not have to be a valid language name." 18273 // http://www.w3.org/TR/selectors/#lang-pseudo 18274 "lang": markFunction( function( lang ) { 18275 // lang value must be a valid identifier 18276 if ( !ridentifier.test(lang || "") ) { 18277 Sizzle.error( "unsupported lang: " + lang ); 18278 } 18279 lang = lang.replace( runescape, funescape ).toLowerCase(); 18280 return function( elem ) { 18281 var elemLang; 18282 do { 18283 if ( (elemLang = documentIsHTML ? 18284 elem.lang : 18285 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 18286 18287 elemLang = elemLang.toLowerCase(); 18288 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 18289 } 18290 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 18291 return false; 18292 }; 18293 }), 18294 18295 // Miscellaneous 18296 "target": function( elem ) { 18297 var hash = window.location && window.location.hash; 18298 return hash && hash.slice( 1 ) === elem.id; 18299 }, 18300 18301 "root": function( elem ) { 18302 return elem === docElem; 18303 }, 18304 18305 "focus": function( elem ) { 18306 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 18307 }, 18308 18309 // Boolean properties 18310 "enabled": createDisabledPseudo( false ), 18311 "disabled": createDisabledPseudo( true ), 18312 18313 "checked": function( elem ) { 18314 // In CSS3, :checked should return both checked and selected elements 18315 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 18316 var nodeName = elem.nodeName.toLowerCase(); 18317 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 18318 }, 18319 18320 "selected": function( elem ) { 18321 // Accessing this property makes selected-by-default 18322 // options in Safari work properly 18323 if ( elem.parentNode ) { 18324 elem.parentNode.selectedIndex; 18325 } 18326 18327 return elem.selected === true; 18328 }, 18329 18330 // Contents 18331 "empty": function( elem ) { 18332 // http://www.w3.org/TR/selectors/#empty-pseudo 18333 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 18334 // but not by others (comment: 8; processing instruction: 7; etc.) 18335 // nodeType < 6 works because attributes (2) do not appear as children 18336 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 18337 if ( elem.nodeType < 6 ) { 18338 return false; 18339 } 18340 } 18341 return true; 18342 }, 18343 18344 "parent": function( elem ) { 18345 return !Expr.pseudos["empty"]( elem ); 18346 }, 18347 18348 // Element/input types 18349 "header": function( elem ) { 18350 return rheader.test( elem.nodeName ); 18351 }, 18352 18353 "input": function( elem ) { 18354 return rinputs.test( elem.nodeName ); 18355 }, 18356 18357 "button": function( elem ) { 18358 var name = elem.nodeName.toLowerCase(); 18359 return name === "input" && elem.type === "button" || name === "button"; 18360 }, 18361 18362 "text": function( elem ) { 18363 var attr; 18364 return elem.nodeName.toLowerCase() === "input" && 18365 elem.type === "text" && 18366 18367 // Support: IE<8 18368 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 18369 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 18370 }, 18371 18372 // Position-in-collection 18373 "first": createPositionalPseudo(function() { 18374 return [ 0 ]; 18375 }), 18376 18377 "last": createPositionalPseudo(function( matchIndexes, length ) { 18378 return [ length - 1 ]; 18379 }), 18380 18381 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 18382 return [ argument < 0 ? argument + length : argument ]; 18383 }), 18384 18385 "even": createPositionalPseudo(function( matchIndexes, length ) { 18386 var i = 0; 18387 for ( ; i < length; i += 2 ) { 18388 matchIndexes.push( i ); 18389 } 18390 return matchIndexes; 18391 }), 18392 18393 "odd": createPositionalPseudo(function( matchIndexes, length ) { 18394 var i = 1; 18395 for ( ; i < length; i += 2 ) { 18396 matchIndexes.push( i ); 18397 } 18398 return matchIndexes; 18399 }), 18400 18401 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 18402 var i = argument < 0 ? argument + length : argument; 18403 for ( ; --i >= 0; ) { 18404 matchIndexes.push( i ); 18405 } 18406 return matchIndexes; 18407 }), 18408 18409 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 18410 var i = argument < 0 ? argument + length : argument; 18411 for ( ; ++i < length; ) { 18412 matchIndexes.push( i ); 18413 } 18414 return matchIndexes; 18415 }) 18416 } 18417 }; 18418 18419 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 18420 18421 // Add button/input type pseudos 18422 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 18423 Expr.pseudos[ i ] = createInputPseudo( i ); 18424 } 18425 for ( i in { submit: true, reset: true } ) { 18426 Expr.pseudos[ i ] = createButtonPseudo( i ); 18427 } 18428 18429 // Easy API for creating new setFilters 18430 function setFilters() {} 18431 setFilters.prototype = Expr.filters = Expr.pseudos; 18432 Expr.setFilters = new setFilters(); 18433 18434 tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 18435 var matched, match, tokens, type, 18436 soFar, groups, preFilters, 18437 cached = tokenCache[ selector + " " ]; 18438 18439 if ( cached ) { 18440 return parseOnly ? 0 : cached.slice( 0 ); 18441 } 18442 18443 soFar = selector; 18444 groups = []; 18445 preFilters = Expr.preFilter; 18446 18447 while ( soFar ) { 18448 18449 // Comma and first run 18450 if ( !matched || (match = rcomma.exec( soFar )) ) { 18451 if ( match ) { 18452 // Don't consume trailing commas as valid 18453 soFar = soFar.slice( match[0].length ) || soFar; 18454 } 18455 groups.push( (tokens = []) ); 18456 } 18457 18458 matched = false;
vendor: 4,110 bytes, lines 18459-18619
18459 18460 // Combinators 18461 if ( (match = rcombinators.exec( soFar )) ) { 18462 matched = match.shift(); 18463 tokens.push({ 18464 value: matched, 18465 // Cast descendant combinators to space 18466 type: match[0].replace( rtrim, " " ) 18467 }); 18468 soFar = soFar.slice( matched.length ); 18469 } 18470 18471 // Filters 18472 for ( type in Expr.filter ) { 18473 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 18474 (match = preFilters[ type ]( match ))) ) { 18475 matched = match.shift(); 18476 tokens.push({ 18477 value: matched, 18478 type: type, 18479 matches: match 18480 }); 18481 soFar = soFar.slice( matched.length ); 18482 } 18483 } 18484 18485 if ( !matched ) { 18486 break; 18487 } 18488 } 18489 18490 // Return the length of the invalid excess 18491 // if we're just parsing 18492 // Otherwise, throw an error or return tokens 18493 return parseOnly ? 18494 soFar.length : 18495 soFar ? 18496 Sizzle.error( selector ) : 18497 // Cache the tokens 18498 tokenCache( selector, groups ).slice( 0 ); 18499 }; 18500 18501 function toSelector( tokens ) { 18502 var i = 0, 18503 len = tokens.length, 18504 selector = ""; 18505 for ( ; i < len; i++ ) { 18506 selector += tokens[i].value; 18507 } 18508 return selector; 18509 } 18510 18511 function addCombinator( matcher, combinator, base ) { 18512 var dir = combinator.dir, 18513 skip = combinator.next, 18514 key = skip || dir, 18515 checkNonElements = base && key === "parentNode", 18516 doneName = done++; 18517 18518 return combinator.first ? 18519 // Check against closest ancestor/preceding element 18520 function( elem, context, xml ) { 18521 while ( (elem = elem[ dir ]) ) { 18522 if ( elem.nodeType === 1 || checkNonElements ) { 18523 return matcher( elem, context, xml ); 18524 } 18525 } 18526 return false; 18527 } : 18528 18529 // Check against all ancestor/preceding elements 18530 function( elem, context, xml ) { 18531 var oldCache, uniqueCache, outerCache, 18532 newCache = [ dirruns, doneName ]; 18533 18534 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 18535 if ( xml ) { 18536 while ( (elem = elem[ dir ]) ) { 18537 if ( elem.nodeType === 1 || checkNonElements ) { 18538 if ( matcher( elem, context, xml ) ) { 18539 return true; 18540 } 18541 } 18542 } 18543 } else { 18544 while ( (elem = elem[ dir ]) ) { 18545 if ( elem.nodeType === 1 || checkNonElements ) { 18546 outerCache = elem[ expando ] || (elem[ expando ] = {}); 18547 18548 // Support: IE <9 only 18549 // Defend against cloned attroperties (jQuery gh-1709) 18550 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 18551 18552 if ( skip && skip === elem.nodeName.toLowerCase() ) { 18553 elem = elem[ dir ] || elem; 18554 } else if ( (oldCache = uniqueCache[ key ]) && 18555 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 18556 18557 // Assign to newCache so results back-propagate to previous elements 18558 return (newCache[ 2 ] = oldCache[ 2 ]); 18559 } else { 18560 // Reuse newcache so results back-propagate to previous elements 18561 uniqueCache[ key ] = newCache; 18562 18563 // A match means we're done; a fail means we have to keep checking 18564 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 18565 return true; 18566 } 18567 } 18568 } 18569 } 18570 } 18571 return false; 18572 }; 18573 } 18574 18575 function elementMatcher( matchers ) { 18576 return matchers.length > 1 ? 18577 function( elem, context, xml ) { 18578 var i = matchers.length; 18579 while ( i-- ) { 18580 if ( !matchers[i]( elem, context, xml ) ) { 18581 return false; 18582 } 18583 } 18584 return true; 18585 } : 18586 matchers[0]; 18587 } 18588 18589 function multipleContexts( selector, contexts, results ) { 18590 var i = 0, 18591 len = contexts.length; 18592 for ( ; i < len; i++ ) { 18593 Sizzle( selector, contexts[i], results ); 18594 } 18595 return results; 18596 } 18597 18598 function condense( unmatched, map, filter, context, xml ) { 18599 var elem, 18600 newUnmatched = [], 18601 i = 0, 18602 len = unmatched.length, 18603 mapped = map != null; 18604 18605 for ( ; i < len; i++ ) { 18606 if ( (elem = unmatched[i]) ) { 18607 if ( !filter || filter( elem, context, xml ) ) { 18608 newUnmatched.push( elem ); 18609 if ( mapped ) { 18610 map.push( i ); 18611 } 18612 } 18613 } 18614 } 18615 18616 return newUnmatched; 18617 } 18618 18619 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
vendor: 4,437 bytes, lines 18620-18756
18620 if ( postFilter && !postFilter[ expando ] ) { 18621 postFilter = setMatcher( postFilter ); 18622 } 18623 if ( postFinder && !postFinder[ expando ] ) { 18624 postFinder = setMatcher( postFinder, postSelector ); 18625 } 18626 return markFunction(function( seed, results, context, xml ) { 18627 var temp, i, elem, 18628 preMap = [], 18629 postMap = [], 18630 preexisting = results.length, 18631 18632 // Get initial elements from seed or context 18633 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 18634 18635 // Prefilter to get matcher input, preserving a map for seed-results synchronization 18636 matcherIn = preFilter && ( seed || !selector ) ? 18637 condense( elems, preMap, preFilter, context, xml ) : 18638 elems, 18639 18640 matcherOut = matcher ? 18641 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 18642 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 18643 18644 // ...intermediate processing is necessary 18645 [] : 18646 18647 // ...otherwise use results directly 18648 results : 18649 matcherIn; 18650 18651 // Find primary matches 18652 if ( matcher ) { 18653 matcher( matcherIn, matcherOut, context, xml ); 18654 } 18655 18656 // Apply postFilter 18657 if ( postFilter ) { 18658 temp = condense( matcherOut, postMap ); 18659 postFilter( temp, [], context, xml ); 18660 18661 // Un-match failing elements by moving them back to matcherIn 18662 i = temp.length; 18663 while ( i-- ) { 18664 if ( (elem = temp[i]) ) { 18665 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 18666 } 18667 } 18668 } 18669 18670 if ( seed ) { 18671 if ( postFinder || preFilter ) { 18672 if ( postFinder ) { 18673 // Get the final matcherOut by condensing this intermediate into postFinder contexts 18674 temp = []; 18675 i = matcherOut.length; 18676 while ( i-- ) { 18677 if ( (elem = matcherOut[i]) ) { 18678 // Restore matcherIn since elem is not yet a final match 18679 temp.push( (matcherIn[i] = elem) ); 18680 } 18681 } 18682 postFinder( null, (matcherOut = []), temp, xml ); 18683 } 18684 18685 // Move matched elements from seed to results to keep them synchronized 18686 i = matcherOut.length; 18687 while ( i-- ) { 18688 if ( (elem = matcherOut[i]) && 18689 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 18690 18691 seed[temp] = !(results[temp] = elem); 18692 } 18693 } 18694 } 18695 18696 // Add elements to results, through postFinder if defined 18697 } else { 18698 matcherOut = condense( 18699 matcherOut === results ? 18700 matcherOut.splice( preexisting, matcherOut.length ) : 18701 matcherOut 18702 ); 18703 if ( postFinder ) { 18704 postFinder( null, results, matcherOut, xml ); 18705 } else { 18706 push.apply( results, matcherOut ); 18707 } 18708 } 18709 }); 18710 } 18711 18712 function matcherFromTokens( tokens ) { 18713 var checkContext, matcher, j, 18714 len = tokens.length, 18715 leadingRelative = Expr.relative[ tokens[0].type ], 18716 implicitRelative = leadingRelative || Expr.relative[" "], 18717 i = leadingRelative ? 1 : 0, 18718 18719 // The foundational matcher ensures that elements are reachable from top-level context(s) 18720 matchContext = addCombinator( function( elem ) { 18721 return elem === checkContext; 18722 }, implicitRelative, true ), 18723 matchAnyContext = addCombinator( function( elem ) { 18724 return indexOf( checkContext, elem ) > -1; 18725 }, implicitRelative, true ), 18726 matchers = [ function( elem, context, xml ) { 18727 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 18728 (checkContext = context).nodeType ? 18729 matchContext( elem, context, xml ) : 18730 matchAnyContext( elem, context, xml ) ); 18731 // Avoid hanging onto element (issue #299) 18732 checkContext = null; 18733 return ret; 18734 } ]; 18735 18736 for ( ; i < len; i++ ) { 18737 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 18738 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 18739 } else { 18740 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 18741 18742 // Return special upon seeing a positional matcher 18743 if ( matcher[ expando ] ) { 18744 // Find the next relative operator (if any) for proper handling 18745 j = ++i; 18746 for ( ; j < len; j++ ) { 18747 if ( Expr.relative[ tokens[j].type ] ) { 18748 break; 18749 } 18750 } 18751 return setMatcher( 18752 i > 1 && elementMatcher( matchers ), 18753 i > 1 && toSelector( 18754 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 18755 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 18756 ).replace( rtrim, "$1" ),
vendor: 11,891 bytes, lines 18757-19173
18757 matcher, 18758 i < j && matcherFromTokens( tokens.slice( i, j ) ), 18759 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 18760 j < len && toSelector( tokens ) 18761 ); 18762 } 18763 matchers.push( matcher ); 18764 } 18765 } 18766 18767 return elementMatcher( matchers ); 18768 } 18769 18770 function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 18771 var bySet = setMatchers.length > 0, 18772 byElement = elementMatchers.length > 0, 18773 superMatcher = function( seed, context, xml, results, outermost ) { 18774 var elem, j, matcher, 18775 matchedCount = 0, 18776 i = "0", 18777 unmatched = seed && [], 18778 setMatched = [], 18779 contextBackup = outermostContext, 18780 // We must always have either seed elements or outermost context 18781 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 18782 // Use integer dirruns iff this is the outermost matcher 18783 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 18784 len = elems.length; 18785 18786 if ( outermost ) { 18787 outermostContext = context === document || context || outermost; 18788 } 18789 18790 // Add elements passing elementMatchers directly to results 18791 // Support: IE<9, Safari 18792 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 18793 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 18794 if ( byElement && elem ) { 18795 j = 0; 18796 if ( !context && elem.ownerDocument !== document ) { 18797 setDocument( elem ); 18798 xml = !documentIsHTML; 18799 } 18800 while ( (matcher = elementMatchers[j++]) ) { 18801 if ( matcher( elem, context || document, xml) ) { 18802 results.push( elem ); 18803 break; 18804 } 18805 } 18806 if ( outermost ) { 18807 dirruns = dirrunsUnique; 18808 } 18809 } 18810 18811 // Track unmatched elements for set filters 18812 if ( bySet ) { 18813 // They will have gone through all possible matchers 18814 if ( (elem = !matcher && elem) ) { 18815 matchedCount--; 18816 } 18817 18818 // Lengthen the array for every element, matched or not 18819 if ( seed ) { 18820 unmatched.push( elem ); 18821 } 18822 } 18823 } 18824 18825 // `i` is now the count of elements visited above, and adding it to `matchedCount` 18826 // makes the latter nonnegative. 18827 matchedCount += i; 18828 18829 // Apply set filters to unmatched elements 18830 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 18831 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 18832 // no element matchers and no seed. 18833 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 18834 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 18835 // numerically zero. 18836 if ( bySet && i !== matchedCount ) { 18837 j = 0; 18838 while ( (matcher = setMatchers[j++]) ) { 18839 matcher( unmatched, setMatched, context, xml ); 18840 } 18841 18842 if ( seed ) { 18843 // Reintegrate element matches to eliminate the need for sorting 18844 if ( matchedCount > 0 ) { 18845 while ( i-- ) { 18846 if ( !(unmatched[i] || setMatched[i]) ) { 18847 setMatched[i] = pop.call( results ); 18848 } 18849 } 18850 } 18851 18852 // Discard index placeholder values to get only actual matches 18853 setMatched = condense( setMatched ); 18854 } 18855 18856 // Add matches to results 18857 push.apply( results, setMatched ); 18858 18859 // Seedless set matches succeeding multiple successful matchers stipulate sorting 18860 if ( outermost && !seed && setMatched.length > 0 && 18861 ( matchedCount + setMatchers.length ) > 1 ) { 18862 18863 Sizzle.uniqueSort( results ); 18864 } 18865 } 18866 18867 // Override manipulation of globals by nested matchers 18868 if ( outermost ) { 18869 dirruns = dirrunsUnique; 18870 outermostContext = contextBackup; 18871 } 18872 18873 return unmatched; 18874 }; 18875 18876 return bySet ? 18877 markFunction( superMatcher ) : 18878 superMatcher; 18879 } 18880 18881 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 18882 var i, 18883 setMatchers = [], 18884 elementMatchers = [], 18885 cached = compilerCache[ selector + " " ]; 18886 18887 if ( !cached ) { 18888 // Generate a function of recursive functions that can be used to check each element 18889 if ( !match ) { 18890 match = tokenize( selector ); 18891 } 18892 i = match.length; 18893 while ( i-- ) { 18894 cached = matcherFromTokens( match[i] ); 18895 if ( cached[ expando ] ) { 18896 setMatchers.push( cached ); 18897 } else { 18898 elementMatchers.push( cached ); 18899 } 18900 } 18901 18902 // Cache the compiled function 18903 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 18904 18905 // Save selector and tokenization 18906 cached.selector = selector; 18907 } 18908 return cached; 18909 }; 18910 18911 /** 18912 * A low-level selection function that works with Sizzle's compiled 18913 * selector functions 18914 * @param {String|Function} selector A selector or a pre-compiled 18915 * selector function built with Sizzle.compile 18916 * @param {Element} context 18917 * @param {Array} [results] 18918 * @param {Array} [seed] A set of elements to match against 18919 */ 18920 select = Sizzle.select = function( selector, context, results, seed ) { 18921 var i, tokens, token, type, find, 18922 compiled = typeof selector === "function" && selector, 18923 match = !seed && tokenize( (selector = compiled.selector || selector) ); 18924 18925 results = results || []; 18926 18927 // Try to minimize operations if there is only one selector in the list and no seed 18928 // (the latter of which guarantees us context) 18929 if ( match.length === 1 ) { 18930 18931 // Reduce context if the leading compound selector is an ID 18932 tokens = match[0] = match[0].slice( 0 ); 18933 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 18934 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 18935 18936 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 18937 if ( !context ) { 18938 return results; 18939 18940 // Precompiled matchers will still verify ancestry, so step up a level 18941 } else if ( compiled ) { 18942 context = context.parentNode; 18943 } 18944 18945 selector = selector.slice( tokens.shift().value.length ); 18946 } 18947 18948 // Fetch a seed set for right-to-left matching 18949 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 18950 while ( i-- ) { 18951 token = tokens[i]; 18952 18953 // Abort if we hit a combinator 18954 if ( Expr.relative[ (type = token.type) ] ) { 18955 break; 18956 } 18957 if ( (find = Expr.find[ type ]) ) { 18958 // Search, expanding context for leading sibling combinators 18959 if ( (seed = find( 18960 token.matches[0].replace( runescape, funescape ), 18961 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 18962 )) ) { 18963 18964 // If seed is empty or no tokens remain, we can return early 18965 tokens.splice( i, 1 ); 18966 selector = seed.length && toSelector( tokens ); 18967 if ( !selector ) { 18968 push.apply( results, seed ); 18969 return results; 18970 } 18971 18972 break; 18973 } 18974 } 18975 } 18976 } 18977 18978 // Compile and execute a filtering function if one is not provided 18979 // Provide `match` to avoid retokenization if we modified the selector above 18980 ( compiled || compile( selector, match ) )( 18981 seed, 18982 context, 18983 !documentIsHTML, 18984 results, 18985 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 18986 ); 18987 return results; 18988 }; 18989 18990 // One-time assignments 18991 18992 // Sort stability 18993 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 18994 18995 // Support: Chrome 14-35+ 18996 // Always assume duplicates if they aren't passed to the comparison function 18997 support.detectDuplicates = !!hasDuplicate; 18998 18999 // Initialize against the default document 19000 setDocument(); 19001 19002 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 19003 // Detached nodes confoundingly follow *each other* 19004 support.sortDetached = assert(function( el ) { 19005 // Should return 1, but returns 4 (following) 19006 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 19007 }); 19008 19009 // Support: IE<8 19010 // Prevent attribute/property "interpolation" 19011 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 19012 if ( !assert(function( el ) { 19013 el.innerHTML = "<a href='#'></a>"; 19014 return el.firstChild.getAttribute("href") === "#" ; 19015 }) ) { 19016 addHandle( "type|href|height|width", function( elem, name, isXML ) { 19017 if ( !isXML ) { 19018 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 19019 } 19020 }); 19021 } 19022 19023 // Support: IE<9 19024 // Use defaultValue in place of getAttribute("value") 19025 if ( !support.attributes || !assert(function( el ) { 19026 el.innerHTML = "<input/>"; 19027 el.firstChild.setAttribute( "value", "" ); 19028 return el.firstChild.getAttribute( "value" ) === ""; 19029 }) ) { 19030 addHandle( "value", function( elem, name, isXML ) { 19031 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 19032 return elem.defaultValue; 19033 } 19034 }); 19035 } 19036 19037 // Support: IE<9 19038 // Use getAttributeNode to fetch booleans when getAttribute lies 19039 if ( !assert(function( el ) { 19040 return el.getAttribute("disabled") == null; 19041 }) ) { 19042 addHandle( booleans, function( elem, name, isXML ) { 19043 var val; 19044 if ( !isXML ) { 19045 return elem[ name ] === true ? name.toLowerCase() : 19046 (val = elem.getAttributeNode( name )) && val.specified ? 19047 val.value : 19048 null; 19049 } 19050 }); 19051 } 19052 19053 return Sizzle; 19054 19055 })( window ); 19056 19057 19058 19059 jQuery.find = Sizzle; 19060 jQuery.expr = Sizzle.selectors; 19061 19062 // Deprecated 19063 jQuery.expr[ ":" ] = jQuery.expr.pseudos; 19064 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 19065 jQuery.text = Sizzle.getText; 19066 jQuery.isXMLDoc = Sizzle.isXML; 19067 jQuery.contains = Sizzle.contains; 19068 jQuery.escapeSelector = Sizzle.escape; 19069 19070 19071 19072 19073 var dir = function( elem, dir, until ) { 19074 var matched = [], 19075 truncate = until !== undefined; 19076 19077 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 19078 if ( elem.nodeType === 1 ) { 19079 if ( truncate && jQuery( elem ).is( until ) ) { 19080 break; 19081 } 19082 matched.push( elem ); 19083 } 19084 } 19085 return matched; 19086 }; 19087 19088 19089 var siblings = function( n, elem ) { 19090 var matched = []; 19091 19092 for ( ; n; n = n.nextSibling ) { 19093 if ( n.nodeType === 1 && n !== elem ) { 19094 matched.push( n ); 19095 } 19096 } 19097 19098 return matched; 19099 }; 19100 19101 19102 var rneedsContext = jQuery.expr.match.needsContext; 19103 19104 19105 19106 function nodeName( elem, name ) { 19107 19108 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 19109 19110 }; 19111 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 19112 19113 19114 19115 var risSimple = /^.[^:#\[\.,]*$/; 19116 19117 // Implement the identical functionality for filter and not 19118 function winnow( elements, qualifier, not ) { 19119 if ( jQuery.isFunction( qualifier ) ) { 19120 return jQuery.grep( elements, function( elem, i ) { 19121 return !!qualifier.call( elem, i, elem ) !== not; 19122 } ); 19123 } 19124 19125 // Single element 19126 if ( qualifier.nodeType ) { 19127 return jQuery.grep( elements, function( elem ) { 19128 return ( elem === qualifier ) !== not; 19129 } ); 19130 } 19131 19132 // Arraylike of elements (jQuery, arguments, Array) 19133 if ( typeof qualifier !== "string" ) { 19134 return jQuery.grep( elements, function( elem ) { 19135 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 19136 } ); 19137 } 19138 19139 // Simple selector that can be filtered directly, removing non-Elements 19140 if ( risSimple.test( qualifier ) ) { 19141 return jQuery.filter( qualifier, elements, not ); 19142 } 19143 19144 // Complex selector, compare the two sets, removing non-Elements 19145 qualifier = jQuery.filter( qualifier, elements ); 19146 return jQuery.grep( elements, function( elem ) { 19147 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; 19148 } ); 19149 } 19150 19151 jQuery.filter = function( expr, elems, not ) { 19152 var elem = elems[ 0 ]; 19153 19154 if ( not ) { 19155 expr = ":not(" + expr + ")"; 19156 } 19157 19158 if ( elems.length === 1 && elem.nodeType === 1 ) { 19159 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 19160 } 19161 19162 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 19163 return elem.nodeType === 1; 19164 } ) ); 19165 }; 19166 19167 jQuery.fn.extend( { 19168 find: function( selector ) { 19169 var i, ret, 19170 len = this.length, 19171 self = this; 19172 19173 if ( typeof selector !== "string" ) {
vendor: 4,426 bytes, lines 19174-19339
19174 return this.pushStack( jQuery( selector ).filter( function() { 19175 for ( i = 0; i < len; i++ ) { 19176 if ( jQuery.contains( self[ i ], this ) ) { 19177 return true; 19178 } 19179 } 19180 } ) ); 19181 } 19182 19183 ret = this.pushStack( [] ); 19184 19185 for ( i = 0; i < len; i++ ) { 19186 jQuery.find( selector, self[ i ], ret ); 19187 } 19188 19189 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 19190 }, 19191 filter: function( selector ) { 19192 return this.pushStack( winnow( this, selector || [], false ) ); 19193 }, 19194 not: function( selector ) { 19195 return this.pushStack( winnow( this, selector || [], true ) ); 19196 }, 19197 is: function( selector ) { 19198 return !!winnow( 19199 this, 19200 19201 // If this is a positional/relative selector, check membership in the returned set 19202 // so $("p:first").is("p:last") won't return true for a doc with two "p". 19203 typeof selector === "string" && rneedsContext.test( selector ) ? 19204 jQuery( selector ) : 19205 selector || [], 19206 false 19207 ).length; 19208 } 19209 } ); 19210 19211 19212 // Initialize a jQuery object 19213 19214 19215 // A central reference to the root jQuery(document) 19216 var rootjQuery, 19217 19218 // A simple way to check for HTML strings 19219 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 19220 // Strict HTML recognition (#11290: must start with <) 19221 // Shortcut simple #id case for speed 19222 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 19223 19224 init = jQuery.fn.init = function( selector, context, root ) { 19225 var match, elem; 19226 19227 // HANDLE: $(""), $(null), $(undefined), $(false) 19228 if ( !selector ) { 19229 return this; 19230 } 19231 19232 // Method init() accepts an alternate rootjQuery 19233 // so migrate can support jQuery.sub (gh-2101) 19234 root = root || rootjQuery; 19235 19236 // Handle HTML strings 19237 if ( typeof selector === "string" ) { 19238 if ( selector[ 0 ] === "<" && 19239 selector[ selector.length - 1 ] === ">" && 19240 selector.length >= 3 ) { 19241 19242 // Assume that strings that start and end with <> are HTML and skip the regex check 19243 match = [ null, selector, null ]; 19244 19245 } else { 19246 match = rquickExpr.exec( selector ); 19247 } 19248 19249 // Match html or make sure no context is specified for #id 19250 if ( match && ( match[ 1 ] || !context ) ) { 19251 19252 // HANDLE: $(html) -> $(array) 19253 if ( match[ 1 ] ) { 19254 context = context instanceof jQuery ? context[ 0 ] : context; 19255 19256 // Option to run scripts is true for back-compat 19257 // Intentionally let the error be thrown if parseHTML is not present 19258 jQuery.merge( this, jQuery.parseHTML( 19259 match[ 1 ], 19260 context && context.nodeType ? context.ownerDocument || context : document, 19261 true 19262 ) ); 19263 19264 // HANDLE: $(html, props) 19265 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 19266 for ( match in context ) { 19267 19268 // Properties of context are called as methods if possible 19269 if ( jQuery.isFunction( this[ match ] ) ) { 19270 this[ match ]( context[ match ] ); 19271 19272 // ...and otherwise set as attributes 19273 } else { 19274 this.attr( match, context[ match ] ); 19275 } 19276 } 19277 } 19278 19279 return this; 19280 19281 // HANDLE: $(#id) 19282 } else { 19283 elem = document.getElementById( match[ 2 ] ); 19284 19285 if ( elem ) { 19286 19287 // Inject the element directly into the jQuery object 19288 this[ 0 ] = elem; 19289 this.length = 1; 19290 } 19291 return this; 19292 } 19293 19294 // HANDLE: $(expr, $(...)) 19295 } else if ( !context || context.jquery ) { 19296 return ( context || root ).find( selector ); 19297 19298 // HANDLE: $(expr, context) 19299 // (which is just equivalent to: $(context).find(expr) 19300 } else { 19301 return this.constructor( context ).find( selector ); 19302 } 19303 19304 // HANDLE: $(DOMElement) 19305 } else if ( selector.nodeType ) { 19306 this[ 0 ] = selector; 19307 this.length = 1; 19308 return this; 19309 19310 // HANDLE: $(function) 19311 // Shortcut for document ready 19312 } else if ( jQuery.isFunction( selector ) ) { 19313 return root.ready !== undefined ? 19314 root.ready( selector ) : 19315 19316 // Execute immediately if ready is not present 19317 selector( jQuery ); 19318 } 19319 19320 return jQuery.makeArray( selector, this ); 19321 }; 19322 19323 // Give the init function the jQuery prototype for later instantiation 19324 init.prototype = jQuery.fn; 19325 19326 // Initialize central reference 19327 rootjQuery = jQuery( document ); 19328 19329 19330 var rparentsprev = /^(?:parents|prev(?:Until|All))/, 19331 19332 // Methods guaranteed to produce a unique set when starting from a unique set 19333 guaranteedUnique = { 19334 children: true, 19335 contents: true, 19336 next: true, 19337 prev: true 19338 }; 19339
vendor: 6,588 bytes, lines 19340-19586
19340 jQuery.fn.extend( { 19341 has: function( target ) { 19342 var targets = jQuery( target, this ), 19343 l = targets.length; 19344 19345 return this.filter( function() { 19346 var i = 0; 19347 for ( ; i < l; i++ ) { 19348 if ( jQuery.contains( this, targets[ i ] ) ) { 19349 return true; 19350 } 19351 } 19352 } ); 19353 }, 19354 19355 closest: function( selectors, context ) { 19356 var cur, 19357 i = 0, 19358 l = this.length, 19359 matched = [], 19360 targets = typeof selectors !== "string" && jQuery( selectors ); 19361 19362 // Positional selectors never match, since there's no _selection_ context 19363 if ( !rneedsContext.test( selectors ) ) { 19364 for ( ; i < l; i++ ) { 19365 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 19366 19367 // Always skip document fragments 19368 if ( cur.nodeType < 11 && ( targets ? 19369 targets.index( cur ) > -1 : 19370 19371 // Don't pass non-elements to Sizzle 19372 cur.nodeType === 1 && 19373 jQuery.find.matchesSelector( cur, selectors ) ) ) { 19374 19375 matched.push( cur ); 19376 break; 19377 } 19378 } 19379 } 19380 } 19381 19382 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 19383 }, 19384 19385 // Determine the position of an element within the set 19386 index: function( elem ) { 19387 19388 // No argument, return index in parent 19389 if ( !elem ) { 19390 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 19391 } 19392 19393 // Index in selector 19394 if ( typeof elem === "string" ) { 19395 return indexOf.call( jQuery( elem ), this[ 0 ] ); 19396 } 19397 19398 // Locate the position of the desired element 19399 return indexOf.call( this, 19400 19401 // If it receives a jQuery object, the first element is used 19402 elem.jquery ? elem[ 0 ] : elem 19403 ); 19404 }, 19405 19406 add: function( selector, context ) { 19407 return this.pushStack( 19408 jQuery.uniqueSort( 19409 jQuery.merge( this.get(), jQuery( selector, context ) ) 19410 ) 19411 ); 19412 }, 19413 19414 addBack: function( selector ) { 19415 return this.add( selector == null ? 19416 this.prevObject : this.prevObject.filter( selector ) 19417 ); 19418 } 19419 } ); 19420 19421 function sibling( cur, dir ) { 19422 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 19423 return cur; 19424 } 19425 19426 jQuery.each( { 19427 parent: function( elem ) { 19428 var parent = elem.parentNode; 19429 return parent && parent.nodeType !== 11 ? parent : null; 19430 }, 19431 parents: function( elem ) { 19432 return dir( elem, "parentNode" ); 19433 }, 19434 parentsUntil: function( elem, i, until ) { 19435 return dir( elem, "parentNode", until ); 19436 }, 19437 next: function( elem ) { 19438 return sibling( elem, "nextSibling" ); 19439 }, 19440 prev: function( elem ) { 19441 return sibling( elem, "previousSibling" ); 19442 }, 19443 nextAll: function( elem ) { 19444 return dir( elem, "nextSibling" ); 19445 }, 19446 prevAll: function( elem ) { 19447 return dir( elem, "previousSibling" ); 19448 }, 19449 nextUntil: function( elem, i, until ) { 19450 return dir( elem, "nextSibling", until ); 19451 }, 19452 prevUntil: function( elem, i, until ) { 19453 return dir( elem, "previousSibling", until ); 19454 }, 19455 siblings: function( elem ) { 19456 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 19457 }, 19458 children: function( elem ) { 19459 return siblings( elem.firstChild ); 19460 }, 19461 contents: function( elem ) { 19462 if ( nodeName( elem, "iframe" ) ) { 19463 return elem.contentDocument; 19464 } 19465 19466 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 19467 // Treat the template element as a regular one in browsers that 19468 // don't support it. 19469 if ( nodeName( elem, "template" ) ) { 19470 elem = elem.content || elem; 19471 } 19472 19473 return jQuery.merge( [], elem.childNodes ); 19474 } 19475 }, function( name, fn ) { 19476 jQuery.fn[ name ] = function( until, selector ) { 19477 var matched = jQuery.map( this, fn, until ); 19478 19479 if ( name.slice( -5 ) !== "Until" ) { 19480 selector = until; 19481 } 19482 19483 if ( selector && typeof selector === "string" ) { 19484 matched = jQuery.filter( selector, matched ); 19485 } 19486 19487 if ( this.length > 1 ) { 19488 19489 // Remove duplicates 19490 if ( !guaranteedUnique[ name ] ) { 19491 jQuery.uniqueSort( matched ); 19492 } 19493 19494 // Reverse order for parents* and prev-derivatives 19495 if ( rparentsprev.test( name ) ) { 19496 matched.reverse(); 19497 } 19498 } 19499 19500 return this.pushStack( matched ); 19501 }; 19502 } ); 19503 var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 19504 19505 19506 19507 // Convert String-formatted options into Object-formatted ones 19508 function createOptions( options ) { 19509 var object = {}; 19510 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 19511 object[ flag ] = true; 19512 } ); 19513 return object; 19514 } 19515 19516 /* 19517 * Create a callback list using the following parameters: 19518 * 19519 * options: an optional list of space-separated options that will change how 19520 * the callback list behaves or a more traditional option object 19521 * 19522 * By default a callback list will act like an event callback list and can be 19523 * "fired" multiple times. 19524 * 19525 * Possible options: 19526 * 19527 * once: will ensure the callback list can only be fired once (like a Deferred) 19528 * 19529 * memory: will keep track of previous values and will call any callback added 19530 * after the list has been fired right away with the latest "memorized" 19531 * values (like a Deferred) 19532 * 19533 * unique: will ensure a callback can only be added once (no duplicate in the list) 19534 * 19535 * stopOnFalse: interrupt callings when a callback returns false 19536 * 19537 */ 19538 jQuery.Callbacks = function( options ) { 19539 19540 // Convert options from String-formatted to Object-formatted if needed 19541 // (we check in cache first) 19542 options = typeof options === "string" ? 19543 createOptions( options ) : 19544 jQuery.extend( {}, options ); 19545 19546 var // Flag to know if list is currently firing 19547 firing, 19548 19549 // Last fire value for non-forgettable lists 19550 memory, 19551 19552 // Flag to know if list was already fired 19553 fired, 19554 19555 // Flag to prevent firing 19556 locked, 19557 19558 // Actual callback list 19559 list = [], 19560 19561 // Queue of execution data for repeatable lists 19562 queue = [], 19563 19564 // Index of currently firing callback (modified by add/remove as needed) 19565 firingIndex = -1, 19566 19567 // Fire callbacks 19568 fire = function() { 19569 19570 // Enforce single-firing 19571 locked = locked || options.once; 19572 19573 // Execute callbacks for all pending executions, 19574 // respecting firingIndex overrides and runtime changes 19575 fired = firing = true; 19576 for ( ; queue.length; firingIndex = -1 ) { 19577 memory = queue.shift(); 19578 while ( ++firingIndex < list.length ) { 19579 19580 // Run callback and check for early termination 19581 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 19582 options.stopOnFalse ) { 19583 19584 // Jump to end and forget the data so .add doesn't re-fire 19585 firingIndex = list.length; 19586 memory = false;
vendor: 4,217 bytes, lines 19587-19766
19587 } 19588 } 19589 } 19590 19591 // Forget the data if we're done with it 19592 if ( !options.memory ) { 19593 memory = false; 19594 } 19595 19596 firing = false; 19597 19598 // Clean up if we're done firing for good 19599 if ( locked ) { 19600 19601 // Keep an empty list if we have data for future add calls 19602 if ( memory ) { 19603 list = []; 19604 19605 // Otherwise, this object is spent 19606 } else { 19607 list = ""; 19608 } 19609 } 19610 }, 19611 19612 // Actual Callbacks object 19613 self = { 19614 19615 // Add a callback or a collection of callbacks to the list 19616 add: function() { 19617 if ( list ) { 19618 19619 // If we have memory from a past run, we should fire after adding 19620 if ( memory && !firing ) { 19621 firingIndex = list.length - 1; 19622 queue.push( memory ); 19623 } 19624 19625 ( function add( args ) { 19626 jQuery.each( args, function( _, arg ) { 19627 if ( jQuery.isFunction( arg ) ) { 19628 if ( !options.unique || !self.has( arg ) ) { 19629 list.push( arg ); 19630 } 19631 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { 19632 19633 // Inspect recursively 19634 add( arg ); 19635 } 19636 } ); 19637 } )( arguments ); 19638 19639 if ( memory && !firing ) { 19640 fire(); 19641 } 19642 } 19643 return this; 19644 }, 19645 19646 // Remove a callback from the list 19647 remove: function() { 19648 jQuery.each( arguments, function( _, arg ) { 19649 var index; 19650 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 19651 list.splice( index, 1 ); 19652 19653 // Handle firing indexes 19654 if ( index <= firingIndex ) { 19655 firingIndex--; 19656 } 19657 } 19658 } ); 19659 return this; 19660 }, 19661 19662 // Check if a given callback is in the list. 19663 // If no argument is given, return whether or not list has callbacks attached. 19664 has: function( fn ) { 19665 return fn ? 19666 jQuery.inArray( fn, list ) > -1 : 19667 list.length > 0; 19668 }, 19669 19670 // Remove all callbacks from the list 19671 empty: function() { 19672 if ( list ) { 19673 list = []; 19674 } 19675 return this; 19676 }, 19677 19678 // Disable .fire and .add 19679 // Abort any current/pending executions 19680 // Clear all callbacks and values 19681 disable: function() { 19682 locked = queue = []; 19683 list = memory = ""; 19684 return this; 19685 }, 19686 disabled: function() { 19687 return !list; 19688 }, 19689 19690 // Disable .fire 19691 // Also disable .add unless we have memory (since it would have no effect) 19692 // Abort any pending executions 19693 lock: function() { 19694 locked = queue = []; 19695 if ( !memory && !firing ) { 19696 list = memory = ""; 19697 } 19698 return this; 19699 }, 19700 locked: function() { 19701 return !!locked; 19702 }, 19703 19704 // Call all callbacks with the given context and arguments 19705 fireWith: function( context, args ) { 19706 if ( !locked ) { 19707 args = args || []; 19708 args = [ context, args.slice ? args.slice() : args ]; 19709 queue.push( args ); 19710 if ( !firing ) { 19711 fire(); 19712 } 19713 } 19714 return this; 19715 }, 19716 19717 // Call all the callbacks with the given arguments 19718 fire: function() { 19719 self.fireWith( this, arguments ); 19720 return this; 19721 }, 19722 19723 // To know if the callbacks have already been called at least once 19724 fired: function() { 19725 return !!fired; 19726 } 19727 }; 19728 19729 return self; 19730 }; 19731 19732 19733 function Identity( v ) { 19734 return v; 19735 } 19736 function Thrower( ex ) { 19737 throw ex; 19738 } 19739 19740 function adoptValue( value, resolve, reject, noValue ) { 19741 var method; 19742 19743 try { 19744 19745 // Check for promise aspect first to privilege synchronous behavior 19746 if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { 19747 method.call( value ).done( resolve ).fail( reject ); 19748 19749 // Other thenables 19750 } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { 19751 method.call( value, resolve, reject ); 19752 19753 // Other non-thenables 19754 } else { 19755 19756 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 19757 // * false: [ value ].slice( 0 ) => resolve( value ) 19758 // * true: [ value ].slice( 1 ) => resolve() 19759 resolve.apply( undefined, [ value ].slice( noValue ) ); 19760 } 19761 19762 // For Promises/A+, convert exceptions into rejections 19763 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 19764 // Deferred#then to conditionally suppress rejection. 19765 } catch ( value ) { 19766
vendor: 5,037 bytes, lines 19767-19922
19767 // Support: Android 4.0 only 19768 // Strict mode functions invoked without .call/.apply get global-object context 19769 reject.apply( undefined, [ value ] ); 19770 } 19771 } 19772 19773 jQuery.extend( { 19774 19775 Deferred: function( func ) { 19776 var tuples = [ 19777 19778 // action, add listener, callbacks, 19779 // ... .then handlers, argument index, [final state] 19780 [ "notify", "progress", jQuery.Callbacks( "memory" ), 19781 jQuery.Callbacks( "memory" ), 2 ], 19782 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 19783 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 19784 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 19785 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 19786 ], 19787 state = "pending", 19788 promise = { 19789 state: function() { 19790 return state; 19791 }, 19792 always: function() { 19793 deferred.done( arguments ).fail( arguments ); 19794 return this; 19795 }, 19796 "catch": function( fn ) { 19797 return promise.then( null, fn ); 19798 }, 19799 19800 // Keep pipe for back-compat 19801 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 19802 var fns = arguments; 19803 19804 return jQuery.Deferred( function( newDefer ) { 19805 jQuery.each( tuples, function( i, tuple ) { 19806 19807 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 19808 var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 19809 19810 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 19811 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 19812 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 19813 deferred[ tuple[ 1 ] ]( function() { 19814 var returned = fn && fn.apply( this, arguments ); 19815 if ( returned && jQuery.isFunction( returned.promise ) ) { 19816 returned.promise() 19817 .progress( newDefer.notify ) 19818 .done( newDefer.resolve ) 19819 .fail( newDefer.reject ); 19820 } else { 19821 newDefer[ tuple[ 0 ] + "With" ]( 19822 this, 19823 fn ? [ returned ] : arguments 19824 ); 19825 } 19826 } ); 19827 } ); 19828 fns = null; 19829 } ).promise(); 19830 }, 19831 then: function( onFulfilled, onRejected, onProgress ) { 19832 var maxDepth = 0; 19833 function resolve( depth, deferred, handler, special ) { 19834 return function() { 19835 var that = this, 19836 args = arguments, 19837 mightThrow = function() { 19838 var returned, then; 19839 19840 // Support: Promises/A+ section 2.3.3.3.3 19841 // https://promisesaplus.com/#point-59 19842 // Ignore double-resolution attempts 19843 if ( depth < maxDepth ) { 19844 return; 19845 } 19846 19847 returned = handler.apply( that, args ); 19848 19849 // Support: Promises/A+ section 2.3.1 19850 // https://promisesaplus.com/#point-48 19851 if ( returned === deferred.promise() ) { 19852 throw new TypeError( "Thenable self-resolution" ); 19853 } 19854 19855 // Support: Promises/A+ sections 2.3.3.1, 3.5 19856 // https://promisesaplus.com/#point-54 19857 // https://promisesaplus.com/#point-75 19858 // Retrieve `then` only once 19859 then = returned && 19860 19861 // Support: Promises/A+ section 2.3.4 19862 // https://promisesaplus.com/#point-64 19863 // Only check objects and functions for thenability 19864 ( typeof returned === "object" || 19865 typeof returned === "function" ) && 19866 returned.then; 19867 19868 // Handle a returned thenable 19869 if ( jQuery.isFunction( then ) ) { 19870 19871 // Special processors (notify) just wait for resolution 19872 if ( special ) { 19873 then.call( 19874 returned, 19875 resolve( maxDepth, deferred, Identity, special ), 19876 resolve( maxDepth, deferred, Thrower, special ) 19877 ); 19878 19879 // Normal processors (resolve) also hook into progress 19880 } else { 19881 19882 // ...and disregard older resolution values 19883 maxDepth++; 19884 19885 then.call( 19886 returned, 19887 resolve( maxDepth, deferred, Identity, special ), 19888 resolve( maxDepth, deferred, Thrower, special ), 19889 resolve( maxDepth, deferred, Identity, 19890 deferred.notifyWith ) 19891 ); 19892 } 19893 19894 // Handle all other returned values 19895 } else { 19896 19897 // Only substitute handlers pass on context 19898 // and multiple values (non-spec behavior) 19899 if ( handler !== Identity ) { 19900 that = undefined; 19901 args = [ returned ]; 19902 } 19903 19904 // Process the value(s) 19905 // Default process is resolve 19906 ( special || deferred.resolveWith )( that, args ); 19907 } 19908 }, 19909 19910 // Only normal processors (resolve) catch and reject exceptions 19911 process = special ? 19912 mightThrow : 19913 function() { 19914 try { 19915 mightThrow(); 19916 } catch ( e ) { 19917 19918 if ( jQuery.Deferred.exceptionHook ) { 19919 jQuery.Deferred.exceptionHook( e, 19920 process.stackTrace ); 19921 } 19922
vendor: 4,281 bytes, lines 19923-20086
19923 // Support: Promises/A+ section 2.3.3.3.4.1 19924 // https://promisesaplus.com/#point-61 19925 // Ignore post-resolution exceptions 19926 if ( depth + 1 >= maxDepth ) { 19927 19928 // Only substitute handlers pass on context 19929 // and multiple values (non-spec behavior) 19930 if ( handler !== Thrower ) { 19931 that = undefined; 19932 args = [ e ]; 19933 } 19934 19935 deferred.rejectWith( that, args ); 19936 } 19937 } 19938 }; 19939 19940 // Support: Promises/A+ section 2.3.3.3.1 19941 // https://promisesaplus.com/#point-57 19942 // Re-resolve promises immediately to dodge false rejection from 19943 // subsequent errors 19944 if ( depth ) { 19945 process(); 19946 } else { 19947 19948 // Call an optional hook to record the stack, in case of exception 19949 // since it's otherwise lost when execution goes async 19950 if ( jQuery.Deferred.getStackHook ) { 19951 process.stackTrace = jQuery.Deferred.getStackHook(); 19952 } 19953 window.setTimeout( process ); 19954 } 19955 }; 19956 } 19957 19958 return jQuery.Deferred( function( newDefer ) { 19959 19960 // progress_handlers.add( ... ) 19961 tuples[ 0 ][ 3 ].add( 19962 resolve( 19963 0, 19964 newDefer, 19965 jQuery.isFunction( onProgress ) ? 19966 onProgress : 19967 Identity, 19968 newDefer.notifyWith 19969 ) 19970 ); 19971 19972 // fulfilled_handlers.add( ... ) 19973 tuples[ 1 ][ 3 ].add( 19974 resolve( 19975 0, 19976 newDefer, 19977 jQuery.isFunction( onFulfilled ) ? 19978 onFulfilled : 19979 Identity 19980 ) 19981 ); 19982 19983 // rejected_handlers.add( ... ) 19984 tuples[ 2 ][ 3 ].add( 19985 resolve( 19986 0, 19987 newDefer, 19988 jQuery.isFunction( onRejected ) ? 19989 onRejected : 19990 Thrower 19991 ) 19992 ); 19993 } ).promise(); 19994 }, 19995 19996 // Get a promise for this deferred 19997 // If obj is provided, the promise aspect is added to the object 19998 promise: function( obj ) { 19999 return obj != null ? jQuery.extend( obj, promise ) : promise; 20000 } 20001 }, 20002 deferred = {}; 20003 20004 // Add list-specific methods 20005 jQuery.each( tuples, function( i, tuple ) { 20006 var list = tuple[ 2 ], 20007 stateString = tuple[ 5 ]; 20008 20009 // promise.progress = list.add 20010 // promise.done = list.add 20011 // promise.fail = list.add 20012 promise[ tuple[ 1 ] ] = list.add; 20013 20014 // Handle state 20015 if ( stateString ) { 20016 list.add( 20017 function() { 20018 20019 // state = "resolved" (i.e., fulfilled) 20020 // state = "rejected" 20021 state = stateString; 20022 }, 20023 20024 // rejected_callbacks.disable 20025 // fulfilled_callbacks.disable 20026 tuples[ 3 - i ][ 2 ].disable, 20027 20028 // progress_callbacks.lock 20029 tuples[ 0 ][ 2 ].lock 20030 ); 20031 } 20032 20033 // progress_handlers.fire 20034 // fulfilled_handlers.fire 20035 // rejected_handlers.fire 20036 list.add( tuple[ 3 ].fire ); 20037 20038 // deferred.notify = function() { deferred.notifyWith(...) } 20039 // deferred.resolve = function() { deferred.resolveWith(...) } 20040 // deferred.reject = function() { deferred.rejectWith(...) } 20041 deferred[ tuple[ 0 ] ] = function() { 20042 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 20043 return this; 20044 }; 20045 20046 // deferred.notifyWith = list.fireWith 20047 // deferred.resolveWith = list.fireWith 20048 // deferred.rejectWith = list.fireWith 20049 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 20050 } ); 20051 20052 // Make the deferred a promise 20053 promise.promise( deferred ); 20054 20055 // Call given func if any 20056 if ( func ) { 20057 func.call( deferred, deferred ); 20058 } 20059 20060 // All done! 20061 return deferred; 20062 }, 20063 20064 // Deferred helper 20065 when: function( singleValue ) { 20066 var 20067 20068 // count of uncompleted subordinates 20069 remaining = arguments.length, 20070 20071 // count of unprocessed arguments 20072 i = remaining, 20073 20074 // subordinate fulfillment data 20075 resolveContexts = Array( i ), 20076 resolveValues = slice.call( arguments ), 20077 20078 // the master Deferred 20079 master = jQuery.Deferred(), 20080 20081 // subordinate callback factory 20082 updateFunc = function( i ) { 20083 return function( value ) { 20084 resolveContexts[ i ] = this; 20085 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 20086 if ( !( --remaining ) ) {
vendor: 2,946 bytes, lines 20087-20200
20087 master.resolveWith( resolveContexts, resolveValues ); 20088 } 20089 }; 20090 }; 20091 20092 // Single- and empty arguments are adopted like Promise.resolve 20093 if ( remaining <= 1 ) { 20094 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 20095 !remaining ); 20096 20097 // Use .then() to unwrap secondary thenables (cf. gh-3000) 20098 if ( master.state() === "pending" || 20099 jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 20100 20101 return master.then(); 20102 } 20103 } 20104 20105 // Multiple arguments are aggregated like Promise.all array elements 20106 while ( i-- ) { 20107 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 20108 } 20109 20110 return master.promise(); 20111 } 20112 } ); 20113 20114 20115 // These usually indicate a programmer mistake during development, 20116 // warn about them ASAP rather than swallowing them by default. 20117 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 20118 20119 jQuery.Deferred.exceptionHook = function( error, stack ) { 20120 20121 // Support: IE 8 - 9 only 20122 // Console exists when dev tools are open, which can happen at any time 20123 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 20124 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 20125 } 20126 }; 20127 20128 20129 20130 20131 jQuery.readyException = function( error ) { 20132 window.setTimeout( function() { 20133 throw error; 20134 } ); 20135 }; 20136 20137 20138 20139 20140 // The deferred used on DOM ready 20141 var readyList = jQuery.Deferred(); 20142 20143 jQuery.fn.ready = function( fn ) { 20144 20145 readyList 20146 .then( fn ) 20147 20148 // Wrap jQuery.readyException in a function so that the lookup 20149 // happens at the time of error handling instead of callback 20150 // registration. 20151 .catch( function( error ) { 20152 jQuery.readyException( error ); 20153 } ); 20154 20155 return this; 20156 }; 20157 20158 jQuery.extend( { 20159 20160 // Is the DOM ready to be used? Set to true once it occurs. 20161 isReady: false, 20162 20163 // A counter to track how many items to wait for before 20164 // the ready event fires. See #6781 20165 readyWait: 1, 20166 20167 // Handle when the DOM is ready 20168 ready: function( wait ) { 20169 20170 // Abort if there are pending holds or we're already ready 20171 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 20172 return; 20173 } 20174 20175 // Remember that the DOM is ready 20176 jQuery.isReady = true; 20177 20178 // If a normal DOM Ready event fired, decrement, and wait if need be 20179 if ( wait !== true && --jQuery.readyWait > 0 ) { 20180 return; 20181 } 20182 20183 // If there are functions bound, to execute 20184 readyList.resolveWith( document, [ jQuery ] ); 20185 } 20186 } ); 20187 20188 jQuery.ready.then = readyList.then; 20189 20190 // The ready event handler and self cleanup method 20191 function completed() { 20192 document.removeEventListener( "DOMContentLoaded", completed ); 20193 window.removeEventListener( "load", completed ); 20194 jQuery.ready(); 20195 } 20196 20197 // Catch cases where $(document).ready() is called 20198 // after the browser event has already occurred. 20199 // Support: IE <=9 - 10 only 20200 // Older IE sometimes signals "interactive" too soon
vendor: 4,339 bytes, lines 20201-20386
20201 if ( document.readyState === "complete" || 20202 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 20203 20204 // Handle it asynchronously to allow scripts the opportunity to delay ready 20205 window.setTimeout( jQuery.ready ); 20206 20207 } else { 20208 20209 // Use the handy event callback 20210 document.addEventListener( "DOMContentLoaded", completed ); 20211 20212 // A fallback to window.onload, that will always work 20213 window.addEventListener( "load", completed ); 20214 } 20215 20216 20217 20218 20219 // Multifunctional method to get and set values of a collection 20220 // The value/s can optionally be executed if it's a function 20221 var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 20222 var i = 0, 20223 len = elems.length, 20224 bulk = key == null; 20225 20226 // Sets many values 20227 if ( jQuery.type( key ) === "object" ) { 20228 chainable = true; 20229 for ( i in key ) { 20230 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 20231 } 20232 20233 // Sets one value 20234 } else if ( value !== undefined ) { 20235 chainable = true; 20236 20237 if ( !jQuery.isFunction( value ) ) { 20238 raw = true; 20239 } 20240 20241 if ( bulk ) { 20242 20243 // Bulk operations run against the entire set 20244 if ( raw ) { 20245 fn.call( elems, value ); 20246 fn = null; 20247 20248 // ...except when executing function values 20249 } else { 20250 bulk = fn; 20251 fn = function( elem, key, value ) { 20252 return bulk.call( jQuery( elem ), value ); 20253 }; 20254 } 20255 } 20256 20257 if ( fn ) { 20258 for ( ; i < len; i++ ) { 20259 fn( 20260 elems[ i ], key, raw ? 20261 value : 20262 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 20263 ); 20264 } 20265 } 20266 } 20267 20268 if ( chainable ) { 20269 return elems; 20270 } 20271 20272 // Gets 20273 if ( bulk ) { 20274 return fn.call( elems ); 20275 } 20276 20277 return len ? fn( elems[ 0 ], key ) : emptyGet; 20278 }; 20279 var acceptData = function( owner ) { 20280 20281 // Accepts only: 20282 // - Node 20283 // - Node.ELEMENT_NODE 20284 // - Node.DOCUMENT_NODE 20285 // - Object 20286 // - Any 20287 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 20288 }; 20289 20290 20291 20292 20293 function Data() { 20294 this.expando = jQuery.expando + Data.uid++; 20295 } 20296 20297 Data.uid = 1; 20298 20299 Data.prototype = { 20300 20301 cache: function( owner ) { 20302 20303 // Check if the owner object already has a cache 20304 var value = owner[ this.expando ]; 20305 20306 // If not, create one 20307 if ( !value ) { 20308 value = {}; 20309 20310 // We can accept data for non-element nodes in modern browsers, 20311 // but we should not, see #8335. 20312 // Always return an empty object. 20313 if ( acceptData( owner ) ) { 20314 20315 // If it is a node unlikely to be stringify-ed or looped over 20316 // use plain assignment 20317 if ( owner.nodeType ) { 20318 owner[ this.expando ] = value; 20319 20320 // Otherwise secure it in a non-enumerable property 20321 // configurable must be true to allow the property to be 20322 // deleted when data is removed 20323 } else { 20324 Object.defineProperty( owner, this.expando, { 20325 value: value, 20326 configurable: true 20327 } ); 20328 } 20329 } 20330 } 20331 20332 return value; 20333 }, 20334 set: function( owner, data, value ) { 20335 var prop, 20336 cache = this.cache( owner ); 20337 20338 // Handle: [ owner, key, value ] args 20339 // Always use camelCase key (gh-2257) 20340 if ( typeof data === "string" ) { 20341 cache[ jQuery.camelCase( data ) ] = value; 20342 20343 // Handle: [ owner, { properties } ] args 20344 } else { 20345 20346 // Copy the properties one-by-one to the cache object 20347 for ( prop in data ) { 20348 cache[ jQuery.camelCase( prop ) ] = data[ prop ]; 20349 } 20350 } 20351 return cache; 20352 }, 20353 get: function( owner, key ) { 20354 return key === undefined ? 20355 this.cache( owner ) : 20356 20357 // Always use camelCase key (gh-2257) 20358 owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; 20359 }, 20360 access: function( owner, key, value ) { 20361 20362 // In cases where either: 20363 // 20364 // 1. No key was specified 20365 // 2. A string key was specified, but no value provided 20366 // 20367 // Take the "read" path and allow the get method to determine 20368 // which value to return, respectively either: 20369 // 20370 // 1. The entire cache object 20371 // 2. The data stored at the key 20372 // 20373 if ( key === undefined || 20374 ( ( key && typeof key === "string" ) && value === undefined ) ) { 20375 20376 return this.get( owner, key ); 20377 } 20378 20379 // When the key is not a string, or both a key and value 20380 // are specified, set or extend (existing objects) with either: 20381 // 20382 // 1. An object of properties 20383 // 2. A key and value 20384 // 20385 this.set( owner, key, value ); 20386
vendor: 4,096 bytes, lines 20387-20548
20387 // Since the "set" path can have two possible entry points 20388 // return the expected data based on which path was taken[*] 20389 return value !== undefined ? value : key; 20390 }, 20391 remove: function( owner, key ) { 20392 var i, 20393 cache = owner[ this.expando ]; 20394 20395 if ( cache === undefined ) { 20396 return; 20397 } 20398 20399 if ( key !== undefined ) { 20400 20401 // Support array or space separated string of keys 20402 if ( Array.isArray( key ) ) { 20403 20404 // If key is an array of keys... 20405 // We always set camelCase keys, so remove that. 20406 key = key.map( jQuery.camelCase ); 20407 } else { 20408 key = jQuery.camelCase( key ); 20409 20410 // If a key with the spaces exists, use it. 20411 // Otherwise, create an array by matching non-whitespace 20412 key = key in cache ? 20413 [ key ] : 20414 ( key.match( rnothtmlwhite ) || [] ); 20415 } 20416 20417 i = key.length; 20418 20419 while ( i-- ) { 20420 delete cache[ key[ i ] ]; 20421 } 20422 } 20423 20424 // Remove the expando if there's no more data 20425 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 20426 20427 // Support: Chrome <=35 - 45 20428 // Webkit & Blink performance suffers when deleting properties 20429 // from DOM nodes, so set to undefined instead 20430 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 20431 if ( owner.nodeType ) { 20432 owner[ this.expando ] = undefined; 20433 } else { 20434 delete owner[ this.expando ]; 20435 } 20436 } 20437 }, 20438 hasData: function( owner ) { 20439 var cache = owner[ this.expando ]; 20440 return cache !== undefined && !jQuery.isEmptyObject( cache ); 20441 } 20442 }; 20443 var dataPriv = new Data(); 20444 20445 var dataUser = new Data(); 20446 20447 20448 20449 // Implementation Summary 20450 // 20451 // 1. Enforce API surface and semantic compatibility with 1.9.x branch 20452 // 2. Improve the module's maintainability by reducing the storage 20453 // paths to a single mechanism. 20454 // 3. Use the same single mechanism to support "private" and "user" data. 20455 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 20456 // 5. Avoid exposing implementation details on user objects (eg. expando properties) 20457 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 20458 20459 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 20460 rmultiDash = /[A-Z]/g; 20461 20462 function getData( data ) { 20463 if ( data === "true" ) { 20464 return true; 20465 } 20466 20467 if ( data === "false" ) { 20468 return false; 20469 } 20470 20471 if ( data === "null" ) { 20472 return null; 20473 } 20474 20475 // Only convert to a number if it doesn't change the string 20476 if ( data === +data + "" ) { 20477 return +data; 20478 } 20479 20480 if ( rbrace.test( data ) ) { 20481 return JSON.parse( data ); 20482 } 20483 20484 return data; 20485 } 20486 20487 function dataAttr( elem, key, data ) { 20488 var name; 20489 20490 // If nothing was found internally, try to fetch any 20491 // data from the HTML5 data-* attribute 20492 if ( data === undefined && elem.nodeType === 1 ) { 20493 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 20494 data = elem.getAttribute( name ); 20495 20496 if ( typeof data === "string" ) { 20497 try { 20498 data = getData( data ); 20499 } catch ( e ) {} 20500 20501 // Make sure we set the data so it isn't changed later 20502 dataUser.set( elem, key, data ); 20503 } else { 20504 data = undefined; 20505 } 20506 } 20507 return data; 20508 } 20509 20510 jQuery.extend( { 20511 hasData: function( elem ) { 20512 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 20513 }, 20514 20515 data: function( elem, name, data ) { 20516 return dataUser.access( elem, name, data ); 20517 }, 20518 20519 removeData: function( elem, name ) { 20520 dataUser.remove( elem, name ); 20521 }, 20522 20523 // TODO: Now that all calls to _data and _removeData have been replaced 20524 // with direct calls to dataPriv methods, these can be deprecated. 20525 _data: function( elem, name, data ) { 20526 return dataPriv.access( elem, name, data ); 20527 }, 20528 20529 _removeData: function( elem, name ) { 20530 dataPriv.remove( elem, name ); 20531 } 20532 } ); 20533 20534 jQuery.fn.extend( { 20535 data: function( key, value ) { 20536 var i, name, data, 20537 elem = this[ 0 ], 20538 attrs = elem && elem.attributes; 20539 20540 // Gets all values 20541 if ( key === undefined ) { 20542 if ( this.length ) { 20543 data = dataUser.get( elem ); 20544 20545 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 20546 i = attrs.length; 20547 while ( i-- ) { 20548
vendor: 8,321 bytes, lines 20549-20884
20549 // Support: IE 11 only 20550 // The attrs elements can be null (#14894) 20551 if ( attrs[ i ] ) { 20552 name = attrs[ i ].name; 20553 if ( name.indexOf( "data-" ) === 0 ) { 20554 name = jQuery.camelCase( name.slice( 5 ) ); 20555 dataAttr( elem, name, data[ name ] ); 20556 } 20557 } 20558 } 20559 dataPriv.set( elem, "hasDataAttrs", true ); 20560 } 20561 } 20562 20563 return data; 20564 } 20565 20566 // Sets multiple values 20567 if ( typeof key === "object" ) { 20568 return this.each( function() { 20569 dataUser.set( this, key ); 20570 } ); 20571 } 20572 20573 return access( this, function( value ) { 20574 var data; 20575 20576 // The calling jQuery object (element matches) is not empty 20577 // (and therefore has an element appears at this[ 0 ]) and the 20578 // `value` parameter was not undefined. An empty jQuery object 20579 // will result in `undefined` for elem = this[ 0 ] which will 20580 // throw an exception if an attempt to read a data cache is made. 20581 if ( elem && value === undefined ) { 20582 20583 // Attempt to get data from the cache 20584 // The key will always be camelCased in Data 20585 data = dataUser.get( elem, key ); 20586 if ( data !== undefined ) { 20587 return data; 20588 } 20589 20590 // Attempt to "discover" the data in 20591 // HTML5 custom data-* attrs 20592 data = dataAttr( elem, key ); 20593 if ( data !== undefined ) { 20594 return data; 20595 } 20596 20597 // We tried really hard, but the data doesn't exist. 20598 return; 20599 } 20600 20601 // Set the data... 20602 this.each( function() { 20603 20604 // We always store the camelCased key 20605 dataUser.set( this, key, value ); 20606 } ); 20607 }, null, value, arguments.length > 1, null, true ); 20608 }, 20609 20610 removeData: function( key ) { 20611 return this.each( function() { 20612 dataUser.remove( this, key ); 20613 } ); 20614 } 20615 } ); 20616 20617 20618 jQuery.extend( { 20619 queue: function( elem, type, data ) { 20620 var queue; 20621 20622 if ( elem ) { 20623 type = ( type || "fx" ) + "queue"; 20624 queue = dataPriv.get( elem, type ); 20625 20626 // Speed up dequeue by getting out quickly if this is just a lookup 20627 if ( data ) { 20628 if ( !queue || Array.isArray( data ) ) { 20629 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 20630 } else { 20631 queue.push( data ); 20632 } 20633 } 20634 return queue || []; 20635 } 20636 }, 20637 20638 dequeue: function( elem, type ) { 20639 type = type || "fx"; 20640 20641 var queue = jQuery.queue( elem, type ), 20642 startLength = queue.length, 20643 fn = queue.shift(), 20644 hooks = jQuery._queueHooks( elem, type ), 20645 next = function() { 20646 jQuery.dequeue( elem, type ); 20647 }; 20648 20649 // If the fx queue is dequeued, always remove the progress sentinel 20650 if ( fn === "inprogress" ) { 20651 fn = queue.shift(); 20652 startLength--; 20653 } 20654 20655 if ( fn ) { 20656 20657 // Add a progress sentinel to prevent the fx queue from being 20658 // automatically dequeued 20659 if ( type === "fx" ) { 20660 queue.unshift( "inprogress" ); 20661 } 20662 20663 // Clear up the last queue stop function 20664 delete hooks.stop; 20665 fn.call( elem, next, hooks ); 20666 } 20667 20668 if ( !startLength && hooks ) { 20669 hooks.empty.fire(); 20670 } 20671 }, 20672 20673 // Not public - generate a queueHooks object, or return the current one 20674 _queueHooks: function( elem, type ) { 20675 var key = type + "queueHooks"; 20676 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 20677 empty: jQuery.Callbacks( "once memory" ).add( function() { 20678 dataPriv.remove( elem, [ type + "queue", key ] ); 20679 } ) 20680 } ); 20681 } 20682 } ); 20683 20684 jQuery.fn.extend( { 20685 queue: function( type, data ) { 20686 var setter = 2; 20687 20688 if ( typeof type !== "string" ) { 20689 data = type; 20690 type = "fx"; 20691 setter--; 20692 } 20693 20694 if ( arguments.length < setter ) { 20695 return jQuery.queue( this[ 0 ], type ); 20696 } 20697 20698 return data === undefined ? 20699 this : 20700 this.each( function() { 20701 var queue = jQuery.queue( this, type, data ); 20702 20703 // Ensure a hooks for this queue 20704 jQuery._queueHooks( this, type ); 20705 20706 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 20707 jQuery.dequeue( this, type ); 20708 } 20709 } ); 20710 }, 20711 dequeue: function( type ) { 20712 return this.each( function() { 20713 jQuery.dequeue( this, type ); 20714 } ); 20715 }, 20716 clearQueue: function( type ) { 20717 return this.queue( type || "fx", [] ); 20718 }, 20719 20720 // Get a promise resolved when queues of a certain type 20721 // are emptied (fx is the type by default) 20722 promise: function( type, obj ) { 20723 var tmp, 20724 count = 1, 20725 defer = jQuery.Deferred(), 20726 elements = this, 20727 i = this.length, 20728 resolve = function() { 20729 if ( !( --count ) ) { 20730 defer.resolveWith( elements, [ elements ] ); 20731 } 20732 }; 20733 20734 if ( typeof type !== "string" ) { 20735 obj = type; 20736 type = undefined; 20737 } 20738 type = type || "fx"; 20739 20740 while ( i-- ) { 20741 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 20742 if ( tmp && tmp.empty ) { 20743 count++; 20744 tmp.empty.add( resolve ); 20745 } 20746 } 20747 resolve(); 20748 return defer.promise( obj ); 20749 } 20750 } ); 20751 var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 20752 20753 var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 20754 20755 20756 var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 20757 20758 var isHiddenWithinTree = function( elem, el ) { 20759 20760 // isHiddenWithinTree might be called from jQuery#filter function; 20761 // in that case, element will be second argument 20762 elem = el || elem; 20763 20764 // Inline style trumps all 20765 return elem.style.display === "none" || 20766 elem.style.display === "" && 20767 20768 // Otherwise, check computed style 20769 // Support: Firefox <=43 - 45 20770 // Disconnected elements can have computed display: none, so first confirm that elem is 20771 // in the document. 20772 jQuery.contains( elem.ownerDocument, elem ) && 20773 20774 jQuery.css( elem, "display" ) === "none"; 20775 }; 20776 20777 var swap = function( elem, options, callback, args ) { 20778 var ret, name, 20779 old = {}; 20780 20781 // Remember the old values, and insert the new ones 20782 for ( name in options ) { 20783 old[ name ] = elem.style[ name ]; 20784 elem.style[ name ] = options[ name ]; 20785 } 20786 20787 ret = callback.apply( elem, args || [] ); 20788 20789 // Revert the old values 20790 for ( name in options ) { 20791 elem.style[ name ] = old[ name ]; 20792 } 20793 20794 return ret; 20795 }; 20796 20797 20798 20799 20800 function adjustCSS( elem, prop, valueParts, tween ) { 20801 var adjusted, 20802 scale = 1, 20803 maxIterations = 20, 20804 currentValue = tween ? 20805 function() { 20806 return tween.cur(); 20807 } : 20808 function() { 20809 return jQuery.css( elem, prop, "" ); 20810 }, 20811 initial = currentValue(), 20812 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 20813 20814 // Starting value computation is required for potential unit mismatches 20815 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 20816 rcssNum.exec( jQuery.css( elem, prop ) ); 20817 20818 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 20819 20820 // Trust units reported by jQuery.css 20821 unit = unit || initialInUnit[ 3 ]; 20822 20823 // Make sure we update the tween properties later on 20824 valueParts = valueParts || []; 20825 20826 // Iteratively approximate from a nonzero starting point 20827 initialInUnit = +initial || 1; 20828 20829 do { 20830 20831 // If previous iteration zeroed out, double until we get *something*. 20832 // Use string for doubling so we don't accidentally see scale as unchanged below 20833 scale = scale || ".5"; 20834 20835 // Adjust and apply 20836 initialInUnit = initialInUnit / scale; 20837 jQuery.style( elem, prop, initialInUnit + unit ); 20838 20839 // Update scale, tolerating zero or NaN from tween.cur() 20840 // Break the loop if scale is unchanged or perfect, or if we've just had enough. 20841 } while ( 20842 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations 20843 ); 20844 } 20845 20846 if ( valueParts ) { 20847 initialInUnit = +initialInUnit || +initial || 0; 20848 20849 // Apply relative offset (+=/-=) if specified 20850 adjusted = valueParts[ 1 ] ? 20851 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 20852 +valueParts[ 2 ]; 20853 if ( tween ) { 20854 tween.unit = unit; 20855 tween.start = initialInUnit; 20856 tween.end = adjusted; 20857 } 20858 } 20859 return adjusted; 20860 } 20861 20862 20863 var defaultDisplayMap = {}; 20864 20865 function getDefaultDisplay( elem ) { 20866 var temp, 20867 doc = elem.ownerDocument, 20868 nodeName = elem.nodeName, 20869 display = defaultDisplayMap[ nodeName ]; 20870 20871 if ( display ) { 20872 return display; 20873 } 20874 20875 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 20876 display = jQuery.css( temp, "display" ); 20877 20878 temp.parentNode.removeChild( temp ); 20879 20880 if ( display === "none" ) { 20881 display = "block"; 20882 } 20883 defaultDisplayMap[ nodeName ] = display; 20884
vendor: 4,692 bytes, lines 20885-21067
20885 return display; 20886 } 20887 20888 function showHide( elements, show ) { 20889 var display, elem, 20890 values = [], 20891 index = 0, 20892 length = elements.length; 20893 20894 // Determine new display value for elements that need to change 20895 for ( ; index < length; index++ ) { 20896 elem = elements[ index ]; 20897 if ( !elem.style ) { 20898 continue; 20899 } 20900 20901 display = elem.style.display; 20902 if ( show ) { 20903 20904 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 20905 // check is required in this first loop unless we have a nonempty display value (either 20906 // inline or about-to-be-restored) 20907 if ( display === "none" ) { 20908 values[ index ] = dataPriv.get( elem, "display" ) || null; 20909 if ( !values[ index ] ) { 20910 elem.style.display = ""; 20911 } 20912 } 20913 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 20914 values[ index ] = getDefaultDisplay( elem ); 20915 } 20916 } else { 20917 if ( display !== "none" ) { 20918 values[ index ] = "none"; 20919 20920 // Remember what we're overwriting 20921 dataPriv.set( elem, "display", display ); 20922 } 20923 } 20924 } 20925 20926 // Set the display of the elements in a second loop to avoid constant reflow 20927 for ( index = 0; index < length; index++ ) { 20928 if ( values[ index ] != null ) { 20929 elements[ index ].style.display = values[ index ]; 20930 } 20931 } 20932 20933 return elements; 20934 } 20935 20936 jQuery.fn.extend( { 20937 show: function() { 20938 return showHide( this, true ); 20939 }, 20940 hide: function() { 20941 return showHide( this ); 20942 }, 20943 toggle: function( state ) { 20944 if ( typeof state === "boolean" ) { 20945 return state ? this.show() : this.hide(); 20946 } 20947 20948 return this.each( function() { 20949 if ( isHiddenWithinTree( this ) ) { 20950 jQuery( this ).show(); 20951 } else { 20952 jQuery( this ).hide(); 20953 } 20954 } ); 20955 } 20956 } ); 20957 var rcheckableType = ( /^(?:checkbox|radio)$/i ); 20958 20959 var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); 20960 20961 var rscriptType = ( /^$|\/(?:java|ecma)script/i ); 20962 20963 20964 20965 // We have to close these tags to support XHTML (#13200) 20966 var wrapMap = { 20967 20968 // Support: IE <=9 only 20969 option: [ 1, "<select multiple='multiple'>", "</select>" ], 20970 20971 // XHTML parsers do not magically insert elements in the 20972 // same way that tag soup parsers do. So we cannot shorten 20973 // this by omitting <tbody> or other required elements. 20974 thead: [ 1, "<table>", "</table>" ], 20975 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 20976 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 20977 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 20978 20979 _default: [ 0, "", "" ] 20980 }; 20981 20982 // Support: IE <=9 only 20983 wrapMap.optgroup = wrapMap.option; 20984 20985 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 20986 wrapMap.th = wrapMap.td; 20987 20988 20989 function getAll( context, tag ) { 20990 20991 // Support: IE <=9 - 11 only 20992 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 20993 var ret; 20994 20995 if ( typeof context.getElementsByTagName !== "undefined" ) { 20996 ret = context.getElementsByTagName( tag || "*" ); 20997 20998 } else if ( typeof context.querySelectorAll !== "undefined" ) { 20999 ret = context.querySelectorAll( tag || "*" ); 21000 21001 } else { 21002 ret = []; 21003 } 21004 21005 if ( tag === undefined || tag && nodeName( context, tag ) ) { 21006 return jQuery.merge( [ context ], ret ); 21007 } 21008 21009 return ret; 21010 } 21011 21012 21013 // Mark scripts as having already been evaluated 21014 function setGlobalEval( elems, refElements ) { 21015 var i = 0, 21016 l = elems.length; 21017 21018 for ( ; i < l; i++ ) { 21019 dataPriv.set( 21020 elems[ i ], 21021 "globalEval", 21022 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 21023 ); 21024 } 21025 } 21026 21027 21028 var rhtml = /<|&#?\w+;/; 21029 21030 function buildFragment( elems, context, scripts, selection, ignored ) { 21031 var elem, tmp, tag, wrap, contains, j, 21032 fragment = context.createDocumentFragment(), 21033 nodes = [], 21034 i = 0, 21035 l = elems.length; 21036 21037 for ( ; i < l; i++ ) { 21038 elem = elems[ i ]; 21039 21040 if ( elem || elem === 0 ) { 21041 21042 // Add nodes directly 21043 if ( jQuery.type( elem ) === "object" ) { 21044 21045 // Support: Android <=4.0 only, PhantomJS 1 only 21046 // push.apply(_, arraylike) throws on ancient WebKit 21047 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 21048 21049 // Convert non-html into a text node 21050 } else if ( !rhtml.test( elem ) ) { 21051 nodes.push( context.createTextNode( elem ) ); 21052 21053 // Convert html into DOM nodes 21054 } else { 21055 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 21056 21057 // Deserialize a standard representation 21058 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 21059 wrap = wrapMap[ tag ] || wrapMap._default; 21060 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 21061 21062 // Descend through wrappers to the right content 21063 j = wrap[ 0 ]; 21064 while ( j-- ) { 21065 tmp = tmp.lastChild; 21066 } 21067
vendor: 12,171 bytes, lines 21068-21498
21068 // Support: Android <=4.0 only, PhantomJS 1 only 21069 // push.apply(_, arraylike) throws on ancient WebKit 21070 jQuery.merge( nodes, tmp.childNodes ); 21071 21072 // Remember the top-level container 21073 tmp = fragment.firstChild; 21074 21075 // Ensure the created nodes are orphaned (#12392) 21076 tmp.textContent = ""; 21077 } 21078 } 21079 } 21080 21081 // Remove wrapper from fragment 21082 fragment.textContent = ""; 21083 21084 i = 0; 21085 while ( ( elem = nodes[ i++ ] ) ) { 21086 21087 // Skip elements already in the context collection (trac-4087) 21088 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 21089 if ( ignored ) { 21090 ignored.push( elem ); 21091 } 21092 continue; 21093 } 21094 21095 contains = jQuery.contains( elem.ownerDocument, elem ); 21096 21097 // Append to fragment 21098 tmp = getAll( fragment.appendChild( elem ), "script" ); 21099 21100 // Preserve script evaluation history 21101 if ( contains ) { 21102 setGlobalEval( tmp ); 21103 } 21104 21105 // Capture executables 21106 if ( scripts ) { 21107 j = 0; 21108 while ( ( elem = tmp[ j++ ] ) ) { 21109 if ( rscriptType.test( elem.type || "" ) ) { 21110 scripts.push( elem ); 21111 } 21112 } 21113 } 21114 } 21115 21116 return fragment; 21117 } 21118 21119 21120 ( function() { 21121 var fragment = document.createDocumentFragment(), 21122 div = fragment.appendChild( document.createElement( "div" ) ), 21123 input = document.createElement( "input" ); 21124 21125 // Support: Android 4.0 - 4.3 only 21126 // Check state lost if the name is set (#11217) 21127 // Support: Windows Web Apps (WWA) 21128 // `name` and `type` must use .setAttribute for WWA (#14901) 21129 input.setAttribute( "type", "radio" ); 21130 input.setAttribute( "checked", "checked" ); 21131 input.setAttribute( "name", "t" ); 21132 21133 div.appendChild( input ); 21134 21135 // Support: Android <=4.1 only 21136 // Older WebKit doesn't clone checked state correctly in fragments 21137 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 21138 21139 // Support: IE <=11 only 21140 // Make sure textarea (and checkbox) defaultValue is properly cloned 21141 div.innerHTML = "<textarea>x</textarea>"; 21142 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 21143 } )(); 21144 var documentElement = document.documentElement; 21145 21146 21147 21148 var 21149 rkeyEvent = /^key/, 21150 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 21151 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 21152 21153 function returnTrue() { 21154 return true; 21155 } 21156 21157 function returnFalse() { 21158 return false; 21159 } 21160 21161 // Support: IE <=9 only 21162 // See #13393 for more info 21163 function safeActiveElement() { 21164 try { 21165 return document.activeElement; 21166 } catch ( err ) { } 21167 } 21168 21169 function on( elem, types, selector, data, fn, one ) { 21170 var origFn, type; 21171 21172 // Types can be a map of types/handlers 21173 if ( typeof types === "object" ) { 21174 21175 // ( types-Object, selector, data ) 21176 if ( typeof selector !== "string" ) { 21177 21178 // ( types-Object, data ) 21179 data = data || selector; 21180 selector = undefined; 21181 } 21182 for ( type in types ) { 21183 on( elem, type, selector, data, types[ type ], one ); 21184 } 21185 return elem; 21186 } 21187 21188 if ( data == null && fn == null ) { 21189 21190 // ( types, fn ) 21191 fn = selector; 21192 data = selector = undefined; 21193 } else if ( fn == null ) { 21194 if ( typeof selector === "string" ) { 21195 21196 // ( types, selector, fn ) 21197 fn = data; 21198 data = undefined; 21199 } else { 21200 21201 // ( types, data, fn ) 21202 fn = data; 21203 data = selector; 21204 selector = undefined; 21205 } 21206 } 21207 if ( fn === false ) { 21208 fn = returnFalse; 21209 } else if ( !fn ) { 21210 return elem; 21211 } 21212 21213 if ( one === 1 ) { 21214 origFn = fn; 21215 fn = function( event ) { 21216 21217 // Can use an empty set, since event contains the info 21218 jQuery().off( event ); 21219 return origFn.apply( this, arguments ); 21220 }; 21221 21222 // Use same guid so caller can remove using origFn 21223 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 21224 } 21225 return elem.each( function() { 21226 jQuery.event.add( this, types, fn, data, selector ); 21227 } ); 21228 } 21229 21230 /* 21231 * Helper functions for managing events -- not part of the public interface. 21232 * Props to Dean Edwards' addEvent library for many of the ideas. 21233 */ 21234 jQuery.event = { 21235 21236 global: {}, 21237 21238 add: function( elem, types, handler, data, selector ) { 21239 21240 var handleObjIn, eventHandle, tmp, 21241 events, t, handleObj, 21242 special, handlers, type, namespaces, origType, 21243 elemData = dataPriv.get( elem ); 21244 21245 // Don't attach events to noData or text/comment nodes (but allow plain objects) 21246 if ( !elemData ) { 21247 return; 21248 } 21249 21250 // Caller can pass in an object of custom data in lieu of the handler 21251 if ( handler.handler ) { 21252 handleObjIn = handler; 21253 handler = handleObjIn.handler; 21254 selector = handleObjIn.selector; 21255 } 21256 21257 // Ensure that invalid selectors throw exceptions at attach time 21258 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 21259 if ( selector ) { 21260 jQuery.find.matchesSelector( documentElement, selector ); 21261 } 21262 21263 // Make sure that the handler has a unique ID, used to find/remove it later 21264 if ( !handler.guid ) { 21265 handler.guid = jQuery.guid++; 21266 } 21267 21268 // Init the element's event structure and main handler, if this is the first 21269 if ( !( events = elemData.events ) ) { 21270 events = elemData.events = {}; 21271 } 21272 if ( !( eventHandle = elemData.handle ) ) { 21273 eventHandle = elemData.handle = function( e ) { 21274 21275 // Discard the second event of a jQuery.event.trigger() and 21276 // when an event is called after a page has unloaded 21277 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 21278 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 21279 }; 21280 } 21281 21282 // Handle multiple events separated by a space 21283 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 21284 t = types.length; 21285 while ( t-- ) { 21286 tmp = rtypenamespace.exec( types[ t ] ) || []; 21287 type = origType = tmp[ 1 ]; 21288 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 21289 21290 // There *must* be a type, no attaching namespace-only handlers 21291 if ( !type ) { 21292 continue; 21293 } 21294 21295 // If event changes its type, use the special event handlers for the changed type 21296 special = jQuery.event.special[ type ] || {}; 21297 21298 // If selector defined, determine special event api type, otherwise given type 21299 type = ( selector ? special.delegateType : special.bindType ) || type; 21300 21301 // Update special based on newly reset type 21302 special = jQuery.event.special[ type ] || {}; 21303 21304 // handleObj is passed to all event handlers 21305 handleObj = jQuery.extend( { 21306 type: type, 21307 origType: origType, 21308 data: data, 21309 handler: handler, 21310 guid: handler.guid, 21311 selector: selector, 21312 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 21313 namespace: namespaces.join( "." ) 21314 }, handleObjIn ); 21315 21316 // Init the event handler queue if we're the first 21317 if ( !( handlers = events[ type ] ) ) { 21318 handlers = events[ type ] = []; 21319 handlers.delegateCount = 0; 21320 21321 // Only use addEventListener if the special events handler returns false 21322 if ( !special.setup || 21323 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 21324 21325 if ( elem.addEventListener ) { 21326 elem.addEventListener( type, eventHandle ); 21327 } 21328 } 21329 } 21330 21331 if ( special.add ) { 21332 special.add.call( elem, handleObj ); 21333 21334 if ( !handleObj.handler.guid ) { 21335 handleObj.handler.guid = handler.guid; 21336 } 21337 } 21338 21339 // Add to the element's handler list, delegates in front 21340 if ( selector ) { 21341 handlers.splice( handlers.delegateCount++, 0, handleObj ); 21342 } else { 21343 handlers.push( handleObj ); 21344 } 21345 21346 // Keep track of which events have ever been used, for event optimization 21347 jQuery.event.global[ type ] = true; 21348 } 21349 21350 }, 21351 21352 // Detach an event or set of events from an element 21353 remove: function( elem, types, handler, selector, mappedTypes ) { 21354 21355 var j, origCount, tmp, 21356 events, t, handleObj, 21357 special, handlers, type, namespaces, origType, 21358 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 21359 21360 if ( !elemData || !( events = elemData.events ) ) { 21361 return; 21362 } 21363 21364 // Once for each type.namespace in types; type may be omitted 21365 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 21366 t = types.length; 21367 while ( t-- ) { 21368 tmp = rtypenamespace.exec( types[ t ] ) || []; 21369 type = origType = tmp[ 1 ]; 21370 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 21371 21372 // Unbind all events (on this namespace, if provided) for the element 21373 if ( !type ) { 21374 for ( type in events ) { 21375 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 21376 } 21377 continue; 21378 } 21379 21380 special = jQuery.event.special[ type ] || {}; 21381 type = ( selector ? special.delegateType : special.bindType ) || type; 21382 handlers = events[ type ] || []; 21383 tmp = tmp[ 2 ] && 21384 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 21385 21386 // Remove matching events 21387 origCount = j = handlers.length; 21388 while ( j-- ) { 21389 handleObj = handlers[ j ]; 21390 21391 if ( ( mappedTypes || origType === handleObj.origType ) && 21392 ( !handler || handler.guid === handleObj.guid ) && 21393 ( !tmp || tmp.test( handleObj.namespace ) ) && 21394 ( !selector || selector === handleObj.selector || 21395 selector === "**" && handleObj.selector ) ) { 21396 handlers.splice( j, 1 ); 21397 21398 if ( handleObj.selector ) { 21399 handlers.delegateCount--; 21400 } 21401 if ( special.remove ) { 21402 special.remove.call( elem, handleObj ); 21403 } 21404 } 21405 } 21406 21407 // Remove generic event handler if we removed something and no more handlers exist 21408 // (avoids potential for endless recursion during removal of special event handlers) 21409 if ( origCount && !handlers.length ) { 21410 if ( !special.teardown || 21411 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 21412 21413 jQuery.removeEvent( elem, type, elemData.handle ); 21414 } 21415 21416 delete events[ type ]; 21417 } 21418 } 21419 21420 // Remove data and the expando if it's no longer used 21421 if ( jQuery.isEmptyObject( events ) ) { 21422 dataPriv.remove( elem, "handle events" ); 21423 } 21424 }, 21425 21426 dispatch: function( nativeEvent ) { 21427 21428 // Make a writable jQuery.Event from the native event object 21429 var event = jQuery.event.fix( nativeEvent ); 21430 21431 var i, j, ret, matched, handleObj, handlerQueue, 21432 args = new Array( arguments.length ), 21433 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 21434 special = jQuery.event.special[ event.type ] || {}; 21435 21436 // Use the fix-ed jQuery.Event rather than the (read-only) native event 21437 args[ 0 ] = event; 21438 21439 for ( i = 1; i < arguments.length; i++ ) { 21440 args[ i ] = arguments[ i ]; 21441 } 21442 21443 event.delegateTarget = this; 21444 21445 // Call the preDispatch hook for the mapped type, and let it bail if desired 21446 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 21447 return; 21448 } 21449 21450 // Determine handlers 21451 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 21452 21453 // Run delegates first; they may want to stop propagation beneath us 21454 i = 0; 21455 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 21456 event.currentTarget = matched.elem; 21457 21458 j = 0; 21459 while ( ( handleObj = matched.handlers[ j++ ] ) && 21460 !event.isImmediatePropagationStopped() ) { 21461 21462 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 21463 // a subset or equal to those in the bound event (both can have no namespace). 21464 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 21465 21466 event.handleObj = handleObj; 21467 event.data = handleObj.data; 21468 21469 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 21470 handleObj.handler ).apply( matched.elem, args ); 21471 21472 if ( ret !== undefined ) { 21473 if ( ( event.result = ret ) === false ) { 21474 event.preventDefault(); 21475 event.stopPropagation(); 21476 } 21477 } 21478 } 21479 } 21480 } 21481 21482 // Call the postDispatch hook for the mapped type 21483 if ( special.postDispatch ) { 21484 special.postDispatch.call( this, event ); 21485 } 21486 21487 return event.result; 21488 }, 21489 21490 handlers: function( event, handlers ) { 21491 var i, handleObj, sel, matchedHandlers, matchedSelectors, 21492 handlerQueue = [], 21493 delegateCount = handlers.delegateCount, 21494 cur = event.target; 21495 21496 // Find delegate handlers 21497 if ( delegateCount && 21498
vendor: 9,850 bytes, lines 21499-21886
21499 // Support: IE <=9 21500 // Black-hole SVG <use> instance trees (trac-13180) 21501 cur.nodeType && 21502 21503 // Support: Firefox <=42 21504 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 21505 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 21506 // Support: IE 11 only 21507 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 21508 !( event.type === "click" && event.button >= 1 ) ) { 21509 21510 for ( ; cur !== this; cur = cur.parentNode || this ) { 21511 21512 // Don't check non-elements (#13208) 21513 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 21514 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 21515 matchedHandlers = []; 21516 matchedSelectors = {}; 21517 for ( i = 0; i < delegateCount; i++ ) { 21518 handleObj = handlers[ i ]; 21519 21520 // Don't conflict with Object.prototype properties (#13203) 21521 sel = handleObj.selector + " "; 21522 21523 if ( matchedSelectors[ sel ] === undefined ) { 21524 matchedSelectors[ sel ] = handleObj.needsContext ? 21525 jQuery( sel, this ).index( cur ) > -1 : 21526 jQuery.find( sel, this, null, [ cur ] ).length; 21527 } 21528 if ( matchedSelectors[ sel ] ) { 21529 matchedHandlers.push( handleObj ); 21530 } 21531 } 21532 if ( matchedHandlers.length ) { 21533 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 21534 } 21535 } 21536 } 21537 } 21538 21539 // Add the remaining (directly-bound) handlers 21540 cur = this; 21541 if ( delegateCount < handlers.length ) { 21542 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 21543 } 21544 21545 return handlerQueue; 21546 }, 21547 21548 addProp: function( name, hook ) { 21549 Object.defineProperty( jQuery.Event.prototype, name, { 21550 enumerable: true, 21551 configurable: true, 21552 21553 get: jQuery.isFunction( hook ) ? 21554 function() { 21555 if ( this.originalEvent ) { 21556 return hook( this.originalEvent ); 21557 } 21558 } : 21559 function() { 21560 if ( this.originalEvent ) { 21561 return this.originalEvent[ name ]; 21562 } 21563 }, 21564 21565 set: function( value ) { 21566 Object.defineProperty( this, name, { 21567 enumerable: true, 21568 configurable: true, 21569 writable: true, 21570 value: value 21571 } ); 21572 } 21573 } ); 21574 }, 21575 21576 fix: function( originalEvent ) { 21577 return originalEvent[ jQuery.expando ] ? 21578 originalEvent : 21579 new jQuery.Event( originalEvent ); 21580 }, 21581 21582 special: { 21583 load: { 21584 21585 // Prevent triggered image.load events from bubbling to window.load 21586 noBubble: true 21587 }, 21588 focus: { 21589 21590 // Fire native event if possible so blur/focus sequence is correct 21591 trigger: function() { 21592 if ( this !== safeActiveElement() && this.focus ) { 21593 this.focus(); 21594 return false; 21595 } 21596 }, 21597 delegateType: "focusin" 21598 }, 21599 blur: { 21600 trigger: function() { 21601 if ( this === safeActiveElement() && this.blur ) { 21602 this.blur(); 21603 return false; 21604 } 21605 }, 21606 delegateType: "focusout" 21607 }, 21608 click: { 21609 21610 // For checkbox, fire native event so checked state will be right 21611 trigger: function() { 21612 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { 21613 this.click(); 21614 return false; 21615 } 21616 }, 21617 21618 // For cross-browser consistency, don't fire native .click() on links 21619 _default: function( event ) { 21620 return nodeName( event.target, "a" ); 21621 } 21622 }, 21623 21624 beforeunload: { 21625 postDispatch: function( event ) { 21626 21627 // Support: Firefox 20+ 21628 // Firefox doesn't alert if the returnValue field is not set. 21629 if ( event.result !== undefined && event.originalEvent ) { 21630 event.originalEvent.returnValue = event.result; 21631 } 21632 } 21633 } 21634 } 21635 }; 21636 21637 jQuery.removeEvent = function( elem, type, handle ) { 21638 21639 // This "if" is needed for plain objects 21640 if ( elem.removeEventListener ) { 21641 elem.removeEventListener( type, handle ); 21642 } 21643 }; 21644 21645 jQuery.Event = function( src, props ) { 21646 21647 // Allow instantiation without the 'new' keyword 21648 if ( !( this instanceof jQuery.Event ) ) { 21649 return new jQuery.Event( src, props ); 21650 } 21651 21652 // Event object 21653 if ( src && src.type ) { 21654 this.originalEvent = src; 21655 this.type = src.type; 21656 21657 // Events bubbling up the document may have been marked as prevented 21658 // by a handler lower down the tree; reflect the correct value. 21659 this.isDefaultPrevented = src.defaultPrevented || 21660 src.defaultPrevented === undefined && 21661 21662 // Support: Android <=2.3 only 21663 src.returnValue === false ? 21664 returnTrue : 21665 returnFalse; 21666 21667 // Create target properties 21668 // Support: Safari <=6 - 7 only 21669 // Target should not be a text node (#504, #13143) 21670 this.target = ( src.target && src.target.nodeType === 3 ) ? 21671 src.target.parentNode : 21672 src.target; 21673 21674 this.currentTarget = src.currentTarget; 21675 this.relatedTarget = src.relatedTarget; 21676 21677 // Event type 21678 } else { 21679 this.type = src; 21680 } 21681 21682 // Put explicitly provided properties onto the event object 21683 if ( props ) { 21684 jQuery.extend( this, props ); 21685 } 21686 21687 // Create a timestamp if incoming event doesn't have one 21688 this.timeStamp = src && src.timeStamp || jQuery.now(); 21689 21690 // Mark it as fixed 21691 this[ jQuery.expando ] = true; 21692 }; 21693 21694 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 21695 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 21696 jQuery.Event.prototype = { 21697 constructor: jQuery.Event, 21698 isDefaultPrevented: returnFalse, 21699 isPropagationStopped: returnFalse, 21700 isImmediatePropagationStopped: returnFalse, 21701 isSimulated: false, 21702 21703 preventDefault: function() { 21704 var e = this.originalEvent; 21705 21706 this.isDefaultPrevented = returnTrue; 21707 21708 if ( e && !this.isSimulated ) { 21709 e.preventDefault(); 21710 } 21711 }, 21712 stopPropagation: function() { 21713 var e = this.originalEvent; 21714 21715 this.isPropagationStopped = returnTrue; 21716 21717 if ( e && !this.isSimulated ) { 21718 e.stopPropagation(); 21719 } 21720 }, 21721 stopImmediatePropagation: function() { 21722 var e = this.originalEvent; 21723 21724 this.isImmediatePropagationStopped = returnTrue; 21725 21726 if ( e && !this.isSimulated ) { 21727 e.stopImmediatePropagation(); 21728 } 21729 21730 this.stopPropagation(); 21731 } 21732 }; 21733 21734 // Includes all common event props including KeyEvent and MouseEvent specific props 21735 jQuery.each( { 21736 altKey: true, 21737 bubbles: true, 21738 cancelable: true, 21739 changedTouches: true, 21740 ctrlKey: true, 21741 detail: true, 21742 eventPhase: true, 21743 metaKey: true, 21744 pageX: true, 21745 pageY: true, 21746 shiftKey: true, 21747 view: true, 21748 "char": true, 21749 charCode: true, 21750 key: true, 21751 keyCode: true, 21752 button: true, 21753 buttons: true, 21754 clientX: true, 21755 clientY: true, 21756 offsetX: true, 21757 offsetY: true, 21758 pointerId: true, 21759 pointerType: true, 21760 screenX: true, 21761 screenY: true, 21762 targetTouches: true, 21763 toElement: true, 21764 touches: true, 21765 21766 which: function( event ) { 21767 var button = event.button; 21768 21769 // Add which for key events 21770 if ( event.which == null && rkeyEvent.test( event.type ) ) { 21771 return event.charCode != null ? event.charCode : event.keyCode; 21772 } 21773 21774 // Add which for click: 1 === left; 2 === middle; 3 === right 21775 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 21776 if ( button & 1 ) { 21777 return 1; 21778 } 21779 21780 if ( button & 2 ) { 21781 return 3; 21782 } 21783 21784 if ( button & 4 ) { 21785 return 2; 21786 } 21787 21788 return 0; 21789 } 21790 21791 return event.which; 21792 } 21793 }, jQuery.event.addProp ); 21794 21795 // Create mouseenter/leave events using mouseover/out and event-time checks 21796 // so that event delegation works in jQuery. 21797 // Do the same for pointerenter/pointerleave and pointerover/pointerout 21798 // 21799 // Support: Safari 7 only 21800 // Safari sends mouseenter too often; see: 21801 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 21802 // for the description of the bug (it existed in older Chrome versions as well). 21803 jQuery.each( { 21804 mouseenter: "mouseover", 21805 mouseleave: "mouseout", 21806 pointerenter: "pointerover", 21807 pointerleave: "pointerout" 21808 }, function( orig, fix ) { 21809 jQuery.event.special[ orig ] = { 21810 delegateType: fix, 21811 bindType: fix, 21812 21813 handle: function( event ) { 21814 var ret, 21815 target = this, 21816 related = event.relatedTarget, 21817 handleObj = event.handleObj; 21818 21819 // For mouseenter/leave call the handler if related is outside the target. 21820 // NB: No relatedTarget if the mouse left/entered the browser window 21821 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 21822 event.type = handleObj.origType; 21823 ret = handleObj.handler.apply( this, arguments ); 21824 event.type = fix; 21825 } 21826 return ret; 21827 } 21828 }; 21829 } ); 21830 21831 jQuery.fn.extend( { 21832 21833 on: function( types, selector, data, fn ) { 21834 return on( this, types, selector, data, fn ); 21835 }, 21836 one: function( types, selector, data, fn ) { 21837 return on( this, types, selector, data, fn, 1 ); 21838 }, 21839 off: function( types, selector, fn ) { 21840 var handleObj, type; 21841 if ( types && types.preventDefault && types.handleObj ) { 21842 21843 // ( event ) dispatched jQuery.Event 21844 handleObj = types.handleObj; 21845 jQuery( types.delegateTarget ).off( 21846 handleObj.namespace ? 21847 handleObj.origType + "." + handleObj.namespace : 21848 handleObj.origType, 21849 handleObj.selector, 21850 handleObj.handler 21851 ); 21852 return this; 21853 } 21854 if ( typeof types === "object" ) { 21855 21856 // ( types-object [, selector] ) 21857 for ( type in types ) { 21858 this.off( type, selector, types[ type ] ); 21859 } 21860 return this; 21861 } 21862 if ( selector === false || typeof selector === "function" ) { 21863 21864 // ( types [, fn] ) 21865 fn = selector; 21866 selector = undefined; 21867 } 21868 if ( fn === false ) { 21869 fn = returnFalse; 21870 } 21871 return this.each( function() { 21872 jQuery.event.remove( this, types, fn, selector ); 21873 } ); 21874 } 21875 } ); 21876 21877 21878 var 21879 21880 /* eslint-disable max-len */ 21881 21882 // See https://github.com/eslint/eslint/issues/3229 21883 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 21884 21885 /* eslint-enable */ 21886
vendor: 16,119 bytes, lines 21887-22475
21887 // Support: IE <=10 - 11, Edge 12 - 13 21888 // In IE/Edge using regex groups here causes severe slowdowns. 21889 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 21890 rnoInnerhtml = /<script|<style|<link/i, 21891 21892 // checked="checked" or checked 21893 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 21894 rscriptTypeMasked = /^true\/(.*)/, 21895 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 21896 21897 // Prefer a tbody over its parent table for containing new rows 21898 function manipulationTarget( elem, content ) { 21899 if ( nodeName( elem, "table" ) && 21900 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 21901 21902 return jQuery( ">tbody", elem )[ 0 ] || elem; 21903 } 21904 21905 return elem; 21906 } 21907 21908 // Replace/restore the type attribute of script elements for safe DOM manipulation 21909 function disableScript( elem ) { 21910 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 21911 return elem; 21912 } 21913 function restoreScript( elem ) { 21914 var match = rscriptTypeMasked.exec( elem.type ); 21915 21916 if ( match ) { 21917 elem.type = match[ 1 ]; 21918 } else { 21919 elem.removeAttribute( "type" ); 21920 } 21921 21922 return elem; 21923 } 21924 21925 function cloneCopyEvent( src, dest ) { 21926 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 21927 21928 if ( dest.nodeType !== 1 ) { 21929 return; 21930 } 21931 21932 // 1. Copy private data: events, handlers, etc. 21933 if ( dataPriv.hasData( src ) ) { 21934 pdataOld = dataPriv.access( src ); 21935 pdataCur = dataPriv.set( dest, pdataOld ); 21936 events = pdataOld.events; 21937 21938 if ( events ) { 21939 delete pdataCur.handle; 21940 pdataCur.events = {}; 21941 21942 for ( type in events ) { 21943 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 21944 jQuery.event.add( dest, type, events[ type ][ i ] ); 21945 } 21946 } 21947 } 21948 } 21949 21950 // 2. Copy user data 21951 if ( dataUser.hasData( src ) ) { 21952 udataOld = dataUser.access( src ); 21953 udataCur = jQuery.extend( {}, udataOld ); 21954 21955 dataUser.set( dest, udataCur ); 21956 } 21957 } 21958 21959 // Fix IE bugs, see support tests 21960 function fixInput( src, dest ) { 21961 var nodeName = dest.nodeName.toLowerCase(); 21962 21963 // Fails to persist the checked state of a cloned checkbox or radio button. 21964 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 21965 dest.checked = src.checked; 21966 21967 // Fails to return the selected option to the default selected state when cloning options 21968 } else if ( nodeName === "input" || nodeName === "textarea" ) { 21969 dest.defaultValue = src.defaultValue; 21970 } 21971 } 21972 21973 function domManip( collection, args, callback, ignored ) { 21974 21975 // Flatten any nested arrays 21976 args = concat.apply( [], args ); 21977 21978 var fragment, first, scripts, hasScripts, node, doc, 21979 i = 0, 21980 l = collection.length, 21981 iNoClone = l - 1, 21982 value = args[ 0 ], 21983 isFunction = jQuery.isFunction( value ); 21984 21985 // We can't cloneNode fragments that contain checked, in WebKit 21986 if ( isFunction || 21987 ( l > 1 && typeof value === "string" && 21988 !support.checkClone && rchecked.test( value ) ) ) { 21989 return collection.each( function( index ) { 21990 var self = collection.eq( index ); 21991 if ( isFunction ) { 21992 args[ 0 ] = value.call( this, index, self.html() ); 21993 } 21994 domManip( self, args, callback, ignored ); 21995 } ); 21996 } 21997 21998 if ( l ) { 21999 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 22000 first = fragment.firstChild; 22001 22002 if ( fragment.childNodes.length === 1 ) { 22003 fragment = first; 22004 } 22005 22006 // Require either new content or an interest in ignored elements to invoke the callback 22007 if ( first || ignored ) { 22008 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 22009 hasScripts = scripts.length; 22010 22011 // Use the original fragment for the last item 22012 // instead of the first because it can end up 22013 // being emptied incorrectly in certain situations (#8070). 22014 for ( ; i < l; i++ ) { 22015 node = fragment; 22016 22017 if ( i !== iNoClone ) { 22018 node = jQuery.clone( node, true, true ); 22019 22020 // Keep references to cloned scripts for later restoration 22021 if ( hasScripts ) { 22022 22023 // Support: Android <=4.0 only, PhantomJS 1 only 22024 // push.apply(_, arraylike) throws on ancient WebKit 22025 jQuery.merge( scripts, getAll( node, "script" ) ); 22026 } 22027 } 22028 22029 callback.call( collection[ i ], node, i ); 22030 } 22031 22032 if ( hasScripts ) { 22033 doc = scripts[ scripts.length - 1 ].ownerDocument; 22034 22035 // Reenable scripts 22036 jQuery.map( scripts, restoreScript ); 22037 22038 // Evaluate executable scripts on first document insertion 22039 for ( i = 0; i < hasScripts; i++ ) { 22040 node = scripts[ i ]; 22041 if ( rscriptType.test( node.type || "" ) && 22042 !dataPriv.access( node, "globalEval" ) && 22043 jQuery.contains( doc, node ) ) { 22044 22045 if ( node.src ) { 22046 22047 // Optional AJAX dependency, but won't run scripts if not present 22048 if ( jQuery._evalUrl ) { 22049 jQuery._evalUrl( node.src ); 22050 } 22051 } else { 22052 DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); 22053 } 22054 } 22055 } 22056 } 22057 } 22058 } 22059 22060 return collection; 22061 } 22062 22063 function remove( elem, selector, keepData ) { 22064 var node, 22065 nodes = selector ? jQuery.filter( selector, elem ) : elem, 22066 i = 0; 22067 22068 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 22069 if ( !keepData && node.nodeType === 1 ) { 22070 jQuery.cleanData( getAll( node ) ); 22071 } 22072 22073 if ( node.parentNode ) { 22074 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 22075 setGlobalEval( getAll( node, "script" ) ); 22076 } 22077 node.parentNode.removeChild( node ); 22078 } 22079 } 22080 22081 return elem; 22082 } 22083 22084 jQuery.extend( { 22085 htmlPrefilter: function( html ) { 22086 return html.replace( rxhtmlTag, "<$1></$2>" ); 22087 }, 22088 22089 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 22090 var i, l, srcElements, destElements, 22091 clone = elem.cloneNode( true ), 22092 inPage = jQuery.contains( elem.ownerDocument, elem ); 22093 22094 // Fix IE cloning issues 22095 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 22096 !jQuery.isXMLDoc( elem ) ) { 22097 22098 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 22099 destElements = getAll( clone ); 22100 srcElements = getAll( elem ); 22101 22102 for ( i = 0, l = srcElements.length; i < l; i++ ) { 22103 fixInput( srcElements[ i ], destElements[ i ] ); 22104 } 22105 } 22106 22107 // Copy the events from the original to the clone 22108 if ( dataAndEvents ) { 22109 if ( deepDataAndEvents ) { 22110 srcElements = srcElements || getAll( elem ); 22111 destElements = destElements || getAll( clone ); 22112 22113 for ( i = 0, l = srcElements.length; i < l; i++ ) { 22114 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 22115 } 22116 } else { 22117 cloneCopyEvent( elem, clone ); 22118 } 22119 } 22120 22121 // Preserve script evaluation history 22122 destElements = getAll( clone, "script" ); 22123 if ( destElements.length > 0 ) { 22124 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 22125 } 22126 22127 // Return the cloned set 22128 return clone; 22129 }, 22130 22131 cleanData: function( elems ) { 22132 var data, elem, type, 22133 special = jQuery.event.special, 22134 i = 0; 22135 22136 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 22137 if ( acceptData( elem ) ) { 22138 if ( ( data = elem[ dataPriv.expando ] ) ) { 22139 if ( data.events ) { 22140 for ( type in data.events ) { 22141 if ( special[ type ] ) { 22142 jQuery.event.remove( elem, type ); 22143 22144 // This is a shortcut to avoid jQuery.event.remove's overhead 22145 } else { 22146 jQuery.removeEvent( elem, type, data.handle ); 22147 } 22148 } 22149 } 22150 22151 // Support: Chrome <=35 - 45+ 22152 // Assign undefined instead of using delete, see Data#remove 22153 elem[ dataPriv.expando ] = undefined; 22154 } 22155 if ( elem[ dataUser.expando ] ) { 22156 22157 // Support: Chrome <=35 - 45+ 22158 // Assign undefined instead of using delete, see Data#remove 22159 elem[ dataUser.expando ] = undefined; 22160 } 22161 } 22162 } 22163 } 22164 } ); 22165 22166 jQuery.fn.extend( { 22167 detach: function( selector ) { 22168 return remove( this, selector, true ); 22169 }, 22170 22171 remove: function( selector ) { 22172 return remove( this, selector ); 22173 }, 22174 22175 text: function( value ) { 22176 return access( this, function( value ) { 22177 return value === undefined ? 22178 jQuery.text( this ) : 22179 this.empty().each( function() { 22180 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22181 this.textContent = value; 22182 } 22183 } ); 22184 }, null, value, arguments.length ); 22185 }, 22186 22187 append: function() { 22188 return domManip( this, arguments, function( elem ) { 22189 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22190 var target = manipulationTarget( this, elem ); 22191 target.appendChild( elem ); 22192 } 22193 } ); 22194 }, 22195 22196 prepend: function() { 22197 return domManip( this, arguments, function( elem ) { 22198 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22199 var target = manipulationTarget( this, elem ); 22200 target.insertBefore( elem, target.firstChild ); 22201 } 22202 } ); 22203 }, 22204 22205 before: function() { 22206 return domManip( this, arguments, function( elem ) { 22207 if ( this.parentNode ) { 22208 this.parentNode.insertBefore( elem, this ); 22209 } 22210 } ); 22211 }, 22212 22213 after: function() { 22214 return domManip( this, arguments, function( elem ) { 22215 if ( this.parentNode ) { 22216 this.parentNode.insertBefore( elem, this.nextSibling ); 22217 } 22218 } ); 22219 }, 22220 22221 empty: function() { 22222 var elem, 22223 i = 0; 22224 22225 for ( ; ( elem = this[ i ] ) != null; i++ ) { 22226 if ( elem.nodeType === 1 ) { 22227 22228 // Prevent memory leaks 22229 jQuery.cleanData( getAll( elem, false ) ); 22230 22231 // Remove any remaining nodes 22232 elem.textContent = ""; 22233 } 22234 } 22235 22236 return this; 22237 }, 22238 22239 clone: function( dataAndEvents, deepDataAndEvents ) { 22240 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 22241 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 22242 22243 return this.map( function() { 22244 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 22245 } ); 22246 }, 22247 22248 html: function( value ) { 22249 return access( this, function( value ) { 22250 var elem = this[ 0 ] || {}, 22251 i = 0, 22252 l = this.length; 22253 22254 if ( value === undefined && elem.nodeType === 1 ) { 22255 return elem.innerHTML; 22256 } 22257 22258 // See if we can take a shortcut and just use innerHTML 22259 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 22260 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 22261 22262 value = jQuery.htmlPrefilter( value ); 22263 22264 try { 22265 for ( ; i < l; i++ ) { 22266 elem = this[ i ] || {}; 22267 22268 // Remove element nodes and prevent memory leaks 22269 if ( elem.nodeType === 1 ) { 22270 jQuery.cleanData( getAll( elem, false ) ); 22271 elem.innerHTML = value; 22272 } 22273 } 22274 22275 elem = 0; 22276 22277 // If using innerHTML throws an exception, use the fallback method 22278 } catch ( e ) {} 22279 } 22280 22281 if ( elem ) { 22282 this.empty().append( value ); 22283 } 22284 }, null, value, arguments.length ); 22285 }, 22286 22287 replaceWith: function() { 22288 var ignored = []; 22289 22290 // Make the changes, replacing each non-ignored context element with the new content 22291 return domManip( this, arguments, function( elem ) { 22292 var parent = this.parentNode; 22293 22294 if ( jQuery.inArray( this, ignored ) < 0 ) { 22295 jQuery.cleanData( getAll( this ) ); 22296 if ( parent ) { 22297 parent.replaceChild( elem, this ); 22298 } 22299 } 22300 22301 // Force callback invocation 22302 }, ignored ); 22303 } 22304 } ); 22305 22306 jQuery.each( { 22307 appendTo: "append", 22308 prependTo: "prepend", 22309 insertBefore: "before", 22310 insertAfter: "after", 22311 replaceAll: "replaceWith" 22312 }, function( name, original ) { 22313 jQuery.fn[ name ] = function( selector ) { 22314 var elems, 22315 ret = [], 22316 insert = jQuery( selector ), 22317 last = insert.length - 1, 22318 i = 0; 22319 22320 for ( ; i <= last; i++ ) { 22321 elems = i === last ? this : this.clone( true ); 22322 jQuery( insert[ i ] )[ original ]( elems ); 22323 22324 // Support: Android <=4.0 only, PhantomJS 1 only 22325 // .get() because push.apply(_, arraylike) throws on ancient WebKit 22326 push.apply( ret, elems.get() ); 22327 } 22328 22329 return this.pushStack( ret ); 22330 }; 22331 } ); 22332 var rmargin = ( /^margin/ ); 22333 22334 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 22335 22336 var getStyles = function( elem ) { 22337 22338 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 22339 // IE throws on elements created in popups 22340 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 22341 var view = elem.ownerDocument.defaultView; 22342 22343 if ( !view || !view.opener ) { 22344 view = window; 22345 } 22346 22347 return view.getComputedStyle( elem ); 22348 }; 22349 22350 22351 22352 ( function() { 22353 22354 // Executing both pixelPosition & boxSizingReliable tests require only one layout 22355 // so they're executed at the same time to save the second computation. 22356 function computeStyleTests() { 22357 22358 // This is a singleton, we need to execute it only once 22359 if ( !div ) { 22360 return; 22361 } 22362 22363 div.style.cssText = 22364 "box-sizing:border-box;" + 22365 "position:relative;display:block;" + 22366 "margin:auto;border:1px;padding:1px;" + 22367 "top:1%;width:50%"; 22368 div.innerHTML = ""; 22369 documentElement.appendChild( container ); 22370 22371 var divStyle = window.getComputedStyle( div ); 22372 pixelPositionVal = divStyle.top !== "1%"; 22373 22374 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 22375 reliableMarginLeftVal = divStyle.marginLeft === "2px"; 22376 boxSizingReliableVal = divStyle.width === "4px"; 22377 22378 // Support: Android 4.0 - 4.3 only 22379 // Some styles come back with percentage values, even though they shouldn't 22380 div.style.marginRight = "50%"; 22381 pixelMarginRightVal = divStyle.marginRight === "4px"; 22382 22383 documentElement.removeChild( container ); 22384 22385 // Nullify the div so it wouldn't be stored in the memory and 22386 // it will also be a sign that checks already performed 22387 div = null; 22388 } 22389 22390 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, 22391 container = document.createElement( "div" ), 22392 div = document.createElement( "div" ); 22393 22394 // Finish early in limited (non-browser) environments 22395 if ( !div.style ) { 22396 return; 22397 } 22398 22399 // Support: IE <=9 - 11 only 22400 // Style of cloned element affects source element cloned (#8908) 22401 div.style.backgroundClip = "content-box"; 22402 div.cloneNode( true ).style.backgroundClip = ""; 22403 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 22404 22405 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + 22406 "padding:0;margin-top:1px;position:absolute"; 22407 container.appendChild( div ); 22408 22409 jQuery.extend( support, { 22410 pixelPosition: function() { 22411 computeStyleTests(); 22412 return pixelPositionVal; 22413 }, 22414 boxSizingReliable: function() { 22415 computeStyleTests(); 22416 return boxSizingReliableVal; 22417 }, 22418 pixelMarginRight: function() { 22419 computeStyleTests(); 22420 return pixelMarginRightVal; 22421 }, 22422 reliableMarginLeft: function() { 22423 computeStyleTests(); 22424 return reliableMarginLeftVal; 22425 } 22426 } ); 22427 } )(); 22428 22429 22430 function curCSS( elem, name, computed ) { 22431 var width, minWidth, maxWidth, ret, 22432 22433 // Support: Firefox 51+ 22434 // Retrieving style before computed somehow 22435 // fixes an issue with getting wrong values 22436 // on detached elements 22437 style = elem.style; 22438 22439 computed = computed || getStyles( elem ); 22440 22441 // getPropertyValue is needed for: 22442 // .css('filter') (IE 9 only, #12537) 22443 // .css('--customProperty) (#3144) 22444 if ( computed ) { 22445 ret = computed.getPropertyValue( name ) || computed[ name ]; 22446 22447 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { 22448 ret = jQuery.style( elem, name ); 22449 } 22450 22451 // A tribute to the "awesome hack by Dean Edwards" 22452 // Android Browser returns percentage for some values, 22453 // but width seems to be reliably pixels. 22454 // This is against the CSSOM draft spec: 22455 // https://drafts.csswg.org/cssom/#resolved-values 22456 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { 22457 22458 // Remember the original values 22459 width = style.width; 22460 minWidth = style.minWidth; 22461 maxWidth = style.maxWidth; 22462 22463 // Put in the new values to get a computed value out 22464 style.minWidth = style.maxWidth = style.width = ret; 22465 ret = computed.width; 22466 22467 // Revert the changed values 22468 style.width = width; 22469 style.minWidth = minWidth; 22470 style.maxWidth = maxWidth; 22471 } 22472 } 22473 22474 return ret !== undefined ? 22475
vendor: 7,304 bytes, lines 22476-22737
22476 // Support: IE <=9 - 11 only 22477 // IE returns zIndex value as an integer. 22478 ret + "" : 22479 ret; 22480 } 22481 22482 22483 function addGetHookIf( conditionFn, hookFn ) { 22484 22485 // Define the hook, we'll check on the first run if it's really needed. 22486 return { 22487 get: function() { 22488 if ( conditionFn() ) { 22489 22490 // Hook not needed (or it's not possible to use it due 22491 // to missing dependency), remove it. 22492 delete this.get; 22493 return; 22494 } 22495 22496 // Hook needed; redefine it so that the support test is not executed again. 22497 return ( this.get = hookFn ).apply( this, arguments ); 22498 } 22499 }; 22500 } 22501 22502 22503 var 22504 22505 // Swappable if display is none or starts with table 22506 // except "table", "table-cell", or "table-caption" 22507 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 22508 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 22509 rcustomProp = /^--/, 22510 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 22511 cssNormalTransform = { 22512 letterSpacing: "0", 22513 fontWeight: "400" 22514 }, 22515 22516 cssPrefixes = [ "Webkit", "Moz", "ms" ], 22517 emptyStyle = document.createElement( "div" ).style; 22518 22519 // Return a css property mapped to a potentially vendor prefixed property 22520 function vendorPropName( name ) { 22521 22522 // Shortcut for names that are not vendor prefixed 22523 if ( name in emptyStyle ) { 22524 return name; 22525 } 22526 22527 // Check for vendor prefixed names 22528 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 22529 i = cssPrefixes.length; 22530 22531 while ( i-- ) { 22532 name = cssPrefixes[ i ] + capName; 22533 if ( name in emptyStyle ) { 22534 return name; 22535 } 22536 } 22537 } 22538 22539 // Return a property mapped along what jQuery.cssProps suggests or to 22540 // a vendor prefixed property. 22541 function finalPropName( name ) { 22542 var ret = jQuery.cssProps[ name ]; 22543 if ( !ret ) { 22544 ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; 22545 } 22546 return ret; 22547 } 22548 22549 function setPositiveNumber( elem, value, subtract ) { 22550 22551 // Any relative (+/-) values have already been 22552 // normalized at this point 22553 var matches = rcssNum.exec( value ); 22554 return matches ? 22555 22556 // Guard against undefined "subtract", e.g., when used as in cssHooks 22557 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 22558 value; 22559 } 22560 22561 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 22562 var i, 22563 val = 0; 22564 22565 // If we already have the right measurement, avoid augmentation 22566 if ( extra === ( isBorderBox ? "border" : "content" ) ) { 22567 i = 4; 22568 22569 // Otherwise initialize for horizontal or vertical properties 22570 } else { 22571 i = name === "width" ? 1 : 0; 22572 } 22573 22574 for ( ; i < 4; i += 2 ) { 22575 22576 // Both box models exclude margin, so add it if we want it 22577 if ( extra === "margin" ) { 22578 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 22579 } 22580 22581 if ( isBorderBox ) { 22582 22583 // border-box includes padding, so remove it if we want content 22584 if ( extra === "content" ) { 22585 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 22586 } 22587 22588 // At this point, extra isn't border nor margin, so remove border 22589 if ( extra !== "margin" ) { 22590 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 22591 } 22592 } else { 22593 22594 // At this point, extra isn't content, so add padding 22595 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 22596 22597 // At this point, extra isn't content nor padding, so add border 22598 if ( extra !== "padding" ) { 22599 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 22600 } 22601 } 22602 } 22603 22604 return val; 22605 } 22606 22607 function getWidthOrHeight( elem, name, extra ) { 22608 22609 // Start with computed style 22610 var valueIsBorderBox, 22611 styles = getStyles( elem ), 22612 val = curCSS( elem, name, styles ), 22613 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 22614 22615 // Computed unit is not pixels. Stop here and return. 22616 if ( rnumnonpx.test( val ) ) { 22617 return val; 22618 } 22619 22620 // Check for style in case a browser which returns unreliable values 22621 // for getComputedStyle silently falls back to the reliable elem.style 22622 valueIsBorderBox = isBorderBox && 22623 ( support.boxSizingReliable() || val === elem.style[ name ] ); 22624 22625 // Fall back to offsetWidth/Height when value is "auto" 22626 // This happens for inline elements with no explicit setting (gh-3571) 22627 if ( val === "auto" ) { 22628 val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; 22629 } 22630 22631 // Normalize "", auto, and prepare for extra 22632 val = parseFloat( val ) || 0; 22633 22634 // Use the active box-sizing model to add/subtract irrelevant styles 22635 return ( val + 22636 augmentWidthOrHeight( 22637 elem, 22638 name, 22639 extra || ( isBorderBox ? "border" : "content" ), 22640 valueIsBorderBox, 22641 styles 22642 ) 22643 ) + "px"; 22644 } 22645 22646 jQuery.extend( { 22647 22648 // Add in style property hooks for overriding the default 22649 // behavior of getting and setting a style property 22650 cssHooks: { 22651 opacity: { 22652 get: function( elem, computed ) { 22653 if ( computed ) { 22654 22655 // We should always get a number back from opacity 22656 var ret = curCSS( elem, "opacity" ); 22657 return ret === "" ? "1" : ret; 22658 } 22659 } 22660 } 22661 }, 22662 22663 // Don't automatically add "px" to these possibly-unitless properties 22664 cssNumber: { 22665 "animationIterationCount": true, 22666 "columnCount": true, 22667 "fillOpacity": true, 22668 "flexGrow": true, 22669 "flexShrink": true, 22670 "fontWeight": true, 22671 "lineHeight": true, 22672 "opacity": true, 22673 "order": true, 22674 "orphans": true, 22675 "widows": true, 22676 "zIndex": true, 22677 "zoom": true 22678 }, 22679 22680 // Add in properties whose names you wish to fix before 22681 // setting or getting the value 22682 cssProps: { 22683 "float": "cssFloat" 22684 }, 22685 22686 // Get and set the style property on a DOM Node 22687 style: function( elem, name, value, extra ) { 22688 22689 // Don't set styles on text and comment nodes 22690 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 22691 return; 22692 } 22693 22694 // Make sure that we're working with the right name 22695 var ret, type, hooks, 22696 origName = jQuery.camelCase( name ), 22697 isCustomProp = rcustomProp.test( name ), 22698 style = elem.style; 22699 22700 // Make sure that we're working with the right name. We don't 22701 // want to query the value if it is a CSS custom property 22702 // since they are user-defined. 22703 if ( !isCustomProp ) { 22704 name = finalPropName( origName ); 22705 } 22706 22707 // Gets hook for the prefixed version, then unprefixed version 22708 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 22709 22710 // Check if we're setting a value 22711 if ( value !== undefined ) { 22712 type = typeof value; 22713 22714 // Convert "+=" or "-=" to relative numbers (#7345) 22715 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 22716 value = adjustCSS( elem, name, ret ); 22717 22718 // Fixes bug #9237 22719 type = "number"; 22720 } 22721 22722 // Make sure that null and NaN values aren't set (#7116) 22723 if ( value == null || value !== value ) { 22724 return; 22725 } 22726 22727 // If a number was passed in, add the unit (except for certain CSS properties) 22728 if ( type === "number" ) { 22729 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 22730 } 22731 22732 // background-* props affect original clone's values 22733 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 22734 style[ name ] = "inherit"; 22735 } 22736 22737 // If a hook was provided, use that value, otherwise just set the specified value
vendor: 5,752 bytes, lines 22738-22949
22738 if ( !hooks || !( "set" in hooks ) || 22739 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 22740 22741 if ( isCustomProp ) { 22742 style.setProperty( name, value ); 22743 } else { 22744 style[ name ] = value; 22745 } 22746 } 22747 22748 } else { 22749 22750 // If a hook was provided get the non-computed value from there 22751 if ( hooks && "get" in hooks && 22752 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 22753 22754 return ret; 22755 } 22756 22757 // Otherwise just get the value from the style object 22758 return style[ name ]; 22759 } 22760 }, 22761 22762 css: function( elem, name, extra, styles ) { 22763 var val, num, hooks, 22764 origName = jQuery.camelCase( name ), 22765 isCustomProp = rcustomProp.test( name ); 22766 22767 // Make sure that we're working with the right name. We don't 22768 // want to modify the value if it is a CSS custom property 22769 // since they are user-defined. 22770 if ( !isCustomProp ) { 22771 name = finalPropName( origName ); 22772 } 22773 22774 // Try prefixed name followed by the unprefixed name 22775 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 22776 22777 // If a hook was provided get the computed value from there 22778 if ( hooks && "get" in hooks ) { 22779 val = hooks.get( elem, true, extra ); 22780 } 22781 22782 // Otherwise, if a way to get the computed value exists, use that 22783 if ( val === undefined ) { 22784 val = curCSS( elem, name, styles ); 22785 } 22786 22787 // Convert "normal" to computed value 22788 if ( val === "normal" && name in cssNormalTransform ) { 22789 val = cssNormalTransform[ name ]; 22790 } 22791 22792 // Make numeric if forced or a qualifier was provided and val looks numeric 22793 if ( extra === "" || extra ) { 22794 num = parseFloat( val ); 22795 return extra === true || isFinite( num ) ? num || 0 : val; 22796 } 22797 22798 return val; 22799 } 22800 } ); 22801 22802 jQuery.each( [ "height", "width" ], function( i, name ) { 22803 jQuery.cssHooks[ name ] = { 22804 get: function( elem, computed, extra ) { 22805 if ( computed ) { 22806 22807 // Certain elements can have dimension info if we invisibly show them 22808 // but it must have a current display style that would benefit 22809 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 22810 22811 // Support: Safari 8+ 22812 // Table columns in Safari have non-zero offsetWidth & zero 22813 // getBoundingClientRect().width unless display is changed. 22814 // Support: IE <=11 only 22815 // Running getBoundingClientRect on a disconnected node 22816 // in IE throws an error. 22817 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 22818 swap( elem, cssShow, function() { 22819 return getWidthOrHeight( elem, name, extra ); 22820 } ) : 22821 getWidthOrHeight( elem, name, extra ); 22822 } 22823 }, 22824 22825 set: function( elem, value, extra ) { 22826 var matches, 22827 styles = extra && getStyles( elem ), 22828 subtract = extra && augmentWidthOrHeight( 22829 elem, 22830 name, 22831 extra, 22832 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 22833 styles 22834 ); 22835 22836 // Convert to pixels if value adjustment is needed 22837 if ( subtract && ( matches = rcssNum.exec( value ) ) && 22838 ( matches[ 3 ] || "px" ) !== "px" ) { 22839 22840 elem.style[ name ] = value; 22841 value = jQuery.css( elem, name ); 22842 } 22843 22844 return setPositiveNumber( elem, value, subtract ); 22845 } 22846 }; 22847 } ); 22848 22849 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 22850 function( elem, computed ) { 22851 if ( computed ) { 22852 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 22853 elem.getBoundingClientRect().left - 22854 swap( elem, { marginLeft: 0 }, function() { 22855 return elem.getBoundingClientRect().left; 22856 } ) 22857 ) + "px"; 22858 } 22859 } 22860 ); 22861 22862 // These hooks are used by animate to expand properties 22863 jQuery.each( { 22864 margin: "", 22865 padding: "", 22866 border: "Width" 22867 }, function( prefix, suffix ) { 22868 jQuery.cssHooks[ prefix + suffix ] = { 22869 expand: function( value ) { 22870 var i = 0, 22871 expanded = {}, 22872 22873 // Assumes a single number if not a string 22874 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 22875 22876 for ( ; i < 4; i++ ) { 22877 expanded[ prefix + cssExpand[ i ] + suffix ] = 22878 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 22879 } 22880 22881 return expanded; 22882 } 22883 }; 22884 22885 if ( !rmargin.test( prefix ) ) { 22886 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 22887 } 22888 } ); 22889 22890 jQuery.fn.extend( { 22891 css: function( name, value ) { 22892 return access( this, function( elem, name, value ) { 22893 var styles, len, 22894 map = {}, 22895 i = 0; 22896 22897 if ( Array.isArray( name ) ) { 22898 styles = getStyles( elem ); 22899 len = name.length; 22900 22901 for ( ; i < len; i++ ) { 22902 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 22903 } 22904 22905 return map; 22906 } 22907 22908 return value !== undefined ? 22909 jQuery.style( elem, name, value ) : 22910 jQuery.css( elem, name ); 22911 }, name, value, arguments.length > 1 ); 22912 } 22913 } ); 22914 22915 22916 function Tween( elem, options, prop, end, easing ) { 22917 return new Tween.prototype.init( elem, options, prop, end, easing ); 22918 } 22919 jQuery.Tween = Tween; 22920 22921 Tween.prototype = { 22922 constructor: Tween, 22923 init: function( elem, options, prop, end, easing, unit ) { 22924 this.elem = elem; 22925 this.prop = prop; 22926 this.easing = easing || jQuery.easing._default; 22927 this.options = options; 22928 this.start = this.now = this.cur(); 22929 this.end = end; 22930 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 22931 }, 22932 cur: function() { 22933 var hooks = Tween.propHooks[ this.prop ]; 22934 22935 return hooks && hooks.get ? 22936 hooks.get( this ) : 22937 Tween.propHooks._default.get( this ); 22938 }, 22939 run: function( percent ) { 22940 var eased, 22941 hooks = Tween.propHooks[ this.prop ]; 22942 22943 if ( this.options.duration ) { 22944 this.pos = eased = jQuery.easing[ this.easing ]( 22945 percent, this.options.duration * percent, 0, 1, this.options.duration 22946 ); 22947 } else { 22948 this.pos = eased = percent; 22949 }
vendor: 5,594 bytes, lines 22950-23159
22950 this.now = ( this.end - this.start ) * eased + this.start; 22951 22952 if ( this.options.step ) { 22953 this.options.step.call( this.elem, this.now, this ); 22954 } 22955 22956 if ( hooks && hooks.set ) { 22957 hooks.set( this ); 22958 } else { 22959 Tween.propHooks._default.set( this ); 22960 } 22961 return this; 22962 } 22963 }; 22964 22965 Tween.prototype.init.prototype = Tween.prototype; 22966 22967 Tween.propHooks = { 22968 _default: { 22969 get: function( tween ) { 22970 var result; 22971 22972 // Use a property on the element directly when it is not a DOM element, 22973 // or when there is no matching style property that exists. 22974 if ( tween.elem.nodeType !== 1 || 22975 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 22976 return tween.elem[ tween.prop ]; 22977 } 22978 22979 // Passing an empty string as a 3rd parameter to .css will automatically 22980 // attempt a parseFloat and fallback to a string if the parse fails. 22981 // Simple values such as "10px" are parsed to Float; 22982 // complex values such as "rotate(1rad)" are returned as-is. 22983 result = jQuery.css( tween.elem, tween.prop, "" ); 22984 22985 // Empty strings, null, undefined and "auto" are converted to 0. 22986 return !result || result === "auto" ? 0 : result; 22987 }, 22988 set: function( tween ) { 22989 22990 // Use step hook for back compat. 22991 // Use cssHook if its there. 22992 // Use .style if available and use plain properties where available. 22993 if ( jQuery.fx.step[ tween.prop ] ) { 22994 jQuery.fx.step[ tween.prop ]( tween ); 22995 } else if ( tween.elem.nodeType === 1 && 22996 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 22997 jQuery.cssHooks[ tween.prop ] ) ) { 22998 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 22999 } else { 23000 tween.elem[ tween.prop ] = tween.now; 23001 } 23002 } 23003 } 23004 }; 23005 23006 // Support: IE <=9 only 23007 // Panic based approach to setting things on disconnected nodes 23008 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 23009 set: function( tween ) { 23010 if ( tween.elem.nodeType && tween.elem.parentNode ) { 23011 tween.elem[ tween.prop ] = tween.now; 23012 } 23013 } 23014 }; 23015 23016 jQuery.easing = { 23017 linear: function( p ) { 23018 return p; 23019 }, 23020 swing: function( p ) { 23021 return 0.5 - Math.cos( p * Math.PI ) / 2; 23022 }, 23023 _default: "swing" 23024 }; 23025 23026 jQuery.fx = Tween.prototype.init; 23027 23028 // Back compat <1.8 extension point 23029 jQuery.fx.step = {}; 23030 23031 23032 23033 23034 var 23035 fxNow, inProgress, 23036 rfxtypes = /^(?:toggle|show|hide)$/, 23037 rrun = /queueHooks$/; 23038 23039 function schedule() { 23040 if ( inProgress ) { 23041 if ( document.hidden === false && window.requestAnimationFrame ) { 23042 window.requestAnimationFrame( schedule ); 23043 } else { 23044 window.setTimeout( schedule, jQuery.fx.interval ); 23045 } 23046 23047 jQuery.fx.tick(); 23048 } 23049 } 23050 23051 // Animations created synchronously will run synchronously 23052 function createFxNow() { 23053 window.setTimeout( function() { 23054 fxNow = undefined; 23055 } ); 23056 return ( fxNow = jQuery.now() ); 23057 } 23058 23059 // Generate parameters to create a standard animation 23060 function genFx( type, includeWidth ) { 23061 var which, 23062 i = 0, 23063 attrs = { height: type }; 23064 23065 // If we include width, step value is 1 to do all cssExpand values, 23066 // otherwise step value is 2 to skip over Left and Right 23067 includeWidth = includeWidth ? 1 : 0; 23068 for ( ; i < 4; i += 2 - includeWidth ) { 23069 which = cssExpand[ i ]; 23070 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 23071 } 23072 23073 if ( includeWidth ) { 23074 attrs.opacity = attrs.width = type; 23075 } 23076 23077 return attrs; 23078 } 23079 23080 function createTween( value, prop, animation ) { 23081 var tween, 23082 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 23083 index = 0, 23084 length = collection.length; 23085 for ( ; index < length; index++ ) { 23086 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 23087 23088 // We're done with this property 23089 return tween; 23090 } 23091 } 23092 } 23093 23094 function defaultPrefilter( elem, props, opts ) { 23095 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 23096 isBox = "width" in props || "height" in props, 23097 anim = this, 23098 orig = {}, 23099 style = elem.style, 23100 hidden = elem.nodeType && isHiddenWithinTree( elem ), 23101 dataShow = dataPriv.get( elem, "fxshow" ); 23102 23103 // Queue-skipping animations hijack the fx hooks 23104 if ( !opts.queue ) { 23105 hooks = jQuery._queueHooks( elem, "fx" ); 23106 if ( hooks.unqueued == null ) { 23107 hooks.unqueued = 0; 23108 oldfire = hooks.empty.fire; 23109 hooks.empty.fire = function() { 23110 if ( !hooks.unqueued ) { 23111 oldfire(); 23112 } 23113 }; 23114 } 23115 hooks.unqueued++; 23116 23117 anim.always( function() { 23118 23119 // Ensure the complete handler is called before this completes 23120 anim.always( function() { 23121 hooks.unqueued--; 23122 if ( !jQuery.queue( elem, "fx" ).length ) { 23123 hooks.empty.fire(); 23124 } 23125 } ); 23126 } ); 23127 } 23128 23129 // Detect show/hide animations 23130 for ( prop in props ) { 23131 value = props[ prop ]; 23132 if ( rfxtypes.test( value ) ) { 23133 delete props[ prop ]; 23134 toggle = toggle || value === "toggle"; 23135 if ( value === ( hidden ? "hide" : "show" ) ) { 23136 23137 // Pretend to be hidden if this is a "show" and 23138 // there is still data from a stopped show/hide 23139 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 23140 hidden = true; 23141 23142 // Ignore all other no-op show/hide data 23143 } else { 23144 continue; 23145 } 23146 } 23147 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 23148 } 23149 } 23150 23151 // Bail out if this is a no-op like .hide().hide() 23152 propTween = !jQuery.isEmptyObject( props ); 23153 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 23154 return; 23155 } 23156 23157 // Restrict "overflow" and "display" styles during box animations 23158 if ( isBox && elem.nodeType === 1 ) { 23159
vendor: 4,169 bytes, lines 23160-23314
23160 // Support: IE <=9 - 11, Edge 12 - 13 23161 // Record all 3 overflow attributes because IE does not infer the shorthand 23162 // from identically-valued overflowX and overflowY 23163 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 23164 23165 // Identify a display type, preferring old show/hide data over the CSS cascade 23166 restoreDisplay = dataShow && dataShow.display; 23167 if ( restoreDisplay == null ) { 23168 restoreDisplay = dataPriv.get( elem, "display" ); 23169 } 23170 display = jQuery.css( elem, "display" ); 23171 if ( display === "none" ) { 23172 if ( restoreDisplay ) { 23173 display = restoreDisplay; 23174 } else { 23175 23176 // Get nonempty value(s) by temporarily forcing visibility 23177 showHide( [ elem ], true ); 23178 restoreDisplay = elem.style.display || restoreDisplay; 23179 display = jQuery.css( elem, "display" ); 23180 showHide( [ elem ] ); 23181 } 23182 } 23183 23184 // Animate inline elements as inline-block 23185 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 23186 if ( jQuery.css( elem, "float" ) === "none" ) { 23187 23188 // Restore the original display value at the end of pure show/hide animations 23189 if ( !propTween ) { 23190 anim.done( function() { 23191 style.display = restoreDisplay; 23192 } ); 23193 if ( restoreDisplay == null ) { 23194 display = style.display; 23195 restoreDisplay = display === "none" ? "" : display; 23196 } 23197 } 23198 style.display = "inline-block"; 23199 } 23200 } 23201 } 23202 23203 if ( opts.overflow ) { 23204 style.overflow = "hidden"; 23205 anim.always( function() { 23206 style.overflow = opts.overflow[ 0 ]; 23207 style.overflowX = opts.overflow[ 1 ]; 23208 style.overflowY = opts.overflow[ 2 ]; 23209 } ); 23210 } 23211 23212 // Implement show/hide animations 23213 propTween = false; 23214 for ( prop in orig ) { 23215 23216 // General show/hide setup for this element animation 23217 if ( !propTween ) { 23218 if ( dataShow ) { 23219 if ( "hidden" in dataShow ) { 23220 hidden = dataShow.hidden; 23221 } 23222 } else { 23223 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 23224 } 23225 23226 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 23227 if ( toggle ) { 23228 dataShow.hidden = !hidden; 23229 } 23230 23231 // Show elements before animating them 23232 if ( hidden ) { 23233 showHide( [ elem ], true ); 23234 } 23235 23236 /* eslint-disable no-loop-func */ 23237 23238 anim.done( function() { 23239 23240 /* eslint-enable no-loop-func */ 23241 23242 // The final step of a "hide" animation is actually hiding the element 23243 if ( !hidden ) { 23244 showHide( [ elem ] ); 23245 } 23246 dataPriv.remove( elem, "fxshow" ); 23247 for ( prop in orig ) { 23248 jQuery.style( elem, prop, orig[ prop ] ); 23249 } 23250 } ); 23251 } 23252 23253 // Per-property setup 23254 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 23255 if ( !( prop in dataShow ) ) { 23256 dataShow[ prop ] = propTween.start; 23257 if ( hidden ) { 23258 propTween.end = propTween.start; 23259 propTween.start = 0; 23260 } 23261 } 23262 } 23263 } 23264 23265 function propFilter( props, specialEasing ) { 23266 var index, name, easing, value, hooks; 23267 23268 // camelCase, specialEasing and expand cssHook pass 23269 for ( index in props ) { 23270 name = jQuery.camelCase( index ); 23271 easing = specialEasing[ name ]; 23272 value = props[ index ]; 23273 if ( Array.isArray( value ) ) { 23274 easing = value[ 1 ]; 23275 value = props[ index ] = value[ 0 ]; 23276 } 23277 23278 if ( index !== name ) { 23279 props[ name ] = value; 23280 delete props[ index ]; 23281 } 23282 23283 hooks = jQuery.cssHooks[ name ]; 23284 if ( hooks && "expand" in hooks ) { 23285 value = hooks.expand( value ); 23286 delete props[ name ]; 23287 23288 // Not quite $.extend, this won't overwrite existing keys. 23289 // Reusing 'index' because we have the correct "name" 23290 for ( index in value ) { 23291 if ( !( index in props ) ) { 23292 props[ index ] = value[ index ]; 23293 specialEasing[ index ] = easing; 23294 } 23295 } 23296 } else { 23297 specialEasing[ name ] = easing; 23298 } 23299 } 23300 } 23301 23302 function Animation( elem, properties, options ) { 23303 var result, 23304 stopped, 23305 index = 0, 23306 length = Animation.prefilters.length, 23307 deferred = jQuery.Deferred().always( function() { 23308 23309 // Don't match elem in the :animated selector 23310 delete tick.elem; 23311 } ), 23312 tick = function() { 23313 if ( stopped ) { 23314 return false;
vendor: 7,046 bytes, lines 23315-23578
23315 } 23316 var currentTime = fxNow || createFxNow(), 23317 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 23318 23319 // Support: Android 2.3 only 23320 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 23321 temp = remaining / animation.duration || 0, 23322 percent = 1 - temp, 23323 index = 0, 23324 length = animation.tweens.length; 23325 23326 for ( ; index < length; index++ ) { 23327 animation.tweens[ index ].run( percent ); 23328 } 23329 23330 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 23331 23332 // If there's more to do, yield 23333 if ( percent < 1 && length ) { 23334 return remaining; 23335 } 23336 23337 // If this was an empty animation, synthesize a final progress notification 23338 if ( !length ) { 23339 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 23340 } 23341 23342 // Resolve the animation and report its conclusion 23343 deferred.resolveWith( elem, [ animation ] ); 23344 return false; 23345 }, 23346 animation = deferred.promise( { 23347 elem: elem, 23348 props: jQuery.extend( {}, properties ), 23349 opts: jQuery.extend( true, { 23350 specialEasing: {}, 23351 easing: jQuery.easing._default 23352 }, options ), 23353 originalProperties: properties, 23354 originalOptions: options, 23355 startTime: fxNow || createFxNow(), 23356 duration: options.duration, 23357 tweens: [], 23358 createTween: function( prop, end ) { 23359 var tween = jQuery.Tween( elem, animation.opts, prop, end, 23360 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 23361 animation.tweens.push( tween ); 23362 return tween; 23363 }, 23364 stop: function( gotoEnd ) { 23365 var index = 0, 23366 23367 // If we are going to the end, we want to run all the tweens 23368 // otherwise we skip this part 23369 length = gotoEnd ? animation.tweens.length : 0; 23370 if ( stopped ) { 23371 return this; 23372 } 23373 stopped = true; 23374 for ( ; index < length; index++ ) { 23375 animation.tweens[ index ].run( 1 ); 23376 } 23377 23378 // Resolve when we played the last frame; otherwise, reject 23379 if ( gotoEnd ) { 23380 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 23381 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 23382 } else { 23383 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 23384 } 23385 return this; 23386 } 23387 } ), 23388 props = animation.props; 23389 23390 propFilter( props, animation.opts.specialEasing ); 23391 23392 for ( ; index < length; index++ ) { 23393 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 23394 if ( result ) { 23395 if ( jQuery.isFunction( result.stop ) ) { 23396 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 23397 jQuery.proxy( result.stop, result ); 23398 } 23399 return result; 23400 } 23401 } 23402 23403 jQuery.map( props, createTween, animation ); 23404 23405 if ( jQuery.isFunction( animation.opts.start ) ) { 23406 animation.opts.start.call( elem, animation ); 23407 } 23408 23409 // Attach callbacks from options 23410 animation 23411 .progress( animation.opts.progress ) 23412 .done( animation.opts.done, animation.opts.complete ) 23413 .fail( animation.opts.fail ) 23414 .always( animation.opts.always ); 23415 23416 jQuery.fx.timer( 23417 jQuery.extend( tick, { 23418 elem: elem, 23419 anim: animation, 23420 queue: animation.opts.queue 23421 } ) 23422 ); 23423 23424 return animation; 23425 } 23426 23427 jQuery.Animation = jQuery.extend( Animation, { 23428 23429 tweeners: { 23430 "*": [ function( prop, value ) { 23431 var tween = this.createTween( prop, value ); 23432 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 23433 return tween; 23434 } ] 23435 }, 23436 23437 tweener: function( props, callback ) { 23438 if ( jQuery.isFunction( props ) ) { 23439 callback = props; 23440 props = [ "*" ]; 23441 } else { 23442 props = props.match( rnothtmlwhite ); 23443 } 23444 23445 var prop, 23446 index = 0, 23447 length = props.length; 23448 23449 for ( ; index < length; index++ ) { 23450 prop = props[ index ]; 23451 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 23452 Animation.tweeners[ prop ].unshift( callback ); 23453 } 23454 }, 23455 23456 prefilters: [ defaultPrefilter ], 23457 23458 prefilter: function( callback, prepend ) { 23459 if ( prepend ) { 23460 Animation.prefilters.unshift( callback ); 23461 } else { 23462 Animation.prefilters.push( callback ); 23463 } 23464 } 23465 } ); 23466 23467 jQuery.speed = function( speed, easing, fn ) { 23468 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 23469 complete: fn || !fn && easing || 23470 jQuery.isFunction( speed ) && speed, 23471 duration: speed, 23472 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 23473 }; 23474 23475 // Go to the end state if fx are off 23476 if ( jQuery.fx.off ) { 23477 opt.duration = 0; 23478 23479 } else { 23480 if ( typeof opt.duration !== "number" ) { 23481 if ( opt.duration in jQuery.fx.speeds ) { 23482 opt.duration = jQuery.fx.speeds[ opt.duration ]; 23483 23484 } else { 23485 opt.duration = jQuery.fx.speeds._default; 23486 } 23487 } 23488 } 23489 23490 // Normalize opt.queue - true/undefined/null -> "fx" 23491 if ( opt.queue == null || opt.queue === true ) { 23492 opt.queue = "fx"; 23493 } 23494 23495 // Queueing 23496 opt.old = opt.complete; 23497 23498 opt.complete = function() { 23499 if ( jQuery.isFunction( opt.old ) ) { 23500 opt.old.call( this ); 23501 } 23502 23503 if ( opt.queue ) { 23504 jQuery.dequeue( this, opt.queue ); 23505 } 23506 }; 23507 23508 return opt; 23509 }; 23510 23511 jQuery.fn.extend( { 23512 fadeTo: function( speed, to, easing, callback ) { 23513 23514 // Show any hidden elements after setting opacity to 0 23515 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 23516 23517 // Animate to the value specified 23518 .end().animate( { opacity: to }, speed, easing, callback ); 23519 }, 23520 animate: function( prop, speed, easing, callback ) { 23521 var empty = jQuery.isEmptyObject( prop ), 23522 optall = jQuery.speed( speed, easing, callback ), 23523 doAnimation = function() { 23524 23525 // Operate on a copy of prop so per-property easing won't be lost 23526 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 23527 23528 // Empty animations, or finishing resolves immediately 23529 if ( empty || dataPriv.get( this, "finish" ) ) { 23530 anim.stop( true ); 23531 } 23532 }; 23533 doAnimation.finish = doAnimation; 23534 23535 return empty || optall.queue === false ? 23536 this.each( doAnimation ) : 23537 this.queue( optall.queue, doAnimation ); 23538 }, 23539 stop: function( type, clearQueue, gotoEnd ) { 23540 var stopQueue = function( hooks ) { 23541 var stop = hooks.stop; 23542 delete hooks.stop; 23543 stop( gotoEnd ); 23544 }; 23545 23546 if ( typeof type !== "string" ) { 23547 gotoEnd = clearQueue; 23548 clearQueue = type; 23549 type = undefined; 23550 } 23551 if ( clearQueue && type !== false ) { 23552 this.queue( type || "fx", [] ); 23553 } 23554 23555 return this.each( function() { 23556 var dequeue = true, 23557 index = type != null && type + "queueHooks", 23558 timers = jQuery.timers, 23559 data = dataPriv.get( this ); 23560 23561 if ( index ) { 23562 if ( data[ index ] && data[ index ].stop ) { 23563 stopQueue( data[ index ] ); 23564 } 23565 } else { 23566 for ( index in data ) { 23567 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 23568 stopQueue( data[ index ] ); 23569 } 23570 } 23571 } 23572 23573 for ( index = timers.length; index--; ) { 23574 if ( timers[ index ].elem === this && 23575 ( type == null || timers[ index ].queue === type ) ) { 23576 23577 timers[ index ].anim.stop( gotoEnd ); 23578 dequeue = false;
vendor: 8,484 bytes, lines 23579-23930
23579 timers.splice( index, 1 ); 23580 } 23581 } 23582 23583 // Start the next in the queue if the last step wasn't forced. 23584 // Timers currently will call their complete callbacks, which 23585 // will dequeue but only if they were gotoEnd. 23586 if ( dequeue || !gotoEnd ) { 23587 jQuery.dequeue( this, type ); 23588 } 23589 } ); 23590 }, 23591 finish: function( type ) { 23592 if ( type !== false ) { 23593 type = type || "fx"; 23594 } 23595 return this.each( function() { 23596 var index, 23597 data = dataPriv.get( this ), 23598 queue = data[ type + "queue" ], 23599 hooks = data[ type + "queueHooks" ], 23600 timers = jQuery.timers, 23601 length = queue ? queue.length : 0; 23602 23603 // Enable finishing flag on private data 23604 data.finish = true; 23605 23606 // Empty the queue first 23607 jQuery.queue( this, type, [] ); 23608 23609 if ( hooks && hooks.stop ) { 23610 hooks.stop.call( this, true ); 23611 } 23612 23613 // Look for any active animations, and finish them 23614 for ( index = timers.length; index--; ) { 23615 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 23616 timers[ index ].anim.stop( true ); 23617 timers.splice( index, 1 ); 23618 } 23619 } 23620 23621 // Look for any animations in the old queue and finish them 23622 for ( index = 0; index < length; index++ ) { 23623 if ( queue[ index ] && queue[ index ].finish ) { 23624 queue[ index ].finish.call( this ); 23625 } 23626 } 23627 23628 // Turn off finishing flag 23629 delete data.finish; 23630 } ); 23631 } 23632 } ); 23633 23634 jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 23635 var cssFn = jQuery.fn[ name ]; 23636 jQuery.fn[ name ] = function( speed, easing, callback ) { 23637 return speed == null || typeof speed === "boolean" ? 23638 cssFn.apply( this, arguments ) : 23639 this.animate( genFx( name, true ), speed, easing, callback ); 23640 }; 23641 } ); 23642 23643 // Generate shortcuts for custom animations 23644 jQuery.each( { 23645 slideDown: genFx( "show" ), 23646 slideUp: genFx( "hide" ), 23647 slideToggle: genFx( "toggle" ), 23648 fadeIn: { opacity: "show" }, 23649 fadeOut: { opacity: "hide" }, 23650 fadeToggle: { opacity: "toggle" } 23651 }, function( name, props ) { 23652 jQuery.fn[ name ] = function( speed, easing, callback ) { 23653 return this.animate( props, speed, easing, callback ); 23654 }; 23655 } ); 23656 23657 jQuery.timers = []; 23658 jQuery.fx.tick = function() { 23659 var timer, 23660 i = 0, 23661 timers = jQuery.timers; 23662 23663 fxNow = jQuery.now(); 23664 23665 for ( ; i < timers.length; i++ ) { 23666 timer = timers[ i ]; 23667 23668 // Run the timer and safely remove it when done (allowing for external removal) 23669 if ( !timer() && timers[ i ] === timer ) { 23670 timers.splice( i--, 1 ); 23671 } 23672 } 23673 23674 if ( !timers.length ) { 23675 jQuery.fx.stop(); 23676 } 23677 fxNow = undefined; 23678 }; 23679 23680 jQuery.fx.timer = function( timer ) { 23681 jQuery.timers.push( timer ); 23682 jQuery.fx.start(); 23683 }; 23684 23685 jQuery.fx.interval = 13; 23686 jQuery.fx.start = function() { 23687 if ( inProgress ) { 23688 return; 23689 } 23690 23691 inProgress = true; 23692 schedule(); 23693 }; 23694 23695 jQuery.fx.stop = function() { 23696 inProgress = null; 23697 }; 23698 23699 jQuery.fx.speeds = { 23700 slow: 600, 23701 fast: 200, 23702 23703 // Default speed 23704 _default: 400 23705 }; 23706 23707 23708 // Based off of the plugin by Clint Helfers, with permission. 23709 // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 23710 jQuery.fn.delay = function( time, type ) { 23711 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 23712 type = type || "fx"; 23713 23714 return this.queue( type, function( next, hooks ) { 23715 var timeout = window.setTimeout( next, time ); 23716 hooks.stop = function() { 23717 window.clearTimeout( timeout ); 23718 }; 23719 } ); 23720 }; 23721 23722 23723 ( function() { 23724 var input = document.createElement( "input" ), 23725 select = document.createElement( "select" ), 23726 opt = select.appendChild( document.createElement( "option" ) ); 23727 23728 input.type = "checkbox"; 23729 23730 // Support: Android <=4.3 only 23731 // Default value for a checkbox should be "on" 23732 support.checkOn = input.value !== ""; 23733 23734 // Support: IE <=11 only 23735 // Must access selectedIndex to make default options select 23736 support.optSelected = opt.selected; 23737 23738 // Support: IE <=11 only 23739 // An input loses its value after becoming a radio 23740 input = document.createElement( "input" ); 23741 input.value = "t"; 23742 input.type = "radio"; 23743 support.radioValue = input.value === "t"; 23744 } )(); 23745 23746 23747 var boolHook, 23748 attrHandle = jQuery.expr.attrHandle; 23749 23750 jQuery.fn.extend( { 23751 attr: function( name, value ) { 23752 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 23753 }, 23754 23755 removeAttr: function( name ) { 23756 return this.each( function() { 23757 jQuery.removeAttr( this, name ); 23758 } ); 23759 } 23760 } ); 23761 23762 jQuery.extend( { 23763 attr: function( elem, name, value ) { 23764 var ret, hooks, 23765 nType = elem.nodeType; 23766 23767 // Don't get/set attributes on text, comment and attribute nodes 23768 if ( nType === 3 || nType === 8 || nType === 2 ) { 23769 return; 23770 } 23771 23772 // Fallback to prop when attributes are not supported 23773 if ( typeof elem.getAttribute === "undefined" ) { 23774 return jQuery.prop( elem, name, value ); 23775 } 23776 23777 // Attribute hooks are determined by the lowercase version 23778 // Grab necessary hook if one is defined 23779 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 23780 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 23781 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 23782 } 23783 23784 if ( value !== undefined ) { 23785 if ( value === null ) { 23786 jQuery.removeAttr( elem, name ); 23787 return; 23788 } 23789 23790 if ( hooks && "set" in hooks && 23791 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 23792 return ret; 23793 } 23794 23795 elem.setAttribute( name, value + "" ); 23796 return value; 23797 } 23798 23799 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 23800 return ret; 23801 } 23802 23803 ret = jQuery.find.attr( elem, name ); 23804 23805 // Non-existent attributes return null, we normalize to undefined 23806 return ret == null ? undefined : ret; 23807 }, 23808 23809 attrHooks: { 23810 type: { 23811 set: function( elem, value ) { 23812 if ( !support.radioValue && value === "radio" && 23813 nodeName( elem, "input" ) ) { 23814 var val = elem.value; 23815 elem.setAttribute( "type", value ); 23816 if ( val ) { 23817 elem.value = val; 23818 } 23819 return value; 23820 } 23821 } 23822 } 23823 }, 23824 23825 removeAttr: function( elem, value ) { 23826 var name, 23827 i = 0, 23828 23829 // Attribute names can contain non-HTML whitespace characters 23830 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 23831 attrNames = value && value.match( rnothtmlwhite ); 23832 23833 if ( attrNames && elem.nodeType === 1 ) { 23834 while ( ( name = attrNames[ i++ ] ) ) { 23835 elem.removeAttribute( name ); 23836 } 23837 } 23838 } 23839 } ); 23840 23841 // Hooks for boolean attributes 23842 boolHook = { 23843 set: function( elem, value, name ) { 23844 if ( value === false ) { 23845 23846 // Remove boolean attributes when set to false 23847 jQuery.removeAttr( elem, name ); 23848 } else { 23849 elem.setAttribute( name, name ); 23850 } 23851 return name; 23852 } 23853 }; 23854 23855 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 23856 var getter = attrHandle[ name ] || jQuery.find.attr; 23857 23858 attrHandle[ name ] = function( elem, name, isXML ) { 23859 var ret, handle, 23860 lowercaseName = name.toLowerCase(); 23861 23862 if ( !isXML ) { 23863 23864 // Avoid an infinite loop by temporarily removing this function from the getter 23865 handle = attrHandle[ lowercaseName ]; 23866 attrHandle[ lowercaseName ] = ret; 23867 ret = getter( elem, name, isXML ) != null ? 23868 lowercaseName : 23869 null; 23870 attrHandle[ lowercaseName ] = handle; 23871 } 23872 return ret; 23873 }; 23874 } ); 23875 23876 23877 23878 23879 var rfocusable = /^(?:input|select|textarea|button)$/i, 23880 rclickable = /^(?:a|area)$/i; 23881 23882 jQuery.fn.extend( { 23883 prop: function( name, value ) { 23884 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 23885 }, 23886 23887 removeProp: function( name ) { 23888 return this.each( function() { 23889 delete this[ jQuery.propFix[ name ] || name ]; 23890 } ); 23891 } 23892 } ); 23893 23894 jQuery.extend( { 23895 prop: function( elem, name, value ) { 23896 var ret, hooks, 23897 nType = elem.nodeType; 23898 23899 // Don't get/set properties on text, comment and attribute nodes 23900 if ( nType === 3 || nType === 8 || nType === 2 ) { 23901 return; 23902 } 23903 23904 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 23905 23906 // Fix name and attach hooks 23907 name = jQuery.propFix[ name ] || name; 23908 hooks = jQuery.propHooks[ name ]; 23909 } 23910 23911 if ( value !== undefined ) { 23912 if ( hooks && "set" in hooks && 23913 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 23914 return ret; 23915 } 23916 23917 return ( elem[ name ] = value ); 23918 } 23919 23920 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 23921 return ret; 23922 } 23923 23924 return elem[ name ]; 23925 }, 23926 23927 propHooks: { 23928 tabIndex: { 23929 get: function( elem ) { 23930
vendor: 6,276 bytes, lines 23931-24182
23931 // Support: IE <=9 - 11 only 23932 // elem.tabIndex doesn't always return the 23933 // correct value when it hasn't been explicitly set 23934 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 23935 // Use proper attribute retrieval(#12072) 23936 var tabindex = jQuery.find.attr( elem, "tabindex" ); 23937 23938 if ( tabindex ) { 23939 return parseInt( tabindex, 10 ); 23940 } 23941 23942 if ( 23943 rfocusable.test( elem.nodeName ) || 23944 rclickable.test( elem.nodeName ) && 23945 elem.href 23946 ) { 23947 return 0; 23948 } 23949 23950 return -1; 23951 } 23952 } 23953 }, 23954 23955 propFix: { 23956 "for": "htmlFor", 23957 "class": "className" 23958 } 23959 } ); 23960 23961 // Support: IE <=11 only 23962 // Accessing the selectedIndex property 23963 // forces the browser to respect setting selected 23964 // on the option 23965 // The getter ensures a default option is selected 23966 // when in an optgroup 23967 // eslint rule "no-unused-expressions" is disabled for this code 23968 // since it considers such accessions noop 23969 if ( !support.optSelected ) { 23970 jQuery.propHooks.selected = { 23971 get: function( elem ) { 23972 23973 /* eslint no-unused-expressions: "off" */ 23974 23975 var parent = elem.parentNode; 23976 if ( parent && parent.parentNode ) { 23977 parent.parentNode.selectedIndex; 23978 } 23979 return null; 23980 }, 23981 set: function( elem ) { 23982 23983 /* eslint no-unused-expressions: "off" */ 23984 23985 var parent = elem.parentNode; 23986 if ( parent ) { 23987 parent.selectedIndex; 23988 23989 if ( parent.parentNode ) { 23990 parent.parentNode.selectedIndex; 23991 } 23992 } 23993 } 23994 }; 23995 } 23996 23997 jQuery.each( [ 23998 "tabIndex", 23999 "readOnly", 24000 "maxLength", 24001 "cellSpacing", 24002 "cellPadding", 24003 "rowSpan", 24004 "colSpan", 24005 "useMap", 24006 "frameBorder", 24007 "contentEditable" 24008 ], function() { 24009 jQuery.propFix[ this.toLowerCase() ] = this; 24010 } ); 24011 24012 24013 24014 24015 // Strip and collapse whitespace according to HTML spec 24016 // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace 24017 function stripAndCollapse( value ) { 24018 var tokens = value.match( rnothtmlwhite ) || []; 24019 return tokens.join( " " ); 24020 } 24021 24022 24023 function getClass( elem ) { 24024 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 24025 } 24026 24027 jQuery.fn.extend( { 24028 addClass: function( value ) { 24029 var classes, elem, cur, curValue, clazz, j, finalValue, 24030 i = 0; 24031 24032 if ( jQuery.isFunction( value ) ) { 24033 return this.each( function( j ) { 24034 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 24035 } ); 24036 } 24037 24038 if ( typeof value === "string" && value ) { 24039 classes = value.match( rnothtmlwhite ) || []; 24040 24041 while ( ( elem = this[ i++ ] ) ) { 24042 curValue = getClass( elem ); 24043 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 24044 24045 if ( cur ) { 24046 j = 0; 24047 while ( ( clazz = classes[ j++ ] ) ) { 24048 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 24049 cur += clazz + " "; 24050 } 24051 } 24052 24053 // Only assign if different to avoid unneeded rendering. 24054 finalValue = stripAndCollapse( cur ); 24055 if ( curValue !== finalValue ) { 24056 elem.setAttribute( "class", finalValue ); 24057 } 24058 } 24059 } 24060 } 24061 24062 return this; 24063 }, 24064 24065 removeClass: function( value ) { 24066 var classes, elem, cur, curValue, clazz, j, finalValue, 24067 i = 0; 24068 24069 if ( jQuery.isFunction( value ) ) { 24070 return this.each( function( j ) { 24071 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 24072 } ); 24073 } 24074 24075 if ( !arguments.length ) { 24076 return this.attr( "class", "" ); 24077 } 24078 24079 if ( typeof value === "string" && value ) { 24080 classes = value.match( rnothtmlwhite ) || []; 24081 24082 while ( ( elem = this[ i++ ] ) ) { 24083 curValue = getClass( elem ); 24084 24085 // This expression is here for better compressibility (see addClass) 24086 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 24087 24088 if ( cur ) { 24089 j = 0; 24090 while ( ( clazz = classes[ j++ ] ) ) { 24091 24092 // Remove *all* instances 24093 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 24094 cur = cur.replace( " " + clazz + " ", " " ); 24095 } 24096 } 24097 24098 // Only assign if different to avoid unneeded rendering. 24099 finalValue = stripAndCollapse( cur ); 24100 if ( curValue !== finalValue ) { 24101 elem.setAttribute( "class", finalValue ); 24102 } 24103 } 24104 } 24105 } 24106 24107 return this; 24108 }, 24109 24110 toggleClass: function( value, stateVal ) { 24111 var type = typeof value; 24112 24113 if ( typeof stateVal === "boolean" && type === "string" ) { 24114 return stateVal ? this.addClass( value ) : this.removeClass( value ); 24115 } 24116 24117 if ( jQuery.isFunction( value ) ) { 24118 return this.each( function( i ) { 24119 jQuery( this ).toggleClass( 24120 value.call( this, i, getClass( this ), stateVal ), 24121 stateVal 24122 ); 24123 } ); 24124 } 24125 24126 return this.each( function() { 24127 var className, i, self, classNames; 24128 24129 if ( type === "string" ) { 24130 24131 // Toggle individual class names 24132 i = 0; 24133 self = jQuery( this ); 24134 classNames = value.match( rnothtmlwhite ) || []; 24135 24136 while ( ( className = classNames[ i++ ] ) ) { 24137 24138 // Check each className given, space separated list 24139 if ( self.hasClass( className ) ) { 24140 self.removeClass( className ); 24141 } else { 24142 self.addClass( className ); 24143 } 24144 } 24145 24146 // Toggle whole class name 24147 } else if ( value === undefined || type === "boolean" ) { 24148 className = getClass( this ); 24149 if ( className ) { 24150 24151 // Store className if set 24152 dataPriv.set( this, "__className__", className ); 24153 } 24154 24155 // If the element has a class name or if we're passed `false`, 24156 // then remove the whole classname (if there was one, the above saved it). 24157 // Otherwise bring back whatever was previously saved (if anything), 24158 // falling back to the empty string if nothing was stored. 24159 if ( this.setAttribute ) { 24160 this.setAttribute( "class", 24161 className || value === false ? 24162 "" : 24163 dataPriv.get( this, "__className__" ) || "" 24164 ); 24165 } 24166 } 24167 } ); 24168 }, 24169 24170 hasClass: function( selector ) { 24171 var className, elem, 24172 i = 0; 24173 24174 className = " " + selector + " "; 24175 while ( ( elem = this[ i++ ] ) ) { 24176 if ( elem.nodeType === 1 && 24177 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 24178 return true; 24179 } 24180 } 24181 24182 return false;
vendor: 1,427 bytes, lines 24183-24252
24183 } 24184 } ); 24185 24186 24187 24188 24189 var rreturn = /\r/g; 24190 24191 jQuery.fn.extend( { 24192 val: function( value ) { 24193 var hooks, ret, isFunction, 24194 elem = this[ 0 ]; 24195 24196 if ( !arguments.length ) { 24197 if ( elem ) { 24198 hooks = jQuery.valHooks[ elem.type ] || 24199 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 24200 24201 if ( hooks && 24202 "get" in hooks && 24203 ( ret = hooks.get( elem, "value" ) ) !== undefined 24204 ) { 24205 return ret; 24206 } 24207 24208 ret = elem.value; 24209 24210 // Handle most common string cases 24211 if ( typeof ret === "string" ) { 24212 return ret.replace( rreturn, "" ); 24213 } 24214 24215 // Handle cases where value is null/undef or number 24216 return ret == null ? "" : ret; 24217 } 24218 24219 return; 24220 } 24221 24222 isFunction = jQuery.isFunction( value ); 24223 24224 return this.each( function( i ) { 24225 var val; 24226 24227 if ( this.nodeType !== 1 ) { 24228 return; 24229 } 24230 24231 if ( isFunction ) { 24232 val = value.call( this, i, jQuery( this ).val() ); 24233 } else { 24234 val = value; 24235 } 24236 24237 // Treat null/undefined as ""; convert numbers to string 24238 if ( val == null ) { 24239 val = ""; 24240 24241 } else if ( typeof val === "number" ) { 24242 val += ""; 24243 24244 } else if ( Array.isArray( val ) ) { 24245 val = jQuery.map( val, function( value ) { 24246 return value == null ? "" : value + ""; 24247 } ); 24248 } 24249 24250 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 24251 24252 // If set returns undefined, fall back to normal setting
vendor: 4,144 bytes, lines 24253-24412
24253 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 24254 this.value = val; 24255 } 24256 } ); 24257 } 24258 } ); 24259 24260 jQuery.extend( { 24261 valHooks: { 24262 option: { 24263 get: function( elem ) { 24264 24265 var val = jQuery.find.attr( elem, "value" ); 24266 return val != null ? 24267 val : 24268 24269 // Support: IE <=10 - 11 only 24270 // option.text throws exceptions (#14686, #14858) 24271 // Strip and collapse whitespace 24272 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 24273 stripAndCollapse( jQuery.text( elem ) ); 24274 } 24275 }, 24276 select: { 24277 get: function( elem ) { 24278 var value, option, i, 24279 options = elem.options, 24280 index = elem.selectedIndex, 24281 one = elem.type === "select-one", 24282 values = one ? null : [], 24283 max = one ? index + 1 : options.length; 24284 24285 if ( index < 0 ) { 24286 i = max; 24287 24288 } else { 24289 i = one ? index : 0; 24290 } 24291 24292 // Loop through all the selected options 24293 for ( ; i < max; i++ ) { 24294 option = options[ i ]; 24295 24296 // Support: IE <=9 only 24297 // IE8-9 doesn't update selected after form reset (#2551) 24298 if ( ( option.selected || i === index ) && 24299 24300 // Don't return options that are disabled or in a disabled optgroup 24301 !option.disabled && 24302 ( !option.parentNode.disabled || 24303 !nodeName( option.parentNode, "optgroup" ) ) ) { 24304 24305 // Get the specific value for the option 24306 value = jQuery( option ).val(); 24307 24308 // We don't need an array for one selects 24309 if ( one ) { 24310 return value; 24311 } 24312 24313 // Multi-Selects return an array 24314 values.push( value ); 24315 } 24316 } 24317 24318 return values; 24319 }, 24320 24321 set: function( elem, value ) { 24322 var optionSet, option, 24323 options = elem.options, 24324 values = jQuery.makeArray( value ), 24325 i = options.length; 24326 24327 while ( i-- ) { 24328 option = options[ i ]; 24329 24330 /* eslint-disable no-cond-assign */ 24331 24332 if ( option.selected = 24333 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 24334 ) { 24335 optionSet = true; 24336 } 24337 24338 /* eslint-enable no-cond-assign */ 24339 } 24340 24341 // Force browsers to behave consistently when non-matching value is set 24342 if ( !optionSet ) { 24343 elem.selectedIndex = -1; 24344 } 24345 return values; 24346 } 24347 } 24348 } 24349 } ); 24350 24351 // Radios and checkboxes getter/setter 24352 jQuery.each( [ "radio", "checkbox" ], function() { 24353 jQuery.valHooks[ this ] = { 24354 set: function( elem, value ) { 24355 if ( Array.isArray( value ) ) { 24356 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 24357 } 24358 } 24359 }; 24360 if ( !support.checkOn ) { 24361 jQuery.valHooks[ this ].get = function( elem ) { 24362 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 24363 }; 24364 } 24365 } ); 24366 24367 24368 24369 24370 // Return jQuery for attributes-only inclusion 24371 24372 24373 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; 24374 24375 jQuery.extend( jQuery.event, { 24376 24377 trigger: function( event, data, elem, onlyHandlers ) { 24378 24379 var i, cur, tmp, bubbleType, ontype, handle, special, 24380 eventPath = [ elem || document ], 24381 type = hasOwn.call( event, "type" ) ? event.type : event, 24382 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 24383 24384 cur = tmp = elem = elem || document; 24385 24386 // Don't do events on text and comment nodes 24387 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 24388 return; 24389 } 24390 24391 // focus/blur morphs to focusin/out; ensure we're not firing them right now 24392 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 24393 return; 24394 } 24395 24396 if ( type.indexOf( "." ) > -1 ) { 24397 24398 // Namespaced trigger; create a regexp to match event type in handle() 24399 namespaces = type.split( "." ); 24400 type = namespaces.shift(); 24401 namespaces.sort(); 24402 } 24403 ontype = type.indexOf( ":" ) < 0 && "on" + type; 24404 24405 // Caller can pass in a jQuery.Event object, Object, or just an event type string 24406 event = event[ jQuery.expando ] ? 24407 event : 24408 new jQuery.Event( type, typeof event === "object" && event ); 24409 24410 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 24411 event.isTrigger = onlyHandlers ? 2 : 3; 24412 event.namespace = namespaces.join( "." );
vendor: 4,267 bytes, lines 24413-24571
24413 event.rnamespace = event.namespace ? 24414 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 24415 null; 24416 24417 // Clean up the event in case it is being reused 24418 event.result = undefined; 24419 if ( !event.target ) { 24420 event.target = elem; 24421 } 24422 24423 // Clone any incoming data and prepend the event, creating the handler arg list 24424 data = data == null ? 24425 [ event ] : 24426 jQuery.makeArray( data, [ event ] ); 24427 24428 // Allow special events to draw outside the lines 24429 special = jQuery.event.special[ type ] || {}; 24430 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 24431 return; 24432 } 24433 24434 // Determine event propagation path in advance, per W3C events spec (#9951) 24435 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 24436 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 24437 24438 bubbleType = special.delegateType || type; 24439 if ( !rfocusMorph.test( bubbleType + type ) ) { 24440 cur = cur.parentNode; 24441 } 24442 for ( ; cur; cur = cur.parentNode ) { 24443 eventPath.push( cur ); 24444 tmp = cur; 24445 } 24446 24447 // Only add window if we got to document (e.g., not plain obj or detached DOM) 24448 if ( tmp === ( elem.ownerDocument || document ) ) { 24449 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 24450 } 24451 } 24452 24453 // Fire handlers on the event path 24454 i = 0; 24455 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 24456 24457 event.type = i > 1 ? 24458 bubbleType : 24459 special.bindType || type; 24460 24461 // jQuery handler 24462 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 24463 dataPriv.get( cur, "handle" ); 24464 if ( handle ) { 24465 handle.apply( cur, data ); 24466 } 24467 24468 // Native handler 24469 handle = ontype && cur[ ontype ]; 24470 if ( handle && handle.apply && acceptData( cur ) ) { 24471 event.result = handle.apply( cur, data ); 24472 if ( event.result === false ) { 24473 event.preventDefault(); 24474 } 24475 } 24476 } 24477 event.type = type; 24478 24479 // If nobody prevented the default action, do it now 24480 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 24481 24482 if ( ( !special._default || 24483 special._default.apply( eventPath.pop(), data ) === false ) && 24484 acceptData( elem ) ) { 24485 24486 // Call a native DOM method on the target with the same name as the event. 24487 // Don't do default actions on window, that's where global variables be (#6170) 24488 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { 24489 24490 // Don't re-trigger an onFOO event when we call its FOO() method 24491 tmp = elem[ ontype ]; 24492 24493 if ( tmp ) { 24494 elem[ ontype ] = null; 24495 } 24496 24497 // Prevent re-triggering of the same event, since we already bubbled it above 24498 jQuery.event.triggered = type; 24499 elem[ type ](); 24500 jQuery.event.triggered = undefined; 24501 24502 if ( tmp ) { 24503 elem[ ontype ] = tmp; 24504 } 24505 } 24506 } 24507 } 24508 24509 return event.result; 24510 }, 24511 24512 // Piggyback on a donor event to simulate a different one 24513 // Used only for `focus(in | out)` events 24514 simulate: function( type, elem, event ) { 24515 var e = jQuery.extend( 24516 new jQuery.Event(), 24517 event, 24518 { 24519 type: type, 24520 isSimulated: true 24521 } 24522 ); 24523 24524 jQuery.event.trigger( e, null, elem ); 24525 } 24526 24527 } ); 24528 24529 jQuery.fn.extend( { 24530 24531 trigger: function( type, data ) { 24532 return this.each( function() { 24533 jQuery.event.trigger( type, data, this ); 24534 } ); 24535 }, 24536 triggerHandler: function( type, data ) { 24537 var elem = this[ 0 ]; 24538 if ( elem ) { 24539 return jQuery.event.trigger( type, data, elem, true ); 24540 } 24541 } 24542 } ); 24543 24544 24545 jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 24546 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 24547 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 24548 function( i, name ) { 24549 24550 // Handle event binding 24551 jQuery.fn[ name ] = function( data, fn ) { 24552 return arguments.length > 0 ? 24553 this.on( name, null, data, fn ) : 24554 this.trigger( name ); 24555 }; 24556 } ); 24557 24558 jQuery.fn.extend( { 24559 hover: function( fnOver, fnOut ) { 24560 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 24561 } 24562 } ); 24563 24564 24565 24566 24567 support.focusin = "onfocusin" in window; 24568 24569 24570 // Support: Firefox <=44 24571 // Firefox doesn't have focus(in | out) events
vendor: 4,303 bytes, lines 24572-24735
24572 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 24573 // 24574 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 24575 // focus(in | out) events fire after focus & blur events, 24576 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 24577 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 24578 if ( !support.focusin ) { 24579 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 24580 24581 // Attach a single capturing handler on the document while someone wants focusin/focusout 24582 var handler = function( event ) { 24583 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 24584 }; 24585 24586 jQuery.event.special[ fix ] = { 24587 setup: function() { 24588 var doc = this.ownerDocument || this, 24589 attaches = dataPriv.access( doc, fix ); 24590 24591 if ( !attaches ) { 24592 doc.addEventListener( orig, handler, true ); 24593 } 24594 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 24595 }, 24596 teardown: function() { 24597 var doc = this.ownerDocument || this, 24598 attaches = dataPriv.access( doc, fix ) - 1; 24599 24600 if ( !attaches ) { 24601 doc.removeEventListener( orig, handler, true ); 24602 dataPriv.remove( doc, fix ); 24603 24604 } else { 24605 dataPriv.access( doc, fix, attaches ); 24606 } 24607 } 24608 }; 24609 } ); 24610 } 24611 var location = window.location; 24612 24613 var nonce = jQuery.now(); 24614 24615 var rquery = ( /\?/ ); 24616 24617 24618 24619 // Cross-browser xml parsing 24620 jQuery.parseXML = function( data ) { 24621 var xml; 24622 if ( !data || typeof data !== "string" ) { 24623 return null; 24624 } 24625 24626 // Support: IE 9 - 11 only 24627 // IE throws on parseFromString with invalid input. 24628 try { 24629 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 24630 } catch ( e ) { 24631 xml = undefined; 24632 } 24633 24634 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 24635 jQuery.error( "Invalid XML: " + data ); 24636 } 24637 return xml; 24638 }; 24639 24640 24641 var 24642 rbracket = /\[\]$/, 24643 rCRLF = /\r?\n/g, 24644 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 24645 rsubmittable = /^(?:input|select|textarea|keygen)/i; 24646 24647 function buildParams( prefix, obj, traditional, add ) { 24648 var name; 24649 24650 if ( Array.isArray( obj ) ) { 24651 24652 // Serialize array item. 24653 jQuery.each( obj, function( i, v ) { 24654 if ( traditional || rbracket.test( prefix ) ) { 24655 24656 // Treat each array item as a scalar. 24657 add( prefix, v ); 24658 24659 } else { 24660 24661 // Item is non-scalar (array or object), encode its numeric index. 24662 buildParams( 24663 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 24664 v, 24665 traditional, 24666 add 24667 ); 24668 } 24669 } ); 24670 24671 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 24672 24673 // Serialize object item. 24674 for ( name in obj ) { 24675 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 24676 } 24677 24678 } else { 24679 24680 // Serialize scalar item. 24681 add( prefix, obj ); 24682 } 24683 } 24684 24685 // Serialize an array of form elements or a set of 24686 // key/values into a query string 24687 jQuery.param = function( a, traditional ) { 24688 var prefix, 24689 s = [], 24690 add = function( key, valueOrFunction ) { 24691 24692 // If value is a function, invoke it and use its return value 24693 var value = jQuery.isFunction( valueOrFunction ) ? 24694 valueOrFunction() : 24695 valueOrFunction; 24696 24697 s[ s.length ] = encodeURIComponent( key ) + "=" + 24698 encodeURIComponent( value == null ? "" : value ); 24699 }; 24700 24701 // If an array was passed in, assume that it is an array of form elements. 24702 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 24703 24704 // Serialize the form elements 24705 jQuery.each( a, function() { 24706 add( this.name, this.value ); 24707 } ); 24708 24709 } else { 24710 24711 // If traditional, encode the "old" way (the way 1.3.2 or older 24712 // did it), otherwise encode params recursively. 24713 for ( prefix in a ) { 24714 buildParams( prefix, a[ prefix ], traditional, add ); 24715 } 24716 } 24717 24718 // Return the resulting serialization 24719 return s.join( "&" ); 24720 }; 24721 24722 jQuery.fn.extend( { 24723 serialize: function() { 24724 return jQuery.param( this.serializeArray() ); 24725 }, 24726 serializeArray: function() { 24727 return this.map( function() { 24728 24729 // Can add propHook for "elements" to filter or add form elements 24730 var elements = jQuery.prop( this, "elements" ); 24731 return elements ? jQuery.makeArray( elements ) : this; 24732 } ) 24733 .filter( function() { 24734 var type = this.type; 24735
vendor: 5,080 bytes, lines 24736-24908
24736 // Use .is( ":disabled" ) so that fieldset[disabled] works 24737 return this.name && !jQuery( this ).is( ":disabled" ) && 24738 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 24739 ( this.checked || !rcheckableType.test( type ) ); 24740 } ) 24741 .map( function( i, elem ) { 24742 var val = jQuery( this ).val(); 24743 24744 if ( val == null ) { 24745 return null; 24746 } 24747 24748 if ( Array.isArray( val ) ) { 24749 return jQuery.map( val, function( val ) { 24750 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 24751 } ); 24752 } 24753 24754 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 24755 } ).get(); 24756 } 24757 } ); 24758 24759 24760 var 24761 r20 = /%20/g, 24762 rhash = /#.*$/, 24763 rantiCache = /([?&])_=[^&]*/, 24764 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 24765 24766 // #7653, #8125, #8152: local protocol detection 24767 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 24768 rnoContent = /^(?:GET|HEAD)$/, 24769 rprotocol = /^\/\//, 24770 24771 /* Prefilters 24772 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 24773 * 2) These are called: 24774 * - BEFORE asking for a transport 24775 * - AFTER param serialization (s.data is a string if s.processData is true) 24776 * 3) key is the dataType 24777 * 4) the catchall symbol "*" can be used 24778 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 24779 */ 24780 prefilters = {}, 24781 24782 /* Transports bindings 24783 * 1) key is the dataType 24784 * 2) the catchall symbol "*" can be used 24785 * 3) selection will start with transport dataType and THEN go to "*" if needed 24786 */ 24787 transports = {}, 24788 24789 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 24790 allTypes = "*/".concat( "*" ), 24791 24792 // Anchor tag for parsing the document origin 24793 originAnchor = document.createElement( "a" ); 24794 originAnchor.href = location.href; 24795 24796 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 24797 function addToPrefiltersOrTransports( structure ) { 24798 24799 // dataTypeExpression is optional and defaults to "*" 24800 return function( dataTypeExpression, func ) { 24801 24802 if ( typeof dataTypeExpression !== "string" ) { 24803 func = dataTypeExpression; 24804 dataTypeExpression = "*"; 24805 } 24806 24807 var dataType, 24808 i = 0, 24809 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 24810 24811 if ( jQuery.isFunction( func ) ) { 24812 24813 // For each dataType in the dataTypeExpression 24814 while ( ( dataType = dataTypes[ i++ ] ) ) { 24815 24816 // Prepend if requested 24817 if ( dataType[ 0 ] === "+" ) { 24818 dataType = dataType.slice( 1 ) || "*"; 24819 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 24820 24821 // Otherwise append 24822 } else { 24823 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 24824 } 24825 } 24826 } 24827 }; 24828 } 24829 24830 // Base inspection function for prefilters and transports 24831 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 24832 24833 var inspected = {}, 24834 seekingTransport = ( structure === transports ); 24835 24836 function inspect( dataType ) { 24837 var selected; 24838 inspected[ dataType ] = true; 24839 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 24840 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 24841 if ( typeof dataTypeOrTransport === "string" && 24842 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 24843 24844 options.dataTypes.unshift( dataTypeOrTransport ); 24845 inspect( dataTypeOrTransport ); 24846 return false; 24847 } else if ( seekingTransport ) { 24848 return !( selected = dataTypeOrTransport ); 24849 } 24850 } ); 24851 return selected; 24852 } 24853 24854 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 24855 } 24856 24857 // A special extend for ajax options 24858 // that takes "flat" options (not to be deep extended) 24859 // Fixes #9887 24860 function ajaxExtend( target, src ) { 24861 var key, deep, 24862 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 24863 24864 for ( key in src ) { 24865 if ( src[ key ] !== undefined ) { 24866 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 24867 } 24868 } 24869 if ( deep ) { 24870 jQuery.extend( true, target, deep ); 24871 } 24872 24873 return target; 24874 } 24875 24876 /* Handles responses to an ajax request: 24877 * - finds the right dataType (mediates between content-type and expected dataType) 24878 * - returns the corresponding response 24879 */ 24880 function ajaxHandleResponses( s, jqXHR, responses ) { 24881 24882 var ct, type, finalDataType, firstDataType, 24883 contents = s.contents, 24884 dataTypes = s.dataTypes; 24885 24886 // Remove auto dataType and get content-type in the process 24887 while ( dataTypes[ 0 ] === "*" ) { 24888 dataTypes.shift(); 24889 if ( ct === undefined ) { 24890 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 24891 } 24892 } 24893 24894 // Check if we're dealing with a known content-type 24895 if ( ct ) { 24896 for ( type in contents ) { 24897 if ( contents[ type ] && contents[ type ].test( ct ) ) { 24898 dataTypes.unshift( type ); 24899 break; 24900 } 24901 } 24902 } 24903 24904 // Check to see if we have a response for the expected dataType 24905 if ( dataTypes[ 0 ] in responses ) { 24906 finalDataType = dataTypes[ 0 ]; 24907 } else { 24908
vendor: 5,168 bytes, lines 24909-25123
24909 // Try convertible dataTypes 24910 for ( type in responses ) { 24911 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 24912 finalDataType = type; 24913 break; 24914 } 24915 if ( !firstDataType ) { 24916 firstDataType = type; 24917 } 24918 } 24919 24920 // Or just use first one 24921 finalDataType = finalDataType || firstDataType; 24922 } 24923 24924 // If we found a dataType 24925 // We add the dataType to the list if needed 24926 // and return the corresponding response 24927 if ( finalDataType ) { 24928 if ( finalDataType !== dataTypes[ 0 ] ) { 24929 dataTypes.unshift( finalDataType ); 24930 } 24931 return responses[ finalDataType ]; 24932 } 24933 } 24934 24935 /* Chain conversions given the request and the original response 24936 * Also sets the responseXXX fields on the jqXHR instance 24937 */ 24938 function ajaxConvert( s, response, jqXHR, isSuccess ) { 24939 var conv2, current, conv, tmp, prev, 24940 converters = {}, 24941 24942 // Work with a copy of dataTypes in case we need to modify it for conversion 24943 dataTypes = s.dataTypes.slice(); 24944 24945 // Create converters map with lowercased keys 24946 if ( dataTypes[ 1 ] ) { 24947 for ( conv in s.converters ) { 24948 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 24949 } 24950 } 24951 24952 current = dataTypes.shift(); 24953 24954 // Convert to each sequential dataType 24955 while ( current ) { 24956 24957 if ( s.responseFields[ current ] ) { 24958 jqXHR[ s.responseFields[ current ] ] = response; 24959 } 24960 24961 // Apply the dataFilter if provided 24962 if ( !prev && isSuccess && s.dataFilter ) { 24963 response = s.dataFilter( response, s.dataType ); 24964 } 24965 24966 prev = current; 24967 current = dataTypes.shift(); 24968 24969 if ( current ) { 24970 24971 // There's only work to do if current dataType is non-auto 24972 if ( current === "*" ) { 24973 24974 current = prev; 24975 24976 // Convert response if prev dataType is non-auto and differs from current 24977 } else if ( prev !== "*" && prev !== current ) { 24978 24979 // Seek a direct converter 24980 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 24981 24982 // If none found, seek a pair 24983 if ( !conv ) { 24984 for ( conv2 in converters ) { 24985 24986 // If conv2 outputs current 24987 tmp = conv2.split( " " ); 24988 if ( tmp[ 1 ] === current ) { 24989 24990 // If prev can be converted to accepted input 24991 conv = converters[ prev + " " + tmp[ 0 ] ] || 24992 converters[ "* " + tmp[ 0 ] ]; 24993 if ( conv ) { 24994 24995 // Condense equivalence converters 24996 if ( conv === true ) { 24997 conv = converters[ conv2 ]; 24998 24999 // Otherwise, insert the intermediate dataType 25000 } else if ( converters[ conv2 ] !== true ) { 25001 current = tmp[ 0 ]; 25002 dataTypes.unshift( tmp[ 1 ] ); 25003 } 25004 break; 25005 } 25006 } 25007 } 25008 } 25009 25010 // Apply converter (if not an equivalence) 25011 if ( conv !== true ) { 25012 25013 // Unless errors are allowed to bubble, catch and return them 25014 if ( conv && s.throws ) { 25015 response = conv( response ); 25016 } else { 25017 try { 25018 response = conv( response ); 25019 } catch ( e ) { 25020 return { 25021 state: "parsererror", 25022 error: conv ? e : "No conversion from " + prev + " to " + current 25023 }; 25024 } 25025 } 25026 } 25027 } 25028 } 25029 } 25030 25031 return { state: "success", data: response }; 25032 } 25033 25034 jQuery.extend( { 25035 25036 // Counter for holding the number of active queries 25037 active: 0, 25038 25039 // Last-Modified header cache for next request 25040 lastModified: {}, 25041 etag: {}, 25042 25043 ajaxSettings: { 25044 url: location.href, 25045 type: "GET", 25046 isLocal: rlocalProtocol.test( location.protocol ), 25047 global: true, 25048 processData: true, 25049 async: true, 25050 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 25051 25052 /* 25053 timeout: 0, 25054 data: null, 25055 dataType: null, 25056 username: null, 25057 password: null, 25058 cache: null, 25059 throws: false, 25060 traditional: false, 25061 headers: {}, 25062 */ 25063 25064 accepts: { 25065 "*": allTypes, 25066 text: "text/plain", 25067 html: "text/html", 25068 xml: "application/xml, text/xml", 25069 json: "application/json, text/javascript" 25070 }, 25071 25072 contents: { 25073 xml: /\bxml\b/, 25074 html: /\bhtml/, 25075 json: /\bjson\b/ 25076 }, 25077 25078 responseFields: { 25079 xml: "responseXML", 25080 text: "responseText", 25081 json: "responseJSON" 25082 }, 25083 25084 // Data converters 25085 // Keys separate source (or catchall "*") and destination types with a single space 25086 converters: { 25087 25088 // Convert anything to text 25089 "* text": String, 25090 25091 // Text to html (true = no transformation) 25092 "text html": true, 25093 25094 // Evaluate text as a json expression 25095 "text json": JSON.parse, 25096 25097 // Parse text as xml 25098 "text xml": jQuery.parseXML 25099 }, 25100 25101 // For options that shouldn't be deep extended: 25102 // you can add your own custom options here if 25103 // and when you create one that shouldn't be 25104 // deep extended (see ajaxExtend) 25105 flatOptions: { 25106 url: true, 25107 context: true 25108 } 25109 }, 25110 25111 // Creates a full fledged settings object into target 25112 // with both ajaxSettings and settings fields. 25113 // If target is omitted, writes into ajaxSettings. 25114 ajaxSetup: function( target, settings ) { 25115 return settings ? 25116 25117 // Building a settings object 25118 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 25119 25120 // Extending ajaxSettings 25121 ajaxExtend( jQuery.ajaxSettings, target ); 25122 }, 25123
vendor: 15,058 bytes, lines 25124-25699
25124 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 25125 ajaxTransport: addToPrefiltersOrTransports( transports ), 25126 25127 // Main method 25128 ajax: function( url, options ) { 25129 25130 // If url is an object, simulate pre-1.5 signature 25131 if ( typeof url === "object" ) { 25132 options = url; 25133 url = undefined; 25134 } 25135 25136 // Force options to be an object 25137 options = options || {}; 25138 25139 var transport, 25140 25141 // URL without anti-cache param 25142 cacheURL, 25143 25144 // Response headers 25145 responseHeadersString, 25146 responseHeaders, 25147 25148 // timeout handle 25149 timeoutTimer, 25150 25151 // Url cleanup var 25152 urlAnchor, 25153 25154 // Request state (becomes false upon send and true upon completion) 25155 completed, 25156 25157 // To know if global events are to be dispatched 25158 fireGlobals, 25159 25160 // Loop variable 25161 i, 25162 25163 // uncached part of the url 25164 uncached, 25165 25166 // Create the final options object 25167 s = jQuery.ajaxSetup( {}, options ), 25168 25169 // Callbacks context 25170 callbackContext = s.context || s, 25171 25172 // Context for global events is callbackContext if it is a DOM node or jQuery collection 25173 globalEventContext = s.context && 25174 ( callbackContext.nodeType || callbackContext.jquery ) ? 25175 jQuery( callbackContext ) : 25176 jQuery.event, 25177 25178 // Deferreds 25179 deferred = jQuery.Deferred(), 25180 completeDeferred = jQuery.Callbacks( "once memory" ), 25181 25182 // Status-dependent callbacks 25183 statusCode = s.statusCode || {}, 25184 25185 // Headers (they are sent all at once) 25186 requestHeaders = {}, 25187 requestHeadersNames = {}, 25188 25189 // Default abort message 25190 strAbort = "canceled", 25191 25192 // Fake xhr 25193 jqXHR = { 25194 readyState: 0, 25195 25196 // Builds headers hashtable if needed 25197 getResponseHeader: function( key ) { 25198 var match; 25199 if ( completed ) { 25200 if ( !responseHeaders ) { 25201 responseHeaders = {}; 25202 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 25203 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 25204 } 25205 } 25206 match = responseHeaders[ key.toLowerCase() ]; 25207 } 25208 return match == null ? null : match; 25209 }, 25210 25211 // Raw string 25212 getAllResponseHeaders: function() { 25213 return completed ? responseHeadersString : null; 25214 }, 25215 25216 // Caches the header 25217 setRequestHeader: function( name, value ) { 25218 if ( completed == null ) { 25219 name = requestHeadersNames[ name.toLowerCase() ] = 25220 requestHeadersNames[ name.toLowerCase() ] || name; 25221 requestHeaders[ name ] = value; 25222 } 25223 return this; 25224 }, 25225 25226 // Overrides response content-type header 25227 overrideMimeType: function( type ) { 25228 if ( completed == null ) { 25229 s.mimeType = type; 25230 } 25231 return this; 25232 }, 25233 25234 // Status-dependent callbacks 25235 statusCode: function( map ) { 25236 var code; 25237 if ( map ) { 25238 if ( completed ) { 25239 25240 // Execute the appropriate callbacks 25241 jqXHR.always( map[ jqXHR.status ] ); 25242 } else { 25243 25244 // Lazy-add the new callbacks in a way that preserves old ones 25245 for ( code in map ) { 25246 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 25247 } 25248 } 25249 } 25250 return this; 25251 }, 25252 25253 // Cancel the request 25254 abort: function( statusText ) { 25255 var finalText = statusText || strAbort; 25256 if ( transport ) { 25257 transport.abort( finalText ); 25258 } 25259 done( 0, finalText ); 25260 return this; 25261 } 25262 }; 25263 25264 // Attach deferreds 25265 deferred.promise( jqXHR ); 25266 25267 // Add protocol if not provided (prefilters might expect it) 25268 // Handle falsy url in the settings object (#10093: consistency with old signature) 25269 // We also use the url parameter if available 25270 s.url = ( ( url || s.url || location.href ) + "" ) 25271 .replace( rprotocol, location.protocol + "//" ); 25272 25273 // Alias method option to type as per ticket #12004 25274 s.type = options.method || options.type || s.method || s.type; 25275 25276 // Extract dataTypes list 25277 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 25278 25279 // A cross-domain request is in order when the origin doesn't match the current origin. 25280 if ( s.crossDomain == null ) { 25281 urlAnchor = document.createElement( "a" ); 25282 25283 // Support: IE <=8 - 11, Edge 12 - 13 25284 // IE throws exception on accessing the href property if url is malformed, 25285 // e.g. http://example.com:80x/ 25286 try { 25287 urlAnchor.href = s.url; 25288 25289 // Support: IE <=8 - 11 only 25290 // Anchor's host property isn't correctly set when s.url is relative 25291 urlAnchor.href = urlAnchor.href; 25292 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 25293 urlAnchor.protocol + "//" + urlAnchor.host; 25294 } catch ( e ) { 25295 25296 // If there is an error parsing the URL, assume it is crossDomain, 25297 // it can be rejected by the transport if it is invalid 25298 s.crossDomain = true; 25299 } 25300 } 25301 25302 // Convert data if not already a string 25303 if ( s.data && s.processData && typeof s.data !== "string" ) { 25304 s.data = jQuery.param( s.data, s.traditional ); 25305 } 25306 25307 // Apply prefilters 25308 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 25309 25310 // If request was aborted inside a prefilter, stop there 25311 if ( completed ) { 25312 return jqXHR; 25313 } 25314 25315 // We can fire global events as of now if asked to 25316 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 25317 fireGlobals = jQuery.event && s.global; 25318 25319 // Watch for a new set of requests 25320 if ( fireGlobals && jQuery.active++ === 0 ) { 25321 jQuery.event.trigger( "ajaxStart" ); 25322 } 25323 25324 // Uppercase the type 25325 s.type = s.type.toUpperCase(); 25326 25327 // Determine if request has content 25328 s.hasContent = !rnoContent.test( s.type ); 25329 25330 // Save the URL in case we're toying with the If-Modified-Since 25331 // and/or If-None-Match header later on 25332 // Remove hash to simplify url manipulation 25333 cacheURL = s.url.replace( rhash, "" ); 25334 25335 // More options handling for requests with no content 25336 if ( !s.hasContent ) { 25337 25338 // Remember the hash so we can put it back 25339 uncached = s.url.slice( cacheURL.length ); 25340 25341 // If data is available, append data to url 25342 if ( s.data ) { 25343 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 25344 25345 // #9682: remove data so that it's not used in an eventual retry 25346 delete s.data; 25347 } 25348 25349 // Add or update anti-cache param if needed 25350 if ( s.cache === false ) { 25351 cacheURL = cacheURL.replace( rantiCache, "$1" ); 25352 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 25353 } 25354 25355 // Put hash and anti-cache on the URL that will be requested (gh-1732) 25356 s.url = cacheURL + uncached; 25357 25358 // Change '%20' to '+' if this is encoded form body content (gh-2658) 25359 } else if ( s.data && s.processData && 25360 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 25361 s.data = s.data.replace( r20, "+" ); 25362 } 25363 25364 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 25365 if ( s.ifModified ) { 25366 if ( jQuery.lastModified[ cacheURL ] ) { 25367 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 25368 } 25369 if ( jQuery.etag[ cacheURL ] ) { 25370 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 25371 } 25372 } 25373 25374 // Set the correct header, if data is being sent 25375 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 25376 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 25377 } 25378 25379 // Set the Accepts header for the server, depending on the dataType 25380 jqXHR.setRequestHeader( 25381 "Accept", 25382 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 25383 s.accepts[ s.dataTypes[ 0 ] ] + 25384 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 25385 s.accepts[ "*" ] 25386 ); 25387 25388 // Check for headers option 25389 for ( i in s.headers ) { 25390 jqXHR.setRequestHeader( i, s.headers[ i ] ); 25391 } 25392 25393 // Allow custom headers/mimetypes and early abort 25394 if ( s.beforeSend && 25395 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 25396 25397 // Abort if not done already and return 25398 return jqXHR.abort(); 25399 } 25400 25401 // Aborting is no longer a cancellation 25402 strAbort = "abort"; 25403 25404 // Install callbacks on deferreds 25405 completeDeferred.add( s.complete ); 25406 jqXHR.done( s.success ); 25407 jqXHR.fail( s.error ); 25408 25409 // Get transport 25410 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 25411 25412 // If no transport, we auto-abort 25413 if ( !transport ) { 25414 done( -1, "No Transport" ); 25415 } else { 25416 jqXHR.readyState = 1; 25417 25418 // Send global event 25419 if ( fireGlobals ) { 25420 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 25421 } 25422 25423 // If request was aborted inside ajaxSend, stop there 25424 if ( completed ) { 25425 return jqXHR; 25426 } 25427 25428 // Timeout 25429 if ( s.async && s.timeout > 0 ) { 25430 timeoutTimer = window.setTimeout( function() { 25431 jqXHR.abort( "timeout" ); 25432 }, s.timeout ); 25433 } 25434 25435 try { 25436 completed = false; 25437 transport.send( requestHeaders, done ); 25438 } catch ( e ) { 25439 25440 // Rethrow post-completion exceptions 25441 if ( completed ) { 25442 throw e; 25443 } 25444 25445 // Propagate others as results 25446 done( -1, e ); 25447 } 25448 } 25449 25450 // Callback for when everything is done 25451 function done( status, nativeStatusText, responses, headers ) { 25452 var isSuccess, success, error, response, modified, 25453 statusText = nativeStatusText; 25454 25455 // Ignore repeat invocations 25456 if ( completed ) { 25457 return; 25458 } 25459 25460 completed = true; 25461 25462 // Clear timeout if it exists 25463 if ( timeoutTimer ) { 25464 window.clearTimeout( timeoutTimer ); 25465 } 25466 25467 // Dereference transport for early garbage collection 25468 // (no matter how long the jqXHR object will be used) 25469 transport = undefined; 25470 25471 // Cache response headers 25472 responseHeadersString = headers || ""; 25473 25474 // Set readyState 25475 jqXHR.readyState = status > 0 ? 4 : 0; 25476 25477 // Determine if successful 25478 isSuccess = status >= 200 && status < 300 || status === 304; 25479 25480 // Get response data 25481 if ( responses ) { 25482 response = ajaxHandleResponses( s, jqXHR, responses ); 25483 } 25484 25485 // Convert no matter what (that way responseXXX fields are always set) 25486 response = ajaxConvert( s, response, jqXHR, isSuccess ); 25487 25488 // If successful, handle type chaining 25489 if ( isSuccess ) { 25490 25491 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 25492 if ( s.ifModified ) { 25493 modified = jqXHR.getResponseHeader( "Last-Modified" ); 25494 if ( modified ) { 25495 jQuery.lastModified[ cacheURL ] = modified; 25496 } 25497 modified = jqXHR.getResponseHeader( "etag" ); 25498 if ( modified ) { 25499 jQuery.etag[ cacheURL ] = modified; 25500 } 25501 } 25502 25503 // if no content 25504 if ( status === 204 || s.type === "HEAD" ) { 25505 statusText = "nocontent"; 25506 25507 // if not modified 25508 } else if ( status === 304 ) { 25509 statusText = "notmodified"; 25510 25511 // If we have data, let's convert it 25512 } else { 25513 statusText = response.state; 25514 success = response.data; 25515 error = response.error; 25516 isSuccess = !error; 25517 } 25518 } else { 25519 25520 // Extract error from statusText and normalize for non-aborts 25521 error = statusText; 25522 if ( status || !statusText ) { 25523 statusText = "error"; 25524 if ( status < 0 ) { 25525 status = 0; 25526 } 25527 } 25528 } 25529 25530 // Set data for the fake xhr object 25531 jqXHR.status = status; 25532 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 25533 25534 // Success/Error 25535 if ( isSuccess ) { 25536 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 25537 } else { 25538 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 25539 } 25540 25541 // Status-dependent callbacks 25542 jqXHR.statusCode( statusCode ); 25543 statusCode = undefined; 25544 25545 if ( fireGlobals ) { 25546 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 25547 [ jqXHR, s, isSuccess ? success : error ] ); 25548 } 25549 25550 // Complete 25551 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 25552 25553 if ( fireGlobals ) { 25554 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 25555 25556 // Handle the global AJAX counter 25557 if ( !( --jQuery.active ) ) { 25558 jQuery.event.trigger( "ajaxStop" ); 25559 } 25560 } 25561 } 25562 25563 return jqXHR; 25564 }, 25565 25566 getJSON: function( url, data, callback ) { 25567 return jQuery.get( url, data, callback, "json" ); 25568 }, 25569 25570 getScript: function( url, callback ) { 25571 return jQuery.get( url, undefined, callback, "script" ); 25572 } 25573 } ); 25574 25575 jQuery.each( [ "get", "post" ], function( i, method ) { 25576 jQuery[ method ] = function( url, data, callback, type ) { 25577 25578 // Shift arguments if data argument was omitted 25579 if ( jQuery.isFunction( data ) ) { 25580 type = type || callback; 25581 callback = data; 25582 data = undefined; 25583 } 25584 25585 // The url can be an options object (which then must have .url) 25586 return jQuery.ajax( jQuery.extend( { 25587 url: url, 25588 type: method, 25589 dataType: type, 25590 data: data, 25591 success: callback 25592 }, jQuery.isPlainObject( url ) && url ) ); 25593 }; 25594 } ); 25595 25596 25597 jQuery._evalUrl = function( url ) { 25598 return jQuery.ajax( { 25599 url: url, 25600 25601 // Make this explicit, since user can override this through ajaxSetup (#11264) 25602 type: "GET", 25603 dataType: "script", 25604 cache: true, 25605 async: false, 25606 global: false, 25607 "throws": true 25608 } ); 25609 }; 25610 25611 25612 jQuery.fn.extend( { 25613 wrapAll: function( html ) { 25614 var wrap; 25615 25616 if ( this[ 0 ] ) { 25617 if ( jQuery.isFunction( html ) ) { 25618 html = html.call( this[ 0 ] ); 25619 } 25620 25621 // The elements to wrap the target around 25622 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 25623 25624 if ( this[ 0 ].parentNode ) { 25625 wrap.insertBefore( this[ 0 ] ); 25626 } 25627 25628 wrap.map( function() { 25629 var elem = this; 25630 25631 while ( elem.firstElementChild ) { 25632 elem = elem.firstElementChild; 25633 } 25634 25635 return elem; 25636 } ).append( this ); 25637 } 25638 25639 return this; 25640 }, 25641 25642 wrapInner: function( html ) { 25643 if ( jQuery.isFunction( html ) ) { 25644 return this.each( function( i ) { 25645 jQuery( this ).wrapInner( html.call( this, i ) ); 25646 } ); 25647 } 25648 25649 return this.each( function() { 25650 var self = jQuery( this ), 25651 contents = self.contents(); 25652 25653 if ( contents.length ) { 25654 contents.wrapAll( html ); 25655 25656 } else { 25657 self.append( html ); 25658 } 25659 } ); 25660 }, 25661 25662 wrap: function( html ) { 25663 var isFunction = jQuery.isFunction( html ); 25664 25665 return this.each( function( i ) { 25666 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); 25667 } ); 25668 }, 25669 25670 unwrap: function( selector ) { 25671 this.parent( selector ).not( "body" ).each( function() { 25672 jQuery( this ).replaceWith( this.childNodes ); 25673 } ); 25674 return this; 25675 } 25676 } ); 25677 25678 25679 jQuery.expr.pseudos.hidden = function( elem ) { 25680 return !jQuery.expr.pseudos.visible( elem ); 25681 }; 25682 jQuery.expr.pseudos.visible = function( elem ) { 25683 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 25684 }; 25685 25686 25687 25688 25689 jQuery.ajaxSettings.xhr = function() { 25690 try { 25691 return new window.XMLHttpRequest(); 25692 } catch ( e ) {} 25693 }; 25694 25695 var xhrSuccessStatus = { 25696 25697 // File protocol always yields status code 0, assume 200 25698 0: 200, 25699
vendor: 1,276 bytes, lines 25700-25742
25700 // Support: IE <=9 only 25701 // #1450: sometimes IE returns 1223 when it should be 204 25702 1223: 204 25703 }, 25704 xhrSupported = jQuery.ajaxSettings.xhr(); 25705 25706 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 25707 support.ajax = xhrSupported = !!xhrSupported; 25708 25709 jQuery.ajaxTransport( function( options ) { 25710 var callback, errorCallback; 25711 25712 // Cross domain only allowed if supported through XMLHttpRequest 25713 if ( support.cors || xhrSupported && !options.crossDomain ) { 25714 return { 25715 send: function( headers, complete ) { 25716 var i, 25717 xhr = options.xhr(); 25718 25719 xhr.open( 25720 options.type, 25721 options.url, 25722 options.async, 25723 options.username, 25724 options.password 25725 ); 25726 25727 // Apply custom fields if provided 25728 if ( options.xhrFields ) { 25729 for ( i in options.xhrFields ) { 25730 xhr[ i ] = options.xhrFields[ i ]; 25731 } 25732 } 25733 25734 // Override mime type if needed 25735 if ( options.mimeType && xhr.overrideMimeType ) { 25736 xhr.overrideMimeType( options.mimeType ); 25737 } 25738 25739 // X-Requested-With header 25740 // For cross-domain requests, seeing as conditions for a preflight are 25741 // akin to a jigsaw puzzle, we simply never set it to be sure. 25742 // (it can always be set on a per-request basis or even using ajaxSetup)
vendor: 11,249 bytes, lines 25743-26175
25743 // For same-domain requests, won't change header if already provided. 25744 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 25745 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 25746 } 25747 25748 // Set headers 25749 for ( i in headers ) { 25750 xhr.setRequestHeader( i, headers[ i ] ); 25751 } 25752 25753 // Callback 25754 callback = function( type ) { 25755 return function() { 25756 if ( callback ) { 25757 callback = errorCallback = xhr.onload = 25758 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; 25759 25760 if ( type === "abort" ) { 25761 xhr.abort(); 25762 } else if ( type === "error" ) { 25763 25764 // Support: IE <=9 only 25765 // On a manual native abort, IE9 throws 25766 // errors on any property access that is not readyState 25767 if ( typeof xhr.status !== "number" ) { 25768 complete( 0, "error" ); 25769 } else { 25770 complete( 25771 25772 // File: protocol always yields status 0; see #8605, #14207 25773 xhr.status, 25774 xhr.statusText 25775 ); 25776 } 25777 } else { 25778 complete( 25779 xhrSuccessStatus[ xhr.status ] || xhr.status, 25780 xhr.statusText, 25781 25782 // Support: IE <=9 only 25783 // IE9 has no XHR2 but throws on binary (trac-11426) 25784 // For XHR2 non-text, let the caller handle it (gh-2498) 25785 ( xhr.responseType || "text" ) !== "text" || 25786 typeof xhr.responseText !== "string" ? 25787 { binary: xhr.response } : 25788 { text: xhr.responseText }, 25789 xhr.getAllResponseHeaders() 25790 ); 25791 } 25792 } 25793 }; 25794 }; 25795 25796 // Listen to events 25797 xhr.onload = callback(); 25798 errorCallback = xhr.onerror = callback( "error" ); 25799 25800 // Support: IE 9 only 25801 // Use onreadystatechange to replace onabort 25802 // to handle uncaught aborts 25803 if ( xhr.onabort !== undefined ) { 25804 xhr.onabort = errorCallback; 25805 } else { 25806 xhr.onreadystatechange = function() { 25807 25808 // Check readyState before timeout as it changes 25809 if ( xhr.readyState === 4 ) { 25810 25811 // Allow onerror to be called first, 25812 // but that will not handle a native abort 25813 // Also, save errorCallback to a variable 25814 // as xhr.onerror cannot be accessed 25815 window.setTimeout( function() { 25816 if ( callback ) { 25817 errorCallback(); 25818 } 25819 } ); 25820 } 25821 }; 25822 } 25823 25824 // Create the abort callback 25825 callback = callback( "abort" ); 25826 25827 try { 25828 25829 // Do send the request (this may raise an exception) 25830 xhr.send( options.hasContent && options.data || null ); 25831 } catch ( e ) { 25832 25833 // #14683: Only rethrow if this hasn't been notified as an error yet 25834 if ( callback ) { 25835 throw e; 25836 } 25837 } 25838 }, 25839 25840 abort: function() { 25841 if ( callback ) { 25842 callback(); 25843 } 25844 } 25845 }; 25846 } 25847 } ); 25848 25849 25850 25851 25852 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 25853 jQuery.ajaxPrefilter( function( s ) { 25854 if ( s.crossDomain ) { 25855 s.contents.script = false; 25856 } 25857 } ); 25858 25859 // Install script dataType 25860 jQuery.ajaxSetup( { 25861 accepts: { 25862 script: "text/javascript, application/javascript, " + 25863 "application/ecmascript, application/x-ecmascript" 25864 }, 25865 contents: { 25866 script: /\b(?:java|ecma)script\b/ 25867 }, 25868 converters: { 25869 "text script": function( text ) { 25870 jQuery.globalEval( text ); 25871 return text; 25872 } 25873 } 25874 } ); 25875 25876 // Handle cache's special case and crossDomain 25877 jQuery.ajaxPrefilter( "script", function( s ) { 25878 if ( s.cache === undefined ) { 25879 s.cache = false; 25880 } 25881 if ( s.crossDomain ) { 25882 s.type = "GET"; 25883 } 25884 } ); 25885 25886 // Bind script tag hack transport 25887 jQuery.ajaxTransport( "script", function( s ) { 25888 25889 // This transport only deals with cross domain requests 25890 if ( s.crossDomain ) { 25891 var script, callback; 25892 return { 25893 send: function( _, complete ) { 25894 script = jQuery( "<script>" ).prop( { 25895 charset: s.scriptCharset, 25896 src: s.url 25897 } ).on( 25898 "load error", 25899 callback = function( evt ) { 25900 script.remove(); 25901 callback = null; 25902 if ( evt ) { 25903 complete( evt.type === "error" ? 404 : 200, evt.type ); 25904 } 25905 } 25906 ); 25907 25908 // Use native DOM manipulation to avoid our domManip AJAX trickery 25909 document.head.appendChild( script[ 0 ] ); 25910 }, 25911 abort: function() { 25912 if ( callback ) { 25913 callback(); 25914 } 25915 } 25916 }; 25917 } 25918 } ); 25919 25920 25921 25922 25923 var oldCallbacks = [], 25924 rjsonp = /(=)\?(?=&|$)|\?\?/; 25925 25926 // Default jsonp settings 25927 jQuery.ajaxSetup( { 25928 jsonp: "callback", 25929 jsonpCallback: function() { 25930 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 25931 this[ callback ] = true; 25932 return callback; 25933 } 25934 } ); 25935 25936 // Detect, normalize options and install callbacks for jsonp requests 25937 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 25938 25939 var callbackName, overwritten, responseContainer, 25940 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 25941 "url" : 25942 typeof s.data === "string" && 25943 ( s.contentType || "" ) 25944 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 25945 rjsonp.test( s.data ) && "data" 25946 ); 25947 25948 // Handle iff the expected data type is "jsonp" or we have a parameter to set 25949 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 25950 25951 // Get callback name, remembering preexisting value associated with it 25952 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 25953 s.jsonpCallback() : 25954 s.jsonpCallback; 25955 25956 // Insert callback into url or form data 25957 if ( jsonProp ) { 25958 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 25959 } else if ( s.jsonp !== false ) { 25960 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 25961 } 25962 25963 // Use data converter to retrieve json after script execution 25964 s.converters[ "script json" ] = function() { 25965 if ( !responseContainer ) { 25966 jQuery.error( callbackName + " was not called" ); 25967 } 25968 return responseContainer[ 0 ]; 25969 }; 25970 25971 // Force json dataType 25972 s.dataTypes[ 0 ] = "json"; 25973 25974 // Install callback 25975 overwritten = window[ callbackName ]; 25976 window[ callbackName ] = function() { 25977 responseContainer = arguments; 25978 }; 25979 25980 // Clean-up function (fires after converters) 25981 jqXHR.always( function() { 25982 25983 // If previous value didn't exist - remove it 25984 if ( overwritten === undefined ) { 25985 jQuery( window ).removeProp( callbackName ); 25986 25987 // Otherwise restore preexisting value 25988 } else { 25989 window[ callbackName ] = overwritten; 25990 } 25991 25992 // Save back as free 25993 if ( s[ callbackName ] ) { 25994 25995 // Make sure that re-using the options doesn't screw things around 25996 s.jsonpCallback = originalSettings.jsonpCallback; 25997 25998 // Save the callback name for future use 25999 oldCallbacks.push( callbackName ); 26000 } 26001 26002 // Call if it was a function and we have a response 26003 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 26004 overwritten( responseContainer[ 0 ] ); 26005 } 26006 26007 responseContainer = overwritten = undefined; 26008 } ); 26009 26010 // Delegate to script 26011 return "script"; 26012 } 26013 } ); 26014 26015 26016 26017 26018 // Support: Safari 8 only 26019 // In Safari 8 documents created via document.implementation.createHTMLDocument 26020 // collapse sibling forms: the second one becomes a child of the first one. 26021 // Because of that, this security measure has to be disabled in Safari 8. 26022 // https://bugs.webkit.org/show_bug.cgi?id=137337 26023 support.createHTMLDocument = ( function() { 26024 var body = document.implementation.createHTMLDocument( "" ).body; 26025 body.innerHTML = "<form></form><form></form>"; 26026 return body.childNodes.length === 2; 26027 } )(); 26028 26029 26030 // Argument "data" should be string of html 26031 // context (optional): If specified, the fragment will be created in this context, 26032 // defaults to document 26033 // keepScripts (optional): If true, will include scripts passed in the html string 26034 jQuery.parseHTML = function( data, context, keepScripts ) { 26035 if ( typeof data !== "string" ) { 26036 return []; 26037 } 26038 if ( typeof context === "boolean" ) { 26039 keepScripts = context; 26040 context = false; 26041 } 26042 26043 var base, parsed, scripts; 26044 26045 if ( !context ) { 26046 26047 // Stop scripts or inline event handlers from being executed immediately 26048 // by using document.implementation 26049 if ( support.createHTMLDocument ) { 26050 context = document.implementation.createHTMLDocument( "" ); 26051 26052 // Set the base href for the created document 26053 // so any parsed elements with URLs 26054 // are based on the document's URL (gh-2965) 26055 base = context.createElement( "base" ); 26056 base.href = document.location.href; 26057 context.head.appendChild( base ); 26058 } else { 26059 context = document; 26060 } 26061 } 26062 26063 parsed = rsingleTag.exec( data ); 26064 scripts = !keepScripts && []; 26065 26066 // Single tag 26067 if ( parsed ) { 26068 return [ context.createElement( parsed[ 1 ] ) ]; 26069 } 26070 26071 parsed = buildFragment( [ data ], context, scripts ); 26072 26073 if ( scripts && scripts.length ) { 26074 jQuery( scripts ).remove(); 26075 } 26076 26077 return jQuery.merge( [], parsed.childNodes ); 26078 }; 26079 26080 26081 /** 26082 * Load a url into a page 26083 */ 26084 jQuery.fn.load = function( url, params, callback ) { 26085 var selector, type, response, 26086 self = this, 26087 off = url.indexOf( " " ); 26088 26089 if ( off > -1 ) { 26090 selector = stripAndCollapse( url.slice( off ) ); 26091 url = url.slice( 0, off ); 26092 } 26093 26094 // If it's a function 26095 if ( jQuery.isFunction( params ) ) { 26096 26097 // We assume that it's the callback 26098 callback = params; 26099 params = undefined; 26100 26101 // Otherwise, build a param string 26102 } else if ( params && typeof params === "object" ) { 26103 type = "POST"; 26104 } 26105 26106 // If we have elements to modify, make the request 26107 if ( self.length > 0 ) { 26108 jQuery.ajax( { 26109 url: url, 26110 26111 // If "type" variable is undefined, then "GET" method will be used. 26112 // Make value of this field explicit since 26113 // user can override it through ajaxSetup method 26114 type: type || "GET", 26115 dataType: "html", 26116 data: params 26117 } ).done( function( responseText ) { 26118 26119 // Save response for use in complete callback 26120 response = arguments; 26121 26122 self.html( selector ? 26123 26124 // If a selector was specified, locate the right elements in a dummy div 26125 // Exclude scripts to avoid IE 'Permission Denied' errors 26126 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 26127 26128 // Otherwise use the full result 26129 responseText ); 26130 26131 // If the request succeeds, this function gets "data", "status", "jqXHR" 26132 // but they are ignored because response was set above. 26133 // If it fails, this function gets "jqXHR", "status", "error" 26134 } ).always( callback && function( jqXHR, status ) { 26135 self.each( function() { 26136 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 26137 } ); 26138 } ); 26139 } 26140 26141 return this; 26142 }; 26143 26144 26145 26146 26147 // Attach a bunch of functions for handling common AJAX events 26148 jQuery.each( [ 26149 "ajaxStart", 26150 "ajaxStop", 26151 "ajaxComplete", 26152 "ajaxError", 26153 "ajaxSuccess", 26154 "ajaxSend" 26155 ], function( i, type ) { 26156 jQuery.fn[ type ] = function( fn ) { 26157 return this.on( type, fn ); 26158 }; 26159 } ); 26160 26161 26162 26163 26164 jQuery.expr.pseudos.animated = function( elem ) { 26165 return jQuery.grep( jQuery.timers, function( fn ) { 26166 return elem === fn.elem; 26167 } ).length; 26168 }; 26169 26170 26171 26172 26173 jQuery.offset = { 26174 setOffset: function( elem, options, i ) { 26175 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft,
vendor: 6,067 bytes, lines 26175-26383
26175calculatePosition, 26176 position = jQuery.css( elem, "position" ), 26177 curElem = jQuery( elem ), 26178 props = {}; 26179 26180 // Set position first, in-case top/left are set even on static elem 26181 if ( position === "static" ) { 26182 elem.style.position = "relative"; 26183 } 26184 26185 curOffset = curElem.offset(); 26186 curCSSTop = jQuery.css( elem, "top" ); 26187 curCSSLeft = jQuery.css( elem, "left" ); 26188 calculatePosition = ( position === "absolute" || position === "fixed" ) && 26189 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 26190 26191 // Need to be able to calculate position if either 26192 // top or left is auto and position is either absolute or fixed 26193 if ( calculatePosition ) { 26194 curPosition = curElem.position(); 26195 curTop = curPosition.top; 26196 curLeft = curPosition.left; 26197 26198 } else { 26199 curTop = parseFloat( curCSSTop ) || 0; 26200 curLeft = parseFloat( curCSSLeft ) || 0; 26201 } 26202 26203 if ( jQuery.isFunction( options ) ) { 26204 26205 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 26206 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 26207 } 26208 26209 if ( options.top != null ) { 26210 props.top = ( options.top - curOffset.top ) + curTop; 26211 } 26212 if ( options.left != null ) { 26213 props.left = ( options.left - curOffset.left ) + curLeft; 26214 } 26215 26216 if ( "using" in options ) { 26217 options.using.call( elem, props ); 26218 26219 } else { 26220 curElem.css( props ); 26221 } 26222 } 26223 }; 26224 26225 jQuery.fn.extend( { 26226 offset: function( options ) { 26227 26228 // Preserve chaining for setter 26229 if ( arguments.length ) { 26230 return options === undefined ? 26231 this : 26232 this.each( function( i ) { 26233 jQuery.offset.setOffset( this, options, i ); 26234 } ); 26235 } 26236 26237 var doc, docElem, rect, win, 26238 elem = this[ 0 ]; 26239 26240 if ( !elem ) { 26241 return; 26242 } 26243 26244 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 26245 // Support: IE <=11 only 26246 // Running getBoundingClientRect on a 26247 // disconnected node in IE throws an error 26248 if ( !elem.getClientRects().length ) { 26249 return { top: 0, left: 0 }; 26250 } 26251 26252 rect = elem.getBoundingClientRect(); 26253 26254 doc = elem.ownerDocument; 26255 docElem = doc.documentElement; 26256 win = doc.defaultView; 26257 26258 return { 26259 top: rect.top + win.pageYOffset - docElem.clientTop, 26260 left: rect.left + win.pageXOffset - docElem.clientLeft 26261 }; 26262 }, 26263 26264 position: function() { 26265 if ( !this[ 0 ] ) { 26266 return; 26267 } 26268 26269 var offsetParent, offset, 26270 elem = this[ 0 ], 26271 parentOffset = { top: 0, left: 0 }; 26272 26273 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, 26274 // because it is its only offset parent 26275 if ( jQuery.css( elem, "position" ) === "fixed" ) { 26276 26277 // Assume getBoundingClientRect is there when computed position is fixed 26278 offset = elem.getBoundingClientRect(); 26279 26280 } else { 26281 26282 // Get *real* offsetParent 26283 offsetParent = this.offsetParent(); 26284 26285 // Get correct offsets 26286 offset = this.offset(); 26287 if ( !nodeName( offsetParent[ 0 ], "html" ) ) { 26288 parentOffset = offsetParent.offset(); 26289 } 26290 26291 // Add offsetParent borders 26292 parentOffset = { 26293 top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ), 26294 left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) 26295 }; 26296 } 26297 26298 // Subtract parent offsets and element margins 26299 return { 26300 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 26301 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 26302 }; 26303 }, 26304 26305 // This method will return documentElement in the following cases: 26306 // 1) For the element inside the iframe without offsetParent, this method will return 26307 // documentElement of the parent window 26308 // 2) For the hidden or detached element 26309 // 3) For body or html element, i.e. in case of the html node - it will return itself 26310 // 26311 // but those exceptions were never presented as a real life use-cases 26312 // and might be considered as more preferable results. 26313 // 26314 // This logic, however, is not guaranteed and can change at any point in the future 26315 offsetParent: function() { 26316 return this.map( function() { 26317 var offsetParent = this.offsetParent; 26318 26319 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 26320 offsetParent = offsetParent.offsetParent; 26321 } 26322 26323 return offsetParent || documentElement; 26324 } ); 26325 } 26326 } ); 26327 26328 // Create scrollLeft and scrollTop methods 26329 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 26330 var top = "pageYOffset" === prop; 26331 26332 jQuery.fn[ method ] = function( val ) { 26333 return access( this, function( elem, method, val ) { 26334 26335 // Coalesce documents and windows 26336 var win; 26337 if ( jQuery.isWindow( elem ) ) { 26338 win = elem; 26339 } else if ( elem.nodeType === 9 ) { 26340 win = elem.defaultView; 26341 } 26342 26343 if ( val === undefined ) { 26344 return win ? win[ prop ] : elem[ method ]; 26345 } 26346 26347 if ( win ) { 26348 win.scrollTo( 26349 !top ? val : win.pageXOffset, 26350 top ? val : win.pageYOffset 26351 ); 26352 26353 } else { 26354 elem[ method ] = val; 26355 } 26356 }, method, val, arguments.length ); 26357 }; 26358 } ); 26359 26360 // Support: Safari <=7 - 9.1, Chrome <=37 - 49 26361 // Add the top/left cssHooks using jQuery.fn.position 26362 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 26363 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 26364 // getComputedStyle returns percent when specified for top/left/bottom/right; 26365 // rather than make the css module depend on the offset module, just check for it here 26366 jQuery.each( [ "top", "left" ], function( i, prop ) { 26367 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 26368 function( elem, computed ) { 26369 if ( computed ) { 26370 computed = curCSS( elem, prop ); 26371 26372 // If curCSS returns percentage, fallback to offset 26373 return rnumnonpx.test( computed ) ? 26374 jQuery( elem ).position()[ prop ] + "px" : 26375 computed; 26376 } 26377 } 26378 ); 26379 } ); 26380 26381 26382 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 26383 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
vendor: 4,387 bytes, lines 26384-26535
26384 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 26385 function( defaultExtra, funcName ) { 26386 26387 // Margin is only for outerHeight, outerWidth 26388 jQuery.fn[ funcName ] = function( margin, value ) { 26389 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 26390 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 26391 26392 return access( this, function( elem, type, value ) { 26393 var doc; 26394 26395 if ( jQuery.isWindow( elem ) ) { 26396 26397 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 26398 return funcName.indexOf( "outer" ) === 0 ? 26399 elem[ "inner" + name ] : 26400 elem.document.documentElement[ "client" + name ]; 26401 } 26402 26403 // Get document width or height 26404 if ( elem.nodeType === 9 ) { 26405 doc = elem.documentElement; 26406 26407 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 26408 // whichever is greatest 26409 return Math.max( 26410 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 26411 elem.body[ "offset" + name ], doc[ "offset" + name ], 26412 doc[ "client" + name ] 26413 ); 26414 } 26415 26416 return value === undefined ? 26417 26418 // Get width or height on the element, requesting but not forcing parseFloat 26419 jQuery.css( elem, type, extra ) : 26420 26421 // Set width or height on the element 26422 jQuery.style( elem, type, value, extra ); 26423 }, type, chainable ? margin : undefined, chainable ); 26424 }; 26425 } ); 26426 } ); 26427 26428 26429 jQuery.fn.extend( { 26430 26431 bind: function( types, data, fn ) { 26432 return this.on( types, null, data, fn ); 26433 }, 26434 unbind: function( types, fn ) { 26435 return this.off( types, null, fn ); 26436 }, 26437 26438 delegate: function( selector, types, data, fn ) { 26439 return this.on( types, selector, data, fn ); 26440 }, 26441 undelegate: function( selector, types, fn ) { 26442 26443 // ( namespace ) or ( selector, types [, fn] ) 26444 return arguments.length === 1 ? 26445 this.off( selector, "**" ) : 26446 this.off( types, selector || "**", fn ); 26447 } 26448 } ); 26449 26450 jQuery.holdReady = function( hold ) { 26451 if ( hold ) { 26452 jQuery.readyWait++; 26453 } else { 26454 jQuery.ready( true ); 26455 } 26456 }; 26457 jQuery.isArray = Array.isArray; 26458 jQuery.parseJSON = JSON.parse; 26459 jQuery.nodeName = nodeName; 26460 26461 26462 26463 26464 // Register as a named AMD module, since jQuery can be concatenated with other 26465 // files that may use define, but not via a proper concatenation script that 26466 // understands anonymous AMD modules. A named AMD is safest and most robust 26467 // way to register. Lowercase jquery is used because AMD module names are 26468 // derived from file names, and jQuery is normally delivered in a lowercase 26469 // file name. Do this after creating the global so that if an AMD module wants 26470 // to call noConflict to hide this version of jQuery, it will work. 26471 26472 // Note that for maximum portability, libraries that are not jQuery should 26473 // declare themselves as anonymous modules, and avoid setting a global if an 26474 // AMD loader is present. jQuery is a special case. For more information, see 26475 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 26476 26477 if ( true ) { 26478 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { 26479 return jQuery; 26480 }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 26481 } 26482 26483 26484 26485 26486 var 26487 26488 // Map over jQuery in case of overwrite 26489 _jQuery = window.jQuery, 26490 26491 // Map over the $ in case of overwrite 26492 _$ = window.$; 26493 26494 jQuery.noConflict = function( deep ) { 26495 if ( window.$ === jQuery ) { 26496 window.$ = _$; 26497 } 26498 26499 if ( deep && window.jQuery === jQuery ) { 26500 window.jQuery = _jQuery; 26501 } 26502 26503 return jQuery; 26504 }; 26505 26506 // Expose jQuery and $ identifiers, even in AMD 26507 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 26508 // and CommonJS for browser emulators (#13566) 26509 if ( !noGlobal ) { 26510 window.jQuery = window.$ = jQuery; 26511 } 26512 26513 26514 26515 26516 return jQuery; 26517 } ); 26518 26519 26520/***/ }), 26521/* 304 */ 26522/***/ (function(module, exports, __webpack_require__) { 26523 26524 // THIS FILE IS GENERATED - DO NOT EDIT! 26525 /*!mobile-detect v1.3.6 2017-04-05*/ 26526 /*global module:false, define:false*/ 26527 /*jshint latedef:false*/ 26528 /*!@license Copyright 2013, Heinrich Goebl, License: MIT, see https://github.com/hgoebl/mobile-detect.js*/ 26529 (function (define, undefined) { 26530 define(function () { 26531 'use strict'; 26532 26533 var impl = {}; 26534 26535 impl.mobileDetectRules = {
26536 "phones": { 26537 "iPhone": "\\biPhone\\b|\\biPod\\b", 26538 "BlackBerry": "BlackBerry|\\bBB10\\b|rim[0-9]+", 26539 "HTC": "HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\bEVO\\b|T-Mobile G1|Z520m", 26540 "Nexus": "Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6", 26541 "Dell": "Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\\b001DL\\b|\\b101DL\\b|\\bGS01\\b", 26542 "Motorola": "Motorola|DROIDX|DROID BIONIC|\\bDroid\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b", 26543 "Samsung": "\\bSamsung\\b
vendor: 5,343 bytes, line 26543
26543|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C
26543", 26544 "LG": "\\bLG\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323)", 26545 "Sony": "SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533", 26546 "Asus": "Asus.*Galaxy|PadFone.*Mobile", 26547 "NokiaLumia": "Lumia [0-9]{3,4}", 26548 "Micromax": "Micromax.*\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\b", 26549 "Palm": "PalmSource|Palm", 26550 "Vertu": "Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature", 26551 "Pantech": "PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790", 26552 "Fly": "IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250", 26553 "Wiko": "KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLI
26553M|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM", 26554 "iMobile": "i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)", 26555 "SimValley": "\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\b", 26556 "Wolfgang": "AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q", 26557 "Alcatel": "Alcatel", 26558 "Nintendo": "Nintendo 3DS", 26559 "Amoi": "Amoi", 26560 "INQ": "INQ", 26561 "GenericPhone": "Tapatalk|PDA;|SAGEM|\\bmmp\\b|pocket|\\bpsp\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\bwap\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser" 26562 }, 26563 "tablets": { 26564 "iPad": "iPad|iPad.*Mobile", 26565 "NexusTablet": "Android.*Nexus[\\s]+(7|9|10)", 26566 "SamsungTablet": "SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587", 26567 "Kindle": "Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\b|Android.*Silk\/[0-9.]+ like Chrome\/[0-9.]+ (?!Mobile)", 26568 "SurfaceTablet": "Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)", 26569 "HPTablet": "HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10", 26570 "AsusTablet": "^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z", 26571 "BlackBerryTablet": "PlayBook|RIM Tablet", 26572 "HTCtablet": "HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410", 26573 "MotorolaTablet": "xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617", 26574 "NookTablet": "Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2", 26575 "AcerTablet": "Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20\\b|\\bA3-A30", 26576 "ToshibaTablet": "Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO", 26577 "LGTablet": "\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V4
2657700|LG-VK810\\b", 26578 "FujitsuTablet": "Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b", 26579 "PrestigioTablet": "PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002", 26580 "LenovoTablet": "Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)", 26581 "DellTablet": "Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7", 26582 "YarvikTablet": "Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b", 26583 "MedionTablet": "Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB", 26584 "ArnovaTablet": "97G4|AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2", 26585 "IntensoTablet": "INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004", 26586 "IRUTablet": "M702pro", 26587 "MegafonTablet": "MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b", 26588 "EbodaTablet": "E-Boda (Supreme|Impresspeed|Izzycomm|Essential)", 26589 "AllViewTablet": "Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)", 26590 "ArchosTablet": "\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|c|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b", 26591 "AinolTablet": "NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark", 26592 "NokiaLumiaTablet": "Lumia 2520", 26593 "SonyTablet": "Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612|SOT31", 26594 "PhilipsTablet": "\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b", 26595 "CubeTablet": "Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT", 26596 "CobyTablet": "MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010", 26597 "MIDTablet": "M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10", 26598 "MSITablet": "MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b", 26599 "SMiTTablet": "Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)", 26600 "RockChipTablet": "Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A", 26601 "FlyTablet": "IQ310|Fly Vision", 26602 "bqTablet": "Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris [E|M]10)|Maxwell.*Lite|Maxwell.*Plus", 26603 "HuaweiTablet": "MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim", 26604 "NecTablet": "\\bN-06D|\\bN-08D", 26605 "PantechTablet": "Pantech.*P4100",
26606 "BronchoTablet": "Broncho.*(N701|N708|N802|a710)", 26607 "VersusTablet": "TOUCHPAD.*[78910]|\\bTOUCHTAB\\b", 26608 "ZyncTablet": "z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900", 26609 "PositivoTablet": "TB07STA|TB10STA|TB07FTA|TB10FTA", 26610 "NabiTablet": "Android.*\\bNabi", 26611 "KoboTablet": "Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build", 26612 "DanewTablet": "DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b", 26613 "TexetTablet": "NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE", 26614 "PlaystationTablet": "Playstation.*(Portable|Vita)", 26615 "TrekstorTablet": "ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab", 26616 "PyleAudioTablet": "\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b", 26617 "AdvanTablet": "Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ", 26618 "DanyTechTablet": "Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1", 26619 "GalapadTablet": "Android.*\\bG1\\b", 26620 "MicromaxTablet": "Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b", 26621 "KarbonnTablet": "Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b", 26622 "AllFineTablet": "Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide", 26623 "PROSCANTablet": "\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b", 26624 "YONESTablet": "BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026", 26625 "ChangJiaTablet": "TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503", 26626 "GUTablet": "TX-A1301|TX-M9002|Q702|kf026", 26627 "PointOfViewTablet": "TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10", 26628 "OvermaxTablet": "OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)", 26629 "HCLTablet": "HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync", 26630 "DPSTablet": "DPS Dream 9|DPS Dual 7", 26631 "VistureTablet": "V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10", 26632 "CrestaTablet": "CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989", 26633 "MediatekTablet": "\\bMT8125|MT8389|MT8135|MT8377\\b", 26634 "ConcordeTablet": "Concorde([ ]+)?Tab|ConCorde ReadMan", 26635 "GoCleverTablet": "GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042", 26636 "ModecomTablet": "FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003", 26637 "VoninoTablet": "\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b", 26638 "ECSTablet": "V07OT2|TM105A|S10OT1|TR10CS1", 26639 "StorexTablet": "eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab", 26640 "VodafoneTablet": "SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497", 26641 "EssentielBTablet": "Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2", 26642 "RossMoorTablet": "RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711", 26643 "iMobileTablet": "i-mobile i-note", 26644 "TolinoTablet": "tolino tab [0-9.]+|tolino shine", 26645 "AudioSonicTablet": "\\bC-22Q|T7-QC|T-17B|T-17P\\b", 26646 "AMPETablet": "Android.* A78 ", 26647 "SkkTablet": "Android.* (SKYPAD|PHOENIX|CYCLOPS)", 26648 "TecnoTablet": "TECNO P9", 26649 "JXDTablet": "Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b", 26650 "iJoyTablet": "Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)", 26651 "FX2Tablet": "FX2 PAD7|FX2 PAD10", 26652 "XoroTablet": "KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151", 26653 "ViewsonicTablet": "ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a", 26654 "OdysTablet": "LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10", 26655 "CaptivaTablet": "CAPTIVA PAD", 26656 "IconbitTablet": "NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S", 26657 "TeclastTablet": "T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi", 26658 "OndaTablet": "\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+", 26659 "JaytechTablet": "TPC-PA762", 26660 "BlaupunktTablet": "Endeavour 800NG|Endeavour 1010", 26661 "DigmaTablet": "\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b", 26662 "EvolioTablet": "ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b", 26663 "LavaTablet": "QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b", 26664 "AocTablet": "MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712", 26665 "MpmanTablet": "MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010", 26666 "CelkonTablet": "CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b", 26667 "WolderTablet": "miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b", 26668 "MiTablet": "\\bMI PAD\\b|\\bHM NOTE 1W\\b", 26669 "NibiruTablet": "Nibiru M1|Nibiru Jupiter One", 26670 "NexoTablet": "NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI", 26671 "LeaderTablet": "TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100", 26672 "UbislateTablet": "UbiSlate[\\s]?7C", 26673 "PocketBookTablet": "Pocketbook", 26674 "KocasoTablet": "\\b(TB-1207)\\b", 26675 "HisenseTablet": "\\b(F5281|E2371)\\b", 26676 "Hudl": "Hudl HT7S3|Hudl 2", 26677 "TelstraTablet": "T-Hub2", 26678 "GenericTablet": "Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bTP750\\b" 26679 }, 26680 "oss": { 26681 "AndroidOS": "Android", 26682 "BlackBerryOS": "blackberry|\\bBB10\\b|rim tablet os", 26683 "PalmOS": "PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino",
26684 "SymbianOS": "Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\bS60\\b", 26685 "WindowsMobileOS": "Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;", 26686 "WindowsPhoneOS": "Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;", 26687 "iOS": "\\biPhone.*Mobile|\\biPod|\\biPad", 26688 "MeeGoOS": "MeeGo", 26689 "MaemoOS": "Maemo", 26690 "JavaOS": "J2ME\/|\\bMIDP\\b|\\bCLDC\\b", 26691 "webOS": "webOS|hpwOS", 26692 "badaOS": "\\bBada\\b", 26693 "BREWOS": "BREW" 26694 }, 26695 "uas": { 26696 "Chrome": "\\bCrMo\\b|CriOS|Android.*Chrome\/[.0-9]* (Mobile)?", 26697 "Dolfin": "\\bDolfin\\b", 26698 "Opera": "Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\/[0-9.]+|Coast\/[0-9.]+", 26699 "Skyfire": "Skyfire", 26700 "Edge": "Mobile Safari\/[.0-9]* Edge", 26701 "IE": "IEMobile|MSIEMobile", 26702 "Firefox": "fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS", 26703 "Bolt": "bolt", 26704 "TeaShark": "teashark", 26705 "Blazer": "Blazer", 26706 "Safari": "Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari", 26707 "UCBrowser": "UC.*Browser|UCWEB", 26708 "baiduboxapp": "baiduboxapp", 26709 "baidubrowser": "baidubrowser", 26710 "DiigoBrowser": "DiigoBrowser", 26711 "Puffin": "Puffin", 26712 "Mercury": "\\bMercury\\b", 26713 "ObigoBrowser": "Obigo", 26714 "NetFront": "NF-Browser", 26715 "GenericBrowser": "NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger", 26716 "PaleMoon": "Android.*PaleMoon|Mobile.*PaleMoon" 26717 }, 26718 "props": { 26719 "Mobile": "Mobile\/[VER]", 26720 "Build": "Build\/[VER]", 26721 "Version": "Version\/[VER]", 26722 "VendorID": "VendorID\/[VER]", 26723 "iPad": "iPad.*CPU[a-z ]+[VER]", 26724 "iPhone": "iPhone.*CPU[a-z ]+[VER]", 26725 "iPod": "iPod.*CPU[a-z ]+[VER]", 26726 "Kindle": "Kindle\/[VER]", 26727 "Chrome": [ 26728 "Chrome\/[VER]", 26729 "CriOS\/[VER]", 26730 "CrMo\/[VER]" 26731 ], 26732 "Coast": [ 26733 "Coast\/[VER]" 26734 ], 26735 "Dolfin": "Dolfin\/[VER]", 26736 "Firefox": [ 26737 "Firefox\/[VER]", 26738 "FxiOS\/[VER]" 26739 ], 26740 "Fennec": "Fennec\/[VER]", 26741 "Edge": "Edge\/[VER]", 26742 "IE": [ 26743 "IEMobile\/[VER];", 26744 "IEMobile [VER]", 26745 "MSIE [VER];", 26746 "Trident\/[0-9.]+;.*rv:[VER]" 26747 ], 26748 "NetFront": "NetFront\/[VER]", 26749 "NokiaBrowser": "NokiaBrowser\/[VER]", 26750 "Opera": [ 26751 " OPR\/[VER]", 26752 "Opera Mini\/[VER]", 26753 "Version\/[VER]" 26754 ], 26755 "Opera Mini": "Opera Mini\/[VER]", 26756 "Opera Mobi": "Version\/[VER]", 26757 "UC Browser": "UC Browser[VER]", 26758 "MQQBrowser": "MQQBrowser\/[VER]", 26759 "MicroMessenger": "MicroMessenger\/[VER]", 26760 "baiduboxapp": "baiduboxapp\/[VER]", 26761 "baidubrowser": "baidubrowser\/[VER]", 26762 "SamsungBrowser": "SamsungBrowser\/[VER]", 26763 "Iron": "Iron\/[VER]", 26764 "Safari": [ 26765 "Version\/[VER]", 26766 "Safari\/[VER]" 26767 ], 26768 "Skyfire": "Skyfire\/[VER]", 26769 "Tizen": "Tizen\/[VER]", 26770 "Webkit": "webkit[ \/][VER]", 26771 "PaleMoon": "PaleMoon\/[VER]", 26772 "Gecko": "Gecko\/[VER]", 26773 "Trident": "Trident\/[VER]", 26774 "Presto": "Presto\/[VER]", 26775 "Goanna": "Goanna\/[VER]", 26776 "iOS": " \\bi?OS\\b [VER][ ;]{1}", 26777 "Android": "Android [VER]", 26778 "BlackBerry": [ 26779 "BlackBerry[\\w]+\/[VER]", 26780 "BlackBerry.*Version\/[VER]", 26781 "Version\/[VER]" 26782 ], 26783 "BREW": "BREW [VER]", 26784 "Java": "Java\/[VER]", 26785 "Windows Phone OS": [ 26786 "Windows Phone OS [VER]", 26787 "Windows Phone [VER]" 26788 ], 26789 "Windows Phone": "Windows Phone [VER]", 26790 "Windows CE": "Windows CE\/[VER]", 26791 "Windows NT": "Windows NT [VER]", 26792 "Symbian": [ 26793 "SymbianOS\/[VER]", 26794 "Symbian\/[VER]" 26795 ], 26796 "webOS": [ 26797 "webOS\/[VER]", 26798 "hpwOS\/[VER];" 26799 ] 26800 }, 26801 "utils": { 26802 "Bot": "Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom", 26803 "MobileBot": "Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker\/M1A1-R2D2", 26804 "DesktopMode": "WPDesktop", 26805 "TV": "SonyDTV|HbbTV", 26806 "WebKit": "(webkit)[ \/]([\\w.]+)", 26807 "Console": "\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|PLAYSTATION|Xbox)\\b", 26808 "Watch": "SM-V700" 26809 } 26810 }; 26811 26812 // following patterns come from http://detectmobilebrowsers.com/ 26813 impl.detectMobileBrowsers = { 26814 fullPattern: /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i, 26815 shortPattern: /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
26815sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i, 26816 tabletPattern: /android|ipad|playbook|silk/i 26817 }; 26818 26819 var hasOwnProp = Object.prototype.hasOwnProperty, 26820 isArray; 26821 26822 impl.FALLBACK_PHONE = 'UnknownPhone'; 26823 impl.FALLBACK_TABLET = 'UnknownTablet'; 26824 impl.FALLBACK_MOBILE = 'UnknownMobile'; 26825 26826 isArray = ('isArray' in Array) ? 26827 Array.isArray : function (value) { return Object.prototype.toString.call(value) === '[object Array]'; }; 26828 26829 function equalIC(a, b) { 26830 return a != null && b != null && a.toLowerCase() === b.toLowerCase(); 26831 } 26832 26833 function containsIC(array, value) { 26834 var valueLC, i, len = array.length; 26835 if (!len || !value) { 26836 return false; 26837 } 26838 valueLC = value.toLowerCase(); 26839 for (i = 0; i < len; ++i) {
vendor: 20,199 bytes, lines 26840-27282
26840 if (valueLC === array[i].toLowerCase()) { 26841 return true; 26842 } 26843 } 26844 return false; 26845 } 26846 26847 function convertPropsToRegExp(object) { 26848 for (var key in object) { 26849 if (hasOwnProp.call(object, key)) { 26850 object[key] = new RegExp(object[key], 'i'); 26851 } 26852 } 26853 } 26854 26855 (function init() { 26856 var key, values, value, i, len, verPos, mobileDetectRules = impl.mobileDetectRules; 26857 for (key in mobileDetectRules.props) { 26858 if (hasOwnProp.call(mobileDetectRules.props, key)) { 26859 values = mobileDetectRules.props[key]; 26860 if (!isArray(values)) { 26861 values = [values]; 26862 } 26863 len = values.length; 26864 for (i = 0; i < len; ++i) { 26865 value = values[i]; 26866 verPos = value.indexOf('[VER]'); 26867 if (verPos >= 0) { 26868 value = value.substring(0, verPos) + '([\\w._\\+]+)' + value.substring(verPos + 5); 26869 } 26870 values[i] = new RegExp(value, 'i'); 26871 } 26872 mobileDetectRules.props[key] = values; 26873 } 26874 } 26875 convertPropsToRegExp(mobileDetectRules.oss); 26876 convertPropsToRegExp(mobileDetectRules.phones); 26877 convertPropsToRegExp(mobileDetectRules.tablets); 26878 convertPropsToRegExp(mobileDetectRules.uas); 26879 convertPropsToRegExp(mobileDetectRules.utils); 26880 26881 // copy some patterns to oss0 which are tested first (see issue#15) 26882 mobileDetectRules.oss0 = { 26883 WindowsPhoneOS: mobileDetectRules.oss.WindowsPhoneOS, 26884 WindowsMobileOS: mobileDetectRules.oss.WindowsMobileOS 26885 }; 26886 }()); 26887 26888 /** 26889 * Test userAgent string against a set of rules and find the first matched key. 26890 * @param {Object} rules (key is String, value is RegExp) 26891 * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent'). 26892 * @returns {String|null} the matched key if found, otherwise <tt>null</tt> 26893 * @private 26894 */ 26895 impl.findMatch = function(rules, userAgent) { 26896 for (var key in rules) { 26897 if (hasOwnProp.call(rules, key)) { 26898 if (rules[key].test(userAgent)) { 26899 return key; 26900 } 26901 } 26902 } 26903 return null; 26904 }; 26905 26906 /** 26907 * Test userAgent string against a set of rules and return an array of matched keys. 26908 * @param {Object} rules (key is String, value is RegExp) 26909 * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent'). 26910 * @returns {Array} an array of matched keys, may be empty when there is no match, but not <tt>null</tt> 26911 * @private 26912 */ 26913 impl.findMatches = function(rules, userAgent) { 26914 var result = []; 26915 for (var key in rules) { 26916 if (hasOwnProp.call(rules, key)) { 26917 if (rules[key].test(userAgent)) { 26918 result.push(key); 26919 } 26920 } 26921 } 26922 return result; 26923 }; 26924 26925 /** 26926 * Check the version of the given property in the User-Agent. 26927 * 26928 * @param {String} propertyName 26929 * @param {String} userAgent 26930 * @return {String} version or <tt>null</tt> if version not found 26931 * @private 26932 */ 26933 impl.getVersionStr = function (propertyName, userAgent) { 26934 var props = impl.mobileDetectRules.props, patterns, i, len, match; 26935 if (hasOwnProp.call(props, propertyName)) { 26936 patterns = props[propertyName]; 26937 len = patterns.length; 26938 for (i = 0; i < len; ++i) { 26939 match = patterns[i].exec(userAgent); 26940 if (match !== null) { 26941 return match[1]; 26942 } 26943 } 26944 } 26945 return null; 26946 }; 26947 26948 /** 26949 * Check the version of the given property in the User-Agent. 26950 * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) 26951 * 26952 * @param {String} propertyName 26953 * @param {String} userAgent 26954 * @return {Number} version or <tt>NaN</tt> if version not found 26955 * @private 26956 */ 26957 impl.getVersion = function (propertyName, userAgent) { 26958 var version = impl.getVersionStr(propertyName, userAgent); 26959 return version ? impl.prepareVersionNo(version) : NaN; 26960 }; 26961 26962 /** 26963 * Prepare the version number. 26964 * 26965 * @param {String} version 26966 * @return {Number} the version number as a floating number 26967 * @private 26968 */ 26969 impl.prepareVersionNo = function (version) { 26970 var numbers; 26971 26972 numbers = version.split(/[a-z._ \/\-]/i); 26973 if (numbers.length === 1) { 26974 version = numbers[0]; 26975 } 26976 if (numbers.length > 1) { 26977 version = numbers[0] + '.'; 26978 numbers.shift(); 26979 version += numbers.join(''); 26980 } 26981 return Number(version); 26982 }; 26983 26984 impl.isMobileFallback = function (userAgent) { 26985 return impl.detectMobileBrowsers.fullPattern.test(userAgent) || 26986 impl.detectMobileBrowsers.shortPattern.test(userAgent.substr(0,4)); 26987 }; 26988 26989 impl.isTabletFallback = function (userAgent) { 26990 return impl.detectMobileBrowsers.tabletPattern.test(userAgent); 26991 }; 26992 26993 impl.prepareDetectionCache = function (cache, userAgent, maxPhoneWidth) { 26994 if (cache.mobile !== undefined) { 26995 return; 26996 } 26997 var phone, tablet, phoneSized; 26998 26999 // first check for stronger tablet rules, then phone (see issue#5) 27000 tablet = impl.findMatch(impl.mobileDetectRules.tablets, userAgent); 27001 if (tablet) { 27002 cache.mobile = cache.tablet = tablet; 27003 cache.phone = null; 27004 return; // unambiguously identified as tablet 27005 } 27006 27007 phone = impl.findMatch(impl.mobileDetectRules.phones, userAgent); 27008 if (phone) { 27009 cache.mobile = cache.phone = phone; 27010 cache.tablet = null; 27011 return; // unambiguously identified as phone 27012 } 27013 27014 // our rules haven't found a match -> try more general fallback rules 27015 if (impl.isMobileFallback(userAgent)) { 27016 phoneSized = MobileDetect.isPhoneSized(maxPhoneWidth); 27017 if (phoneSized === undefined) { 27018 cache.mobile = impl.FALLBACK_MOBILE; 27019 cache.tablet = cache.phone = null; 27020 } else if (phoneSized) { 27021 cache.mobile = cache.phone = impl.FALLBACK_PHONE; 27022 cache.tablet = null; 27023 } else { 27024 cache.mobile = cache.tablet = impl.FALLBACK_TABLET; 27025 cache.phone = null; 27026 } 27027 } else if (impl.isTabletFallback(userAgent)) { 27028 cache.mobile = cache.tablet = impl.FALLBACK_TABLET; 27029 cache.phone = null; 27030 } else { 27031 // not mobile at all! 27032 cache.mobile = cache.tablet = cache.phone = null; 27033 } 27034 }; 27035 27036 // t is a reference to a MobileDetect instance 27037 impl.mobileGrade = function (t) { 27038 // impl note: 27039 // To keep in sync w/ Mobile_Detect.php easily, the following code is tightly aligned to the PHP version. 27040 // When changes are made in Mobile_Detect.php, copy this method and replace: 27041 // $this-> / t. 27042 // self::MOBILE_GRADE_(.) / '$1' 27043 // , self::VERSION_TYPE_FLOAT / (nothing) 27044 // isIOS() / os('iOS') 27045 // [reg] / (nothing) <-- jsdelivr complaining about unescaped unicode character U+00AE 27046 var $isMobile = t.mobile() !== null; 27047 27048 if ( 27049 // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) 27050 t.os('iOS') && t.version('iPad')>=4.3 || 27051 t.os('iOS') && t.version('iPhone')>=3.1 || 27052 t.os('iOS') && t.version('iPod')>=3.1 || 27053 27054 // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) 27055 // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM 27056 // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices 27057 // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 27058 ( t.version('Android')>2.1 && t.is('Webkit') ) || 27059 27060 // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 27061 t.version('Windows Phone OS')>=7.0 || 27062 27063 // Blackberry 7 - Tested on BlackBerry Torch 9810 27064 // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 27065 t.is('BlackBerry') && t.version('BlackBerry')>=6.0 || 27066 // Blackberry Playbook (1.0-2.0) - Tested on PlayBook 27067 t.match('Playbook.*Tablet') || 27068 27069 // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) 27070 ( t.version('webOS')>=1.4 && t.match('Palm|Pre|Pixi') ) || 27071 // Palm WebOS 3.0 - Tested on HP TouchPad 27072 t.match('hp.*TouchPad') || 27073 27074 // Firefox Mobile (12 Beta) - Tested on Android 2.3 device 27075 ( t.is('Firefox') && t.version('Firefox')>=12 ) || 27076 27077 // Chrome for Android - Tested on Android 4.0, 4.1 device 27078 ( t.is('Chrome') && t.is('AndroidOS') && t.version('Android')>=4.0 ) || 27079 27080 // Skyfire 4.1 - Tested on Android 2.3 device 27081 ( t.is('Skyfire') && t.version('Skyfire')>=4.1 && t.is('AndroidOS') && t.version('Android')>=2.3 ) || 27082 27083 // Opera Mobile 11.5-12: Tested on Android 2.3 27084 ( t.is('Opera') && t.version('Opera Mobi')>11 && t.is('AndroidOS') ) || 27085 27086 // Meego 1.2 - Tested on Nokia 950 and N9 27087 t.is('MeeGoOS') || 27088 27089 // Tizen (pre-release) - Tested on early hardware 27090 t.is('Tizen') || 27091 27092 // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser 27093 // @todo: more tests here! 27094 t.is('Dolfin') && t.version('Bada')>=2.0 || 27095 27096 // UC Browser - Tested on Android 2.3 device 27097 ( (t.is('UC Browser') || t.is('Dolfin')) && t.version('Android')>=2.3 ) || 27098 27099 // Kindle 3 and Fire - Tested on the built-in WebKit browser for each 27100 ( t.match('Kindle Fire') || 27101 t.is('Kindle') && t.version('Kindle')>=3.0 ) || 27102 27103 // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet 27104 t.is('AndroidOS') && t.is('NookTablet') || 27105 27106 // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 27107 t.version('Chrome')>=11 && !$isMobile || 27108 27109 // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 27110 t.version('Safari')>=5.0 && !$isMobile || 27111 27112 // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 27113 t.version('Firefox')>=4.0 && !$isMobile || 27114 27115 // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 27116 t.version('MSIE')>=7.0 && !$isMobile || 27117 27118 // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 27119 // @reference: http://my.opera.com/community/openweb/idopera/ 27120 t.version('Opera')>=10 && !$isMobile 27121 27122 ){ 27123 return 'A'; 27124 } 27125 27126 if ( 27127 t.os('iOS') && t.version('iPad')<4.3 || 27128 t.os('iOS') && t.version('iPhone')<3.1 || 27129 t.os('iOS') && t.version('iPod')<3.1 || 27130 27131 // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 27132 t.is('Blackberry') && t.version('BlackBerry')>=5 && t.version('BlackBerry')<6 || 27133 27134 //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 27135 ( t.version('Opera Mini')>=5.0 && t.version('Opera Mini')<=6.5 && 27136 (t.version('Android')>=2.3 || t.is('iOS')) ) || 27137 27138 // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) 27139 t.match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || 27140 27141 // @todo: report this (tested on Nokia N71) 27142 t.version('Opera Mobi')>=11 && t.is('SymbianOS') 27143 ){ 27144 return 'B'; 27145 } 27146 27147 if ( 27148 // Blackberry 4.x - Tested on the Curve 8330 27149 t.version('BlackBerry')<5.0 || 27150 // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) 27151 t.match('MSIEMobile|Windows CE.*Mobile') || t.version('Windows Mobile')<=5.2 27152 27153 ){ 27154 return 'C'; 27155 } 27156 27157 //All older smartphone platforms and featurephones - Any device that doesn't support media queries 27158 //will receive the basic, C grade experience. 27159 return 'C'; 27160 }; 27161 27162 impl.detectOS = function (ua) { 27163 return impl.findMatch(impl.mobileDetectRules.oss0, ua) || 27164 impl.findMatch(impl.mobileDetectRules.oss, ua); 27165 }; 27166 27167 impl.getDeviceSmallerSide = function () { 27168 return window.screen.width < window.screen.height ? 27169 window.screen.width : 27170 window.screen.height; 27171 }; 27172 27173 /** 27174 * Constructor for MobileDetect object. 27175 * <br> 27176 * Such an object will keep a reference to the given user-agent string and cache most of the detect queries.<br> 27177 * <div style="background-color: #d9edf7; border: 1px solid #bce8f1; color: #3a87ad; padding: 14px; border-radius: 2px; margin-top: 20px"> 27178 * <strong>Find information how to download and install:</strong> 27179 * <a href="https://github.com/hgoebl/mobile-detect.js/">github.com/hgoebl/mobile-detect.js/</a> 27180 * </div> 27181 * 27182 * @example <pre> 27183 * var md = new MobileDetect(window.navigator.userAgent); 27184 * if (md.mobile()) { 27185 * location.href = (md.mobileGrade() === 'A') ? '/mobile/' : '/lynx/'; 27186 * } 27187 * </pre> 27188 * 27189 * @param {string} userAgent typically taken from window.navigator.userAgent or http_header['User-Agent'] 27190 * @param {number} [maxPhoneWidth=600] <strong>only for browsers</strong> specify a value for the maximum 27191 * width of smallest device side (in logical "CSS" pixels) until a device detected as mobile will be handled 27192 * as phone. 27193 * This is only used in cases where the device cannot be classified as phone or tablet.<br> 27194 * See <a href="http://developer.android.com/guide/practices/screens_support.html">Declaring Tablet Layouts 27195 * for Android</a>.<br> 27196 * If you provide a value < 0, then this "fuzzy" check is disabled. 27197 * @constructor 27198 * @global 27199 */ 27200 function MobileDetect(userAgent, maxPhoneWidth) { 27201 this.ua = userAgent || ''; 27202 this._cache = {}; 27203 //600dp is typical 7" tablet minimum width 27204 this.maxPhoneWidth = maxPhoneWidth || 600; 27205 } 27206 27207 MobileDetect.prototype = { 27208 constructor: MobileDetect, 27209 27210 /** 27211 * Returns the detected phone or tablet type or <tt>null</tt> if it is not a mobile device. 27212 * <br> 27213 * For a list of possible return values see {@link MobileDetect#phone} and {@link MobileDetect#tablet}.<br> 27214 * <br> 27215 * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against 27216 * the patterns of <a href="http://detectmobilebrowsers.com/">detectmobilebrowsers.com</a>. If this test 27217 * is positive, a value of <code>UnknownPhone</code>, <code>UnknownTablet</code> or 27218 * <code>UnknownMobile</code> is returned.<br> 27219 * When used in browser, the decision whether phone or tablet is made based on <code>screen.width/height</code>.<br> 27220 * <br> 27221 * When used server-side (node.js), there is no way to tell the difference between <code>UnknownTablet</code> 27222 * and <code>UnknownMobile</code>, so you will get <code>UnknownMobile</code> here.<br> 27223 * Be aware that since v1.0.0 in this special case you will get <code>UnknownMobile</code> only for: 27224 * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. 27225 * In versions before v1.0.0 all 3 methods returned <code>UnknownMobile</code> which was tedious to use. 27226 * <br> 27227 * In most cases you will use the return value just as a boolean. 27228 * 27229 * @returns {String} the key for the phone family or tablet family, e.g. "Nexus". 27230 * @function MobileDetect#mobile 27231 */ 27232 mobile: function () { 27233 impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); 27234 return this._cache.mobile; 27235 }, 27236 27237 /** 27238 * Returns the detected phone type/family string or <tt>null</tt>. 27239 * <br> 27240 * The returned tablet (family or producer) is one of following keys:<br> 27241 * <br><tt>iPhone, BlackBerry, HTC, Nexus, Dell, Motorola, Samsung, LG, Sony, Asus, 27242 * NokiaLumia, Micromax, Palm, Vertu, Pantech, Fly, Wiko, iMobile, SimValley, 27243 * Wolfgang, Alcatel, Nintendo, Amoi, INQ, GenericPhone</tt><br> 27244 * <br> 27245 * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against 27246 * the patterns of <a href="http://detectmobilebrowsers.com/">detectmobilebrowsers.com</a>. If this test 27247 * is positive, a value of <code>UnknownPhone</code> or <code>UnknownMobile</code> is returned.<br> 27248 * When used in browser, the decision whether phone or tablet is made based on <code>screen.width/height</code>.<br> 27249 * <br> 27250 * When used server-side (node.js), there is no way to tell the difference between <code>UnknownTablet</code> 27251 * and <code>UnknownMobile</code>, so you will get <code>null</code> here, while {@link MobileDetect#mobile} 27252 * will return <code>UnknownMobile</code>.<br> 27253 * Be aware that since v1.0.0 in this special case you will get <code>UnknownMobile</code> only for: 27254 * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. 27255 * In versions before v1.0.0 all 3 methods returned <code>UnknownMobile</code> which was tedious to use. 27256 * <br> 27257 * In most cases you will use the return value just as a boolean. 27258 * 27259 * @returns {String} the key of the phone family or producer, e.g. "iPhone" 27260 * @function MobileDetect#phone 27261 */ 27262 phone: function () { 27263 impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); 27264 return this._cache.phone; 27265 }, 27266 27267 /** 27268 * Returns the detected tablet type/family string or <tt>null</tt>. 27269 * <br> 27270 * The returned tablet (family or producer) is one of following keys:<br> 27271 * <br><tt>iPad, NexusTablet, SamsungTablet, Kindle, SurfaceTablet, HPTablet, AsusTablet, 27272 * BlackBerryTablet, HTCtablet, MotorolaTablet, NookTablet, AcerTablet, 27273 * ToshibaTablet, LGTablet, FujitsuTablet, PrestigioTablet, LenovoTablet, 27274 * DellTablet, YarvikTablet, MedionTablet, ArnovaTablet, IntensoTablet, IRUTablet, 27275 * MegafonTablet, EbodaTablet, AllViewTablet, ArchosTablet, AinolTablet, 27276 * NokiaLumiaTablet, SonyTablet, PhilipsTablet, CubeTablet, CobyTablet, MIDTablet, 27277 * MSITablet, SMiTTablet, RockChipTablet, FlyTablet, bqTablet, HuaweiTablet, 27278 * NecTablet, PantechTablet, BronchoTablet, VersusTablet, ZyncTablet, 27279 * PositivoTablet, NabiTablet, KoboTablet, DanewTablet, TexetTablet, 27280 * PlaystationTablet, TrekstorTablet, PyleAudioTablet, AdvanTablet, 27281 * DanyTechTablet, GalapadTablet, MicromaxTablet, KarbonnTablet, AllFineTablet, 27282 * PROSCANTablet, YONESTablet, ChangJiaTablet, GUTablet, PointOfVie
27282wTablet, 27283 * OvermaxTablet, HCLTablet, DPSTablet, VistureTablet, CrestaTablet, 27284 * MediatekTablet, ConcordeTablet, GoCleverTablet, ModecomTablet, VoninoTablet, 27285 * ECSTablet, StorexTablet, VodafoneTablet, EssentielBTablet, RossMoorTablet, 27286 * iMobileTablet, TolinoTablet, AudioSonicTablet, AMPETablet, SkkTablet, 27287 * TecnoTablet, JXDTablet, iJoyTablet, FX2Tablet, XoroTablet, ViewsonicTablet, 27288 * OdysTablet, CaptivaTablet, IconbitTablet, TeclastTablet, OndaTablet, 27289 * JaytechTablet, BlaupunktTablet, DigmaTablet, EvolioTablet, LavaTablet, 27290 * AocTablet, MpmanTablet, CelkonTablet, WolderTablet, MiTablet, NibiruTablet, 27291 * NexoTablet, LeaderTablet, UbislateTablet, PocketBookTablet, KocasoTablet, 27292 * HisenseTablet, Hudl, TelstraTablet, GenericTablet</tt><br> 27293 * <br> 27294 * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against 27295 * the patterns of <a href="http://detectmobilebrowsers.com/">detectmobilebrowsers.com</a>. If this test 27296 * is positive, a value of <code>UnknownTablet</code> or <code>UnknownMobile</code> is returned.<br> 27297 * When used in browser, the decision whether phone or tablet is made based on <code>screen.width/height</code>.<br> 27298 * <br> 27299 * When used server-side (node.js), there is no way to tell the difference between <code>UnknownTablet</code> 27300 * and <code>UnknownMobile</code>, so you will get <code>null</code> here, while {@link MobileDetect#mobile} 27301 * will return <code>UnknownMobile</code>.<br> 27302 * Be aware that since v1.0.0 in this special case you will get <code>UnknownMobile</code> only for: 27303 * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. 27304 * In versions before v1.0.0 all 3 methods returned <code>UnknownMobile</code> which was tedious to use. 27305 * <br> 27306 * In most cases you will use the return value just as a boolean. 27307 * 27308 * @returns {String} the key of the tablet family or producer, e.g. "SamsungTablet" 27309 * @function MobileDetect#tablet 27310 */ 27311 tablet: function () { 27312 impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); 27313 return this._cache.tablet; 27314 }, 27315 27316 /** 27317 * Returns the (first) detected user-agent string or <tt>null</tt>. 27318 * <br> 27319 * The returned user-agent is one of following keys:<br> 27320 * <br><tt>Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, Blazer, 27321 * Safari, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, Puffin, Mercury, 27322 * ObigoBrowser, NetFront, GenericBrowser, PaleMoon</tt><br> 27323 * <br> 27324 * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare 27325 * cases where a mobile device pretends to be more than one particular browser. You can get the 27326 * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by 27327 * providing one of the defined keys as first argument to {@link MobileDetect#is}. 27328 * 27329 * @returns {String} the key for the detected user-agent or <tt>null</tt> 27330 * @function MobileDetect#userAgent 27331 */ 27332 userAgent: function () { 27333 if (this._cache.userAgent === undefined) { 27334 this._cache.userAgent = impl.findMatch(impl.mobileDetectRules.uas, this.ua); 27335 } 27336 return this._cache.userAgent; 27337 }, 27338 27339 /** 27340 * Returns all detected user-agent strings. 27341 * <br> 27342 * The array is empty or contains one or more of following keys:<br> 27343 * <br><tt>Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, Blazer, 27344 * Safari, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, Puffin, Mercury, 27345 * ObigoBrowser, NetFront, GenericBrowser, PaleMoon</tt><br> 27346 * <br> 27347 * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare 27348 * cases where a mobile device pretends to be more than one particular browser. You can get the 27349 * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by 27350 * providing one of the defined keys as first argument to {@link MobileDetect#is}. 27351 * 27352 * @returns {Array} the array of detected user-agent keys or <tt>[]</tt> 27353 * @function MobileDetect#userAgents 27354 */ 27355 userAgents: function () { 27356 if (this._cache.userAgents === undefined) { 27357 this._cache.userAgents = impl.findMatches(impl.mobileDetectRules.uas, this.ua); 27358 } 27359 return this._cache.userAgents; 27360 }, 27361 27362 /** 27363 * Returns the detected operating system string or <tt>null</tt>. 27364 * <br> 27365 * The operating system is one of following keys:<br> 27366 * <br><tt>AndroidOS, BlackBerryOS, PalmOS, SymbianOS, WindowsMobileOS, WindowsPhoneOS, 27367 * iOS, MeeGoOS, MaemoOS, JavaOS, webOS, badaOS, BREWOS</tt><br> 27368 * 27369 * @returns {String} the key for the detected operating system. 27370 * @function MobileDetect#os 27371 */ 27372 os: function () { 27373 if (this._cache.os === undefined) { 27374 this._cache.os = impl.detectOS(this.ua); 27375 } 27376 return this._cache.os; 27377 }, 27378 27379 /** 27380 * Get the version (as Number) of the given property in the User-Agent. 27381 * <br> 27382 * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.3
273821) 27383 * 27384 * @param {String} key a key defining a thing which has a version.<br> 27385 * You can use one of following keys:<br> 27386 * <br><tt>Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast, 27387 * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini, 27388 * Opera Mobi, UC Browser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser, 27389 * SamsungBrowser, Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon, Gecko, Trident, 27390 * Presto, Goanna, iOS, Android, BlackBerry, BREW, Java, Windows Phone OS, Windows 27391 * Phone, Windows CE, Windows NT, Symbian, webOS</tt><br> 27392 * 27393 * @returns {Number} the version as float or <tt>NaN</tt> if User-Agent doesn't contain this version. 27394 * Be careful when comparing this value with '==' operator! 27395 * @function MobileDetect#version 27396 */ 27397 version: function (key) { 27398 return impl.getVersion(key, this.ua); 27399 }, 27400 27401 /** 27402 * Get the version (as String) of the given property in the User-Agent. 27403 * <br> 27404 * 27405 * @param {String} key a key defining a thing which has a version.<br> 27406 * You can use one of following keys:<br> 27407 * <br><tt>Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast, 27408 * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini, 27409 * Opera Mobi, UC Browser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser, 27410 * SamsungBrowser, Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon, Gecko, Trident, 27411 * Presto, Goanna, iOS, Android, BlackBerry, BREW, Java, Windows Phone OS, Windows 27412 * Phone, Windows CE, Windows NT, Symbian, webOS</tt><br> 27413 * 27414 * @returns {String} the "raw" version as String or <tt>null</tt> if User-Agent doesn't contain this version. 27415 * 27416 * @function MobileDetect#versionStr 27417 */ 27418 versionStr: function (key) { 27419 return impl.getVersionStr(key, this.ua); 27420 }, 27421 27422 /** 27423 * Global test key against userAgent, os, phone, tablet and some other properties of userAgent string. 27424 * 27425 * @param {String} key the key (case-insensitive) of a userAgent, an operating system, phone or 27426 * tablet family.<br> 27427 * For a complete list of possible values, see {@link MobileDetect#userAgent}, 27428 * {@link MobileDetect#os}, {@link MobileDetect#phone}, {@link MobileDetect#tablet}.<br> 27429 * Additionally you have following keys:<br> 27430 * <br><tt>Bot, MobileBot, DesktopMode, TV, WebKit, Console, Watch</tt><br> 27431 * 27432 * @returns {boolean} <tt>true</tt> when the given key is one of the defined keys of userAgent, os, phone, 27433 * tablet or one of the listed additional keys, otherwise <tt>false</tt> 27434 * @function MobileDetect#is 27435 */ 27436 is: function (key) { 27437 return containsIC(this.userAgents(), key) || 27438 equalIC(key, this.os()) || 27439 equalIC(key, this.phone()) || 27440 equalIC(key, this.tablet()) || 27441 containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key); 27442 }, 27443 27444 /** 27445 * Do a quick test against navigator::userAgent. 27446 * 27447 * @param {String|RegExp} pattern the pattern, either as String or RegExp 27448 * (a string will be converted to a case-insensitive RegExp). 27449 * @returns {boolean} <tt>true</tt> when the pattern matches, otherwise <tt>false</tt> 27450 * @function MobileDetect#match 27451 */ 27452 match: function (pattern) { 27453 if (!(pattern instanceof RegExp)) { 27454 pattern = new RegExp(pattern, 'i'); 27455 } 27456 return pattern.test(this.ua); 27457 }, 27458 27459 /** 27460 * Checks whether the mobile device can be considered as phone regarding <code>screen.width</code>. 27461 * <br> 27462 * Obviously this method makes sense in browser environments only (not for Node.js)! 27463 * @param {number} [maxPhoneWidth] the maximum logical pixels (aka. CSS-pixels) to be considered as phone.<br> 27464 * The argument is optional and if not present or falsy, the value of the constructor is taken. 27465 * @returns {boolean|undefined} <code>undefined</code> if screen size wasn't detectable, else <code>true</code> 27466 * when screen.width is less or equal to maxPhoneWidth, otherwise <code>false</code>.<br> 27467 * Will always return <code>undefined</code> server-side. 27468 */ 27469 isPhoneSized: function (maxPhoneWidth) { 27470 return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth); 27471 }, 27472 27473 /** 27474 * Returns the mobile grade ('A', 'B', 'C'). 27475 * 27476 * @returns {String} one of the mobile grades ('A', 'B', 'C'). 27477 * @function MobileDetect#mobileGrade 27478 */ 27479 mobileGrade: function () { 27480 if (this._cache.grade === undefined) { 27481 this._cache.grade = impl.mobileGrade(this); 27482 } 27483 return this._cache.grade; 27484 } 27485 }; 27486 27487 // environment-dependent 27488 if (typeof window !== 'undefined' && window.screen) { 27489 MobileDetect.isPhoneSized = function (maxPhoneWidth) { 27490 return maxPhoneWidth < 0 ? undefined : impl.getDeviceSmallerSide() <= maxPhoneWidth; 27491 }; 27492 } else { 27493 MobileDetect.isPhoneSized = function () {}; 27494 } 27495 27496 // should not be replaced by a completely new object - just overwrite existing methods 27497 MobileDetect._impl = impl; 27498 27499 MobileDetect.version = '1.3.6 2017-04-05'; 27500 27501 return MobileDetect; 27502 }); // end of call of define() 27503 })((function (undefined) { 27504 if (typeof module !== 'undefined' && module.exports) { 27505 return function (factory) { module.exports = factory(); }; 27506 } else if (true) { 27507 return __webpack_require__(305); 27508 } else if (typeof window !== 'undefined') { 27509 return function (factory) { window.MobileDetect = factory(); }; 27510 } else { 27511 // please file a bug if you get this error! 27512 throw new Error('unknown environment'); 27513 } 27514 })()); 27515 27516/***/ }), 27517/* 305 */
27518/***/ (function(module, exports) { 27519 27520 module.exports = function() { throw new Error("define cannot be used indirect"); }; 27521 27522 27523/***/ }), 27524/* 306 */ 27525/***/ (function(module, exports, __webpack_require__) { 27526 27527 "use strict"; 27528 27529 Object.defineProperty(exports, "__esModule", { 27530 value: true 27531 }); 27532 27533 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 27534 27535 var _lodash = __webpack_require__(307); 27536 27537 var _lodash2 = _interopRequireDefault(_lodash); 27538 27539 var _events = __webpack_require__(301); 27540 27541 var _events2 = _interopRequireDefault(_events); 27542 27543 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 27544 27545 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 27546 27547 var Menu = function () { 27548 function Menu(props) { 27549 var _this = this; 27550 27551 _classCallCheck(this, Menu); 27552 27553 this.menu = props.menu; 27554 this.menuToggle = props.menuToggle; 27555 this.menuItems = props.menuItems; 27556 this.isOpen = false; 27557 27558 _lodash2.default.forEach(this.menuToggle, function (dom) { 27559 dom.addEventListener("click", function (event) { 27560 _this.toggle(); 27561 }); 27562 }); 27563 27564 _lodash2.default.forEach(this.menuItems, function (dom) { 27565 dom.addEventListener("click", function (event) { 27566 var el = event.target; 27567 _events2.default.emit("selectMenu", el.getAttribute("href")); 27568 _this.close(); 27569 }); 27570 }); 27571 } 27572 27573 _createClass(Menu, [{ 27574 key: "toggle", 27575 value: function toggle() { 27576 if (this.isOpen) { 27577 this.close(); 27578 } else { 27579 this.open(); 27580 } 27581 } 27582 }, { 27583 key: "open", 27584 value: function open() { 27585 this.page = ""; 27586 this.isOpen = true; 27587 this.update(); 27588 } 27589 }, { 27590 key: "close", 27591 value: function close() { 27592 this.isOpen = false; 27593 this.update(); 27594 } 27595 }, { 27596 key: "update", 27597 value: function update() { 27598 var _this2 = this; 27599 27600 _lodash2.default.forEach(this.menu, function (dom) { 27601 dom.setAttribute("data-menu-is-open", _this2.isOpen ? 1 : 0); 27602 dom.setAttribute("data-menu-page", _this2.page || ""); 27603 }); 27604 _lodash2.default.forEach(this.menuToggle, function (dom) { 27605 dom.setAttribute("data-menu-is-open", _this2.isOpen ? 1 : 0); 27606 }); 27607 } 27608 }]); 27609 27610 return Menu; 27611 }(); 27612 27613 exports.default = Menu; 27614 27615/***/ }), 27616/* 307 */ 27617/***/ (function(module, exports, __webpack_require__) { 27618 27619 var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {/** 27620 * @license 27621 * Lodash <https://lodash.com/> 27622 * Copyright JS Foundation and other contributors <https://js.foundation/> 27623 * Released under MIT license <https://lodash.com/license> 27624 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 27625 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 27626 */ 27627 ;(function() { 27628 27629 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 27630 var undefined; 27631 27632 /** Used as the semantic version number. */ 27633 var VERSION = '4.17.4'; 27634 27635 /** Used as the size to enable large array optimizations. */ 27636 var LARGE_ARRAY_SIZE = 200; 27637 27638 /** Error message constants. */ 27639 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 27640 FUNC_ERROR_TEXT = 'Expected a function'; 27641 27642 /** Used to stand-in for `undefined` hash values. */ 27643 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 27644 27645 /** Used as the maximum memoize cache size. */ 27646 var MAX_MEMOIZE_SIZE = 500; 27647 27648 /** Used as the internal argument placeholder. */ 27649 var PLACEHOLDER = '__lodash_placeholder__';
vendor: 17,316 bytes, lines 27650-28055
27650 27651 /** Used to compose bitmasks for cloning. */ 27652 var CLONE_DEEP_FLAG = 1, 27653 CLONE_FLAT_FLAG = 2, 27654 CLONE_SYMBOLS_FLAG = 4; 27655 27656 /** Used to compose bitmasks for value comparisons. */ 27657 var COMPARE_PARTIAL_FLAG = 1, 27658 COMPARE_UNORDERED_FLAG = 2; 27659 27660 /** Used to compose bitmasks for function metadata. */ 27661 var WRAP_BIND_FLAG = 1, 27662 WRAP_BIND_KEY_FLAG = 2, 27663 WRAP_CURRY_BOUND_FLAG = 4, 27664 WRAP_CURRY_FLAG = 8, 27665 WRAP_CURRY_RIGHT_FLAG = 16, 27666 WRAP_PARTIAL_FLAG = 32, 27667 WRAP_PARTIAL_RIGHT_FLAG = 64, 27668 WRAP_ARY_FLAG = 128, 27669 WRAP_REARG_FLAG = 256, 27670 WRAP_FLIP_FLAG = 512; 27671 27672 /** Used as default options for `_.truncate`. */ 27673 var DEFAULT_TRUNC_LENGTH = 30, 27674 DEFAULT_TRUNC_OMISSION = '...'; 27675 27676 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 27677 var HOT_COUNT = 800, 27678 HOT_SPAN = 16; 27679 27680 /** Used to indicate the type of lazy iteratees. */ 27681 var LAZY_FILTER_FLAG = 1, 27682 LAZY_MAP_FLAG = 2, 27683 LAZY_WHILE_FLAG = 3; 27684 27685 /** Used as references for various `Number` constants. */ 27686 var INFINITY = 1 / 0, 27687 MAX_SAFE_INTEGER = 9007199254740991, 27688 MAX_INTEGER = 1.7976931348623157e+308, 27689 NAN = 0 / 0; 27690 27691 /** Used as references for the maximum length and index of an array. */ 27692 var MAX_ARRAY_LENGTH = 4294967295, 27693 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 27694 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 27695 27696 /** Used to associate wrap methods with their bit flags. */ 27697 var wrapFlags = [ 27698 ['ary', WRAP_ARY_FLAG], 27699 ['bind', WRAP_BIND_FLAG], 27700 ['bindKey', WRAP_BIND_KEY_FLAG], 27701 ['curry', WRAP_CURRY_FLAG], 27702 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 27703 ['flip', WRAP_FLIP_FLAG], 27704 ['partial', WRAP_PARTIAL_FLAG], 27705 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 27706 ['rearg', WRAP_REARG_FLAG] 27707 ]; 27708 27709 /** `Object#toString` result references. */ 27710 var argsTag = '[object Arguments]', 27711 arrayTag = '[object Array]', 27712 asyncTag = '[object AsyncFunction]', 27713 boolTag = '[object Boolean]', 27714 dateTag = '[object Date]', 27715 domExcTag = '[object DOMException]', 27716 errorTag = '[object Error]', 27717 funcTag = '[object Function]', 27718 genTag = '[object GeneratorFunction]', 27719 mapTag = '[object Map]', 27720 numberTag = '[object Number]', 27721 nullTag = '[object Null]', 27722 objectTag = '[object Object]', 27723 promiseTag = '[object Promise]', 27724 proxyTag = '[object Proxy]', 27725 regexpTag = '[object RegExp]', 27726 setTag = '[object Set]', 27727 stringTag = '[object String]', 27728 symbolTag = '[object Symbol]', 27729 undefinedTag = '[object Undefined]', 27730 weakMapTag = '[object WeakMap]', 27731 weakSetTag = '[object WeakSet]'; 27732 27733 var arrayBufferTag = '[object ArrayBuffer]', 27734 dataViewTag = '[object DataView]', 27735 float32Tag = '[object Float32Array]', 27736 float64Tag = '[object Float64Array]', 27737 int8Tag = '[object Int8Array]', 27738 int16Tag = '[object Int16Array]', 27739 int32Tag = '[object Int32Array]', 27740 uint8Tag = '[object Uint8Array]', 27741 uint8ClampedTag = '[object Uint8ClampedArray]', 27742 uint16Tag = '[object Uint16Array]', 27743 uint32Tag = '[object Uint32Array]'; 27744 27745 /** Used to match empty string literals in compiled template source. */ 27746 var reEmptyStringLeading = /\b__p \+= '';/g, 27747 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 27748 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 27749 27750 /** Used to match HTML entities and HTML characters. */ 27751 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 27752 reUnescapedHtml = /[&<>"']/g, 27753 reHasEscapedHtml = RegExp(reEscapedHtml.source), 27754 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 27755 27756 /** Used to match template delimiters. */ 27757 var reEscape = /<%-([\s\S]+?)%>/g, 27758 reEvaluate = /<%([\s\S]+?)%>/g, 27759 reInterpolate = /<%=([\s\S]+?)%>/g; 27760 27761 /** Used to match property names within property paths. */ 27762 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 27763 reIsPlainProp = /^\w*$/, 27764 reLeadingDot = /^\./, 27765 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 27766 27767 /** 27768 * Used to match `RegExp` 27769 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 27770 */ 27771 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 27772 reHasRegExpChar = RegExp(reRegExpChar.source); 27773 27774 /** Used to match leading and trailing whitespace. */ 27775 var reTrim = /^\s+|\s+$/g, 27776 reTrimStart = /^\s+/, 27777 reTrimEnd = /\s+$/; 27778 27779 /** Used to match wrap detail comments. */ 27780 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 27781 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 27782 reSplitDetails = /,? & /; 27783 27784 /** Used to match words composed of alphanumeric characters. */ 27785 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 27786 27787 /** Used to match backslashes in property paths. */ 27788 var reEscapeChar = /\\(\\)?/g; 27789 27790 /** 27791 * Used to match 27792 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 27793 */ 27794 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 27795 27796 /** Used to match `RegExp` flags from their coerced string values. */ 27797 var reFlags = /\w*$/; 27798 27799 /** Used to detect bad signed hexadecimal string values. */ 27800 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 27801 27802 /** Used to detect binary string values. */ 27803 var reIsBinary = /^0b[01]+$/i; 27804 27805 /** Used to detect host constructors (Safari). */ 27806 var reIsHostCtor = /^\[object .+?Constructor\]$/; 27807 27808 /** Used to detect octal string values. */ 27809 var reIsOctal = /^0o[0-7]+$/i; 27810 27811 /** Used to detect unsigned integer values. */ 27812 var reIsUint = /^(?:0|[1-9]\d*)$/; 27813 27814 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 27815 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 27816 27817 /** Used to ensure capturing order of template delimiters. */ 27818 var reNoMatch = /($^)/; 27819 27820 /** Used to match unescaped characters in compiled string literals. */ 27821 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 27822 27823 /** Used to compose unicode character classes. */ 27824 var rsAstralRange = '\\ud800-\\udfff', 27825 rsComboMarksRange = '\\u0300-\\u036f', 27826 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 27827 rsComboSymbolsRange = '\\u20d0-\\u20ff', 27828 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 27829 rsDingbatRange = '\\u2700-\\u27bf', 27830 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 27831 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 27832 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 27833 rsPunctuationRange = '\\u2000-\\u206f', 27834 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', 27835 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 27836 rsVarRange = '\\ufe0e\\ufe0f', 27837 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 27838 27839 /** Used to compose unicode capture groups. */ 27840 var rsApos = "['\u2019]", 27841 rsAstral = '[' + rsAstralRange + ']', 27842 rsBreak = '[' + rsBreakRange + ']', 27843 rsCombo = '[' + rsComboRange + ']', 27844 rsDigits = '\\d+', 27845 rsDingbat = '[' + rsDingbatRange + ']', 27846 rsLower = '[' + rsLowerRange + ']', 27847 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 27848 rsFitz = '\\ud83c[\\udffb-\\udfff]', 27849 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 27850 rsNonAstral = '[^' + rsAstralRange + ']', 27851 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 27852 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 27853 rsUpper = '[' + rsUpperRange + ']', 27854 rsZWJ = '\\u200d'; 27855 27856 /** Used to compose unicode regexes. */ 27857 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 27858 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 27859 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 27860 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 27861 reOptMod = rsModifier + '?', 27862 rsOptVar = '[' + rsVarRange + ']?', 27863 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 27864 rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)', 27865 rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)', 27866 rsSeq = rsOptVar + reOptMod + rsOptJoin, 27867 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 27868 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 27869 27870 /** Used to match apostrophes. */ 27871 var reApos = RegExp(rsApos, 'g'); 27872 27873 /** 27874 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 27875 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 27876 */ 27877 var reComboMark = RegExp(rsCombo, 'g'); 27878 27879 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 27880 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 27881 27882 /** Used to match complex or compound words. */ 27883 var reUnicodeWord = RegExp([ 27884 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 27885 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 27886 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 27887 rsUpper + '+' + rsOptContrUpper, 27888 rsOrdUpper, 27889 rsOrdLower, 27890 rsDigits, 27891 rsEmoji 27892 ].join('|'), 'g'); 27893 27894 /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ 27895 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 27896 27897 /** Used to detect strings that need a more robust regexp to match words. */ 27898 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 ]/; 27899 27900 /** Used to assign default `context` object properties. */ 27901 var contextProps = [ 27902 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 27903 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 27904 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 27905 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 27906 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 27907 ]; 27908 27909 /** Used to make template sourceURLs easier to identify. */ 27910 var templateCounter = -1; 27911 27912 /** Used to identify `toStringTag` values of typed arrays. */ 27913 var typedArrayTags = {}; 27914 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 27915 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 27916 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 27917 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 27918 typedArrayTags[uint32Tag] = true; 27919 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 27920 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 27921 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 27922 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 27923 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 27924 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 27925 typedArrayTags[setTag] = typedArrayTags[stringTag] = 27926 typedArrayTags[weakMapTag] = false; 27927 27928 /** Used to identify `toStringTag` values supported by `_.clone`. */ 27929 var cloneableTags = {}; 27930 cloneableTags[argsTag] = cloneableTags[arrayTag] = 27931 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 27932 cloneableTags[boolTag] = cloneableTags[dateTag] = 27933 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 27934 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 27935 cloneableTags[int32Tag] = cloneableTags[mapTag] = 27936 cloneableTags[numberTag] = cloneableTags[objectTag] = 27937 cloneableTags[regexpTag] = cloneableTags[setTag] = 27938 cloneableTags[stringTag] = cloneableTags[symbolTag] = 27939 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 27940 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 27941 cloneableTags[errorTag] = cloneableTags[funcTag] = 27942 cloneableTags[weakMapTag] = false; 27943 27944 /** Used to map Latin Unicode letters to basic Latin letters. */ 27945 var deburredLetters = { 27946 // Latin-1 Supplement block. 27947 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 27948 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 27949 '\xc7': 'C', '\xe7': 'c', 27950 '\xd0': 'D', '\xf0': 'd', 27951 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 27952 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 27953 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 27954 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 27955 '\xd1': 'N', '\xf1': 'n', 27956 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 27957 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 27958 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 27959 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 27960 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 27961 '\xc6': 'Ae', '\xe6': 'ae', 27962 '\xde': 'Th', '\xfe': 'th', 27963 '\xdf': 'ss', 27964 // Latin Extended-A block. 27965 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 27966 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 27967 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 27968 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 27969 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 27970 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 27971 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 27972 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 27973 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 27974 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 27975 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 27976 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 27977 '\u0134': 'J', '\u0135': 'j', 27978 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 27979 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 27980 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 27981 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 27982 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 27983 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 27984 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 27985 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 27986 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 27987 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 27988 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 27989 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 27990 '\u0163': 't', '\u0165': 't', '\u0167': 't', 27991 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 27992 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 27993 '\u0174': 'W', '\u0175': 'w', 27994 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 27995 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 27996 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 27997 '\u0132': 'IJ', '\u0133': 'ij', 27998 '\u0152': 'Oe', '\u0153': 'oe', 27999 '\u0149': "'n", '\u017f': 's' 28000 }; 28001 28002 /** Used to map characters to HTML entities. */ 28003 var htmlEscapes = { 28004 '&': '&', 28005 '<': '<', 28006 '>': '>', 28007 '"': '"', 28008 "'": ''' 28009 }; 28010 28011 /** Used to map HTML entities to characters. */ 28012 var htmlUnescapes = { 28013 '&': '&', 28014 '<': '<', 28015 '>': '>', 28016 '"': '"', 28017 ''': "'" 28018 }; 28019 28020 /** Used to escape characters for inclusion in compiled string literals. */ 28021 var stringEscapes = { 28022 '\\': '\\', 28023 "'": "'", 28024 '\n': 'n', 28025 '\r': 'r', 28026 '\u2028': 'u2028', 28027 '\u2029': 'u2029' 28028 }; 28029 28030 /** Built-in method references without a dependency on `root`. */ 28031 var freeParseFloat = parseFloat, 28032 freeParseInt = parseInt; 28033 28034 /** Detect free variable `global` from Node.js. */ 28035 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 28036 28037 /** Detect free variable `self`. */ 28038 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 28039 28040 /** Used as a reference to the global object. */ 28041 var root = freeGlobal || freeSelf || Function('return this')(); 28042 28043 /** Detect free variable `exports`. */ 28044 var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; 28045 28046 /** Detect free variable `module`. */ 28047 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; 28048 28049 /** Detect the popular CommonJS extension `module.exports`. */ 28050 var moduleExports = freeModule && freeModule.exports === freeExports; 28051 28052 /** Detect free variable `process` from Node.js. */ 28053 var freeProcess = moduleExports && freeGlobal.process; 28054 28055 /** Used to access faster Node.js helpers. */
28056 var nodeUtil = (function() { 28057 try { 28058 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 28059 } catch (e) {} 28060 }()); 28061 28062 /* Node.js helper references. */ 28063 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 28064 nodeIsDate = nodeUtil && nodeUtil.isDate, 28065 nodeIsMap = nodeUtil && nodeUtil.isMap, 28066 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 28067 nodeIsSet = nodeUtil && nodeUtil.isSet, 28068 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 28069 28070 /*--------------------------------------------------------------------------*/ 28071 28072 /** 28073 * Adds the key-value `pair` to `map`. 28074 * 28075 * @private 28076 * @param {Object} map The map to modify. 28077 * @param {Array} pair The key-value pair to add. 28078 * @returns {Object} Returns `map`. 28079 */ 28080 function addMapEntry(map, pair) { 28081 // Don't return `map.set` because it's not chainable in IE 11. 28082 map.set(pair[0], pair[1]); 28083 return map; 28084 } 28085 28086 /** 28087 * Adds `value` to `set`. 28088 * 28089 * @private 28090 * @param {Object} set The set to modify. 28091 * @param {*} value The value to add. 28092 * @returns {Object} Returns `set`. 28093 */ 28094 function addSetEntry(set, value) { 28095 // Don't return `set.add` because it's not chainable in IE 11. 28096 set.add(value); 28097 return set; 28098 }
vendor: 12,938 bytes, lines 28098-28519
28098 28099 28100 /** 28101 * A faster alternative to `Function#apply`, this function invokes `func` 28102 * with the `this` binding of `thisArg` and the arguments of `args`. 28103 * 28104 * @private 28105 * @param {Function} func The function to invoke. 28106 * @param {*} thisArg The `this` binding of `func`. 28107 * @param {Array} args The arguments to invoke `func` with. 28108 * @returns {*} Returns the result of `func`. 28109 */ 28110 function apply(func, thisArg, args) { 28111 switch (args.length) { 28112 case 0: return func.call(thisArg); 28113 case 1: return func.call(thisArg, args[0]); 28114 case 2: return func.call(thisArg, args[0], args[1]); 28115 case 3: return func.call(thisArg, args[0], args[1], args[2]); 28116 } 28117 return func.apply(thisArg, args); 28118 } 28119 28120 /** 28121 * A specialized version of `baseAggregator` for arrays. 28122 * 28123 * @private 28124 * @param {Array} [array] The array to iterate over. 28125 * @param {Function} setter The function to set `accumulator` values. 28126 * @param {Function} iteratee The iteratee to transform keys. 28127 * @param {Object} accumulator The initial aggregated object. 28128 * @returns {Function} Returns `accumulator`. 28129 */ 28130 function arrayAggregator(array, setter, iteratee, accumulator) { 28131 var index = -1, 28132 length = array == null ? 0 : array.length; 28133 28134 while (++index < length) { 28135 var value = array[index]; 28136 setter(accumulator, value, iteratee(value), array); 28137 } 28138 return accumulator; 28139 } 28140 28141 /** 28142 * A specialized version of `_.forEach` for arrays without support for 28143 * iteratee shorthands. 28144 * 28145 * @private 28146 * @param {Array} [array] The array to iterate over. 28147 * @param {Function} iteratee The function invoked per iteration. 28148 * @returns {Array} Returns `array`. 28149 */ 28150 function arrayEach(array, iteratee) { 28151 var index = -1, 28152 length = array == null ? 0 : array.length; 28153 28154 while (++index < length) { 28155 if (iteratee(array[index], index, array) === false) { 28156 break; 28157 } 28158 } 28159 return array; 28160 } 28161 28162 /** 28163 * A specialized version of `_.forEachRight` for arrays without support for 28164 * iteratee shorthands. 28165 * 28166 * @private 28167 * @param {Array} [array] The array to iterate over. 28168 * @param {Function} iteratee The function invoked per iteration. 28169 * @returns {Array} Returns `array`. 28170 */ 28171 function arrayEachRight(array, iteratee) { 28172 var length = array == null ? 0 : array.length; 28173 28174 while (length--) { 28175 if (iteratee(array[length], length, array) === false) { 28176 break; 28177 } 28178 } 28179 return array; 28180 } 28181 28182 /** 28183 * A specialized version of `_.every` for arrays without support for 28184 * iteratee shorthands. 28185 * 28186 * @private 28187 * @param {Array} [array] The array to iterate over. 28188 * @param {Function} predicate The function invoked per iteration. 28189 * @returns {boolean} Returns `true` if all elements pass the predicate check, 28190 * else `false`. 28191 */ 28192 function arrayEvery(array, predicate) { 28193 var index = -1, 28194 length = array == null ? 0 : array.length; 28195 28196 while (++index < length) { 28197 if (!predicate(array[index], index, array)) { 28198 return false; 28199 } 28200 } 28201 return true; 28202 } 28203 28204 /** 28205 * A specialized version of `_.filter` for arrays without support for 28206 * iteratee shorthands. 28207 * 28208 * @private 28209 * @param {Array} [array] The array to iterate over. 28210 * @param {Function} predicate The function invoked per iteration. 28211 * @returns {Array} Returns the new filtered array. 28212 */ 28213 function arrayFilter(array, predicate) { 28214 var index = -1, 28215 length = array == null ? 0 : array.length, 28216 resIndex = 0, 28217 result = []; 28218 28219 while (++index < length) { 28220 var value = array[index]; 28221 if (predicate(value, index, array)) { 28222 result[resIndex++] = value; 28223 } 28224 } 28225 return result; 28226 } 28227 28228 /** 28229 * A specialized version of `_.includes` for arrays without support for 28230 * specifying an index to search from. 28231 * 28232 * @private 28233 * @param {Array} [array] The array to inspect. 28234 * @param {*} target The value to search for. 28235 * @returns {boolean} Returns `true` if `target` is found, else `false`. 28236 */ 28237 function arrayIncludes(array, value) { 28238 var length = array == null ? 0 : array.length; 28239 return !!length && baseIndexOf(array, value, 0) > -1; 28240 } 28241 28242 /** 28243 * This function is like `arrayIncludes` except that it accepts a comparator. 28244 * 28245 * @private 28246 * @param {Array} [array] The array to inspect. 28247 * @param {*} target The value to search for. 28248 * @param {Function} comparator The comparator invoked per element. 28249 * @returns {boolean} Returns `true` if `target` is found, else `false`. 28250 */ 28251 function arrayIncludesWith(array, value, comparator) { 28252 var index = -1, 28253 length = array == null ? 0 : array.length; 28254 28255 while (++index < length) { 28256 if (comparator(value, array[index])) { 28257 return true; 28258 } 28259 } 28260 return false; 28261 } 28262 28263 /** 28264 * A specialized version of `_.map` for arrays without support for iteratee 28265 * shorthands. 28266 * 28267 * @private 28268 * @param {Array} [array] The array to iterate over. 28269 * @param {Function} iteratee The function invoked per iteration. 28270 * @returns {Array} Returns the new mapped array. 28271 */ 28272 function arrayMap(array, iteratee) { 28273 var index = -1, 28274 length = array == null ? 0 : array.length, 28275 result = Array(length); 28276 28277 while (++index < length) { 28278 result[index] = iteratee(array[index], index, array); 28279 } 28280 return result; 28281 } 28282 28283 /** 28284 * Appends the elements of `values` to `array`. 28285 * 28286 * @private 28287 * @param {Array} array The array to modify. 28288 * @param {Array} values The values to append. 28289 * @returns {Array} Returns `array`. 28290 */ 28291 function arrayPush(array, values) { 28292 var index = -1, 28293 length = values.length, 28294 offset = array.length; 28295 28296 while (++index < length) { 28297 array[offset + index] = values[index]; 28298 } 28299 return array; 28300 } 28301 28302 /** 28303 * A specialized version of `_.reduce` for arrays without support for 28304 * iteratee shorthands. 28305 * 28306 * @private 28307 * @param {Array} [array] The array to iterate over. 28308 * @param {Function} iteratee The function invoked per iteration. 28309 * @param {*} [accumulator] The initial value. 28310 * @param {boolean} [initAccum] Specify using the first element of `array` as 28311 * the initial value. 28312 * @returns {*} Returns the accumulated value. 28313 */ 28314 function arrayReduce(array, iteratee, accumulator, initAccum) { 28315 var index = -1, 28316 length = array == null ? 0 : array.length; 28317 28318 if (initAccum && length) { 28319 accumulator = array[++index]; 28320 } 28321 while (++index < length) { 28322 accumulator = iteratee(accumulator, array[index], index, array); 28323 } 28324 return accumulator; 28325 } 28326 28327 /** 28328 * A specialized version of `_.reduceRight` for arrays without support for 28329 * iteratee shorthands. 28330 * 28331 * @private 28332 * @param {Array} [array] The array to iterate over. 28333 * @param {Function} iteratee The function invoked per iteration. 28334 * @param {*} [accumulator] The initial value. 28335 * @param {boolean} [initAccum] Specify using the last element of `array` as 28336 * the initial value. 28337 * @returns {*} Returns the accumulated value. 28338 */ 28339 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 28340 var length = array == null ? 0 : array.length; 28341 if (initAccum && length) { 28342 accumulator = array[--length]; 28343 } 28344 while (length--) { 28345 accumulator = iteratee(accumulator, array[length], length, array); 28346 } 28347 return accumulator; 28348 } 28349 28350 /** 28351 * A specialized version of `_.some` for arrays without support for iteratee 28352 * shorthands. 28353 * 28354 * @private 28355 * @param {Array} [array] The array to iterate over. 28356 * @param {Function} predicate The function invoked per iteration. 28357 * @returns {boolean} Returns `true` if any element passes the predicate check, 28358 * else `false`. 28359 */ 28360 function arraySome(array, predicate) { 28361 var index = -1, 28362 length = array == null ? 0 : array.length; 28363 28364 while (++index < length) { 28365 if (predicate(array[index], index, array)) { 28366 return true; 28367 } 28368 } 28369 return false; 28370 } 28371 28372 /** 28373 * Gets the size of an ASCII `string`. 28374 * 28375 * @private 28376 * @param {string} string The string inspect. 28377 * @returns {number} Returns the string size. 28378 */ 28379 var asciiSize = baseProperty('length'); 28380 28381 /** 28382 * Converts an ASCII `string` to an array. 28383 * 28384 * @private 28385 * @param {string} string The string to convert. 28386 * @returns {Array} Returns the converted array. 28387 */ 28388 function asciiToArray(string) { 28389 return string.split(''); 28390 } 28391 28392 /** 28393 * Splits an ASCII `string` into an array of its words. 28394 * 28395 * @private 28396 * @param {string} The string to inspect. 28397 * @returns {Array} Returns the words of `string`. 28398 */ 28399 function asciiWords(string) { 28400 return string.match(reAsciiWord) || []; 28401 } 28402 28403 /** 28404 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 28405 * without support for iteratee shorthands, which iterates over `collection` 28406 * using `eachFunc`. 28407 * 28408 * @private 28409 * @param {Array|Object} collection The collection to inspect. 28410 * @param {Function} predicate The function invoked per iteration. 28411 * @param {Function} eachFunc The function to iterate over `collection`. 28412 * @returns {*} Returns the found element or its key, else `undefined`. 28413 */ 28414 function baseFindKey(collection, predicate, eachFunc) { 28415 var result; 28416 eachFunc(collection, function(value, key, collection) { 28417 if (predicate(value, key, collection)) { 28418 result = key; 28419 return false; 28420 } 28421 }); 28422 return result; 28423 } 28424 28425 /** 28426 * The base implementation of `_.findIndex` and `_.findLastIndex` without 28427 * support for iteratee shorthands. 28428 * 28429 * @private 28430 * @param {Array} array The array to inspect. 28431 * @param {Function} predicate The function invoked per iteration. 28432 * @param {number} fromIndex The index to search from. 28433 * @param {boolean} [fromRight] Specify iterating from right to left. 28434 * @returns {number} Returns the index of the matched value, else `-1`. 28435 */ 28436 function baseFindIndex(array, predicate, fromIndex, fromRight) { 28437 var length = array.length, 28438 index = fromIndex + (fromRight ? 1 : -1); 28439 28440 while ((fromRight ? index-- : ++index < length)) { 28441 if (predicate(array[index], index, array)) { 28442 return index; 28443 } 28444 } 28445 return -1; 28446 } 28447 28448 /** 28449 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 28450 * 28451 * @private 28452 * @param {Array} array The array to inspect. 28453 * @param {*} value The value to search for. 28454 * @param {number} fromIndex The index to search from. 28455 * @returns {number} Returns the index of the matched value, else `-1`. 28456 */ 28457 function baseIndexOf(array, value, fromIndex) { 28458 return value === value 28459 ? strictIndexOf(array, value, fromIndex) 28460 : baseFindIndex(array, baseIsNaN, fromIndex); 28461 } 28462 28463 /** 28464 * This function is like `baseIndexOf` except that it accepts a comparator. 28465 * 28466 * @private 28467 * @param {Array} array The array to inspect. 28468 * @param {*} value The value to search for. 28469 * @param {number} fromIndex The index to search from. 28470 * @param {Function} comparator The comparator invoked per element. 28471 * @returns {number} Returns the index of the matched value, else `-1`. 28472 */ 28473 function baseIndexOfWith(array, value, fromIndex, comparator) { 28474 var index = fromIndex - 1, 28475 length = array.length; 28476 28477 while (++index < length) { 28478 if (comparator(array[index], value)) { 28479 return index; 28480 } 28481 } 28482 return -1; 28483 } 28484 28485 /** 28486 * The base implementation of `_.isNaN` without support for number objects. 28487 * 28488 * @private 28489 * @param {*} value The value to check. 28490 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 28491 */ 28492 function baseIsNaN(value) { 28493 return value !== value; 28494 } 28495 28496 /** 28497 * The base implementation of `_.mean` and `_.meanBy` without support for 28498 * iteratee shorthands. 28499 * 28500 * @private 28501 * @param {Array} array The array to iterate over. 28502 * @param {Function} iteratee The function invoked per iteration. 28503 * @returns {number} Returns the mean. 28504 */ 28505 function baseMean(array, iteratee) { 28506 var length = array == null ? 0 : array.length; 28507 return length ? (baseSum(array, iteratee) / length) : NAN; 28508 } 28509 28510 /** 28511 * The base implementation of `_.property` without support for deep paths. 28512 * 28513 * @private 28514 * @param {string} key The key of the property to get. 28515 * @returns {Function} Returns the new accessor function. 28516 */ 28517 function baseProperty(key) { 28518 return function(object) { 28519 return object == null ? undefined
vendor: 2,546 bytes, lines 28519-28601
28519 : object[key]; 28520 }; 28521 } 28522 28523 /** 28524 * The base implementation of `_.propertyOf` without support for deep paths. 28525 * 28526 * @private 28527 * @param {Object} object The object to query. 28528 * @returns {Function} Returns the new accessor function. 28529 */ 28530 function basePropertyOf(object) { 28531 return function(key) { 28532 return object == null ? undefined : object[key]; 28533 }; 28534 } 28535 28536 /** 28537 * The base implementation of `_.reduce` and `_.reduceRight`, without support 28538 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 28539 * 28540 * @private 28541 * @param {Array|Object} collection The collection to iterate over. 28542 * @param {Function} iteratee The function invoked per iteration. 28543 * @param {*} accumulator The initial value. 28544 * @param {boolean} initAccum Specify using the first or last element of 28545 * `collection` as the initial value. 28546 * @param {Function} eachFunc The function to iterate over `collection`. 28547 * @returns {*} Returns the accumulated value. 28548 */ 28549 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 28550 eachFunc(collection, function(value, index, collection) { 28551 accumulator = initAccum 28552 ? (initAccum = false, value) 28553 : iteratee(accumulator, value, index, collection); 28554 }); 28555 return accumulator; 28556 } 28557 28558 /** 28559 * The base implementation of `_.sortBy` which uses `comparer` to define the 28560 * sort order of `array` and replaces criteria objects with their corresponding 28561 * values. 28562 * 28563 * @private 28564 * @param {Array} array The array to sort. 28565 * @param {Function} comparer The function to define sort order. 28566 * @returns {Array} Returns `array`. 28567 */ 28568 function baseSortBy(array, comparer) { 28569 var length = array.length; 28570 28571 array.sort(comparer); 28572 while (length--) { 28573 array[length] = array[length].value; 28574 } 28575 return array; 28576 } 28577 28578 /** 28579 * The base implementation of `_.sum` and `_.sumBy` without support for 28580 * iteratee shorthands. 28581 * 28582 * @private 28583 * @param {Array} array The array to iterate over. 28584 * @param {Function} iteratee The function invoked per iteration. 28585 * @returns {number} Returns the sum. 28586 */ 28587 function baseSum(array, iteratee) { 28588 var result, 28589 index = -1, 28590 length = array.length; 28591 28592 while (++index < length) { 28593 var current = iteratee(array[index]); 28594 if (current !== undefined) { 28595 result = result === undefined ? current : (result + current); 28596 } 28597 } 28598 return result; 28599 } 28600 28601 /**
28602 * The base implementation of `_.times` without support for iteratee shorthands 28603 * or max array length checks. 28604 * 28605 * @private 28606 * @param {number} n The number of times to invoke `iteratee`. 28607 * @param {Function} iteratee The function invoked per iteration. 28608 * @returns {Array} Returns the array of results. 28609 */ 28610 function baseTimes(n, iteratee) { 28611 var index = -1, 28612 result = Array(n); 28613 28614 while (++index < n) { 28615 result[index] = iteratee(index); 28616 } 28617 return result; 28618 } 28619 28620 /** 28621 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 28622 * of key-value pairs for `object` corresponding to the property names of `props`. 28623 * 28624 * @private 28625 * @param {Object} object The object to query. 28626 * @param {Array} props The property names to get values for. 28627 * @returns {Object} Returns the key-value pairs. 28628 */ 28629 function baseToPairs(object, props) { 28630 return arrayMap(props, function(key) { 28631 return [key, object[key]]; 28632 }); 28633 } 28634 28635 /** 28636 * The base implementation of `_.unary` without support for storing metadata. 28637 * 28638 * @private 28639 * @param {Function} func The function to cap arguments for. 28640 * @returns {Function} Returns the new capped function. 28641 */ 28642 function baseUnary(func) { 28643 return function(value) { 28644 return func(value); 28645 }; 28646 } 28647 28648 /** 28649 * The base implementation of `_.values` and `_.valuesIn` which creates an 28650 * array of `object` property values corresponding to the property names 28651 * of `props`. 28652 * 28653 * @private 28654 * @param {Object} object The object to query. 28655 * @param {Array} props The property names to get values for. 28656 * @returns {Object} Returns the array of property values. 28657 */ 28658 function baseValues(object, props) { 28659 return arrayMap(props, function(key) { 28660 return object[key]; 28661 }); 28662 } 28663 28664 /** 28665 * Checks if a `cache` value for `key` exists. 28666 * 28667 * @private 28668 * @param {Object} cache The cache to query. 28669 * @param {string} key The key of the entry to check. 28670 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 28671 */ 28672 function cacheHas(cache, key) { 28673 return cache.has(key); 28674 } 28675 28676 /** 28677 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 28678 * that is not found in the character symbols. 28679 * 28680 * @private 28681 * @param {Array} strSymbols The string symbols to inspect. 28682 * @param {Array} chrSymbols The character symbols to find. 28683 * @returns {number} Returns the index of the first unmatched string symbol. 28684 */ 28685 function charsStartIndex(strSymbols, chrSymbols) { 28686 var index = -1, 28687 length = strSymbols.length; 28688 28689 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 28690 return index; 28691 } 28692 28693 /** 28694 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 28695 * that is not found in the character symbols. 28696 * 28697 * @private 28698 * @param {Array} strSymbols The string symbols to inspect. 28699 * @param {Array} chrSymbols The character symbols to find. 28700 * @returns {number} Returns the index of the last unmatched string symbol. 28701 */ 28702 function charsEndIndex(strSymbols, chrSymbols) { 28703 var index = strSymbols.length; 28704 28705 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 28706 return index; 28707 } 28708 28709 /** 28710 * Gets the number of `placeholder` occurrences in `array`. 28711 * 28712 * @private 28713 * @param {Array} array The array to inspect. 28714 * @param {*} placeholder The placeholder to search for. 28715 * @returns {number} Returns the placeholder count. 28716 */ 28717 function countHolders(array, placeholder) { 28718 var length = array.length, 28719 result = 0; 28720 28721 while (length--) { 28722 if (array[length] === placeholder) { 28723 ++result; 28724 } 28725 } 28726 return result; 28727 } 28728 28729 /** 28730 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 28731 * letters to basic Latin letters. 28732 * 28733 * @private 28734 * @param {string} letter The matched letter to deburr. 28735 * @returns {string} Returns the deburred letter. 28736 */ 28737 var deburrLetter = basePropertyOf(deburredLetters); 28738 28739 /** 28740 * Used by `_.escape` to convert characters to HTML entities. 28741 * 28742 * @private 28743 * @param {string} chr The matched character to escape. 28744 * @returns {string} Returns the escaped character. 28745 */ 28746 var escapeHtmlChar = basePropertyOf(htmlEscapes); 28747 28748 /** 28749 * Used by `_.template` to escape characters for inclusion in compiled string literals. 28750 * 28751 * @private 28752 * @param {string} chr The matched character to escape. 28753 * @returns {string} Returns the escaped character. 28754 */ 28755 function escapeStringChar(chr) { 28756 return '\\' + stringEscapes[chr]; 28757 } 28758 28759 /** 28760 * Gets the value at `key` of `object`. 28761 * 28762 * @private 28763 * @param {Object} [object] The object to query. 28764 * @param {string} key The key of the property to get. 28765 * @returns {*} Returns the property value. 28766 */ 28767 function getValue(object, key) { 28768 return object == null ? undefined
vendor: 5,113 bytes, lines 28768-28969
28768 : object[key]; 28769 } 28770 28771 /** 28772 * Checks if `string` contains Unicode symbols. 28773 * 28774 * @private 28775 * @param {string} string The string to inspect. 28776 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 28777 */ 28778 function hasUnicode(string) { 28779 return reHasUnicode.test(string); 28780 } 28781 28782 /** 28783 * Checks if `string` contains a word composed of Unicode symbols. 28784 * 28785 * @private 28786 * @param {string} string The string to inspect. 28787 * @returns {boolean} Returns `true` if a word is found, else `false`. 28788 */ 28789 function hasUnicodeWord(string) { 28790 return reHasUnicodeWord.test(string); 28791 } 28792 28793 /** 28794 * Converts `iterator` to an array. 28795 * 28796 * @private 28797 * @param {Object} iterator The iterator to convert. 28798 * @returns {Array} Returns the converted array. 28799 */ 28800 function iteratorToArray(iterator) { 28801 var data, 28802 result = []; 28803 28804 while (!(data = iterator.next()).done) { 28805 result.push(data.value); 28806 } 28807 return result; 28808 } 28809 28810 /** 28811 * Converts `map` to its key-value pairs. 28812 * 28813 * @private 28814 * @param {Object} map The map to convert. 28815 * @returns {Array} Returns the key-value pairs. 28816 */ 28817 function mapToArray(map) { 28818 var index = -1, 28819 result = Array(map.size); 28820 28821 map.forEach(function(value, key) { 28822 result[++index] = [key, value]; 28823 }); 28824 return result; 28825 } 28826 28827 /** 28828 * Creates a unary function that invokes `func` with its argument transformed. 28829 * 28830 * @private 28831 * @param {Function} func The function to wrap. 28832 * @param {Function} transform The argument transform. 28833 * @returns {Function} Returns the new function. 28834 */ 28835 function overArg(func, transform) { 28836 return function(arg) { 28837 return func(transform(arg)); 28838 }; 28839 } 28840 28841 /** 28842 * Replaces all `placeholder` elements in `array` with an internal placeholder 28843 * and returns an array of their indexes. 28844 * 28845 * @private 28846 * @param {Array} array The array to modify. 28847 * @param {*} placeholder The placeholder to replace. 28848 * @returns {Array} Returns the new array of placeholder indexes. 28849 */ 28850 function replaceHolders(array, placeholder) { 28851 var index = -1, 28852 length = array.length, 28853 resIndex = 0, 28854 result = []; 28855 28856 while (++index < length) { 28857 var value = array[index]; 28858 if (value === placeholder || value === PLACEHOLDER) { 28859 array[index] = PLACEHOLDER; 28860 result[resIndex++] = index; 28861 } 28862 } 28863 return result; 28864 } 28865 28866 /** 28867 * Converts `set` to an array of its values. 28868 * 28869 * @private 28870 * @param {Object} set The set to convert. 28871 * @returns {Array} Returns the values. 28872 */ 28873 function setToArray(set) { 28874 var index = -1, 28875 result = Array(set.size); 28876 28877 set.forEach(function(value) { 28878 result[++index] = value; 28879 }); 28880 return result; 28881 } 28882 28883 /** 28884 * Converts `set` to its value-value pairs. 28885 * 28886 * @private 28887 * @param {Object} set The set to convert. 28888 * @returns {Array} Returns the value-value pairs. 28889 */ 28890 function setToPairs(set) { 28891 var index = -1, 28892 result = Array(set.size); 28893 28894 set.forEach(function(value) { 28895 result[++index] = [value, value]; 28896 }); 28897 return result; 28898 } 28899 28900 /** 28901 * A specialized version of `_.indexOf` which performs strict equality 28902 * comparisons of values, i.e. `===`. 28903 * 28904 * @private 28905 * @param {Array} array The array to inspect. 28906 * @param {*} value The value to search for. 28907 * @param {number} fromIndex The index to search from. 28908 * @returns {number} Returns the index of the matched value, else `-1`. 28909 */ 28910 function strictIndexOf(array, value, fromIndex) { 28911 var index = fromIndex - 1, 28912 length = array.length; 28913 28914 while (++index < length) { 28915 if (array[index] === value) { 28916 return index; 28917 } 28918 } 28919 return -1; 28920 } 28921 28922 /** 28923 * A specialized version of `_.lastIndexOf` which performs strict equality 28924 * comparisons of values, i.e. `===`. 28925 * 28926 * @private 28927 * @param {Array} array The array to inspect. 28928 * @param {*} value The value to search for. 28929 * @param {number} fromIndex The index to search from. 28930 * @returns {number} Returns the index of the matched value, else `-1`. 28931 */ 28932 function strictLastIndexOf(array, value, fromIndex) { 28933 var index = fromIndex + 1; 28934 while (index--) { 28935 if (array[index] === value) { 28936 return index; 28937 } 28938 } 28939 return index; 28940 } 28941 28942 /** 28943 * Gets the number of symbols in `string`. 28944 * 28945 * @private 28946 * @param {string} string The string to inspect. 28947 * @returns {number} Returns the string size. 28948 */ 28949 function stringSize(string) { 28950 return hasUnicode(string) 28951 ? unicodeSize(string) 28952 : asciiSize(string); 28953 } 28954 28955 /** 28956 * Converts `string` to an array. 28957 * 28958 * @private 28959 * @param {string} string The string to convert. 28960 * @returns {Array} Returns the converted array. 28961 */ 28962 function stringToArray(string) { 28963 return hasUnicode(string) 28964 ? unicodeToArray(string) 28965 : asciiToArray(string); 28966 } 28967 28968 /** 28969 * Used by `_.
28969unescape` to convert HTML entities to characters. 28970 * 28971 * @private 28972 * @param {string} chr The matched character to unescape. 28973 * @returns {string} Returns the unescaped character. 28974 */ 28975 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 28976 28977 /** 28978 * Gets the size of a Unicode `string`. 28979 * 28980 * @private 28981 * @param {string} string The string inspect. 28982 * @returns {number} Returns the string size. 28983 */ 28984 function unicodeSize(string) { 28985 var result = reUnicode.lastIndex = 0; 28986 while (reUnicode.test(string)) { 28987 ++result; 28988 } 28989 return result; 28990 } 28991 28992 /** 28993 * Converts a Unicode `string` to an array. 28994 * 28995 * @private 28996 * @param {string} string The string to convert. 28997 * @returns {Array} Returns the converted array. 28998 */ 28999 function unicodeToArray(string) { 29000 return string.match(reUnicode) || []; 29001 } 29002 29003 /** 29004 * Splits a Unicode `string` into an array of its words. 29005 * 29006 * @private 29007 * @param {string} The string to inspect. 29008 * @returns {Array} Returns the words of `string`. 29009 */ 29010 function unicodeWords(string) { 29011 return string.match(reUnicodeWord) || []; 29012 } 29013 29014 /*--------------------------------------------------------------------------*/ 29015 29016 /** 29017 * Create a new pristine `lodash` function using the `context` object. 29018 * 29019 * @static 29020 * @memberOf _ 29021 * @since 1.1.0 29022 * @category Util 29023 * @param {Object} [context=root] The context object. 29024 * @returns {Function} Returns a new `lodash` function. 29025 * @example 29026 * 29027 * _.mixin({ 'foo': _.constant('foo') }); 29028 * 29029 * var lodash = _.runInContext(); 29030 * lodash.mixin({ 'bar': lodash.constant('bar') }); 29031 * 29032 * _.isFunction(_.foo); 29033 * // => true 29034 * _.isFunction(_.bar); 29035 * // => false 29036 * 29037 * lodash.isFunction(lodash.foo); 29038 * // => false 29039 * lodash.isFunction(lodash.bar); 29040 * // => true 29041 * 29042 * // Create a suped-up `defer` in Node.js. 29043 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 29044 */ 29045 var runInContext = (function runInContext(context) { 29046 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 29047 29048 /** Built-in constructor references. */ 29049 var Array = context.Array, 29050 Date = context.Date, 29051 Error = context.Error, 29052 Function = context.Function, 29053 Math = context.Math, 29054 Object = context.Object, 29055 RegExp = context.RegExp, 29056 String = context.String, 29057 TypeError = context.TypeError; 29058 29059 /** Used for built-in method references. */ 29060 var arrayProto = Array.prototype, 29061 funcProto = Function.prototype, 29062 objectProto = Object.prototype; 29063 29064 /** Used to detect overreaching core-js shims. */ 29065 var coreJsData = context['__core-js_shared__']; 29066 29067 /** Used to resolve the decompiled source of functions. */ 29068 var funcToString = funcProto.toString; 29069 29070 /** Used to check objects for own properties. */ 29071 var hasOwnProperty = objectProto.hasOwnProperty; 29072 29073 /** Used to generate unique IDs. */ 29074 var idCounter = 0; 29075 29076 /** Used to detect methods masquerading as native. */ 29077 var maskSrcKey = (function() { 29078 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 29079 return uid ? ('Symbol(src)_1.' + uid) : ''; 29080 }()); 29081 29082 /** 29083 * Used to resolve the 29084 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 29085 * of values. 29086 */ 29087 var nativeObjectToString = objectProto.toString; 29088 29089 /** Used to infer the `Object` constructor. */ 29090 var objectCtorString = funcToString.call(Object); 29091 29092 /** Used to restore the original `_` reference in `_.noConflict`. */ 29093 var oldDash = root._; 29094 29095 /** Used to detect if a method is native. */ 29096 var reIsNative = RegExp('^' + 29097 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 29098 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 29099 ); 29100 29101 /** Built-in value references. */ 29102 var Buffer = moduleExports ? context.Buffer : undefined, 29103 Symbol = context.Symbol, 29104 Uint8Array = context.Uint8Array, 29105 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 29106 getPrototype = overArg(Object.getPrototypeOf, Object), 29107 objectCreate = Object.create, 29108 propertyIsEnumerable = objectProto.propertyIsEnumerable, 29109 splice = arrayProto.splice, 29110 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 29111 symIterator = Symbol ? Symbol.iterator : undefined,
vendor: 6,345 bytes, lines 29112-29234
29112 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 29113 29114 var defineProperty = (function() { 29115 try { 29116 var func = getNative(Object, 'defineProperty'); 29117 func({}, '', {}); 29118 return func; 29119 } catch (e) {} 29120 }()); 29121 29122 /** Mocked built-ins. */ 29123 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 29124 ctxNow = Date && Date.now !== root.Date.now && Date.now, 29125 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 29126 29127 /* Built-in method references for those with the same name as other `lodash` methods. */ 29128 var nativeCeil = Math.ceil, 29129 nativeFloor = Math.floor, 29130 nativeGetSymbols = Object.getOwnPropertySymbols, 29131 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 29132 nativeIsFinite = context.isFinite, 29133 nativeJoin = arrayProto.join, 29134 nativeKeys = overArg(Object.keys, Object), 29135 nativeMax = Math.max, 29136 nativeMin = Math.min, 29137 nativeNow = Date.now, 29138 nativeParseInt = context.parseInt, 29139 nativeRandom = Math.random, 29140 nativeReverse = arrayProto.reverse; 29141 29142 /* Built-in method references that are verified to be native. */ 29143 var DataView = getNative(context, 'DataView'), 29144 Map = getNative(context, 'Map'), 29145 Promise = getNative(context, 'Promise'), 29146 Set = getNative(context, 'Set'), 29147 WeakMap = getNative(context, 'WeakMap'), 29148 nativeCreate = getNative(Object, 'create'); 29149 29150 /** Used to store function metadata. */ 29151 var metaMap = WeakMap && new WeakMap; 29152 29153 /** Used to lookup unminified function names. */ 29154 var realNames = {}; 29155 29156 /** Used to detect maps, sets, and weakmaps. */ 29157 var dataViewCtorString = toSource(DataView), 29158 mapCtorString = toSource(Map), 29159 promiseCtorString = toSource(Promise), 29160 setCtorString = toSource(Set), 29161 weakMapCtorString = toSource(WeakMap); 29162 29163 /** Used to convert symbols to primitives and strings. */ 29164 var symbolProto = Symbol ? Symbol.prototype : undefined, 29165 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 29166 symbolToString = symbolProto ? symbolProto.toString : undefined; 29167 29168 /*------------------------------------------------------------------------*/ 29169 29170 /** 29171 * Creates a `lodash` object which wraps `value` to enable implicit method 29172 * chain sequences. Methods that operate on and return arrays, collections, 29173 * and functions can be chained together. Methods that retrieve a single value 29174 * or may return a primitive value will automatically end the chain sequence 29175 * and return the unwrapped value. Otherwise, the value must be unwrapped 29176 * with `_#value`. 29177 * 29178 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 29179 * enabled using `_.chain`. 29180 * 29181 * The execution of chained methods is lazy, that is, it's deferred until 29182 * `_#value` is implicitly or explicitly called. 29183 * 29184 * Lazy evaluation allows several methods to support shortcut fusion. 29185 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 29186 * the creation of intermediate arrays and can greatly reduce the number of 29187 * iteratee executions. Sections of a chain sequence qualify for shortcut 29188 * fusion if the section is applied to an array and iteratees accept only 29189 * one argument. The heuristic for whether a section qualifies for shortcut 29190 * fusion is subject to change. 29191 * 29192 * Chaining is supported in custom builds as long as the `_#value` method is 29193 * directly or indirectly included in the build. 29194 * 29195 * In addition to lodash methods, wrappers have `Array` and `String` methods. 29196 * 29197 * The wrapper `Array` methods are: 29198 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 29199 * 29200 * The wrapper `String` methods are: 29201 * `replace` and `split` 29202 * 29203 * The wrapper methods that support shortcut fusion are: 29204 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 29205 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 29206 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 29207 * 29208 * The chainable wrapper methods are: 29209 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 29210 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 29211 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 29212 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 29213 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 29214 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 29215 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 29216 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 29217 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 29218 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 29219 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 29220 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 29221 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 29222 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 29223 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 29224 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 29225 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 29226 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 29227 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 29228 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 29229 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 29230 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 29231 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 29232 * `zipObject`, `zipObjectDeep`, and `zipWith` 29233 * 29234 * The wrapper methods that are **not** chainable by default are:
29235 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 29236 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 29237 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 29238 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 29239 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 29240 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 29241 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 29242 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 29243 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 29244 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 29245 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 29246 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 29247 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 29248 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 29249 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 29250 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 29251 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 29252 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 29253 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 29254 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 29255 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 29256 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 29257 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 29258 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 29259 * `upperFirst`, `value`, and `words` 29260 * 29261 * @name _ 29262 * @constructor 29263 * @category Seq 29264 * @param {*} value The value to wrap in a `lodash` instance. 29265 * @returns {Object} Returns the new `lodash` wrapper instance. 29266 * @example 29267 * 29268 * function square(n) { 29269 * return n * n; 29270 * } 29271 * 29272 * var wrapped = _([1, 2, 3]); 29273 * 29274 * // Returns an unwrapped value. 29275 * wrapped.reduce(_.add); 29276 * // => 6 29277 * 29278 * // Returns a wrapped value. 29279 * var squares = wrapped.map(square); 29280 * 29281 * _.isArray(squares); 29282 * // => false 29283 * 29284 * _.isArray(squares.value()); 29285 * // => true 29286 */ 29287 function lodash(value) { 29288 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 29289 if (value instanceof LodashWrapper) { 29290 return value; 29291 } 29292 if (hasOwnProperty.call(value, '__wrapped__')) { 29293 return wrapperClone(value); 29294 } 29295 } 29296 return new LodashWrapper(value); 29297 } 29298 29299 /** 29300 * The base implementation of `_.create` without support for assigning 29301 * properties to the created object. 29302 * 29303 * @private 29304 * @param {Object} proto The object to inherit from. 29305 * @returns {Object} Returns the new object. 29306 */ 29307 var baseCreate = (function() { 29308 function object() {} 29309 return function(proto) { 29310 if (!isObject(proto)) { 29311 return {}; 29312 } 29313 if (objectCreate) { 29314 return objectCreate(proto); 29315 } 29316 object.prototype = proto; 29317 var result = new object; 29318 object.prototype = undefined; 29319 return result; 29320 }; 29321 }()); 29322 29323 /** 29324 * The function whose prototype chain sequence wrappers inherit from. 29325 * 29326 * @private 29327 */ 29328 function baseLodash() { 29329 // No operation performed. 29330 } 29331 29332 /** 29333 * The base constructor for creating `lodash` wrapper objects. 29334 * 29335 * @private 29336 * @param {*} value The value to wrap. 29337 * @param {boolean} [chainAll] Enable explicit method chain sequences. 29338 */ 29339 function LodashWrapper(value, chainAll) { 29340 this.__wrapped__ = value; 29341 this.__actions__ = []; 29342 this.__chain__ = !!chainAll; 29343 this.__index__ = 0; 29344 this.__values__ = undefined; 29345 } 29346 29347 /** 29348 * By default, the template delimiters used by lodash are like those in 29349 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 29350 * following template settings to use alternative delimiters. 29351 * 29352 * @static 29353 * @memberOf _ 29354 * @type {Object} 29355 */ 29356 lodash.templateSettings = { 29357 29358 /** 29359 * Used to detect `data` property values to be HTML-escaped. 29360 * 29361 * @memberOf _.templateSettings 29362 * @type {RegExp} 29363 */ 29364 'escape': reEscape, 29365 29366 /** 29367 * Used to detect code to be evaluated. 29368 * 29369 * @memberOf _.templateSettings 29370 * @type {RegExp} 29371 */ 29372 'evaluate': reEvaluate, 29373 29374 /** 29375 * Used to detect `data` property values to inject. 29376 * 29377 * @memberOf _.templateSettings 29378 * @type {RegExp} 29379 */ 29380 'interpolate': reInterpolate, 29381 29382 /** 29383 * Used to reference the data object in the template text. 29384 * 29385 * @memberOf _.templateSettings 29386 * @type {string} 29387 */ 29388 'variable': '', 29389 29390 /** 29391 * Used to import variables into the compiled template. 29392 * 29393 * @memberOf _.templateSettings 29394 * @type {Object} 29395 */ 29396 'imports': { 29397 29398 /** 29399 * A reference to the `lodash` function. 29400 * 29401 * @memberOf _.templateSettings.imports 29402 * @type {Function} 29403 */ 29404 '_': lodash 29405 } 29406 }; 29407 29408 // Ensure wrappers are instances of `baseLodash`.
vendor: 7,867 bytes, lines 29409-29684
29409 lodash.prototype = baseLodash.prototype; 29410 lodash.prototype.constructor = lodash; 29411 29412 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 29413 LodashWrapper.prototype.constructor = LodashWrapper; 29414 29415 /*------------------------------------------------------------------------*/ 29416 29417 /** 29418 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 29419 * 29420 * @private 29421 * @constructor 29422 * @param {*} value The value to wrap. 29423 */ 29424 function LazyWrapper(value) { 29425 this.__wrapped__ = value; 29426 this.__actions__ = []; 29427 this.__dir__ = 1; 29428 this.__filtered__ = false; 29429 this.__iteratees__ = []; 29430 this.__takeCount__ = MAX_ARRAY_LENGTH; 29431 this.__views__ = []; 29432 } 29433 29434 /** 29435 * Creates a clone of the lazy wrapper object. 29436 * 29437 * @private 29438 * @name clone 29439 * @memberOf LazyWrapper 29440 * @returns {Object} Returns the cloned `LazyWrapper` object. 29441 */ 29442 function lazyClone() { 29443 var result = new LazyWrapper(this.__wrapped__); 29444 result.__actions__ = copyArray(this.__actions__); 29445 result.__dir__ = this.__dir__; 29446 result.__filtered__ = this.__filtered__; 29447 result.__iteratees__ = copyArray(this.__iteratees__); 29448 result.__takeCount__ = this.__takeCount__; 29449 result.__views__ = copyArray(this.__views__); 29450 return result; 29451 } 29452 29453 /** 29454 * Reverses the direction of lazy iteration. 29455 * 29456 * @private 29457 * @name reverse 29458 * @memberOf LazyWrapper 29459 * @returns {Object} Returns the new reversed `LazyWrapper` object. 29460 */ 29461 function lazyReverse() { 29462 if (this.__filtered__) { 29463 var result = new LazyWrapper(this); 29464 result.__dir__ = -1; 29465 result.__filtered__ = true; 29466 } else { 29467 result = this.clone(); 29468 result.__dir__ *= -1; 29469 } 29470 return result; 29471 } 29472 29473 /** 29474 * Extracts the unwrapped value from its lazy wrapper. 29475 * 29476 * @private 29477 * @name value 29478 * @memberOf LazyWrapper 29479 * @returns {*} Returns the unwrapped value. 29480 */ 29481 function lazyValue() { 29482 var array = this.__wrapped__.value(), 29483 dir = this.__dir__, 29484 isArr = isArray(array), 29485 isRight = dir < 0, 29486 arrLength = isArr ? array.length : 0, 29487 view = getView(0, arrLength, this.__views__), 29488 start = view.start, 29489 end = view.end, 29490 length = end - start, 29491 index = isRight ? end : (start - 1), 29492 iteratees = this.__iteratees__, 29493 iterLength = iteratees.length, 29494 resIndex = 0, 29495 takeCount = nativeMin(length, this.__takeCount__); 29496 29497 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 29498 return baseWrapperValue(array, this.__actions__); 29499 } 29500 var result = []; 29501 29502 outer: 29503 while (length-- && resIndex < takeCount) { 29504 index += dir; 29505 29506 var iterIndex = -1, 29507 value = array[index]; 29508 29509 while (++iterIndex < iterLength) { 29510 var data = iteratees[iterIndex], 29511 iteratee = data.iteratee, 29512 type = data.type, 29513 computed = iteratee(value); 29514 29515 if (type == LAZY_MAP_FLAG) { 29516 value = computed; 29517 } else if (!computed) { 29518 if (type == LAZY_FILTER_FLAG) { 29519 continue outer; 29520 } else { 29521 break outer; 29522 } 29523 } 29524 } 29525 result[resIndex++] = value; 29526 } 29527 return result; 29528 } 29529 29530 // Ensure `LazyWrapper` is an instance of `baseLodash`. 29531 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 29532 LazyWrapper.prototype.constructor = LazyWrapper; 29533 29534 /*------------------------------------------------------------------------*/ 29535 29536 /** 29537 * Creates a hash object. 29538 * 29539 * @private 29540 * @constructor 29541 * @param {Array} [entries] The key-value pairs to cache. 29542 */ 29543 function Hash(entries) { 29544 var index = -1, 29545 length = entries == null ? 0 : entries.length; 29546 29547 this.clear(); 29548 while (++index < length) { 29549 var entry = entries[index]; 29550 this.set(entry[0], entry[1]); 29551 } 29552 } 29553 29554 /** 29555 * Removes all key-value entries from the hash. 29556 * 29557 * @private 29558 * @name clear 29559 * @memberOf Hash 29560 */ 29561 function hashClear() { 29562 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 29563 this.size = 0; 29564 } 29565 29566 /** 29567 * Removes `key` and its value from the hash. 29568 * 29569 * @private 29570 * @name delete 29571 * @memberOf Hash 29572 * @param {Object} hash The hash to modify. 29573 * @param {string} key The key of the value to remove. 29574 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 29575 */ 29576 function hashDelete(key) { 29577 var result = this.has(key) && delete this.__data__[key]; 29578 this.size -= result ? 1 : 0; 29579 return result; 29580 } 29581 29582 /** 29583 * Gets the hash value for `key`. 29584 * 29585 * @private 29586 * @name get 29587 * @memberOf Hash 29588 * @param {string} key The key of the value to get. 29589 * @returns {*} Returns the entry value. 29590 */ 29591 function hashGet(key) { 29592 var data = this.__data__; 29593 if (nativeCreate) { 29594 var result = data[key]; 29595 return result === HASH_UNDEFINED ? undefined : result; 29596 } 29597 return hasOwnProperty.call(data, key) ? data[key] : undefined; 29598 } 29599 29600 /** 29601 * Checks if a hash value for `key` exists. 29602 * 29603 * @private 29604 * @name has 29605 * @memberOf Hash 29606 * @param {string} key The key of the entry to check. 29607 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 29608 */ 29609 function hashHas(key) { 29610 var data = this.__data__; 29611 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 29612 } 29613 29614 /** 29615 * Sets the hash `key` to `value`. 29616 * 29617 * @private 29618 * @name set 29619 * @memberOf Hash 29620 * @param {string} key The key of the value to set. 29621 * @param {*} value The value to set. 29622 * @returns {Object} Returns the hash instance. 29623 */ 29624 function hashSet(key, value) { 29625 var data = this.__data__; 29626 this.size += this.has(key) ? 0 : 1; 29627 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 29628 return this; 29629 } 29630 29631 // Add methods to `Hash`. 29632 Hash.prototype.clear = hashClear; 29633 Hash.prototype['delete'] = hashDelete; 29634 Hash.prototype.get = hashGet; 29635 Hash.prototype.has = hashHas; 29636 Hash.prototype.set = hashSet; 29637 29638 /*------------------------------------------------------------------------*/ 29639 29640 /** 29641 * Creates an list cache object. 29642 * 29643 * @private 29644 * @constructor 29645 * @param {Array} [entries] The key-value pairs to cache. 29646 */ 29647 function ListCache(entries) { 29648 var index = -1, 29649 length = entries == null ? 0 : entries.length; 29650 29651 this.clear(); 29652 while (++index < length) { 29653 var entry = entries[index]; 29654 this.set(entry[0], entry[1]); 29655 } 29656 } 29657 29658 /** 29659 * Removes all key-value entries from the list cache. 29660 * 29661 * @private 29662 * @name clear 29663 * @memberOf ListCache 29664 */ 29665 function listCacheClear() { 29666 this.__data__ = []; 29667 this.size = 0; 29668 } 29669 29670 /** 29671 * Removes `key` and its value from the list cache. 29672 * 29673 * @private 29674 * @name delete 29675 * @memberOf ListCache 29676 * @param {string} key The key of the value to remove. 29677 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 29678 */ 29679 function listCacheDelete(key) { 29680 var data = this.__data__, 29681 index = assocIndexOf(data, key); 29682 29683 if (index < 0) { 29684 return false;
29685 } 29686 var lastIndex = data.length - 1; 29687 if (index == lastIndex) { 29688 data.pop(); 29689 } else { 29690 splice.call(data, index, 1); 29691 } 29692 --this.size; 29693 return true; 29694 } 29695 29696 /** 29697 * Gets the list cache value for `key`. 29698 * 29699 * @private 29700 * @name get 29701 * @memberOf ListCache 29702 * @param {string} key The key of the value to get. 29703 * @returns {*} Returns the entry value. 29704 */ 29705 function listCacheGet(key) { 29706 var data = this.__data__, 29707 index = assocIndexOf(data, key); 29708 29709 return index < 0 ? undefined
vendor: 10,019 bytes, lines 29709-30058
29709 : data[index][1]; 29710 } 29711 29712 /** 29713 * Checks if a list cache value for `key` exists. 29714 * 29715 * @private 29716 * @name has 29717 * @memberOf ListCache 29718 * @param {string} key The key of the entry to check. 29719 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 29720 */ 29721 function listCacheHas(key) { 29722 return assocIndexOf(this.__data__, key) > -1; 29723 } 29724 29725 /** 29726 * Sets the list cache `key` to `value`. 29727 * 29728 * @private 29729 * @name set 29730 * @memberOf ListCache 29731 * @param {string} key The key of the value to set. 29732 * @param {*} value The value to set. 29733 * @returns {Object} Returns the list cache instance. 29734 */ 29735 function listCacheSet(key, value) { 29736 var data = this.__data__, 29737 index = assocIndexOf(data, key); 29738 29739 if (index < 0) { 29740 ++this.size; 29741 data.push([key, value]); 29742 } else { 29743 data[index][1] = value; 29744 } 29745 return this; 29746 } 29747 29748 // Add methods to `ListCache`. 29749 ListCache.prototype.clear = listCacheClear; 29750 ListCache.prototype['delete'] = listCacheDelete; 29751 ListCache.prototype.get = listCacheGet; 29752 ListCache.prototype.has = listCacheHas; 29753 ListCache.prototype.set = listCacheSet; 29754 29755 /*------------------------------------------------------------------------*/ 29756 29757 /** 29758 * Creates a map cache object to store key-value pairs. 29759 * 29760 * @private 29761 * @constructor 29762 * @param {Array} [entries] The key-value pairs to cache. 29763 */ 29764 function MapCache(entries) { 29765 var index = -1, 29766 length = entries == null ? 0 : entries.length; 29767 29768 this.clear(); 29769 while (++index < length) { 29770 var entry = entries[index]; 29771 this.set(entry[0], entry[1]); 29772 } 29773 } 29774 29775 /** 29776 * Removes all key-value entries from the map. 29777 * 29778 * @private 29779 * @name clear 29780 * @memberOf MapCache 29781 */ 29782 function mapCacheClear() { 29783 this.size = 0; 29784 this.__data__ = { 29785 'hash': new Hash, 29786 'map': new (Map || ListCache), 29787 'string': new Hash 29788 }; 29789 } 29790 29791 /** 29792 * Removes `key` and its value from the map. 29793 * 29794 * @private 29795 * @name delete 29796 * @memberOf MapCache 29797 * @param {string} key The key of the value to remove. 29798 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 29799 */ 29800 function mapCacheDelete(key) { 29801 var result = getMapData(this, key)['delete'](key); 29802 this.size -= result ? 1 : 0; 29803 return result; 29804 } 29805 29806 /** 29807 * Gets the map value for `key`. 29808 * 29809 * @private 29810 * @name get 29811 * @memberOf MapCache 29812 * @param {string} key The key of the value to get. 29813 * @returns {*} Returns the entry value. 29814 */ 29815 function mapCacheGet(key) { 29816 return getMapData(this, key).get(key); 29817 } 29818 29819 /** 29820 * Checks if a map value for `key` exists. 29821 * 29822 * @private 29823 * @name has 29824 * @memberOf MapCache 29825 * @param {string} key The key of the entry to check. 29826 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 29827 */ 29828 function mapCacheHas(key) { 29829 return getMapData(this, key).has(key); 29830 } 29831 29832 /** 29833 * Sets the map `key` to `value`. 29834 * 29835 * @private 29836 * @name set 29837 * @memberOf MapCache 29838 * @param {string} key The key of the value to set. 29839 * @param {*} value The value to set. 29840 * @returns {Object} Returns the map cache instance. 29841 */ 29842 function mapCacheSet(key, value) { 29843 var data = getMapData(this, key), 29844 size = data.size; 29845 29846 data.set(key, value); 29847 this.size += data.size == size ? 0 : 1; 29848 return this; 29849 } 29850 29851 // Add methods to `MapCache`. 29852 MapCache.prototype.clear = mapCacheClear; 29853 MapCache.prototype['delete'] = mapCacheDelete; 29854 MapCache.prototype.get = mapCacheGet; 29855 MapCache.prototype.has = mapCacheHas; 29856 MapCache.prototype.set = mapCacheSet; 29857 29858 /*------------------------------------------------------------------------*/ 29859 29860 /** 29861 * 29862 * Creates an array cache object to store unique values. 29863 * 29864 * @private 29865 * @constructor 29866 * @param {Array} [values] The values to cache. 29867 */ 29868 function SetCache(values) { 29869 var index = -1, 29870 length = values == null ? 0 : values.length; 29871 29872 this.__data__ = new MapCache; 29873 while (++index < length) { 29874 this.add(values[index]); 29875 } 29876 } 29877 29878 /** 29879 * Adds `value` to the array cache. 29880 * 29881 * @private 29882 * @name add 29883 * @memberOf SetCache 29884 * @alias push 29885 * @param {*} value The value to cache. 29886 * @returns {Object} Returns the cache instance. 29887 */ 29888 function setCacheAdd(value) { 29889 this.__data__.set(value, HASH_UNDEFINED); 29890 return this; 29891 } 29892 29893 /** 29894 * Checks if `value` is in the array cache. 29895 * 29896 * @private 29897 * @name has 29898 * @memberOf SetCache 29899 * @param {*} value The value to search for. 29900 * @returns {number} Returns `true` if `value` is found, else `false`. 29901 */ 29902 function setCacheHas(value) { 29903 return this.__data__.has(value); 29904 } 29905 29906 // Add methods to `SetCache`. 29907 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 29908 SetCache.prototype.has = setCacheHas; 29909 29910 /*------------------------------------------------------------------------*/ 29911 29912 /** 29913 * Creates a stack cache object to store key-value pairs. 29914 * 29915 * @private 29916 * @constructor 29917 * @param {Array} [entries] The key-value pairs to cache. 29918 */ 29919 function Stack(entries) { 29920 var data = this.__data__ = new ListCache(entries); 29921 this.size = data.size; 29922 } 29923 29924 /** 29925 * Removes all key-value entries from the stack. 29926 * 29927 * @private 29928 * @name clear 29929 * @memberOf Stack 29930 */ 29931 function stackClear() { 29932 this.__data__ = new ListCache; 29933 this.size = 0; 29934 } 29935 29936 /** 29937 * Removes `key` and its value from the stack. 29938 * 29939 * @private 29940 * @name delete 29941 * @memberOf Stack 29942 * @param {string} key The key of the value to remove. 29943 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 29944 */ 29945 function stackDelete(key) { 29946 var data = this.__data__, 29947 result = data['delete'](key); 29948 29949 this.size = data.size; 29950 return result; 29951 } 29952 29953 /** 29954 * Gets the stack value for `key`. 29955 * 29956 * @private 29957 * @name get 29958 * @memberOf Stack 29959 * @param {string} key The key of the value to get. 29960 * @returns {*} Returns the entry value. 29961 */ 29962 function stackGet(key) { 29963 return this.__data__.get(key); 29964 } 29965 29966 /** 29967 * Checks if a stack value for `key` exists. 29968 * 29969 * @private 29970 * @name has 29971 * @memberOf Stack 29972 * @param {string} key The key of the entry to check. 29973 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 29974 */ 29975 function stackHas(key) { 29976 return this.__data__.has(key); 29977 } 29978 29979 /** 29980 * Sets the stack `key` to `value`. 29981 * 29982 * @private 29983 * @name set 29984 * @memberOf Stack 29985 * @param {string} key The key of the value to set. 29986 * @param {*} value The value to set. 29987 * @returns {Object} Returns the stack cache instance. 29988 */ 29989 function stackSet(key, value) { 29990 var data = this.__data__; 29991 if (data instanceof ListCache) { 29992 var pairs = data.__data__; 29993 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 29994 pairs.push([key, value]); 29995 this.size = ++data.size; 29996 return this; 29997 } 29998 data = this.__data__ = new MapCache(pairs); 29999 } 30000 data.set(key, value); 30001 this.size = data.size; 30002 return this; 30003 } 30004 30005 // Add methods to `Stack`. 30006 Stack.prototype.clear = stackClear; 30007 Stack.prototype['delete'] = stackDelete; 30008 Stack.prototype.get = stackGet; 30009 Stack.prototype.has = stackHas; 30010 Stack.prototype.set = stackSet; 30011 30012 /*------------------------------------------------------------------------*/ 30013 30014 /** 30015 * Creates an array of the enumerable property names of the array-like `value`. 30016 * 30017 * @private 30018 * @param {*} value The value to query. 30019 * @param {boolean} inherited Specify returning inherited property names. 30020 * @returns {Array} Returns the array of property names. 30021 */ 30022 function arrayLikeKeys(value, inherited) { 30023 var isArr = isArray(value), 30024 isArg = !isArr && isArguments(value), 30025 isBuff = !isArr && !isArg && isBuffer(value), 30026 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 30027 skipIndexes = isArr || isArg || isBuff || isType, 30028 result = skipIndexes ? baseTimes(value.length, String) : [], 30029 length = result.length; 30030 30031 for (var key in value) { 30032 if ((inherited || hasOwnProperty.call(value, key)) && 30033 !(skipIndexes && ( 30034 // Safari 9 has enumerable `arguments.length` in strict mode. 30035 key == 'length' || 30036 // Node.js 0.10 has enumerable non-index properties on buffers. 30037 (isBuff && (key == 'offset' || key == 'parent')) || 30038 // PhantomJS 2 has enumerable non-index properties on typed arrays. 30039 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 30040 // Skip index properties. 30041 isIndex(key, length) 30042 ))) { 30043 result.push(key); 30044 } 30045 } 30046 return result; 30047 } 30048 30049 /** 30050 * A specialized version of `_.sample` for arrays. 30051 * 30052 * @private 30053 * @param {Array} array The array to sample. 30054 * @returns {*} Returns the random element. 30055 */ 30056 function arraySample(array) { 30057 var length = array.length; 30058 return length ? array[baseRandom(0, length - 1)] : undefined
vendor: 42,538 bytes, lines 30058-31291
30058; 30059 } 30060 30061 /** 30062 * A specialized version of `_.sampleSize` for arrays. 30063 * 30064 * @private 30065 * @param {Array} array The array to sample. 30066 * @param {number} n The number of elements to sample. 30067 * @returns {Array} Returns the random elements. 30068 */ 30069 function arraySampleSize(array, n) { 30070 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 30071 } 30072 30073 /** 30074 * A specialized version of `_.shuffle` for arrays. 30075 * 30076 * @private 30077 * @param {Array} array The array to shuffle. 30078 * @returns {Array} Returns the new shuffled array. 30079 */ 30080 function arrayShuffle(array) { 30081 return shuffleSelf(copyArray(array)); 30082 } 30083 30084 /** 30085 * This function is like `assignValue` except that it doesn't assign 30086 * `undefined` values. 30087 * 30088 * @private 30089 * @param {Object} object The object to modify. 30090 * @param {string} key The key of the property to assign. 30091 * @param {*} value The value to assign. 30092 */ 30093 function assignMergeValue(object, key, value) { 30094 if ((value !== undefined && !eq(object[key], value)) || 30095 (value === undefined && !(key in object))) { 30096 baseAssignValue(object, key, value); 30097 } 30098 } 30099 30100 /** 30101 * Assigns `value` to `key` of `object` if the existing value is not equivalent 30102 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 30103 * for equality comparisons. 30104 * 30105 * @private 30106 * @param {Object} object The object to modify. 30107 * @param {string} key The key of the property to assign. 30108 * @param {*} value The value to assign. 30109 */ 30110 function assignValue(object, key, value) { 30111 var objValue = object[key]; 30112 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 30113 (value === undefined && !(key in object))) { 30114 baseAssignValue(object, key, value); 30115 } 30116 } 30117 30118 /** 30119 * Gets the index at which the `key` is found in `array` of key-value pairs. 30120 * 30121 * @private 30122 * @param {Array} array The array to inspect. 30123 * @param {*} key The key to search for. 30124 * @returns {number} Returns the index of the matched value, else `-1`. 30125 */ 30126 function assocIndexOf(array, key) { 30127 var length = array.length; 30128 while (length--) { 30129 if (eq(array[length][0], key)) { 30130 return length; 30131 } 30132 } 30133 return -1; 30134 } 30135 30136 /** 30137 * Aggregates elements of `collection` on `accumulator` with keys transformed 30138 * by `iteratee` and values set by `setter`. 30139 * 30140 * @private 30141 * @param {Array|Object} collection The collection to iterate over. 30142 * @param {Function} setter The function to set `accumulator` values. 30143 * @param {Function} iteratee The iteratee to transform keys. 30144 * @param {Object} accumulator The initial aggregated object. 30145 * @returns {Function} Returns `accumulator`. 30146 */ 30147 function baseAggregator(collection, setter, iteratee, accumulator) { 30148 baseEach(collection, function(value, key, collection) { 30149 setter(accumulator, value, iteratee(value), collection); 30150 }); 30151 return accumulator; 30152 } 30153 30154 /** 30155 * The base implementation of `_.assign` without support for multiple sources 30156 * or `customizer` functions. 30157 * 30158 * @private 30159 * @param {Object} object The destination object. 30160 * @param {Object} source The source object. 30161 * @returns {Object} Returns `object`. 30162 */ 30163 function baseAssign(object, source) { 30164 return object && copyObject(source, keys(source), object); 30165 } 30166 30167 /** 30168 * The base implementation of `_.assignIn` without support for multiple sources 30169 * or `customizer` functions. 30170 * 30171 * @private 30172 * @param {Object} object The destination object. 30173 * @param {Object} source The source object. 30174 * @returns {Object} Returns `object`. 30175 */ 30176 function baseAssignIn(object, source) { 30177 return object && copyObject(source, keysIn(source), object); 30178 } 30179 30180 /** 30181 * The base implementation of `assignValue` and `assignMergeValue` without 30182 * value checks. 30183 * 30184 * @private 30185 * @param {Object} object The object to modify. 30186 * @param {string} key The key of the property to assign. 30187 * @param {*} value The value to assign. 30188 */ 30189 function baseAssignValue(object, key, value) { 30190 if (key == '__proto__' && defineProperty) { 30191 defineProperty(object, key, { 30192 'configurable': true, 30193 'enumerable': true, 30194 'value': value, 30195 'writable': true 30196 }); 30197 } else { 30198 object[key] = value; 30199 } 30200 } 30201 30202 /** 30203 * The base implementation of `_.at` without support for individual paths. 30204 * 30205 * @private 30206 * @param {Object} object The object to iterate over. 30207 * @param {string[]} paths The property paths to pick. 30208 * @returns {Array} Returns the picked elements. 30209 */ 30210 function baseAt(object, paths) { 30211 var index = -1, 30212 length = paths.length, 30213 result = Array(length), 30214 skip = object == null; 30215 30216 while (++index < length) { 30217 result[index] = skip ? undefined : get(object, paths[index]); 30218 } 30219 return result; 30220 } 30221 30222 /** 30223 * The base implementation of `_.clamp` which doesn't coerce arguments. 30224 * 30225 * @private 30226 * @param {number} number The number to clamp. 30227 * @param {number} [lower] The lower bound. 30228 * @param {number} upper The upper bound. 30229 * @returns {number} Returns the clamped number. 30230 */ 30231 function baseClamp(number, lower, upper) { 30232 if (number === number) { 30233 if (upper !== undefined) { 30234 number = number <= upper ? number : upper; 30235 } 30236 if (lower !== undefined) { 30237 number = number >= lower ? number : lower; 30238 } 30239 } 30240 return number; 30241 } 30242 30243 /** 30244 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 30245 * traversed objects. 30246 * 30247 * @private 30248 * @param {*} value The value to clone. 30249 * @param {boolean} bitmask The bitmask flags. 30250 * 1 - Deep clone 30251 * 2 - Flatten inherited properties 30252 * 4 - Clone symbols 30253 * @param {Function} [customizer] The function to customize cloning. 30254 * @param {string} [key] The key of `value`. 30255 * @param {Object} [object] The parent object of `value`. 30256 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 30257 * @returns {*} Returns the cloned value. 30258 */ 30259 function baseClone(value, bitmask, customizer, key, object, stack) { 30260 var result, 30261 isDeep = bitmask & CLONE_DEEP_FLAG, 30262 isFlat = bitmask & CLONE_FLAT_FLAG, 30263 isFull = bitmask & CLONE_SYMBOLS_FLAG; 30264 30265 if (customizer) { 30266 result = object ? customizer(value, key, object, stack) : customizer(value); 30267 } 30268 if (result !== undefined) { 30269 return result; 30270 } 30271 if (!isObject(value)) { 30272 return value; 30273 } 30274 var isArr = isArray(value); 30275 if (isArr) { 30276 result = initCloneArray(value); 30277 if (!isDeep) { 30278 return copyArray(value, result); 30279 } 30280 } else { 30281 var tag = getTag(value), 30282 isFunc = tag == funcTag || tag == genTag; 30283 30284 if (isBuffer(value)) { 30285 return cloneBuffer(value, isDeep); 30286 } 30287 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 30288 result = (isFlat || isFunc) ? {} : initCloneObject(value); 30289 if (!isDeep) { 30290 return isFlat 30291 ? copySymbolsIn(value, baseAssignIn(result, value)) 30292 : copySymbols(value, baseAssign(result, value)); 30293 } 30294 } else { 30295 if (!cloneableTags[tag]) { 30296 return object ? value : {}; 30297 } 30298 result = initCloneByTag(value, tag, baseClone, isDeep); 30299 } 30300 } 30301 // Check for circular references and return its corresponding clone. 30302 stack || (stack = new Stack); 30303 var stacked = stack.get(value); 30304 if (stacked) { 30305 return stacked; 30306 } 30307 stack.set(value, result); 30308 30309 var keysFunc = isFull 30310 ? (isFlat ? getAllKeysIn : getAllKeys) 30311 : (isFlat ? keysIn : keys); 30312 30313 var props = isArr ? undefined : keysFunc(value); 30314 arrayEach(props || value, function(subValue, key) { 30315 if (props) { 30316 key = subValue; 30317 subValue = value[key]; 30318 } 30319 // Recursively populate clone (susceptible to call stack limits). 30320 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 30321 }); 30322 return result; 30323 } 30324 30325 /** 30326 * The base implementation of `_.conforms` which doesn't clone `source`. 30327 * 30328 * @private 30329 * @param {Object} source The object of property predicates to conform to. 30330 * @returns {Function} Returns the new spec function. 30331 */ 30332 function baseConforms(source) { 30333 var props = keys(source); 30334 return function(object) { 30335 return baseConformsTo(object, source, props); 30336 }; 30337 } 30338 30339 /** 30340 * The base implementation of `_.conformsTo` which accepts `props` to check. 30341 * 30342 * @private 30343 * @param {Object} object The object to inspect. 30344 * @param {Object} source The object of property predicates to conform to. 30345 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 30346 */ 30347 function baseConformsTo(object, source, props) { 30348 var length = props.length; 30349 if (object == null) { 30350 return !length; 30351 } 30352 object = Object(object); 30353 while (length--) { 30354 var key = props[length], 30355 predicate = source[key], 30356 value = object[key]; 30357 30358 if ((value === undefined && !(key in object)) || !predicate(value)) { 30359 return false; 30360 } 30361 } 30362 return true; 30363 } 30364 30365 /** 30366 * The base implementation of `_.delay` and `_.defer` which accepts `args` 30367 * to provide to `func`. 30368 * 30369 * @private 30370 * @param {Function} func The function to delay. 30371 * @param {number} wait The number of milliseconds to delay invocation. 30372 * @param {Array} args The arguments to provide to `func`. 30373 * @returns {number|Object} Returns the timer id or timeout object. 30374 */ 30375 function baseDelay(func, wait, args) { 30376 if (typeof func != 'function') { 30377 throw new TypeError(FUNC_ERROR_TEXT); 30378 } 30379 return setTimeout(function() { func.apply(undefined, args); }, wait); 30380 } 30381 30382 /** 30383 * The base implementation of methods like `_.difference` without support 30384 * for excluding multiple arrays or iteratee shorthands. 30385 * 30386 * @private 30387 * @param {Array} array The array to inspect. 30388 * @param {Array} values The values to exclude. 30389 * @param {Function} [iteratee] The iteratee invoked per element. 30390 * @param {Function} [comparator] The comparator invoked per element. 30391 * @returns {Array} Returns the new array of filtered values. 30392 */ 30393 function baseDifference(array, values, iteratee, comparator) { 30394 var index = -1, 30395 includes = arrayIncludes, 30396 isCommon = true, 30397 length = array.length, 30398 result = [], 30399 valuesLength = values.length; 30400 30401 if (!length) { 30402 return result; 30403 } 30404 if (iteratee) { 30405 values = arrayMap(values, baseUnary(iteratee)); 30406 } 30407 if (comparator) { 30408 includes = arrayIncludesWith; 30409 isCommon = false; 30410 } 30411 else if (values.length >= LARGE_ARRAY_SIZE) { 30412 includes = cacheHas; 30413 isCommon = false; 30414 values = new SetCache(values); 30415 } 30416 outer: 30417 while (++index < length) { 30418 var value = array[index], 30419 computed = iteratee == null ? value : iteratee(value); 30420 30421 value = (comparator || value !== 0) ? value : 0; 30422 if (isCommon && computed === computed) { 30423 var valuesIndex = valuesLength; 30424 while (valuesIndex--) { 30425 if (values[valuesIndex] === computed) { 30426 continue outer; 30427 } 30428 } 30429 result.push(value); 30430 } 30431 else if (!includes(values, computed, comparator)) { 30432 result.push(value); 30433 } 30434 } 30435 return result; 30436 } 30437 30438 /** 30439 * The base implementation of `_.forEach` without support for iteratee shorthands. 30440 * 30441 * @private 30442 * @param {Array|Object} collection The collection to iterate over. 30443 * @param {Function} iteratee The function invoked per iteration. 30444 * @returns {Array|Object} Returns `collection`. 30445 */ 30446 var baseEach = createBaseEach(baseForOwn); 30447 30448 /** 30449 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 30450 * 30451 * @private 30452 * @param {Array|Object} collection The collection to iterate over. 30453 * @param {Function} iteratee The function invoked per iteration. 30454 * @returns {Array|Object} Returns `collection`. 30455 */ 30456 var baseEachRight = createBaseEach(baseForOwnRight, true); 30457 30458 /** 30459 * The base implementation of `_.every` without support for iteratee shorthands. 30460 * 30461 * @private 30462 * @param {Array|Object} collection The collection to iterate over. 30463 * @param {Function} predicate The function invoked per iteration. 30464 * @returns {boolean} Returns `true` if all elements pass the predicate check, 30465 * else `false` 30466 */ 30467 function baseEvery(collection, predicate) { 30468 var result = true; 30469 baseEach(collection, function(value, index, collection) { 30470 result = !!predicate(value, index, collection); 30471 return result; 30472 }); 30473 return result; 30474 } 30475 30476 /** 30477 * The base implementation of methods like `_.max` and `_.min` which accepts a 30478 * `comparator` to determine the extremum value. 30479 * 30480 * @private 30481 * @param {Array} array The array to iterate over. 30482 * @param {Function} iteratee The iteratee invoked per iteration. 30483 * @param {Function} comparator The comparator used to compare values. 30484 * @returns {*} Returns the extremum value. 30485 */ 30486 function baseExtremum(array, iteratee, comparator) { 30487 var index = -1, 30488 length = array.length; 30489 30490 while (++index < length) { 30491 var value = array[index], 30492 current = iteratee(value); 30493 30494 if (current != null && (computed === undefined 30495 ? (current === current && !isSymbol(current)) 30496 : comparator(current, computed) 30497 )) { 30498 var computed = current, 30499 result = value; 30500 } 30501 } 30502 return result; 30503 } 30504 30505 /** 30506 * The base implementation of `_.fill` without an iteratee call guard. 30507 * 30508 * @private 30509 * @param {Array} array The array to fill. 30510 * @param {*} value The value to fill `array` with. 30511 * @param {number} [start=0] The start position. 30512 * @param {number} [end=array.length] The end position. 30513 * @returns {Array} Returns `array`. 30514 */ 30515 function baseFill(array, value, start, end) { 30516 var length = array.length; 30517 30518 start = toInteger(start); 30519 if (start < 0) { 30520 start = -start > length ? 0 : (length + start); 30521 } 30522 end = (end === undefined || end > length) ? length : toInteger(end); 30523 if (end < 0) { 30524 end += length; 30525 } 30526 end = start > end ? 0 : toLength(end); 30527 while (start < end) { 30528 array[start++] = value; 30529 } 30530 return array; 30531 } 30532 30533 /** 30534 * The base implementation of `_.filter` without support for iteratee shorthands. 30535 * 30536 * @private 30537 * @param {Array|Object} collection The collection to iterate over. 30538 * @param {Function} predicate The function invoked per iteration. 30539 * @returns {Array} Returns the new filtered array. 30540 */ 30541 function baseFilter(collection, predicate) { 30542 var result = []; 30543 baseEach(collection, function(value, index, collection) { 30544 if (predicate(value, index, collection)) { 30545 result.push(value); 30546 } 30547 }); 30548 return result; 30549 } 30550 30551 /** 30552 * The base implementation of `_.flatten` with support for restricting flattening. 30553 * 30554 * @private 30555 * @param {Array} array The array to flatten. 30556 * @param {number} depth The maximum recursion depth. 30557 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 30558 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 30559 * @param {Array} [result=[]] The initial result value. 30560 * @returns {Array} Returns the new flattened array. 30561 */ 30562 function baseFlatten(array, depth, predicate, isStrict, result) { 30563 var index = -1, 30564 length = array.length; 30565 30566 predicate || (predicate = isFlattenable); 30567 result || (result = []); 30568 30569 while (++index < length) { 30570 var value = array[index]; 30571 if (depth > 0 && predicate(value)) { 30572 if (depth > 1) { 30573 // Recursively flatten arrays (susceptible to call stack limits). 30574 baseFlatten(value, depth - 1, predicate, isStrict, result); 30575 } else { 30576 arrayPush(result, value); 30577 } 30578 } else if (!isStrict) { 30579 result[result.length] = value; 30580 } 30581 } 30582 return result; 30583 } 30584 30585 /** 30586 * The base implementation of `baseForOwn` which iterates over `object` 30587 * properties returned by `keysFunc` and invokes `iteratee` for each property. 30588 * Iteratee functions may exit iteration early by explicitly returning `false`. 30589 * 30590 * @private 30591 * @param {Object} object The object to iterate over. 30592 * @param {Function} iteratee The function invoked per iteration. 30593 * @param {Function} keysFunc The function to get the keys of `object`. 30594 * @returns {Object} Returns `object`. 30595 */ 30596 var baseFor = createBaseFor(); 30597 30598 /** 30599 * This function is like `baseFor` except that it iterates over properties 30600 * in the opposite order. 30601 * 30602 * @private 30603 * @param {Object} object The object to iterate over. 30604 * @param {Function} iteratee The function invoked per iteration. 30605 * @param {Function} keysFunc The function to get the keys of `object`. 30606 * @returns {Object} Returns `object`. 30607 */ 30608 var baseForRight = createBaseFor(true); 30609 30610 /** 30611 * The base implementation of `_.forOwn` without support for iteratee shorthands. 30612 * 30613 * @private 30614 * @param {Object} object The object to iterate over. 30615 * @param {Function} iteratee The function invoked per iteration. 30616 * @returns {Object} Returns `object`. 30617 */ 30618 function baseForOwn(object, iteratee) { 30619 return object && baseFor(object, iteratee, keys); 30620 } 30621 30622 /** 30623 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 30624 * 30625 * @private 30626 * @param {Object} object The object to iterate over. 30627 * @param {Function} iteratee The function invoked per iteration. 30628 * @returns {Object} Returns `object`. 30629 */ 30630 function baseForOwnRight(object, iteratee) { 30631 return object && baseForRight(object, iteratee, keys); 30632 } 30633 30634 /** 30635 * The base implementation of `_.functions` which creates an array of 30636 * `object` function property names filtered from `props`. 30637 * 30638 * @private 30639 * @param {Object} object The object to inspect. 30640 * @param {Array} props The property names to filter. 30641 * @returns {Array} Returns the function names. 30642 */ 30643 function baseFunctions(object, props) { 30644 return arrayFilter(props, function(key) { 30645 return isFunction(object[key]); 30646 }); 30647 } 30648 30649 /** 30650 * The base implementation of `_.get` without support for default values. 30651 * 30652 * @private 30653 * @param {Object} object The object to query. 30654 * @param {Array|string} path The path of the property to get. 30655 * @returns {*} Returns the resolved value. 30656 */ 30657 function baseGet(object, path) { 30658 path = castPath(path, object); 30659 30660 var index = 0, 30661 length = path.length; 30662 30663 while (object != null && index < length) { 30664 object = object[toKey(path[index++])]; 30665 } 30666 return (index && index == length) ? object : undefined; 30667 } 30668 30669 /** 30670 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 30671 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 30672 * symbols of `object`. 30673 * 30674 * @private 30675 * @param {Object} object The object to query. 30676 * @param {Function} keysFunc The function to get the keys of `object`. 30677 * @param {Function} symbolsFunc The function to get the symbols of `object`. 30678 * @returns {Array} Returns the array of property names and symbols. 30679 */ 30680 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 30681 var result = keysFunc(object); 30682 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 30683 } 30684 30685 /** 30686 * The base implementation of `getTag` without fallbacks for buggy environments. 30687 * 30688 * @private 30689 * @param {*} value The value to query. 30690 * @returns {string} Returns the `toStringTag`. 30691 */ 30692 function baseGetTag(value) { 30693 if (value == null) { 30694 return value === undefined ? undefinedTag : nullTag; 30695 } 30696 return (symToStringTag && symToStringTag in Object(value)) 30697 ? getRawTag(value) 30698 : objectToString(value); 30699 } 30700 30701 /** 30702 * The base implementation of `_.gt` which doesn't coerce arguments. 30703 * 30704 * @private 30705 * @param {*} value The value to compare. 30706 * @param {*} other The other value to compare. 30707 * @returns {boolean} Returns `true` if `value` is greater than `other`, 30708 * else `false`. 30709 */ 30710 function baseGt(value, other) { 30711 return value > other; 30712 } 30713 30714 /** 30715 * The base implementation of `_.has` without support for deep paths. 30716 * 30717 * @private 30718 * @param {Object} [object] The object to query. 30719 * @param {Array|string} key The key to check. 30720 * @returns {boolean} Returns `true` if `key` exists, else `false`. 30721 */ 30722 function baseHas(object, key) { 30723 return object != null && hasOwnProperty.call(object, key); 30724 } 30725 30726 /** 30727 * The base implementation of `_.hasIn` without support for deep paths. 30728 * 30729 * @private 30730 * @param {Object} [object] The object to query. 30731 * @param {Array|string} key The key to check. 30732 * @returns {boolean} Returns `true` if `key` exists, else `false`. 30733 */ 30734 function baseHasIn(object, key) { 30735 return object != null && key in Object(object); 30736 } 30737 30738 /** 30739 * The base implementation of `_.inRange` which doesn't coerce arguments. 30740 * 30741 * @private 30742 * @param {number} number The number to check. 30743 * @param {number} start The start of the range. 30744 * @param {number} end The end of the range. 30745 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 30746 */ 30747 function baseInRange(number, start, end) { 30748 return number >= nativeMin(start, end) && number < nativeMax(start, end); 30749 } 30750 30751 /** 30752 * The base implementation of methods like `_.intersection`, without support 30753 * for iteratee shorthands, that accepts an array of arrays to inspect. 30754 * 30755 * @private 30756 * @param {Array} arrays The arrays to inspect. 30757 * @param {Function} [iteratee] The iteratee invoked per element. 30758 * @param {Function} [comparator] The comparator invoked per element. 30759 * @returns {Array} Returns the new array of shared values. 30760 */ 30761 function baseIntersection(arrays, iteratee, comparator) { 30762 var includes = comparator ? arrayIncludesWith : arrayIncludes, 30763 length = arrays[0].length, 30764 othLength = arrays.length, 30765 othIndex = othLength, 30766 caches = Array(othLength), 30767 maxLength = Infinity, 30768 result = []; 30769 30770 while (othIndex--) { 30771 var array = arrays[othIndex]; 30772 if (othIndex && iteratee) { 30773 array = arrayMap(array, baseUnary(iteratee)); 30774 } 30775 maxLength = nativeMin(array.length, maxLength); 30776 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 30777 ? new SetCache(othIndex && array) 30778 : undefined; 30779 } 30780 array = arrays[0]; 30781 30782 var index = -1, 30783 seen = caches[0]; 30784 30785 outer: 30786 while (++index < length && result.length < maxLength) { 30787 var value = array[index], 30788 computed = iteratee ? iteratee(value) : value; 30789 30790 value = (comparator || value !== 0) ? value : 0; 30791 if (!(seen 30792 ? cacheHas(seen, computed) 30793 : includes(result, computed, comparator) 30794 )) { 30795 othIndex = othLength; 30796 while (--othIndex) { 30797 var cache = caches[othIndex]; 30798 if (!(cache 30799 ? cacheHas(cache, computed) 30800 : includes(arrays[othIndex], computed, comparator)) 30801 ) { 30802 continue outer; 30803 } 30804 } 30805 if (seen) { 30806 seen.push(computed); 30807 } 30808 result.push(value); 30809 } 30810 } 30811 return result; 30812 } 30813 30814 /** 30815 * The base implementation of `_.invert` and `_.invertBy` which inverts 30816 * `object` with values transformed by `iteratee` and set by `setter`. 30817 * 30818 * @private 30819 * @param {Object} object The object to iterate over. 30820 * @param {Function} setter The function to set `accumulator` values. 30821 * @param {Function} iteratee The iteratee to transform values. 30822 * @param {Object} accumulator The initial inverted object. 30823 * @returns {Function} Returns `accumulator`. 30824 */ 30825 function baseInverter(object, setter, iteratee, accumulator) { 30826 baseForOwn(object, function(value, key, object) { 30827 setter(accumulator, iteratee(value), key, object); 30828 }); 30829 return accumulator; 30830 } 30831 30832 /** 30833 * The base implementation of `_.invoke` without support for individual 30834 * method arguments. 30835 * 30836 * @private 30837 * @param {Object} object The object to query. 30838 * @param {Array|string} path The path of the method to invoke. 30839 * @param {Array} args The arguments to invoke the method with. 30840 * @returns {*} Returns the result of the invoked method. 30841 */ 30842 function baseInvoke(object, path, args) { 30843 path = castPath(path, object); 30844 object = parent(object, path); 30845 var func = object == null ? object : object[toKey(last(path))]; 30846 return func == null ? undefined : apply(func, object, args); 30847 } 30848 30849 /** 30850 * The base implementation of `_.isArguments`. 30851 * 30852 * @private 30853 * @param {*} value The value to check. 30854 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 30855 */ 30856 function baseIsArguments(value) { 30857 return isObjectLike(value) && baseGetTag(value) == argsTag; 30858 } 30859 30860 /** 30861 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 30862 * 30863 * @private 30864 * @param {*} value The value to check. 30865 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 30866 */ 30867 function baseIsArrayBuffer(value) { 30868 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 30869 } 30870 30871 /** 30872 * The base implementation of `_.isDate` without Node.js optimizations. 30873 * 30874 * @private 30875 * @param {*} value The value to check. 30876 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 30877 */ 30878 function baseIsDate(value) { 30879 return isObjectLike(value) && baseGetTag(value) == dateTag; 30880 } 30881 30882 /** 30883 * The base implementation of `_.isEqual` which supports partial comparisons 30884 * and tracks traversed objects. 30885 * 30886 * @private 30887 * @param {*} value The value to compare. 30888 * @param {*} other The other value to compare. 30889 * @param {boolean} bitmask The bitmask flags. 30890 * 1 - Unordered comparison 30891 * 2 - Partial comparison 30892 * @param {Function} [customizer] The function to customize comparisons. 30893 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 30894 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 30895 */ 30896 function baseIsEqual(value, other, bitmask, customizer, stack) { 30897 if (value === other) { 30898 return true; 30899 } 30900 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 30901 return value !== value && other !== other; 30902 } 30903 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 30904 } 30905 30906 /** 30907 * A specialized version of `baseIsEqual` for arrays and objects which performs 30908 * deep comparisons and tracks traversed objects enabling objects with circular 30909 * references to be compared. 30910 * 30911 * @private 30912 * @param {Object} object The object to compare. 30913 * @param {Object} other The other object to compare. 30914 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 30915 * @param {Function} customizer The function to customize comparisons. 30916 * @param {Function} equalFunc The function to determine equivalents of values. 30917 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 30918 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 30919 */ 30920 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 30921 var objIsArr = isArray(object), 30922 othIsArr = isArray(other), 30923 objTag = objIsArr ? arrayTag : getTag(object), 30924 othTag = othIsArr ? arrayTag : getTag(other); 30925 30926 objTag = objTag == argsTag ? objectTag : objTag; 30927 othTag = othTag == argsTag ? objectTag : othTag; 30928 30929 var objIsObj = objTag == objectTag, 30930 othIsObj = othTag == objectTag, 30931 isSameTag = objTag == othTag; 30932 30933 if (isSameTag && isBuffer(object)) { 30934 if (!isBuffer(other)) { 30935 return false; 30936 } 30937 objIsArr = true; 30938 objIsObj = false; 30939 } 30940 if (isSameTag && !objIsObj) { 30941 stack || (stack = new Stack); 30942 return (objIsArr || isTypedArray(object)) 30943 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 30944 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 30945 } 30946 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 30947 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 30948 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 30949 30950 if (objIsWrapped || othIsWrapped) { 30951 var objUnwrapped = objIsWrapped ? object.value() : object, 30952 othUnwrapped = othIsWrapped ? other.value() : other; 30953 30954 stack || (stack = new Stack); 30955 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 30956 } 30957 } 30958 if (!isSameTag) { 30959 return false; 30960 } 30961 stack || (stack = new Stack); 30962 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 30963 } 30964 30965 /** 30966 * The base implementation of `_.isMap` without Node.js optimizations. 30967 * 30968 * @private 30969 * @param {*} value The value to check. 30970 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 30971 */ 30972 function baseIsMap(value) { 30973 return isObjectLike(value) && getTag(value) == mapTag; 30974 } 30975 30976 /** 30977 * The base implementation of `_.isMatch` without support for iteratee shorthands. 30978 * 30979 * @private 30980 * @param {Object} object The object to inspect. 30981 * @param {Object} source The object of property values to match. 30982 * @param {Array} matchData The property names, values, and compare flags to match. 30983 * @param {Function} [customizer] The function to customize comparisons. 30984 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 30985 */ 30986 function baseIsMatch(object, source, matchData, customizer) { 30987 var index = matchData.length, 30988 length = index, 30989 noCustomizer = !customizer; 30990 30991 if (object == null) { 30992 return !length; 30993 } 30994 object = Object(object); 30995 while (index--) { 30996 var data = matchData[index]; 30997 if ((noCustomizer && data[2]) 30998 ? data[1] !== object[data[0]] 30999 : !(data[0] in object) 31000 ) { 31001 return false; 31002 } 31003 } 31004 while (++index < length) { 31005 data = matchData[index]; 31006 var key = data[0], 31007 objValue = object[key], 31008 srcValue = data[1]; 31009 31010 if (noCustomizer && data[2]) { 31011 if (objValue === undefined && !(key in object)) { 31012 return false; 31013 } 31014 } else { 31015 var stack = new Stack; 31016 if (customizer) { 31017 var result = customizer(objValue, srcValue, key, object, source, stack); 31018 } 31019 if (!(result === undefined 31020 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 31021 : result 31022 )) { 31023 return false; 31024 } 31025 } 31026 } 31027 return true; 31028 } 31029 31030 /** 31031 * The base implementation of `_.isNative` without bad shim checks. 31032 * 31033 * @private 31034 * @param {*} value The value to check. 31035 * @returns {boolean} Returns `true` if `value` is a native function, 31036 * else `false`. 31037 */ 31038 function baseIsNative(value) { 31039 if (!isObject(value) || isMasked(value)) { 31040 return false; 31041 } 31042 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 31043 return pattern.test(toSource(value)); 31044 } 31045 31046 /** 31047 * The base implementation of `_.isRegExp` without Node.js optimizations. 31048 * 31049 * @private 31050 * @param {*} value The value to check. 31051 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 31052 */ 31053 function baseIsRegExp(value) { 31054 return isObjectLike(value) && baseGetTag(value) == regexpTag; 31055 } 31056 31057 /** 31058 * The base implementation of `_.isSet` without Node.js optimizations. 31059 * 31060 * @private 31061 * @param {*} value The value to check. 31062 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 31063 */ 31064 function baseIsSet(value) { 31065 return isObjectLike(value) && getTag(value) == setTag; 31066 } 31067 31068 /** 31069 * The base implementation of `_.isTypedArray` without Node.js optimizations. 31070 * 31071 * @private 31072 * @param {*} value The value to check. 31073 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 31074 */ 31075 function baseIsTypedArray(value) { 31076 return isObjectLike(value) && 31077 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 31078 } 31079 31080 /** 31081 * The base implementation of `_.iteratee`. 31082 * 31083 * @private 31084 * @param {*} [value=_.identity] The value to convert to an iteratee. 31085 * @returns {Function} Returns the iteratee. 31086 */ 31087 function baseIteratee(value) { 31088 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 31089 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 31090 if (typeof value == 'function') { 31091 return value; 31092 } 31093 if (value == null) { 31094 return identity; 31095 } 31096 if (typeof value == 'object') { 31097 return isArray(value) 31098 ? baseMatchesProperty(value[0], value[1]) 31099 : baseMatches(value); 31100 } 31101 return property(value); 31102 } 31103 31104 /** 31105 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 31106 * 31107 * @private 31108 * @param {Object} object The object to query. 31109 * @returns {Array} Returns the array of property names. 31110 */ 31111 function baseKeys(object) { 31112 if (!isPrototype(object)) { 31113 return nativeKeys(object); 31114 } 31115 var result = []; 31116 for (var key in Object(object)) { 31117 if (hasOwnProperty.call(object, key) && key != 'constructor') { 31118 result.push(key); 31119 } 31120 } 31121 return result; 31122 } 31123 31124 /** 31125 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 31126 * 31127 * @private 31128 * @param {Object} object The object to query. 31129 * @returns {Array} Returns the array of property names. 31130 */ 31131 function baseKeysIn(object) { 31132 if (!isObject(object)) { 31133 return nativeKeysIn(object); 31134 } 31135 var isProto = isPrototype(object), 31136 result = []; 31137 31138 for (var key in object) { 31139 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 31140 result.push(key); 31141 } 31142 } 31143 return result; 31144 } 31145 31146 /** 31147 * The base implementation of `_.lt` which doesn't coerce arguments. 31148 * 31149 * @private 31150 * @param {*} value The value to compare. 31151 * @param {*} other The other value to compare. 31152 * @returns {boolean} Returns `true` if `value` is less than `other`, 31153 * else `false`. 31154 */ 31155 function baseLt(value, other) { 31156 return value < other; 31157 } 31158 31159 /** 31160 * The base implementation of `_.map` without support for iteratee shorthands. 31161 * 31162 * @private 31163 * @param {Array|Object} collection The collection to iterate over. 31164 * @param {Function} iteratee The function invoked per iteration. 31165 * @returns {Array} Returns the new mapped array. 31166 */ 31167 function baseMap(collection, iteratee) { 31168 var index = -1, 31169 result = isArrayLike(collection) ? Array(collection.length) : []; 31170 31171 baseEach(collection, function(value, key, collection) { 31172 result[++index] = iteratee(value, key, collection); 31173 }); 31174 return result; 31175 } 31176 31177 /** 31178 * The base implementation of `_.matches` which doesn't clone `source`. 31179 * 31180 * @private 31181 * @param {Object} source The object of property values to match. 31182 * @returns {Function} Returns the new spec function. 31183 */ 31184 function baseMatches(source) { 31185 var matchData = getMatchData(source); 31186 if (matchData.length == 1 && matchData[0][2]) { 31187 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 31188 } 31189 return function(object) { 31190 return object === source || baseIsMatch(object, source, matchData); 31191 }; 31192 } 31193 31194 /** 31195 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 31196 * 31197 * @private 31198 * @param {string} path The path of the property to get. 31199 * @param {*} srcValue The value to match. 31200 * @returns {Function} Returns the new spec function. 31201 */ 31202 function baseMatchesProperty(path, srcValue) { 31203 if (isKey(path) && isStrictComparable(srcValue)) { 31204 return matchesStrictComparable(toKey(path), srcValue); 31205 } 31206 return function(object) { 31207 var objValue = get(object, path); 31208 return (objValue === undefined && objValue === srcValue) 31209 ? hasIn(object, path) 31210 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 31211 }; 31212 } 31213 31214 /** 31215 * The base implementation of `_.merge` without support for multiple sources. 31216 * 31217 * @private 31218 * @param {Object} object The destination object. 31219 * @param {Object} source The source object. 31220 * @param {number} srcIndex The index of `source`. 31221 * @param {Function} [customizer] The function to customize merged values. 31222 * @param {Object} [stack] Tracks traversed source values and their merged 31223 * counterparts. 31224 */ 31225 function baseMerge(object, source, srcIndex, customizer, stack) { 31226 if (object === source) { 31227 return; 31228 } 31229 baseFor(source, function(srcValue, key) { 31230 if (isObject(srcValue)) { 31231 stack || (stack = new Stack); 31232 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 31233 } 31234 else { 31235 var newValue = customizer 31236 ? customizer(object[key], srcValue, (key + ''), object, source, stack) 31237 : undefined; 31238 31239 if (newValue === undefined) { 31240 newValue = srcValue; 31241 } 31242 assignMergeValue(object, key, newValue); 31243 } 31244 }, keysIn); 31245 } 31246 31247 /** 31248 * A specialized version of `baseMerge` for arrays and objects which performs 31249 * deep merges and tracks traversed objects enabling objects with circular 31250 * references to be merged. 31251 * 31252 * @private 31253 * @param {Object} object The destination object. 31254 * @param {Object} source The source object. 31255 * @param {string} key The key of the value to merge. 31256 * @param {number} srcIndex The index of `source`. 31257 * @param {Function} mergeFunc The function to merge values. 31258 * @param {Function} [customizer] The function to customize assigned values. 31259 * @param {Object} [stack] Tracks traversed source values and their merged 31260 * counterparts. 31261 */ 31262 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 31263 var objValue = object[key], 31264 srcValue = source[key], 31265 stacked = stack.get(srcValue); 31266 31267 if (stacked) { 31268 assignMergeValue(object, key, stacked); 31269 return; 31270 } 31271 var newValue = customizer 31272 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 31273 : undefined; 31274 31275 var isCommon = newValue === undefined; 31276 31277 if (isCommon) { 31278 var isArr = isArray(srcValue), 31279 isBuff = !isArr && isBuffer(srcValue), 31280 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 31281 31282 newValue = srcValue; 31283 if (isArr || isBuff || isTyped) { 31284 if (isArray(objValue)) { 31285 newValue = objValue; 31286 } 31287 else if (isArrayLikeObject(objValue)) { 31288 newValue = copyArray(objValue); 31289 } 31290 else if (isBuff) { 31291 isCommon = false;
vendor: 15,686 bytes, lines 31292-31770
31292 newValue = cloneBuffer(srcValue, true); 31293 } 31294 else if (isTyped) { 31295 isCommon = false; 31296 newValue = cloneTypedArray(srcValue, true); 31297 } 31298 else { 31299 newValue = []; 31300 } 31301 } 31302 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 31303 newValue = objValue; 31304 if (isArguments(objValue)) { 31305 newValue = toPlainObject(objValue); 31306 } 31307 else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { 31308 newValue = initCloneObject(srcValue); 31309 } 31310 } 31311 else { 31312 isCommon = false; 31313 } 31314 } 31315 if (isCommon) { 31316 // Recursively merge objects and arrays (susceptible to call stack limits). 31317 stack.set(srcValue, newValue); 31318 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 31319 stack['delete'](srcValue); 31320 } 31321 assignMergeValue(object, key, newValue); 31322 } 31323 31324 /** 31325 * The base implementation of `_.nth` which doesn't coerce arguments. 31326 * 31327 * @private 31328 * @param {Array} array The array to query. 31329 * @param {number} n The index of the element to return. 31330 * @returns {*} Returns the nth element of `array`. 31331 */ 31332 function baseNth(array, n) { 31333 var length = array.length; 31334 if (!length) { 31335 return; 31336 } 31337 n += n < 0 ? length : 0; 31338 return isIndex(n, length) ? array[n] : undefined; 31339 } 31340 31341 /** 31342 * The base implementation of `_.orderBy` without param guards. 31343 * 31344 * @private 31345 * @param {Array|Object} collection The collection to iterate over. 31346 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 31347 * @param {string[]} orders The sort orders of `iteratees`. 31348 * @returns {Array} Returns the new sorted array. 31349 */ 31350 function baseOrderBy(collection, iteratees, orders) { 31351 var index = -1; 31352 iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); 31353 31354 var result = baseMap(collection, function(value, key, collection) { 31355 var criteria = arrayMap(iteratees, function(iteratee) { 31356 return iteratee(value); 31357 }); 31358 return { 'criteria': criteria, 'index': ++index, 'value': value }; 31359 }); 31360 31361 return baseSortBy(result, function(object, other) { 31362 return compareMultiple(object, other, orders); 31363 }); 31364 } 31365 31366 /** 31367 * The base implementation of `_.pick` without support for individual 31368 * property identifiers. 31369 * 31370 * @private 31371 * @param {Object} object The source object. 31372 * @param {string[]} paths The property paths to pick. 31373 * @returns {Object} Returns the new object. 31374 */ 31375 function basePick(object, paths) { 31376 return basePickBy(object, paths, function(value, path) { 31377 return hasIn(object, path); 31378 }); 31379 } 31380 31381 /** 31382 * The base implementation of `_.pickBy` without support for iteratee shorthands. 31383 * 31384 * @private 31385 * @param {Object} object The source object. 31386 * @param {string[]} paths The property paths to pick. 31387 * @param {Function} predicate The function invoked per property. 31388 * @returns {Object} Returns the new object. 31389 */ 31390 function basePickBy(object, paths, predicate) { 31391 var index = -1, 31392 length = paths.length, 31393 result = {}; 31394 31395 while (++index < length) { 31396 var path = paths[index], 31397 value = baseGet(object, path); 31398 31399 if (predicate(value, path)) { 31400 baseSet(result, castPath(path, object), value); 31401 } 31402 } 31403 return result; 31404 } 31405 31406 /** 31407 * A specialized version of `baseProperty` which supports deep paths. 31408 * 31409 * @private 31410 * @param {Array|string} path The path of the property to get. 31411 * @returns {Function} Returns the new accessor function. 31412 */ 31413 function basePropertyDeep(path) { 31414 return function(object) { 31415 return baseGet(object, path); 31416 }; 31417 } 31418 31419 /** 31420 * The base implementation of `_.pullAllBy` without support for iteratee 31421 * shorthands. 31422 * 31423 * @private 31424 * @param {Array} array The array to modify. 31425 * @param {Array} values The values to remove. 31426 * @param {Function} [iteratee] The iteratee invoked per element. 31427 * @param {Function} [comparator] The comparator invoked per element. 31428 * @returns {Array} Returns `array`. 31429 */ 31430 function basePullAll(array, values, iteratee, comparator) { 31431 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 31432 index = -1, 31433 length = values.length, 31434 seen = array; 31435 31436 if (array === values) { 31437 values = copyArray(values); 31438 } 31439 if (iteratee) { 31440 seen = arrayMap(array, baseUnary(iteratee)); 31441 } 31442 while (++index < length) { 31443 var fromIndex = 0, 31444 value = values[index], 31445 computed = iteratee ? iteratee(value) : value; 31446 31447 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 31448 if (seen !== array) { 31449 splice.call(seen, fromIndex, 1); 31450 } 31451 splice.call(array, fromIndex, 1); 31452 } 31453 } 31454 return array; 31455 } 31456 31457 /** 31458 * The base implementation of `_.pullAt` without support for individual 31459 * indexes or capturing the removed elements. 31460 * 31461 * @private 31462 * @param {Array} array The array to modify. 31463 * @param {number[]} indexes The indexes of elements to remove. 31464 * @returns {Array} Returns `array`. 31465 */ 31466 function basePullAt(array, indexes) { 31467 var length = array ? indexes.length : 0, 31468 lastIndex = length - 1; 31469 31470 while (length--) { 31471 var index = indexes[length]; 31472 if (length == lastIndex || index !== previous) { 31473 var previous = index; 31474 if (isIndex(index)) { 31475 splice.call(array, index, 1); 31476 } else { 31477 baseUnset(array, index); 31478 } 31479 } 31480 } 31481 return array; 31482 } 31483 31484 /** 31485 * The base implementation of `_.random` without support for returning 31486 * floating-point numbers. 31487 * 31488 * @private 31489 * @param {number} lower The lower bound. 31490 * @param {number} upper The upper bound. 31491 * @returns {number} Returns the random number. 31492 */ 31493 function baseRandom(lower, upper) { 31494 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 31495 } 31496 31497 /** 31498 * The base implementation of `_.range` and `_.rangeRight` which doesn't 31499 * coerce arguments. 31500 * 31501 * @private 31502 * @param {number} start The start of the range. 31503 * @param {number} end The end of the range. 31504 * @param {number} step The value to increment or decrement by. 31505 * @param {boolean} [fromRight] Specify iterating from right to left. 31506 * @returns {Array} Returns the range of numbers. 31507 */ 31508 function baseRange(start, end, step, fromRight) { 31509 var index = -1, 31510 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 31511 result = Array(length); 31512 31513 while (length--) { 31514 result[fromRight ? length : ++index] = start; 31515 start += step; 31516 } 31517 return result; 31518 } 31519 31520 /** 31521 * The base implementation of `_.repeat` which doesn't coerce arguments. 31522 * 31523 * @private 31524 * @param {string} string The string to repeat. 31525 * @param {number} n The number of times to repeat the string. 31526 * @returns {string} Returns the repeated string. 31527 */ 31528 function baseRepeat(string, n) { 31529 var result = ''; 31530 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 31531 return result; 31532 } 31533 // Leverage the exponentiation by squaring algorithm for a faster repeat. 31534 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 31535 do { 31536 if (n % 2) { 31537 result += string; 31538 } 31539 n = nativeFloor(n / 2); 31540 if (n) { 31541 string += string; 31542 } 31543 } while (n); 31544 31545 return result; 31546 } 31547 31548 /** 31549 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 31550 * 31551 * @private 31552 * @param {Function} func The function to apply a rest parameter to. 31553 * @param {number} [start=func.length-1] The start position of the rest parameter. 31554 * @returns {Function} Returns the new function. 31555 */ 31556 function baseRest(func, start) { 31557 return setToString(overRest(func, start, identity), func + ''); 31558 } 31559 31560 /** 31561 * The base implementation of `_.sample`. 31562 * 31563 * @private 31564 * @param {Array|Object} collection The collection to sample. 31565 * @returns {*} Returns the random element. 31566 */ 31567 function baseSample(collection) { 31568 return arraySample(values(collection)); 31569 } 31570 31571 /** 31572 * The base implementation of `_.sampleSize` without param guards. 31573 * 31574 * @private 31575 * @param {Array|Object} collection The collection to sample. 31576 * @param {number} n The number of elements to sample. 31577 * @returns {Array} Returns the random elements. 31578 */ 31579 function baseSampleSize(collection, n) { 31580 var array = values(collection); 31581 return shuffleSelf(array, baseClamp(n, 0, array.length)); 31582 } 31583 31584 /** 31585 * The base implementation of `_.set`. 31586 * 31587 * @private 31588 * @param {Object} object The object to modify. 31589 * @param {Array|string} path The path of the property to set. 31590 * @param {*} value The value to set. 31591 * @param {Function} [customizer] The function to customize path creation. 31592 * @returns {Object} Returns `object`. 31593 */ 31594 function baseSet(object, path, value, customizer) { 31595 if (!isObject(object)) { 31596 return object; 31597 } 31598 path = castPath(path, object); 31599 31600 var index = -1, 31601 length = path.length, 31602 lastIndex = length - 1, 31603 nested = object; 31604 31605 while (nested != null && ++index < length) { 31606 var key = toKey(path[index]), 31607 newValue = value; 31608 31609 if (index != lastIndex) { 31610 var objValue = nested[key]; 31611 newValue = customizer ? customizer(objValue, key, nested) : undefined; 31612 if (newValue === undefined) { 31613 newValue = isObject(objValue) 31614 ? objValue 31615 : (isIndex(path[index + 1]) ? [] : {}); 31616 } 31617 } 31618 assignValue(nested, key, newValue); 31619 nested = nested[key]; 31620 } 31621 return object; 31622 } 31623 31624 /** 31625 * The base implementation of `setData` without support for hot loop shorting. 31626 * 31627 * @private 31628 * @param {Function} func The function to associate metadata with. 31629 * @param {*} data The metadata. 31630 * @returns {Function} Returns `func`. 31631 */ 31632 var baseSetData = !metaMap ? identity : function(func, data) { 31633 metaMap.set(func, data); 31634 return func; 31635 }; 31636 31637 /** 31638 * The base implementation of `setToString` without support for hot loop shorting. 31639 * 31640 * @private 31641 * @param {Function} func The function to modify. 31642 * @param {Function} string The `toString` result. 31643 * @returns {Function} Returns `func`. 31644 */ 31645 var baseSetToString = !defineProperty ? identity : function(func, string) { 31646 return defineProperty(func, 'toString', { 31647 'configurable': true, 31648 'enumerable': false, 31649 'value': constant(string), 31650 'writable': true 31651 }); 31652 }; 31653 31654 /** 31655 * The base implementation of `_.shuffle`. 31656 * 31657 * @private 31658 * @param {Array|Object} collection The collection to shuffle. 31659 * @returns {Array} Returns the new shuffled array. 31660 */ 31661 function baseShuffle(collection) { 31662 return shuffleSelf(values(collection)); 31663 } 31664 31665 /** 31666 * The base implementation of `_.slice` without an iteratee call guard. 31667 * 31668 * @private 31669 * @param {Array} array The array to slice. 31670 * @param {number} [start=0] The start position. 31671 * @param {number} [end=array.length] The end position. 31672 * @returns {Array} Returns the slice of `array`. 31673 */ 31674 function baseSlice(array, start, end) { 31675 var index = -1, 31676 length = array.length; 31677 31678 if (start < 0) { 31679 start = -start > length ? 0 : (length + start); 31680 } 31681 end = end > length ? length : end; 31682 if (end < 0) { 31683 end += length; 31684 } 31685 length = start > end ? 0 : ((end - start) >>> 0); 31686 start >>>= 0; 31687 31688 var result = Array(length); 31689 while (++index < length) { 31690 result[index] = array[index + start]; 31691 } 31692 return result; 31693 } 31694 31695 /** 31696 * The base implementation of `_.some` without support for iteratee shorthands. 31697 * 31698 * @private 31699 * @param {Array|Object} collection The collection to iterate over. 31700 * @param {Function} predicate The function invoked per iteration. 31701 * @returns {boolean} Returns `true` if any element passes the predicate check, 31702 * else `false`. 31703 */ 31704 function baseSome(collection, predicate) { 31705 var result; 31706 31707 baseEach(collection, function(value, index, collection) { 31708 result = predicate(value, index, collection); 31709 return !result; 31710 }); 31711 return !!result; 31712 } 31713 31714 /** 31715 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 31716 * performs a binary search of `array` to determine the index at which `value` 31717 * should be inserted into `array` in order to maintain its sort order. 31718 * 31719 * @private 31720 * @param {Array} array The sorted array to inspect. 31721 * @param {*} value The value to evaluate. 31722 * @param {boolean} [retHighest] Specify returning the highest qualified index. 31723 * @returns {number} Returns the index at which `value` should be inserted 31724 * into `array`. 31725 */ 31726 function baseSortedIndex(array, value, retHighest) { 31727 var low = 0, 31728 high = array == null ? low : array.length; 31729 31730 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 31731 while (low < high) { 31732 var mid = (low + high) >>> 1, 31733 computed = array[mid]; 31734 31735 if (computed !== null && !isSymbol(computed) && 31736 (retHighest ? (computed <= value) : (computed < value))) { 31737 low = mid + 1; 31738 } else { 31739 high = mid; 31740 } 31741 } 31742 return high; 31743 } 31744 return baseSortedIndexBy(array, value, identity, retHighest); 31745 } 31746 31747 /** 31748 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 31749 * which invokes `iteratee` for `value` and each element of `array` to compute 31750 * their sort ranking. The iteratee is invoked with one argument; (value). 31751 * 31752 * @private 31753 * @param {Array} array The sorted array to inspect. 31754 * @param {*} value The value to evaluate. 31755 * @param {Function} iteratee The iteratee invoked per element. 31756 * @param {boolean} [retHighest] Specify returning the highest qualified index. 31757 * @returns {number} Returns the index at which `value` should be inserted 31758 * into `array`. 31759 */ 31760 function baseSortedIndexBy(array, value, iteratee, retHighest) { 31761 value = iteratee(value); 31762 31763 var low = 0, 31764 high = array == null ? 0 : array.length, 31765 valIsNaN = value !== value, 31766 valIsNull = value === null, 31767 valIsSymbol = isSymbol(value), 31768 valIsUndefined = value === undefined; 31769 31770 while (low < high) {
31771 var mid = nativeFloor((low + high) / 2), 31772 computed = iteratee(array[mid]), 31773 othIsDefined = computed !== undefined
vendor: 9,364 bytes, lines 31773-32048
31773, 31774 othIsNull = computed === null, 31775 othIsReflexive = computed === computed, 31776 othIsSymbol = isSymbol(computed); 31777 31778 if (valIsNaN) { 31779 var setLow = retHighest || othIsReflexive; 31780 } else if (valIsUndefined) { 31781 setLow = othIsReflexive && (retHighest || othIsDefined); 31782 } else if (valIsNull) { 31783 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 31784 } else if (valIsSymbol) { 31785 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 31786 } else if (othIsNull || othIsSymbol) { 31787 setLow = false; 31788 } else { 31789 setLow = retHighest ? (computed <= value) : (computed < value); 31790 } 31791 if (setLow) { 31792 low = mid + 1; 31793 } else { 31794 high = mid; 31795 } 31796 } 31797 return nativeMin(high, MAX_ARRAY_INDEX); 31798 } 31799 31800 /** 31801 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 31802 * support for iteratee shorthands. 31803 * 31804 * @private 31805 * @param {Array} array The array to inspect. 31806 * @param {Function} [iteratee] The iteratee invoked per element. 31807 * @returns {Array} Returns the new duplicate free array. 31808 */ 31809 function baseSortedUniq(array, iteratee) { 31810 var index = -1, 31811 length = array.length, 31812 resIndex = 0, 31813 result = []; 31814 31815 while (++index < length) { 31816 var value = array[index], 31817 computed = iteratee ? iteratee(value) : value; 31818 31819 if (!index || !eq(computed, seen)) { 31820 var seen = computed; 31821 result[resIndex++] = value === 0 ? 0 : value; 31822 } 31823 } 31824 return result; 31825 } 31826 31827 /** 31828 * The base implementation of `_.toNumber` which doesn't ensure correct 31829 * conversions of binary, hexadecimal, or octal string values. 31830 * 31831 * @private 31832 * @param {*} value The value to process. 31833 * @returns {number} Returns the number. 31834 */ 31835 function baseToNumber(value) { 31836 if (typeof value == 'number') { 31837 return value; 31838 } 31839 if (isSymbol(value)) { 31840 return NAN; 31841 } 31842 return +value; 31843 } 31844 31845 /** 31846 * The base implementation of `_.toString` which doesn't convert nullish 31847 * values to empty strings. 31848 * 31849 * @private 31850 * @param {*} value The value to process. 31851 * @returns {string} Returns the string. 31852 */ 31853 function baseToString(value) { 31854 // Exit early for strings to avoid a performance hit in some environments. 31855 if (typeof value == 'string') { 31856 return value; 31857 } 31858 if (isArray(value)) { 31859 // Recursively convert values (susceptible to call stack limits). 31860 return arrayMap(value, baseToString) + ''; 31861 } 31862 if (isSymbol(value)) { 31863 return symbolToString ? symbolToString.call(value) : ''; 31864 } 31865 var result = (value + ''); 31866 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 31867 } 31868 31869 /** 31870 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 31871 * 31872 * @private 31873 * @param {Array} array The array to inspect. 31874 * @param {Function} [iteratee] The iteratee invoked per element. 31875 * @param {Function} [comparator] The comparator invoked per element. 31876 * @returns {Array} Returns the new duplicate free array. 31877 */ 31878 function baseUniq(array, iteratee, comparator) { 31879 var index = -1, 31880 includes = arrayIncludes, 31881 length = array.length, 31882 isCommon = true, 31883 result = [], 31884 seen = result; 31885 31886 if (comparator) { 31887 isCommon = false; 31888 includes = arrayIncludesWith; 31889 } 31890 else if (length >= LARGE_ARRAY_SIZE) { 31891 var set = iteratee ? null : createSet(array); 31892 if (set) { 31893 return setToArray(set); 31894 } 31895 isCommon = false; 31896 includes = cacheHas; 31897 seen = new SetCache; 31898 } 31899 else { 31900 seen = iteratee ? [] : result; 31901 } 31902 outer: 31903 while (++index < length) { 31904 var value = array[index], 31905 computed = iteratee ? iteratee(value) : value; 31906 31907 value = (comparator || value !== 0) ? value : 0; 31908 if (isCommon && computed === computed) { 31909 var seenIndex = seen.length; 31910 while (seenIndex--) { 31911 if (seen[seenIndex] === computed) { 31912 continue outer; 31913 } 31914 } 31915 if (iteratee) { 31916 seen.push(computed); 31917 } 31918 result.push(value); 31919 } 31920 else if (!includes(seen, computed, comparator)) { 31921 if (seen !== result) { 31922 seen.push(computed); 31923 } 31924 result.push(value); 31925 } 31926 } 31927 return result; 31928 } 31929 31930 /** 31931 * The base implementation of `_.unset`. 31932 * 31933 * @private 31934 * @param {Object} object The object to modify. 31935 * @param {Array|string} path The property path to unset. 31936 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 31937 */ 31938 function baseUnset(object, path) { 31939 path = castPath(path, object); 31940 object = parent(object, path); 31941 return object == null || delete object[toKey(last(path))]; 31942 } 31943 31944 /** 31945 * The base implementation of `_.update`. 31946 * 31947 * @private 31948 * @param {Object} object The object to modify. 31949 * @param {Array|string} path The path of the property to update. 31950 * @param {Function} updater The function to produce the updated value. 31951 * @param {Function} [customizer] The function to customize path creation. 31952 * @returns {Object} Returns `object`. 31953 */ 31954 function baseUpdate(object, path, updater, customizer) { 31955 return baseSet(object, path, updater(baseGet(object, path)), customizer); 31956 } 31957 31958 /** 31959 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 31960 * without support for iteratee shorthands. 31961 * 31962 * @private 31963 * @param {Array} array The array to query. 31964 * @param {Function} predicate The function invoked per iteration. 31965 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 31966 * @param {boolean} [fromRight] Specify iterating from right to left. 31967 * @returns {Array} Returns the slice of `array`. 31968 */ 31969 function baseWhile(array, predicate, isDrop, fromRight) { 31970 var length = array.length, 31971 index = fromRight ? length : -1; 31972 31973 while ((fromRight ? index-- : ++index < length) && 31974 predicate(array[index], index, array)) {} 31975 31976 return isDrop 31977 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 31978 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 31979 } 31980 31981 /** 31982 * The base implementation of `wrapperValue` which returns the result of 31983 * performing a sequence of actions on the unwrapped `value`, where each 31984 * successive action is supplied the return value of the previous. 31985 * 31986 * @private 31987 * @param {*} value The unwrapped value. 31988 * @param {Array} actions Actions to perform to resolve the unwrapped value. 31989 * @returns {*} Returns the resolved value. 31990 */ 31991 function baseWrapperValue(value, actions) { 31992 var result = value; 31993 if (result instanceof LazyWrapper) { 31994 result = result.value(); 31995 } 31996 return arrayReduce(actions, function(result, action) { 31997 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 31998 }, result); 31999 } 32000 32001 /** 32002 * The base implementation of methods like `_.xor`, without support for 32003 * iteratee shorthands, that accepts an array of arrays to inspect. 32004 * 32005 * @private 32006 * @param {Array} arrays The arrays to inspect. 32007 * @param {Function} [iteratee] The iteratee invoked per element. 32008 * @param {Function} [comparator] The comparator invoked per element. 32009 * @returns {Array} Returns the new array of values. 32010 */ 32011 function baseXor(arrays, iteratee, comparator) { 32012 var length = arrays.length; 32013 if (length < 2) { 32014 return length ? baseUniq(arrays[0]) : []; 32015 } 32016 var index = -1, 32017 result = Array(length); 32018 32019 while (++index < length) { 32020 var array = arrays[index], 32021 othIndex = -1; 32022 32023 while (++othIndex < length) { 32024 if (othIndex != index) { 32025 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 32026 } 32027 } 32028 } 32029 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 32030 } 32031 32032 /** 32033 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 32034 * 32035 * @private 32036 * @param {Array} props The property identifiers. 32037 * @param {Array} values The property values. 32038 * @param {Function} assignFunc The function to assign values. 32039 * @returns {Object} Returns the new object. 32040 */ 32041 function baseZipObject(props, values, assignFunc) { 32042 var index = -1, 32043 length = props.length, 32044 valsLength = values.length, 32045 result = {}; 32046 32047 while (++index < length) { 32048 var value = index < valsLength ? values[index] : undefined
vendor: 4,097 bytes, lines 32048-32180
32048; 32049 assignFunc(result, props[index], value); 32050 } 32051 return result; 32052 } 32053 32054 /** 32055 * Casts `value` to an empty array if it's not an array like object. 32056 * 32057 * @private 32058 * @param {*} value The value to inspect. 32059 * @returns {Array|Object} Returns the cast array-like object. 32060 */ 32061 function castArrayLikeObject(value) { 32062 return isArrayLikeObject(value) ? value : []; 32063 } 32064 32065 /** 32066 * Casts `value` to `identity` if it's not a function. 32067 * 32068 * @private 32069 * @param {*} value The value to inspect. 32070 * @returns {Function} Returns cast function. 32071 */ 32072 function castFunction(value) { 32073 return typeof value == 'function' ? value : identity; 32074 } 32075 32076 /** 32077 * Casts `value` to a path array if it's not one. 32078 * 32079 * @private 32080 * @param {*} value The value to inspect. 32081 * @param {Object} [object] The object to query keys on. 32082 * @returns {Array} Returns the cast property path array. 32083 */ 32084 function castPath(value, object) { 32085 if (isArray(value)) { 32086 return value; 32087 } 32088 return isKey(value, object) ? [value] : stringToPath(toString(value)); 32089 } 32090 32091 /** 32092 * A `baseRest` alias which can be replaced with `identity` by module 32093 * replacement plugins. 32094 * 32095 * @private 32096 * @type {Function} 32097 * @param {Function} func The function to apply a rest parameter to. 32098 * @returns {Function} Returns the new function. 32099 */ 32100 var castRest = baseRest; 32101 32102 /** 32103 * Casts `array` to a slice if it's needed. 32104 * 32105 * @private 32106 * @param {Array} array The array to inspect. 32107 * @param {number} start The start position. 32108 * @param {number} [end=array.length] The end position. 32109 * @returns {Array} Returns the cast slice. 32110 */ 32111 function castSlice(array, start, end) { 32112 var length = array.length; 32113 end = end === undefined ? length : end; 32114 return (!start && end >= length) ? array : baseSlice(array, start, end); 32115 } 32116 32117 /** 32118 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 32119 * 32120 * @private 32121 * @param {number|Object} id The timer id or timeout object of the timer to clear. 32122 */ 32123 var clearTimeout = ctxClearTimeout || function(id) { 32124 return root.clearTimeout(id); 32125 }; 32126 32127 /** 32128 * Creates a clone of `buffer`. 32129 * 32130 * @private 32131 * @param {Buffer} buffer The buffer to clone. 32132 * @param {boolean} [isDeep] Specify a deep clone. 32133 * @returns {Buffer} Returns the cloned buffer. 32134 */ 32135 function cloneBuffer(buffer, isDeep) { 32136 if (isDeep) { 32137 return buffer.slice(); 32138 } 32139 var length = buffer.length, 32140 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 32141 32142 buffer.copy(result); 32143 return result; 32144 } 32145 32146 /** 32147 * Creates a clone of `arrayBuffer`. 32148 * 32149 * @private 32150 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 32151 * @returns {ArrayBuffer} Returns the cloned array buffer. 32152 */ 32153 function cloneArrayBuffer(arrayBuffer) { 32154 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 32155 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 32156 return result; 32157 } 32158 32159 /** 32160 * Creates a clone of `dataView`. 32161 * 32162 * @private 32163 * @param {Object} dataView The data view to clone. 32164 * @param {boolean} [isDeep] Specify a deep clone. 32165 * @returns {Object} Returns the cloned data view. 32166 */ 32167 function cloneDataView(dataView, isDeep) { 32168 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 32169 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 32170 } 32171 32172 /** 32173 * Creates a clone of `map`. 32174 * 32175 * @private 32176 * @param {Object} map The map to clone. 32177 * @param {Function} cloneFunc The function to clone values. 32178 * @param {boolean} [isDeep] Specify a deep clone. 32179 * @returns {Object} Returns the cloned map. 32180 */
vendor: 4,873 bytes, lines 32181-32310
32181 function cloneMap(map, isDeep, cloneFunc) { 32182 var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); 32183 return arrayReduce(array, addMapEntry, new map.constructor); 32184 } 32185 32186 /** 32187 * Creates a clone of `regexp`. 32188 * 32189 * @private 32190 * @param {Object} regexp The regexp to clone. 32191 * @returns {Object} Returns the cloned regexp. 32192 */ 32193 function cloneRegExp(regexp) { 32194 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 32195 result.lastIndex = regexp.lastIndex; 32196 return result; 32197 } 32198 32199 /** 32200 * Creates a clone of `set`. 32201 * 32202 * @private 32203 * @param {Object} set The set to clone. 32204 * @param {Function} cloneFunc The function to clone values. 32205 * @param {boolean} [isDeep] Specify a deep clone. 32206 * @returns {Object} Returns the cloned set. 32207 */ 32208 function cloneSet(set, isDeep, cloneFunc) { 32209 var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); 32210 return arrayReduce(array, addSetEntry, new set.constructor); 32211 } 32212 32213 /** 32214 * Creates a clone of the `symbol` object. 32215 * 32216 * @private 32217 * @param {Object} symbol The symbol object to clone. 32218 * @returns {Object} Returns the cloned symbol object. 32219 */ 32220 function cloneSymbol(symbol) { 32221 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 32222 } 32223 32224 /** 32225 * Creates a clone of `typedArray`. 32226 * 32227 * @private 32228 * @param {Object} typedArray The typed array to clone. 32229 * @param {boolean} [isDeep] Specify a deep clone. 32230 * @returns {Object} Returns the cloned typed array. 32231 */ 32232 function cloneTypedArray(typedArray, isDeep) { 32233 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 32234 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 32235 } 32236 32237 /** 32238 * Compares values to sort them in ascending order. 32239 * 32240 * @private 32241 * @param {*} value The value to compare. 32242 * @param {*} other The other value to compare. 32243 * @returns {number} Returns the sort order indicator for `value`. 32244 */ 32245 function compareAscending(value, other) { 32246 if (value !== other) { 32247 var valIsDefined = value !== undefined, 32248 valIsNull = value === null, 32249 valIsReflexive = value === value, 32250 valIsSymbol = isSymbol(value); 32251 32252 var othIsDefined = other !== undefined, 32253 othIsNull = other === null, 32254 othIsReflexive = other === other, 32255 othIsSymbol = isSymbol(other); 32256 32257 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 32258 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 32259 (valIsNull && othIsDefined && othIsReflexive) || 32260 (!valIsDefined && othIsReflexive) || 32261 !valIsReflexive) { 32262 return 1; 32263 } 32264 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 32265 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 32266 (othIsNull && valIsDefined && valIsReflexive) || 32267 (!othIsDefined && valIsReflexive) || 32268 !othIsReflexive) { 32269 return -1; 32270 } 32271 } 32272 return 0; 32273 } 32274 32275 /** 32276 * Used by `_.orderBy` to compare multiple properties of a value to another 32277 * and stable sort them. 32278 * 32279 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 32280 * specify an order of "desc" for descending or "asc" for ascending sort order 32281 * of corresponding values. 32282 * 32283 * @private 32284 * @param {Object} object The object to compare. 32285 * @param {Object} other The other object to compare. 32286 * @param {boolean[]|string[]} orders The order to sort by for each property. 32287 * @returns {number} Returns the sort order indicator for `object`. 32288 */ 32289 function compareMultiple(object, other, orders) { 32290 var index = -1, 32291 objCriteria = object.criteria, 32292 othCriteria = other.criteria, 32293 length = objCriteria.length, 32294 ordersLength = orders.length; 32295 32296 while (++index < length) { 32297 var result = compareAscending(objCriteria[index], othCriteria[index]); 32298 if (result) { 32299 if (index >= ordersLength) { 32300 return result; 32301 } 32302 var order = orders[index]; 32303 return result * (order == 'desc' ? -1 : 1); 32304 } 32305 } 32306 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 32307 // that causes it, under certain circumstances, to provide the same value for 32308 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 32309 // for more details. 32310 //
vendor: 21,984 bytes, lines 32311-32937
32311 // This also ensures a stable sort in V8 and other engines. 32312 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 32313 return object.index - other.index; 32314 } 32315 32316 /** 32317 * Creates an array that is the composition of partially applied arguments, 32318 * placeholders, and provided arguments into a single array of arguments. 32319 * 32320 * @private 32321 * @param {Array} args The provided arguments. 32322 * @param {Array} partials The arguments to prepend to those provided. 32323 * @param {Array} holders The `partials` placeholder indexes. 32324 * @params {boolean} [isCurried] Specify composing for a curried function. 32325 * @returns {Array} Returns the new array of composed arguments. 32326 */ 32327 function composeArgs(args, partials, holders, isCurried) { 32328 var argsIndex = -1, 32329 argsLength = args.length, 32330 holdersLength = holders.length, 32331 leftIndex = -1, 32332 leftLength = partials.length, 32333 rangeLength = nativeMax(argsLength - holdersLength, 0), 32334 result = Array(leftLength + rangeLength), 32335 isUncurried = !isCurried; 32336 32337 while (++leftIndex < leftLength) { 32338 result[leftIndex] = partials[leftIndex]; 32339 } 32340 while (++argsIndex < holdersLength) { 32341 if (isUncurried || argsIndex < argsLength) { 32342 result[holders[argsIndex]] = args[argsIndex]; 32343 } 32344 } 32345 while (rangeLength--) { 32346 result[leftIndex++] = args[argsIndex++]; 32347 } 32348 return result; 32349 } 32350 32351 /** 32352 * This function is like `composeArgs` except that the arguments composition 32353 * is tailored for `_.partialRight`. 32354 * 32355 * @private 32356 * @param {Array} args The provided arguments. 32357 * @param {Array} partials The arguments to append to those provided. 32358 * @param {Array} holders The `partials` placeholder indexes. 32359 * @params {boolean} [isCurried] Specify composing for a curried function. 32360 * @returns {Array} Returns the new array of composed arguments. 32361 */ 32362 function composeArgsRight(args, partials, holders, isCurried) { 32363 var argsIndex = -1, 32364 argsLength = args.length, 32365 holdersIndex = -1, 32366 holdersLength = holders.length, 32367 rightIndex = -1, 32368 rightLength = partials.length, 32369 rangeLength = nativeMax(argsLength - holdersLength, 0), 32370 result = Array(rangeLength + rightLength), 32371 isUncurried = !isCurried; 32372 32373 while (++argsIndex < rangeLength) { 32374 result[argsIndex] = args[argsIndex]; 32375 } 32376 var offset = argsIndex; 32377 while (++rightIndex < rightLength) { 32378 result[offset + rightIndex] = partials[rightIndex]; 32379 } 32380 while (++holdersIndex < holdersLength) { 32381 if (isUncurried || argsIndex < argsLength) { 32382 result[offset + holders[holdersIndex]] = args[argsIndex++]; 32383 } 32384 } 32385 return result; 32386 } 32387 32388 /** 32389 * Copies the values of `source` to `array`. 32390 * 32391 * @private 32392 * @param {Array} source The array to copy values from. 32393 * @param {Array} [array=[]] The array to copy values to. 32394 * @returns {Array} Returns `array`. 32395 */ 32396 function copyArray(source, array) { 32397 var index = -1, 32398 length = source.length; 32399 32400 array || (array = Array(length)); 32401 while (++index < length) { 32402 array[index] = source[index]; 32403 } 32404 return array; 32405 } 32406 32407 /** 32408 * Copies properties of `source` to `object`. 32409 * 32410 * @private 32411 * @param {Object} source The object to copy properties from. 32412 * @param {Array} props The property identifiers to copy. 32413 * @param {Object} [object={}] The object to copy properties to. 32414 * @param {Function} [customizer] The function to customize copied values. 32415 * @returns {Object} Returns `object`. 32416 */ 32417 function copyObject(source, props, object, customizer) { 32418 var isNew = !object; 32419 object || (object = {}); 32420 32421 var index = -1, 32422 length = props.length; 32423 32424 while (++index < length) { 32425 var key = props[index]; 32426 32427 var newValue = customizer 32428 ? customizer(object[key], source[key], key, object, source) 32429 : undefined; 32430 32431 if (newValue === undefined) { 32432 newValue = source[key]; 32433 } 32434 if (isNew) { 32435 baseAssignValue(object, key, newValue); 32436 } else { 32437 assignValue(object, key, newValue); 32438 } 32439 } 32440 return object; 32441 } 32442 32443 /** 32444 * Copies own symbols of `source` to `object`. 32445 * 32446 * @private 32447 * @param {Object} source The object to copy symbols from. 32448 * @param {Object} [object={}] The object to copy symbols to. 32449 * @returns {Object} Returns `object`. 32450 */ 32451 function copySymbols(source, object) { 32452 return copyObject(source, getSymbols(source), object); 32453 } 32454 32455 /** 32456 * Copies own and inherited symbols of `source` to `object`. 32457 * 32458 * @private 32459 * @param {Object} source The object to copy symbols from. 32460 * @param {Object} [object={}] The object to copy symbols to. 32461 * @returns {Object} Returns `object`. 32462 */ 32463 function copySymbolsIn(source, object) { 32464 return copyObject(source, getSymbolsIn(source), object); 32465 } 32466 32467 /** 32468 * Creates a function like `_.groupBy`. 32469 * 32470 * @private 32471 * @param {Function} setter The function to set accumulator values. 32472 * @param {Function} [initializer] The accumulator object initializer. 32473 * @returns {Function} Returns the new aggregator function. 32474 */ 32475 function createAggregator(setter, initializer) { 32476 return function(collection, iteratee) { 32477 var func = isArray(collection) ? arrayAggregator : baseAggregator, 32478 accumulator = initializer ? initializer() : {}; 32479 32480 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 32481 }; 32482 } 32483 32484 /** 32485 * Creates a function like `_.assign`. 32486 * 32487 * @private 32488 * @param {Function} assigner The function to assign values. 32489 * @returns {Function} Returns the new assigner function. 32490 */ 32491 function createAssigner(assigner) { 32492 return baseRest(function(object, sources) { 32493 var index = -1, 32494 length = sources.length, 32495 customizer = length > 1 ? sources[length - 1] : undefined, 32496 guard = length > 2 ? sources[2] : undefined; 32497 32498 customizer = (assigner.length > 3 && typeof customizer == 'function') 32499 ? (length--, customizer) 32500 : undefined; 32501 32502 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 32503 customizer = length < 3 ? undefined : customizer; 32504 length = 1; 32505 } 32506 object = Object(object); 32507 while (++index < length) { 32508 var source = sources[index]; 32509 if (source) { 32510 assigner(object, source, index, customizer); 32511 } 32512 } 32513 return object; 32514 }); 32515 } 32516 32517 /** 32518 * Creates a `baseEach` or `baseEachRight` function. 32519 * 32520 * @private 32521 * @param {Function} eachFunc The function to iterate over a collection. 32522 * @param {boolean} [fromRight] Specify iterating from right to left. 32523 * @returns {Function} Returns the new base function. 32524 */ 32525 function createBaseEach(eachFunc, fromRight) { 32526 return function(collection, iteratee) { 32527 if (collection == null) { 32528 return collection; 32529 } 32530 if (!isArrayLike(collection)) { 32531 return eachFunc(collection, iteratee); 32532 } 32533 var length = collection.length, 32534 index = fromRight ? length : -1, 32535 iterable = Object(collection); 32536 32537 while ((fromRight ? index-- : ++index < length)) { 32538 if (iteratee(iterable[index], index, iterable) === false) { 32539 break; 32540 } 32541 } 32542 return collection; 32543 }; 32544 } 32545 32546 /** 32547 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 32548 * 32549 * @private 32550 * @param {boolean} [fromRight] Specify iterating from right to left. 32551 * @returns {Function} Returns the new base function. 32552 */ 32553 function createBaseFor(fromRight) { 32554 return function(object, iteratee, keysFunc) { 32555 var index = -1, 32556 iterable = Object(object), 32557 props = keysFunc(object), 32558 length = props.length; 32559 32560 while (length--) { 32561 var key = props[fromRight ? length : ++index]; 32562 if (iteratee(iterable[key], key, iterable) === false) { 32563 break; 32564 } 32565 } 32566 return object; 32567 }; 32568 } 32569 32570 /** 32571 * Creates a function that wraps `func` to invoke it with the optional `this` 32572 * binding of `thisArg`. 32573 * 32574 * @private 32575 * @param {Function} func The function to wrap. 32576 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 32577 * @param {*} [thisArg] The `this` binding of `func`. 32578 * @returns {Function} Returns the new wrapped function. 32579 */ 32580 function createBind(func, bitmask, thisArg) { 32581 var isBind = bitmask & WRAP_BIND_FLAG, 32582 Ctor = createCtor(func); 32583 32584 function wrapper() { 32585 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 32586 return fn.apply(isBind ? thisArg : this, arguments); 32587 } 32588 return wrapper; 32589 } 32590 32591 /** 32592 * Creates a function like `_.lowerFirst`. 32593 * 32594 * @private 32595 * @param {string} methodName The name of the `String` case method to use. 32596 * @returns {Function} Returns the new case function. 32597 */ 32598 function createCaseFirst(methodName) { 32599 return function(string) { 32600 string = toString(string); 32601 32602 var strSymbols = hasUnicode(string) 32603 ? stringToArray(string) 32604 : undefined; 32605 32606 var chr = strSymbols 32607 ? strSymbols[0] 32608 : string.charAt(0); 32609 32610 var trailing = strSymbols 32611 ? castSlice(strSymbols, 1).join('') 32612 : string.slice(1); 32613 32614 return chr[methodName]() + trailing; 32615 }; 32616 } 32617 32618 /** 32619 * Creates a function like `_.camelCase`. 32620 * 32621 * @private 32622 * @param {Function} callback The function to combine each word. 32623 * @returns {Function} Returns the new compounder function. 32624 */ 32625 function createCompounder(callback) { 32626 return function(string) { 32627 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 32628 }; 32629 } 32630 32631 /** 32632 * Creates a function that produces an instance of `Ctor` regardless of 32633 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 32634 * 32635 * @private 32636 * @param {Function} Ctor The constructor to wrap. 32637 * @returns {Function} Returns the new wrapped function. 32638 */ 32639 function createCtor(Ctor) { 32640 return function() { 32641 // Use a `switch` statement to work with class constructors. See 32642 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 32643 // for more details. 32644 var args = arguments; 32645 switch (args.length) { 32646 case 0: return new Ctor; 32647 case 1: return new Ctor(args[0]); 32648 case 2: return new Ctor(args[0], args[1]); 32649 case 3: return new Ctor(args[0], args[1], args[2]); 32650 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 32651 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 32652 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 32653 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 32654 } 32655 var thisBinding = baseCreate(Ctor.prototype), 32656 result = Ctor.apply(thisBinding, args); 32657 32658 // Mimic the constructor's `return` behavior. 32659 // See https://es5.github.io/#x13.2.2 for more details. 32660 return isObject(result) ? result : thisBinding; 32661 }; 32662 } 32663 32664 /** 32665 * Creates a function that wraps `func` to enable currying. 32666 * 32667 * @private 32668 * @param {Function} func The function to wrap. 32669 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 32670 * @param {number} arity The arity of `func`. 32671 * @returns {Function} Returns the new wrapped function. 32672 */ 32673 function createCurry(func, bitmask, arity) { 32674 var Ctor = createCtor(func); 32675 32676 function wrapper() { 32677 var length = arguments.length, 32678 args = Array(length), 32679 index = length, 32680 placeholder = getHolder(wrapper); 32681 32682 while (index--) { 32683 args[index] = arguments[index]; 32684 } 32685 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 32686 ? [] 32687 : replaceHolders(args, placeholder); 32688 32689 length -= holders.length; 32690 if (length < arity) { 32691 return createRecurry( 32692 func, bitmask, createHybrid, wrapper.placeholder, undefined, 32693 args, holders, undefined, undefined, arity - length); 32694 } 32695 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 32696 return apply(fn, this, args); 32697 } 32698 return wrapper; 32699 } 32700 32701 /** 32702 * Creates a `_.find` or `_.findLast` function. 32703 * 32704 * @private 32705 * @param {Function} findIndexFunc The function to find the collection index. 32706 * @returns {Function} Returns the new find function. 32707 */ 32708 function createFind(findIndexFunc) { 32709 return function(collection, predicate, fromIndex) { 32710 var iterable = Object(collection); 32711 if (!isArrayLike(collection)) { 32712 var iteratee = getIteratee(predicate, 3); 32713 collection = keys(collection); 32714 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 32715 } 32716 var index = findIndexFunc(collection, predicate, fromIndex); 32717 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 32718 }; 32719 } 32720 32721 /** 32722 * Creates a `_.flow` or `_.flowRight` function. 32723 * 32724 * @private 32725 * @param {boolean} [fromRight] Specify iterating from right to left. 32726 * @returns {Function} Returns the new flow function. 32727 */ 32728 function createFlow(fromRight) { 32729 return flatRest(function(funcs) { 32730 var length = funcs.length, 32731 index = length, 32732 prereq = LodashWrapper.prototype.thru; 32733 32734 if (fromRight) { 32735 funcs.reverse(); 32736 } 32737 while (index--) { 32738 var func = funcs[index]; 32739 if (typeof func != 'function') { 32740 throw new TypeError(FUNC_ERROR_TEXT); 32741 } 32742 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 32743 var wrapper = new LodashWrapper([], true); 32744 } 32745 } 32746 index = wrapper ? index : length; 32747 while (++index < length) { 32748 func = funcs[index]; 32749 32750 var funcName = getFuncName(func), 32751 data = funcName == 'wrapper' ? getData(func) : undefined; 32752 32753 if (data && isLaziable(data[0]) && 32754 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 32755 !data[4].length && data[9] == 1 32756 ) { 32757 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 32758 } else { 32759 wrapper = (func.length == 1 && isLaziable(func)) 32760 ? wrapper[funcName]() 32761 : wrapper.thru(func); 32762 } 32763 } 32764 return function() { 32765 var args = arguments, 32766 value = args[0]; 32767 32768 if (wrapper && args.length == 1 && isArray(value)) { 32769 return wrapper.plant(value).value(); 32770 } 32771 var index = 0, 32772 result = length ? funcs[index].apply(this, args) : value; 32773 32774 while (++index < length) { 32775 result = funcs[index].call(this, result); 32776 } 32777 return result; 32778 }; 32779 }); 32780 } 32781 32782 /** 32783 * Creates a function that wraps `func` to invoke it with optional `this` 32784 * binding of `thisArg`, partial application, and currying. 32785 * 32786 * @private 32787 * @param {Function|string} func The function or method name to wrap. 32788 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 32789 * @param {*} [thisArg] The `this` binding of `func`. 32790 * @param {Array} [partials] The arguments to prepend to those provided to 32791 * the new function. 32792 * @param {Array} [holders] The `partials` placeholder indexes. 32793 * @param {Array} [partialsRight] The arguments to append to those provided 32794 * to the new function. 32795 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 32796 * @param {Array} [argPos] The argument positions of the new function. 32797 * @param {number} [ary] The arity cap of `func`. 32798 * @param {number} [arity] The arity of `func`. 32799 * @returns {Function} Returns the new wrapped function. 32800 */ 32801 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 32802 var isAry = bitmask & WRAP_ARY_FLAG, 32803 isBind = bitmask & WRAP_BIND_FLAG, 32804 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 32805 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 32806 isFlip = bitmask & WRAP_FLIP_FLAG, 32807 Ctor = isBindKey ? undefined : createCtor(func); 32808 32809 function wrapper() { 32810 var length = arguments.length, 32811 args = Array(length), 32812 index = length; 32813 32814 while (index--) { 32815 args[index] = arguments[index]; 32816 } 32817 if (isCurried) { 32818 var placeholder = getHolder(wrapper), 32819 holdersCount = countHolders(args, placeholder); 32820 } 32821 if (partials) { 32822 args = composeArgs(args, partials, holders, isCurried); 32823 } 32824 if (partialsRight) { 32825 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 32826 } 32827 length -= holdersCount; 32828 if (isCurried && length < arity) { 32829 var newHolders = replaceHolders(args, placeholder); 32830 return createRecurry( 32831 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 32832 args, newHolders, argPos, ary, arity - length 32833 ); 32834 } 32835 var thisBinding = isBind ? thisArg : this, 32836 fn = isBindKey ? thisBinding[func] : func; 32837 32838 length = args.length; 32839 if (argPos) { 32840 args = reorder(args, argPos); 32841 } else if (isFlip && length > 1) { 32842 args.reverse(); 32843 } 32844 if (isAry && ary < length) { 32845 args.length = ary; 32846 } 32847 if (this && this !== root && this instanceof wrapper) { 32848 fn = Ctor || createCtor(fn); 32849 } 32850 return fn.apply(thisBinding, args); 32851 } 32852 return wrapper; 32853 } 32854 32855 /** 32856 * Creates a function like `_.invertBy`. 32857 * 32858 * @private 32859 * @param {Function} setter The function to set accumulator values. 32860 * @param {Function} toIteratee The function to resolve iteratees. 32861 * @returns {Function} Returns the new inverter function. 32862 */ 32863 function createInverter(setter, toIteratee) { 32864 return function(object, iteratee) { 32865 return baseInverter(object, setter, toIteratee(iteratee), {}); 32866 }; 32867 } 32868 32869 /** 32870 * Creates a function that performs a mathematical operation on two values. 32871 * 32872 * @private 32873 * @param {Function} operator The function to perform the operation. 32874 * @param {number} [defaultValue] The value used for `undefined` arguments. 32875 * @returns {Function} Returns the new mathematical operation function. 32876 */ 32877 function createMathOperation(operator, defaultValue) { 32878 return function(value, other) { 32879 var result; 32880 if (value === undefined && other === undefined) { 32881 return defaultValue; 32882 } 32883 if (value !== undefined) { 32884 result = value; 32885 } 32886 if (other !== undefined) { 32887 if (result === undefined) { 32888 return other; 32889 } 32890 if (typeof value == 'string' || typeof other == 'string') { 32891 value = baseToString(value); 32892 other = baseToString(other); 32893 } else { 32894 value = baseToNumber(value); 32895 other = baseToNumber(other); 32896 } 32897 result = operator(value, other); 32898 } 32899 return result; 32900 }; 32901 } 32902 32903 /** 32904 * Creates a function like `_.over`. 32905 * 32906 * @private 32907 * @param {Function} arrayFunc The function to iterate over iteratees. 32908 * @returns {Function} Returns the new over function. 32909 */ 32910 function createOver(arrayFunc) { 32911 return flatRest(function(iteratees) { 32912 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 32913 return baseRest(function(args) { 32914 var thisArg = this; 32915 return arrayFunc(iteratees, function(iteratee) { 32916 return apply(iteratee, thisArg, args); 32917 }); 32918 }); 32919 }); 32920 } 32921 32922 /** 32923 * Creates the padding for `string` based on `length`. The `chars` string 32924 * is truncated if the number of characters exceeds `length`. 32925 * 32926 * @private 32927 * @param {number} length The padding length. 32928 * @param {string} [chars=' '] The string used as padding. 32929 * @returns {string} Returns the padding for `string`. 32930 */ 32931 function createPadding(length, chars) { 32932 chars = chars === undefined ? ' ' : baseToString(chars); 32933 32934 var charsLength = chars.length; 32935 if (charsLength < 2) { 32936 return charsLength ? baseRepeat(chars, length) : chars; 32937 }
vendor: 6,933 bytes, lines 32938-33125
32938 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 32939 return hasUnicode(chars) 32940 ? castSlice(stringToArray(result), 0, length).join('') 32941 : result.slice(0, length); 32942 } 32943 32944 /** 32945 * Creates a function that wraps `func` to invoke it with the `this` binding 32946 * of `thisArg` and `partials` prepended to the arguments it receives. 32947 * 32948 * @private 32949 * @param {Function} func The function to wrap. 32950 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 32951 * @param {*} thisArg The `this` binding of `func`. 32952 * @param {Array} partials The arguments to prepend to those provided to 32953 * the new function. 32954 * @returns {Function} Returns the new wrapped function. 32955 */ 32956 function createPartial(func, bitmask, thisArg, partials) { 32957 var isBind = bitmask & WRAP_BIND_FLAG, 32958 Ctor = createCtor(func); 32959 32960 function wrapper() { 32961 var argsIndex = -1, 32962 argsLength = arguments.length, 32963 leftIndex = -1, 32964 leftLength = partials.length, 32965 args = Array(leftLength + argsLength), 32966 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 32967 32968 while (++leftIndex < leftLength) { 32969 args[leftIndex] = partials[leftIndex]; 32970 } 32971 while (argsLength--) { 32972 args[leftIndex++] = arguments[++argsIndex]; 32973 } 32974 return apply(fn, isBind ? thisArg : this, args); 32975 } 32976 return wrapper; 32977 } 32978 32979 /** 32980 * Creates a `_.range` or `_.rangeRight` function. 32981 * 32982 * @private 32983 * @param {boolean} [fromRight] Specify iterating from right to left. 32984 * @returns {Function} Returns the new range function. 32985 */ 32986 function createRange(fromRight) { 32987 return function(start, end, step) { 32988 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 32989 end = step = undefined; 32990 } 32991 // Ensure the sign of `-0` is preserved. 32992 start = toFinite(start); 32993 if (end === undefined) { 32994 end = start; 32995 start = 0; 32996 } else { 32997 end = toFinite(end); 32998 } 32999 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 33000 return baseRange(start, end, step, fromRight); 33001 }; 33002 } 33003 33004 /** 33005 * Creates a function that performs a relational operation on two values. 33006 * 33007 * @private 33008 * @param {Function} operator The function to perform the operation. 33009 * @returns {Function} Returns the new relational operation function. 33010 */ 33011 function createRelationalOperation(operator) { 33012 return function(value, other) { 33013 if (!(typeof value == 'string' && typeof other == 'string')) { 33014 value = toNumber(value); 33015 other = toNumber(other); 33016 } 33017 return operator(value, other); 33018 }; 33019 } 33020 33021 /** 33022 * Creates a function that wraps `func` to continue currying. 33023 * 33024 * @private 33025 * @param {Function} func The function to wrap. 33026 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 33027 * @param {Function} wrapFunc The function to create the `func` wrapper. 33028 * @param {*} placeholder The placeholder value. 33029 * @param {*} [thisArg] The `this` binding of `func`. 33030 * @param {Array} [partials] The arguments to prepend to those provided to 33031 * the new function. 33032 * @param {Array} [holders] The `partials` placeholder indexes. 33033 * @param {Array} [argPos] The argument positions of the new function. 33034 * @param {number} [ary] The arity cap of `func`. 33035 * @param {number} [arity] The arity of `func`. 33036 * @returns {Function} Returns the new wrapped function. 33037 */ 33038 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 33039 var isCurry = bitmask & WRAP_CURRY_FLAG, 33040 newHolders = isCurry ? holders : undefined, 33041 newHoldersRight = isCurry ? undefined : holders, 33042 newPartials = isCurry ? partials : undefined, 33043 newPartialsRight = isCurry ? undefined : partials; 33044 33045 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 33046 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 33047 33048 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 33049 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 33050 } 33051 var newData = [ 33052 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 33053 newHoldersRight, argPos, ary, arity 33054 ]; 33055 33056 var result = wrapFunc.apply(undefined, newData); 33057 if (isLaziable(func)) { 33058 setData(result, newData); 33059 } 33060 result.placeholder = placeholder; 33061 return setWrapToString(result, func, bitmask); 33062 } 33063 33064 /** 33065 * Creates a function like `_.round`. 33066 * 33067 * @private 33068 * @param {string} methodName The name of the `Math` method to use when rounding. 33069 * @returns {Function} Returns the new round function. 33070 */ 33071 function createRound(methodName) { 33072 var func = Math[methodName]; 33073 return function(number, precision) { 33074 number = toNumber(number); 33075 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 33076 if (precision) { 33077 // Shift with exponential notation to avoid floating-point issues. 33078 // See [MDN](https://mdn.io/round#Examples) for more details. 33079 var pair = (toString(number) + 'e').split('e'), 33080 value = func(pair[0] + 'e' + (+pair[1] + precision)); 33081 33082 pair = (toString(value) + 'e').split('e'); 33083 return +(pair[0] + 'e' + (+pair[1] - precision)); 33084 } 33085 return func(number); 33086 }; 33087 } 33088 33089 /** 33090 * Creates a set object of `values`. 33091 * 33092 * @private 33093 * @param {Array} values The values to add to the set. 33094 * @returns {Object} Returns the new set. 33095 */ 33096 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 33097 return new Set(values); 33098 }; 33099 33100 /** 33101 * Creates a `_.toPairs` or `_.toPairsIn` function. 33102 * 33103 * @private 33104 * @param {Function} keysFunc The function to get the keys of a given object. 33105 * @returns {Function} Returns the new pairs function. 33106 */ 33107 function createToPairs(keysFunc) { 33108 return function(object) { 33109 var tag = getTag(object); 33110 if (tag == mapTag) { 33111 return mapToArray(object); 33112 } 33113 if (tag == setTag) { 33114 return setToPairs(object); 33115 } 33116 return baseToPairs(object, keysFunc(object)); 33117 }; 33118 } 33119 33120 /** 33121 * Creates a function that either curries or invokes `func` with optional 33122 * `this` binding and partially applied arguments. 33123 * 33124 * @private 33125 * @param {Function|string}
33125 func The function or method name to wrap. 33126 * @param {number} bitmask The bitmask flags. 33127 * 1 - `_.bind` 33128 * 2 - `_.bindKey` 33129 * 4 - `_.curry` or `_.curryRight` of a bound function 33130 * 8 - `_.curry` 33131 * 16 - `_.curryRight` 33132 * 32 - `_.partial` 33133 * 64 - `_.partialRight` 33134 * 128 - `_.rearg` 33135 * 256 - `_.ary` 33136 * 512 - `_.flip` 33137 * @param {*} [thisArg] The `this` binding of `func`. 33138 * @param {Array} [partials] The arguments to be partially applied. 33139 * @param {Array} [holders] The `partials` placeholder indexes. 33140 * @param {Array} [argPos] The argument positions of the new function. 33141 * @param {number} [ary] The arity cap of `func`. 33142 * @param {number} [arity] The arity of `func`. 33143 * @returns {Function} Returns the new wrapped function. 33144 */ 33145 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 33146 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 33147 if (!isBindKey && typeof func != 'function') { 33148 throw new TypeError(FUNC_ERROR_TEXT); 33149 } 33150 var length = partials ? partials.length : 0; 33151 if (!length) { 33152 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 33153 partials = holders = undefined; 33154 } 33155 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 33156 arity = arity === undefined ? arity : toInteger(arity); 33157 length -= holders ? holders.length : 0; 33158 33159 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 33160 var partialsRight = partials, 33161 holdersRight = holders; 33162 33163 partials = holders = undefined; 33164 } 33165 var data = isBindKey ? undefined : getData(func); 33166 33167 var newData = [ 33168 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 33169 argPos, ary, arity 33170 ]; 33171 33172 if (data) { 33173 mergeData(newData, data); 33174 } 33175 func = newData[0]; 33176 bitmask = newData[1]; 33177 thisArg = newData[2]; 33178 partials = newData[3]; 33179 holders = newData[4]; 33180 arity = newData[9] = newData[9] === undefined 33181 ? (isBindKey ? 0 : func.length) 33182 : nativeMax(newData[9] - length, 0); 33183 33184 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 33185 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 33186 } 33187 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 33188 var result = createBind(func, bitmask, thisArg); 33189 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 33190 result = createCurry(func, bitmask, arity); 33191 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 33192 result = createPartial(func, bitmask, thisArg, partials); 33193 } else { 33194 result = createHybrid.apply(undefined, newData); 33195 } 33196 var setter = data ? baseSetData : setData; 33197 return setWrapToString(setter(result, newData), func, bitmask); 33198 } 33199 33200 /** 33201 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 33202 * of source objects to the destination object for all destination properties 33203 * that resolve to `undefined`. 33204 * 33205 * @private 33206 * @param {*} objValue The destination value. 33207 * @param {*} srcValue The source value. 33208 * @param {string} key The key of the property to assign. 33209 * @param {Object} object The parent object of `objValue`. 33210 * @returns {*} Returns the value to assign. 33211 */ 33212 function customDefaultsAssignIn(objValue, srcValue, key, object) { 33213 if (objValue === undefined || 33214 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 33215 return srcValue; 33216 } 33217 return objValue; 33218 } 33219 33220 /** 33221 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 33222 * objects into destination objects that are passed thru. 33223 * 33224 * @private 33225 * @param {*} objValue The destination value. 33226 * @param {*} srcValue The source value. 33227 * @param {string} key The key of the property to merge. 33228 * @param {Object} object The parent object of `objValue`. 33229 * @param {Object} source The parent object of `srcValue`. 33230 * @param {Object} [stack] Tracks traversed source values and their merged 33231 * counterparts. 33232 * @returns {*} Returns the value to assign. 33233 */ 33234 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 33235 if (isObject(objValue) && isObject(srcValue)) { 33236 // Recursively merge objects and arrays (susceptible to call stack limits). 33237 stack.set(srcValue, objValue); 33238 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 33239 stack['delete'](srcValue); 33240 } 33241 return objValue; 33242 } 33243 33244 /** 33245 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 33246 * objects. 33247 * 33248 * @private 33249 * @param {*} value The value to inspect. 33250 * @param {string} key The key of the property to inspect. 33251 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 33252 */ 33253 function customOmitClone(value) { 33254 return isPlainObject(value) ? undefined : value; 33255 } 33256 33257 /** 33258 * A specialized version of `baseIsEqualDeep` for arrays with support for 33259 * partial deep comparisons. 33260 * 33261 * @private 33262 * @param {Array} array The array to compare. 33263 * @param {Array} other The other array to compare. 33264 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 33265 * @param {Function} customizer The function to customize comparisons. 33266 * @param {Function} equalFunc The function to determine equivalents of values. 33267 * @param {Object} stack Tracks traversed `array` and `other` objects. 33268 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 33269 */ 33270 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 33271 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 33272 arrLength = array.length, 33273 othLength = other.length; 33274 33275 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 33276 return false;
33277 } 33278 // Assume cyclic values are equal. 33279 var stacked = stack.get(array); 33280 if (stacked && stack.get(other)) { 33281 return stacked == other; 33282 } 33283 var index = -1, 33284 result = true, 33285 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 33286 33287 stack.set(array, other); 33288 stack.set(other, array); 33289 33290 // Ignore non-index properties. 33291 while (++index < arrLength) { 33292 var arrValue = array[index], 33293 othValue = other[index]; 33294 33295 if (customizer) { 33296 var compared = isPartial 33297 ? customizer(othValue, arrValue, index, other, array, stack) 33298 : customizer(arrValue, othValue, index, array, other, stack); 33299 } 33300 if (compared !== undefined
vendor: 5,309 bytes, lines 33300-33443
33300) { 33301 if (compared) { 33302 continue; 33303 } 33304 result = false; 33305 break; 33306 } 33307 // Recursively compare arrays (susceptible to call stack limits). 33308 if (seen) { 33309 if (!arraySome(other, function(othValue, othIndex) { 33310 if (!cacheHas(seen, othIndex) && 33311 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 33312 return seen.push(othIndex); 33313 } 33314 })) { 33315 result = false; 33316 break; 33317 } 33318 } else if (!( 33319 arrValue === othValue || 33320 equalFunc(arrValue, othValue, bitmask, customizer, stack) 33321 )) { 33322 result = false; 33323 break; 33324 } 33325 } 33326 stack['delete'](array); 33327 stack['delete'](other); 33328 return result; 33329 } 33330 33331 /** 33332 * A specialized version of `baseIsEqualDeep` for comparing objects of 33333 * the same `toStringTag`. 33334 * 33335 * **Note:** This function only supports comparing values with tags of 33336 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 33337 * 33338 * @private 33339 * @param {Object} object The object to compare. 33340 * @param {Object} other The other object to compare. 33341 * @param {string} tag The `toStringTag` of the objects to compare. 33342 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 33343 * @param {Function} customizer The function to customize comparisons. 33344 * @param {Function} equalFunc The function to determine equivalents of values. 33345 * @param {Object} stack Tracks traversed `object` and `other` objects. 33346 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 33347 */ 33348 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 33349 switch (tag) { 33350 case dataViewTag: 33351 if ((object.byteLength != other.byteLength) || 33352 (object.byteOffset != other.byteOffset)) { 33353 return false; 33354 } 33355 object = object.buffer; 33356 other = other.buffer; 33357 33358 case arrayBufferTag: 33359 if ((object.byteLength != other.byteLength) || 33360 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 33361 return false; 33362 } 33363 return true; 33364 33365 case boolTag: 33366 case dateTag: 33367 case numberTag: 33368 // Coerce booleans to `1` or `0` and dates to milliseconds. 33369 // Invalid dates are coerced to `NaN`. 33370 return eq(+object, +other); 33371 33372 case errorTag: 33373 return object.name == other.name && object.message == other.message; 33374 33375 case regexpTag: 33376 case stringTag: 33377 // Coerce regexes to strings and treat strings, primitives and objects, 33378 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 33379 // for more details. 33380 return object == (other + ''); 33381 33382 case mapTag: 33383 var convert = mapToArray; 33384 33385 case setTag: 33386 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 33387 convert || (convert = setToArray); 33388 33389 if (object.size != other.size && !isPartial) { 33390 return false; 33391 } 33392 // Assume cyclic values are equal. 33393 var stacked = stack.get(object); 33394 if (stacked) { 33395 return stacked == other; 33396 } 33397 bitmask |= COMPARE_UNORDERED_FLAG; 33398 33399 // Recursively compare objects (susceptible to call stack limits). 33400 stack.set(object, other); 33401 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 33402 stack['delete'](object); 33403 return result; 33404 33405 case symbolTag: 33406 if (symbolValueOf) { 33407 return symbolValueOf.call(object) == symbolValueOf.call(other); 33408 } 33409 } 33410 return false; 33411 } 33412 33413 /** 33414 * A specialized version of `baseIsEqualDeep` for objects with support for 33415 * partial deep comparisons. 33416 * 33417 * @private 33418 * @param {Object} object The object to compare. 33419 * @param {Object} other The other object to compare. 33420 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 33421 * @param {Function} customizer The function to customize comparisons. 33422 * @param {Function} equalFunc The function to determine equivalents of values. 33423 * @param {Object} stack Tracks traversed `object` and `other` objects. 33424 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 33425 */ 33426 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 33427 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 33428 objProps = getAllKeys(object), 33429 objLength = objProps.length, 33430 othProps = getAllKeys(other), 33431 othLength = othProps.length; 33432 33433 if (objLength != othLength && !isPartial) { 33434 return false; 33435 } 33436 var index = objLength; 33437 while (index--) { 33438 var key = objProps[index]; 33439 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 33440 return false; 33441 } 33442 } 33443 //
33443Assume cyclic values are equal. 33444 var stacked = stack.get(object); 33445 if (stacked && stack.get(other)) { 33446 return stacked == other; 33447 } 33448 var result = true; 33449 stack.set(object, other); 33450 stack.set(other, object); 33451 33452 var skipCtor = isPartial; 33453 while (++index < objLength) { 33454 key = objProps[index]; 33455 var objValue = object[key], 33456 othValue = other[key]; 33457 33458 if (customizer) { 33459 var compared = isPartial 33460 ? customizer(othValue, objValue, key, other, object, stack) 33461 : customizer(objValue, othValue, key, object, other, stack); 33462 } 33463 // Recursively compare objects (susceptible to call stack limits). 33464 if (!(compared === undefined 33465 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 33466 : compared 33467 )) { 33468 result = false;
vendor: 7,647 bytes, lines 33469-33711
33469 break; 33470 } 33471 skipCtor || (skipCtor = key == 'constructor'); 33472 } 33473 if (result && !skipCtor) { 33474 var objCtor = object.constructor, 33475 othCtor = other.constructor; 33476 33477 // Non `Object` object instances with different constructors are not equal. 33478 if (objCtor != othCtor && 33479 ('constructor' in object && 'constructor' in other) && 33480 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 33481 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 33482 result = false; 33483 } 33484 } 33485 stack['delete'](object); 33486 stack['delete'](other); 33487 return result; 33488 } 33489 33490 /** 33491 * A specialized version of `baseRest` which flattens the rest array. 33492 * 33493 * @private 33494 * @param {Function} func The function to apply a rest parameter to. 33495 * @returns {Function} Returns the new function. 33496 */ 33497 function flatRest(func) { 33498 return setToString(overRest(func, undefined, flatten), func + ''); 33499 } 33500 33501 /** 33502 * Creates an array of own enumerable property names and symbols of `object`. 33503 * 33504 * @private 33505 * @param {Object} object The object to query. 33506 * @returns {Array} Returns the array of property names and symbols. 33507 */ 33508 function getAllKeys(object) { 33509 return baseGetAllKeys(object, keys, getSymbols); 33510 } 33511 33512 /** 33513 * Creates an array of own and inherited enumerable property names and 33514 * symbols of `object`. 33515 * 33516 * @private 33517 * @param {Object} object The object to query. 33518 * @returns {Array} Returns the array of property names and symbols. 33519 */ 33520 function getAllKeysIn(object) { 33521 return baseGetAllKeys(object, keysIn, getSymbolsIn); 33522 } 33523 33524 /** 33525 * Gets metadata for `func`. 33526 * 33527 * @private 33528 * @param {Function} func The function to query. 33529 * @returns {*} Returns the metadata for `func`. 33530 */ 33531 var getData = !metaMap ? noop : function(func) { 33532 return metaMap.get(func); 33533 }; 33534 33535 /** 33536 * Gets the name of `func`. 33537 * 33538 * @private 33539 * @param {Function} func The function to query. 33540 * @returns {string} Returns the function name. 33541 */ 33542 function getFuncName(func) { 33543 var result = (func.name + ''), 33544 array = realNames[result], 33545 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 33546 33547 while (length--) { 33548 var data = array[length], 33549 otherFunc = data.func; 33550 if (otherFunc == null || otherFunc == func) { 33551 return data.name; 33552 } 33553 } 33554 return result; 33555 } 33556 33557 /** 33558 * Gets the argument placeholder value for `func`. 33559 * 33560 * @private 33561 * @param {Function} func The function to inspect. 33562 * @returns {*} Returns the placeholder value. 33563 */ 33564 function getHolder(func) { 33565 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 33566 return object.placeholder; 33567 } 33568 33569 /** 33570 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 33571 * this function returns the custom method, otherwise it returns `baseIteratee`. 33572 * If arguments are provided, the chosen function is invoked with them and 33573 * its result is returned. 33574 * 33575 * @private 33576 * @param {*} [value] The value to convert to an iteratee. 33577 * @param {number} [arity] The arity of the created iteratee. 33578 * @returns {Function} Returns the chosen function or its result. 33579 */ 33580 function getIteratee() { 33581 var result = lodash.iteratee || iteratee; 33582 result = result === iteratee ? baseIteratee : result; 33583 return arguments.length ? result(arguments[0], arguments[1]) : result; 33584 } 33585 33586 /** 33587 * Gets the data for `map`. 33588 * 33589 * @private 33590 * @param {Object} map The map to query. 33591 * @param {string} key The reference key. 33592 * @returns {*} Returns the map data. 33593 */ 33594 function getMapData(map, key) { 33595 var data = map.__data__; 33596 return isKeyable(key) 33597 ? data[typeof key == 'string' ? 'string' : 'hash'] 33598 : data.map; 33599 } 33600 33601 /** 33602 * Gets the property names, values, and compare flags of `object`. 33603 * 33604 * @private 33605 * @param {Object} object The object to query. 33606 * @returns {Array} Returns the match data of `object`. 33607 */ 33608 function getMatchData(object) { 33609 var result = keys(object), 33610 length = result.length; 33611 33612 while (length--) { 33613 var key = result[length], 33614 value = object[key]; 33615 33616 result[length] = [key, value, isStrictComparable(value)]; 33617 } 33618 return result; 33619 } 33620 33621 /** 33622 * Gets the native function at `key` of `object`. 33623 * 33624 * @private 33625 * @param {Object} object The object to query. 33626 * @param {string} key The key of the method to get. 33627 * @returns {*} Returns the function if it's native, else `undefined`. 33628 */ 33629 function getNative(object, key) { 33630 var value = getValue(object, key); 33631 return baseIsNative(value) ? value : undefined; 33632 } 33633 33634 /** 33635 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 33636 * 33637 * @private 33638 * @param {*} value The value to query. 33639 * @returns {string} Returns the raw `toStringTag`. 33640 */ 33641 function getRawTag(value) { 33642 var isOwn = hasOwnProperty.call(value, symToStringTag), 33643 tag = value[symToStringTag]; 33644 33645 try { 33646 value[symToStringTag] = undefined; 33647 var unmasked = true; 33648 } catch (e) {} 33649 33650 var result = nativeObjectToString.call(value); 33651 if (unmasked) { 33652 if (isOwn) { 33653 value[symToStringTag] = tag; 33654 } else { 33655 delete value[symToStringTag]; 33656 } 33657 } 33658 return result; 33659 } 33660 33661 /** 33662 * Creates an array of the own enumerable symbols of `object`. 33663 * 33664 * @private 33665 * @param {Object} object The object to query. 33666 * @returns {Array} Returns the array of symbols. 33667 */ 33668 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 33669 if (object == null) { 33670 return []; 33671 } 33672 object = Object(object); 33673 return arrayFilter(nativeGetSymbols(object), function(symbol) { 33674 return propertyIsEnumerable.call(object, symbol); 33675 }); 33676 }; 33677 33678 /** 33679 * Creates an array of the own and inherited enumerable symbols of `object`. 33680 * 33681 * @private 33682 * @param {Object} object The object to query. 33683 * @returns {Array} Returns the array of symbols. 33684 */ 33685 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 33686 var result = []; 33687 while (object) { 33688 arrayPush(result, getSymbols(object)); 33689 object = getPrototype(object); 33690 } 33691 return result; 33692 }; 33693 33694 /** 33695 * Gets the `toStringTag` of `value`. 33696 * 33697 * @private 33698 * @param {*} value The value to query. 33699 * @returns {string} Returns the `toStringTag`. 33700 */ 33701 var getTag = baseGetTag; 33702 33703 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 33704 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 33705 (Map && getTag(new Map) != mapTag) || 33706 (Promise && getTag(Promise.resolve()) != promiseTag) || 33707 (Set && getTag(new Set) != setTag) || 33708 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 33709 getTag = function(value) { 33710 var result = baseGetTag(value), 33711 Ctor = result == objectTag ? value.constructor : undefined
vendor: 3,047 bytes, lines 33711-33807
33711, 33712 ctorString = Ctor ? toSource(Ctor) : ''; 33713 33714 if (ctorString) { 33715 switch (ctorString) { 33716 case dataViewCtorString: return dataViewTag; 33717 case mapCtorString: return mapTag; 33718 case promiseCtorString: return promiseTag; 33719 case setCtorString: return setTag; 33720 case weakMapCtorString: return weakMapTag; 33721 } 33722 } 33723 return result; 33724 }; 33725 } 33726 33727 /** 33728 * Gets the view, applying any `transforms` to the `start` and `end` positions. 33729 * 33730 * @private 33731 * @param {number} start The start of the view. 33732 * @param {number} end The end of the view. 33733 * @param {Array} transforms The transformations to apply to the view. 33734 * @returns {Object} Returns an object containing the `start` and `end` 33735 * positions of the view. 33736 */ 33737 function getView(start, end, transforms) { 33738 var index = -1, 33739 length = transforms.length; 33740 33741 while (++index < length) { 33742 var data = transforms[index], 33743 size = data.size; 33744 33745 switch (data.type) { 33746 case 'drop': start += size; break; 33747 case 'dropRight': end -= size; break; 33748 case 'take': end = nativeMin(end, start + size); break; 33749 case 'takeRight': start = nativeMax(start, end - size); break; 33750 } 33751 } 33752 return { 'start': start, 'end': end }; 33753 } 33754 33755 /** 33756 * Extracts wrapper details from the `source` body comment. 33757 * 33758 * @private 33759 * @param {string} source The source to inspect. 33760 * @returns {Array} Returns the wrapper details. 33761 */ 33762 function getWrapDetails(source) { 33763 var match = source.match(reWrapDetails); 33764 return match ? match[1].split(reSplitDetails) : []; 33765 } 33766 33767 /** 33768 * Checks if `path` exists on `object`. 33769 * 33770 * @private 33771 * @param {Object} object The object to query. 33772 * @param {Array|string} path The path to check. 33773 * @param {Function} hasFunc The function to check properties. 33774 * @returns {boolean} Returns `true` if `path` exists, else `false`. 33775 */ 33776 function hasPath(object, path, hasFunc) { 33777 path = castPath(path, object); 33778 33779 var index = -1, 33780 length = path.length, 33781 result = false; 33782 33783 while (++index < length) { 33784 var key = toKey(path[index]); 33785 if (!(result = object != null && hasFunc(object, key))) { 33786 break; 33787 } 33788 object = object[key]; 33789 } 33790 if (result || ++index != length) { 33791 return result; 33792 } 33793 length = object == null ? 0 : object.length; 33794 return !!length && isLength(length) && isIndex(key, length) && 33795 (isArray(object) || isArguments(object)); 33796 } 33797 33798 /** 33799 * Initializes an array clone. 33800 * 33801 * @private 33802 * @param {Array} array The array to clone. 33803 * @returns {Array} Returns the initialized clone. 33804 */ 33805 function initCloneArray(array) { 33806 var length = array.length, 33807 result =
vendor: 4,389 bytes, lines 33807-33937
33807array.constructor(length); 33808 33809 // Add properties assigned by `RegExp#exec`. 33810 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 33811 result.index = array.index; 33812 result.input = array.input; 33813 } 33814 return result; 33815 } 33816 33817 /** 33818 * Initializes an object clone. 33819 * 33820 * @private 33821 * @param {Object} object The object to clone. 33822 * @returns {Object} Returns the initialized clone. 33823 */ 33824 function initCloneObject(object) { 33825 return (typeof object.constructor == 'function' && !isPrototype(object)) 33826 ? baseCreate(getPrototype(object)) 33827 : {}; 33828 } 33829 33830 /** 33831 * Initializes an object clone based on its `toStringTag`. 33832 * 33833 * **Note:** This function only supports cloning values with tags of 33834 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 33835 * 33836 * @private 33837 * @param {Object} object The object to clone. 33838 * @param {string} tag The `toStringTag` of the object to clone. 33839 * @param {Function} cloneFunc The function to clone values. 33840 * @param {boolean} [isDeep] Specify a deep clone. 33841 * @returns {Object} Returns the initialized clone. 33842 */ 33843 function initCloneByTag(object, tag, cloneFunc, isDeep) { 33844 var Ctor = object.constructor; 33845 switch (tag) { 33846 case arrayBufferTag: 33847 return cloneArrayBuffer(object); 33848 33849 case boolTag: 33850 case dateTag: 33851 return new Ctor(+object); 33852 33853 case dataViewTag: 33854 return cloneDataView(object, isDeep); 33855 33856 case float32Tag: case float64Tag: 33857 case int8Tag: case int16Tag: case int32Tag: 33858 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 33859 return cloneTypedArray(object, isDeep); 33860 33861 case mapTag: 33862 return cloneMap(object, isDeep, cloneFunc); 33863 33864 case numberTag: 33865 case stringTag: 33866 return new Ctor(object); 33867 33868 case regexpTag: 33869 return cloneRegExp(object); 33870 33871 case setTag: 33872 return cloneSet(object, isDeep, cloneFunc); 33873 33874 case symbolTag: 33875 return cloneSymbol(object); 33876 } 33877 } 33878 33879 /** 33880 * Inserts wrapper `details` in a comment at the top of the `source` body. 33881 * 33882 * @private 33883 * @param {string} source The source to modify. 33884 * @returns {Array} details The details to insert. 33885 * @returns {string} Returns the modified source. 33886 */ 33887 function insertWrapDetails(source, details) { 33888 var length = details.length; 33889 if (!length) { 33890 return source; 33891 } 33892 var lastIndex = length - 1; 33893 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 33894 details = details.join(length > 2 ? ', ' : ' '); 33895 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 33896 } 33897 33898 /** 33899 * Checks if `value` is a flattenable `arguments` object or array. 33900 * 33901 * @private 33902 * @param {*} value The value to check. 33903 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 33904 */ 33905 function isFlattenable(value) { 33906 return isArray(value) || isArguments(value) || 33907 !!(spreadableSymbol && value && value[spreadableSymbol]); 33908 } 33909 33910 /** 33911 * Checks if `value` is a valid array-like index. 33912 * 33913 * @private 33914 * @param {*} value The value to check. 33915 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 33916 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 33917 */ 33918 function isIndex(value, length) { 33919 length = length == null ? MAX_SAFE_INTEGER : length; 33920 return !!length && 33921 (typeof value == 'number' || reIsUint.test(value)) && 33922 (value > -1 && value % 1 == 0 && value < length); 33923 } 33924 33925 /** 33926 * Checks if the given arguments are from an iteratee call. 33927 * 33928 * @private 33929 * @param {*} value The potential iteratee value argument. 33930 * @param {*} index The potential iteratee index or key argument. 33931 * @param {*} object The potential iteratee object argument. 33932 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 33933 * else `false`. 33934 */ 33935 function isIterateeCall(value, index, object) { 33936 if (!isObject(object)) { 33937 return false;
vendor: 33,294 bytes, lines 33938-34954
33938 } 33939 var type = typeof index; 33940 if (type == 'number' 33941 ? (isArrayLike(object) && isIndex(index, object.length)) 33942 : (type == 'string' && index in object) 33943 ) { 33944 return eq(object[index], value); 33945 } 33946 return false; 33947 } 33948 33949 /** 33950 * Checks if `value` is a property name and not a property path. 33951 * 33952 * @private 33953 * @param {*} value The value to check. 33954 * @param {Object} [object] The object to query keys on. 33955 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 33956 */ 33957 function isKey(value, object) { 33958 if (isArray(value)) { 33959 return false; 33960 } 33961 var type = typeof value; 33962 if (type == 'number' || type == 'symbol' || type == 'boolean' || 33963 value == null || isSymbol(value)) { 33964 return true; 33965 } 33966 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 33967 (object != null && value in Object(object)); 33968 } 33969 33970 /** 33971 * Checks if `value` is suitable for use as unique object key. 33972 * 33973 * @private 33974 * @param {*} value The value to check. 33975 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 33976 */ 33977 function isKeyable(value) { 33978 var type = typeof value; 33979 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 33980 ? (value !== '__proto__') 33981 : (value === null); 33982 } 33983 33984 /** 33985 * Checks if `func` has a lazy counterpart. 33986 * 33987 * @private 33988 * @param {Function} func The function to check. 33989 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 33990 * else `false`. 33991 */ 33992 function isLaziable(func) { 33993 var funcName = getFuncName(func), 33994 other = lodash[funcName]; 33995 33996 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 33997 return false; 33998 } 33999 if (func === other) { 34000 return true; 34001 } 34002 var data = getData(other); 34003 return !!data && func === data[0]; 34004 } 34005 34006 /** 34007 * Checks if `func` has its source masked. 34008 * 34009 * @private 34010 * @param {Function} func The function to check. 34011 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 34012 */ 34013 function isMasked(func) { 34014 return !!maskSrcKey && (maskSrcKey in func); 34015 } 34016 34017 /** 34018 * Checks if `func` is capable of being masked. 34019 * 34020 * @private 34021 * @param {*} value The value to check. 34022 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 34023 */ 34024 var isMaskable = coreJsData ? isFunction : stubFalse; 34025 34026 /** 34027 * Checks if `value` is likely a prototype object. 34028 * 34029 * @private 34030 * @param {*} value The value to check. 34031 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 34032 */ 34033 function isPrototype(value) { 34034 var Ctor = value && value.constructor, 34035 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 34036 34037 return value === proto; 34038 } 34039 34040 /** 34041 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 34042 * 34043 * @private 34044 * @param {*} value The value to check. 34045 * @returns {boolean} Returns `true` if `value` if suitable for strict 34046 * equality comparisons, else `false`. 34047 */ 34048 function isStrictComparable(value) { 34049 return value === value && !isObject(value); 34050 } 34051 34052 /** 34053 * A specialized version of `matchesProperty` for source values suitable 34054 * for strict equality comparisons, i.e. `===`. 34055 * 34056 * @private 34057 * @param {string} key The key of the property to get. 34058 * @param {*} srcValue The value to match. 34059 * @returns {Function} Returns the new spec function. 34060 */ 34061 function matchesStrictComparable(key, srcValue) { 34062 return function(object) { 34063 if (object == null) { 34064 return false; 34065 } 34066 return object[key] === srcValue && 34067 (srcValue !== undefined || (key in Object(object))); 34068 }; 34069 } 34070 34071 /** 34072 * A specialized version of `_.memoize` which clears the memoized function's 34073 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 34074 * 34075 * @private 34076 * @param {Function} func The function to have its output memoized. 34077 * @returns {Function} Returns the new memoized function. 34078 */ 34079 function memoizeCapped(func) { 34080 var result = memoize(func, function(key) { 34081 if (cache.size === MAX_MEMOIZE_SIZE) { 34082 cache.clear(); 34083 } 34084 return key; 34085 }); 34086 34087 var cache = result.cache; 34088 return result; 34089 } 34090 34091 /** 34092 * Merges the function metadata of `source` into `data`. 34093 * 34094 * Merging metadata reduces the number of wrappers used to invoke a function. 34095 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 34096 * may be applied regardless of execution order. Methods like `_.ary` and 34097 * `_.rearg` modify function arguments, making the order in which they are 34098 * executed important, preventing the merging of metadata. However, we make 34099 * an exception for a safe combined case where curried functions have `_.ary` 34100 * and or `_.rearg` applied. 34101 * 34102 * @private 34103 * @param {Array} data The destination metadata. 34104 * @param {Array} source The source metadata. 34105 * @returns {Array} Returns `data`. 34106 */ 34107 function mergeData(data, source) { 34108 var bitmask = data[1], 34109 srcBitmask = source[1], 34110 newBitmask = bitmask | srcBitmask, 34111 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 34112 34113 var isCombo = 34114 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 34115 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 34116 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 34117 34118 // Exit early if metadata can't be merged. 34119 if (!(isCommon || isCombo)) { 34120 return data; 34121 } 34122 // Use source `thisArg` if available. 34123 if (srcBitmask & WRAP_BIND_FLAG) { 34124 data[2] = source[2]; 34125 // Set when currying a bound function. 34126 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 34127 } 34128 // Compose partial arguments. 34129 var value = source[3]; 34130 if (value) { 34131 var partials = data[3]; 34132 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 34133 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 34134 } 34135 // Compose partial right arguments. 34136 value = source[5]; 34137 if (value) { 34138 partials = data[5]; 34139 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 34140 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 34141 } 34142 // Use source `argPos` if available. 34143 value = source[7]; 34144 if (value) { 34145 data[7] = value; 34146 } 34147 // Use source `ary` if it's smaller. 34148 if (srcBitmask & WRAP_ARY_FLAG) { 34149 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 34150 } 34151 // Use source `arity` if one is not provided. 34152 if (data[9] == null) { 34153 data[9] = source[9]; 34154 } 34155 // Use source `func` and merge bitmasks. 34156 data[0] = source[0]; 34157 data[1] = newBitmask; 34158 34159 return data; 34160 } 34161 34162 /** 34163 * This function is like 34164 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 34165 * except that it includes inherited enumerable properties. 34166 * 34167 * @private 34168 * @param {Object} object The object to query. 34169 * @returns {Array} Returns the array of property names. 34170 */ 34171 function nativeKeysIn(object) { 34172 var result = []; 34173 if (object != null) { 34174 for (var key in Object(object)) { 34175 result.push(key); 34176 } 34177 } 34178 return result; 34179 } 34180 34181 /** 34182 * Converts `value` to a string using `Object.prototype.toString`. 34183 * 34184 * @private 34185 * @param {*} value The value to convert. 34186 * @returns {string} Returns the converted string. 34187 */ 34188 function objectToString(value) { 34189 return nativeObjectToString.call(value); 34190 } 34191 34192 /** 34193 * A specialized version of `baseRest` which transforms the rest array. 34194 * 34195 * @private 34196 * @param {Function} func The function to apply a rest parameter to. 34197 * @param {number} [start=func.length-1] The start position of the rest parameter. 34198 * @param {Function} transform The rest array transform. 34199 * @returns {Function} Returns the new function. 34200 */ 34201 function overRest(func, start, transform) { 34202 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 34203 return function() { 34204 var args = arguments, 34205 index = -1, 34206 length = nativeMax(args.length - start, 0), 34207 array = Array(length); 34208 34209 while (++index < length) { 34210 array[index] = args[start + index]; 34211 } 34212 index = -1; 34213 var otherArgs = Array(start + 1); 34214 while (++index < start) { 34215 otherArgs[index] = args[index]; 34216 } 34217 otherArgs[start] = transform(array); 34218 return apply(func, this, otherArgs); 34219 }; 34220 } 34221 34222 /** 34223 * Gets the parent value at `path` of `object`. 34224 * 34225 * @private 34226 * @param {Object} object The object to query. 34227 * @param {Array} path The path to get the parent value of. 34228 * @returns {*} Returns the parent value. 34229 */ 34230 function parent(object, path) { 34231 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 34232 } 34233 34234 /** 34235 * Reorder `array` according to the specified indexes where the element at 34236 * the first index is assigned as the first element, the element at 34237 * the second index is assigned as the second element, and so on. 34238 * 34239 * @private 34240 * @param {Array} array The array to reorder. 34241 * @param {Array} indexes The arranged array indexes. 34242 * @returns {Array} Returns `array`. 34243 */ 34244 function reorder(array, indexes) { 34245 var arrLength = array.length, 34246 length = nativeMin(indexes.length, arrLength), 34247 oldArray = copyArray(array); 34248 34249 while (length--) { 34250 var index = indexes[length]; 34251 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 34252 } 34253 return array; 34254 } 34255 34256 /** 34257 * Sets metadata for `func`. 34258 * 34259 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 34260 * period of time, it will trip its breaker and transition to an identity 34261 * function to avoid garbage collection pauses in V8. See 34262 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 34263 * for more details. 34264 * 34265 * @private 34266 * @param {Function} func The function to associate metadata with. 34267 * @param {*} data The metadata. 34268 * @returns {Function} Returns `func`. 34269 */ 34270 var setData = shortOut(baseSetData); 34271 34272 /** 34273 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 34274 * 34275 * @private 34276 * @param {Function} func The function to delay. 34277 * @param {number} wait The number of milliseconds to delay invocation. 34278 * @returns {number|Object} Returns the timer id or timeout object. 34279 */ 34280 var setTimeout = ctxSetTimeout || function(func, wait) { 34281 return root.setTimeout(func, wait); 34282 }; 34283 34284 /** 34285 * Sets the `toString` method of `func` to return `string`. 34286 * 34287 * @private 34288 * @param {Function} func The function to modify. 34289 * @param {Function} string The `toString` result. 34290 * @returns {Function} Returns `func`. 34291 */ 34292 var setToString = shortOut(baseSetToString); 34293 34294 /** 34295 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 34296 * with wrapper details in a comment at the top of the source body. 34297 * 34298 * @private 34299 * @param {Function} wrapper The function to modify. 34300 * @param {Function} reference The reference function. 34301 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 34302 * @returns {Function} Returns `wrapper`. 34303 */ 34304 function setWrapToString(wrapper, reference, bitmask) { 34305 var source = (reference + ''); 34306 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 34307 } 34308 34309 /** 34310 * Creates a function that'll short out and invoke `identity` instead 34311 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 34312 * milliseconds. 34313 * 34314 * @private 34315 * @param {Function} func The function to restrict. 34316 * @returns {Function} Returns the new shortable function. 34317 */ 34318 function shortOut(func) { 34319 var count = 0, 34320 lastCalled = 0; 34321 34322 return function() { 34323 var stamp = nativeNow(), 34324 remaining = HOT_SPAN - (stamp - lastCalled); 34325 34326 lastCalled = stamp; 34327 if (remaining > 0) { 34328 if (++count >= HOT_COUNT) { 34329 return arguments[0]; 34330 } 34331 } else { 34332 count = 0; 34333 } 34334 return func.apply(undefined, arguments); 34335 }; 34336 } 34337 34338 /** 34339 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 34340 * 34341 * @private 34342 * @param {Array} array The array to shuffle. 34343 * @param {number} [size=array.length] The size of `array`. 34344 * @returns {Array} Returns `array`. 34345 */ 34346 function shuffleSelf(array, size) { 34347 var index = -1, 34348 length = array.length, 34349 lastIndex = length - 1; 34350 34351 size = size === undefined ? length : size; 34352 while (++index < size) { 34353 var rand = baseRandom(index, lastIndex), 34354 value = array[rand]; 34355 34356 array[rand] = array[index]; 34357 array[index] = value; 34358 } 34359 array.length = size; 34360 return array; 34361 } 34362 34363 /** 34364 * Converts `string` to a property path array. 34365 * 34366 * @private 34367 * @param {string} string The string to convert. 34368 * @returns {Array} Returns the property path array. 34369 */ 34370 var stringToPath = memoizeCapped(function(string) { 34371 var result = []; 34372 if (reLeadingDot.test(string)) { 34373 result.push(''); 34374 } 34375 string.replace(rePropName, function(match, number, quote, string) { 34376 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); 34377 }); 34378 return result; 34379 }); 34380 34381 /** 34382 * Converts `value` to a string key if it's not a string or symbol. 34383 * 34384 * @private 34385 * @param {*} value The value to inspect. 34386 * @returns {string|symbol} Returns the key. 34387 */ 34388 function toKey(value) { 34389 if (typeof value == 'string' || isSymbol(value)) { 34390 return value; 34391 } 34392 var result = (value + ''); 34393 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 34394 } 34395 34396 /** 34397 * Converts `func` to its source code. 34398 * 34399 * @private 34400 * @param {Function} func The function to convert. 34401 * @returns {string} Returns the source code. 34402 */ 34403 function toSource(func) { 34404 if (func != null) { 34405 try { 34406 return funcToString.call(func); 34407 } catch (e) {} 34408 try { 34409 return (func + ''); 34410 } catch (e) {} 34411 } 34412 return ''; 34413 } 34414 34415 /** 34416 * Updates wrapper `details` based on `bitmask` flags. 34417 * 34418 * @private 34419 * @returns {Array} details The details to modify. 34420 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 34421 * @returns {Array} Returns `details`. 34422 */ 34423 function updateWrapDetails(details, bitmask) { 34424 arrayEach(wrapFlags, function(pair) { 34425 var value = '_.' + pair[0]; 34426 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 34427 details.push(value); 34428 } 34429 }); 34430 return details.sort(); 34431 } 34432 34433 /** 34434 * Creates a clone of `wrapper`. 34435 * 34436 * @private 34437 * @param {Object} wrapper The wrapper to clone. 34438 * @returns {Object} Returns the cloned wrapper. 34439 */ 34440 function wrapperClone(wrapper) { 34441 if (wrapper instanceof LazyWrapper) { 34442 return wrapper.clone(); 34443 } 34444 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 34445 result.__actions__ = copyArray(wrapper.__actions__); 34446 result.__index__ = wrapper.__index__; 34447 result.__values__ = wrapper.__values__; 34448 return result; 34449 } 34450 34451 /*------------------------------------------------------------------------*/ 34452 34453 /** 34454 * Creates an array of elements split into groups the length of `size`. 34455 * If `array` can't be split evenly, the final chunk will be the remaining 34456 * elements. 34457 * 34458 * @static 34459 * @memberOf _ 34460 * @since 3.0.0 34461 * @category Array 34462 * @param {Array} array The array to process. 34463 * @param {number} [size=1] The length of each chunk 34464 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34465 * @returns {Array} Returns the new array of chunks. 34466 * @example 34467 * 34468 * _.chunk(['a', 'b', 'c', 'd'], 2); 34469 * // => [['a', 'b'], ['c', 'd']] 34470 * 34471 * _.chunk(['a', 'b', 'c', 'd'], 3); 34472 * // => [['a', 'b', 'c'], ['d']] 34473 */ 34474 function chunk(array, size, guard) { 34475 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 34476 size = 1; 34477 } else { 34478 size = nativeMax(toInteger(size), 0); 34479 } 34480 var length = array == null ? 0 : array.length; 34481 if (!length || size < 1) { 34482 return []; 34483 } 34484 var index = 0, 34485 resIndex = 0, 34486 result = Array(nativeCeil(length / size)); 34487 34488 while (index < length) { 34489 result[resIndex++] = baseSlice(array, index, (index += size)); 34490 } 34491 return result; 34492 } 34493 34494 /** 34495 * Creates an array with all falsey values removed. The values `false`, `null`, 34496 * `0`, `""`, `undefined`, and `NaN` are falsey. 34497 * 34498 * @static 34499 * @memberOf _ 34500 * @since 0.1.0 34501 * @category Array 34502 * @param {Array} array The array to compact. 34503 * @returns {Array} Returns the new array of filtered values. 34504 * @example 34505 * 34506 * _.compact([0, 1, false, 2, '', 3]); 34507 * // => [1, 2, 3] 34508 */ 34509 function compact(array) { 34510 var index = -1, 34511 length = array == null ? 0 : array.length, 34512 resIndex = 0, 34513 result = []; 34514 34515 while (++index < length) { 34516 var value = array[index]; 34517 if (value) { 34518 result[resIndex++] = value; 34519 } 34520 } 34521 return result; 34522 } 34523 34524 /** 34525 * Creates a new array concatenating `array` with any additional arrays 34526 * and/or values. 34527 * 34528 * @static 34529 * @memberOf _ 34530 * @since 4.0.0 34531 * @category Array 34532 * @param {Array} array The array to concatenate. 34533 * @param {...*} [values] The values to concatenate. 34534 * @returns {Array} Returns the new concatenated array. 34535 * @example 34536 * 34537 * var array = [1]; 34538 * var other = _.concat(array, 2, [3], [[4]]); 34539 * 34540 * console.log(other); 34541 * // => [1, 2, 3, [4]] 34542 * 34543 * console.log(array); 34544 * // => [1] 34545 */ 34546 function concat() { 34547 var length = arguments.length; 34548 if (!length) { 34549 return []; 34550 } 34551 var args = Array(length - 1), 34552 array = arguments[0], 34553 index = length; 34554 34555 while (index--) { 34556 args[index - 1] = arguments[index]; 34557 } 34558 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 34559 } 34560 34561 /** 34562 * Creates an array of `array` values not included in the other given arrays 34563 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 34564 * for equality comparisons. The order and references of result values are 34565 * determined by the first array. 34566 * 34567 * **Note:** Unlike `_.pullAll`, this method returns a new array. 34568 * 34569 * @static 34570 * @memberOf _ 34571 * @since 0.1.0 34572 * @category Array 34573 * @param {Array} array The array to inspect. 34574 * @param {...Array} [values] The values to exclude. 34575 * @returns {Array} Returns the new array of filtered values. 34576 * @see _.without, _.xor 34577 * @example 34578 * 34579 * _.difference([2, 1], [2, 3]); 34580 * // => [1] 34581 */ 34582 var difference = baseRest(function(array, values) { 34583 return isArrayLikeObject(array) 34584 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 34585 : []; 34586 }); 34587 34588 /** 34589 * This method is like `_.difference` except that it accepts `iteratee` which 34590 * is invoked for each element of `array` and `values` to generate the criterion 34591 * by which they're compared. The order and references of result values are 34592 * determined by the first array. The iteratee is invoked with one argument: 34593 * (value). 34594 * 34595 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 34596 * 34597 * @static 34598 * @memberOf _ 34599 * @since 4.0.0 34600 * @category Array 34601 * @param {Array} array The array to inspect. 34602 * @param {...Array} [values] The values to exclude. 34603 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 34604 * @returns {Array} Returns the new array of filtered values. 34605 * @example 34606 * 34607 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 34608 * // => [1.2] 34609 * 34610 * // The `_.property` iteratee shorthand. 34611 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 34612 * // => [{ 'x': 2 }] 34613 */ 34614 var differenceBy = baseRest(function(array, values) { 34615 var iteratee = last(values); 34616 if (isArrayLikeObject(iteratee)) { 34617 iteratee = undefined; 34618 } 34619 return isArrayLikeObject(array) 34620 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 34621 : []; 34622 }); 34623 34624 /** 34625 * This method is like `_.difference` except that it accepts `comparator` 34626 * which is invoked to compare elements of `array` to `values`. The order and 34627 * references of result values are determined by the first array. The comparator 34628 * is invoked with two arguments: (arrVal, othVal). 34629 * 34630 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 34631 * 34632 * @static 34633 * @memberOf _ 34634 * @since 4.0.0 34635 * @category Array 34636 * @param {Array} array The array to inspect. 34637 * @param {...Array} [values] The values to exclude. 34638 * @param {Function} [comparator] The comparator invoked per element. 34639 * @returns {Array} Returns the new array of filtered values. 34640 * @example 34641 * 34642 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 34643 * 34644 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 34645 * // => [{ 'x': 2, 'y': 1 }] 34646 */ 34647 var differenceWith = baseRest(function(array, values) { 34648 var comparator = last(values); 34649 if (isArrayLikeObject(comparator)) { 34650 comparator = undefined; 34651 } 34652 return isArrayLikeObject(array) 34653 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 34654 : []; 34655 }); 34656 34657 /** 34658 * Creates a slice of `array` with `n` elements dropped from the beginning. 34659 * 34660 * @static 34661 * @memberOf _ 34662 * @since 0.5.0 34663 * @category Array 34664 * @param {Array} array The array to query. 34665 * @param {number} [n=1] The number of elements to drop. 34666 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34667 * @returns {Array} Returns the slice of `array`. 34668 * @example 34669 * 34670 * _.drop([1, 2, 3]); 34671 * // => [2, 3] 34672 * 34673 * _.drop([1, 2, 3], 2); 34674 * // => [3] 34675 * 34676 * _.drop([1, 2, 3], 5); 34677 * // => [] 34678 * 34679 * _.drop([1, 2, 3], 0); 34680 * // => [1, 2, 3] 34681 */ 34682 function drop(array, n, guard) { 34683 var length = array == null ? 0 : array.length; 34684 if (!length) { 34685 return []; 34686 } 34687 n = (guard || n === undefined) ? 1 : toInteger(n); 34688 return baseSlice(array, n < 0 ? 0 : n, length); 34689 } 34690 34691 /** 34692 * Creates a slice of `array` with `n` elements dropped from the end. 34693 * 34694 * @static 34695 * @memberOf _ 34696 * @since 3.0.0 34697 * @category Array 34698 * @param {Array} array The array to query. 34699 * @param {number} [n=1] The number of elements to drop. 34700 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34701 * @returns {Array} Returns the slice of `array`. 34702 * @example 34703 * 34704 * _.dropRight([1, 2, 3]); 34705 * // => [1, 2] 34706 * 34707 * _.dropRight([1, 2, 3], 2); 34708 * // => [1] 34709 * 34710 * _.dropRight([1, 2, 3], 5); 34711 * // => [] 34712 * 34713 * _.dropRight([1, 2, 3], 0); 34714 * // => [1, 2, 3] 34715 */ 34716 function dropRight(array, n, guard) { 34717 var length = array == null ? 0 : array.length; 34718 if (!length) { 34719 return []; 34720 } 34721 n = (guard || n === undefined) ? 1 : toInteger(n); 34722 n = length - n; 34723 return baseSlice(array, 0, n < 0 ? 0 : n); 34724 } 34725 34726 /** 34727 * Creates a slice of `array` excluding elements dropped from the end. 34728 * Elements are dropped until `predicate` returns falsey. The predicate is 34729 * invoked with three arguments: (value, index, array). 34730 * 34731 * @static 34732 * @memberOf _ 34733 * @since 3.0.0 34734 * @category Array 34735 * @param {Array} array The array to query. 34736 * @param {Function} [predicate=_.identity] The function invoked per iteration. 34737 * @returns {Array} Returns the slice of `array`. 34738 * @example 34739 * 34740 * var users = [ 34741 * { 'user': 'barney', 'active': true }, 34742 * { 'user': 'fred', 'active': false }, 34743 * { 'user': 'pebbles', 'active': false } 34744 * ]; 34745 * 34746 * _.dropRightWhile(users, function(o) { return !o.active; }); 34747 * // => objects for ['barney'] 34748 * 34749 * // The `_.matches` iteratee shorthand. 34750 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 34751 * // => objects for ['barney', 'fred'] 34752 * 34753 * // The `_.matchesProperty` iteratee shorthand. 34754 * _.dropRightWhile(users, ['active', false]); 34755 * // => objects for ['barney'] 34756 * 34757 * // The `_.property` iteratee shorthand. 34758 * _.dropRightWhile(users, 'active'); 34759 * // => objects for ['barney', 'fred', 'pebbles'] 34760 */ 34761 function dropRightWhile(array, predicate) { 34762 return (array && array.length) 34763 ? baseWhile(array, getIteratee(predicate, 3), true, true) 34764 : []; 34765 } 34766 34767 /** 34768 * Creates a slice of `array` excluding elements dropped from the beginning. 34769 * Elements are dropped until `predicate` returns falsey. The predicate is 34770 * invoked with three arguments: (value, index, array). 34771 * 34772 * @static 34773 * @memberOf _ 34774 * @since 3.0.0 34775 * @category Array 34776 * @param {Array} array The array to query. 34777 * @param {Function} [predicate=_.identity] The function invoked per iteration. 34778 * @returns {Array} Returns the slice of `array`. 34779 * @example 34780 * 34781 * var users = [ 34782 * { 'user': 'barney', 'active': false }, 34783 * { 'user': 'fred', 'active': false }, 34784 * { 'user': 'pebbles', 'active': true } 34785 * ]; 34786 * 34787 * _.dropWhile(users, function(o) { return !o.active; }); 34788 * // => objects for ['pebbles'] 34789 * 34790 * // The `_.matches` iteratee shorthand. 34791 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 34792 * // => objects for ['fred', 'pebbles'] 34793 * 34794 * // The `_.matchesProperty` iteratee shorthand. 34795 * _.dropWhile(users, ['active', false]); 34796 * // => objects for ['pebbles'] 34797 * 34798 * // The `_.property` iteratee shorthand. 34799 * _.dropWhile(users, 'active'); 34800 * // => objects for ['barney', 'fred', 'pebbles'] 34801 */ 34802 function dropWhile(array, predicate) { 34803 return (array && array.length) 34804 ? baseWhile(array, getIteratee(predicate, 3), true) 34805 : []; 34806 } 34807 34808 /** 34809 * Fills elements of `array` with `value` from `start` up to, but not 34810 * including, `end`. 34811 * 34812 * **Note:** This method mutates `array`. 34813 * 34814 * @static 34815 * @memberOf _ 34816 * @since 3.2.0 34817 * @category Array 34818 * @param {Array} array The array to fill. 34819 * @param {*} value The value to fill `array` with. 34820 * @param {number} [start=0] The start position. 34821 * @param {number} [end=array.length] The end position. 34822 * @returns {Array} Returns `array`. 34823 * @example 34824 * 34825 * var array = [1, 2, 3]; 34826 * 34827 * _.fill(array, 'a'); 34828 * console.log(array); 34829 * // => ['a', 'a', 'a'] 34830 * 34831 * _.fill(Array(3), 2); 34832 * // => [2, 2, 2] 34833 * 34834 * _.fill([4, 6, 8, 10], '*', 1, 3); 34835 * // => [4, '*', '*', 10] 34836 */ 34837 function fill(array, value, start, end) { 34838 var length = array == null ? 0 : array.length; 34839 if (!length) { 34840 return []; 34841 } 34842 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 34843 start = 0; 34844 end = length; 34845 } 34846 return baseFill(array, value, start, end); 34847 } 34848 34849 /** 34850 * This method is like `_.find` except that it returns the index of the first 34851 * element `predicate` returns truthy for instead of the element itself. 34852 * 34853 * @static 34854 * @memberOf _ 34855 * @since 1.1.0 34856 * @category Array 34857 * @param {Array} array The array to inspect. 34858 * @param {Function} [predicate=_.identity] The function invoked per iteration. 34859 * @param {number} [fromIndex=0] The index to search from. 34860 * @returns {number} Returns the index of the found element, else `-1`. 34861 * @example 34862 * 34863 * var users = [ 34864 * { 'user': 'barney', 'active': false }, 34865 * { 'user': 'fred', 'active': false }, 34866 * { 'user': 'pebbles', 'active': true } 34867 * ]; 34868 * 34869 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 34870 * // => 0 34871 * 34872 * // The `_.matches` iteratee shorthand. 34873 * _.findIndex(users, { 'user': 'fred', 'active': false }); 34874 * // => 1 34875 * 34876 * // The `_.matchesProperty` iteratee shorthand. 34877 * _.findIndex(users, ['active', false]); 34878 * // => 0 34879 * 34880 * // The `_.property` iteratee shorthand. 34881 * _.findIndex(users, 'active'); 34882 * // => 2 34883 */ 34884 function findIndex(array, predicate, fromIndex) { 34885 var length = array == null ? 0 : array.length; 34886 if (!length) { 34887 return -1; 34888 } 34889 var index = fromIndex == null ? 0 : toInteger(fromIndex); 34890 if (index < 0) { 34891 index = nativeMax(length + index, 0); 34892 } 34893 return baseFindIndex(array, getIteratee(predicate, 3), index); 34894 } 34895 34896 /** 34897 * This method is like `_.findIndex` except that it iterates over elements 34898 * of `collection` from right to left. 34899 * 34900 * @static 34901 * @memberOf _ 34902 * @since 2.0.0 34903 * @category Array 34904 * @param {Array} array The array to inspect. 34905 * @param {Function} [predicate=_.identity] The function invoked per iteration. 34906 * @param {number} [fromIndex=array.length-1] The index to search from. 34907 * @returns {number} Returns the index of the found element, else `-1`. 34908 * @example 34909 * 34910 * var users = [ 34911 * { 'user': 'barney', 'active': true }, 34912 * { 'user': 'fred', 'active': false }, 34913 * { 'user': 'pebbles', 'active': false } 34914 * ]; 34915 * 34916 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 34917 * // => 2 34918 * 34919 * // The `_.matches` iteratee shorthand. 34920 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 34921 * // => 0 34922 * 34923 * // The `_.matchesProperty` iteratee shorthand. 34924 * _.findLastIndex(users, ['active', false]); 34925 * // => 2 34926 * 34927 * // The `_.property` iteratee shorthand. 34928 * _.findLastIndex(users, 'active'); 34929 * // => 0 34930 */ 34931 function findLastIndex(array, predicate, fromIndex) { 34932 var length = array == null ? 0 : array.length; 34933 if (!length) { 34934 return -1; 34935 } 34936 var index = length - 1; 34937 if (fromIndex !== undefined) { 34938 index = toInteger(fromIndex); 34939 index = fromIndex < 0 34940 ? nativeMax(length + index, 0) 34941 : nativeMin(index, length - 1); 34942 } 34943 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 34944 } 34945 34946 /** 34947 * Flattens `array` a single level deep. 34948 * 34949 * @static 34950 * @memberOf _ 34951 * @since 0.1.0 34952 * @category Array 34953 * @param {Array} array The array to flatten. 34954 * @returns {Array} Returns the new flattened array.
34955 * @example 34956 * 34957 * _.flatten([1, [2, [3, [4]], 5]]); 34958 * // => [1, 2, [3, [4]], 5] 34959 */ 34960 function flatten(array) { 34961 var length = array == null ? 0 : array.length; 34962 return length ? baseFlatten(array, 1) : []; 34963 } 34964 34965 /** 34966 * Recursively flattens `array`. 34967 * 34968 * @static 34969 * @memberOf _ 34970 * @since 3.0.0 34971 * @category Array 34972 * @param {Array} array The array to flatten. 34973 * @returns {Array} Returns the new flattened array. 34974 * @example 34975 * 34976 * _.flattenDeep([1, [2, [3, [4]], 5]]); 34977 * // => [1, 2, 3, 4, 5] 34978 */ 34979 function flattenDeep(array) { 34980 var length = array == null ? 0 : array.length; 34981 return length ? baseFlatten(array, INFINITY) : []; 34982 } 34983 34984 /** 34985 * Recursively flatten `array` up to `depth` times. 34986 * 34987 * @static 34988 * @memberOf _ 34989 * @since 4.4.0 34990 * @category Array 34991 * @param {Array} array The array to flatten. 34992 * @param {number} [depth=1] The maximum recursion depth. 34993 * @returns {Array} Returns the new flattened array. 34994 * @example 34995 * 34996 * var array = [1, [2, [3, [4]], 5]]; 34997 * 34998 * _.flattenDepth(array, 1); 34999 * // => [1, 2, [3, [4]], 5] 35000 * 35001 * _.flattenDepth(array, 2); 35002 * // => [1, 2, 3, [4], 5] 35003 */ 35004 function flattenDepth(array, depth) { 35005 var length = array == null ? 0 : array.length; 35006 if (!length) { 35007 return []; 35008 } 35009 depth = depth === undefined ? 1 : toInteger(depth); 35010 return baseFlatten(array, depth); 35011 } 35012 35013 /** 35014 * The inverse of `_.toPairs`;
35014 this method returns an object composed 35015 * from key-value `pairs`. 35016 * 35017 * @static 35018 * @memberOf _ 35019 * @since 4.0.0 35020 * @category Array 35021 * @param {Array} pairs The key-value pairs. 35022 * @returns {Object} Returns the new object. 35023 * @example 35024 * 35025 * _.fromPairs([['a', 1], ['b', 2]]); 35026 * // => { 'a': 1, 'b': 2 } 35027 */ 35028 function fromPairs(pairs) { 35029 var index = -1, 35030 length = pairs == null ? 0 : pairs.length, 35031 result = {}; 35032 35033 while (++index < length) { 35034 var pair = pairs[index]; 35035 result[pair[0]] = pair[1]; 35036 } 35037 return result; 35038 } 35039 35040 /** 35041 * Gets the first element of `array`. 35042 * 35043 * @static 35044 * @memberOf _ 35045 * @since 0.1.0 35046 * @alias first 35047 * @category Array 35048 * @param {Array} array The array to query. 35049 * @returns {*} Returns the first element of `array`. 35050 * @example 35051 * 35052 * _.head([1, 2, 3]); 35053 * // => 1 35054 * 35055 * _.head([]); 35056 * // => undefined 35057 */ 35058 function head(array) { 35059 return (array && array.length) ? array[0] : undefined; 35060 } 35061 35062 /** 35063 * Gets the index at which the first occurrence of `value` is found in `array` 35064 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 35065 * for equality comparisons. If `fromIndex` is negative, it's used as the 35066 * offset from the end of `array`. 35067 * 35068 * @static 35069 * @memberOf _ 35070 * @since 0.1.0 35071 * @category Array 35072 * @param {Array} array The array to inspect. 35073 * @param {*} value The value to search for. 35074 * @param {number} [fromIndex=0] The index to search from. 35075 * @returns {number} Returns the index of the matched value, else `-1`. 35076 * @example 35077 * 35078 * _.indexOf([1, 2, 1, 2], 2); 35079 * // => 1 35080 * 35081 * // Search from the `fromIndex`. 35082 * _.indexOf([1, 2, 1, 2], 2, 2); 35083 * // => 3 35084 */ 35085 function indexOf(array, value, fromIndex) { 35086 var length = array == null ? 0 : array.length; 35087 if (!length) { 35088 return -1; 35089 } 35090 var index = fromIndex == null ? 0 : toInteger(fromIndex); 35091 if (index < 0) { 35092 index = nativeMax(length + index, 0); 35093 } 35094 return baseIndexOf(array, value, index); 35095 } 35096 35097 /** 35098 * Gets all but the last element of `array`. 35099 * 35100 * @static 35101 * @memberOf _ 35102 * @since 0.1.0 35103 * @category Array 35104 * @param {Array} array The array to query. 35105 * @returns {Array} Returns the slice of `array`. 35106 * @example 35107 * 35108 * _.initial([1, 2, 3]); 35109 * // => [1, 2] 35110 */ 35111 function initial(array) { 35112 var length = array == null ? 0 : array.length; 35113 return length ? baseSlice(array, 0, -1) : []; 35114 } 35115 35116 /** 35117 * Creates an array of unique values that are included in all given arrays 35118 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 35119 * for equality comparisons. The order and references of result values are 35120 * determined by the first array. 35121 * 35122 * @static 35123 * @memberOf _ 35124 * @since 0.1.0 35125 * @category Array 35126 * @param {...Array} [arrays] The arrays to inspect. 35127 * @returns {Array} Returns the new array of intersecting values. 35128 * @example 35129 * 35130 * _.intersection([2, 1], [2, 3]); 35131 * // => [2] 35132 */ 35133 var intersection = baseRest(function(arrays) { 35134 var mapped = arrayMap(arrays, castArrayLikeObject); 35135 return (mapped.length && mapped[0] === arrays[0]) 35136 ? baseIntersection(mapped) 35137 : []; 35138 }); 35139 35140 /** 35141 * This method is like `_.intersection` except that it accepts `iteratee` 35142 * which is invoked for each element of each `arrays` to generate the criterion 35143 * by which they're compared. The order and references of result values are 35144 * determined by the first array. The iteratee is invoked with one argument: 35145 * (value). 35146 * 35147 * @static 35148 * @memberOf _ 35149 * @since 4.0.0 35150 * @category Array 35151 * @param {...Array} [arrays] The arrays to inspect. 35152 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35153 * @returns {Array} Returns the new array of intersecting values. 35154 * @example 35155 * 35156 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 35157 * // => [2.1] 35158 * 35159 * // The `_.property` iteratee shorthand. 35160 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 35161 * // => [{ 'x': 1 }] 35162 */ 35163 var intersectionBy = baseRest(function(arrays) { 35164 var iteratee = last(arrays), 35165 mapped = arrayMap(arrays, castArrayLikeObject); 35166 35167 if (iteratee === last(mapped)) { 35168 iteratee = undefined; 35169 } else { 35170 mapped.pop(); 35171 } 35172 return (mapped.length && mapped[0] === arrays[0]) 35173 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 35174 : []; 35175 }); 35176 35177 /** 35178 * This method is like `_.intersection` except that it accepts `comparator` 35179 * which is invoked to compare elements of `arrays`. The order and references 35180 * of result values are determined by the first array. The comparator is 35181 * invoked with two arguments: (arrVal, othVal). 35182 * 35183 * @static 35184 * @memberOf _ 35185 * @since 4.0.0 35186 * @category Array 35187 * @param {...Array} [arrays] The arrays to inspect. 35188 * @param {Function} [comparator] The comparator invoked per element. 35189 * @returns {Array} Returns the new array of intersecting values. 35190 * @example 35191 * 35192 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 35193 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 35194 * 35195 * _.intersectionWith(objects, others, _.isEqual); 35196 * // => [{ 'x': 1, 'y': 2 }] 35197 */ 35198 var intersectionWith = baseRest(function(arrays) { 35199 var comparator = last(arrays), 35200 mapped = arrayMap(arrays, castArrayLikeObject); 35201 35202 comparator = typeof comparator == 'function' ? comparator : undefined; 35203 if (comparator) { 35204 mapped.pop(); 35205 } 35206 return (mapped.length && mapped[0] === arrays[0])
vendor: 45,067 bytes, lines 35207-36635
35207 ? baseIntersection(mapped, undefined, comparator) 35208 : []; 35209 }); 35210 35211 /** 35212 * Converts all elements in `array` into a string separated by `separator`. 35213 * 35214 * @static 35215 * @memberOf _ 35216 * @since 4.0.0 35217 * @category Array 35218 * @param {Array} array The array to convert. 35219 * @param {string} [separator=','] The element separator. 35220 * @returns {string} Returns the joined string. 35221 * @example 35222 * 35223 * _.join(['a', 'b', 'c'], '~'); 35224 * // => 'a~b~c' 35225 */ 35226 function join(array, separator) { 35227 return array == null ? '' : nativeJoin.call(array, separator); 35228 } 35229 35230 /** 35231 * Gets the last element of `array`. 35232 * 35233 * @static 35234 * @memberOf _ 35235 * @since 0.1.0 35236 * @category Array 35237 * @param {Array} array The array to query. 35238 * @returns {*} Returns the last element of `array`. 35239 * @example 35240 * 35241 * _.last([1, 2, 3]); 35242 * // => 3 35243 */ 35244 function last(array) { 35245 var length = array == null ? 0 : array.length; 35246 return length ? array[length - 1] : undefined; 35247 } 35248 35249 /** 35250 * This method is like `_.indexOf` except that it iterates over elements of 35251 * `array` from right to left. 35252 * 35253 * @static 35254 * @memberOf _ 35255 * @since 0.1.0 35256 * @category Array 35257 * @param {Array} array The array to inspect. 35258 * @param {*} value The value to search for. 35259 * @param {number} [fromIndex=array.length-1] The index to search from. 35260 * @returns {number} Returns the index of the matched value, else `-1`. 35261 * @example 35262 * 35263 * _.lastIndexOf([1, 2, 1, 2], 2); 35264 * // => 3 35265 * 35266 * // Search from the `fromIndex`. 35267 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 35268 * // => 1 35269 */ 35270 function lastIndexOf(array, value, fromIndex) { 35271 var length = array == null ? 0 : array.length; 35272 if (!length) { 35273 return -1; 35274 } 35275 var index = length; 35276 if (fromIndex !== undefined) { 35277 index = toInteger(fromIndex); 35278 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 35279 } 35280 return value === value 35281 ? strictLastIndexOf(array, value, index) 35282 : baseFindIndex(array, baseIsNaN, index, true); 35283 } 35284 35285 /** 35286 * Gets the element at index `n` of `array`. If `n` is negative, the nth 35287 * element from the end is returned. 35288 * 35289 * @static 35290 * @memberOf _ 35291 * @since 4.11.0 35292 * @category Array 35293 * @param {Array} array The array to query. 35294 * @param {number} [n=0] The index of the element to return. 35295 * @returns {*} Returns the nth element of `array`. 35296 * @example 35297 * 35298 * var array = ['a', 'b', 'c', 'd']; 35299 * 35300 * _.nth(array, 1); 35301 * // => 'b' 35302 * 35303 * _.nth(array, -2); 35304 * // => 'c'; 35305 */ 35306 function nth(array, n) { 35307 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 35308 } 35309 35310 /** 35311 * Removes all given values from `array` using 35312 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 35313 * for equality comparisons. 35314 * 35315 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 35316 * to remove elements from an array by predicate. 35317 * 35318 * @static 35319 * @memberOf _ 35320 * @since 2.0.0 35321 * @category Array 35322 * @param {Array} array The array to modify. 35323 * @param {...*} [values] The values to remove. 35324 * @returns {Array} Returns `array`. 35325 * @example 35326 * 35327 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 35328 * 35329 * _.pull(array, 'a', 'c'); 35330 * console.log(array); 35331 * // => ['b', 'b'] 35332 */ 35333 var pull = baseRest(pullAll); 35334 35335 /** 35336 * This method is like `_.pull` except that it accepts an array of values to remove. 35337 * 35338 * **Note:** Unlike `_.difference`, this method mutates `array`. 35339 * 35340 * @static 35341 * @memberOf _ 35342 * @since 4.0.0 35343 * @category Array 35344 * @param {Array} array The array to modify. 35345 * @param {Array} values The values to remove. 35346 * @returns {Array} Returns `array`. 35347 * @example 35348 * 35349 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 35350 * 35351 * _.pullAll(array, ['a', 'c']); 35352 * console.log(array); 35353 * // => ['b', 'b'] 35354 */ 35355 function pullAll(array, values) { 35356 return (array && array.length && values && values.length) 35357 ? basePullAll(array, values) 35358 : array; 35359 } 35360 35361 /** 35362 * This method is like `_.pullAll` except that it accepts `iteratee` which is 35363 * invoked for each element of `array` and `values` to generate the criterion 35364 * by which they're compared. The iteratee is invoked with one argument: (value). 35365 * 35366 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 35367 * 35368 * @static 35369 * @memberOf _ 35370 * @since 4.0.0 35371 * @category Array 35372 * @param {Array} array The array to modify. 35373 * @param {Array} values The values to remove. 35374 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35375 * @returns {Array} Returns `array`. 35376 * @example 35377 * 35378 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 35379 * 35380 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 35381 * console.log(array); 35382 * // => [{ 'x': 2 }] 35383 */ 35384 function pullAllBy(array, values, iteratee) { 35385 return (array && array.length && values && values.length) 35386 ? basePullAll(array, values, getIteratee(iteratee, 2)) 35387 : array; 35388 } 35389 35390 /** 35391 * This method is like `_.pullAll` except that it accepts `comparator` which 35392 * is invoked to compare elements of `array` to `values`. The comparator is 35393 * invoked with two arguments: (arrVal, othVal). 35394 * 35395 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 35396 * 35397 * @static 35398 * @memberOf _ 35399 * @since 4.6.0 35400 * @category Array 35401 * @param {Array} array The array to modify. 35402 * @param {Array} values The values to remove. 35403 * @param {Function} [comparator] The comparator invoked per element. 35404 * @returns {Array} Returns `array`. 35405 * @example 35406 * 35407 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 35408 * 35409 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 35410 * console.log(array); 35411 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 35412 */ 35413 function pullAllWith(array, values, comparator) { 35414 return (array && array.length && values && values.length) 35415 ? basePullAll(array, values, undefined, comparator) 35416 : array; 35417 } 35418 35419 /** 35420 * Removes elements from `array` corresponding to `indexes` and returns an 35421 * array of removed elements. 35422 * 35423 * **Note:** Unlike `_.at`, this method mutates `array`. 35424 * 35425 * @static 35426 * @memberOf _ 35427 * @since 3.0.0 35428 * @category Array 35429 * @param {Array} array The array to modify. 35430 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 35431 * @returns {Array} Returns the new array of removed elements. 35432 * @example 35433 * 35434 * var array = ['a', 'b', 'c', 'd']; 35435 * var pulled = _.pullAt(array, [1, 3]); 35436 * 35437 * console.log(array); 35438 * // => ['a', 'c'] 35439 * 35440 * console.log(pulled); 35441 * // => ['b', 'd'] 35442 */ 35443 var pullAt = flatRest(function(array, indexes) { 35444 var length = array == null ? 0 : array.length, 35445 result = baseAt(array, indexes); 35446 35447 basePullAt(array, arrayMap(indexes, function(index) { 35448 return isIndex(index, length) ? +index : index; 35449 }).sort(compareAscending)); 35450 35451 return result; 35452 }); 35453 35454 /** 35455 * Removes all elements from `array` that `predicate` returns truthy for 35456 * and returns an array of the removed elements. The predicate is invoked 35457 * with three arguments: (value, index, array). 35458 * 35459 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 35460 * to pull elements from an array by value. 35461 * 35462 * @static 35463 * @memberOf _ 35464 * @since 2.0.0 35465 * @category Array 35466 * @param {Array} array The array to modify. 35467 * @param {Function} [predicate=_.identity] The function invoked per iteration. 35468 * @returns {Array} Returns the new array of removed elements. 35469 * @example 35470 * 35471 * var array = [1, 2, 3, 4]; 35472 * var evens = _.remove(array, function(n) { 35473 * return n % 2 == 0; 35474 * }); 35475 * 35476 * console.log(array); 35477 * // => [1, 3] 35478 * 35479 * console.log(evens); 35480 * // => [2, 4] 35481 */ 35482 function remove(array, predicate) { 35483 var result = []; 35484 if (!(array && array.length)) { 35485 return result; 35486 } 35487 var index = -1, 35488 indexes = [], 35489 length = array.length; 35490 35491 predicate = getIteratee(predicate, 3); 35492 while (++index < length) { 35493 var value = array[index]; 35494 if (predicate(value, index, array)) { 35495 result.push(value); 35496 indexes.push(index); 35497 } 35498 } 35499 basePullAt(array, indexes); 35500 return result; 35501 } 35502 35503 /** 35504 * Reverses `array` so that the first element becomes the last, the second 35505 * element becomes the second to last, and so on. 35506 * 35507 * **Note:** This method mutates `array` and is based on 35508 * [`Array#reverse`](https://mdn.io/Array/reverse). 35509 * 35510 * @static 35511 * @memberOf _ 35512 * @since 4.0.0 35513 * @category Array 35514 * @param {Array} array The array to modify. 35515 * @returns {Array} Returns `array`. 35516 * @example 35517 * 35518 * var array = [1, 2, 3]; 35519 * 35520 * _.reverse(array); 35521 * // => [3, 2, 1] 35522 * 35523 * console.log(array); 35524 * // => [3, 2, 1] 35525 */ 35526 function reverse(array) { 35527 return array == null ? array : nativeReverse.call(array); 35528 } 35529 35530 /** 35531 * Creates a slice of `array` from `start` up to, but not including, `end`. 35532 * 35533 * **Note:** This method is used instead of 35534 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 35535 * returned. 35536 * 35537 * @static 35538 * @memberOf _ 35539 * @since 3.0.0 35540 * @category Array 35541 * @param {Array} array The array to slice. 35542 * @param {number} [start=0] The start position. 35543 * @param {number} [end=array.length] The end position. 35544 * @returns {Array} Returns the slice of `array`. 35545 */ 35546 function slice(array, start, end) { 35547 var length = array == null ? 0 : array.length; 35548 if (!length) { 35549 return []; 35550 } 35551 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 35552 start = 0; 35553 end = length; 35554 } 35555 else { 35556 start = start == null ? 0 : toInteger(start); 35557 end = end === undefined ? length : toInteger(end); 35558 } 35559 return baseSlice(array, start, end); 35560 } 35561 35562 /** 35563 * Uses a binary search to determine the lowest index at which `value` 35564 * should be inserted into `array` in order to maintain its sort order. 35565 * 35566 * @static 35567 * @memberOf _ 35568 * @since 0.1.0 35569 * @category Array 35570 * @param {Array} array The sorted array to inspect. 35571 * @param {*} value The value to evaluate. 35572 * @returns {number} Returns the index at which `value` should be inserted 35573 * into `array`. 35574 * @example 35575 * 35576 * _.sortedIndex([30, 50], 40); 35577 * // => 1 35578 */ 35579 function sortedIndex(array, value) { 35580 return baseSortedIndex(array, value); 35581 } 35582 35583 /** 35584 * This method is like `_.sortedIndex` except that it accepts `iteratee` 35585 * which is invoked for `value` and each element of `array` to compute their 35586 * sort ranking. The iteratee is invoked with one argument: (value). 35587 * 35588 * @static 35589 * @memberOf _ 35590 * @since 4.0.0 35591 * @category Array 35592 * @param {Array} array The sorted array to inspect. 35593 * @param {*} value The value to evaluate. 35594 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35595 * @returns {number} Returns the index at which `value` should be inserted 35596 * into `array`. 35597 * @example 35598 * 35599 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 35600 * 35601 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 35602 * // => 0 35603 * 35604 * // The `_.property` iteratee shorthand. 35605 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 35606 * // => 0 35607 */ 35608 function sortedIndexBy(array, value, iteratee) { 35609 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 35610 } 35611 35612 /** 35613 * This method is like `_.indexOf` except that it performs a binary 35614 * search on a sorted `array`. 35615 * 35616 * @static 35617 * @memberOf _ 35618 * @since 4.0.0 35619 * @category Array 35620 * @param {Array} array The array to inspect. 35621 * @param {*} value The value to search for. 35622 * @returns {number} Returns the index of the matched value, else `-1`. 35623 * @example 35624 * 35625 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 35626 * // => 1 35627 */ 35628 function sortedIndexOf(array, value) { 35629 var length = array == null ? 0 : array.length; 35630 if (length) { 35631 var index = baseSortedIndex(array, value); 35632 if (index < length && eq(array[index], value)) { 35633 return index; 35634 } 35635 } 35636 return -1; 35637 } 35638 35639 /** 35640 * This method is like `_.sortedIndex` except that it returns the highest 35641 * index at which `value` should be inserted into `array` in order to 35642 * maintain its sort order. 35643 * 35644 * @static 35645 * @memberOf _ 35646 * @since 3.0.0 35647 * @category Array 35648 * @param {Array} array The sorted array to inspect. 35649 * @param {*} value The value to evaluate. 35650 * @returns {number} Returns the index at which `value` should be inserted 35651 * into `array`. 35652 * @example 35653 * 35654 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 35655 * // => 4 35656 */ 35657 function sortedLastIndex(array, value) { 35658 return baseSortedIndex(array, value, true); 35659 } 35660 35661 /** 35662 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 35663 * which is invoked for `value` and each element of `array` to compute their 35664 * sort ranking. The iteratee is invoked with one argument: (value). 35665 * 35666 * @static 35667 * @memberOf _ 35668 * @since 4.0.0 35669 * @category Array 35670 * @param {Array} array The sorted array to inspect. 35671 * @param {*} value The value to evaluate. 35672 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35673 * @returns {number} Returns the index at which `value` should be inserted 35674 * into `array`. 35675 * @example 35676 * 35677 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 35678 * 35679 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 35680 * // => 1 35681 * 35682 * // The `_.property` iteratee shorthand. 35683 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 35684 * // => 1 35685 */ 35686 function sortedLastIndexBy(array, value, iteratee) { 35687 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 35688 } 35689 35690 /** 35691 * This method is like `_.lastIndexOf` except that it performs a binary 35692 * search on a sorted `array`. 35693 * 35694 * @static 35695 * @memberOf _ 35696 * @since 4.0.0 35697 * @category Array 35698 * @param {Array} array The array to inspect. 35699 * @param {*} value The value to search for. 35700 * @returns {number} Returns the index of the matched value, else `-1`. 35701 * @example 35702 * 35703 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 35704 * // => 3 35705 */ 35706 function sortedLastIndexOf(array, value) { 35707 var length = array == null ? 0 : array.length; 35708 if (length) { 35709 var index = baseSortedIndex(array, value, true) - 1; 35710 if (eq(array[index], value)) { 35711 return index; 35712 } 35713 } 35714 return -1; 35715 } 35716 35717 /** 35718 * This method is like `_.uniq` except that it's designed and optimized 35719 * for sorted arrays. 35720 * 35721 * @static 35722 * @memberOf _ 35723 * @since 4.0.0 35724 * @category Array 35725 * @param {Array} array The array to inspect. 35726 * @returns {Array} Returns the new duplicate free array. 35727 * @example 35728 * 35729 * _.sortedUniq([1, 1, 2]); 35730 * // => [1, 2] 35731 */ 35732 function sortedUniq(array) { 35733 return (array && array.length) 35734 ? baseSortedUniq(array) 35735 : []; 35736 } 35737 35738 /** 35739 * This method is like `_.uniqBy` except that it's designed and optimized 35740 * for sorted arrays. 35741 * 35742 * @static 35743 * @memberOf _ 35744 * @since 4.0.0 35745 * @category Array 35746 * @param {Array} array The array to inspect. 35747 * @param {Function} [iteratee] The iteratee invoked per element. 35748 * @returns {Array} Returns the new duplicate free array. 35749 * @example 35750 * 35751 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 35752 * // => [1.1, 2.3] 35753 */ 35754 function sortedUniqBy(array, iteratee) { 35755 return (array && array.length) 35756 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 35757 : []; 35758 } 35759 35760 /** 35761 * Gets all but the first element of `array`. 35762 * 35763 * @static 35764 * @memberOf _ 35765 * @since 4.0.0 35766 * @category Array 35767 * @param {Array} array The array to query. 35768 * @returns {Array} Returns the slice of `array`. 35769 * @example 35770 * 35771 * _.tail([1, 2, 3]); 35772 * // => [2, 3] 35773 */ 35774 function tail(array) { 35775 var length = array == null ? 0 : array.length; 35776 return length ? baseSlice(array, 1, length) : []; 35777 } 35778 35779 /** 35780 * Creates a slice of `array` with `n` elements taken from the beginning. 35781 * 35782 * @static 35783 * @memberOf _ 35784 * @since 0.1.0 35785 * @category Array 35786 * @param {Array} array The array to query. 35787 * @param {number} [n=1] The number of elements to take. 35788 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 35789 * @returns {Array} Returns the slice of `array`. 35790 * @example 35791 * 35792 * _.take([1, 2, 3]); 35793 * // => [1] 35794 * 35795 * _.take([1, 2, 3], 2); 35796 * // => [1, 2] 35797 * 35798 * _.take([1, 2, 3], 5); 35799 * // => [1, 2, 3] 35800 * 35801 * _.take([1, 2, 3], 0); 35802 * // => [] 35803 */ 35804 function take(array, n, guard) { 35805 if (!(array && array.length)) { 35806 return []; 35807 } 35808 n = (guard || n === undefined) ? 1 : toInteger(n); 35809 return baseSlice(array, 0, n < 0 ? 0 : n); 35810 } 35811 35812 /** 35813 * Creates a slice of `array` with `n` elements taken from the end. 35814 * 35815 * @static 35816 * @memberOf _ 35817 * @since 3.0.0 35818 * @category Array 35819 * @param {Array} array The array to query. 35820 * @param {number} [n=1] The number of elements to take. 35821 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 35822 * @returns {Array} Returns the slice of `array`. 35823 * @example 35824 * 35825 * _.takeRight([1, 2, 3]); 35826 * // => [3] 35827 * 35828 * _.takeRight([1, 2, 3], 2); 35829 * // => [2, 3] 35830 * 35831 * _.takeRight([1, 2, 3], 5); 35832 * // => [1, 2, 3] 35833 * 35834 * _.takeRight([1, 2, 3], 0); 35835 * // => [] 35836 */ 35837 function takeRight(array, n, guard) { 35838 var length = array == null ? 0 : array.length; 35839 if (!length) { 35840 return []; 35841 } 35842 n = (guard || n === undefined) ? 1 : toInteger(n); 35843 n = length - n; 35844 return baseSlice(array, n < 0 ? 0 : n, length); 35845 } 35846 35847 /** 35848 * Creates a slice of `array` with elements taken from the end. Elements are 35849 * taken until `predicate` returns falsey. The predicate is invoked with 35850 * three arguments: (value, index, array). 35851 * 35852 * @static 35853 * @memberOf _ 35854 * @since 3.0.0 35855 * @category Array 35856 * @param {Array} array The array to query. 35857 * @param {Function} [predicate=_.identity] The function invoked per iteration. 35858 * @returns {Array} Returns the slice of `array`. 35859 * @example 35860 * 35861 * var users = [ 35862 * { 'user': 'barney', 'active': true }, 35863 * { 'user': 'fred', 'active': false }, 35864 * { 'user': 'pebbles', 'active': false } 35865 * ]; 35866 * 35867 * _.takeRightWhile(users, function(o) { return !o.active; }); 35868 * // => objects for ['fred', 'pebbles'] 35869 * 35870 * // The `_.matches` iteratee shorthand. 35871 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 35872 * // => objects for ['pebbles'] 35873 * 35874 * // The `_.matchesProperty` iteratee shorthand. 35875 * _.takeRightWhile(users, ['active', false]); 35876 * // => objects for ['fred', 'pebbles'] 35877 * 35878 * // The `_.property` iteratee shorthand. 35879 * _.takeRightWhile(users, 'active'); 35880 * // => [] 35881 */ 35882 function takeRightWhile(array, predicate) { 35883 return (array && array.length) 35884 ? baseWhile(array, getIteratee(predicate, 3), false, true) 35885 : []; 35886 } 35887 35888 /** 35889 * Creates a slice of `array` with elements taken from the beginning. Elements 35890 * are taken until `predicate` returns falsey. The predicate is invoked with 35891 * three arguments: (value, index, array). 35892 * 35893 * @static 35894 * @memberOf _ 35895 * @since 3.0.0 35896 * @category Array 35897 * @param {Array} array The array to query. 35898 * @param {Function} [predicate=_.identity] The function invoked per iteration. 35899 * @returns {Array} Returns the slice of `array`. 35900 * @example 35901 * 35902 * var users = [ 35903 * { 'user': 'barney', 'active': false }, 35904 * { 'user': 'fred', 'active': false }, 35905 * { 'user': 'pebbles', 'active': true } 35906 * ]; 35907 * 35908 * _.takeWhile(users, function(o) { return !o.active; }); 35909 * // => objects for ['barney', 'fred'] 35910 * 35911 * // The `_.matches` iteratee shorthand. 35912 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 35913 * // => objects for ['barney'] 35914 * 35915 * // The `_.matchesProperty` iteratee shorthand. 35916 * _.takeWhile(users, ['active', false]); 35917 * // => objects for ['barney', 'fred'] 35918 * 35919 * // The `_.property` iteratee shorthand. 35920 * _.takeWhile(users, 'active'); 35921 * // => [] 35922 */ 35923 function takeWhile(array, predicate) { 35924 return (array && array.length) 35925 ? baseWhile(array, getIteratee(predicate, 3)) 35926 : []; 35927 } 35928 35929 /** 35930 * Creates an array of unique values, in order, from all given arrays using 35931 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 35932 * for equality comparisons. 35933 * 35934 * @static 35935 * @memberOf _ 35936 * @since 0.1.0 35937 * @category Array 35938 * @param {...Array} [arrays] The arrays to inspect. 35939 * @returns {Array} Returns the new array of combined values. 35940 * @example 35941 * 35942 * _.union([2], [1, 2]); 35943 * // => [2, 1] 35944 */ 35945 var union = baseRest(function(arrays) { 35946 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 35947 }); 35948 35949 /** 35950 * This method is like `_.union` except that it accepts `iteratee` which is 35951 * invoked for each element of each `arrays` to generate the criterion by 35952 * which uniqueness is computed. Result values are chosen from the first 35953 * array in which the value occurs. The iteratee is invoked with one argument: 35954 * (value). 35955 * 35956 * @static 35957 * @memberOf _ 35958 * @since 4.0.0 35959 * @category Array 35960 * @param {...Array} [arrays] The arrays to inspect. 35961 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35962 * @returns {Array} Returns the new array of combined values. 35963 * @example 35964 * 35965 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 35966 * // => [2.1, 1.2] 35967 * 35968 * // The `_.property` iteratee shorthand. 35969 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 35970 * // => [{ 'x': 1 }, { 'x': 2 }] 35971 */ 35972 var unionBy = baseRest(function(arrays) { 35973 var iteratee = last(arrays); 35974 if (isArrayLikeObject(iteratee)) { 35975 iteratee = undefined; 35976 } 35977 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 35978 }); 35979 35980 /** 35981 * This method is like `_.union` except that it accepts `comparator` which 35982 * is invoked to compare elements of `arrays`. Result values are chosen from 35983 * the first array in which the value occurs. The comparator is invoked 35984 * with two arguments: (arrVal, othVal). 35985 * 35986 * @static 35987 * @memberOf _ 35988 * @since 4.0.0 35989 * @category Array 35990 * @param {...Array} [arrays] The arrays to inspect. 35991 * @param {Function} [comparator] The comparator invoked per element. 35992 * @returns {Array} Returns the new array of combined values. 35993 * @example 35994 * 35995 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 35996 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 35997 * 35998 * _.unionWith(objects, others, _.isEqual); 35999 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 36000 */ 36001 var unionWith = baseRest(function(arrays) { 36002 var comparator = last(arrays); 36003 comparator = typeof comparator == 'function' ? comparator : undefined; 36004 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 36005 }); 36006 36007 /** 36008 * Creates a duplicate-free version of an array, using 36009 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 36010 * for equality comparisons, in which only the first occurrence of each element 36011 * is kept. The order of result values is determined by the order they occur 36012 * in the array. 36013 * 36014 * @static 36015 * @memberOf _ 36016 * @since 0.1.0 36017 * @category Array 36018 * @param {Array} array The array to inspect. 36019 * @returns {Array} Returns the new duplicate free array. 36020 * @example 36021 * 36022 * _.uniq([2, 1, 2]); 36023 * // => [2, 1] 36024 */ 36025 function uniq(array) { 36026 return (array && array.length) ? baseUniq(array) : []; 36027 } 36028 36029 /** 36030 * This method is like `_.uniq` except that it accepts `iteratee` which is 36031 * invoked for each element in `array` to generate the criterion by which 36032 * uniqueness is computed. The order of result values is determined by the 36033 * order they occur in the array. The iteratee is invoked with one argument: 36034 * (value). 36035 * 36036 * @static 36037 * @memberOf _ 36038 * @since 4.0.0 36039 * @category Array 36040 * @param {Array} array The array to inspect. 36041 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36042 * @returns {Array} Returns the new duplicate free array. 36043 * @example 36044 * 36045 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 36046 * // => [2.1, 1.2] 36047 * 36048 * // The `_.property` iteratee shorthand. 36049 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 36050 * // => [{ 'x': 1 }, { 'x': 2 }] 36051 */ 36052 function uniqBy(array, iteratee) { 36053 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 36054 } 36055 36056 /** 36057 * This method is like `_.uniq` except that it accepts `comparator` which 36058 * is invoked to compare elements of `array`. The order of result values is 36059 * determined by the order they occur in the array.The comparator is invoked 36060 * with two arguments: (arrVal, othVal). 36061 * 36062 * @static 36063 * @memberOf _ 36064 * @since 4.0.0 36065 * @category Array 36066 * @param {Array} array The array to inspect. 36067 * @param {Function} [comparator] The comparator invoked per element. 36068 * @returns {Array} Returns the new duplicate free array. 36069 * @example 36070 * 36071 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 36072 * 36073 * _.uniqWith(objects, _.isEqual); 36074 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 36075 */ 36076 function uniqWith(array, comparator) { 36077 comparator = typeof comparator == 'function' ? comparator : undefined; 36078 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 36079 } 36080 36081 /** 36082 * This method is like `_.zip` except that it accepts an array of grouped 36083 * elements and creates an array regrouping the elements to their pre-zip 36084 * configuration. 36085 * 36086 * @static 36087 * @memberOf _ 36088 * @since 1.2.0 36089 * @category Array 36090 * @param {Array} array The array of grouped elements to process. 36091 * @returns {Array} Returns the new array of regrouped elements. 36092 * @example 36093 * 36094 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 36095 * // => [['a', 1, true], ['b', 2, false]] 36096 * 36097 * _.unzip(zipped); 36098 * // => [['a', 'b'], [1, 2], [true, false]] 36099 */ 36100 function unzip(array) { 36101 if (!(array && array.length)) { 36102 return []; 36103 } 36104 var length = 0; 36105 array = arrayFilter(array, function(group) { 36106 if (isArrayLikeObject(group)) { 36107 length = nativeMax(group.length, length); 36108 return true; 36109 } 36110 }); 36111 return baseTimes(length, function(index) { 36112 return arrayMap(array, baseProperty(index)); 36113 }); 36114 } 36115 36116 /** 36117 * This method is like `_.unzip` except that it accepts `iteratee` to specify 36118 * how regrouped values should be combined. The iteratee is invoked with the 36119 * elements of each group: (...group). 36120 * 36121 * @static 36122 * @memberOf _ 36123 * @since 3.8.0 36124 * @category Array 36125 * @param {Array} array The array of grouped elements to process. 36126 * @param {Function} [iteratee=_.identity] The function to combine 36127 * regrouped values. 36128 * @returns {Array} Returns the new array of regrouped elements. 36129 * @example 36130 * 36131 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 36132 * // => [[1, 10, 100], [2, 20, 200]] 36133 * 36134 * _.unzipWith(zipped, _.add); 36135 * // => [3, 30, 300] 36136 */ 36137 function unzipWith(array, iteratee) { 36138 if (!(array && array.length)) { 36139 return []; 36140 } 36141 var result = unzip(array); 36142 if (iteratee == null) { 36143 return result; 36144 } 36145 return arrayMap(result, function(group) { 36146 return apply(iteratee, undefined, group); 36147 }); 36148 } 36149 36150 /** 36151 * Creates an array excluding all given values using 36152 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 36153 * for equality comparisons. 36154 * 36155 * **Note:** Unlike `_.pull`, this method returns a new array. 36156 * 36157 * @static 36158 * @memberOf _ 36159 * @since 0.1.0 36160 * @category Array 36161 * @param {Array} array The array to inspect. 36162 * @param {...*} [values] The values to exclude. 36163 * @returns {Array} Returns the new array of filtered values. 36164 * @see _.difference, _.xor 36165 * @example 36166 * 36167 * _.without([2, 1, 2, 3], 1, 2); 36168 * // => [3] 36169 */ 36170 var without = baseRest(function(array, values) { 36171 return isArrayLikeObject(array) 36172 ? baseDifference(array, values) 36173 : []; 36174 }); 36175 36176 /** 36177 * Creates an array of unique values that is the 36178 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 36179 * of the given arrays. The order of result values is determined by the order 36180 * they occur in the arrays. 36181 * 36182 * @static 36183 * @memberOf _ 36184 * @since 2.4.0 36185 * @category Array 36186 * @param {...Array} [arrays] The arrays to inspect. 36187 * @returns {Array} Returns the new array of filtered values. 36188 * @see _.difference, _.without 36189 * @example 36190 * 36191 * _.xor([2, 1], [2, 3]); 36192 * // => [1, 3] 36193 */ 36194 var xor = baseRest(function(arrays) { 36195 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 36196 }); 36197 36198 /** 36199 * This method is like `_.xor` except that it accepts `iteratee` which is 36200 * invoked for each element of each `arrays` to generate the criterion by 36201 * which by which they're compared. The order of result values is determined 36202 * by the order they occur in the arrays. The iteratee is invoked with one 36203 * argument: (value). 36204 * 36205 * @static 36206 * @memberOf _ 36207 * @since 4.0.0 36208 * @category Array 36209 * @param {...Array} [arrays] The arrays to inspect. 36210 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36211 * @returns {Array} Returns the new array of filtered values. 36212 * @example 36213 * 36214 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 36215 * // => [1.2, 3.4] 36216 * 36217 * // The `_.property` iteratee shorthand. 36218 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 36219 * // => [{ 'x': 2 }] 36220 */ 36221 var xorBy = baseRest(function(arrays) { 36222 var iteratee = last(arrays); 36223 if (isArrayLikeObject(iteratee)) { 36224 iteratee = undefined; 36225 } 36226 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 36227 }); 36228 36229 /** 36230 * This method is like `_.xor` except that it accepts `comparator` which is 36231 * invoked to compare elements of `arrays`. The order of result values is 36232 * determined by the order they occur in the arrays. The comparator is invoked 36233 * with two arguments: (arrVal, othVal). 36234 * 36235 * @static 36236 * @memberOf _ 36237 * @since 4.0.0 36238 * @category Array 36239 * @param {...Array} [arrays] The arrays to inspect. 36240 * @param {Function} [comparator] The comparator invoked per element. 36241 * @returns {Array} Returns the new array of filtered values. 36242 * @example 36243 * 36244 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 36245 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 36246 * 36247 * _.xorWith(objects, others, _.isEqual); 36248 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 36249 */ 36250 var xorWith = baseRest(function(arrays) { 36251 var comparator = last(arrays); 36252 comparator = typeof comparator == 'function' ? comparator : undefined; 36253 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 36254 }); 36255 36256 /** 36257 * Creates an array of grouped elements, the first of which contains the 36258 * first elements of the given arrays, the second of which contains the 36259 * second elements of the given arrays, and so on. 36260 * 36261 * @static 36262 * @memberOf _ 36263 * @since 0.1.0 36264 * @category Array 36265 * @param {...Array} [arrays] The arrays to process. 36266 * @returns {Array} Returns the new array of grouped elements. 36267 * @example 36268 * 36269 * _.zip(['a', 'b'], [1, 2], [true, false]); 36270 * // => [['a', 1, true], ['b', 2, false]] 36271 */ 36272 var zip = baseRest(unzip); 36273 36274 /** 36275 * This method is like `_.fromPairs` except that it accepts two arrays, 36276 * one of property identifiers and one of corresponding values. 36277 * 36278 * @static 36279 * @memberOf _ 36280 * @since 0.4.0 36281 * @category Array 36282 * @param {Array} [props=[]] The property identifiers. 36283 * @param {Array} [values=[]] The property values. 36284 * @returns {Object} Returns the new object. 36285 * @example 36286 * 36287 * _.zipObject(['a', 'b'], [1, 2]); 36288 * // => { 'a': 1, 'b': 2 } 36289 */ 36290 function zipObject(props, values) { 36291 return baseZipObject(props || [], values || [], assignValue); 36292 } 36293 36294 /** 36295 * This method is like `_.zipObject` except that it supports property paths. 36296 * 36297 * @static 36298 * @memberOf _ 36299 * @since 4.1.0 36300 * @category Array 36301 * @param {Array} [props=[]] The property identifiers. 36302 * @param {Array} [values=[]] The property values. 36303 * @returns {Object} Returns the new object. 36304 * @example 36305 * 36306 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 36307 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 36308 */ 36309 function zipObjectDeep(props, values) { 36310 return baseZipObject(props || [], values || [], baseSet); 36311 } 36312 36313 /** 36314 * This method is like `_.zip` except that it accepts `iteratee` to specify 36315 * how grouped values should be combined. The iteratee is invoked with the 36316 * elements of each group: (...group). 36317 * 36318 * @static 36319 * @memberOf _ 36320 * @since 3.8.0 36321 * @category Array 36322 * @param {...Array} [arrays] The arrays to process. 36323 * @param {Function} [iteratee=_.identity] The function to combine 36324 * grouped values. 36325 * @returns {Array} Returns the new array of grouped elements. 36326 * @example 36327 * 36328 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 36329 * return a + b + c; 36330 * }); 36331 * // => [111, 222] 36332 */ 36333 var zipWith = baseRest(function(arrays) { 36334 var length = arrays.length, 36335 iteratee = length > 1 ? arrays[length - 1] : undefined; 36336 36337 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 36338 return unzipWith(arrays, iteratee); 36339 }); 36340 36341 /*------------------------------------------------------------------------*/ 36342 36343 /** 36344 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 36345 * chain sequences enabled. The result of such sequences must be unwrapped 36346 * with `_#value`. 36347 * 36348 * @static 36349 * @memberOf _ 36350 * @since 1.3.0 36351 * @category Seq 36352 * @param {*} value The value to wrap. 36353 * @returns {Object} Returns the new `lodash` wrapper instance. 36354 * @example 36355 * 36356 * var users = [ 36357 * { 'user': 'barney', 'age': 36 }, 36358 * { 'user': 'fred', 'age': 40 }, 36359 * { 'user': 'pebbles', 'age': 1 } 36360 * ]; 36361 * 36362 * var youngest = _ 36363 * .chain(users) 36364 * .sortBy('age') 36365 * .map(function(o) { 36366 * return o.user + ' is ' + o.age; 36367 * }) 36368 * .head() 36369 * .value(); 36370 * // => 'pebbles is 1' 36371 */ 36372 function chain(value) { 36373 var result = lodash(value); 36374 result.__chain__ = true; 36375 return result; 36376 } 36377 36378 /** 36379 * This method invokes `interceptor` and returns `value`. The interceptor 36380 * is invoked with one argument; (value). The purpose of this method is to 36381 * "tap into" a method chain sequence in order to modify intermediate results. 36382 * 36383 * @static 36384 * @memberOf _ 36385 * @since 0.1.0 36386 * @category Seq 36387 * @param {*} value The value to provide to `interceptor`. 36388 * @param {Function} interceptor The function to invoke. 36389 * @returns {*} Returns `value`. 36390 * @example 36391 * 36392 * _([1, 2, 3]) 36393 * .tap(function(array) { 36394 * // Mutate input array. 36395 * array.pop(); 36396 * }) 36397 * .reverse() 36398 * .value(); 36399 * // => [2, 1] 36400 */ 36401 function tap(value, interceptor) { 36402 interceptor(value); 36403 return value; 36404 } 36405 36406 /** 36407 * This method is like `_.tap` except that it returns the result of `interceptor`. 36408 * The purpose of this method is to "pass thru" values replacing intermediate 36409 * results in a method chain sequence. 36410 * 36411 * @static 36412 * @memberOf _ 36413 * @since 3.0.0 36414 * @category Seq 36415 * @param {*} value The value to provide to `interceptor`. 36416 * @param {Function} interceptor The function to invoke. 36417 * @returns {*} Returns the result of `interceptor`. 36418 * @example 36419 * 36420 * _(' abc ') 36421 * .chain() 36422 * .trim() 36423 * .thru(function(value) { 36424 * return [value]; 36425 * }) 36426 * .value(); 36427 * // => ['abc'] 36428 */ 36429 function thru(value, interceptor) { 36430 return interceptor(value); 36431 } 36432 36433 /** 36434 * This method is the wrapper version of `_.at`. 36435 * 36436 * @name at 36437 * @memberOf _ 36438 * @since 1.0.0 36439 * @category Seq 36440 * @param {...(string|string[])} [paths] The property paths to pick. 36441 * @returns {Object} Returns the new `lodash` wrapper instance. 36442 * @example 36443 * 36444 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 36445 * 36446 * _(object).at(['a[0].b.c', 'a[1]']).value(); 36447 * // => [3, 4] 36448 */ 36449 var wrapperAt = flatRest(function(paths) { 36450 var length = paths.length, 36451 start = length ? paths[0] : 0, 36452 value = this.__wrapped__, 36453 interceptor = function(object) { return baseAt(object, paths); }; 36454 36455 if (length > 1 || this.__actions__.length || 36456 !(value instanceof LazyWrapper) || !isIndex(start)) { 36457 return this.thru(interceptor); 36458 } 36459 value = value.slice(start, +start + (length ? 1 : 0)); 36460 value.__actions__.push({ 36461 'func': thru, 36462 'args': [interceptor], 36463 'thisArg': undefined 36464 }); 36465 return new LodashWrapper(value, this.__chain__).thru(function(array) { 36466 if (length && !array.length) { 36467 array.push(undefined); 36468 } 36469 return array; 36470 }); 36471 }); 36472 36473 /** 36474 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 36475 * 36476 * @name chain 36477 * @memberOf _ 36478 * @since 0.1.0 36479 * @category Seq 36480 * @returns {Object} Returns the new `lodash` wrapper instance. 36481 * @example 36482 * 36483 * var users = [ 36484 * { 'user': 'barney', 'age': 36 }, 36485 * { 'user': 'fred', 'age': 40 } 36486 * ]; 36487 * 36488 * // A sequence without explicit chaining. 36489 * _(users).head(); 36490 * // => { 'user': 'barney', 'age': 36 } 36491 * 36492 * // A sequence with explicit chaining. 36493 * _(users) 36494 * .chain() 36495 * .head() 36496 * .pick('user') 36497 * .value(); 36498 * // => { 'user': 'barney' } 36499 */ 36500 function wrapperChain() { 36501 return chain(this); 36502 } 36503 36504 /** 36505 * Executes the chain sequence and returns the wrapped result. 36506 * 36507 * @name commit 36508 * @memberOf _ 36509 * @since 3.2.0 36510 * @category Seq 36511 * @returns {Object} Returns the new `lodash` wrapper instance. 36512 * @example 36513 * 36514 * var array = [1, 2]; 36515 * var wrapped = _(array).push(3); 36516 * 36517 * console.log(array); 36518 * // => [1, 2] 36519 * 36520 * wrapped = wrapped.commit(); 36521 * console.log(array); 36522 * // => [1, 2, 3] 36523 * 36524 * wrapped.last(); 36525 * // => 3 36526 * 36527 * console.log(array); 36528 * // => [1, 2, 3] 36529 */ 36530 function wrapperCommit() { 36531 return new LodashWrapper(this.value(), this.__chain__); 36532 } 36533 36534 /** 36535 * Gets the next value on a wrapped object following the 36536 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 36537 * 36538 * @name next 36539 * @memberOf _ 36540 * @since 4.0.0 36541 * @category Seq 36542 * @returns {Object} Returns the next iterator value. 36543 * @example 36544 * 36545 * var wrapped = _([1, 2]); 36546 * 36547 * wrapped.next(); 36548 * // => { 'done': false, 'value': 1 } 36549 * 36550 * wrapped.next(); 36551 * // => { 'done': false, 'value': 2 } 36552 * 36553 * wrapped.next(); 36554 * // => { 'done': true, 'value': undefined } 36555 */ 36556 function wrapperNext() { 36557 if (this.__values__ === undefined) { 36558 this.__values__ = toArray(this.value()); 36559 } 36560 var done = this.__index__ >= this.__values__.length, 36561 value = done ? undefined : this.__values__[this.__index__++]; 36562 36563 return { 'done': done, 'value': value }; 36564 } 36565 36566 /** 36567 * Enables the wrapper to be iterable. 36568 * 36569 * @name Symbol.iterator 36570 * @memberOf _ 36571 * @since 4.0.0 36572 * @category Seq 36573 * @returns {Object} Returns the wrapper object. 36574 * @example 36575 * 36576 * var wrapped = _([1, 2]); 36577 * 36578 * wrapped[Symbol.iterator]() === wrapped; 36579 * // => true 36580 * 36581 * Array.from(wrapped); 36582 * // => [1, 2] 36583 */ 36584 function wrapperToIterator() { 36585 return this; 36586 } 36587 36588 /** 36589 * Creates a clone of the chain sequence planting `value` as the wrapped value. 36590 * 36591 * @name plant 36592 * @memberOf _ 36593 * @since 3.2.0 36594 * @category Seq 36595 * @param {*} value The value to plant. 36596 * @returns {Object} Returns the new `lodash` wrapper instance. 36597 * @example 36598 * 36599 * function square(n) { 36600 * return n * n; 36601 * } 36602 * 36603 * var wrapped = _([1, 2]).map(square); 36604 * var other = wrapped.plant([3, 4]); 36605 * 36606 * other.value(); 36607 * // => [9, 16] 36608 * 36609 * wrapped.value(); 36610 * // => [1, 4] 36611 */ 36612 function wrapperPlant(value) { 36613 var result, 36614 parent = this; 36615 36616 while (parent instanceof baseLodash) { 36617 var clone = wrapperClone(parent); 36618 clone.__index__ = 0; 36619 clone.__values__ = undefined; 36620 if (result) { 36621 previous.__wrapped__ = clone; 36622 } else { 36623 result = clone; 36624 } 36625 var previous = clone; 36626 parent = parent.__wrapped__; 36627 } 36628 previous.__wrapped__ = value; 36629 return result; 36630 } 36631 36632 /** 36633 * This method is the wrapper version of `_.reverse`. 36634 * 36635 * **Note:** This method mutates the wrapped array.
36636 * 36637 * @name reverse 36638 * @memberOf _ 36639 * @since 0.1.0 36640 * @category Seq 36641 * @returns {Object} Returns the new `lodash` wrapper instance. 36642 * @example 36643 * 36644 * var array = [1, 2, 3]; 36645 * 36646 * _(array).reverse().value() 36647 * // => [3, 2, 1] 36648 * 36649 * console.log(array); 36650 * // => [3, 2, 1] 36651 */ 36652 function wrapperReverse() { 36653 var value = this.__wrapped__; 36654 if (value instanceof LazyWrapper) { 36655 var wrapped = value; 36656 if (this.__actions__.length) { 36657 wrapped = new LazyWrapper(this); 36658 } 36659 wrapped = wrapped.reverse(); 36660 wrapped.__actions__.push({ 36661 'func': thru, 36662 'args': [reverse], 36663 'thisArg': undefined 36664 }); 36665 return new LodashWrapper(wrapped, this.__chain__); 36666 } 36667 return this.thru(reverse); 36668 } 36669 36670 /** 36671 * Executes the chain sequence to resolve the unwrapped value. 36672 * 36673 * @name value 36674 * @memberOf _ 36675 * @since 0.1.0 36676 * @alias toJSON, valueOf 36677 * @category Seq 36678 * @returns {*} Returns the resolved unwrapped value. 36679 * @example 36680 * 36681 * _([1, 2, 3]).value(); 36682 * // => [1, 2, 3] 36683 */ 36684 function wrapperValue() { 36685 return baseWrapperValue(this.__wrapped__, this.__actions__); 36686 } 36687 36688 /*------------------------------------------------------------------------*/ 36689 36690 /**
36691 * Creates an object composed of keys generated from the results of running 36692 * each element of `collection` thru `iteratee`. The corresponding value of 36693 * each key is the number of times the key was returned by `iteratee`. The 36694 * iteratee is invoked with one argument: (value). 36695 * 36696 * @static 36697 * @memberOf _ 36698 * @since 0.5.0 36699 * @category Collection 36700 * @param {Array|Object} collection The collection to iterate over. 36701 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 36702 * @returns {Object} Returns the composed aggregate object. 36703 * @example 36704 * 36705 * _.countBy([6.1, 4.2, 6.3], Math.floor); 36706 * // => { '4': 1, '6': 2 } 36707 * 36708 * // The `_.property` iteratee shorthand. 36709 * _.countBy(['one', 'two', 'three'], 'length'); 36710 * // => { '3': 2, '5': 1 } 36711 */ 36712 var countBy = createAggregator(function(result, value, key) { 36713 if (hasOwnProperty.call(result, key)) { 36714 ++result[key]; 36715 } else { 36716 baseAssignValue(result, key, 1); 36717 } 36718 }); 36719 36720 /** 36721 * Checks if `predicate` returns truthy for **all** elements of `collection`. 36722 * Iteration is stopped once `predicate` returns falsey. The predicate is 36723 * invoked with three arguments: (value, index|key, collection). 36724 * 36725 * **Note:** This method returns `true` for 36726 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 36727 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 36728 * elements of empty collections. 36729 * 36730 * @static 36731 * @memberOf _ 36732 * @since 0.1.0 36733 * @category Collection 36734 * @param {Array|Object} collection The collection to iterate over. 36735 * @param {Function} [predicate=_.identity] The function invoked per iteration. 36736 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 36737 * @returns {boolean} Returns `true` if all elements pass the predicate check, 36738 * else `false`. 36739 * @example 36740 * 36741 * _.every([true, 1, null, 'yes'], Boolean); 36742 * // => false 36743 * 36744 * var users = [ 36745 * { 'user': 'barney', 'age': 36, 'active': false }, 36746 * { 'user': 'fred', 'age': 40, 'active': false } 36747 * ]; 36748 * 36749 * // The `_.matches` iteratee shorthand. 36750 * _.every(users, { 'user': 'barney', 'active': false }); 36751 * // => false 36752 * 36753 * // The `_.matchesProperty` iteratee shorthand. 36754 * _.every(users, ['active', false]); 36755 * // => true 36756 * 36757 * // The `_.property` iteratee shorthand. 36758 * _.every(users, 'active'); 36759 * // => false 36760 */ 36761 function every(collection, predicate, guard) { 36762 var func = isArray(collection) ? arrayEvery : baseEvery; 36763 if (guard && isIterateeCall(collection, predicate, guard)) { 36764 predicate = undefined; 36765 } 36766 return func(collection, getIteratee(predicate, 3)); 36767 } 36768 36769 /** 36770 * Iterates over elements of `collection`, returning an array of all elements 36771 * `predicate` returns truthy for. The predicate is invoked with three 36772 * arguments: (value, index|key, collection). 36773 * 36774 * **Note:** Unlike `_.remove`, this method returns a new array. 36775 * 36776 * @static 36777 * @memberOf _ 36778 * @since 0.1.0 36779 * @category Collection 36780 * @param {Array|Object} collection The collection to iterate over. 36781 * @param {Function} [predicate=_.identity] The function invoked per iteration. 36782 * @returns {Array} Returns the new filtered array. 36783 * @see _.reject 36784 * @example 36785 * 36786 * var users = [ 36787 * { 'user': 'barney', 'age': 36, 'active': true }, 36788 * { 'user': 'fred', 'age': 40, 'active': false } 36789 * ]; 36790 * 36791 * _.filter(users, function(o) { return !o.active; }); 36792 * // => objects for ['fred'] 36793 * 36794 * // The `_.matches` iteratee shorthand. 36795 * _.filter(users, { 'age': 36, 'active': true }); 36796 * // => objects for ['barney'] 36797 * 36798 * // The `_.matchesProperty` iteratee shorthand. 36799 * _.filter(users, ['active', false]); 36800 * // => objects for ['fred'] 36801 * 36802 * // The `_.property` iteratee shorthand. 36803 * _.filter(users, 'active'); 36804 * // => objects for ['barney'] 36805 */ 36806 function filter(collection, predicate) { 36807 var func = isArray(collection) ? arrayFilter : baseFilter; 36808 return func(collection, getIteratee(predicate, 3)); 36809 } 36810 36811 /** 36812 * Iterates over elements of `collection`, returning the first element 36813 * `predicate` returns truthy for. The predicate is invoked with three 36814 * arguments: (value, index|key, collection). 36815 * 36816 * @static 36817 * @memberOf _ 36818 * @since 0.1.0 36819 * @category Collection 36820 * @param {Array|Object} collection The collection to inspect. 36821 * @param {Function} [predicate=_.identity] The function invoked per iteration. 36822 * @param {number} [fromIndex=0] The index to search from. 36823 * @returns {*} Returns the matched element, else `undefined`. 36824 * @example 36825 * 36826 * var users = [ 36827 * { 'user': 'barney', 'age': 36, 'active': true }, 36828 * { 'user': 'fred', 'age': 40, 'active': false }, 36829 * { 'user': 'pebbles', 'age': 1, 'active': true } 36830 * ]; 36831 * 36832 * _.find(users, function(o) { return o.age < 40; }); 36833 * // => object for 'barney' 36834 * 36835 * // The `_.matches` iteratee shorthand. 36836 * _.find(users, { 'age': 1, 'active': true }); 36837 * // => object for 'pebbles' 36838 * 36839 * // The `_.matchesProperty` iteratee shorthand. 36840 * _.find(users, ['active', false]); 36841 * // => object for 'fred' 36842 * 36843 * // The `_.property` iteratee shorthand. 36844 * _.find(users, 'active'); 36845 * // => object for 'barney' 36846 */ 36847 var find = createFind(findIndex); 36848 36849 /** 36850 * This method is like `_.find` except that it iterates over elements of 36851 * `collection` from right to left. 36852 * 36853 * @static 36854 * @memberOf _ 36855 * @since 2.0.0 36856 * @category Collection 36857 * @param {Array|Object} collection The collection to inspect. 36858 * @param {Function} [predicate=_.identity] The function invoked per iteration. 36859 * @param {number} [fromIndex=collection.length-1] The index to search from. 36860 * @returns {*} Returns the matched element, else `undefined`. 36861 * @example 36862 * 36863 * _.findLast([1, 2, 3, 4], function(n) { 36864 * return n % 2 == 1; 36865 * }); 36866 * // => 3 36867 */ 36868 var findLast = createFind(findLastIndex); 36869 36870 /** 36871 * Creates a flattened array of values by running each element in `collection` 36872 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 36873 * with three arguments: (value, index|key, collection). 36874 * 36875 * @static 36876 * @memberOf _ 36877 * @since 4.0.0 36878 * @category Collection 36879 * @param {Array|Object} collection The collection to iterate over. 36880 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 36881 * @returns {Array} Returns the new flattened array.
36882 * @example 36883 * 36884 * function duplicate(n) { 36885 * return [n, n]; 36886 * } 36887 * 36888 * _.flatMap([1, 2], duplicate); 36889 * // => [1, 1, 2, 2] 36890 */ 36891 function flatMap(collection, iteratee) { 36892 return baseFlatten(map(collection, iteratee), 1); 36893 } 36894 36895 /** 36896 * This method is like `_.flatMap` except that it recursively flattens the 36897 * mapped results. 36898 * 36899 * @static 36900 * @memberOf _ 36901 * @since 4.7.0 36902 * @category Collection 36903 * @param {Array|Object} collection The collection to iterate over. 36904 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 36905 * @returns {Array} Returns the new flattened array. 36906 * @example 36907 * 36908 * function duplicate(n) { 36909 * return [[[n, n]]]; 36910 * } 36911 * 36912 * _.flatMapDeep([1, 2], duplicate); 36913 * // => [1, 1, 2, 2] 36914 */ 36915 function flatMapDeep(collection, iteratee) { 36916 return baseFlatten(map(collection, iteratee), INFINITY); 36917 } 36918 36919 /** 36920 * This method is like `_.flatMap` except that it recursively flattens the 36921 * mapped results up to `depth` times. 36922 * 36923 * @static 36924 * @memberOf _ 36925 * @since 4.7.0 36926 * @category Collection 36927 * @param {Array|Object} collection The collection to iterate over. 36928 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 36929 * @param {number} [depth=1] The maximum recursion depth. 36930 * @returns {Array} Returns the new flattened array. 36931 * @example 36932 * 36933 * function duplicate(n) { 36934 * return [[[n, n]]]; 36935 * } 36936 * 36937 * _.flatMapDepth([1, 2], duplicate, 2); 36938 * // => [[1, 1], [2, 2]] 36939 */ 36940 function flatMapDepth(collection, iteratee, depth) { 36941 depth = depth === undefined
vendor: 10,940 bytes, lines 36941-37228
36941 ? 1 : toInteger(depth); 36942 return baseFlatten(map(collection, iteratee), depth); 36943 } 36944 36945 /** 36946 * Iterates over elements of `collection` and invokes `iteratee` for each element. 36947 * The iteratee is invoked with three arguments: (value, index|key, collection). 36948 * Iteratee functions may exit iteration early by explicitly returning `false`. 36949 * 36950 * **Note:** As with other "Collections" methods, objects with a "length" 36951 * property are iterated like arrays. To avoid this behavior use `_.forIn` 36952 * or `_.forOwn` for object iteration. 36953 * 36954 * @static 36955 * @memberOf _ 36956 * @since 0.1.0 36957 * @alias each 36958 * @category Collection 36959 * @param {Array|Object} collection The collection to iterate over. 36960 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 36961 * @returns {Array|Object} Returns `collection`. 36962 * @see _.forEachRight 36963 * @example 36964 * 36965 * _.forEach([1, 2], function(value) { 36966 * console.log(value); 36967 * }); 36968 * // => Logs `1` then `2`. 36969 * 36970 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 36971 * console.log(key); 36972 * }); 36973 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 36974 */ 36975 function forEach(collection, iteratee) { 36976 var func = isArray(collection) ? arrayEach : baseEach; 36977 return func(collection, getIteratee(iteratee, 3)); 36978 } 36979 36980 /** 36981 * This method is like `_.forEach` except that it iterates over elements of 36982 * `collection` from right to left. 36983 * 36984 * @static 36985 * @memberOf _ 36986 * @since 2.0.0 36987 * @alias eachRight 36988 * @category Collection 36989 * @param {Array|Object} collection The collection to iterate over. 36990 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 36991 * @returns {Array|Object} Returns `collection`. 36992 * @see _.forEach 36993 * @example 36994 * 36995 * _.forEachRight([1, 2], function(value) { 36996 * console.log(value); 36997 * }); 36998 * // => Logs `2` then `1`. 36999 */ 37000 function forEachRight(collection, iteratee) { 37001 var func = isArray(collection) ? arrayEachRight : baseEachRight; 37002 return func(collection, getIteratee(iteratee, 3)); 37003 } 37004 37005 /** 37006 * Creates an object composed of keys generated from the results of running 37007 * each element of `collection` thru `iteratee`. The order of grouped values 37008 * is determined by the order they occur in `collection`. The corresponding 37009 * value of each key is an array of elements responsible for generating the 37010 * key. The iteratee is invoked with one argument: (value). 37011 * 37012 * @static 37013 * @memberOf _ 37014 * @since 0.1.0 37015 * @category Collection 37016 * @param {Array|Object} collection The collection to iterate over. 37017 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 37018 * @returns {Object} Returns the composed aggregate object. 37019 * @example 37020 * 37021 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 37022 * // => { '4': [4.2], '6': [6.1, 6.3] } 37023 * 37024 * // The `_.property` iteratee shorthand. 37025 * _.groupBy(['one', 'two', 'three'], 'length'); 37026 * // => { '3': ['one', 'two'], '5': ['three'] } 37027 */ 37028 var groupBy = createAggregator(function(result, value, key) { 37029 if (hasOwnProperty.call(result, key)) { 37030 result[key].push(value); 37031 } else { 37032 baseAssignValue(result, key, [value]); 37033 } 37034 }); 37035 37036 /** 37037 * Checks if `value` is in `collection`. If `collection` is a string, it's 37038 * checked for a substring of `value`, otherwise 37039 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 37040 * is used for equality comparisons. If `fromIndex` is negative, it's used as 37041 * the offset from the end of `collection`. 37042 * 37043 * @static 37044 * @memberOf _ 37045 * @since 0.1.0 37046 * @category Collection 37047 * @param {Array|Object|string} collection The collection to inspect. 37048 * @param {*} value The value to search for. 37049 * @param {number} [fromIndex=0] The index to search from. 37050 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 37051 * @returns {boolean} Returns `true` if `value` is found, else `false`. 37052 * @example 37053 * 37054 * _.includes([1, 2, 3], 1); 37055 * // => true 37056 * 37057 * _.includes([1, 2, 3], 1, 2); 37058 * // => false 37059 * 37060 * _.includes({ 'a': 1, 'b': 2 }, 1); 37061 * // => true 37062 * 37063 * _.includes('abcd', 'bc'); 37064 * // => true 37065 */ 37066 function includes(collection, value, fromIndex, guard) { 37067 collection = isArrayLike(collection) ? collection : values(collection); 37068 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 37069 37070 var length = collection.length; 37071 if (fromIndex < 0) { 37072 fromIndex = nativeMax(length + fromIndex, 0); 37073 } 37074 return isString(collection) 37075 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 37076 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 37077 } 37078 37079 /** 37080 * Invokes the method at `path` of each element in `collection`, returning 37081 * an array of the results of each invoked method. Any additional arguments 37082 * are provided to each invoked method. If `path` is a function, it's invoked 37083 * for, and `this` bound to, each element in `collection`. 37084 * 37085 * @static 37086 * @memberOf _ 37087 * @since 4.0.0 37088 * @category Collection 37089 * @param {Array|Object} collection The collection to iterate over. 37090 * @param {Array|Function|string} path The path of the method to invoke or 37091 * the function invoked per iteration. 37092 * @param {...*} [args] The arguments to invoke each method with. 37093 * @returns {Array} Returns the array of results. 37094 * @example 37095 * 37096 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 37097 * // => [[1, 5, 7], [1, 2, 3]] 37098 * 37099 * _.invokeMap([123, 456], String.prototype.split, ''); 37100 * // => [['1', '2', '3'], ['4', '5', '6']] 37101 */ 37102 var invokeMap = baseRest(function(collection, path, args) { 37103 var index = -1, 37104 isFunc = typeof path == 'function', 37105 result = isArrayLike(collection) ? Array(collection.length) : []; 37106 37107 baseEach(collection, function(value) { 37108 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 37109 }); 37110 return result; 37111 }); 37112 37113 /** 37114 * Creates an object composed of keys generated from the results of running 37115 * each element of `collection` thru `iteratee`. The corresponding value of 37116 * each key is the last element responsible for generating the key. The 37117 * iteratee is invoked with one argument: (value). 37118 * 37119 * @static 37120 * @memberOf _ 37121 * @since 4.0.0 37122 * @category Collection 37123 * @param {Array|Object} collection The collection to iterate over. 37124 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 37125 * @returns {Object} Returns the composed aggregate object. 37126 * @example 37127 * 37128 * var array = [ 37129 * { 'dir': 'left', 'code': 97 }, 37130 * { 'dir': 'right', 'code': 100 } 37131 * ]; 37132 * 37133 * _.keyBy(array, function(o) { 37134 * return String.fromCharCode(o.code); 37135 * }); 37136 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 37137 * 37138 * _.keyBy(array, 'dir'); 37139 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 37140 */ 37141 var keyBy = createAggregator(function(result, value, key) { 37142 baseAssignValue(result, key, value); 37143 }); 37144 37145 /** 37146 * Creates an array of values by running each element in `collection` thru 37147 * `iteratee`. The iteratee is invoked with three arguments: 37148 * (value, index|key, collection). 37149 * 37150 * Many lodash methods are guarded to work as iteratees for methods like 37151 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 37152 * 37153 * The guarded methods are: 37154 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 37155 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 37156 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 37157 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 37158 * 37159 * @static 37160 * @memberOf _ 37161 * @since 0.1.0 37162 * @category Collection 37163 * @param {Array|Object} collection The collection to iterate over. 37164 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 37165 * @returns {Array} Returns the new mapped array. 37166 * @example 37167 * 37168 * function square(n) { 37169 * return n * n; 37170 * } 37171 * 37172 * _.map([4, 8], square); 37173 * // => [16, 64] 37174 * 37175 * _.map({ 'a': 4, 'b': 8 }, square); 37176 * // => [16, 64] (iteration order is not guaranteed) 37177 * 37178 * var users = [ 37179 * { 'user': 'barney' }, 37180 * { 'user': 'fred' } 37181 * ]; 37182 * 37183 * // The `_.property` iteratee shorthand. 37184 * _.map(users, 'user'); 37185 * // => ['barney', 'fred'] 37186 */ 37187 function map(collection, iteratee) { 37188 var func = isArray(collection) ? arrayMap : baseMap; 37189 return func(collection, getIteratee(iteratee, 3)); 37190 } 37191 37192 /** 37193 * This method is like `_.sortBy` except that it allows specifying the sort 37194 * orders of the iteratees to sort by. If `orders` is unspecified, all values 37195 * are sorted in ascending order. Otherwise, specify an order of "desc" for 37196 * descending or "asc" for ascending sort order of corresponding values. 37197 * 37198 * @static 37199 * @memberOf _ 37200 * @since 4.0.0 37201 * @category Collection 37202 * @param {Array|Object} collection The collection to iterate over. 37203 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 37204 * The iteratees to sort by. 37205 * @param {string[]} [orders] The sort orders of `iteratees`. 37206 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 37207 * @returns {Array} Returns the new sorted array. 37208 * @example 37209 * 37210 * var users = [ 37211 * { 'user': 'fred', 'age': 48 }, 37212 * { 'user': 'barney', 'age': 34 }, 37213 * { 'user': 'fred', 'age': 40 }, 37214 * { 'user': 'barney', 'age': 36 } 37215 * ]; 37216 * 37217 * // Sort by `user` in ascending order and by `age` in descending order. 37218 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 37219 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 37220 */ 37221 function orderBy(collection, iteratees, orders, guard) { 37222 if (collection == null) { 37223 return []; 37224 } 37225 if (!isArray(iteratees)) { 37226 iteratees = iteratees == null ? [] : [iteratees]; 37227 } 37228 orders = guard ? undefined
37228 : orders; 37229 if (!isArray(orders)) { 37230 orders = orders == null ? [] : [orders]; 37231 } 37232 return baseOrderBy(collection, iteratees, orders); 37233 } 37234 37235 /** 37236 * Creates an array of elements split into two groups, the first of which 37237 * contains elements `predicate` returns truthy for, the second of which 37238 * contains elements `predicate` returns falsey for. The predicate is 37239 * invoked with one argument: (value). 37240 * 37241 * @static 37242 * @memberOf _ 37243 * @since 3.0.0 37244 * @category Collection 37245 * @param {Array|Object} collection The collection to iterate over. 37246 * @param {Function} [predicate=_.identity] The function invoked per iteration. 37247 * @returns {Array} Returns the array of grouped elements. 37248 * @example 37249 * 37250 * var users = [ 37251 * { 'user': 'barney', 'age': 36, 'active': false }, 37252 * { 'user': 'fred', 'age': 40, 'active': true }, 37253 * { 'user': 'pebbles', 'age': 1, 'active': false } 37254 * ]; 37255 * 37256 * _.partition(users, function(o) { return o.active; }); 37257 * // => objects for [['fred'], ['barney', 'pebbles']] 37258 * 37259 * // The `_.matches` iteratee shorthand. 37260 * _.partition(users, { 'age': 1, 'active': false }); 37261 * // => objects for [['pebbles'], ['barney', 'fred']] 37262 * 37263 * // The `_.matchesProperty` iteratee shorthand. 37264 * _.partition(users, ['active', false]); 37265 * // => objects for [['barney', 'pebbles'], ['fred']] 37266 * 37267 * // The `_.property` iteratee shorthand. 37268 * _.partition(users, 'active'); 37269 * // => objects for [['fred'], ['barney', 'pebbles']] 37270 */ 37271 var partition = createAggregator(function(result, value, key) { 37272 result[key ? 0 : 1].push(value); 37273 }, function() { return [[], []]; }); 37274 37275 /** 37276 * Reduces `collection` to a value which is the accumulated result of running 37277 * each element in `collection` thru `iteratee`, where each successive 37278 * invocation is supplied the return value of the previous. If `accumulator` 37279 * is not given, the first element of `collection` is used as the initial 37280 * value. The iteratee is invoked with four arguments: 37281 * (accumulator, value, index|key, collection). 37282 * 37283 * Many lodash methods are guarded to work as iteratees for methods like 37284 * `_.reduce`, `_.reduceRight`, and `_.transform`. 37285 * 37286 * The guarded methods are: 37287 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 37288 * and `sortBy` 37289 * 37290 * @static 37291 * @memberOf _ 37292 * @since 0.1.0 37293 * @category Collection 37294 * @param {Array|Object} collection The collection to iterate over. 37295 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 37296 * @param {*} [accumulator] The initial value. 37297 * @returns {*} Returns the accumulated value. 37298 * @see _.reduceRight 37299 * @example 37300 * 37301 * _.reduce([1, 2], function(sum, n) { 37302 * return sum + n; 37303 * }, 0); 37304 * // => 3 37305 * 37306 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 37307 * (result[value] || (result[value] = [])).push(key); 37308 * return result; 37309 * }, {}); 37310 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 37311 */ 37312 function reduce(collection, iteratee, accumulator) { 37313 var func = isArray(collection) ? arrayReduce : baseReduce, 37314 initAccum = arguments.length < 3; 37315 37316 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 37317 } 37318 37319 /** 37320 * This method is like `_.reduce` except that it iterates over elements of 37321 * `collection` from right to left. 37322 * 37323 * @static 37324 * @memberOf _ 37325 * @since 0.1.0 37326 * @category Collection 37327 * @param {Array|Object} collection The collection to iterate over. 37328 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 37329 * @param {*} [accumulator] The initial value. 37330 * @returns {*} Returns the accumulated value. 37331 * @see _.reduce 37332 * @example 37333 * 37334 * var array = [[0, 1], [2, 3], [4, 5]]; 37335 * 37336 * _.reduceRight(array, function(flattened, other) { 37337 * return flattened.concat(other); 37338 * }, []); 37339 * // => [4, 5, 2, 3, 0, 1] 37340 */ 37341 function reduceRight(collection, iteratee, accumulator) { 37342 var func = isArray(collection) ? arrayReduceRight : baseReduce, 37343 initAccum = arguments.length < 3; 37344 37345 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 37346 } 37347 37348 /** 37349 * The opposite of `_.filter`; this method returns the elements of `collection` 37350 * that `predicate` does **not** return truthy for. 37351 * 37352 * @static 37353 * @memberOf _ 37354 * @since 0.1.0 37355 * @category Collection 37356 * @param {Array|Object} collection The collection to iterate over. 37357 * @param {Function} [predicate=_.identity] The function invoked per iteration. 37358 * @returns {Array} Returns the new filtered array.
37359 * @see _.filter 37360 * @example 37361 * 37362 * var users = [ 37363 * { 'user': 'barney', 'age': 36, 'active': false }, 37364 * { 'user': 'fred', 'age': 40, 'active': true } 37365 * ]; 37366 * 37367 * _.reject(users, function(o) { return !o.active; }); 37368 * // => objects for ['fred'] 37369 * 37370 * // The `_.matches` iteratee shorthand. 37371 * _.reject(users, { 'age': 40, 'active': true }); 37372 * // => objects for ['barney'] 37373 * 37374 * // The `_.matchesProperty` iteratee shorthand. 37375 * _.reject(users, ['active', false]); 37376 * // => objects for ['fred'] 37377 * 37378 * // The `_.property` iteratee shorthand. 37379 * _.reject(users, 'active'); 37380 * // => objects for ['barney'] 37381 */ 37382 function reject(collection, predicate) { 37383 var func = isArray(collection) ? arrayFilter : baseFilter; 37384 return func(collection, negate(getIteratee(predicate, 3))); 37385 } 37386 37387 /** 37388 * Gets a random element from `collection`. 37389 * 37390 * @static 37391 * @memberOf _ 37392 * @since 2.0.0 37393 * @category Collection 37394 * @param {Array|Object} collection The collection to sample. 37395 * @returns {*} Returns the random element. 37396 * @example 37397 * 37398 * _.sample([1, 2, 3, 4]); 37399 * // => 2 37400 */ 37401 function sample(collection) { 37402 var func = isArray(collection) ? arraySample : baseSample; 37403 return func(collection); 37404 } 37405 37406 /** 37407 * Gets `n` random elements at unique keys from `collection` up to the 37408 * size of `collection`. 37409 * 37410 * @static 37411 * @memberOf _ 37412 * @since 4.0.0 37413 * @category Collection 37414 * @param {Array|Object} collection The collection to sample. 37415 * @param {number} [n=1] The number of elements to sample. 37416 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 37417 * @returns {Array} Returns the random elements. 37418 * @example 37419 * 37420 * _.sampleSize([1, 2, 3], 2); 37421 * // => [3, 1] 37422 * 37423 * _.sampleSize([1, 2, 3], 4); 37424 * // => [2, 3, 1] 37425 */ 37426 function sampleSize(collection, n, guard) { 37427 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 37428 n = 1; 37429 } else { 37430 n = toInteger(n); 37431 } 37432 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 37433 return func(collection, n); 37434 } 37435 37436 /** 37437 * Creates an array of shuffled values, using a version of the 37438 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 37439 * 37440 * @static 37441 * @memberOf _ 37442 * @since 0.1.0 37443 * @category Collection 37444 * @param {Array|Object} collection The collection to shuffle. 37445 * @returns {Array} Returns the new shuffled array. 37446 * @example 37447 * 37448 * _.shuffle([1, 2, 3, 4]); 37449 * // => [4, 1, 3, 2] 37450 */ 37451 function shuffle(collection) { 37452 var func = isArray(collection) ? arrayShuffle : baseShuffle; 37453 return func(collection); 37454 } 37455 37456 /** 37457 * Gets the size of `collection` by returning its length for array-like 37458 * values or the number of own enumerable string keyed properties for objects. 37459 * 37460 * @static 37461 * @memberOf _ 37462 * @since 0.1.0 37463 * @category Collection 37464 * @param {Array|Object|string} collection The collection to inspect. 37465 * @returns {number} Returns the collection size. 37466 * @example 37467 * 37468 * _.size([1, 2, 3]); 37469 * // => 3 37470 * 37471 * _.size({ 'a': 1, 'b': 2 }); 37472 * // => 2 37473 * 37474 * _.size('pebbles'); 37475 * // => 7 37476 */ 37477 function size(collection) { 37478 if (collection == null) { 37479 return 0; 37480 } 37481 if (isArrayLike(collection)) { 37482 return isString(collection) ? stringSize(collection) : collection.length; 37483 } 37484 var tag = getTag(collection); 37485 if (tag == mapTag || tag == setTag) { 37486 return collection.size; 37487 } 37488 return baseKeys(collection).length; 37489 } 37490 37491 /** 37492 * Checks if `predicate` returns truthy for **any** element of `collection`. 37493 * Iteration is stopped once `predicate` returns truthy. The predicate is 37494 * invoked with three arguments: (value, index|key, collection). 37495 * 37496 * @static 37497 * @memberOf _ 37498 * @since 0.1.0 37499 * @category Collection 37500 * @param {Array|Object} collection The collection to iterate over. 37501 * @param {Function} [predicate=_.identity] The function invoked per iteration. 37502 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 37503 * @returns {boolean} Returns `true` if any element passes the predicate check, 37504 * else `false`. 37505 * @example 37506 * 37507 * _.some([null, 0, 'yes', false], Boolean); 37508 * // => true 37509 * 37510 * var users = [ 37511 * { 'user': 'barney', 'active': true }, 37512 * { 'user': 'fred', 'active': false } 37513 * ]; 37514 * 37515 * // The `_.matches` iteratee shorthand. 37516 * _.some(users, { 'user': 'barney', 'active': false }); 37517 * // => false 37518 * 37519 * // The `_.matchesProperty` iteratee shorthand. 37520 * _.some(users, ['active', false]); 37521 * // => true 37522 * 37523 * // The `_.property` iteratee shorthand. 37524 * _.some(users, 'active'); 37525 * // => true 37526 */ 37527 function some(collection, predicate, guard) { 37528 var func = isArray(collection) ? arraySome : baseSome; 37529 if (guard && isIterateeCall(collection, predicate, guard)) { 37530 predicate = undefined; 37531 } 37532 return func(collection, getIteratee(predicate, 3)); 37533 } 37534 37535 /** 37536 * Creates an array of elements, sorted in ascending order by the results of 37537 * running each element in a collection thru each iteratee. This method 37538 * performs a stable sort, that is, it preserves the original sort order of 37539 * equal elements. The iteratees are invoked with one argument: (value). 37540 * 37541 * @static 37542 * @memberOf _ 37543 * @since 0.1.0 37544 * @category Collection 37545 * @param {Array|Object} collection The collection to iterate over. 37546 * @param {...(Function|Function[])} [iteratees=[_.identity]] 37547 * The iteratees to sort by. 37548 * @returns {Array} Returns the new sorted array.
vendor: 6,953 bytes, lines 37549-37751
37549 * @example 37550 * 37551 * var users = [ 37552 * { 'user': 'fred', 'age': 48 }, 37553 * { 'user': 'barney', 'age': 36 }, 37554 * { 'user': 'fred', 'age': 40 }, 37555 * { 'user': 'barney', 'age': 34 } 37556 * ]; 37557 * 37558 * _.sortBy(users, [function(o) { return o.user; }]); 37559 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 37560 * 37561 * _.sortBy(users, ['user', 'age']); 37562 * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] 37563 */ 37564 var sortBy = baseRest(function(collection, iteratees) { 37565 if (collection == null) { 37566 return []; 37567 } 37568 var length = iteratees.length; 37569 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 37570 iteratees = []; 37571 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 37572 iteratees = [iteratees[0]]; 37573 } 37574 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 37575 }); 37576 37577 /*------------------------------------------------------------------------*/ 37578 37579 /** 37580 * Gets the timestamp of the number of milliseconds that have elapsed since 37581 * the Unix epoch (1 January 1970 00:00:00 UTC). 37582 * 37583 * @static 37584 * @memberOf _ 37585 * @since 2.4.0 37586 * @category Date 37587 * @returns {number} Returns the timestamp. 37588 * @example 37589 * 37590 * _.defer(function(stamp) { 37591 * console.log(_.now() - stamp); 37592 * }, _.now()); 37593 * // => Logs the number of milliseconds it took for the deferred invocation. 37594 */ 37595 var now = ctxNow || function() { 37596 return root.Date.now(); 37597 }; 37598 37599 /*------------------------------------------------------------------------*/ 37600 37601 /** 37602 * The opposite of `_.before`; this method creates a function that invokes 37603 * `func` once it's called `n` or more times. 37604 * 37605 * @static 37606 * @memberOf _ 37607 * @since 0.1.0 37608 * @category Function 37609 * @param {number} n The number of calls before `func` is invoked. 37610 * @param {Function} func The function to restrict. 37611 * @returns {Function} Returns the new restricted function. 37612 * @example 37613 * 37614 * var saves = ['profile', 'settings']; 37615 * 37616 * var done = _.after(saves.length, function() { 37617 * console.log('done saving!'); 37618 * }); 37619 * 37620 * _.forEach(saves, function(type) { 37621 * asyncSave({ 'type': type, 'complete': done }); 37622 * }); 37623 * // => Logs 'done saving!' after the two async saves have completed. 37624 */ 37625 function after(n, func) { 37626 if (typeof func != 'function') { 37627 throw new TypeError(FUNC_ERROR_TEXT); 37628 } 37629 n = toInteger(n); 37630 return function() { 37631 if (--n < 1) { 37632 return func.apply(this, arguments); 37633 } 37634 }; 37635 } 37636 37637 /** 37638 * Creates a function that invokes `func`, with up to `n` arguments, 37639 * ignoring any additional arguments. 37640 * 37641 * @static 37642 * @memberOf _ 37643 * @since 3.0.0 37644 * @category Function 37645 * @param {Function} func The function to cap arguments for. 37646 * @param {number} [n=func.length] The arity cap. 37647 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 37648 * @returns {Function} Returns the new capped function. 37649 * @example 37650 * 37651 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 37652 * // => [6, 8, 10] 37653 */ 37654 function ary(func, n, guard) { 37655 n = guard ? undefined : n; 37656 n = (func && n == null) ? func.length : n; 37657 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 37658 } 37659 37660 /** 37661 * Creates a function that invokes `func`, with the `this` binding and arguments 37662 * of the created function, while it's called less than `n` times. Subsequent 37663 * calls to the created function return the result of the last `func` invocation. 37664 * 37665 * @static 37666 * @memberOf _ 37667 * @since 3.0.0 37668 * @category Function 37669 * @param {number} n The number of calls at which `func` is no longer invoked. 37670 * @param {Function} func The function to restrict. 37671 * @returns {Function} Returns the new restricted function. 37672 * @example 37673 * 37674 * jQuery(element).on('click', _.before(5, addContactToList)); 37675 * // => Allows adding up to 4 contacts to the list. 37676 */ 37677 function before(n, func) { 37678 var result; 37679 if (typeof func != 'function') { 37680 throw new TypeError(FUNC_ERROR_TEXT); 37681 } 37682 n = toInteger(n); 37683 return function() { 37684 if (--n > 0) { 37685 result = func.apply(this, arguments); 37686 } 37687 if (n <= 1) { 37688 func = undefined; 37689 } 37690 return result; 37691 }; 37692 } 37693 37694 /** 37695 * Creates a function that invokes `func` with the `this` binding of `thisArg` 37696 * and `partials` prepended to the arguments it receives. 37697 * 37698 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 37699 * may be used as a placeholder for partially applied arguments. 37700 * 37701 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 37702 * property of bound functions. 37703 * 37704 * @static 37705 * @memberOf _ 37706 * @since 0.1.0 37707 * @category Function 37708 * @param {Function} func The function to bind. 37709 * @param {*} thisArg The `this` binding of `func`. 37710 * @param {...*} [partials] The arguments to be partially applied. 37711 * @returns {Function} Returns the new bound function. 37712 * @example 37713 * 37714 * function greet(greeting, punctuation) { 37715 * return greeting + ' ' + this.user + punctuation; 37716 * } 37717 * 37718 * var object = { 'user': 'fred' }; 37719 * 37720 * var bound = _.bind(greet, object, 'hi'); 37721 * bound('!'); 37722 * // => 'hi fred!' 37723 * 37724 * // Bound with placeholders. 37725 * var bound = _.bind(greet, object, _, '!'); 37726 * bound('hi'); 37727 * // => 'hi fred!' 37728 */ 37729 var bind = baseRest(function(func, thisArg, partials) { 37730 var bitmask = WRAP_BIND_FLAG; 37731 if (partials.length) { 37732 var holders = replaceHolders(partials, getHolder(bind)); 37733 bitmask |= WRAP_PARTIAL_FLAG; 37734 } 37735 return createWrap(func, bitmask, thisArg, partials, holders); 37736 }); 37737 37738 /** 37739 * Creates a function that invokes the method at `object[key]` with `partials` 37740 * prepended to the arguments it receives. 37741 * 37742 * This method differs from `_.bind` by allowing bound functions to reference 37743 * methods that may be redefined or don't yet exist. See 37744 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 37745 * for more details. 37746 * 37747 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 37748 * builds, may be used as a placeholder for partially applied arguments. 37749 * 37750 * @static 37751 * @memberOf _
37752 * @since 0.10.0 37753 * @category Function 37754 * @param {Object} object The object to invoke the method on. 37755 * @param {string} key The key of the method. 37756 * @param {...*} [partials] The arguments to be partially applied. 37757 * @returns {Function} Returns the new bound function. 37758 * @example 37759 * 37760 * var object = { 37761 * 'user': 'fred', 37762 * 'greet': function(greeting, punctuation) { 37763 * return greeting + ' ' + this.user + punctuation; 37764 * } 37765 * }; 37766 * 37767 * var bound = _.bindKey(object, 'greet', 'hi'); 37768 * bound('!'); 37769 * // => 'hi fred!' 37770 * 37771 * object.greet = function(greeting, punctuation) { 37772 * return greeting + 'ya ' + this.user + punctuation; 37773 * }; 37774 * 37775 * bound('!'); 37776 * // => 'hiya fred!' 37777 * 37778 * // Bound with placeholders. 37779 * var bound = _.bindKey(object, 'greet', _, '!'); 37780 * bound('hi'); 37781 * // => 'hiya fred!' 37782 */ 37783 var bindKey = baseRest(function(object, key, partials) { 37784 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 37785 if (partials.length) { 37786 var holders = replaceHolders(partials, getHolder(bindKey)); 37787 bitmask |= WRAP_PARTIAL_FLAG; 37788 } 37789 return createWrap(key, bitmask, object, partials, holders); 37790 }); 37791 37792 /** 37793 * Creates a function that accepts arguments of `func` and either invokes 37794 * `func` returning its result, if at least `arity` number of arguments have 37795 * been provided, or returns a function that accepts the remaining `func` 37796 * arguments, and so on. The arity of `func` may be specified if `func.length` 37797 * is not sufficient. 37798 * 37799 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 37800 * may be used as a placeholder for provided arguments. 37801 * 37802 * **Note:** This method doesn't set the "length" property of curried functions. 37803 * 37804 * @static 37805 * @memberOf _ 37806 * @since 2.0.0 37807 * @category Function 37808 * @param {Function} func The function to curry. 37809 * @param {number} [arity=func.length] The arity of `func`. 37810 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 37811 * @returns {Function} Returns the new curried function. 37812 * @example 37813 * 37814 * var abc = function(a, b, c) { 37815 * return [a, b, c]; 37816 * }; 37817 * 37818 * var curried = _.curry(abc); 37819 * 37820 * curried(1)(2)(3); 37821 * // => [1, 2, 3] 37822 * 37823 * curried(1, 2)(3); 37824 * // => [1, 2, 3] 37825 * 37826 * curried(1, 2, 3); 37827 * // => [1, 2, 3] 37828 * 37829 * // Curried with placeholders. 37830 * curried(1)(_, 3)(2); 37831 * // => [1, 2, 3] 37832 */ 37833 function curry(func, arity, guard) { 37834 arity = guard ? undefined : arity; 37835 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 37836 result.placeholder = curry.placeholder; 37837 return result; 37838 } 37839 37840 /** 37841 * This method is like `_.curry` except that arguments are applied to `func` 37842 * in the manner of `_.partialRight` instead of `_.partial`. 37843 * 37844 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 37845 * builds, may be used as a placeholder for provided arguments. 37846 * 37847 * **Note:** This method doesn't set the "length" property of curried functions. 37848 * 37849 * @static 37850 * @memberOf _ 37851 * @since 3.0.0 37852 * @category Function 37853 * @param {Function} func The function to curry. 37854 * @param {number} [arity=func.length] The arity of `func`. 37855 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 37856 * @returns {Function} Returns the new curried function. 37857 * @example 37858 * 37859 * var abc = function(a, b, c) { 37860 * return [a, b, c]; 37861 * }; 37862 * 37863 * var curried = _.curryRight(abc); 37864 * 37865 * curried(3)(2)(1); 37866 * // => [1, 2, 3] 37867 * 37868 * curried(2, 3)(1); 37869 * // => [1, 2, 3] 37870 * 37871 * curried(1, 2, 3); 37872 * // => [1, 2, 3] 37873 * 37874 * // Curried with placeholders. 37875 * curried(3)(1, _)(2); 37876 * // => [1, 2, 3] 37877 */ 37878 function curryRight(func, arity, guard) { 37879 arity = guard ? undefined : arity; 37880 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 37881 result.placeholder = curryRight.placeholder; 37882 return result; 37883 } 37884 37885 /** 37886 * Creates a debounced function that delays invoking `func` until after `wait` 37887 * milliseconds have elapsed since the last time the debounced function was 37888 * invoked. The debounced function comes with a `cancel` method to cancel 37889 * delayed `func` invocations and a `flush` method to immediately invoke them. 37890 * Provide `options` to indicate whether `func` should be invoked on the 37891 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 37892 * with the last arguments provided to the debounced function. Subsequent 37893 * calls to the debounced function return the result of the last `func` 37894 * invocation. 37895 * 37896 * **Note:** If `leading` and `trailing` options are `true`, `func` is 37897 * invoked on the trailing edge of the timeout only if the debounced function 37898 * is invoked more than once during the `wait` timeout. 37899 * 37900 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 37901 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 37902 *
37903 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 37904 * for details over the differences between `_.debounce` and `_.throttle`. 37905 * 37906 * @static 37907 * @memberOf _ 37908 * @since 0.1.0 37909 * @category Function 37910 * @param {Function} func The function to debounce. 37911 * @param {number} [wait=0] The number of milliseconds to delay. 37912 * @param {Object} [options={}] The options object. 37913 * @param {boolean} [options.leading=false] 37914 * Specify invoking on the leading edge of the timeout. 37915 * @param {number} [options.maxWait] 37916 * The maximum time `func` is allowed to be delayed before it's invoked. 37917 * @param {boolean} [options.trailing=true] 37918 * Specify invoking on the trailing edge of the timeout. 37919 * @returns {Function} Returns the new debounced function. 37920 * @example 37921 * 37922 * // Avoid costly calculations while the window size is in flux. 37923 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 37924 * 37925 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 37926 * jQuery(element).on('click', _.debounce(sendMail, 300, { 37927 * 'leading': true, 37928 * 'trailing': false 37929 * })); 37930 * 37931 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 37932 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 37933 * var source = new EventSource('/stream'); 37934 * jQuery(source).on('message', debounced); 37935 * 37936 * // Cancel the trailing debounced invocation. 37937 * jQuery(window).on('popstate', debounced.cancel); 37938 */ 37939 function debounce(func, wait, options) { 37940 var lastArgs, 37941 lastThis, 37942 maxWait, 37943 result, 37944 timerId, 37945 lastCallTime, 37946 lastInvokeTime = 0, 37947 leading = false, 37948 maxing = false, 37949 trailing = true; 37950 37951 if (typeof func != 'function') { 37952 throw new TypeError(FUNC_ERROR_TEXT); 37953 } 37954 wait = toNumber(wait) || 0; 37955 if (isObject(options)) { 37956 leading = !!options.leading; 37957 maxing = 'maxWait' in options; 37958 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 37959 trailing = 'trailing' in options ? !!options.trailing : trailing; 37960 } 37961 37962 function invokeFunc(time) { 37963 var args = lastArgs, 37964 thisArg = lastThis; 37965 37966 lastArgs = lastThis = undefined; 37967 lastInvokeTime = time; 37968 result = func.apply(thisArg, args); 37969 return result; 37970 } 37971 37972 function leadingEdge(time) { 37973 // Reset any `maxWait` timer. 37974 lastInvokeTime = time; 37975 // Start the timer for the trailing edge. 37976 timerId = setTimeout(timerExpired, wait); 37977 // Invoke the leading edge. 37978 return leading ? invokeFunc(time) : result; 37979 } 37980 37981 function remainingWait(time) { 37982 var timeSinceLastCall = time - lastCallTime, 37983 timeSinceLastInvoke = time - lastInvokeTime, 37984 result = wait - timeSinceLastCall; 37985 37986 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; 37987 } 37988 37989 function shouldInvoke(time) { 37990 var timeSinceLastCall = time - lastCallTime, 37991 timeSinceLastInvoke = time - lastInvokeTime; 37992 37993 // Either this is the first call, activity has stopped and we're at the 37994 // trailing edge, the system time has gone backwards and we're treating 37995 // it as the trailing edge, or we've hit the `maxWait` limit. 37996 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 37997 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 37998 } 37999 38000 function timerExpired() { 38001 var time = now(); 38002 if (shouldInvoke(time)) { 38003 return trailingEdge(time); 38004 } 38005 // Restart the timer. 38006 timerId = setTimeout(timerExpired, remainingWait(time)); 38007 } 38008 38009 function trailingEdge(time) { 38010 timerId = undefined; 38011 38012 // Only invoke if we have `lastArgs` which means `func` has been 38013 // debounced at least once. 38014 if (trailing && lastArgs) { 38015 return invokeFunc(time); 38016 } 38017 lastArgs = lastThis = undefined; 38018 return result; 38019 } 38020 38021 function cancel() { 38022 if (timerId !== undefined) { 38023 clearTimeout(timerId); 38024 } 38025 lastInvokeTime = 0; 38026 lastArgs = lastCallTime = lastThis = timerId = undefined; 38027 } 38028 38029 function flush() { 38030 return timerId === undefined ? result : trailingEdge(now()); 38031 } 38032 38033 function debounced() { 38034 var time = now(), 38035 isInvoking = shouldInvoke(time); 38036 38037 lastArgs = arguments; 38038 lastThis = this; 38039 lastCallTime = time; 38040 38041 if (isInvoking) { 38042 if (timerId === undefined) { 38043 return leadingEdge(lastCallTime); 38044 } 38045 if (maxing) { 38046 // Handle invocations in a tight loop. 38047 timerId = setTimeout(timerExpired, wait); 38048 return invokeFunc(lastCallTime); 38049 } 38050 } 38051 if (timerId === undefined) { 38052 timerId = setTimeout(timerExpired, wait); 38053 } 38054 return result; 38055 } 38056 debounced.cancel = cancel; 38057 debounced.flush = flush; 38058 return debounced; 38059 } 38060 38061 /** 38062 * Defers invoking the `func` until the current call stack has cleared. Any 38063 * additional arguments are provided to `func` when it's invoked. 38064 * 38065 * @static 38066 * @memberOf _ 38067 * @since 0.1.0 38068 * @category Function 38069 * @param {Function} func The function to defer. 38070 * @param {...*} [args] The arguments to invoke `func` with. 38071 * @returns {number} Returns the timer id. 38072 * @example 38073 * 38074 * _.defer(function(text) { 38075 * console.log(text); 38076 * }, 'deferred'); 38077 * // => Logs 'deferred' after one millisecond. 38078 */ 38079 var defer = baseRest(function(func, args) { 38080 return baseDelay(func, 1, args); 38081 }); 38082 38083 /** 38084 * Invokes `func` after `wait` milliseconds. Any additional arguments are 38085 * provided to `func` when it's invoked. 38086 * 38087 * @static 38088 * @memberOf _ 38089 * @since 0.1.0 38090 * @category Function 38091 * @param {Function} func The function to delay. 38092 * @param {number} wait The number of milliseconds to delay invocation. 38093 * @param {...*} [args] The arguments to invoke `func` with. 38094 * @returns {number} Returns the timer id. 38095 * @example 38096 * 38097 * _.delay(function(text) { 38098 * console.log(text); 38099 * }, 1000, 'later'); 38100 * // => Logs 'later' after one second. 38101 */
vendor: 10,279 bytes, lines 38102-38405
38102 var delay = baseRest(function(func, wait, args) { 38103 return baseDelay(func, toNumber(wait) || 0, args); 38104 }); 38105 38106 /** 38107 * Creates a function that invokes `func` with arguments reversed. 38108 * 38109 * @static 38110 * @memberOf _ 38111 * @since 4.0.0 38112 * @category Function 38113 * @param {Function} func The function to flip arguments for. 38114 * @returns {Function} Returns the new flipped function. 38115 * @example 38116 * 38117 * var flipped = _.flip(function() { 38118 * return _.toArray(arguments); 38119 * }); 38120 * 38121 * flipped('a', 'b', 'c', 'd'); 38122 * // => ['d', 'c', 'b', 'a'] 38123 */ 38124 function flip(func) { 38125 return createWrap(func, WRAP_FLIP_FLAG); 38126 } 38127 38128 /** 38129 * Creates a function that memoizes the result of `func`. If `resolver` is 38130 * provided, it determines the cache key for storing the result based on the 38131 * arguments provided to the memoized function. By default, the first argument 38132 * provided to the memoized function is used as the map cache key. The `func` 38133 * is invoked with the `this` binding of the memoized function. 38134 * 38135 * **Note:** The cache is exposed as the `cache` property on the memoized 38136 * function. Its creation may be customized by replacing the `_.memoize.Cache` 38137 * constructor with one whose instances implement the 38138 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 38139 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 38140 * 38141 * @static 38142 * @memberOf _ 38143 * @since 0.1.0 38144 * @category Function 38145 * @param {Function} func The function to have its output memoized. 38146 * @param {Function} [resolver] The function to resolve the cache key. 38147 * @returns {Function} Returns the new memoized function. 38148 * @example 38149 * 38150 * var object = { 'a': 1, 'b': 2 }; 38151 * var other = { 'c': 3, 'd': 4 }; 38152 * 38153 * var values = _.memoize(_.values); 38154 * values(object); 38155 * // => [1, 2] 38156 * 38157 * values(other); 38158 * // => [3, 4] 38159 * 38160 * object.a = 2; 38161 * values(object); 38162 * // => [1, 2] 38163 * 38164 * // Modify the result cache. 38165 * values.cache.set(object, ['a', 'b']); 38166 * values(object); 38167 * // => ['a', 'b'] 38168 * 38169 * // Replace `_.memoize.Cache`. 38170 * _.memoize.Cache = WeakMap; 38171 */ 38172 function memoize(func, resolver) { 38173 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 38174 throw new TypeError(FUNC_ERROR_TEXT); 38175 } 38176 var memoized = function() { 38177 var args = arguments, 38178 key = resolver ? resolver.apply(this, args) : args[0], 38179 cache = memoized.cache; 38180 38181 if (cache.has(key)) { 38182 return cache.get(key); 38183 } 38184 var result = func.apply(this, args); 38185 memoized.cache = cache.set(key, result) || cache; 38186 return result; 38187 }; 38188 memoized.cache = new (memoize.Cache || MapCache); 38189 return memoized; 38190 } 38191 38192 // Expose `MapCache`. 38193 memoize.Cache = MapCache; 38194 38195 /** 38196 * Creates a function that negates the result of the predicate `func`. The 38197 * `func` predicate is invoked with the `this` binding and arguments of the 38198 * created function. 38199 * 38200 * @static 38201 * @memberOf _ 38202 * @since 3.0.0 38203 * @category Function 38204 * @param {Function} predicate The predicate to negate. 38205 * @returns {Function} Returns the new negated function. 38206 * @example 38207 * 38208 * function isEven(n) { 38209 * return n % 2 == 0; 38210 * } 38211 * 38212 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 38213 * // => [1, 3, 5] 38214 */ 38215 function negate(predicate) { 38216 if (typeof predicate != 'function') { 38217 throw new TypeError(FUNC_ERROR_TEXT); 38218 } 38219 return function() { 38220 var args = arguments; 38221 switch (args.length) { 38222 case 0: return !predicate.call(this); 38223 case 1: return !predicate.call(this, args[0]); 38224 case 2: return !predicate.call(this, args[0], args[1]); 38225 case 3: return !predicate.call(this, args[0], args[1], args[2]); 38226 } 38227 return !predicate.apply(this, args); 38228 }; 38229 } 38230 38231 /** 38232 * Creates a function that is restricted to invoking `func` once. Repeat calls 38233 * to the function return the value of the first invocation. The `func` is 38234 * invoked with the `this` binding and arguments of the created function. 38235 * 38236 * @static 38237 * @memberOf _ 38238 * @since 0.1.0 38239 * @category Function 38240 * @param {Function} func The function to restrict. 38241 * @returns {Function} Returns the new restricted function. 38242 * @example 38243 * 38244 * var initialize = _.once(createApplication); 38245 * initialize(); 38246 * initialize(); 38247 * // => `createApplication` is invoked once 38248 */ 38249 function once(func) { 38250 return before(2, func); 38251 } 38252 38253 /** 38254 * Creates a function that invokes `func` with its arguments transformed. 38255 * 38256 * @static 38257 * @since 4.0.0 38258 * @memberOf _ 38259 * @category Function 38260 * @param {Function} func The function to wrap. 38261 * @param {...(Function|Function[])} [transforms=[_.identity]] 38262 * The argument transforms. 38263 * @returns {Function} Returns the new function. 38264 * @example 38265 * 38266 * function doubled(n) { 38267 * return n * 2; 38268 * } 38269 * 38270 * function square(n) { 38271 * return n * n; 38272 * } 38273 * 38274 * var func = _.overArgs(function(x, y) { 38275 * return [x, y]; 38276 * }, [square, doubled]); 38277 * 38278 * func(9, 3); 38279 * // => [81, 6] 38280 * 38281 * func(10, 5); 38282 * // => [100, 10] 38283 */ 38284 var overArgs = castRest(function(func, transforms) { 38285 transforms = (transforms.length == 1 && isArray(transforms[0])) 38286 ? arrayMap(transforms[0], baseUnary(getIteratee())) 38287 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 38288 38289 var funcsLength = transforms.length; 38290 return baseRest(function(args) { 38291 var index = -1, 38292 length = nativeMin(args.length, funcsLength); 38293 38294 while (++index < length) { 38295 args[index] = transforms[index].call(this, args[index]); 38296 } 38297 return apply(func, this, args); 38298 }); 38299 }); 38300 38301 /** 38302 * Creates a function that invokes `func` with `partials` prepended to the 38303 * arguments it receives. This method is like `_.bind` except it does **not** 38304 * alter the `this` binding. 38305 * 38306 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 38307 * builds, may be used as a placeholder for partially applied arguments. 38308 * 38309 * **Note:** This method doesn't set the "length" property of partially 38310 * applied functions. 38311 * 38312 * @static 38313 * @memberOf _ 38314 * @since 0.2.0 38315 * @category Function 38316 * @param {Function} func The function to partially apply arguments to. 38317 * @param {...*} [partials] The arguments to be partially applied. 38318 * @returns {Function} Returns the new partially applied function. 38319 * @example 38320 * 38321 * function greet(greeting, name) { 38322 * return greeting + ' ' + name; 38323 * } 38324 * 38325 * var sayHelloTo = _.partial(greet, 'hello'); 38326 * sayHelloTo('fred'); 38327 * // => 'hello fred' 38328 * 38329 * // Partially applied with placeholders. 38330 * var greetFred = _.partial(greet, _, 'fred'); 38331 * greetFred('hi'); 38332 * // => 'hi fred' 38333 */ 38334 var partial = baseRest(function(func, partials) { 38335 var holders = replaceHolders(partials, getHolder(partial)); 38336 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 38337 }); 38338 38339 /** 38340 * This method is like `_.partial` except that partially applied arguments 38341 * are appended to the arguments it receives. 38342 * 38343 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 38344 * builds, may be used as a placeholder for partially applied arguments. 38345 * 38346 * **Note:** This method doesn't set the "length" property of partially 38347 * applied functions. 38348 * 38349 * @static 38350 * @memberOf _ 38351 * @since 1.0.0 38352 * @category Function 38353 * @param {Function} func The function to partially apply arguments to. 38354 * @param {...*} [partials] The arguments to be partially applied. 38355 * @returns {Function} Returns the new partially applied function. 38356 * @example 38357 * 38358 * function greet(greeting, name) { 38359 * return greeting + ' ' + name; 38360 * } 38361 * 38362 * var greetFred = _.partialRight(greet, 'fred'); 38363 * greetFred('hi'); 38364 * // => 'hi fred' 38365 * 38366 * // Partially applied with placeholders. 38367 * var sayHelloTo = _.partialRight(greet, 'hello', _); 38368 * sayHelloTo('fred'); 38369 * // => 'hello fred' 38370 */ 38371 var partialRight = baseRest(function(func, partials) { 38372 var holders = replaceHolders(partials, getHolder(partialRight)); 38373 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 38374 }); 38375 38376 /** 38377 * Creates a function that invokes `func` with arguments arranged according 38378 * to the specified `indexes` where the argument value at the first index is 38379 * provided as the first argument, the argument value at the second index is 38380 * provided as the second argument, and so on. 38381 * 38382 * @static 38383 * @memberOf _ 38384 * @since 3.0.0 38385 * @category Function 38386 * @param {Function} func The function to rearrange arguments for. 38387 * @param {...(number|number[])} indexes The arranged argument indexes. 38388 * @returns {Function} Returns the new function. 38389 * @example 38390 * 38391 * var rearged = _.rearg(function(a, b, c) { 38392 * return [a, b, c]; 38393 * }, [2, 0, 1]); 38394 * 38395 * rearged('b', 'c', 'a') 38396 * // => ['a', 'b', 'c'] 38397 */ 38398 var rearg = flatRest(function(func, indexes) { 38399 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 38400 }); 38401 38402 /** 38403 * Creates a function that invokes `func` with the `this` binding of the 38404 * created function and arguments from `start` and beyond provided as 38405 * an array.
38406 * 38407 * **Note:** This method is based on the 38408 * [rest parameter](https://mdn.io/rest_parameters). 38409 * 38410 * @static 38411 * @memberOf _ 38412 * @since 4.0.0 38413 * @category Function 38414 * @param {Function} func The function to apply a rest parameter to. 38415 * @param {number} [start=func.length-1] The start position of the rest parameter. 38416 * @returns {Function} Returns the new function. 38417 * @example 38418 * 38419 * var say = _.rest(function(what, names) { 38420 * return what + ' ' + _.initial(names).join(', ') + 38421 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 38422 * }); 38423 * 38424 * say('hello', 'fred', 'barney', 'pebbles'); 38425 * // => 'hello fred, barney, & pebbles' 38426 */ 38427 function rest(func, start) { 38428 if (typeof func != 'function') { 38429 throw new TypeError(FUNC_ERROR_TEXT); 38430 } 38431 start = start === undefined ? start : toInteger(start); 38432 return baseRest(func, start); 38433 } 38434 38435 /** 38436 * Creates a function that invokes `func` with the `this` binding of the 38437 * create function and an array of arguments much like 38438 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 38439 * 38440 * **Note:** This method is based on the 38441 * [spread operator](https://mdn.io/spread_operator). 38442 * 38443 * @static 38444 * @memberOf _ 38445 * @since 3.2.0 38446 * @category Function 38447 * @param {Function} func The function to spread arguments over. 38448 * @param {number} [start=0] The start position of the spread. 38449 * @returns {Function} Returns the new function. 38450 * @example 38451 * 38452 * var say = _.spread(function(who, what) { 38453 * return who + ' says ' + what; 38454 * }); 38455 * 38456 * say(['fred', 'hello']); 38457 * // => 'fred says hello' 38458 * 38459 * var numbers = Promise.all([ 38460 * Promise.resolve(40), 38461 * Promise.resolve(36) 38462 * ]); 38463 * 38464 * numbers.then(_.spread(function(x, y) { 38465 * return x + y; 38466 * })); 38467 * // => a Promise of 76 38468 */ 38469 function spread(func, start) { 38470 if (typeof func != 'function') { 38471 throw new TypeError(FUNC_ERROR_TEXT); 38472 } 38473 start = start == null ? 0 : nativeMax(toInteger(start), 0); 38474 return baseRest(function(args) { 38475 var array = args[start], 38476 otherArgs = castSlice(args, 0, start); 38477 38478 if (array) { 38479 arrayPush(otherArgs, array); 38480 } 38481 return apply(func, this, otherArgs); 38482 }); 38483 } 38484 38485 /** 38486 * Creates a throttled function that only invokes `func` at most once per 38487 * every `wait` milliseconds. The throttled function comes with a `cancel` 38488 * method to cancel delayed `func` invocations and a `flush` method to 38489 * immediately invoke them. Provide `options` to indicate whether `func` 38490 * should be invoked on the leading and/or trailing edge of the `wait` 38491 * timeout. The `func` is invoked with the last arguments provided to the 38492 * throttled function. Subsequent calls to the throttled function return the 38493 * result of the last `func` invocation. 38494 * 38495 * **Note:** If `leading` and `trailing` options are `true`, `func` is 38496 * invoked on the trailing edge of the timeout only if the throttled function 38497 * is invoked more than once during the `wait` timeout. 38498 * 38499 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 38500 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 38501 * 38502 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 38503 * for details over the differences between `_.throttle` and `_.debounce`. 38504 * 38505 * @static 38506 * @memberOf _ 38507 * @since 0.1.0 38508 * @category Function 38509 * @param {Function} func The function to throttle. 38510 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 38511 * @param {Object} [options={}] The options object. 38512 * @param {boolean} [options.leading=true] 38513 * Specify invoking on the leading edge of the timeout. 38514 * @param {boolean} [options.trailing=true] 38515 * Specify invoking on the trailing edge of the timeout. 38516 * @returns {Function} Returns the new throttled function. 38517 * @example 38518 * 38519 * // Avoid excessively updating the position while scrolling. 38520 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 38521 * 38522 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 38523 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 38524 * jQuery(element).on('click', throttled); 38525 * 38526 * // Cancel the trailing throttled invocation. 38527 * jQuery(window).on('popstate', throttled.cancel); 38528 */ 38529 function throttle(func, wait, options) { 38530 var leading = true, 38531 trailing = true; 38532 38533 if (typeof func != 'function') { 38534 throw new TypeError(FUNC_ERROR_TEXT); 38535 } 38536 if (isObject(options)) { 38537 leading = 'leading' in options ? !!options.leading : leading; 38538 trailing = 'trailing' in options ? !!options.trailing : trailing; 38539 } 38540 return debounce(func, wait, { 38541 'leading': leading, 38542 'maxWait': wait, 38543 'trailing': trailing 38544 }); 38545 } 38546 38547 /** 38548 * Creates a function that accepts up to one argument, ignoring any 38549 * additional arguments. 38550 * 38551 * @static 38552 * @memberOf _ 38553 * @since 4.0.0 38554 * @category Function 38555 * @param {Function} func The function to cap arguments for. 38556 * @returns {Function} Returns the new capped function. 38557 * @example 38558 * 38559 * _.map(['6', '8', '10'], _.unary(parseInt)); 38560 * // => [6, 8, 10] 38561 */ 38562 function unary(func) { 38563 return ary(func, 1); 38564 } 38565 38566 /** 38567 * Creates a function that provides `value` to `wrapper` as its first 38568 * argument. Any additional arguments provided to the function are appended 38569 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 38570 * binding of the created function. 38571 * 38572 * @static 38573 * @memberOf _ 38574 * @since 0.1.0 38575 * @category Function 38576 * @param {*} value The value to wrap. 38577 * @param {Function} [wrapper=identity] The wrapper function. 38578 * @returns {Function} Returns the new function. 38579 * @example 38580 *
38581 * var p = _.wrap(_.escape, function(func, text) { 38582 * return '<p>' + func(text) + '</p>'; 38583 * }); 38584 * 38585 * p('fred, barney, & pebbles'); 38586 * // => '<p>fred, barney, & pebbles</p>' 38587 */ 38588 function wrap(value, wrapper) { 38589 return partial(castFunction(wrapper), value); 38590 } 38591 38592 /*------------------------------------------------------------------------*/ 38593 38594 /** 38595 * Casts `value` as an array if it's not one. 38596 * 38597 * @static 38598 * @memberOf _ 38599 * @since 4.4.0 38600 * @category Lang 38601 * @param {*} value The value to inspect. 38602 * @returns {Array} Returns the cast array. 38603 * @example 38604 * 38605 * _.castArray(1); 38606 * // => [1] 38607 * 38608 * _.castArray({ 'a': 1 }); 38609 * // => [{ 'a': 1 }] 38610 * 38611 * _.castArray('abc'); 38612 * // => ['abc'] 38613 * 38614 * _.castArray(null); 38615 * // => [null] 38616 * 38617 * _.castArray(undefined); 38618 * // => [undefined] 38619 * 38620 * _.castArray(); 38621 * // => [] 38622 * 38623 * var array = [1, 2, 3]; 38624 * console.log(_.castArray(array) === array); 38625 * // => true 38626 */ 38627 function castArray() { 38628 if (!arguments.length) { 38629 return []; 38630 } 38631 var value = arguments[0]; 38632 return isArray(value) ? value : [value]; 38633 } 38634 38635 /** 38636 * Creates a shallow clone of `value`. 38637 * 38638 * **Note:** This method is loosely based on the 38639 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 38640 * and supports cloning arrays, array buffers, booleans, date objects, maps, 38641 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 38642 * arrays. The own enumerable properties of `arguments` objects are cloned 38643 * as plain objects. An empty object is returned for uncloneable values such 38644 * as error objects, functions, DOM nodes, and WeakMaps. 38645 * 38646 * @static 38647 * @memberOf _ 38648 * @since 0.1.0 38649 * @category Lang 38650 * @param {*} value The value to clone. 38651 * @returns {*} Returns the cloned value. 38652 * @see _.cloneDeep 38653 * @example 38654 * 38655 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 38656 * 38657 * var shallow = _.clone(objects); 38658 * console.log(shallow[0] === objects[0]); 38659 * // => true 38660 */ 38661 function clone(value) { 38662 return baseClone(value, CLONE_SYMBOLS_FLAG); 38663 } 38664 38665 /** 38666 * This method is like `_.clone` except that it accepts `customizer` which 38667 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 38668 * cloning is handled by the method instead. The `customizer` is invoked with 38669 * up to four arguments; (value [, index|key, object, stack]). 38670 * 38671 * @static 38672 * @memberOf _ 38673 * @since 4.0.0 38674 * @category Lang 38675 * @param {*} value The value to clone. 38676 * @param {Function} [customizer] The function to customize cloning. 38677 * @returns {*} Returns the cloned value. 38678 * @see _.cloneDeepWith 38679 * @example 38680 * 38681 * function customizer(value) { 38682 * if (_.isElement(value)) { 38683 * return value.cloneNode(false); 38684 * } 38685 * } 38686 * 38687 * var el = _.cloneWith(document.body, customizer); 38688 * 38689 * console.log(el === document.body); 38690 * // => false 38691 * console.log(el.nodeName); 38692 * // => 'BODY' 38693 * console.log(el.childNodes.length); 38694 * // => 0 38695 */ 38696 function cloneWith(value, customizer) { 38697 customizer = typeof customizer == 'function' ? customizer : undefined; 38698 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 38699 } 38700 38701 /** 38702 * This method is like `_.clone` except that it recursively clones `value`. 38703 * 38704 * @static 38705 * @memberOf _ 38706 * @since 1.0.0 38707 * @category Lang 38708 * @param {*} value The value to recursively clone. 38709 * @returns {*} Returns the deep cloned value. 38710 * @see _.clone 38711 * @example 38712 * 38713 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 38714 * 38715 * var deep = _.cloneDeep(objects); 38716 * console.log(deep[0] === objects[0]); 38717 * // => false 38718 */ 38719 function cloneDeep(value) { 38720 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 38721 } 38722 38723 /** 38724 * This method is like `_.cloneWith` except that it recursively clones `value`. 38725 * 38726 * @static 38727 * @memberOf _ 38728 * @since 4.0.0 38729 * @category Lang 38730 * @param {*}
38730 value The value to recursively clone. 38731 * @param {Function} [customizer] The function to customize cloning. 38732 * @returns {*} Returns the deep cloned value. 38733 * @see _.cloneWith 38734 * @example 38735 * 38736 * function customizer(value) { 38737 * if (_.isElement(value)) { 38738 * return value.cloneNode(true); 38739 * } 38740 * } 38741 * 38742 * var el = _.cloneDeepWith(document.body, customizer); 38743 * 38744 * console.log(el === document.body); 38745 * // => false 38746 * console.log(el.nodeName); 38747 * // => 'BODY' 38748 * console.log(el.childNodes.length); 38749 * // => 20 38750 */ 38751 function cloneDeepWith(value, customizer) { 38752 customizer = typeof customizer == 'function' ? customizer : undefined; 38753 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 38754 } 38755 38756 /** 38757 * Checks if `object` conforms to `source` by invoking the predicate 38758 * properties of `source` with the corresponding property values of `object`. 38759 * 38760 * **Note:** This method is equivalent to `_.conforms` when `source` is 38761 * partially applied. 38762 * 38763 * @static 38764 * @memberOf _ 38765 * @since 4.14.0 38766 * @category Lang 38767 * @param {Object} object The object to inspect. 38768 * @param {Object} source The object of property predicates to conform to. 38769 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 38770 * @example 38771 * 38772 * var object = { 'a': 1, 'b': 2 }; 38773 * 38774 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 38775 * // => true 38776 * 38777 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 38778 * // => false 38779 */ 38780 function conformsTo(object, source) { 38781 return source == null || baseConformsTo(object, source, keys(source)); 38782 } 38783 38784 /** 38785 * Performs a 38786 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 38787 * comparison between two values to determine if they are equivalent. 38788 * 38789 * @static 38790 * @memberOf _ 38791 * @since 4.0.0 38792 * @category Lang 38793 * @param {*} value The value to compare. 38794 * @param {*} other The other value to compare. 38795 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 38796 * @example 38797 * 38798 * var object = { 'a': 1 }; 38799 * var other = { 'a': 1 }; 38800 * 38801 * _.eq(object, object); 38802 * // => true 38803 * 38804 * _.eq(object, other); 38805 * // => false 38806 * 38807 * _.eq('a', 'a'); 38808 * // => true 38809 * 38810 * _.eq('a', Object('a')); 38811 * // => false 38812 * 38813 * _.eq(NaN, NaN); 38814 * // => true 38815 */ 38816 function eq(value, other) { 38817 return value === other || (value !== value && other !== other); 38818 } 38819 38820 /** 38821 * Checks if `value` is greater than `other`. 38822 * 38823 * @static 38824 * @memberOf _ 38825 * @since 3.9.0 38826 * @category Lang 38827 * @param {*} value The value to compare. 38828 * @param {*} other The other value to compare. 38829 * @returns {boolean} Returns `true` if `value` is greater than `other`, 38830 * else `false`. 38831 * @see _.lt 38832 * @example 38833 * 38834 * _.gt(3, 1); 38835 * // => true 38836 * 38837 * _.gt(3, 3); 38838 * // => false 38839 * 38840 * _.gt(1, 3); 38841 * // => false 38842 */ 38843 var gt = createRelationalOperation(baseGt); 38844 38845 /** 38846 * Checks if `value` is greater than or equal to `other`. 38847 * 38848 * @static 38849 * @memberOf _ 38850 * @since 3.9.0 38851 * @category Lang 38852 * @param {*} value The value to compare. 38853 * @param {*} other The other value to compare. 38854 * @returns {boolean} Returns `true` if `value` is greater than or equal to 38855 * `other`, else `false`. 38856 * @see _.lte 38857 * @example 38858 * 38859 * _.gte(3, 1); 38860 * // => true 38861 * 38862 * _.gte(3, 3); 38863 * // => true 38864 * 38865 * _.gte(1, 3); 38866 * // => false 38867 */ 38868 var gte = createRelationalOperation(function(value, other) { 38869 return value >= other; 38870 }); 38871 38872 /** 38873 * Checks if `value` is likely an `arguments` object. 38874 * 38875 * @static 38876 * @memberOf _ 38877 * @since 0.1.0 38878 * @category Lang 38879 * @param {*} value The value to check. 38880 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 38881 * else `false`. 38882 * @example 38883 * 38884 * _.isArguments(function() { return arguments; }()); 38885 * // => true 38886 * 38887 * _.isArguments([1, 2, 3]); 38888 * // => false 38889 */ 38890 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 38891 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 38892 !propertyIsEnumerable.call(value, 'callee'); 38893 }; 38894 38895 /** 38896 * Checks if `value` is classified as an `Array` object. 38897 * 38898 * @static 38899 * @memberOf _ 38900 * @since 0.1.0 38901 * @category Lang 38902 * @param {*} value The value to check. 38903 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 38904 * @example 38905 * 38906 * _.isArray([1, 2, 3]); 38907 * // => true 38908 * 38909 * _.isArray(document.body.children); 38910 * // => false 38911 * 38912 * _.isArray('abc'); 38913 * // => false 38914 * 38915 * _.isArray(_.noop); 38916 * // => false 38917 */ 38918 var isArray = Array.isArray; 38919 38920 /** 38921 * Checks if `value` is classified as an `ArrayBuffer` object. 38922 * 38923 * @static 38924 * @memberOf _ 38925 * @since 4.3.0 38926 * @category Lang 38927 * @param {*} value The value to check. 38928 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 38929 * @example 38930 * 38931 * _.isArrayBuffer(new ArrayBuffer(2)); 38932 * // => true 38933 * 38934 * _.isArrayBuffer(new Array(2)); 38935 * // => false 38936 */ 38937 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 38938 38939 /** 38940 * Checks if `value` is array-like. A value is considered array-like if it's 38941 * not a function and has a `value.length` that's an integer greater than or 38942 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 38943 * 38944 * @static 38945 * @memberOf _ 38946 * @since 4.0.0 38947 * @category Lang 38948 * @param {*} value The value to check. 38949 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 38950 * @example 38951 * 38952 * _.isArrayLike([1, 2, 3]); 38953 * // => true 38954 * 38955 * _.isArrayLike(document.body.children); 38956 * // => true 38957 * 38958 * _.isArrayLike('abc'); 38959 * // => true 38960 * 38961 * _.isArrayLike(_.noop); 38962 * // => false 38963 */ 38964 function isArrayLike(value) { 38965 return value != null && isLength(value.length) && !isFunction(value); 38966 } 38967 38968 /** 38969 * This method is like `_.isArrayLike` except that it also checks if `value` 38970 * is an object. 38971 * 38972 * @static 38973 * @memberOf _ 38974 * @since 4.0.0 38975 * @category Lang 38976 * @param {*} value The value to check. 38977 * @returns {boolean} Returns `true` if `value` is an array-like object, 38978 * else `false`. 38979 * @example 38980 * 38981 * _.isArrayLikeObject([1, 2, 3]); 38982 * // => true 38983 * 38984 * _.isArrayLikeObject(document.body.children); 38985 * // => true 38986 * 38987 * _.isArrayLikeObject('abc'); 38988 * // => false 38989 * 38990 * _.isArrayLikeObject(_.noop); 38991 * // => false 38992 */ 38993 function isArrayLikeObject(value) { 38994 return isObjectLike(value) && isArrayLike(value); 38995 } 38996 38997 /** 38998 * Checks if `value` is classified as a boolean primitive or object. 38999 * 39000 * @static 39001 * @memberOf _ 39002 * @since 0.1.0 39003 * @category Lang 39004 * @param {*} value The value to check. 39005 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 39006 * @example 39007 * 39008 * _.isBoolean(false); 39009 * // => true 39010 * 39011 * _.isBoolean(null); 39012 * // => false 39013 */ 39014 function isBoolean(value) { 39015 return value === true || value === false || 39016 (isObjectLike(value) && baseGetTag(value) == boolTag); 39017 } 39018 39019 /** 39020 * Checks if `value` is a buffer. 39021 * 39022 * @static 39023 * @memberOf _ 39024 * @since 4.3.0 39025 * @category Lang 39026 * @param {*} value The value to check. 39027 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 39028 * @example 39029 * 39030 * _.isBuffer(new Buffer(2)); 39031 * // => true 39032 * 39033 * _.isBuffer(new Uint8Array(2)); 39034 * // => false 39035 */ 39036 var isBuffer = nativeIsBuffer || stubFalse; 39037 39038 /** 39039 * Checks if `value` is classified as a `Date` object. 39040 * 39041 * @static 39042 * @memberOf _ 39043 * @since 0.1.0 39044 * @category Lang 39045 * @param {*} value The value to check. 39046 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 39047 * @example 39048 * 39049 * _.isDate(new Date); 39050 * // => true 39051 * 39052 * _.isDate('Mon April 23 2012'); 39053 * // => false 39054 */ 39055 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 39056 39057 /** 39058 * Checks if `value` is likely a DOM element. 39059 * 39060 * @static 39061 * @memberOf _ 39062 * @since 0.1.0 39063 * @category Lang 39064 * @param {*} value The value to check. 39065 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 39066 * @example 39067 * 39068 * _.isElement(document.body); 39069 * // => true 39070 * 39071 * _.isElement('<body>'); 39072 * // => false 39073 */ 39074 function isElement(value) { 39075 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 39076 } 39077 39078 /** 39079 * Checks if `value` is an empty object, collection, map, or set. 39080 * 39081 * Objects are considered empty if they have no own enumerable str
39081ing keyed 39082 * properties. 39083 * 39084 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 39085 * jQuery-like collections are considered empty if they have a `length` of `0`. 39086 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 39087 * 39088 * @static 39089 * @memberOf _ 39090 * @since 0.1.0 39091 * @category Lang 39092 * @param {*} value The value to check. 39093 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 39094 * @example 39095 * 39096 * _.isEmpty(null); 39097 * // => true 39098 * 39099 * _.isEmpty(true); 39100 * // => true 39101 * 39102 * _.isEmpty(1); 39103 * // => true 39104 * 39105 * _.isEmpty([1, 2, 3]); 39106 * // => false 39107 * 39108 * _.isEmpty({ 'a': 1 }); 39109 * // => false 39110 */ 39111 function isEmpty(value) { 39112 if (value == null) { 39113 return true; 39114 } 39115 if (isArrayLike(value) && 39116 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 39117 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 39118 return !value.length; 39119 } 39120 var tag = getTag(value); 39121 if (tag == mapTag || tag == setTag) { 39122 return !value.size; 39123 } 39124 if (isPrototype(value)) { 39125 return !baseKeys(value).length; 39126 } 39127 for (var key in value) { 39128 if (hasOwnProperty.call(value, key)) { 39129 return false; 39130 } 39131 } 39132 return true; 39133 } 39134 39135 /** 39136 * Performs a deep comparison between two values to determine if they are 39137 * equivalent. 39138 * 39139 * **Note:** This method supports comparing arrays, array buffers, booleans, 39140 * date objects, error objects, maps, numbers, `Object` objects, regexes, 39141 * sets, strings, symbols, and typed arrays. `Object` objects are compared 39142 * by their own, not inherited, enumerable properties. Functions and DOM 39143 * nodes are compared by strict equality, i.e. `===`. 39144 * 39145 * @static 39146 * @memberOf _ 39147 * @since 0.1.0 39148 * @category Lang 39149 * @param {*} value The value to compare. 39150 * @param {*} other The other value to compare. 39151 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 39152 * @example 39153 * 39154 * var object = { 'a': 1 }; 39155 * var other = { 'a': 1 }; 39156 * 39157 * _.isEqual(object, other); 39158 * // => true 39159 * 39160 * object === other; 39161 * // => false 39162 */ 39163 function isEqual(value, other) { 39164 return baseIsEqual(value, other); 39165 } 39166 39167 /** 39168 * This method is like `_.isEqual` except that it accepts `customizer` which 39169 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 39170 * are handled by the method instead. The `customizer` is invoked with up to 39171 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 39172 * 39173 * @static 39174 * @memberOf _ 39175 * @since 4.0.0 39176 * @category Lang 39177 * @param {*} value The value to compare. 39178 * @param {*} other The other value to compare. 39179 * @param {Function} [customizer] The function to customize comparisons. 39180 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 39181 * @example 39182 * 39183 * function isGreeting(value) { 39184 * return /^h(?:i|ello)$/.test(value); 39185 * } 39186 * 39187 * function customizer(objValue, othValue) { 39188 * if (isGreeting(objValue) && isGreeting(othValue)) { 39189 * return true; 39190 * } 39191 * } 39192 * 39193 * var array = ['hello', 'goodbye']; 39194 * var other = ['hi', 'goodbye']; 39195 * 39196 * _.isEqualWith(array, other, customizer); 39197 * // => true 39198 */ 39199 function isEqualWith(value, other, customizer) { 39200 customizer = typeof customizer == 'function' ? customizer : undefined; 39201 var result = customizer ? customizer(value, other) : undefined; 39202 return result === undefined ? baseIsEqual(value, other, undefined
vendor: 8,441 bytes, lines 39202-39492
39202, customizer) : !!result; 39203 } 39204 39205 /** 39206 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 39207 * `SyntaxError`, `TypeError`, or `URIError` object. 39208 * 39209 * @static 39210 * @memberOf _ 39211 * @since 3.0.0 39212 * @category Lang 39213 * @param {*} value The value to check. 39214 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 39215 * @example 39216 * 39217 * _.isError(new Error); 39218 * // => true 39219 * 39220 * _.isError(Error); 39221 * // => false 39222 */ 39223 function isError(value) { 39224 if (!isObjectLike(value)) { 39225 return false; 39226 } 39227 var tag = baseGetTag(value); 39228 return tag == errorTag || tag == domExcTag || 39229 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 39230 } 39231 39232 /** 39233 * Checks if `value` is a finite primitive number. 39234 * 39235 * **Note:** This method is based on 39236 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 39237 * 39238 * @static 39239 * @memberOf _ 39240 * @since 0.1.0 39241 * @category Lang 39242 * @param {*} value The value to check. 39243 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 39244 * @example 39245 * 39246 * _.isFinite(3); 39247 * // => true 39248 * 39249 * _.isFinite(Number.MIN_VALUE); 39250 * // => true 39251 * 39252 * _.isFinite(Infinity); 39253 * // => false 39254 * 39255 * _.isFinite('3'); 39256 * // => false 39257 */ 39258 function isFinite(value) { 39259 return typeof value == 'number' && nativeIsFinite(value); 39260 } 39261 39262 /** 39263 * Checks if `value` is classified as a `Function` object. 39264 * 39265 * @static 39266 * @memberOf _ 39267 * @since 0.1.0 39268 * @category Lang 39269 * @param {*} value The value to check. 39270 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 39271 * @example 39272 * 39273 * _.isFunction(_); 39274 * // => true 39275 * 39276 * _.isFunction(/abc/); 39277 * // => false 39278 */ 39279 function isFunction(value) { 39280 if (!isObject(value)) { 39281 return false; 39282 } 39283 // The use of `Object#toString` avoids issues with the `typeof` operator 39284 // in Safari 9 which returns 'object' for typed arrays and other constructors. 39285 var tag = baseGetTag(value); 39286 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 39287 } 39288 39289 /** 39290 * Checks if `value` is an integer. 39291 * 39292 * **Note:** This method is based on 39293 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 39294 * 39295 * @static 39296 * @memberOf _ 39297 * @since 4.0.0 39298 * @category Lang 39299 * @param {*} value The value to check. 39300 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 39301 * @example 39302 * 39303 * _.isInteger(3); 39304 * // => true 39305 * 39306 * _.isInteger(Number.MIN_VALUE); 39307 * // => false 39308 * 39309 * _.isInteger(Infinity); 39310 * // => false 39311 * 39312 * _.isInteger('3'); 39313 * // => false 39314 */ 39315 function isInteger(value) { 39316 return typeof value == 'number' && value == toInteger(value); 39317 } 39318 39319 /** 39320 * Checks if `value` is a valid array-like length. 39321 * 39322 * **Note:** This method is loosely based on 39323 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 39324 * 39325 * @static 39326 * @memberOf _ 39327 * @since 4.0.0 39328 * @category Lang 39329 * @param {*} value The value to check. 39330 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 39331 * @example 39332 * 39333 * _.isLength(3); 39334 * // => true 39335 * 39336 * _.isLength(Number.MIN_VALUE); 39337 * // => false 39338 * 39339 * _.isLength(Infinity); 39340 * // => false 39341 * 39342 * _.isLength('3'); 39343 * // => false 39344 */ 39345 function isLength(value) { 39346 return typeof value == 'number' && 39347 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 39348 } 39349 39350 /** 39351 * Checks if `value` is the 39352 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 39353 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 39354 * 39355 * @static 39356 * @memberOf _ 39357 * @since 0.1.0 39358 * @category Lang 39359 * @param {*} value The value to check. 39360 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 39361 * @example 39362 * 39363 * _.isObject({}); 39364 * // => true 39365 * 39366 * _.isObject([1, 2, 3]); 39367 * // => true 39368 * 39369 * _.isObject(_.noop); 39370 * // => true 39371 * 39372 * _.isObject(null); 39373 * // => false 39374 */ 39375 function isObject(value) { 39376 var type = typeof value; 39377 return value != null && (type == 'object' || type == 'function'); 39378 } 39379 39380 /** 39381 * Checks if `value` is object-like. A value is object-like if it's not `null` 39382 * and has a `typeof` result of "object". 39383 * 39384 * @static 39385 * @memberOf _ 39386 * @since 4.0.0 39387 * @category Lang 39388 * @param {*} value The value to check. 39389 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 39390 * @example 39391 * 39392 * _.isObjectLike({}); 39393 * // => true 39394 * 39395 * _.isObjectLike([1, 2, 3]); 39396 * // => true 39397 * 39398 * _.isObjectLike(_.noop); 39399 * // => false 39400 * 39401 * _.isObjectLike(null); 39402 * // => false 39403 */ 39404 function isObjectLike(value) { 39405 return value != null && typeof value == 'object'; 39406 } 39407 39408 /** 39409 * Checks if `value` is classified as a `Map` object. 39410 * 39411 * @static 39412 * @memberOf _ 39413 * @since 4.3.0 39414 * @category Lang 39415 * @param {*} value The value to check. 39416 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 39417 * @example 39418 * 39419 * _.isMap(new Map); 39420 * // => true 39421 * 39422 * _.isMap(new WeakMap); 39423 * // => false 39424 */ 39425 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 39426 39427 /** 39428 * Performs a partial deep comparison between `object` and `source` to 39429 * determine if `object` contains equivalent property values. 39430 * 39431 * **Note:** This method is equivalent to `_.matches` when `source` is 39432 * partially applied. 39433 * 39434 * Partial comparisons will match empty array and empty object `source` 39435 * values against any array or object value, respectively. See `_.isEqual` 39436 * for a list of supported value comparisons. 39437 * 39438 * @static 39439 * @memberOf _ 39440 * @since 3.0.0 39441 * @category Lang 39442 * @param {Object} object The object to inspect. 39443 * @param {Object} source The object of property values to match. 39444 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 39445 * @example 39446 * 39447 * var object = { 'a': 1, 'b': 2 }; 39448 * 39449 * _.isMatch(object, { 'b': 2 }); 39450 * // => true 39451 * 39452 * _.isMatch(object, { 'b': 1 }); 39453 * // => false 39454 */ 39455 function isMatch(object, source) { 39456 return object === source || baseIsMatch(object, source, getMatchData(source)); 39457 } 39458 39459 /** 39460 * This method is like `_.isMatch` except that it accepts `customizer` which 39461 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 39462 * are handled by the method instead. The `customizer` is invoked with five 39463 * arguments: (objValue, srcValue, index|key, object, source). 39464 * 39465 * @static 39466 * @memberOf _ 39467 * @since 4.0.0 39468 * @category Lang 39469 * @param {Object} object The object to inspect. 39470 * @param {Object} source The object of property values to match. 39471 * @param {Function} [customizer] The function to customize comparisons. 39472 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 39473 * @example 39474 * 39475 * function isGreeting(value) { 39476 * return /^h(?:i|ello)$/.test(value); 39477 * } 39478 * 39479 * function customizer(objValue, srcValue) { 39480 * if (isGreeting(objValue) && isGreeting(srcValue)) { 39481 * return true; 39482 * } 39483 * } 39484 * 39485 * var object = { 'greeting': 'hello' }; 39486 * var source = { 'greeting': 'hi' }; 39487 * 39488 * _.isMatchWith(object, source, customizer); 39489 * // => true 39490 */ 39491 function isMatchWith(object, source, customizer) { 39492 customizer = typeof customizer == 'function' ? customizer : undefined
39492; 39493 return baseIsMatch(object, source, getMatchData(source), customizer); 39494 } 39495 39496 /** 39497 * Checks if `value` is `NaN`. 39498 * 39499 * **Note:** This method is based on 39500 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 39501 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 39502 * `undefined` and other non-number values. 39503 * 39504 * @static 39505 * @memberOf _ 39506 * @since 0.1.0 39507 * @category Lang 39508 * @param {*} value The value to check. 39509 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 39510 * @example 39511 * 39512 * _.isNaN(NaN); 39513 * // => true 39514 * 39515 * _.isNaN(new Number(NaN)); 39516 * // => true 39517 * 39518 * isNaN(undefined); 39519 * // => true 39520 * 39521 * _.isNaN(undefined); 39522 * // => false 39523 */ 39524 function isNaN(value) { 39525 // An `NaN` primitive is the only value that is not equal to itself. 39526 // Perform the `toStringTag` check first to avoid errors with some 39527 // ActiveX objects in IE. 39528 return isNumber(value) && value != +value; 39529 } 39530 39531 /** 39532 * Checks if `value` is a pristine native function. 39533 * 39534 * **Note:** This method can't reliably detect native functions in the presence 39535 * of the core-js package because core-js circumvents this kind of detection. 39536 * Despite multiple requests, the core-js maintainer has made it clear: any 39537 * attempt to fix the detection will be obstructed. As a result, we're left 39538 * with little choice but to throw an error. Unfortunately, this also affects 39539 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 39540 * which rely on core-js. 39541 * 39542 * @static 39543 * @memberOf _ 39544 * @since 3.0.0 39545 * @category Lang 39546 * @param {*} value The value to check. 39547 * @returns {boolean} Returns `true` if `value` is a native function, 39548 * else `false`. 39549 * @example 39550 * 39551 * _.isNative(Array.prototype.push); 39552 * // => true 39553 * 39554 * _.isNative(_); 39555 * // => false 39556 */ 39557 function isNative(value) { 39558 if (isMaskable(value)) { 39559 throw new Error(CORE_ERROR_TEXT); 39560 } 39561 return baseIsNative(value); 39562 } 39563 39564 /** 39565 * Checks if `value` is `null`. 39566 * 39567 * @static 39568 * @memberOf _ 39569 * @since 0.1.0 39570 * @category Lang 39571 * @param {*} value The value to check. 39572 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 39573 * @example 39574 * 39575 * _.isNull(null); 39576 * // => true 39577 * 39578 * _.isNull(void 0); 39579 * // => false 39580 */ 39581 function isNull(value) { 39582 return value === null; 39583 } 39584 39585 /** 39586 * Checks if `value` is `null` or `undefined`. 39587 * 39588 * @static 39589 * @memberOf _ 39590 * @since 4.0.0 39591 * @category Lang 39592 * @param {*} value The value to check. 39593 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 39594 * @example 39595 * 39596 * _.isNil(null); 39597 * // => true 39598 * 39599 * _.isNil(void 0); 39600 * // => true 39601 * 39602 * _.isNil(NaN); 39603 * // => false 39604 */ 39605 function isNil(value) { 39606 return value == null; 39607 } 39608 39609 /** 39610 * Checks if `value` is classified as a `Number` primitive or object. 39611 * 39612 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 39613 * classified as numbers, use the `_.isFinite` method. 39614 * 39615 * @static 39616 * @memberOf _ 39617 * @since 0.1.0 39618 * @category Lang 39619 * @param {*} value The value to check. 39620 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 39621 * @example 39622 * 39623 * _.isNumber(3); 39624 * // => true 39625 * 39626 * _.isNumber(Number.MIN_VALUE); 39627 * // => true 39628 * 39629 * _.isNumber(Infinity); 39630 * // => true 39631 * 39632 * _.isNumber('3'); 39633 * // => false 39634 */ 39635 function isNumber(value) { 39636 return typeof value == 'number' || 39637 (isObjectLike(value) && baseGetTag(value) == numberTag); 39638 } 39639 39640 /** 39641 * Checks if `value` is a plain object, that is, an object created by the 39642 * `Object` constructor or one with a `[[Prototype]]` of `null`. 39643 * 39644 * @static 39645 * @memberOf _ 39646 * @since 0.8.0 39647 * @category Lang 39648 * @param {*} value The value to check. 39649 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 39650 * @example 39651 * 39652 * function Foo() { 39653 * this.a = 1; 39654 * } 39655 * 39656 * _.isPlainObject(new Foo); 39657 * // => false 39658 * 39659 * _.isPlainObject([1, 2, 3]); 39660 * // => false 39661 * 39662 * _.isPlainObject({ 'x': 0, 'y': 0 }); 39663 * // => true 39664 * 39665 * _.isPlainObject(Object.create(null)); 39666 * // => true 39667 */ 39668 function isPlainObject(value) { 39669 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 39670 return false;
vendor: 6,791 bytes, lines 39671-39929
39671 } 39672 var proto = getPrototype(value); 39673 if (proto === null) { 39674 return true; 39675 } 39676 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 39677 return typeof Ctor == 'function' && Ctor instanceof Ctor && 39678 funcToString.call(Ctor) == objectCtorString; 39679 } 39680 39681 /** 39682 * Checks if `value` is classified as a `RegExp` object. 39683 * 39684 * @static 39685 * @memberOf _ 39686 * @since 0.1.0 39687 * @category Lang 39688 * @param {*} value The value to check. 39689 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 39690 * @example 39691 * 39692 * _.isRegExp(/abc/); 39693 * // => true 39694 * 39695 * _.isRegExp('/abc/'); 39696 * // => false 39697 */ 39698 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 39699 39700 /** 39701 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 39702 * double precision number which isn't the result of a rounded unsafe integer. 39703 * 39704 * **Note:** This method is based on 39705 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 39706 * 39707 * @static 39708 * @memberOf _ 39709 * @since 4.0.0 39710 * @category Lang 39711 * @param {*} value The value to check. 39712 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 39713 * @example 39714 * 39715 * _.isSafeInteger(3); 39716 * // => true 39717 * 39718 * _.isSafeInteger(Number.MIN_VALUE); 39719 * // => false 39720 * 39721 * _.isSafeInteger(Infinity); 39722 * // => false 39723 * 39724 * _.isSafeInteger('3'); 39725 * // => false 39726 */ 39727 function isSafeInteger(value) { 39728 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 39729 } 39730 39731 /** 39732 * Checks if `value` is classified as a `Set` object. 39733 * 39734 * @static 39735 * @memberOf _ 39736 * @since 4.3.0 39737 * @category Lang 39738 * @param {*} value The value to check. 39739 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 39740 * @example 39741 * 39742 * _.isSet(new Set); 39743 * // => true 39744 * 39745 * _.isSet(new WeakSet); 39746 * // => false 39747 */ 39748 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 39749 39750 /** 39751 * Checks if `value` is classified as a `String` primitive or object. 39752 * 39753 * @static 39754 * @since 0.1.0 39755 * @memberOf _ 39756 * @category Lang 39757 * @param {*} value The value to check. 39758 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 39759 * @example 39760 * 39761 * _.isString('abc'); 39762 * // => true 39763 * 39764 * _.isString(1); 39765 * // => false 39766 */ 39767 function isString(value) { 39768 return typeof value == 'string' || 39769 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 39770 } 39771 39772 /** 39773 * Checks if `value` is classified as a `Symbol` primitive or object. 39774 * 39775 * @static 39776 * @memberOf _ 39777 * @since 4.0.0 39778 * @category Lang 39779 * @param {*} value The value to check. 39780 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 39781 * @example 39782 * 39783 * _.isSymbol(Symbol.iterator); 39784 * // => true 39785 * 39786 * _.isSymbol('abc'); 39787 * // => false 39788 */ 39789 function isSymbol(value) { 39790 return typeof value == 'symbol' || 39791 (isObjectLike(value) && baseGetTag(value) == symbolTag); 39792 } 39793 39794 /** 39795 * Checks if `value` is classified as a typed array. 39796 * 39797 * @static 39798 * @memberOf _ 39799 * @since 3.0.0 39800 * @category Lang 39801 * @param {*} value The value to check. 39802 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 39803 * @example 39804 * 39805 * _.isTypedArray(new Uint8Array); 39806 * // => true 39807 * 39808 * _.isTypedArray([]); 39809 * // => false 39810 */ 39811 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 39812 39813 /** 39814 * Checks if `value` is `undefined`. 39815 * 39816 * @static 39817 * @since 0.1.0 39818 * @memberOf _ 39819 * @category Lang 39820 * @param {*} value The value to check. 39821 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 39822 * @example 39823 * 39824 * _.isUndefined(void 0); 39825 * // => true 39826 * 39827 * _.isUndefined(null); 39828 * // => false 39829 */ 39830 function isUndefined(value) { 39831 return value === undefined; 39832 } 39833 39834 /** 39835 * Checks if `value` is classified as a `WeakMap` object. 39836 * 39837 * @static 39838 * @memberOf _ 39839 * @since 4.3.0 39840 * @category Lang 39841 * @param {*} value The value to check. 39842 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 39843 * @example 39844 * 39845 * _.isWeakMap(new WeakMap); 39846 * // => true 39847 * 39848 * _.isWeakMap(new Map); 39849 * // => false 39850 */ 39851 function isWeakMap(value) { 39852 return isObjectLike(value) && getTag(value) == weakMapTag; 39853 } 39854 39855 /** 39856 * Checks if `value` is classified as a `WeakSet` object. 39857 * 39858 * @static 39859 * @memberOf _ 39860 * @since 4.3.0 39861 * @category Lang 39862 * @param {*} value The value to check. 39863 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 39864 * @example 39865 * 39866 * _.isWeakSet(new WeakSet); 39867 * // => true 39868 * 39869 * _.isWeakSet(new Set); 39870 * // => false 39871 */ 39872 function isWeakSet(value) { 39873 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 39874 } 39875 39876 /** 39877 * Checks if `value` is less than `other`. 39878 * 39879 * @static 39880 * @memberOf _ 39881 * @since 3.9.0 39882 * @category Lang 39883 * @param {*} value The value to compare. 39884 * @param {*} other The other value to compare. 39885 * @returns {boolean} Returns `true` if `value` is less than `other`, 39886 * else `false`. 39887 * @see _.gt 39888 * @example 39889 * 39890 * _.lt(1, 3); 39891 * // => true 39892 * 39893 * _.lt(3, 3); 39894 * // => false 39895 * 39896 * _.lt(3, 1); 39897 * // => false 39898 */ 39899 var lt = createRelationalOperation(baseLt); 39900 39901 /** 39902 * Checks if `value` is less than or equal to `other`. 39903 * 39904 * @static 39905 * @memberOf _ 39906 * @since 3.9.0 39907 * @category Lang 39908 * @param {*} value The value to compare. 39909 * @param {*} other The other value to compare. 39910 * @returns {boolean} Returns `true` if `value` is less than or equal to 39911 * `other`, else `false`. 39912 * @see _.gte 39913 * @example 39914 * 39915 * _.lte(1, 3); 39916 * // => true 39917 * 39918 * _.lte(3, 3); 39919 * // => true 39920 * 39921 * _.lte(3, 1); 39922 * // => false 39923 */ 39924 var lte = createRelationalOperation(function(value, other) { 39925 return value <= other; 39926 }); 39927 39928 /** 39929 * Converts `value` to an array.
39930 * 39931 * @static 39932 * @since 0.1.0 39933 * @memberOf _ 39934 * @category Lang 39935 * @param {*} value The value to convert. 39936 * @returns {Array} Returns the converted array. 39937 * @example 39938 * 39939 * _.toArray({ 'a': 1, 'b': 2 }); 39940 * // => [1, 2] 39941 * 39942 * _.toArray('abc'); 39943 * // => ['a', 'b', 'c'] 39944 * 39945 * _.toArray(1); 39946 * // => [] 39947 * 39948 * _.toArray(null); 39949 * // => [] 39950 */ 39951 function toArray(value) { 39952 if (!value) { 39953 return []; 39954 } 39955 if (isArrayLike(value)) { 39956 return isString(value) ? stringToArray(value) : copyArray(value); 39957 } 39958 if (symIterator && value[symIterator]) { 39959 return iteratorToArray(value[symIterator]()); 39960 } 39961 var tag = getTag(value), 39962 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 39963 39964 return func(value); 39965 } 39966 39967 /** 39968 * Converts `value` to a finite number. 39969 * 39970 * @static 39971 * @memberOf _ 39972 * @since 4.12.0 39973 * @category Lang 39974 * @param {*} value The value to convert. 39975 * @returns {number} Returns the converted number. 39976 * @example 39977 * 39978 * _.toFinite(3.2); 39979 * // => 3.2 39980 * 39981 * _.toFinite(Number.MIN_VALUE); 39982 * // => 5e-324 39983 * 39984 * _.toFinite(Infinity); 39985 * // => 1.7976931348623157e+308 39986 * 39987 * _.toFinite('3.2'); 39988 * // => 3.2 39989 */ 39990 function toFinite(value) { 39991 if (!value) { 39992 return value === 0 ? value : 0; 39993 } 39994 value = toNumber(value); 39995 if (value === INFINITY || value === -INFINITY) { 39996 var sign = (value < 0 ? -1 : 1); 39997 return sign * MAX_INTEGER; 39998 } 39999 return value === value ? value : 0; 40000 } 40001 40002 /** 40003 * Converts `value` to an integer. 40004 * 40005 * **Note:** This method is loosely based on 40006 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 40007 * 40008 * @static 40009 * @memberOf _ 40010 * @since 4.0.0 40011 * @category Lang 40012 * @param {*} value The value to convert. 40013 * @returns {number} Returns the converted integer. 40014 * @example 40015 * 40016 * _.toInteger(3.2); 40017 * // => 3 40018 * 40019 * _.toInteger(Number.MIN_VALUE); 40020 * // => 0 40021 * 40022 * _.toInteger(Infinity); 40023 * // => 1.7976931348623157e+308 40024 * 40025 * _.toInteger('3.2'); 40026 * // => 3 40027 */ 40028 function toInteger(value) { 40029 var result = toFinite(value), 40030 remainder = result % 1; 40031 40032 return result === result ? (remainder ? result - remainder : result) : 0; 40033 } 40034 40035 /** 40036 * Converts `value` to an integer suitable for use as the length of an 40037 * array-like object. 40038 * 40039 * **Note:** This method is based on 40040 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 40041 * 40042 * @static 40043 * @memberOf _ 40044 * @since 4.0.0 40045 * @category Lang 40046 * @param {*} value The value to convert. 40047 * @returns {number} Returns the converted integer. 40048 * @example 40049 * 40050 * _.toLength(3.2); 40051 * // => 3 40052 * 40053 * _.toLength(Number.MIN_VALUE); 40054 * // => 0 40055 * 40056 * _.toLength(Infinity); 40057 * // => 4294967295 40058 * 40059 * _.toLength('3.2'); 40060 * // => 3 40061 */ 40062 function toLength(value) { 40063 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 40064 } 40065 40066 /** 40067 * Converts `value` to a number. 40068 * 40069 * @static 40070 * @memberOf _ 40071 * @since 4.0.0 40072 * @category Lang 40073 * @param {*} value The value to process. 40074 * @returns {number} Returns the number. 40075 * @example 40076 * 40077 * _.toNumber(3.2); 40078 * // => 3.2 40079 * 40080 * _.toNumber(Number.MIN_VALUE); 40081 * // => 5e-324 40082 * 40083 * _.toNumber(Infinity); 40084 * // => Infinity 40085 * 40086 * _.toNumber('3.2'); 40087 * // => 3.2 40088 */ 40089 function toNumber(value) { 40090 if (typeof value == 'number') { 40091 return value; 40092 } 40093 if (isSymbol(value)) { 40094 return NAN; 40095 } 40096 if (isObject(value)) { 40097 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 40098 value = isObject(other) ? (other + '') : other; 40099 } 40100 if (typeof value != 'string') { 40101 return value === 0 ? value : +value; 40102 } 40103 value = value.replace(reTrim, ''
vendor: 9,661 bytes, lines 40103-40418
40103); 40104 var isBinary = reIsBinary.test(value); 40105 return (isBinary || reIsOctal.test(value)) 40106 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 40107 : (reIsBadHex.test(value) ? NAN : +value); 40108 } 40109 40110 /** 40111 * Converts `value` to a plain object flattening inherited enumerable string 40112 * keyed properties of `value` to own properties of the plain object. 40113 * 40114 * @static 40115 * @memberOf _ 40116 * @since 3.0.0 40117 * @category Lang 40118 * @param {*} value The value to convert. 40119 * @returns {Object} Returns the converted plain object. 40120 * @example 40121 * 40122 * function Foo() { 40123 * this.b = 2; 40124 * } 40125 * 40126 * Foo.prototype.c = 3; 40127 * 40128 * _.assign({ 'a': 1 }, new Foo); 40129 * // => { 'a': 1, 'b': 2 } 40130 * 40131 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 40132 * // => { 'a': 1, 'b': 2, 'c': 3 } 40133 */ 40134 function toPlainObject(value) { 40135 return copyObject(value, keysIn(value)); 40136 } 40137 40138 /** 40139 * Converts `value` to a safe integer. A safe integer can be compared and 40140 * represented correctly. 40141 * 40142 * @static 40143 * @memberOf _ 40144 * @since 4.0.0 40145 * @category Lang 40146 * @param {*} value The value to convert. 40147 * @returns {number} Returns the converted integer. 40148 * @example 40149 * 40150 * _.toSafeInteger(3.2); 40151 * // => 3 40152 * 40153 * _.toSafeInteger(Number.MIN_VALUE); 40154 * // => 0 40155 * 40156 * _.toSafeInteger(Infinity); 40157 * // => 9007199254740991 40158 * 40159 * _.toSafeInteger('3.2'); 40160 * // => 3 40161 */ 40162 function toSafeInteger(value) { 40163 return value 40164 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 40165 : (value === 0 ? value : 0); 40166 } 40167 40168 /** 40169 * Converts `value` to a string. An empty string is returned for `null` 40170 * and `undefined` values. The sign of `-0` is preserved. 40171 * 40172 * @static 40173 * @memberOf _ 40174 * @since 4.0.0 40175 * @category Lang 40176 * @param {*} value The value to convert. 40177 * @returns {string} Returns the converted string. 40178 * @example 40179 * 40180 * _.toString(null); 40181 * // => '' 40182 * 40183 * _.toString(-0); 40184 * // => '-0' 40185 * 40186 * _.toString([1, 2, 3]); 40187 * // => '1,2,3' 40188 */ 40189 function toString(value) { 40190 return value == null ? '' : baseToString(value); 40191 } 40192 40193 /*------------------------------------------------------------------------*/ 40194 40195 /** 40196 * Assigns own enumerable string keyed properties of source objects to the 40197 * destination object. Source objects are applied from left to right. 40198 * Subsequent sources overwrite property assignments of previous sources. 40199 * 40200 * **Note:** This method mutates `object` and is loosely based on 40201 * [`Object.assign`](https://mdn.io/Object/assign). 40202 * 40203 * @static 40204 * @memberOf _ 40205 * @since 0.10.0 40206 * @category Object 40207 * @param {Object} object The destination object. 40208 * @param {...Object} [sources] The source objects. 40209 * @returns {Object} Returns `object`. 40210 * @see _.assignIn 40211 * @example 40212 * 40213 * function Foo() { 40214 * this.a = 1; 40215 * } 40216 * 40217 * function Bar() { 40218 * this.c = 3; 40219 * } 40220 * 40221 * Foo.prototype.b = 2; 40222 * Bar.prototype.d = 4; 40223 * 40224 * _.assign({ 'a': 0 }, new Foo, new Bar); 40225 * // => { 'a': 1, 'c': 3 } 40226 */ 40227 var assign = createAssigner(function(object, source) { 40228 if (isPrototype(source) || isArrayLike(source)) { 40229 copyObject(source, keys(source), object); 40230 return; 40231 } 40232 for (var key in source) { 40233 if (hasOwnProperty.call(source, key)) { 40234 assignValue(object, key, source[key]); 40235 } 40236 } 40237 }); 40238 40239 /** 40240 * This method is like `_.assign` except that it iterates over own and 40241 * inherited source properties. 40242 * 40243 * **Note:** This method mutates `object`. 40244 * 40245 * @static 40246 * @memberOf _ 40247 * @since 4.0.0 40248 * @alias extend 40249 * @category Object 40250 * @param {Object} object The destination object. 40251 * @param {...Object} [sources] The source objects. 40252 * @returns {Object} Returns `object`. 40253 * @see _.assign 40254 * @example 40255 * 40256 * function Foo() { 40257 * this.a = 1; 40258 * } 40259 * 40260 * function Bar() { 40261 * this.c = 3; 40262 * } 40263 * 40264 * Foo.prototype.b = 2; 40265 * Bar.prototype.d = 4; 40266 * 40267 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 40268 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 40269 */ 40270 var assignIn = createAssigner(function(object, source) { 40271 copyObject(source, keysIn(source), object); 40272 }); 40273 40274 /** 40275 * This method is like `_.assignIn` except that it accepts `customizer` 40276 * which is invoked to produce the assigned values. If `customizer` returns 40277 * `undefined`, assignment is handled by the method instead. The `customizer` 40278 * is invoked with five arguments: (objValue, srcValue, key, object, source). 40279 * 40280 * **Note:** This method mutates `object`. 40281 * 40282 * @static 40283 * @memberOf _ 40284 * @since 4.0.0 40285 * @alias extendWith 40286 * @category Object 40287 * @param {Object} object The destination object. 40288 * @param {...Object} sources The source objects. 40289 * @param {Function} [customizer] The function to customize assigned values. 40290 * @returns {Object} Returns `object`. 40291 * @see _.assignWith 40292 * @example 40293 * 40294 * function customizer(objValue, srcValue) { 40295 * return _.isUndefined(objValue) ? srcValue : objValue; 40296 * } 40297 * 40298 * var defaults = _.partialRight(_.assignInWith, customizer); 40299 * 40300 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 40301 * // => { 'a': 1, 'b': 2 } 40302 */ 40303 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 40304 copyObject(source, keysIn(source), object, customizer); 40305 }); 40306 40307 /** 40308 * This method is like `_.assign` except that it accepts `customizer` 40309 * which is invoked to produce the assigned values. If `customizer` returns 40310 * `undefined`, assignment is handled by the method instead. The `customizer` 40311 * is invoked with five arguments: (objValue, srcValue, key, object, source). 40312 * 40313 * **Note:** This method mutates `object`. 40314 * 40315 * @static 40316 * @memberOf _ 40317 * @since 4.0.0 40318 * @category Object 40319 * @param {Object} object The destination object. 40320 * @param {...Object} sources The source objects. 40321 * @param {Function} [customizer] The function to customize assigned values. 40322 * @returns {Object} Returns `object`. 40323 * @see _.assignInWith 40324 * @example 40325 * 40326 * function customizer(objValue, srcValue) { 40327 * return _.isUndefined(objValue) ? srcValue : objValue; 40328 * } 40329 * 40330 * var defaults = _.partialRight(_.assignWith, customizer); 40331 * 40332 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 40333 * // => { 'a': 1, 'b': 2 } 40334 */ 40335 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 40336 copyObject(source, keys(source), object, customizer); 40337 }); 40338 40339 /** 40340 * Creates an array of values corresponding to `paths` of `object`. 40341 * 40342 * @static 40343 * @memberOf _ 40344 * @since 1.0.0 40345 * @category Object 40346 * @param {Object} object The object to iterate over. 40347 * @param {...(string|string[])} [paths] The property paths to pick. 40348 * @returns {Array} Returns the picked values. 40349 * @example 40350 * 40351 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 40352 * 40353 * _.at(object, ['a[0].b.c', 'a[1]']); 40354 * // => [3, 4] 40355 */ 40356 var at = flatRest(baseAt); 40357 40358 /** 40359 * Creates an object that inherits from the `prototype` object. If a 40360 * `properties` object is given, its own enumerable string keyed properties 40361 * are assigned to the created object. 40362 * 40363 * @static 40364 * @memberOf _ 40365 * @since 2.3.0 40366 * @category Object 40367 * @param {Object} prototype The object to inherit from. 40368 * @param {Object} [properties] The properties to assign to the object. 40369 * @returns {Object} Returns the new object. 40370 * @example 40371 * 40372 * function Shape() { 40373 * this.x = 0; 40374 * this.y = 0; 40375 * } 40376 * 40377 * function Circle() { 40378 * Shape.call(this); 40379 * } 40380 * 40381 * Circle.prototype = _.create(Shape.prototype, { 40382 * 'constructor': Circle 40383 * }); 40384 * 40385 * var circle = new Circle; 40386 * circle instanceof Circle; 40387 * // => true 40388 * 40389 * circle instanceof Shape; 40390 * // => true 40391 */ 40392 function create(prototype, properties) { 40393 var result = baseCreate(prototype); 40394 return properties == null ? result : baseAssign(result, properties); 40395 } 40396 40397 /** 40398 * Assigns own and inherited enumerable string keyed properties of source 40399 * objects to the destination object for all destination properties that 40400 * resolve to `undefined`. Source objects are applied from left to right. 40401 * Once a property is set, additional values of the same property are ignored. 40402 * 40403 * **Note:** This method mutates `object`. 40404 * 40405 * @static 40406 * @since 0.1.0 40407 * @memberOf _ 40408 * @category Object 40409 * @param {Object} object The destination object. 40410 * @param {...Object} [sources] The source objects. 40411 * @returns {Object} Returns `object`. 40412 * @see _.defaultsDeep 40413 * @example 40414 * 40415 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 40416 * // => { 'a': 1, 'b': 2 } 40417 */ 40418 var defaults = baseRest(function(
40418args) { 40419 args.push(undefined, customDefaultsAssignIn); 40420 return apply(assignInWith, undefined, args); 40421 }); 40422 40423 /** 40424 * This method is like `_.defaults` except that it recursively assigns 40425 * default properties. 40426 * 40427 * **Note:** This method mutates `object`. 40428 * 40429 * @static 40430 * @memberOf _ 40431 * @since 3.10.0 40432 * @category Object 40433 * @param {Object} object The destination object. 40434 * @param {...Object} [sources] The source objects. 40435 * @returns {Object} Returns `object`. 40436 * @see _.defaults 40437 * @example 40438 * 40439 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 40440 * // => { 'a': { 'b': 2, 'c': 3 } } 40441 */ 40442 var defaultsDeep = baseRest(function(args) { 40443 args.push(undefined, customDefaultsMerge); 40444 return apply(mergeWith, undefined, args); 40445 }); 40446 40447 /** 40448 * This method is like `_.find` except that it returns the key of the first 40449 * element `predicate` returns truthy for instead of the element itself. 40450 * 40451 * @static 40452 * @memberOf _ 40453 * @since 1.1.0 40454 * @category Object 40455 * @param {Object} object The object to inspect. 40456 * @param {Function} [predicate=_.identity] The function invoked per iteration. 40457 * @returns {string|undefined} Returns the key of the matched element, 40458 * else `undefined`. 40459 * @example 40460 * 40461 * var users = { 40462 * 'barney': { 'age': 36, 'active': true }, 40463 * 'fred': { 'age': 40, 'active': false }, 40464 * 'pebbles': { 'age': 1, 'active': true } 40465 * }; 40466 * 40467 * _.findKey(users, function(o) { return o.age < 40; }); 40468 * // => 'barney' (iteration order is not guaranteed) 40469 * 40470 * // The `_.matches` iteratee shorthand. 40471 * _.findKey(users, { 'age': 1, 'active': true }); 40472 * // => 'pebbles' 40473 * 40474 * // The `_.matchesProperty` iteratee shorthand. 40475 * _.findKey(users, ['active', false]); 40476 * // => 'fred' 40477 * 40478 * // The `_.property` iteratee shorthand. 40479 * _.findKey(users, 'active'); 40480 * // => 'barney' 40481 */ 40482 function findKey(object, predicate) { 40483 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 40484 } 40485 40486 /** 40487 * This method is like `_.findKey` except that it iterates over elements of 40488 * a collection in the opposite order. 40489 * 40490 * @static 40491 * @memberOf _ 40492 * @since 2.0.0 40493 * @category Object 40494 * @param {Object} object The object to inspect. 40495 * @param {Function} [predicate=_.identity] The function invoked per iteration. 40496 * @returns {string|undefined} Returns the key of the matched element, 40497 * else `undefined`. 40498 * @example 40499 * 40500 * var users = { 40501 * 'barney': { 'age': 36, 'active': true }, 40502 * 'fred': { 'age': 40, 'active': false }, 40503 * 'pebbles': { 'age': 1, 'active': true } 40504 * }; 40505 * 40506 * _.findLastKey(users, function(o) { return o.age < 40; }); 40507 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 40508 * 40509 * // The `_.matches` iteratee shorthand. 40510 * _.findLastKey(users, { 'age': 36, 'active': true }); 40511 * // => 'barney' 40512 * 40513 * // The `_.matchesProperty` iteratee shorthand. 40514 * _.findLastKey(users, ['active', false]); 40515 * // => 'fred' 40516 * 40517 * // The `_.property` iteratee shorthand. 40518 * _.findLastKey(users, 'active'); 40519 * // => 'pebbles' 40520 */ 40521 function findLastKey(object, predicate) { 40522 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 40523 } 40524 40525 /** 40526 * Iterates over own and inherited enumerable string keyed properties of an 40527 * object and invokes `iteratee` for each property. The iteratee is invoked 40528 * with three arguments: (value, key, object). Iteratee functions may exit 40529 * iteration early by explicitly returning `false`. 40530 * 40531 * @static 40532 * @memberOf _ 40533 * @since 0.3.0 40534 * @category Object 40535 * @param {Object} object The object to iterate over. 40536 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40537 * @returns {Object} Returns `object`. 40538 * @see _.forInRight 40539 * @example 40540 * 40541 * function Foo() { 40542 * this.a = 1; 40543 * this.b = 2; 40544 * } 40545 * 40546 * Foo.prototype.c = 3; 40547 * 40548 * _.forIn(new Foo, function(value, key) { 40549 * console.log(key); 40550 * }); 40551 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 40552 */ 40553 function forIn(object, iteratee) { 40554 return object == null 40555 ? object 40556 : baseFor(object, getIteratee(iteratee, 3), keysIn); 40557 } 40558 40559 /** 40560 * This method is like `_.forIn` except that it iterates over properties of 40561 * `object` in the opposite order. 40562 * 40563 * @static 40564 * @memberOf _ 40565 * @since 2.0.0 40566 * @category Object 40567 * @param {Object} object The object to iterate over. 40568 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40569 * @returns {Object} Returns `object`. 40570 * @see _.forIn 40571 * @example 40572 * 40573 * function Foo() { 40574 * this.a = 1; 40575 * this.b = 2; 40576 * } 40577 * 40578 * Foo.prototype.c = 3; 40579 * 40580 * _.forInRight(new Foo, function(value, key) { 40581 * console.log(key); 40582 * }); 40583 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 40584 */ 40585 function forInRight(object, iteratee) { 40586 return object == null 40587 ? object 40588 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 40589 } 40590 40591 /**
40592 * Iterates over own enumerable string keyed properties of an object and 40593 * invokes `iteratee` for each property. The iteratee is invoked with three 40594 * arguments: (value, key, object). Iteratee functions may exit iteration 40595 * early by explicitly returning `false`. 40596 * 40597 * @static 40598 * @memberOf _ 40599 * @since 0.3.0 40600 * @category Object 40601 * @param {Object} object The object to iterate over. 40602 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40603 * @returns {Object} Returns `object`. 40604 * @see _.forOwnRight 40605 * @example 40606 * 40607 * function Foo() { 40608 * this.a = 1; 40609 * this.b = 2; 40610 * } 40611 * 40612 * Foo.prototype.c = 3; 40613 * 40614 * _.forOwn(new Foo, function(value, key) { 40615 * console.log(key); 40616 * }); 40617 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 40618 */ 40619 function forOwn(object, iteratee) { 40620 return object && baseForOwn(object, getIteratee(iteratee, 3)); 40621 } 40622 40623 /** 40624 * This method is like `_.forOwn` except that it iterates over properties of 40625 * `object` in the opposite order. 40626 * 40627 * @static 40628 * @memberOf _ 40629 * @since 2.0.0 40630 * @category Object 40631 * @param {Object} object The object to iterate over. 40632 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40633 * @returns {Object} Returns `object`. 40634 * @see _.forOwn 40635 * @example 40636 * 40637 * function Foo() { 40638 * this.a = 1; 40639 * this.b = 2; 40640 * } 40641 * 40642 * Foo.prototype.c = 3; 40643 * 40644 * _.forOwnRight(new Foo, function(value, key) { 40645 * console.log(key); 40646 * }); 40647 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 40648 */ 40649 function forOwnRight(object, iteratee) { 40650 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 40651 } 40652 40653 /** 40654 * Creates an array of function property names from own enumerable properties 40655 * of `object`. 40656 * 40657 * @static 40658 * @since 0.1.0 40659 * @memberOf _ 40660 * @category Object 40661 * @param {Object} object The object to inspect. 40662 * @returns {Array} Returns the function names. 40663 * @see _.functionsIn 40664 * @example 40665 * 40666 * function Foo() { 40667 * this.a = _.constant('a'); 40668 * this.b = _.constant('b'); 40669 * } 40670 * 40671 * Foo.prototype.c = _.constant('c'); 40672 * 40673 * _.functions(new Foo); 40674 * // => ['a', 'b'] 40675 */ 40676 function functions(object) { 40677 return object == null ? [] : baseFunctions(object, keys(object)); 40678 } 40679 40680 /** 40681 * Creates an array of function property names from own and inherited 40682 * enumerable properties of `object`. 40683 * 40684 * @static 40685 * @memberOf _ 40686 * @since 4.0.0 40687 * @category Object 40688 * @param {Object} object The object to inspect. 40689 * @returns {Array} Returns the function names. 40690 * @see _.functions 40691 * @example 40692 * 40693 * function Foo() { 40694 * this.a = _.constant('a'); 40695 * this.b = _.constant('b'); 40696 * } 40697 * 40698 * Foo.prototype.c = _.constant('c'); 40699 * 40700 * _.functionsIn(new Foo); 40701 * // => ['a', 'b', 'c'] 40702 */ 40703 function functionsIn(object) { 40704 return object == null ? [] : baseFunctions(object, keysIn(object)); 40705 } 40706 40707 /** 40708 * Gets the value at `path` of `object`. If the resolved value is 40709 * `undefined`, the `defaultValue` is returned in its place. 40710 * 40711 * @static 40712 * @memberOf _ 40713 * @since 3.7.0 40714 * @category Object 40715 * @param {Object} object The object to query. 40716 * @param {Array|string} path The path of the property to get. 40717 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 40718 * @returns {*} Returns the resolved value. 40719 * @example 40720 * 40721 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 40722 * 40723 * _.get(object, 'a[0].b.c'); 40724 * // => 3 40725 * 40726 * _.get(object, ['a', '0', 'b', 'c']); 40727 * // => 3 40728 * 40729 * _.get(object, 'a.b.c', 'default'); 40730 * // => 'default' 40731 */ 40732 function get(object, path, defaultValue) { 40733 var result = object == null ? undefined : baseGet(object, path); 40734 return result === undefined ? defaultValue : result; 40735 } 40736 40737 /** 40738 * Checks if `path` is a direct property of `object`. 40739 * 40740 * @static 40741 * @since 0.1.0 40742 * @memberOf _ 40743 * @category Object 40744 * @param {Object} object The object to query. 40745 * @param {Array|string} path The path to check. 40746 * @returns {boolean} Returns `true` if `path` exists, else `false`. 40747 * @example 40748 * 40749 * var object = { 'a': { 'b': 2 } }; 40750 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 40751 * 40752 * _.has(object, 'a'); 40753 * // => true 40754 * 40755 * _.has(object, 'a.b'); 40756 * // => true 40757 * 40758 * _.has(object, ['a', 'b']); 40759 * // => true 40760 * 40761 * _.has(other, 'a'); 40762 * // => false 40763 */ 40764 function has(object, path) { 40765 return object != null && hasPath(object, path, baseHas); 40766 } 40767 40768 /** 40769 * Checks if `path` is a direct or inherited property of `object`. 40770 * 40771 * @static 40772 * @memberOf _ 40773 * @since 4.0.0 40774 * @category Object 40775 * @param {Object} object The object to query. 40776 * @param {Array|string} path The path to check. 40777 * @returns {boolean} Returns `true` if `path` exists, else `false`. 40778 * @example 40779 * 40780 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 40781 * 40782 * _.hasIn(object, 'a'); 40783 * // => true 40784 * 40785 * _.hasIn(object, 'a.b'); 40786 * // => true 40787 * 40788 * _.hasIn(object, ['a', 'b']); 40789 * // => true 40790 * 40791 * _.hasIn(object, 'b'); 40792 * // => false 40793 */ 40794 function hasIn(object, path) { 40795 return object != null && hasPath(object, path, baseHasIn); 40796 } 40797 40798 /**
40799 * Creates an object composed of the inverted keys and values of `object`. 40800 * If `object` contains duplicate values, subsequent values overwrite 40801 * property assignments of previous values. 40802 * 40803 * @static 40804 * @memberOf _ 40805 * @since 0.7.0 40806 * @category Object 40807 * @param {Object} object The object to invert. 40808 * @returns {Object} Returns the new inverted object. 40809 * @example 40810 * 40811 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 40812 * 40813 * _.invert(object); 40814 * // => { '1': 'c', '2': 'b' } 40815 */ 40816 var invert = createInverter(function(result, value, key) { 40817 result[value] = key; 40818 }, constant(identity)); 40819 40820 /** 40821 * This method is like `_.invert` except that the inverted object is generated 40822 * from the results of running each element of `object` thru `iteratee`. The 40823 * corresponding inverted value of each inverted key is an array of keys 40824 * responsible for generating the inverted value. The iteratee is invoked 40825 * with one argument: (value). 40826 * 40827 * @static 40828 * @memberOf _ 40829 * @since 4.1.0 40830 * @category Object 40831 * @param {Object} object The object to invert. 40832 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 40833 * @returns {Object} Returns the new inverted object. 40834 * @example 40835 * 40836 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 40837 * 40838 * _.invertBy(object); 40839 * // => { '1': ['a', 'c'], '2': ['b'] } 40840 * 40841 * _.invertBy(object, function(value) { 40842 * return 'group' + value; 40843 * }); 40844 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 40845 */ 40846 var invertBy = createInverter(function(result, value, key) {
vendor: 12,405 bytes, lines 40846-41228
40846 40847 if (hasOwnProperty.call(result, value)) { 40848 result[value].push(key); 40849 } else { 40850 result[value] = [key]; 40851 } 40852 }, getIteratee); 40853 40854 /** 40855 * Invokes the method at `path` of `object`. 40856 * 40857 * @static 40858 * @memberOf _ 40859 * @since 4.0.0 40860 * @category Object 40861 * @param {Object} object The object to query. 40862 * @param {Array|string} path The path of the method to invoke. 40863 * @param {...*} [args] The arguments to invoke the method with. 40864 * @returns {*} Returns the result of the invoked method. 40865 * @example 40866 * 40867 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 40868 * 40869 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 40870 * // => [2, 3] 40871 */ 40872 var invoke = baseRest(baseInvoke); 40873 40874 /** 40875 * Creates an array of the own enumerable property names of `object`. 40876 * 40877 * **Note:** Non-object values are coerced to objects. See the 40878 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 40879 * for more details. 40880 * 40881 * @static 40882 * @since 0.1.0 40883 * @memberOf _ 40884 * @category Object 40885 * @param {Object} object The object to query. 40886 * @returns {Array} Returns the array of property names. 40887 * @example 40888 * 40889 * function Foo() { 40890 * this.a = 1; 40891 * this.b = 2; 40892 * } 40893 * 40894 * Foo.prototype.c = 3; 40895 * 40896 * _.keys(new Foo); 40897 * // => ['a', 'b'] (iteration order is not guaranteed) 40898 * 40899 * _.keys('hi'); 40900 * // => ['0', '1'] 40901 */ 40902 function keys(object) { 40903 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 40904 } 40905 40906 /** 40907 * Creates an array of the own and inherited enumerable property names of `object`. 40908 * 40909 * **Note:** Non-object values are coerced to objects. 40910 * 40911 * @static 40912 * @memberOf _ 40913 * @since 3.0.0 40914 * @category Object 40915 * @param {Object} object The object to query. 40916 * @returns {Array} Returns the array of property names. 40917 * @example 40918 * 40919 * function Foo() { 40920 * this.a = 1; 40921 * this.b = 2; 40922 * } 40923 * 40924 * Foo.prototype.c = 3; 40925 * 40926 * _.keysIn(new Foo); 40927 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 40928 */ 40929 function keysIn(object) { 40930 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 40931 } 40932 40933 /** 40934 * The opposite of `_.mapValues`; this method creates an object with the 40935 * same values as `object` and keys generated by running each own enumerable 40936 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 40937 * with three arguments: (value, key, object). 40938 * 40939 * @static 40940 * @memberOf _ 40941 * @since 3.8.0 40942 * @category Object 40943 * @param {Object} object The object to iterate over. 40944 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40945 * @returns {Object} Returns the new mapped object. 40946 * @see _.mapValues 40947 * @example 40948 * 40949 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 40950 * return key + value; 40951 * }); 40952 * // => { 'a1': 1, 'b2': 2 } 40953 */ 40954 function mapKeys(object, iteratee) { 40955 var result = {}; 40956 iteratee = getIteratee(iteratee, 3); 40957 40958 baseForOwn(object, function(value, key, object) { 40959 baseAssignValue(result, iteratee(value, key, object), value); 40960 }); 40961 return result; 40962 } 40963 40964 /** 40965 * Creates an object with the same keys as `object` and values generated 40966 * by running each own enumerable string keyed property of `object` thru 40967 * `iteratee`. The iteratee is invoked with three arguments: 40968 * (value, key, object). 40969 * 40970 * @static 40971 * @memberOf _ 40972 * @since 2.4.0 40973 * @category Object 40974 * @param {Object} object The object to iterate over. 40975 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 40976 * @returns {Object} Returns the new mapped object. 40977 * @see _.mapKeys 40978 * @example 40979 * 40980 * var users = { 40981 * 'fred': { 'user': 'fred', 'age': 40 }, 40982 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 40983 * }; 40984 * 40985 * _.mapValues(users, function(o) { return o.age; }); 40986 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 40987 * 40988 * // The `_.property` iteratee shorthand. 40989 * _.mapValues(users, 'age'); 40990 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 40991 */ 40992 function mapValues(object, iteratee) { 40993 var result = {}; 40994 iteratee = getIteratee(iteratee, 3); 40995 40996 baseForOwn(object, function(value, key, object) { 40997 baseAssignValue(result, key, iteratee(value, key, object)); 40998 }); 40999 return result; 41000 } 41001 41002 /** 41003 * This method is like `_.assign` except that it recursively merges own and 41004 * inherited enumerable string keyed properties of source objects into the 41005 * destination object. Source properties that resolve to `undefined` are 41006 * skipped if a destination value exists. Array and plain object properties 41007 * are merged recursively. Other objects and value types are overridden by 41008 * assignment. Source objects are applied from left to right. Subsequent 41009 * sources overwrite property assignments of previous sources. 41010 * 41011 * **Note:** This method mutates `object`. 41012 * 41013 * @static 41014 * @memberOf _ 41015 * @since 0.5.0 41016 * @category Object 41017 * @param {Object} object The destination object. 41018 * @param {...Object} [sources] The source objects. 41019 * @returns {Object} Returns `object`. 41020 * @example 41021 * 41022 * var object = { 41023 * 'a': [{ 'b': 2 }, { 'd': 4 }] 41024 * }; 41025 * 41026 * var other = { 41027 * 'a': [{ 'c': 3 }, { 'e': 5 }] 41028 * }; 41029 * 41030 * _.merge(object, other); 41031 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 41032 */ 41033 var merge = createAssigner(function(object, source, srcIndex) { 41034 baseMerge(object, source, srcIndex); 41035 }); 41036 41037 /** 41038 * This method is like `_.merge` except that it accepts `customizer` which 41039 * is invoked to produce the merged values of the destination and source 41040 * properties. If `customizer` returns `undefined`, merging is handled by the 41041 * method instead. The `customizer` is invoked with six arguments: 41042 * (objValue, srcValue, key, object, source, stack). 41043 * 41044 * **Note:** This method mutates `object`. 41045 * 41046 * @static 41047 * @memberOf _ 41048 * @since 4.0.0 41049 * @category Object 41050 * @param {Object} object The destination object. 41051 * @param {...Object} sources The source objects. 41052 * @param {Function} customizer The function to customize assigned values. 41053 * @returns {Object} Returns `object`. 41054 * @example 41055 * 41056 * function customizer(objValue, srcValue) { 41057 * if (_.isArray(objValue)) { 41058 * return objValue.concat(srcValue); 41059 * } 41060 * } 41061 * 41062 * var object = { 'a': [1], 'b': [2] }; 41063 * var other = { 'a': [3], 'b': [4] }; 41064 * 41065 * _.mergeWith(object, other, customizer); 41066 * // => { 'a': [1, 3], 'b': [2, 4] } 41067 */ 41068 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 41069 baseMerge(object, source, srcIndex, customizer); 41070 }); 41071 41072 /** 41073 * The opposite of `_.pick`; this method creates an object composed of the 41074 * own and inherited enumerable property paths of `object` that are not omitted. 41075 * 41076 * **Note:** This method is considerably slower than `_.pick`. 41077 * 41078 * @static 41079 * @since 0.1.0 41080 * @memberOf _ 41081 * @category Object 41082 * @param {Object} object The source object. 41083 * @param {...(string|string[])} [paths] The property paths to omit. 41084 * @returns {Object} Returns the new object. 41085 * @example 41086 * 41087 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 41088 * 41089 * _.omit(object, ['a', 'c']); 41090 * // => { 'b': '2' } 41091 */ 41092 var omit = flatRest(function(object, paths) { 41093 var result = {}; 41094 if (object == null) { 41095 return result; 41096 } 41097 var isDeep = false; 41098 paths = arrayMap(paths, function(path) { 41099 path = castPath(path, object); 41100 isDeep || (isDeep = path.length > 1); 41101 return path; 41102 }); 41103 copyObject(object, getAllKeysIn(object), result); 41104 if (isDeep) { 41105 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 41106 } 41107 var length = paths.length; 41108 while (length--) { 41109 baseUnset(result, paths[length]); 41110 } 41111 return result; 41112 }); 41113 41114 /** 41115 * The opposite of `_.pickBy`; this method creates an object composed of 41116 * the own and inherited enumerable string keyed properties of `object` that 41117 * `predicate` doesn't return truthy for. The predicate is invoked with two 41118 * arguments: (value, key). 41119 * 41120 * @static 41121 * @memberOf _ 41122 * @since 4.0.0 41123 * @category Object 41124 * @param {Object} object The source object. 41125 * @param {Function} [predicate=_.identity] The function invoked per property. 41126 * @returns {Object} Returns the new object. 41127 * @example 41128 * 41129 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 41130 * 41131 * _.omitBy(object, _.isNumber); 41132 * // => { 'b': '2' } 41133 */ 41134 function omitBy(object, predicate) { 41135 return pickBy(object, negate(getIteratee(predicate))); 41136 } 41137 41138 /** 41139 * Creates an object composed of the picked `object` properties. 41140 * 41141 * @static 41142 * @since 0.1.0 41143 * @memberOf _ 41144 * @category Object 41145 * @param {Object} object The source object. 41146 * @param {...(string|string[])} [paths] The property paths to pick. 41147 * @returns {Object} Returns the new object. 41148 * @example 41149 * 41150 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 41151 * 41152 * _.pick(object, ['a', 'c']); 41153 * // => { 'a': 1, 'c': 3 } 41154 */ 41155 var pick = flatRest(function(object, paths) { 41156 return object == null ? {} : basePick(object, paths); 41157 }); 41158 41159 /** 41160 * Creates an object composed of the `object` properties `predicate` returns 41161 * truthy for. The predicate is invoked with two arguments: (value, key). 41162 * 41163 * @static 41164 * @memberOf _ 41165 * @since 4.0.0 41166 * @category Object 41167 * @param {Object} object The source object. 41168 * @param {Function} [predicate=_.identity] The function invoked per property. 41169 * @returns {Object} Returns the new object. 41170 * @example 41171 * 41172 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 41173 * 41174 * _.pickBy(object, _.isNumber); 41175 * // => { 'a': 1, 'c': 3 } 41176 */ 41177 function pickBy(object, predicate) { 41178 if (object == null) { 41179 return {}; 41180 } 41181 var props = arrayMap(getAllKeysIn(object), function(prop) { 41182 return [prop]; 41183 }); 41184 predicate = getIteratee(predicate); 41185 return basePickBy(object, props, function(value, path) { 41186 return predicate(value, path[0]); 41187 }); 41188 } 41189 41190 /** 41191 * This method is like `_.get` except that if the resolved value is a 41192 * function it's invoked with the `this` binding of its parent object and 41193 * its result is returned. 41194 * 41195 * @static 41196 * @since 0.1.0 41197 * @memberOf _ 41198 * @category Object 41199 * @param {Object} object The object to query. 41200 * @param {Array|string} path The path of the property to resolve. 41201 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 41202 * @returns {*} Returns the resolved value. 41203 * @example 41204 * 41205 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 41206 * 41207 * _.result(object, 'a[0].b.c1'); 41208 * // => 3 41209 * 41210 * _.result(object, 'a[0].b.c2'); 41211 * // => 4 41212 * 41213 * _.result(object, 'a[0].b.c3', 'default'); 41214 * // => 'default' 41215 * 41216 * _.result(object, 'a[0].b.c3', _.constant('default')); 41217 * // => 'default' 41218 */ 41219 function result(object, path, defaultValue) { 41220 path = castPath(path, object); 41221 41222 var index = -1, 41223 length = path.length; 41224 41225 // Ensure the loop is entered when path is empty. 41226 if (!length) { 41227 length = 1; 41228 object = undefined
41228; 41229 } 41230 while (++index < length) { 41231 var value = object == null ? undefined : object[toKey(path[index])]; 41232 if (value === undefined) { 41233 index = length; 41234 value = defaultValue; 41235 } 41236 object = isFunction(value) ? value.call(object) : value; 41237 } 41238 return object; 41239 } 41240 41241 /** 41242 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 41243 * it's created. Arrays are created for missing index properties while objects 41244 * are created for all other missing properties. Use `_.setWith` to customize 41245 * `path` creation. 41246 * 41247 * **Note:** This method mutates `object`. 41248 * 41249 * @static 41250 * @memberOf _ 41251 * @since 3.7.0 41252 * @category Object 41253 * @param {Object} object The object to modify. 41254 * @param {Array|string} path The path of the property to set. 41255 * @param {*} value The value to set. 41256 * @returns {Object} Returns `object`. 41257 * @example 41258 * 41259 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 41260 * 41261 * _.set(object, 'a[0].b.c', 4); 41262 * console.log(object.a[0].b.c); 41263 * // => 4 41264 * 41265 * _.set(object, ['x', '0', 'y', 'z'], 5); 41266 * console.log(object.x[0].y.z); 41267 * // => 5 41268 */ 41269 function set(object, path, value) { 41270 return object == null ? object : baseSet(object, path, value); 41271 } 41272 41273 /** 41274 * This method is like `_.set` except that it accepts `customizer` which is 41275 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 41276 * path creation is handled by the method instead. The `customizer` is invoked 41277 * with three arguments: (nsValue, key, nsObject). 41278 * 41279 * **Note:** This method mutates `object`. 41280 * 41281 * @static 41282 * @memberOf _ 41283 * @since 4.0.0 41284 * @category Object 41285 * @param {Object} object The object to modify. 41286 * @param {Array|string} path The path of the property to set. 41287 * @param {*} value The value to set. 41288 * @param {Function} [customizer] The function to customize assigned values. 41289 * @returns {Object} Returns `object`. 41290 * @example 41291 * 41292 * var object = {}; 41293 * 41294 * _.setWith(object, '[0][1]', 'a', Object); 41295 * // => { '0': { '1': 'a' } } 41296 */ 41297 function setWith(object, path, value, customizer) { 41298 customizer = typeof customizer == 'function' ? customizer : undefined; 41299 return object == null ? object : baseSet(object, path, value, customizer); 41300 } 41301 41302 /** 41303 * Creates an array of own enumerable string keyed-value pairs for `object` 41304 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 41305 * entries are returned. 41306 * 41307 * @static 41308 * @memberOf _ 41309 * @since 4.0.0 41310 * @alias entries 41311 * @category Object 41312 * @param {Object} object The object to query. 41313 * @returns {Array} Returns the key-value pairs. 41314 * @example 41315 * 41316 * function Foo() { 41317 * this.a = 1; 41318 * this.b = 2; 41319 * } 41320 * 41321 * Foo.prototype.c = 3; 41322 * 41323 * _.toPairs(new Foo); 41324 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 41325 */ 41326 var toPairs = createToPairs(keys); 41327 41328 /** 41329 * Creates an array of own and inherited enumerable string keyed-value pairs 41330 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 41331 * or set, its entries are returned. 41332 * 41333 * @static 41334 * @memberOf _ 41335 * @since 4.0.0 41336 * @alias entriesIn 41337 * @category Object 41338 * @param {Object} object The object to query. 41339 * @returns {Array} Returns the key-value pairs. 41340 * @example 41341 * 41342 * function Foo() { 41343 * this.a = 1; 41344 * this.b = 2; 41345 * } 41346 * 41347 * Foo.prototype.c = 3; 41348 * 41349 * _.toPairsIn(new Foo); 41350 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 41351 */ 41352 var toPairsIn = createToPairs(keysIn); 41353 41354 /** 41355 * An alternative to `_.reduce`; this method transforms `object` to a new 41356 * `accumulator` object which is the result of running each of its own
41357 * enumerable string keyed properties thru `iteratee`, with each invocation 41358 * potentially mutating the `accumulator` object. If `accumulator` is not 41359 * provided, a new object with the same `[[Prototype]]` will be used. The 41360 * iteratee is invoked with four arguments: (accumulator, value, key, object). 41361 * Iteratee functions may exit iteration early by explicitly returning `false`. 41362 * 41363 * @static 41364 * @memberOf _ 41365 * @since 1.3.0 41366 * @category Object 41367 * @param {Object} object The object to iterate over. 41368 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 41369 * @param {*} [accumulator] The custom accumulator value. 41370 * @returns {*} Returns the accumulated value. 41371 * @example 41372 * 41373 * _.transform([2, 3, 4], function(result, n) { 41374 * result.push(n *= n); 41375 * return n % 2 == 0; 41376 * }, []); 41377 * // => [4, 9] 41378 * 41379 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 41380 * (result[value] || (result[value] = [])).push(key); 41381 * }, {}); 41382 * // => { '1': ['a', 'c'], '2': ['b'] } 41383 */ 41384 function transform(object, iteratee, accumulator) { 41385 var isArr = isArray(object), 41386 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 41387 41388 iteratee = getIteratee(iteratee, 4); 41389 if (accumulator == null) { 41390 var Ctor = object && object.constructor; 41391 if (isArrLike) { 41392 accumulator = isArr ? new Ctor : []; 41393 } 41394 else if (isObject(object)) { 41395 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 41396 } 41397 else { 41398 accumulator = {}; 41399 } 41400 } 41401 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 41402 return iteratee(accumulator, value, index, object); 41403 }); 41404 return accumulator; 41405 } 41406 41407 /** 41408 * Removes the property at `path` of `object`. 41409 * 41410 * **Note:** This method mutates `object`. 41411 * 41412 * @static 41413 * @memberOf _ 41414 * @since 4.0.0 41415 * @category Object 41416 * @param {Object} object The object to modify. 41417 * @param {Array|string} path The path of the property to unset. 41418 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 41419 * @example 41420 * 41421 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 41422 * _.unset(object, 'a[0].b.c'); 41423 * // => true 41424 * 41425 * console.log(object); 41426 * // => { 'a': [{ 'b': {} }] }; 41427 * 41428 * _.unset(object, ['a', '0', 'b', 'c']); 41429 * // => true 41430 * 41431 * console.log(object); 41432 * // => { 'a': [{ 'b': {} }] }; 41433 */ 41434 function unset(object, path) { 41435 return object == null ? true : baseUnset(object, path); 41436 } 41437 41438 /** 41439 * This method is like `_.set` except that accepts `updater` to produce the 41440 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 41441 * is invoked with one argument: (value). 41442 * 41443 * **Note:** This method mutates `object`. 41444 * 41445 * @static 41446 * @memberOf _ 41447 * @since 4.6.0 41448 * @category Object 41449 * @param {Object} object The object to modify. 41450 * @param {Array|string} path The path of the property to set. 41451 * @param {Function} updater The function to produce the updated value. 41452 * @returns {Object} Returns `object`. 41453 * @example 41454 * 41455 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 41456 * 41457 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 41458 * console.log(object.a[0].b.c); 41459 * // => 9 41460 * 41461 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 41462 * console.log(object.x[0].y.z); 41463 * // => 0 41464 */ 41465 function update(object, path, updater) { 41466 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 41467 } 41468 41469 /** 41470 * This method is like `_.update` except that it accepts `customizer` which is 41471 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 41472 * path creation is handled by the method instead. The `customizer` is invoked 41473 * with three arguments: (nsValue, key, nsObject). 41474 * 41475 * **Note:** This method mutates `object`. 41476 * 41477 * @static 41478 * @memberOf _ 41479 * @since 4.6.0 41480 * @category Object 41481 * @param {Object} object The object to modify. 41482 * @param {Array|string} path The path of the property to set. 41483 * @param {Function} updater The function to produce the updated value. 41484 * @param {Function} [customizer] The function to customize assigned values. 41485 * @returns {Object} Returns `object`. 41486 * @example 41487 * 41488 * var object = {}; 41489 * 41490 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 41491 * // => { '0': { '1': 'a' } } 41492 */ 41493 function updateWith(object, path, updater, customizer) { 41494 customizer = typeof customizer == 'function' ? customizer : undefined
vendor: 2,306 bytes, lines 41494-41578
41494; 41495 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 41496 } 41497 41498 /** 41499 * Creates an array of the own enumerable string keyed property values of `object`. 41500 * 41501 * **Note:** Non-object values are coerced to objects. 41502 * 41503 * @static 41504 * @since 0.1.0 41505 * @memberOf _ 41506 * @category Object 41507 * @param {Object} object The object to query. 41508 * @returns {Array} Returns the array of property values. 41509 * @example 41510 * 41511 * function Foo() { 41512 * this.a = 1; 41513 * this.b = 2; 41514 * } 41515 * 41516 * Foo.prototype.c = 3; 41517 * 41518 * _.values(new Foo); 41519 * // => [1, 2] (iteration order is not guaranteed) 41520 * 41521 * _.values('hi'); 41522 * // => ['h', 'i'] 41523 */ 41524 function values(object) { 41525 return object == null ? [] : baseValues(object, keys(object)); 41526 } 41527 41528 /** 41529 * Creates an array of the own and inherited enumerable string keyed property 41530 * values of `object`. 41531 * 41532 * **Note:** Non-object values are coerced to objects. 41533 * 41534 * @static 41535 * @memberOf _ 41536 * @since 3.0.0 41537 * @category Object 41538 * @param {Object} object The object to query. 41539 * @returns {Array} Returns the array of property values. 41540 * @example 41541 * 41542 * function Foo() { 41543 * this.a = 1; 41544 * this.b = 2; 41545 * } 41546 * 41547 * Foo.prototype.c = 3; 41548 * 41549 * _.valuesIn(new Foo); 41550 * // => [1, 2, 3] (iteration order is not guaranteed) 41551 */ 41552 function valuesIn(object) { 41553 return object == null ? [] : baseValues(object, keysIn(object)); 41554 } 41555 41556 /*------------------------------------------------------------------------*/ 41557 41558 /** 41559 * Clamps `number` within the inclusive `lower` and `upper` bounds. 41560 * 41561 * @static 41562 * @memberOf _ 41563 * @since 4.0.0 41564 * @category Number 41565 * @param {number} number The number to clamp. 41566 * @param {number} [lower] The lower bound. 41567 * @param {number} upper The upper bound. 41568 * @returns {number} Returns the clamped number. 41569 * @example 41570 * 41571 * _.clamp(-10, -5, 5); 41572 * // => -5 41573 * 41574 * _.clamp(10, -5, 5); 41575 * // => 5 41576 */ 41577 function clamp(number, lower, upper) { 41578 if (upper === undefined
vendor: 4,634 bytes, lines 41578-41734
41578) { 41579 upper = lower; 41580 lower = undefined; 41581 } 41582 if (upper !== undefined) { 41583 upper = toNumber(upper); 41584 upper = upper === upper ? upper : 0; 41585 } 41586 if (lower !== undefined) { 41587 lower = toNumber(lower); 41588 lower = lower === lower ? lower : 0; 41589 } 41590 return baseClamp(toNumber(number), lower, upper); 41591 } 41592 41593 /** 41594 * Checks if `n` is between `start` and up to, but not including, `end`. If 41595 * `end` is not specified, it's set to `start` with `start` then set to `0`. 41596 * If `start` is greater than `end` the params are swapped to support 41597 * negative ranges. 41598 * 41599 * @static 41600 * @memberOf _ 41601 * @since 3.3.0 41602 * @category Number 41603 * @param {number} number The number to check. 41604 * @param {number} [start=0] The start of the range. 41605 * @param {number} end The end of the range. 41606 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 41607 * @see _.range, _.rangeRight 41608 * @example 41609 * 41610 * _.inRange(3, 2, 4); 41611 * // => true 41612 * 41613 * _.inRange(4, 8); 41614 * // => true 41615 * 41616 * _.inRange(4, 2); 41617 * // => false 41618 * 41619 * _.inRange(2, 2); 41620 * // => false 41621 * 41622 * _.inRange(1.2, 2); 41623 * // => true 41624 * 41625 * _.inRange(5.2, 4); 41626 * // => false 41627 * 41628 * _.inRange(-3, -2, -6); 41629 * // => true 41630 */ 41631 function inRange(number, start, end) { 41632 start = toFinite(start); 41633 if (end === undefined) { 41634 end = start; 41635 start = 0; 41636 } else { 41637 end = toFinite(end); 41638 } 41639 number = toNumber(number); 41640 return baseInRange(number, start, end); 41641 } 41642 41643 /** 41644 * Produces a random number between the inclusive `lower` and `upper` bounds. 41645 * If only one argument is provided a number between `0` and the given number 41646 * is returned. If `floating` is `true`, or either `lower` or `upper` are 41647 * floats, a floating-point number is returned instead of an integer. 41648 * 41649 * **Note:** JavaScript follows the IEEE-754 standard for resolving 41650 * floating-point values which can produce unexpected results. 41651 * 41652 * @static 41653 * @memberOf _ 41654 * @since 0.7.0 41655 * @category Number 41656 * @param {number} [lower=0] The lower bound. 41657 * @param {number} [upper=1] The upper bound. 41658 * @param {boolean} [floating] Specify returning a floating-point number. 41659 * @returns {number} Returns the random number. 41660 * @example 41661 * 41662 * _.random(0, 5); 41663 * // => an integer between 0 and 5 41664 * 41665 * _.random(5); 41666 * // => also an integer between 0 and 5 41667 * 41668 * _.random(5, true); 41669 * // => a floating-point number between 0 and 5 41670 * 41671 * _.random(1.2, 5.2); 41672 * // => a floating-point number between 1.2 and 5.2 41673 */ 41674 function random(lower, upper, floating) { 41675 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 41676 upper = floating = undefined; 41677 } 41678 if (floating === undefined) { 41679 if (typeof upper == 'boolean') { 41680 floating = upper; 41681 upper = undefined; 41682 } 41683 else if (typeof lower == 'boolean') { 41684 floating = lower; 41685 lower = undefined; 41686 } 41687 } 41688 if (lower === undefined && upper === undefined) { 41689 lower = 0; 41690 upper = 1; 41691 } 41692 else { 41693 lower = toFinite(lower); 41694 if (upper === undefined) { 41695 upper = lower; 41696 lower = 0; 41697 } else { 41698 upper = toFinite(upper); 41699 } 41700 } 41701 if (lower > upper) { 41702 var temp = lower; 41703 lower = upper; 41704 upper = temp; 41705 } 41706 if (floating || lower % 1 || upper % 1) { 41707 var rand = nativeRandom(); 41708 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 41709 } 41710 return baseRandom(lower, upper); 41711 } 41712 41713 /*------------------------------------------------------------------------*/ 41714 41715 /** 41716 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 41717 * 41718 * @static 41719 * @memberOf _ 41720 * @since 3.0.0 41721 * @category String 41722 * @param {string} [string=''] The string to convert. 41723 * @returns {string} Returns the camel cased string. 41724 * @example 41725 * 41726 * _.camelCase('Foo Bar'); 41727 * // => 'fooBar' 41728 * 41729 * _.camelCase('--foo-bar--'); 41730 * // => 'fooBar' 41731 * 41732 * _.camelCase('__FOO_BAR__'); 41733 * // => 'fooBar' 41734 */
41735 var camelCase = createCompounder(function(result, word, index) { 41736 word = word.toLowerCase(); 41737 return result + (index ? capitalize(word) : word); 41738 }); 41739 41740 /** 41741 * Converts the first character of `string` to upper case and the remaining 41742 * to lower case. 41743 * 41744 * @static 41745 * @memberOf _ 41746 * @since 3.0.0 41747 * @category String 41748 * @param {string} [string=''] The string to capitalize. 41749 * @returns {string} Returns the capitalized string. 41750 * @example 41751 * 41752 * _.capitalize('FRED'); 41753 * // => 'Fred' 41754 */ 41755 function capitalize(string) { 41756 return upperFirst(toString(string).toLowerCase()); 41757 } 41758 41759 /** 41760 * Deburrs `string` by converting 41761 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 41762 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 41763 * letters to basic Latin letters and removing 41764 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 41765 * 41766 * @static 41767 * @memberOf _ 41768 * @since 3.0.0 41769 * @category String 41770 * @param {string} [string=''] The string to deburr. 41771 * @returns {string} Returns the deburred string. 41772 * @example 41773 * 41774 * _.deburr('déjàvu'); 41775 * // => 'deja vu' 41776 */ 41777 function deburr(string) { 41778 string = toString(string); 41779 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 41780 } 41781 41782 /** 41783 * Checks if `string` ends with the given target string. 41784 * 41785 * @static 41786 * @memberOf _ 41787 * @since 3.0.0 41788 * @category String 41789 * @param {string} [string=''] The string to inspect. 41790 * @param {string} [target] The string to search for. 41791 * @param {number} [position=string.length] The position to search up to. 41792 * @returns {boolean} Returns `true` if `string` ends with `target`, 41793 * else `false`. 41794 * @example 41795 * 41796 * _.endsWith('abc', 'c'); 41797 * // => true 41798 * 41799 * _.endsWith('abc', 'b'); 41800 * // => false 41801 * 41802 * _.endsWith('abc', 'b', 2); 41803 * // => true 41804 */ 41805 function endsWith(string, target, position) { 41806 string = toString(string); 41807 target = baseToString(target); 41808 41809 var length = string.length; 41810 position = position === undefined
vendor: 9,019 bytes, lines 41810-42105
41810 41811 ? length 41812 : baseClamp(toInteger(position), 0, length); 41813 41814 var end = position; 41815 position -= target.length; 41816 return position >= 0 && string.slice(position, end) == target; 41817 } 41818 41819 /** 41820 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 41821 * corresponding HTML entities. 41822 * 41823 * **Note:** No other characters are escaped. To escape additional 41824 * characters use a third-party library like [_he_](https://mths.be/he). 41825 * 41826 * Though the ">" character is escaped for symmetry, characters like 41827 * ">" and "/" don't need escaping in HTML and have no special meaning 41828 * unless they're part of a tag or unquoted attribute value. See 41829 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 41830 * (under "semi-related fun fact") for more details. 41831 * 41832 * When working with HTML you should always 41833 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 41834 * XSS vectors. 41835 * 41836 * @static 41837 * @since 0.1.0 41838 * @memberOf _ 41839 * @category String 41840 * @param {string} [string=''] The string to escape. 41841 * @returns {string} Returns the escaped string. 41842 * @example 41843 * 41844 * _.escape('fred, barney, & pebbles'); 41845 * // => 'fred, barney, & pebbles' 41846 */ 41847 function escape(string) { 41848 string = toString(string); 41849 return (string && reHasUnescapedHtml.test(string)) 41850 ? string.replace(reUnescapedHtml, escapeHtmlChar) 41851 : string; 41852 } 41853 41854 /** 41855 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 41856 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 41857 * 41858 * @static 41859 * @memberOf _ 41860 * @since 3.0.0 41861 * @category String 41862 * @param {string} [string=''] The string to escape. 41863 * @returns {string} Returns the escaped string. 41864 * @example 41865 * 41866 * _.escapeRegExp('[lodash](https://lodash.com/)'); 41867 * // => '\[lodash\]\(https://lodash\.com/\)' 41868 */ 41869 function escapeRegExp(string) { 41870 string = toString(string); 41871 return (string && reHasRegExpChar.test(string)) 41872 ? string.replace(reRegExpChar, '\\$&') 41873 : string; 41874 } 41875 41876 /** 41877 * Converts `string` to 41878 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 41879 * 41880 * @static 41881 * @memberOf _ 41882 * @since 3.0.0 41883 * @category String 41884 * @param {string} [string=''] The string to convert. 41885 * @returns {string} Returns the kebab cased string. 41886 * @example 41887 * 41888 * _.kebabCase('Foo Bar'); 41889 * // => 'foo-bar' 41890 * 41891 * _.kebabCase('fooBar'); 41892 * // => 'foo-bar' 41893 * 41894 * _.kebabCase('__FOO_BAR__'); 41895 * // => 'foo-bar' 41896 */ 41897 var kebabCase = createCompounder(function(result, word, index) { 41898 return result + (index ? '-' : '') + word.toLowerCase(); 41899 }); 41900 41901 /** 41902 * Converts `string`, as space separated words, to lower case. 41903 * 41904 * @static 41905 * @memberOf _ 41906 * @since 4.0.0 41907 * @category String 41908 * @param {string} [string=''] The string to convert. 41909 * @returns {string} Returns the lower cased string. 41910 * @example 41911 * 41912 * _.lowerCase('--Foo-Bar--'); 41913 * // => 'foo bar' 41914 * 41915 * _.lowerCase('fooBar'); 41916 * // => 'foo bar' 41917 * 41918 * _.lowerCase('__FOO_BAR__'); 41919 * // => 'foo bar' 41920 */ 41921 var lowerCase = createCompounder(function(result, word, index) { 41922 return result + (index ? ' ' : '') + word.toLowerCase(); 41923 }); 41924 41925 /** 41926 * Converts the first character of `string` to lower case. 41927 * 41928 * @static 41929 * @memberOf _ 41930 * @since 4.0.0 41931 * @category String 41932 * @param {string} [string=''] The string to convert. 41933 * @returns {string} Returns the converted string. 41934 * @example 41935 * 41936 * _.lowerFirst('Fred'); 41937 * // => 'fred' 41938 * 41939 * _.lowerFirst('FRED'); 41940 * // => 'fRED' 41941 */ 41942 var lowerFirst = createCaseFirst('toLowerCase'); 41943 41944 /** 41945 * Pads `string` on the left and right sides if it's shorter than `length`. 41946 * Padding characters are truncated if they can't be evenly divided by `length`. 41947 * 41948 * @static 41949 * @memberOf _ 41950 * @since 3.0.0 41951 * @category String 41952 * @param {string} [string=''] The string to pad. 41953 * @param {number} [length=0] The padding length. 41954 * @param {string} [chars=' '] The string used as padding. 41955 * @returns {string} Returns the padded string. 41956 * @example 41957 * 41958 * _.pad('abc', 8); 41959 * // => ' abc ' 41960 * 41961 * _.pad('abc', 8, '_-'); 41962 * // => '_-abc_-_' 41963 * 41964 * _.pad('abc', 3); 41965 * // => 'abc' 41966 */ 41967 function pad(string, length, chars) { 41968 string = toString(string); 41969 length = toInteger(length); 41970 41971 var strLength = length ? stringSize(string) : 0; 41972 if (!length || strLength >= length) { 41973 return string; 41974 } 41975 var mid = (length - strLength) / 2; 41976 return ( 41977 createPadding(nativeFloor(mid), chars) + 41978 string + 41979 createPadding(nativeCeil(mid), chars) 41980 ); 41981 } 41982 41983 /** 41984 * Pads `string` on the right side if it's shorter than `length`. Padding 41985 * characters are truncated if they exceed `length`. 41986 * 41987 * @static 41988 * @memberOf _ 41989 * @since 4.0.0 41990 * @category String 41991 * @param {string} [string=''] The string to pad. 41992 * @param {number} [length=0] The padding length. 41993 * @param {string} [chars=' '] The string used as padding. 41994 * @returns {string} Returns the padded string. 41995 * @example 41996 * 41997 * _.padEnd('abc', 6); 41998 * // => 'abc ' 41999 * 42000 * _.padEnd('abc', 6, '_-'); 42001 * // => 'abc_-_' 42002 * 42003 * _.padEnd('abc', 3); 42004 * // => 'abc' 42005 */ 42006 function padEnd(string, length, chars) { 42007 string = toString(string); 42008 length = toInteger(length); 42009 42010 var strLength = length ? stringSize(string) : 0; 42011 return (length && strLength < length) 42012 ? (string + createPadding(length - strLength, chars)) 42013 : string; 42014 } 42015 42016 /** 42017 * Pads `string` on the left side if it's shorter than `length`. Padding 42018 * characters are truncated if they exceed `length`. 42019 * 42020 * @static 42021 * @memberOf _ 42022 * @since 4.0.0 42023 * @category String 42024 * @param {string} [string=''] The string to pad. 42025 * @param {number} [length=0] The padding length. 42026 * @param {string} [chars=' '] The string used as padding. 42027 * @returns {string} Returns the padded string. 42028 * @example 42029 * 42030 * _.padStart('abc', 6); 42031 * // => ' abc' 42032 * 42033 * _.padStart('abc', 6, '_-'); 42034 * // => '_-_abc' 42035 * 42036 * _.padStart('abc', 3); 42037 * // => 'abc' 42038 */ 42039 function padStart(string, length, chars) { 42040 string = toString(string); 42041 length = toInteger(length); 42042 42043 var strLength = length ? stringSize(string) : 0; 42044 return (length && strLength < length) 42045 ? (createPadding(length - strLength, chars) + string) 42046 : string; 42047 } 42048 42049 /** 42050 * Converts `string` to an integer of the specified radix. If `radix` is 42051 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 42052 * hexadecimal, in which case a `radix` of `16` is used. 42053 * 42054 * **Note:** This method aligns with the 42055 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 42056 * 42057 * @static 42058 * @memberOf _ 42059 * @since 1.1.0 42060 * @category String 42061 * @param {string} string The string to convert. 42062 * @param {number} [radix=10] The radix to interpret `value` by. 42063 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42064 * @returns {number} Returns the converted integer. 42065 * @example 42066 * 42067 * _.parseInt('08'); 42068 * // => 8 42069 * 42070 * _.map(['6', '08', '10'], _.parseInt); 42071 * // => [6, 8, 10] 42072 */ 42073 function parseInt(string, radix, guard) { 42074 if (guard || radix == null) { 42075 radix = 0; 42076 } else if (radix) { 42077 radix = +radix; 42078 } 42079 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 42080 } 42081 42082 /** 42083 * Repeats the given string `n` times. 42084 * 42085 * @static 42086 * @memberOf _ 42087 * @since 3.0.0 42088 * @category String 42089 * @param {string} [string=''] The string to repeat. 42090 * @param {number} [n=1] The number of times to repeat the string. 42091 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42092 * @returns {string} Returns the repeated string. 42093 * @example 42094 * 42095 * _.repeat('*', 3); 42096 * // => '***' 42097 * 42098 * _.repeat('abc', 2); 42099 * // => 'abcabc' 42100 * 42101 * _.repeat('abc', 0); 42102 * // => '' 42103 */ 42104 function repeat(string, n, guard) { 42105 if ((guard ? isIterateeCall(string, n, guard) : n === undefined
42105)) { 42106 n = 1; 42107 } else { 42108 n = toInteger(n); 42109 } 42110 return baseRepeat(toString(string), n); 42111 } 42112 42113 /** 42114 * Replaces matches for `pattern` in `string` with `replacement`. 42115 * 42116 * **Note:** This method is based on 42117 * [`String#replace`](https://mdn.io/String/replace). 42118 * 42119 * @static 42120 * @memberOf _ 42121 * @since 4.0.0 42122 * @category String 42123 * @param {string} [string=''] The string to modify. 42124 * @param {RegExp|string} pattern The pattern to replace. 42125 * @param {Function|string} replacement The match replacement. 42126 * @returns {string} Returns the modified string. 42127 * @example 42128 * 42129 * _.replace('Hi Fred', 'Fred', 'Barney'); 42130 * // =>
vendor: 7,350 bytes, lines 42130-42332
42130 'Hi Barney' 42131 */ 42132 function replace() { 42133 var args = arguments, 42134 string = toString(args[0]); 42135 42136 return args.length < 3 ? string : string.replace(args[1], args[2]); 42137 } 42138 42139 /** 42140 * Converts `string` to 42141 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 42142 * 42143 * @static 42144 * @memberOf _ 42145 * @since 3.0.0 42146 * @category String 42147 * @param {string} [string=''] The string to convert. 42148 * @returns {string} Returns the snake cased string. 42149 * @example 42150 * 42151 * _.snakeCase('Foo Bar'); 42152 * // => 'foo_bar' 42153 * 42154 * _.snakeCase('fooBar'); 42155 * // => 'foo_bar' 42156 * 42157 * _.snakeCase('--FOO-BAR--'); 42158 * // => 'foo_bar' 42159 */ 42160 var snakeCase = createCompounder(function(result, word, index) { 42161 return result + (index ? '_' : '') + word.toLowerCase(); 42162 }); 42163 42164 /** 42165 * Splits `string` by `separator`. 42166 * 42167 * **Note:** This method is based on 42168 * [`String#split`](https://mdn.io/String/split). 42169 * 42170 * @static 42171 * @memberOf _ 42172 * @since 4.0.0 42173 * @category String 42174 * @param {string} [string=''] The string to split. 42175 * @param {RegExp|string} separator The separator pattern to split by. 42176 * @param {number} [limit] The length to truncate results to. 42177 * @returns {Array} Returns the string segments. 42178 * @example 42179 * 42180 * _.split('a-b-c', '-', 2); 42181 * // => ['a', 'b'] 42182 */ 42183 function split(string, separator, limit) { 42184 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 42185 separator = limit = undefined; 42186 } 42187 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 42188 if (!limit) { 42189 return []; 42190 } 42191 string = toString(string); 42192 if (string && ( 42193 typeof separator == 'string' || 42194 (separator != null && !isRegExp(separator)) 42195 )) { 42196 separator = baseToString(separator); 42197 if (!separator && hasUnicode(string)) { 42198 return castSlice(stringToArray(string), 0, limit); 42199 } 42200 } 42201 return string.split(separator, limit); 42202 } 42203 42204 /** 42205 * Converts `string` to 42206 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 42207 * 42208 * @static 42209 * @memberOf _ 42210 * @since 3.1.0 42211 * @category String 42212 * @param {string} [string=''] The string to convert. 42213 * @returns {string} Returns the start cased string. 42214 * @example 42215 * 42216 * _.startCase('--foo-bar--'); 42217 * // => 'Foo Bar' 42218 * 42219 * _.startCase('fooBar'); 42220 * // => 'Foo Bar' 42221 * 42222 * _.startCase('__FOO_BAR__'); 42223 * // => 'FOO BAR' 42224 */ 42225 var startCase = createCompounder(function(result, word, index) { 42226 return result + (index ? ' ' : '') + upperFirst(word); 42227 }); 42228 42229 /** 42230 * Checks if `string` starts with the given target string. 42231 * 42232 * @static 42233 * @memberOf _ 42234 * @since 3.0.0 42235 * @category String 42236 * @param {string} [string=''] The string to inspect. 42237 * @param {string} [target] The string to search for. 42238 * @param {number} [position=0] The position to search from. 42239 * @returns {boolean} Returns `true` if `string` starts with `target`, 42240 * else `false`. 42241 * @example 42242 * 42243 * _.startsWith('abc', 'a'); 42244 * // => true 42245 * 42246 * _.startsWith('abc', 'b'); 42247 * // => false 42248 * 42249 * _.startsWith('abc', 'b', 1); 42250 * // => true 42251 */ 42252 function startsWith(string, target, position) { 42253 string = toString(string); 42254 position = position == null 42255 ? 0 42256 : baseClamp(toInteger(position), 0, string.length); 42257 42258 target = baseToString(target); 42259 return string.slice(position, position + target.length) == target; 42260 } 42261 42262 /** 42263 * Creates a compiled template function that can interpolate data properties 42264 * in "interpolate" delimiters, HTML-escape interpolated data properties in 42265 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 42266 * properties may be accessed as free variables in the template. If a setting 42267 * object is given, it takes precedence over `_.templateSettings` values. 42268 * 42269 * **Note:** In the development build `_.template` utilizes 42270 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 42271 * for easier debugging. 42272 * 42273 * For more information on precompiling templates see 42274 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 42275 * 42276 * For more information on Chrome extension sandboxes see 42277 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 42278 * 42279 * @static 42280 * @since 0.1.0 42281 * @memberOf _ 42282 * @category String 42283 * @param {string} [string=''] The template string. 42284 * @param {Object} [options={}] The options object. 42285 * @param {RegExp} [options.escape=_.templateSettings.escape] 42286 * The HTML "escape" delimiter. 42287 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 42288 * The "evaluate" delimiter. 42289 * @param {Object} [options.imports=_.templateSettings.imports] 42290 * An object to import into the template as free variables. 42291 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 42292 * The "interpolate" delimiter. 42293 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 42294 * The sourceURL of the compiled template. 42295 * @param {string} [options.variable='obj'] 42296 * The data object variable name. 42297 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42298 * @returns {Function} Returns the compiled template function. 42299 * @example 42300 * 42301 * // Use the "interpolate" delimiter to create a compiled template. 42302 * var compiled = _.template('hello <%= user %>!'); 42303 * compiled({ 'user': 'fred' }); 42304 * // => 'hello fred!' 42305 * 42306 * // Use the HTML "escape" delimiter to escape data property values. 42307 * var compiled = _.template('<b><%- value %></b>'); 42308 * compiled({ 'value': '<script>' }); 42309 * // => '<b><script></b>' 42310 * 42311 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 42312 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 42313 * compiled({ 'users': ['fred', 'barney'] }); 42314 * // => '<li>fred</li><li>barney</li>' 42315 * 42316 * // Use the internal `print` function in "evaluate" delimiters. 42317 * var compiled = _.template('<% print("hello " + user); %>!'); 42318 * compiled({ 'user': 'barney' }); 42319 * // => 'hello barney!' 42320 * 42321 * // Use the ES template literal delimiter as an "interpolate" delimiter. 42322 * // Disable support by replacing the "interpolate" delimiter. 42323 * var compiled = _.template('hello ${ user }!'); 42324 * compiled({ 'user': 'pebbles' }); 42325 * // => 'hello pebbles!' 42326 * 42327 * // Use backslashes to treat delimiters as plain text. 42328 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 42329 * compiled({ 'value': 'ignored' }); 42330 * // => '<%- value %>' 42331 * 42332 * // Use the `imports` option to import `jQuery` as `jq`.
42333 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 42334 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 42335 * compiled({ 'users': ['fred', 'barney'] }); 42336 * // => '<li>fred</li><li>barney</li>' 42337 * 42338 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 42339 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 42340 * compiled(data); 42341 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 42342 * 42343 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 42344 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 42345 * compiled.source; 42346 * // => function(data) { 42347 * // var __t, __p = ''; 42348 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 42349 * // return __p; 42350 * // } 42351 * 42352 * // Use custom template delimiters. 42353 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 42354 * var compiled = _.template('hello {{ user }}!'); 42355 * compiled({ 'user': 'mustache' }); 42356 * // => 'hello mustache!' 42357 * 42358 * // Use the `source` property to inline compiled templates for meaningful 42359 * // line numbers in error messages and stack traces. 42360 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 42361 * var JST = {\ 42362 * "main": ' + _.template(mainText).source + '\ 42363 * };\ 42364 * '); 42365 */ 42366 function template(string, options, guard) { 42367 // Based on John Resig's `tmpl` implementation 42368 // (http://ejohn.org/blog/javascript-micro-templating/) 42369 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 42370 var settings = lodash.templateSettings; 42371 42372 if (guard && isIterateeCall(string, options, guard)) { 42373 options = undefined; 42374 } 42375 string = toString(string); 42376 options = assignInWith({}, options, settings, customDefaultsAssignIn); 42377 42378 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 42379 importsKeys = keys(imports), 42380 importsValues = baseValues(imports, importsKeys); 42381 42382 var isEscaping, 42383 isEvaluating, 42384 index = 0, 42385 interpolate = options.interpolate || reNoMatch, 42386 source = "__p += '"; 42387 42388 // Compile the regexp to match each delimiter. 42389 var reDelimiters = RegExp( 42390 (options.escape || reNoMatch).source + '|' + 42391 interpolate.source + '|' + 42392 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 42393 (options.evaluate || reNoMatch).source + '|$' 42394 , 'g'); 42395 42396 // Use a sourceURL for easier debugging. 42397 var sourceURL = '//# sourceURL=' + 42398 ('sourceURL' in options 42399 ? options.sourceURL 42400 : ('lodash.templateSources[' + (++templateCounter) + ']') 42401 ) + '\n'; 42402 42403 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 42404 interpolateValue || (interpolateValue = esTemplateValue); 42405 42406 // Escape characters that can't be included in string literals. 42407 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 42408 42409 // Replace delimiters with snippets. 42410 if (escapeValue) { 42411 isEscaping = true; 42412 source += "' +\n__e(" + escapeValue + ") +\n'"; 42413 } 42414 if (evaluateValue) { 42415 isEvaluating = true; 42416 source += "';\n" + evaluateValue + ";\n__p += '"; 42417 } 42418 if (interpolateValue) { 42419 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 42420 } 42421 index = offset + match.length; 42422 42423 // The JS engine embedded in Adobe products needs `match` returned in 42424 // order to produce the correct `offset` value. 42425 return match; 42426 }); 42427 42428 source += "';\n"; 42429 42430 // If `variable` is not specified wrap a with-statement around the generated 42431 // code to add the data object to the top of the scope chain.
vendor: 4,492 bytes, lines 42432-42581
42432 var variable = options.variable; 42433 if (!variable) { 42434 source = 'with (obj) {\n' + source + '\n}\n'; 42435 } 42436 // Cleanup code by stripping empty strings. 42437 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 42438 .replace(reEmptyStringMiddle, '$1') 42439 .replace(reEmptyStringTrailing, '$1;'); 42440 42441 // Frame code as the function body. 42442 source = 'function(' + (variable || 'obj') + ') {\n' + 42443 (variable 42444 ? '' 42445 : 'obj || (obj = {});\n' 42446 ) + 42447 "var __t, __p = ''" + 42448 (isEscaping 42449 ? ', __e = _.escape' 42450 : '' 42451 ) + 42452 (isEvaluating 42453 ? ', __j = Array.prototype.join;\n' + 42454 "function print() { __p += __j.call(arguments, '') }\n" 42455 : ';\n' 42456 ) + 42457 source + 42458 'return __p\n}'; 42459 42460 var result = attempt(function() { 42461 return Function(importsKeys, sourceURL + 'return ' + source) 42462 .apply(undefined, importsValues); 42463 }); 42464 42465 // Provide the compiled function's source by its `toString` method or 42466 // the `source` property as a convenience for inlining compiled templates. 42467 result.source = source; 42468 if (isError(result)) { 42469 throw result; 42470 } 42471 return result; 42472 } 42473 42474 /** 42475 * Converts `string`, as a whole, to lower case just like 42476 * [String#toLowerCase](https://mdn.io/toLowerCase). 42477 * 42478 * @static 42479 * @memberOf _ 42480 * @since 4.0.0 42481 * @category String 42482 * @param {string} [string=''] The string to convert. 42483 * @returns {string} Returns the lower cased string. 42484 * @example 42485 * 42486 * _.toLower('--Foo-Bar--'); 42487 * // => '--foo-bar--' 42488 * 42489 * _.toLower('fooBar'); 42490 * // => 'foobar' 42491 * 42492 * _.toLower('__FOO_BAR__'); 42493 * // => '__foo_bar__' 42494 */ 42495 function toLower(value) { 42496 return toString(value).toLowerCase(); 42497 } 42498 42499 /** 42500 * Converts `string`, as a whole, to upper case just like 42501 * [String#toUpperCase](https://mdn.io/toUpperCase). 42502 * 42503 * @static 42504 * @memberOf _ 42505 * @since 4.0.0 42506 * @category String 42507 * @param {string} [string=''] The string to convert. 42508 * @returns {string} Returns the upper cased string. 42509 * @example 42510 * 42511 * _.toUpper('--foo-bar--'); 42512 * // => '--FOO-BAR--' 42513 * 42514 * _.toUpper('fooBar'); 42515 * // => 'FOOBAR' 42516 * 42517 * _.toUpper('__foo_bar__'); 42518 * // => '__FOO_BAR__' 42519 */ 42520 function toUpper(value) { 42521 return toString(value).toUpperCase(); 42522 } 42523 42524 /** 42525 * Removes leading and trailing whitespace or specified characters from `string`. 42526 * 42527 * @static 42528 * @memberOf _ 42529 * @since 3.0.0 42530 * @category String 42531 * @param {string} [string=''] The string to trim. 42532 * @param {string} [chars=whitespace] The characters to trim. 42533 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42534 * @returns {string} Returns the trimmed string. 42535 * @example 42536 * 42537 * _.trim(' abc '); 42538 * // => 'abc' 42539 * 42540 * _.trim('-_-abc-_-', '_-'); 42541 * // => 'abc' 42542 * 42543 * _.map([' foo ', ' bar '], _.trim); 42544 * // => ['foo', 'bar'] 42545 */ 42546 function trim(string, chars, guard) { 42547 string = toString(string); 42548 if (string && (guard || chars === undefined)) { 42549 return string.replace(reTrim, ''); 42550 } 42551 if (!string || !(chars = baseToString(chars))) { 42552 return string; 42553 } 42554 var strSymbols = stringToArray(string), 42555 chrSymbols = stringToArray(chars), 42556 start = charsStartIndex(strSymbols, chrSymbols), 42557 end = charsEndIndex(strSymbols, chrSymbols) + 1; 42558 42559 return castSlice(strSymbols, start, end).join(''); 42560 } 42561 42562 /** 42563 * Removes trailing whitespace or specified characters from `string`. 42564 * 42565 * @static 42566 * @memberOf _ 42567 * @since 4.0.0 42568 * @category String 42569 * @param {string} [string=''] The string to trim. 42570 * @param {string} [chars=whitespace] The characters to trim. 42571 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42572 * @returns {string} Returns the trimmed string. 42573 * @example 42574 * 42575 * _.trimEnd(' abc '); 42576 * // => ' abc' 42577 * 42578 * _.trimEnd('-_-abc-_-', '_-'); 42579 * // => '-_-abc' 42580 */ 42581 function trimEnd(string, chars, guard) {
vendor: 21,147 bytes, lines 42582-43247
42582 string = toString(string); 42583 if (string && (guard || chars === undefined)) { 42584 return string.replace(reTrimEnd, ''); 42585 } 42586 if (!string || !(chars = baseToString(chars))) { 42587 return string; 42588 } 42589 var strSymbols = stringToArray(string), 42590 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 42591 42592 return castSlice(strSymbols, 0, end).join(''); 42593 } 42594 42595 /** 42596 * Removes leading whitespace or specified characters from `string`. 42597 * 42598 * @static 42599 * @memberOf _ 42600 * @since 4.0.0 42601 * @category String 42602 * @param {string} [string=''] The string to trim. 42603 * @param {string} [chars=whitespace] The characters to trim. 42604 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42605 * @returns {string} Returns the trimmed string. 42606 * @example 42607 * 42608 * _.trimStart(' abc '); 42609 * // => 'abc ' 42610 * 42611 * _.trimStart('-_-abc-_-', '_-'); 42612 * // => 'abc-_-' 42613 */ 42614 function trimStart(string, chars, guard) { 42615 string = toString(string); 42616 if (string && (guard || chars === undefined)) { 42617 return string.replace(reTrimStart, ''); 42618 } 42619 if (!string || !(chars = baseToString(chars))) { 42620 return string; 42621 } 42622 var strSymbols = stringToArray(string), 42623 start = charsStartIndex(strSymbols, stringToArray(chars)); 42624 42625 return castSlice(strSymbols, start).join(''); 42626 } 42627 42628 /** 42629 * Truncates `string` if it's longer than the given maximum string length. 42630 * The last characters of the truncated string are replaced with the omission 42631 * string which defaults to "...". 42632 * 42633 * @static 42634 * @memberOf _ 42635 * @since 4.0.0 42636 * @category String 42637 * @param {string} [string=''] The string to truncate. 42638 * @param {Object} [options={}] The options object. 42639 * @param {number} [options.length=30] The maximum string length. 42640 * @param {string} [options.omission='...'] The string to indicate text is omitted. 42641 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 42642 * @returns {string} Returns the truncated string. 42643 * @example 42644 * 42645 * _.truncate('hi-diddly-ho there, neighborino'); 42646 * // => 'hi-diddly-ho there, neighbo...' 42647 * 42648 * _.truncate('hi-diddly-ho there, neighborino', { 42649 * 'length': 24, 42650 * 'separator': ' ' 42651 * }); 42652 * // => 'hi-diddly-ho there,...' 42653 * 42654 * _.truncate('hi-diddly-ho there, neighborino', { 42655 * 'length': 24, 42656 * 'separator': /,? +/ 42657 * }); 42658 * // => 'hi-diddly-ho there...' 42659 * 42660 * _.truncate('hi-diddly-ho there, neighborino', { 42661 * 'omission': ' [...]' 42662 * }); 42663 * // => 'hi-diddly-ho there, neig [...]' 42664 */ 42665 function truncate(string, options) { 42666 var length = DEFAULT_TRUNC_LENGTH, 42667 omission = DEFAULT_TRUNC_OMISSION; 42668 42669 if (isObject(options)) { 42670 var separator = 'separator' in options ? options.separator : separator; 42671 length = 'length' in options ? toInteger(options.length) : length; 42672 omission = 'omission' in options ? baseToString(options.omission) : omission; 42673 } 42674 string = toString(string); 42675 42676 var strLength = string.length; 42677 if (hasUnicode(string)) { 42678 var strSymbols = stringToArray(string); 42679 strLength = strSymbols.length; 42680 } 42681 if (length >= strLength) { 42682 return string; 42683 } 42684 var end = length - stringSize(omission); 42685 if (end < 1) { 42686 return omission; 42687 } 42688 var result = strSymbols 42689 ? castSlice(strSymbols, 0, end).join('') 42690 : string.slice(0, end); 42691 42692 if (separator === undefined) { 42693 return result + omission; 42694 } 42695 if (strSymbols) { 42696 end += (result.length - end); 42697 } 42698 if (isRegExp(separator)) { 42699 if (string.slice(end).search(separator)) { 42700 var match, 42701 substring = result; 42702 42703 if (!separator.global) { 42704 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 42705 } 42706 separator.lastIndex = 0; 42707 while ((match = separator.exec(substring))) { 42708 var newEnd = match.index; 42709 } 42710 result = result.slice(0, newEnd === undefined ? end : newEnd); 42711 } 42712 } else if (string.indexOf(baseToString(separator), end) != end) { 42713 var index = result.lastIndexOf(separator); 42714 if (index > -1) { 42715 result = result.slice(0, index); 42716 } 42717 } 42718 return result + omission; 42719 } 42720 42721 /** 42722 * The inverse of `_.escape`; this method converts the HTML entities 42723 * `&`, `<`, `>`, `"`, and `'` in `string` to 42724 * their corresponding characters. 42725 * 42726 * **Note:** No other HTML entities are unescaped. To unescape additional 42727 * HTML entities use a third-party library like [_he_](https://mths.be/he). 42728 * 42729 * @static 42730 * @memberOf _ 42731 * @since 0.6.0 42732 * @category String 42733 * @param {string} [string=''] The string to unescape. 42734 * @returns {string} Returns the unescaped string. 42735 * @example 42736 * 42737 * _.unescape('fred, barney, & pebbles'); 42738 * // => 'fred, barney, & pebbles' 42739 */ 42740 function unescape(string) { 42741 string = toString(string); 42742 return (string && reHasEscapedHtml.test(string)) 42743 ? string.replace(reEscapedHtml, unescapeHtmlChar) 42744 : string; 42745 } 42746 42747 /** 42748 * Converts `string`, as space separated words, to upper case. 42749 * 42750 * @static 42751 * @memberOf _ 42752 * @since 4.0.0 42753 * @category String 42754 * @param {string} [string=''] The string to convert. 42755 * @returns {string} Returns the upper cased string. 42756 * @example 42757 * 42758 * _.upperCase('--foo-bar'); 42759 * // => 'FOO BAR' 42760 * 42761 * _.upperCase('fooBar'); 42762 * // => 'FOO BAR' 42763 * 42764 * _.upperCase('__foo_bar__'); 42765 * // => 'FOO BAR' 42766 */ 42767 var upperCase = createCompounder(function(result, word, index) { 42768 return result + (index ? ' ' : '') + word.toUpperCase(); 42769 }); 42770 42771 /** 42772 * Converts the first character of `string` to upper case. 42773 * 42774 * @static 42775 * @memberOf _ 42776 * @since 4.0.0 42777 * @category String 42778 * @param {string} [string=''] The string to convert. 42779 * @returns {string} Returns the converted string. 42780 * @example 42781 * 42782 * _.upperFirst('fred'); 42783 * // => 'Fred' 42784 * 42785 * _.upperFirst('FRED'); 42786 * // => 'FRED' 42787 */ 42788 var upperFirst = createCaseFirst('toUpperCase'); 42789 42790 /** 42791 * Splits `string` into an array of its words. 42792 * 42793 * @static 42794 * @memberOf _ 42795 * @since 3.0.0 42796 * @category String 42797 * @param {string} [string=''] The string to inspect. 42798 * @param {RegExp|string} [pattern] The pattern to match words. 42799 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 42800 * @returns {Array} Returns the words of `string`. 42801 * @example 42802 * 42803 * _.words('fred, barney, & pebbles'); 42804 * // => ['fred', 'barney', 'pebbles'] 42805 * 42806 * _.words('fred, barney, & pebbles', /[^, ]+/g); 42807 * // => ['fred', 'barney', '&', 'pebbles'] 42808 */ 42809 function words(string, pattern, guard) { 42810 string = toString(string); 42811 pattern = guard ? undefined : pattern; 42812 42813 if (pattern === undefined) { 42814 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 42815 } 42816 return string.match(pattern) || []; 42817 } 42818 42819 /*------------------------------------------------------------------------*/ 42820 42821 /** 42822 * Attempts to invoke `func`, returning either the result or the caught error 42823 * object. Any additional arguments are provided to `func` when it's invoked. 42824 * 42825 * @static 42826 * @memberOf _ 42827 * @since 3.0.0 42828 * @category Util 42829 * @param {Function} func The function to attempt. 42830 * @param {...*} [args] The arguments to invoke `func` with. 42831 * @returns {*} Returns the `func` result or error object. 42832 * @example 42833 * 42834 * // Avoid throwing errors for invalid selectors. 42835 * var elements = _.attempt(function(selector) { 42836 * return document.querySelectorAll(selector); 42837 * }, '>_>'); 42838 * 42839 * if (_.isError(elements)) { 42840 * elements = []; 42841 * } 42842 */ 42843 var attempt = baseRest(function(func, args) { 42844 try { 42845 return apply(func, undefined, args); 42846 } catch (e) { 42847 return isError(e) ? e : new Error(e); 42848 } 42849 }); 42850 42851 /** 42852 * Binds methods of an object to the object itself, overwriting the existing 42853 * method. 42854 * 42855 * **Note:** This method doesn't set the "length" property of bound functions. 42856 * 42857 * @static 42858 * @since 0.1.0 42859 * @memberOf _ 42860 * @category Util 42861 * @param {Object} object The object to bind and assign the bound methods to. 42862 * @param {...(string|string[])} methodNames The object method names to bind. 42863 * @returns {Object} Returns `object`. 42864 * @example 42865 * 42866 * var view = { 42867 * 'label': 'docs', 42868 * 'click': function() { 42869 * console.log('clicked ' + this.label); 42870 * } 42871 * }; 42872 * 42873 * _.bindAll(view, ['click']); 42874 * jQuery(element).on('click', view.click); 42875 * // => Logs 'clicked docs' when clicked. 42876 */ 42877 var bindAll = flatRest(function(object, methodNames) { 42878 arrayEach(methodNames, function(key) { 42879 key = toKey(key); 42880 baseAssignValue(object, key, bind(object[key], object)); 42881 }); 42882 return object; 42883 }); 42884 42885 /** 42886 * Creates a function that iterates over `pairs` and invokes the corresponding 42887 * function of the first predicate to return truthy. The predicate-function 42888 * pairs are invoked with the `this` binding and arguments of the created 42889 * function. 42890 * 42891 * @static 42892 * @memberOf _ 42893 * @since 4.0.0 42894 * @category Util 42895 * @param {Array} pairs The predicate-function pairs. 42896 * @returns {Function} Returns the new composite function. 42897 * @example 42898 * 42899 * var func = _.cond([ 42900 * [_.matches({ 'a': 1 }), _.constant('matches A')], 42901 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 42902 * [_.stubTrue, _.constant('no match')] 42903 * ]); 42904 * 42905 * func({ 'a': 1, 'b': 2 }); 42906 * // => 'matches A' 42907 * 42908 * func({ 'a': 0, 'b': 1 }); 42909 * // => 'matches B' 42910 * 42911 * func({ 'a': '1', 'b': '2' }); 42912 * // => 'no match' 42913 */ 42914 function cond(pairs) { 42915 var length = pairs == null ? 0 : pairs.length, 42916 toIteratee = getIteratee(); 42917 42918 pairs = !length ? [] : arrayMap(pairs, function(pair) { 42919 if (typeof pair[1] != 'function') { 42920 throw new TypeError(FUNC_ERROR_TEXT); 42921 } 42922 return [toIteratee(pair[0]), pair[1]]; 42923 }); 42924 42925 return baseRest(function(args) { 42926 var index = -1; 42927 while (++index < length) { 42928 var pair = pairs[index]; 42929 if (apply(pair[0], this, args)) { 42930 return apply(pair[1], this, args); 42931 } 42932 } 42933 }); 42934 } 42935 42936 /** 42937 * Creates a function that invokes the predicate properties of `source` with 42938 * the corresponding property values of a given object, returning `true` if 42939 * all predicates return truthy, else `false`. 42940 * 42941 * **Note:** The created function is equivalent to `_.conformsTo` with 42942 * `source` partially applied. 42943 * 42944 * @static 42945 * @memberOf _ 42946 * @since 4.0.0 42947 * @category Util 42948 * @param {Object} source The object of property predicates to conform to. 42949 * @returns {Function} Returns the new spec function. 42950 * @example 42951 * 42952 * var objects = [ 42953 * { 'a': 2, 'b': 1 }, 42954 * { 'a': 1, 'b': 2 } 42955 * ]; 42956 * 42957 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 42958 * // => [{ 'a': 1, 'b': 2 }] 42959 */ 42960 function conforms(source) { 42961 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 42962 } 42963 42964 /** 42965 * Creates a function that returns `value`. 42966 * 42967 * @static 42968 * @memberOf _ 42969 * @since 2.4.0 42970 * @category Util 42971 * @param {*} value The value to return from the new function. 42972 * @returns {Function} Returns the new constant function. 42973 * @example 42974 * 42975 * var objects = _.times(2, _.constant({ 'a': 1 })); 42976 * 42977 * console.log(objects); 42978 * // => [{ 'a': 1 }, { 'a': 1 }] 42979 * 42980 * console.log(objects[0] === objects[1]); 42981 * // => true 42982 */ 42983 function constant(value) { 42984 return function() { 42985 return value; 42986 }; 42987 } 42988 42989 /** 42990 * Checks `value` to determine whether a default value should be returned in 42991 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 42992 * or `undefined`. 42993 * 42994 * @static 42995 * @memberOf _ 42996 * @since 4.14.0 42997 * @category Util 42998 * @param {*} value The value to check. 42999 * @param {*} defaultValue The default value. 43000 * @returns {*} Returns the resolved value. 43001 * @example 43002 * 43003 * _.defaultTo(1, 10); 43004 * // => 1 43005 * 43006 * _.defaultTo(undefined, 10); 43007 * // => 10 43008 */ 43009 function defaultTo(value, defaultValue) { 43010 return (value == null || value !== value) ? defaultValue : value; 43011 } 43012 43013 /** 43014 * Creates a function that returns the result of invoking the given functions 43015 * with the `this` binding of the created function, where each successive 43016 * invocation is supplied the return value of the previous. 43017 * 43018 * @static 43019 * @memberOf _ 43020 * @since 3.0.0 43021 * @category Util 43022 * @param {...(Function|Function[])} [funcs] The functions to invoke. 43023 * @returns {Function} Returns the new composite function. 43024 * @see _.flowRight 43025 * @example 43026 * 43027 * function square(n) { 43028 * return n * n; 43029 * } 43030 * 43031 * var addSquare = _.flow([_.add, square]); 43032 * addSquare(1, 2); 43033 * // => 9 43034 */ 43035 var flow = createFlow(); 43036 43037 /** 43038 * This method is like `_.flow` except that it creates a function that 43039 * invokes the given functions from right to left. 43040 * 43041 * @static 43042 * @since 3.0.0 43043 * @memberOf _ 43044 * @category Util 43045 * @param {...(Function|Function[])} [funcs] The functions to invoke. 43046 * @returns {Function} Returns the new composite function. 43047 * @see _.flow 43048 * @example 43049 * 43050 * function square(n) { 43051 * return n * n; 43052 * } 43053 * 43054 * var addSquare = _.flowRight([square, _.add]); 43055 * addSquare(1, 2); 43056 * // => 9 43057 */ 43058 var flowRight = createFlow(true); 43059 43060 /** 43061 * This method returns the first argument it receives. 43062 * 43063 * @static 43064 * @since 0.1.0 43065 * @memberOf _ 43066 * @category Util 43067 * @param {*} value Any value. 43068 * @returns {*} Returns `value`. 43069 * @example 43070 * 43071 * var object = { 'a': 1 }; 43072 * 43073 * console.log(_.identity(object) === object); 43074 * // => true 43075 */ 43076 function identity(value) { 43077 return value; 43078 } 43079 43080 /** 43081 * Creates a function that invokes `func` with the arguments of the created 43082 * function. If `func` is a property name, the created function returns the 43083 * property value for a given element. If `func` is an array or object, the 43084 * created function returns `true` for elements that contain the equivalent 43085 * source properties, otherwise it returns `false`. 43086 * 43087 * @static 43088 * @since 4.0.0 43089 * @memberOf _ 43090 * @category Util 43091 * @param {*} [func=_.identity] The value to convert to a callback. 43092 * @returns {Function} Returns the callback. 43093 * @example 43094 * 43095 * var users = [ 43096 * { 'user': 'barney', 'age': 36, 'active': true }, 43097 * { 'user': 'fred', 'age': 40, 'active': false } 43098 * ]; 43099 * 43100 * // The `_.matches` iteratee shorthand. 43101 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 43102 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 43103 * 43104 * // The `_.matchesProperty` iteratee shorthand. 43105 * _.filter(users, _.iteratee(['user', 'fred'])); 43106 * // => [{ 'user': 'fred', 'age': 40 }] 43107 * 43108 * // The `_.property` iteratee shorthand. 43109 * _.map(users, _.iteratee('user')); 43110 * // => ['barney', 'fred'] 43111 * 43112 * // Create custom iteratee shorthands. 43113 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 43114 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 43115 * return func.test(string); 43116 * }; 43117 * }); 43118 * 43119 * _.filter(['abc', 'def'], /ef/); 43120 * // => ['def'] 43121 */ 43122 function iteratee(func) { 43123 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 43124 } 43125 43126 /** 43127 * Creates a function that performs a partial deep comparison between a given 43128 * object and `source`, returning `true` if the given object has equivalent 43129 * property values, else `false`. 43130 * 43131 * **Note:** The created function is equivalent to `_.isMatch` with `source` 43132 * partially applied. 43133 * 43134 * Partial comparisons will match empty array and empty object `source` 43135 * values against any array or object value, respectively. See `_.isEqual` 43136 * for a list of supported value comparisons. 43137 * 43138 * @static 43139 * @memberOf _ 43140 * @since 3.0.0 43141 * @category Util 43142 * @param {Object} source The object of property values to match. 43143 * @returns {Function} Returns the new spec function. 43144 * @example 43145 * 43146 * var objects = [ 43147 * { 'a': 1, 'b': 2, 'c': 3 }, 43148 * { 'a': 4, 'b': 5, 'c': 6 } 43149 * ]; 43150 * 43151 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 43152 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 43153 */ 43154 function matches(source) { 43155 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 43156 } 43157 43158 /** 43159 * Creates a function that performs a partial deep comparison between the 43160 * value at `path` of a given object to `srcValue`, returning `true` if the 43161 * object value is equivalent, else `false`. 43162 * 43163 * **Note:** Partial comparisons will match empty array and empty object 43164 * `srcValue` values against any array or object value, respectively. See 43165 * `_.isEqual` for a list of supported value comparisons. 43166 * 43167 * @static 43168 * @memberOf _ 43169 * @since 3.2.0 43170 * @category Util 43171 * @param {Array|string} path The path of the property to get. 43172 * @param {*} srcValue The value to match. 43173 * @returns {Function} Returns the new spec function. 43174 * @example 43175 * 43176 * var objects = [ 43177 * { 'a': 1, 'b': 2, 'c': 3 }, 43178 * { 'a': 4, 'b': 5, 'c': 6 } 43179 * ]; 43180 * 43181 * _.find(objects, _.matchesProperty('a', 4)); 43182 * // => { 'a': 4, 'b': 5, 'c': 6 } 43183 */ 43184 function matchesProperty(path, srcValue) { 43185 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 43186 } 43187 43188 /** 43189 * Creates a function that invokes the method at `path` of a given object. 43190 * Any additional arguments are provided to the invoked method. 43191 * 43192 * @static 43193 * @memberOf _ 43194 * @since 3.7.0 43195 * @category Util 43196 * @param {Array|string} path The path of the method to invoke. 43197 * @param {...*} [args] The arguments to invoke the method with. 43198 * @returns {Function} Returns the new invoker function. 43199 * @example 43200 * 43201 * var objects = [ 43202 * { 'a': { 'b': _.constant(2) } }, 43203 * { 'a': { 'b': _.constant(1) } } 43204 * ]; 43205 * 43206 * _.map(objects, _.method('a.b')); 43207 * // => [2, 1] 43208 * 43209 * _.map(objects, _.method(['a', 'b'])); 43210 * // => [2, 1] 43211 */ 43212 var method = baseRest(function(path, args) { 43213 return function(object) { 43214 return baseInvoke(object, path, args); 43215 }; 43216 }); 43217 43218 /** 43219 * The opposite of `_.method`; this method creates a function that invokes 43220 * the method at a given path of `object`. Any additional arguments are 43221 * provided to the invoked method. 43222 * 43223 * @static 43224 * @memberOf _ 43225 * @since 3.7.0 43226 * @category Util 43227 * @param {Object} object The object to query. 43228 * @param {...*} [args] The arguments to invoke the method with. 43229 * @returns {Function} Returns the new invoker function. 43230 * @example 43231 * 43232 * var array = _.times(3, _.constant), 43233 * object = { 'a': array, 'b': array, 'c': array }; 43234 * 43235 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 43236 * // => [2, 0] 43237 * 43238 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 43239 * // => [2, 0] 43240 */ 43241 var methodOf = baseRest(function(object, args) { 43242 return function(path) { 43243 return baseInvoke(object, path, args); 43244 }; 43245 }); 43246 43247 /**
43248 * Adds all own enumerable string keyed function properties of a source 43249 * object to the destination object. If `object` is a function, then methods 43250 * are added to its prototype as well. 43251 * 43252 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 43253 * avoid conflicts caused by modifying the original. 43254 * 43255 * @static 43256 * @since 0.1.0 43257 * @memberOf _ 43258 * @category Util 43259 * @param {Function|Object} [object=lodash] The destination object. 43260 * @param {Object} source The object of functions to add. 43261 * @param {Object} [options={}] The options object. 43262 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 43263 * @returns {Function|Object} Returns `object`. 43264 * @example 43265 * 43266 * function vowels(string) { 43267 * return _.filter(string, function(v) { 43268 * return /[aeiou]/i.test(v); 43269 * }); 43270 * } 43271 * 43272 * _.mixin({ 'vowels': vowels }); 43273 * _.vowels('fred'); 43274 * // => ['e'] 43275 * 43276 * _('fred').vowels().value(); 43277 * // => ['e'] 43278 * 43279 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 43280 * _('fred').vowels(); 43281 * // => ['e'] 43282 */ 43283 function mixin(object, source, options) { 43284 var props = keys(source), 43285 methodNames = baseFunctions(source, props); 43286 43287 if (options == null && 43288 !(isObject(source) && (methodNames.length || !props.length))) { 43289 options = source; 43290 source = object; 43291 object = this; 43292 methodNames = baseFunctions(source, keys(source)); 43293 } 43294 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 43295 isFunc = isFunction(object); 43296 43297 arrayEach(methodNames, function(methodName) { 43298 var func = source[methodName]; 43299 object[methodName] = func; 43300 if (isFunc) { 43301 object.prototype[methodName] = function() { 43302 var chainAll = this.__chain__; 43303 if (chain || chainAll) { 43304 var result = object(this.__wrapped__), 43305 actions = result.__actions__ = copyArray(this.__actions__); 43306 43307 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 43308 result.__chain__ = chainAll; 43309 return result; 43310 } 43311 return func.apply(object, arrayPush([this.value()], arguments)); 43312 }; 43313 } 43314 }); 43315 43316 return object; 43317 } 43318 43319 /** 43320 * Reverts the `_` variable to its previous value and returns a reference to 43321 * the `lodash` function. 43322 * 43323 * @static 43324 * @since 0.1.0 43325 * @memberOf _ 43326 * @category Util 43327 * @returns {Function} Returns the `lodash` function. 43328 * @example 43329 * 43330 * var lodash = _.noConflict(); 43331 */ 43332 function noConflict() { 43333 if (root._ === this) { 43334 root._ = oldDash; 43335 } 43336 return this; 43337 } 43338 43339 /** 43340 * This method returns `undefined`. 43341 * 43342 * @static 43343 * @memberOf _ 43344 * @since 2.3.0 43345 * @category Util 43346 * @example 43347 * 43348 * _.times(2, _.noop); 43349 * // => [undefined, undefined] 43350 */ 43351 function noop() { 43352 // No operation performed. 43353 } 43354 43355 /** 43356 * Creates a function that gets the argument at index `n`. If `n` is negative, 43357 * the nth argument from the end is returned. 43358 * 43359 * @static 43360 * @memberOf _ 43361 * @since 4.0.0 43362 * @category Util 43363 * @param {number} [n=0] The index of the argument to return. 43364 * @returns {Function} Returns the new pass-thru function. 43365 * @example 43366 * 43367 * var func = _.nthArg(1); 43368 * func('a', 'b', 'c', 'd'); 43369 * // => 'b' 43370 * 43371 * var func = _.nthArg(-2); 43372 * func('a', 'b', 'c', 'd'); 43373 * // => 'c' 43374 */ 43375 function nthArg(n) { 43376 n = toInteger(n); 43377 return baseRest(function(args) { 43378 return baseNth(args, n); 43379 }); 43380 } 43381 43382 /** 43383 * Creates a function that invokes `iteratees` with the arguments it receives 43384 * and returns their results. 43385 * 43386 * @static 43387 * @memberOf _ 43388 * @since 4.0.0 43389 * @category Util 43390 * @param {...(Function|Function[])} [iteratees=[_.identity]] 43391 * The iteratees to invoke. 43392 * @returns {Function} Returns the new function. 43393 * @example 43394 * 43395 * var func = _.over([Math.max, Math.min]); 43396 * 43397 * func(1, 2, 3, 4); 43398 * // => [4, 1] 43399 */ 43400 var over = createOver(arrayMap); 43401 43402 /** 43403 * Creates a function that checks if **all** of the `predicates` return 43404 * truthy when invoked with the arguments it receives. 43405 * 43406 * @static 43407 * @memberOf _ 43408 * @since 4.0.0 43409 * @category Util 43410 * @param {...(Function|Function[])} [predicates=[_.identity]] 43411 * The predicates to check. 43412 * @returns {Function} Returns the new function. 43413 * @example 43414 * 43415 * var func = _.overEvery([Boolean, isFinite]); 43416 * 43417 * func('1'); 43418 * // => true 43419 * 43420 * func(null); 43421 * // => false 43422 * 43423 * func(NaN); 43424 * // => false 43425 */ 43426 var overEvery = createOver(arrayEvery); 43427 43428 /** 43429 * Creates a function that checks if **any** of the `predicates` return 43430 * truthy when invoked with the arguments it receives. 43431 * 43432 * @static 43433 * @memberOf _ 43434 * @since 4.0.0 43435 * @category Util 43436 * @param {...(Function|Function[])} [predicates=[_.identity]] 43437 * The predicates to check. 43438 * @returns {Function} Returns the new function. 43439 * @example 43440 * 43441 * var func = _.overSome([Boolean, isFinite]); 43442 * 43443 * func('1'); 43444 * // => true 43445 * 43446 * func(null); 43447 * // => true 43448 * 43449 * func(NaN); 43450 * // => false 43451 */ 43452 var overSome = createOver(arraySome); 43453 43454 /** 43455 * Creates a function that returns the value at `path` of a given object. 43456 * 43457 * @static 43458 * @memberOf _ 43459 * @since 2.4.0 43460 * @category Util 43461 * @param {Array|string} path The path of the property to get. 43462 * @returns {Function} Returns the new accessor function. 43463 * @example 43464 * 43465 * var objects = [ 43466 * { 'a': { 'b': 2 } }, 43467 * { 'a': { 'b': 1 } } 43468 * ]; 43469 * 43470 * _.map(objects, _.property('a.b')); 43471 * // => [2, 1] 43472 * 43473 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 43474 * // => [1, 2] 43475 */ 43476 function property(path) { 43477 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 43478 } 43479 43480 /** 43481 * The opposite of `_.property`; this method creates a function that returns 43482 * the value at a given path of `object`. 43483 * 43484 * @static 43485 * @memberOf _ 43486 * @since 3.0.0 43487 * @category Util 43488 * @param {Object} object The object to query. 43489 * @returns {Function} Returns the new accessor function. 43490 * @example 43491 * 43492 * var array = [0, 1, 2], 43493 * object = { 'a': array, 'b': array, 'c': array }; 43494 * 43495 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 43496 * // => [2, 0] 43497 * 43498 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 43499 * // => [2, 0] 43500 */ 43501 function propertyOf(object) { 43502 return function(path) { 43503 return object == null ? undefined
vendor: 9,210 bytes, lines 43503-43873
43503 : baseGet(object, path); 43504 }; 43505 } 43506 43507 /** 43508 * Creates an array of numbers (positive and/or negative) progressing from 43509 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 43510 * `start` is specified without an `end` or `step`. If `end` is not specified, 43511 * it's set to `start` with `start` then set to `0`. 43512 * 43513 * **Note:** JavaScript follows the IEEE-754 standard for resolving 43514 * floating-point values which can produce unexpected results. 43515 * 43516 * @static 43517 * @since 0.1.0 43518 * @memberOf _ 43519 * @category Util 43520 * @param {number} [start=0] The start of the range. 43521 * @param {number} end The end of the range. 43522 * @param {number} [step=1] The value to increment or decrement by. 43523 * @returns {Array} Returns the range of numbers. 43524 * @see _.inRange, _.rangeRight 43525 * @example 43526 * 43527 * _.range(4); 43528 * // => [0, 1, 2, 3] 43529 * 43530 * _.range(-4); 43531 * // => [0, -1, -2, -3] 43532 * 43533 * _.range(1, 5); 43534 * // => [1, 2, 3, 4] 43535 * 43536 * _.range(0, 20, 5); 43537 * // => [0, 5, 10, 15] 43538 * 43539 * _.range(0, -4, -1); 43540 * // => [0, -1, -2, -3] 43541 * 43542 * _.range(1, 4, 0); 43543 * // => [1, 1, 1] 43544 * 43545 * _.range(0); 43546 * // => [] 43547 */ 43548 var range = createRange(); 43549 43550 /** 43551 * This method is like `_.range` except that it populates values in 43552 * descending order. 43553 * 43554 * @static 43555 * @memberOf _ 43556 * @since 4.0.0 43557 * @category Util 43558 * @param {number} [start=0] The start of the range. 43559 * @param {number} end The end of the range. 43560 * @param {number} [step=1] The value to increment or decrement by. 43561 * @returns {Array} Returns the range of numbers. 43562 * @see _.inRange, _.range 43563 * @example 43564 * 43565 * _.rangeRight(4); 43566 * // => [3, 2, 1, 0] 43567 * 43568 * _.rangeRight(-4); 43569 * // => [-3, -2, -1, 0] 43570 * 43571 * _.rangeRight(1, 5); 43572 * // => [4, 3, 2, 1] 43573 * 43574 * _.rangeRight(0, 20, 5); 43575 * // => [15, 10, 5, 0] 43576 * 43577 * _.rangeRight(0, -4, -1); 43578 * // => [-3, -2, -1, 0] 43579 * 43580 * _.rangeRight(1, 4, 0); 43581 * // => [1, 1, 1] 43582 * 43583 * _.rangeRight(0); 43584 * // => [] 43585 */ 43586 var rangeRight = createRange(true); 43587 43588 /** 43589 * This method returns a new empty array. 43590 * 43591 * @static 43592 * @memberOf _ 43593 * @since 4.13.0 43594 * @category Util 43595 * @returns {Array} Returns the new empty array. 43596 * @example 43597 * 43598 * var arrays = _.times(2, _.stubArray); 43599 * 43600 * console.log(arrays); 43601 * // => [[], []] 43602 * 43603 * console.log(arrays[0] === arrays[1]); 43604 * // => false 43605 */ 43606 function stubArray() { 43607 return []; 43608 } 43609 43610 /** 43611 * This method returns `false`. 43612 * 43613 * @static 43614 * @memberOf _ 43615 * @since 4.13.0 43616 * @category Util 43617 * @returns {boolean} Returns `false`. 43618 * @example 43619 * 43620 * _.times(2, _.stubFalse); 43621 * // => [false, false] 43622 */ 43623 function stubFalse() { 43624 return false; 43625 } 43626 43627 /** 43628 * This method returns a new empty object. 43629 * 43630 * @static 43631 * @memberOf _ 43632 * @since 4.13.0 43633 * @category Util 43634 * @returns {Object} Returns the new empty object. 43635 * @example 43636 * 43637 * var objects = _.times(2, _.stubObject); 43638 * 43639 * console.log(objects); 43640 * // => [{}, {}] 43641 * 43642 * console.log(objects[0] === objects[1]); 43643 * // => false 43644 */ 43645 function stubObject() { 43646 return {}; 43647 } 43648 43649 /** 43650 * This method returns an empty string. 43651 * 43652 * @static 43653 * @memberOf _ 43654 * @since 4.13.0 43655 * @category Util 43656 * @returns {string} Returns the empty string. 43657 * @example 43658 * 43659 * _.times(2, _.stubString); 43660 * // => ['', ''] 43661 */ 43662 function stubString() { 43663 return ''; 43664 } 43665 43666 /** 43667 * This method returns `true`. 43668 * 43669 * @static 43670 * @memberOf _ 43671 * @since 4.13.0 43672 * @category Util 43673 * @returns {boolean} Returns `true`. 43674 * @example 43675 * 43676 * _.times(2, _.stubTrue); 43677 * // => [true, true] 43678 */ 43679 function stubTrue() { 43680 return true; 43681 } 43682 43683 /** 43684 * Invokes the iteratee `n` times, returning an array of the results of 43685 * each invocation. The iteratee is invoked with one argument; (index). 43686 * 43687 * @static 43688 * @since 0.1.0 43689 * @memberOf _ 43690 * @category Util 43691 * @param {number} n The number of times to invoke `iteratee`. 43692 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 43693 * @returns {Array} Returns the array of results. 43694 * @example 43695 * 43696 * _.times(3, String); 43697 * // => ['0', '1', '2'] 43698 * 43699 * _.times(4, _.constant(0)); 43700 * // => [0, 0, 0, 0] 43701 */ 43702 function times(n, iteratee) { 43703 n = toInteger(n); 43704 if (n < 1 || n > MAX_SAFE_INTEGER) { 43705 return []; 43706 } 43707 var index = MAX_ARRAY_LENGTH, 43708 length = nativeMin(n, MAX_ARRAY_LENGTH); 43709 43710 iteratee = getIteratee(iteratee); 43711 n -= MAX_ARRAY_LENGTH; 43712 43713 var result = baseTimes(length, iteratee); 43714 while (++index < n) { 43715 iteratee(index); 43716 } 43717 return result; 43718 } 43719 43720 /** 43721 * Converts `value` to a property path array. 43722 * 43723 * @static 43724 * @memberOf _ 43725 * @since 4.0.0 43726 * @category Util 43727 * @param {*} value The value to convert. 43728 * @returns {Array} Returns the new property path array. 43729 * @example 43730 * 43731 * _.toPath('a.b.c'); 43732 * // => ['a', 'b', 'c'] 43733 * 43734 * _.toPath('a[0].b.c'); 43735 * // => ['a', '0', 'b', 'c'] 43736 */ 43737 function toPath(value) { 43738 if (isArray(value)) { 43739 return arrayMap(value, toKey); 43740 } 43741 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 43742 } 43743 43744 /** 43745 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 43746 * 43747 * @static 43748 * @since 0.1.0 43749 * @memberOf _ 43750 * @category Util 43751 * @param {string} [prefix=''] The value to prefix the ID with. 43752 * @returns {string} Returns the unique ID. 43753 * @example 43754 * 43755 * _.uniqueId('contact_'); 43756 * // => 'contact_104' 43757 * 43758 * _.uniqueId(); 43759 * // => '105' 43760 */ 43761 function uniqueId(prefix) { 43762 var id = ++idCounter; 43763 return toString(prefix) + id; 43764 } 43765 43766 /*------------------------------------------------------------------------*/ 43767 43768 /** 43769 * Adds two numbers. 43770 * 43771 * @static 43772 * @memberOf _ 43773 * @since 3.4.0 43774 * @category Math 43775 * @param {number} augend The first number in an addition. 43776 * @param {number} addend The second number in an addition. 43777 * @returns {number} Returns the total. 43778 * @example 43779 * 43780 * _.add(6, 4); 43781 * // => 10 43782 */ 43783 var add = createMathOperation(function(augend, addend) { 43784 return augend + addend; 43785 }, 0); 43786 43787 /** 43788 * Computes `number` rounded up to `precision`. 43789 * 43790 * @static 43791 * @memberOf _ 43792 * @since 3.10.0 43793 * @category Math 43794 * @param {number} number The number to round up. 43795 * @param {number} [precision=0] The precision to round up to. 43796 * @returns {number} Returns the rounded up number. 43797 * @example 43798 * 43799 * _.ceil(4.006); 43800 * // => 5 43801 * 43802 * _.ceil(6.004, 2); 43803 * // => 6.01 43804 * 43805 * _.ceil(6040, -2); 43806 * // => 6100 43807 */ 43808 var ceil = createRound('ceil'); 43809 43810 /** 43811 * Divide two numbers. 43812 * 43813 * @static 43814 * @memberOf _ 43815 * @since 4.7.0 43816 * @category Math 43817 * @param {number} dividend The first number in a division. 43818 * @param {number} divisor The second number in a division. 43819 * @returns {number} Returns the quotient. 43820 * @example 43821 * 43822 * _.divide(6, 4); 43823 * // => 1.5 43824 */ 43825 var divide = createMathOperation(function(dividend, divisor) { 43826 return dividend / divisor; 43827 }, 1); 43828 43829 /** 43830 * Computes `number` rounded down to `precision`. 43831 * 43832 * @static 43833 * @memberOf _ 43834 * @since 3.10.0 43835 * @category Math 43836 * @param {number} number The number to round down. 43837 * @param {number} [precision=0] The precision to round down to. 43838 * @returns {number} Returns the rounded down number. 43839 * @example 43840 * 43841 * _.floor(4.006); 43842 * // => 4 43843 * 43844 * _.floor(0.046, 2); 43845 * // => 0.04 43846 * 43847 * _.floor(4060, -2); 43848 * // => 4000 43849 */ 43850 var floor = createRound('floor'); 43851 43852 /** 43853 * Computes the maximum value of `array`. If `array` is empty or falsey, 43854 * `undefined` is returned. 43855 * 43856 * @static 43857 * @since 0.1.0 43858 * @memberOf _ 43859 * @category Math 43860 * @param {Array} array The array to iterate over. 43861 * @returns {*} Returns the maximum value. 43862 * @example 43863 * 43864 * _.max([4, 2, 8, 6]); 43865 * // => 8 43866 * 43867 * _.max([]); 43868 * // => undefined 43869 */ 43870 function max(array) { 43871 return (array && array.length) 43872 ? baseExtremum(array, identity, baseGt) 43873 : undefined
43873; 43874 } 43875 43876 /** 43877 * This method is like `_.max` except that it accepts `iteratee` which is 43878 * invoked for each element in `array` to generate the criterion by which 43879 * the value is ranked. The iteratee is invoked with one argument: (value). 43880 * 43881 * @static 43882 * @memberOf _ 43883 * @since 4.0.0 43884 * @category Math 43885 * @param {Array} array The array to iterate over. 43886 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 43887 * @returns {*} Returns the maximum value. 43888 * @example 43889 * 43890 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 43891 * 43892 * _.maxBy(objects, function(o) { return o.n; }); 43893 * // => { 'n': 2 } 43894 * 43895 * // The `_.property` iteratee shorthand. 43896 * _.maxBy(objects, 'n'); 43897 * // => { 'n': 2 } 43898 */ 43899 function maxBy(array, iteratee) { 43900 return (array && array.length) 43901 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 43902 : undefined; 43903 } 43904 43905 /** 43906 * Computes the mean of the values in `array`. 43907 * 43908 * @static 43909 * @memberOf _ 43910 * @since 4.0.0 43911 * @category Math 43912 * @param {Array} array The array to iterate over. 43913 * @returns {number} Returns the mean. 43914 * @example 43915 * 43916 * _.mean([4, 2, 8, 6]); 43917 * // => 5 43918 */ 43919 function mean(array) { 43920 return baseMean(array, identity); 43921 } 43922 43923 /** 43924 * This method is like `_.mean` except that it accepts `iteratee` which is 43925 * invoked for each element in `array` to generate the value to be averaged. 43926 * The iteratee is invoked with one argument: (value). 43927 * 43928 * @static 43929 * @memberOf _ 43930 * @since 4.7.0 43931 * @category Math 43932 * @param {Array} array The array to iterate over. 43933 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 43934 * @returns {number} Returns the mean. 43935 * @example 43936 * 43937 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 43938 * 43939 * _.meanBy(objects, function(o) { return o.n; }); 43940 * // => 5 43941 * 43942 * // The `_.property` iteratee shorthand. 43943 * _.meanBy(objects, 'n'); 43944 * // => 5 43945 */ 43946 function meanBy(array, iteratee) { 43947 return baseMean(array, getIteratee(iteratee, 2)); 43948 } 43949 43950 /** 43951 * Computes the minimum value of `array`. If `array` is empty or falsey, 43952 * `undefined` is returned. 43953 * 43954 * @static 43955 * @since 0.1.0 43956 * @memberOf _ 43957 * @category Math 43958 * @param {Array} array The array to iterate over. 43959 * @returns {*} Returns the minimum value. 43960 * @example 43961 * 43962 * _.min([4, 2, 8, 6]); 43963 * // => 2 43964 * 43965 * _.min([]); 43966 * // => undefined 43967 */ 43968 function min(array) { 43969 return (array && array.length) 43970 ? baseExtremum(array, identity, baseLt) 43971 : undefined; 43972 } 43973 43974 /** 43975 * This method is like `_.min` except that it accepts `iteratee` which is 43976 * invoked for each element in `array` to generate the criterion by which 43977 * the value is ranked. The iteratee is invoked with one argument: (value). 43978 * 43979 * @static 43980 * @memberOf _ 43981 * @since 4.0.0 43982 * @category Math 43983 * @param {Array} array The array to iterate over. 43984 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 43985 * @returns {*} Returns the minimum value. 43986 * @example 43987 * 43988 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 43989 * 43990 * _.minBy(objects, function(o) { return o.n; }); 43991 * // => { 'n': 1 } 43992 * 43993 * // The `_.property` iteratee shorthand. 43994 * _.minBy(objects, 'n'); 43995 * // => { 'n': 1 } 43996 */ 43997 function minBy(array, iteratee) { 43998 return (array && array.length) 43999 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 44000 : undefined
vendor: 14,139 bytes, lines 44000-44462
44000; 44001 } 44002 44003 /** 44004 * Multiply two numbers. 44005 * 44006 * @static 44007 * @memberOf _ 44008 * @since 4.7.0 44009 * @category Math 44010 * @param {number} multiplier The first number in a multiplication. 44011 * @param {number} multiplicand The second number in a multiplication. 44012 * @returns {number} Returns the product. 44013 * @example 44014 * 44015 * _.multiply(6, 4); 44016 * // => 24 44017 */ 44018 var multiply = createMathOperation(function(multiplier, multiplicand) { 44019 return multiplier * multiplicand; 44020 }, 1); 44021 44022 /** 44023 * Computes `number` rounded to `precision`. 44024 * 44025 * @static 44026 * @memberOf _ 44027 * @since 3.10.0 44028 * @category Math 44029 * @param {number} number The number to round. 44030 * @param {number} [precision=0] The precision to round to. 44031 * @returns {number} Returns the rounded number. 44032 * @example 44033 * 44034 * _.round(4.006); 44035 * // => 4 44036 * 44037 * _.round(4.006, 2); 44038 * // => 4.01 44039 * 44040 * _.round(4060, -2); 44041 * // => 4100 44042 */ 44043 var round = createRound('round'); 44044 44045 /** 44046 * Subtract two numbers. 44047 * 44048 * @static 44049 * @memberOf _ 44050 * @since 4.0.0 44051 * @category Math 44052 * @param {number} minuend The first number in a subtraction. 44053 * @param {number} subtrahend The second number in a subtraction. 44054 * @returns {number} Returns the difference. 44055 * @example 44056 * 44057 * _.subtract(6, 4); 44058 * // => 2 44059 */ 44060 var subtract = createMathOperation(function(minuend, subtrahend) { 44061 return minuend - subtrahend; 44062 }, 0); 44063 44064 /** 44065 * Computes the sum of the values in `array`. 44066 * 44067 * @static 44068 * @memberOf _ 44069 * @since 3.4.0 44070 * @category Math 44071 * @param {Array} array The array to iterate over. 44072 * @returns {number} Returns the sum. 44073 * @example 44074 * 44075 * _.sum([4, 2, 8, 6]); 44076 * // => 20 44077 */ 44078 function sum(array) { 44079 return (array && array.length) 44080 ? baseSum(array, identity) 44081 : 0; 44082 } 44083 44084 /** 44085 * This method is like `_.sum` except that it accepts `iteratee` which is 44086 * invoked for each element in `array` to generate the value to be summed. 44087 * The iteratee is invoked with one argument: (value). 44088 * 44089 * @static 44090 * @memberOf _ 44091 * @since 4.0.0 44092 * @category Math 44093 * @param {Array} array The array to iterate over. 44094 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 44095 * @returns {number} Returns the sum. 44096 * @example 44097 * 44098 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 44099 * 44100 * _.sumBy(objects, function(o) { return o.n; }); 44101 * // => 20 44102 * 44103 * // The `_.property` iteratee shorthand. 44104 * _.sumBy(objects, 'n'); 44105 * // => 20 44106 */ 44107 function sumBy(array, iteratee) { 44108 return (array && array.length) 44109 ? baseSum(array, getIteratee(iteratee, 2)) 44110 : 0; 44111 } 44112 44113 /*------------------------------------------------------------------------*/ 44114 44115 // Add methods that return wrapped values in chain sequences. 44116 lodash.after = after; 44117 lodash.ary = ary; 44118 lodash.assign = assign; 44119 lodash.assignIn = assignIn; 44120 lodash.assignInWith = assignInWith; 44121 lodash.assignWith = assignWith; 44122 lodash.at = at; 44123 lodash.before = before; 44124 lodash.bind = bind; 44125 lodash.bindAll = bindAll; 44126 lodash.bindKey = bindKey; 44127 lodash.castArray = castArray; 44128 lodash.chain = chain; 44129 lodash.chunk = chunk; 44130 lodash.compact = compact; 44131 lodash.concat = concat; 44132 lodash.cond = cond; 44133 lodash.conforms = conforms; 44134 lodash.constant = constant; 44135 lodash.countBy = countBy; 44136 lodash.create = create; 44137 lodash.curry = curry; 44138 lodash.curryRight = curryRight; 44139 lodash.debounce = debounce; 44140 lodash.defaults = defaults; 44141 lodash.defaultsDeep = defaultsDeep; 44142 lodash.defer = defer; 44143 lodash.delay = delay; 44144 lodash.difference = difference; 44145 lodash.differenceBy = differenceBy; 44146 lodash.differenceWith = differenceWith; 44147 lodash.drop = drop; 44148 lodash.dropRight = dropRight; 44149 lodash.dropRightWhile = dropRightWhile; 44150 lodash.dropWhile = dropWhile; 44151 lodash.fill = fill; 44152 lodash.filter = filter; 44153 lodash.flatMap = flatMap; 44154 lodash.flatMapDeep = flatMapDeep; 44155 lodash.flatMapDepth = flatMapDepth; 44156 lodash.flatten = flatten; 44157 lodash.flattenDeep = flattenDeep; 44158 lodash.flattenDepth = flattenDepth; 44159 lodash.flip = flip; 44160 lodash.flow = flow; 44161 lodash.flowRight = flowRight; 44162 lodash.fromPairs = fromPairs; 44163 lodash.functions = functions; 44164 lodash.functionsIn = functionsIn; 44165 lodash.groupBy = groupBy; 44166 lodash.initial = initial; 44167 lodash.intersection = intersection; 44168 lodash.intersectionBy = intersectionBy; 44169 lodash.intersectionWith = intersectionWith; 44170 lodash.invert = invert; 44171 lodash.invertBy = invertBy; 44172 lodash.invokeMap = invokeMap; 44173 lodash.iteratee = iteratee; 44174 lodash.keyBy = keyBy; 44175 lodash.keys = keys; 44176 lodash.keysIn = keysIn; 44177 lodash.map = map; 44178 lodash.mapKeys = mapKeys; 44179 lodash.mapValues = mapValues; 44180 lodash.matches = matches; 44181 lodash.matchesProperty = matchesProperty; 44182 lodash.memoize = memoize; 44183 lodash.merge = merge; 44184 lodash.mergeWith = mergeWith; 44185 lodash.method = method; 44186 lodash.methodOf = methodOf; 44187 lodash.mixin = mixin; 44188 lodash.negate = negate; 44189 lodash.nthArg = nthArg; 44190 lodash.omit = omit; 44191 lodash.omitBy = omitBy; 44192 lodash.once = once; 44193 lodash.orderBy = orderBy; 44194 lodash.over = over; 44195 lodash.overArgs = overArgs; 44196 lodash.overEvery = overEvery; 44197 lodash.overSome = overSome; 44198 lodash.partial = partial; 44199 lodash.partialRight = partialRight; 44200 lodash.partition = partition; 44201 lodash.pick = pick; 44202 lodash.pickBy = pickBy; 44203 lodash.property = property; 44204 lodash.propertyOf = propertyOf; 44205 lodash.pull = pull; 44206 lodash.pullAll = pullAll; 44207 lodash.pullAllBy = pullAllBy; 44208 lodash.pullAllWith = pullAllWith; 44209 lodash.pullAt = pullAt; 44210 lodash.range = range; 44211 lodash.rangeRight = rangeRight; 44212 lodash.rearg = rearg; 44213 lodash.reject = reject; 44214 lodash.remove = remove; 44215 lodash.rest = rest; 44216 lodash.reverse = reverse; 44217 lodash.sampleSize = sampleSize; 44218 lodash.set = set; 44219 lodash.setWith = setWith; 44220 lodash.shuffle = shuffle; 44221 lodash.slice = slice; 44222 lodash.sortBy = sortBy; 44223 lodash.sortedUniq = sortedUniq; 44224 lodash.sortedUniqBy = sortedUniqBy; 44225 lodash.split = split; 44226 lodash.spread = spread; 44227 lodash.tail = tail; 44228 lodash.take = take; 44229 lodash.takeRight = takeRight; 44230 lodash.takeRightWhile = takeRightWhile; 44231 lodash.takeWhile = takeWhile; 44232 lodash.tap = tap; 44233 lodash.throttle = throttle; 44234 lodash.thru = thru; 44235 lodash.toArray = toArray; 44236 lodash.toPairs = toPairs; 44237 lodash.toPairsIn = toPairsIn; 44238 lodash.toPath = toPath; 44239 lodash.toPlainObject = toPlainObject; 44240 lodash.transform = transform; 44241 lodash.unary = unary; 44242 lodash.union = union; 44243 lodash.unionBy = unionBy; 44244 lodash.unionWith = unionWith; 44245 lodash.uniq = uniq; 44246 lodash.uniqBy = uniqBy; 44247 lodash.uniqWith = uniqWith; 44248 lodash.unset = unset; 44249 lodash.unzip = unzip; 44250 lodash.unzipWith = unzipWith; 44251 lodash.update = update; 44252 lodash.updateWith = updateWith; 44253 lodash.values = values; 44254 lodash.valuesIn = valuesIn; 44255 lodash.without = without; 44256 lodash.words = words; 44257 lodash.wrap = wrap; 44258 lodash.xor = xor; 44259 lodash.xorBy = xorBy; 44260 lodash.xorWith = xorWith; 44261 lodash.zip = zip; 44262 lodash.zipObject = zipObject; 44263 lodash.zipObjectDeep = zipObjectDeep; 44264 lodash.zipWith = zipWith; 44265 44266 // Add aliases. 44267 lodash.entries = toPairs; 44268 lodash.entriesIn = toPairsIn; 44269 lodash.extend = assignIn; 44270 lodash.extendWith = assignInWith; 44271 44272 // Add methods to `lodash.prototype`. 44273 mixin(lodash, lodash); 44274 44275 /*------------------------------------------------------------------------*/ 44276 44277 // Add methods that return unwrapped values in chain sequences. 44278 lodash.add = add; 44279 lodash.attempt = attempt; 44280 lodash.camelCase = camelCase; 44281 lodash.capitalize = capitalize; 44282 lodash.ceil = ceil; 44283 lodash.clamp = clamp; 44284 lodash.clone = clone; 44285 lodash.cloneDeep = cloneDeep; 44286 lodash.cloneDeepWith = cloneDeepWith; 44287 lodash.cloneWith = cloneWith; 44288 lodash.conformsTo = conformsTo; 44289 lodash.deburr = deburr; 44290 lodash.defaultTo = defaultTo; 44291 lodash.divide = divide; 44292 lodash.endsWith = endsWith; 44293 lodash.eq = eq; 44294 lodash.escape = escape; 44295 lodash.escapeRegExp = escapeRegExp; 44296 lodash.every = every; 44297 lodash.find = find; 44298 lodash.findIndex = findIndex; 44299 lodash.findKey = findKey; 44300 lodash.findLast = findLast; 44301 lodash.findLastIndex = findLastIndex; 44302 lodash.findLastKey = findLastKey; 44303 lodash.floor = floor; 44304 lodash.forEach = forEach; 44305 lodash.forEachRight = forEachRight; 44306 lodash.forIn = forIn; 44307 lodash.forInRight = forInRight; 44308 lodash.forOwn = forOwn; 44309 lodash.forOwnRight = forOwnRight; 44310 lodash.get = get; 44311 lodash.gt = gt; 44312 lodash.gte = gte; 44313 lodash.has = has; 44314 lodash.hasIn = hasIn; 44315 lodash.head = head; 44316 lodash.identity = identity; 44317 lodash.includes = includes; 44318 lodash.indexOf = indexOf; 44319 lodash.inRange = inRange; 44320 lodash.invoke = invoke; 44321 lodash.isArguments = isArguments; 44322 lodash.isArray = isArray; 44323 lodash.isArrayBuffer = isArrayBuffer; 44324 lodash.isArrayLike = isArrayLike; 44325 lodash.isArrayLikeObject = isArrayLikeObject; 44326 lodash.isBoolean = isBoolean; 44327 lodash.isBuffer = isBuffer; 44328 lodash.isDate = isDate; 44329 lodash.isElement = isElement; 44330 lodash.isEmpty = isEmpty; 44331 lodash.isEqual = isEqual; 44332 lodash.isEqualWith = isEqualWith; 44333 lodash.isError = isError; 44334 lodash.isFinite = isFinite; 44335 lodash.isFunction = isFunction; 44336 lodash.isInteger = isInteger; 44337 lodash.isLength = isLength; 44338 lodash.isMap = isMap; 44339 lodash.isMatch = isMatch; 44340 lodash.isMatchWith = isMatchWith; 44341 lodash.isNaN = isNaN; 44342 lodash.isNative = isNative; 44343 lodash.isNil = isNil; 44344 lodash.isNull = isNull; 44345 lodash.isNumber = isNumber; 44346 lodash.isObject = isObject; 44347 lodash.isObjectLike = isObjectLike; 44348 lodash.isPlainObject = isPlainObject; 44349 lodash.isRegExp = isRegExp; 44350 lodash.isSafeInteger = isSafeInteger; 44351 lodash.isSet = isSet; 44352 lodash.isString = isString; 44353 lodash.isSymbol = isSymbol; 44354 lodash.isTypedArray = isTypedArray; 44355 lodash.isUndefined = isUndefined; 44356 lodash.isWeakMap = isWeakMap; 44357 lodash.isWeakSet = isWeakSet; 44358 lodash.join = join; 44359 lodash.kebabCase = kebabCase; 44360 lodash.last = last; 44361 lodash.lastIndexOf = lastIndexOf; 44362 lodash.lowerCase = lowerCase; 44363 lodash.lowerFirst = lowerFirst; 44364 lodash.lt = lt; 44365 lodash.lte = lte; 44366 lodash.max = max; 44367 lodash.maxBy = maxBy; 44368 lodash.mean = mean; 44369 lodash.meanBy = meanBy; 44370 lodash.min = min; 44371 lodash.minBy = minBy; 44372 lodash.stubArray = stubArray; 44373 lodash.stubFalse = stubFalse; 44374 lodash.stubObject = stubObject; 44375 lodash.stubString = stubString; 44376 lodash.stubTrue = stubTrue; 44377 lodash.multiply = multiply; 44378 lodash.nth = nth; 44379 lodash.noConflict = noConflict; 44380 lodash.noop = noop; 44381 lodash.now = now; 44382 lodash.pad = pad; 44383 lodash.padEnd = padEnd; 44384 lodash.padStart = padStart; 44385 lodash.parseInt = parseInt; 44386 lodash.random = random; 44387 lodash.reduce = reduce; 44388 lodash.reduceRight = reduceRight; 44389 lodash.repeat = repeat; 44390 lodash.replace = replace; 44391 lodash.result = result; 44392 lodash.round = round; 44393 lodash.runInContext = runInContext; 44394 lodash.sample = sample; 44395 lodash.size = size; 44396 lodash.snakeCase = snakeCase; 44397 lodash.some = some; 44398 lodash.sortedIndex = sortedIndex; 44399 lodash.sortedIndexBy = sortedIndexBy; 44400 lodash.sortedIndexOf = sortedIndexOf; 44401 lodash.sortedLastIndex = sortedLastIndex; 44402 lodash.sortedLastIndexBy = sortedLastIndexBy; 44403 lodash.sortedLastIndexOf = sortedLastIndexOf; 44404 lodash.startCase = startCase; 44405 lodash.startsWith = startsWith; 44406 lodash.subtract = subtract; 44407 lodash.sum = sum; 44408 lodash.sumBy = sumBy; 44409 lodash.template = template; 44410 lodash.times = times; 44411 lodash.toFinite = toFinite; 44412 lodash.toInteger = toInteger; 44413 lodash.toLength = toLength; 44414 lodash.toLower = toLower; 44415 lodash.toNumber = toNumber; 44416 lodash.toSafeInteger = toSafeInteger; 44417 lodash.toString = toString; 44418 lodash.toUpper = toUpper; 44419 lodash.trim = trim; 44420 lodash.trimEnd = trimEnd; 44421 lodash.trimStart = trimStart; 44422 lodash.truncate = truncate; 44423 lodash.unescape = unescape; 44424 lodash.uniqueId = uniqueId; 44425 lodash.upperCase = upperCase; 44426 lodash.upperFirst = upperFirst; 44427 44428 // Add aliases. 44429 lodash.each = forEach; 44430 lodash.eachRight = forEachRight; 44431 lodash.first = head; 44432 44433 mixin(lodash, (function() { 44434 var source = {}; 44435 baseForOwn(lodash, function(func, methodName) { 44436 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 44437 source[methodName] = func; 44438 } 44439 }); 44440 return source; 44441 }()), { 'chain': false }); 44442 44443 /*------------------------------------------------------------------------*/ 44444 44445 /** 44446 * The semantic version number. 44447 * 44448 * @static 44449 * @memberOf _ 44450 * @type {string} 44451 */ 44452 lodash.VERSION = VERSION; 44453 44454 // Assign default placeholders. 44455 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 44456 lodash[methodName].placeholder = lodash; 44457 }); 44458 44459 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 44460 arrayEach(['drop', 'take'], function(methodName, index) { 44461 LazyWrapper.prototype[methodName] = function(n) { 44462 n = n === undefined
vendor: 4,536 bytes, lines 44462-44594
44462 ? 1 : nativeMax(toInteger(n), 0); 44463 44464 var result = (this.__filtered__ && !index) 44465 ? new LazyWrapper(this) 44466 : this.clone(); 44467 44468 if (result.__filtered__) { 44469 result.__takeCount__ = nativeMin(n, result.__takeCount__); 44470 } else { 44471 result.__views__.push({ 44472 'size': nativeMin(n, MAX_ARRAY_LENGTH), 44473 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 44474 }); 44475 } 44476 return result; 44477 }; 44478 44479 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 44480 return this.reverse()[methodName](n).reverse(); 44481 }; 44482 }); 44483 44484 // Add `LazyWrapper` methods that accept an `iteratee` value. 44485 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 44486 var type = index + 1, 44487 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 44488 44489 LazyWrapper.prototype[methodName] = function(iteratee) { 44490 var result = this.clone(); 44491 result.__iteratees__.push({ 44492 'iteratee': getIteratee(iteratee, 3), 44493 'type': type 44494 }); 44495 result.__filtered__ = result.__filtered__ || isFilter; 44496 return result; 44497 }; 44498 }); 44499 44500 // Add `LazyWrapper` methods for `_.head` and `_.last`. 44501 arrayEach(['head', 'last'], function(methodName, index) { 44502 var takeName = 'take' + (index ? 'Right' : ''); 44503 44504 LazyWrapper.prototype[methodName] = function() { 44505 return this[takeName](1).value()[0]; 44506 }; 44507 }); 44508 44509 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 44510 arrayEach(['initial', 'tail'], function(methodName, index) { 44511 var dropName = 'drop' + (index ? '' : 'Right'); 44512 44513 LazyWrapper.prototype[methodName] = function() { 44514 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 44515 }; 44516 }); 44517 44518 LazyWrapper.prototype.compact = function() { 44519 return this.filter(identity); 44520 }; 44521 44522 LazyWrapper.prototype.find = function(predicate) { 44523 return this.filter(predicate).head(); 44524 }; 44525 44526 LazyWrapper.prototype.findLast = function(predicate) { 44527 return this.reverse().find(predicate); 44528 }; 44529 44530 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 44531 if (typeof path == 'function') { 44532 return new LazyWrapper(this); 44533 } 44534 return this.map(function(value) { 44535 return baseInvoke(value, path, args); 44536 }); 44537 }); 44538 44539 LazyWrapper.prototype.reject = function(predicate) { 44540 return this.filter(negate(getIteratee(predicate))); 44541 }; 44542 44543 LazyWrapper.prototype.slice = function(start, end) { 44544 start = toInteger(start); 44545 44546 var result = this; 44547 if (result.__filtered__ && (start > 0 || end < 0)) { 44548 return new LazyWrapper(result); 44549 } 44550 if (start < 0) { 44551 result = result.takeRight(-start); 44552 } else if (start) { 44553 result = result.drop(start); 44554 } 44555 if (end !== undefined) { 44556 end = toInteger(end); 44557 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 44558 } 44559 return result; 44560 }; 44561 44562 LazyWrapper.prototype.takeRightWhile = function(predicate) { 44563 return this.reverse().takeWhile(predicate).reverse(); 44564 }; 44565 44566 LazyWrapper.prototype.toArray = function() { 44567 return this.take(MAX_ARRAY_LENGTH); 44568 }; 44569 44570 // Add `LazyWrapper` methods to `lodash.prototype`. 44571 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 44572 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 44573 isTaker = /^(?:head|last)$/.test(methodName), 44574 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 44575 retUnwrapped = isTaker || /^find/.test(methodName); 44576 44577 if (!lodashFunc) { 44578 return; 44579 } 44580 lodash.prototype[methodName] = function() { 44581 var value = this.__wrapped__, 44582 args = isTaker ? [1] : arguments, 44583 isLazy = value instanceof LazyWrapper, 44584 iteratee = args[0], 44585 useLazy = isLazy || isArray(value); 44586 44587 var interceptor = function(value) { 44588 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 44589 return (isTaker && chainAll) ? result[0] : result; 44590 }; 44591 44592 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 44593 // Avoid lazy use if the iteratee has a "length" value other than `1`. 44594 isLazy = useLazy = false;
vendor: 4,130 bytes, lines 44595-44707
44595 } 44596 var chainAll = this.__chain__, 44597 isHybrid = !!this.__actions__.length, 44598 isUnwrapped = retUnwrapped && !chainAll, 44599 onlyLazy = isLazy && !isHybrid; 44600 44601 if (!retUnwrapped && useLazy) { 44602 value = onlyLazy ? value : new LazyWrapper(this); 44603 var result = func.apply(value, args); 44604 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 44605 return new LodashWrapper(result, chainAll); 44606 } 44607 if (isUnwrapped && onlyLazy) { 44608 return func.apply(this, args); 44609 } 44610 result = this.thru(interceptor); 44611 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 44612 }; 44613 }); 44614 44615 // Add `Array` methods to `lodash.prototype`. 44616 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 44617 var func = arrayProto[methodName], 44618 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 44619 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 44620 44621 lodash.prototype[methodName] = function() { 44622 var args = arguments; 44623 if (retUnwrapped && !this.__chain__) { 44624 var value = this.value(); 44625 return func.apply(isArray(value) ? value : [], args); 44626 } 44627 return this[chainName](function(value) { 44628 return func.apply(isArray(value) ? value : [], args); 44629 }); 44630 }; 44631 }); 44632 44633 // Map minified method names to their real names. 44634 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 44635 var lodashFunc = lodash[methodName]; 44636 if (lodashFunc) { 44637 var key = (lodashFunc.name + ''), 44638 names = realNames[key] || (realNames[key] = []); 44639 44640 names.push({ 'name': methodName, 'func': lodashFunc }); 44641 } 44642 }); 44643 44644 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 44645 'name': 'wrapper', 44646 'func': undefined 44647 }]; 44648 44649 // Add methods to `LazyWrapper`. 44650 LazyWrapper.prototype.clone = lazyClone; 44651 LazyWrapper.prototype.reverse = lazyReverse; 44652 LazyWrapper.prototype.value = lazyValue; 44653 44654 // Add chain sequence methods to the `lodash` wrapper. 44655 lodash.prototype.at = wrapperAt; 44656 lodash.prototype.chain = wrapperChain; 44657 lodash.prototype.commit = wrapperCommit; 44658 lodash.prototype.next = wrapperNext; 44659 lodash.prototype.plant = wrapperPlant; 44660 lodash.prototype.reverse = wrapperReverse; 44661 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 44662 44663 // Add lazy aliases. 44664 lodash.prototype.first = lodash.prototype.head; 44665 44666 if (symIterator) { 44667 lodash.prototype[symIterator] = wrapperToIterator; 44668 } 44669 return lodash; 44670 }); 44671 44672 /*--------------------------------------------------------------------------*/ 44673 44674 // Export lodash. 44675 var _ = runInContext(); 44676 44677 // Some AMD build optimizers, like r.js, check for condition patterns like: 44678 if (true) { 44679 // Expose Lodash on the global object to prevent errors when Lodash is 44680 // loaded by a script tag in the presence of an AMD loader. 44681 // See http://requirejs.org/docs/errors.html#mismatch for more details. 44682 // Use `_.noConflict` to remove Lodash from the global object. 44683 root._ = _; 44684 44685 // Define as an anonymous module so, through path mapping, it can be 44686 // referenced as the "underscore" module. 44687 !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { 44688 return _; 44689 }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 44690 } 44691 // Check for `exports` after `define` in case a build optimizer adds it. 44692 else if (freeModule) { 44693 // Export for Node.js. 44694 (freeModule.exports = _)._ = _; 44695 // Export for CommonJS support. 44696 freeExports._ = _; 44697 } 44698 else { 44699 // Export to the global object. 44700 root._ = _; 44701 } 44702 }.call(this)); 44703 44704 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(308)(module))) 44705 44706/***/ }), 44707/* 308 */
44708/***/ (function(module, exports) { 44709 44710 module.exports = function(module) { 44711 if(!module.webpackPolyfill) { 44712 module.deprecate = function() {}; 44713 module.paths = []; 44714 // module.parent = undefined by default 44715 module.children = []; 44716 module.webpackPolyfill = 1; 44717 } 44718 return module; 44719 } 44720 44721 44722/***/ }), 44723/* 309 */ 44724/***/ (function(module, exports, __webpack_require__) { 44725 44726 "use strict"; 44727 44728 Object.defineProperty(exports, "__esModule", { 44729 value: true 44730 }); 44731 exports.TopVisual = undefined; 44732 44733 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); 44734 44735 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 44736 44737 var _gsap = __webpack_require__(310); 44738 44739 var _jquery = __webpack_require__(303); 44740 44741 var _jquery2 = _interopRequireDefault(_jquery); 44742 44743 var _lodash = __webpack_require__(307); 44744 44745 var _lodash2 = _interopRequireDefault(_lodash); 44746 44747 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 44748 44749 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 44750 44751 var _minWidth = 1200; 44752 var resources = { 44753 1: { 44754 bgColor: 0x57d2ff, 44755 line1Color: 0xfdce02, 44756 line2Color: 0x187fc4, 44757 line3Color: 0xe6002e, 44758 charaSizePc: 57, 44759 charaSizeSp: 82, 44760 charaPosSp: { x: -5, y: -17 }, 44761 charaPosPc: { x: -5, y: -10 }, 44762 circle: "./images/top/1-circle.png", 44763 chara: "./images/top/chara-1.png", 44764 bg: "./images/top/1-bg.png", 44765 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 113), function (i) { 44766 return "./images/top/movie1/" + i + ".jpg"; 44767 }) 44768 }, 44769 2: { 44770 line1Color: 0x000000, 44771 line2Color: 0x94d60a, 44772 line3Color: 0x5b5d62, 44773 bgColor: 0xeb5dbe, 44774 charaSizePc: 58, 44775 charaSizeSp: 70, 44776 charaPosSp: { x: -5, y: -8 }, 44777 charaPosPc: { x: -5, y: -8 }, 44778 circle: "./images/top/2-circle.png", 44779 chara: "./images/top/chara-2.png", 44780 bg: "./images/top/2-bg.png", 44781 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 117), function (i) { 44782 return "./images/top/movie2/" + i + ".jpg"; 44783 }) 44784 }, 44785 3: { 44786 line1Color: 0xdb3133, 44787 line2Color: 0x4d97a0, 44788 line3Color: 0x796baf, 44789 bgColor: 0x318dde, 44790 charaSizePc: 58, 44791 charaSizeSp: 70, 44792 charaPosSp: { x: 0, y: -10 }, 44793 charaPosPc: { x: -2.5, y: -11 }, 44794 circle: "./images/top/3-circle.png", 44795 chara: "./images/top/chara-3.png", 44796 bg: "./images/top/3-bg.png", 44797 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 115), function (i) { 44798 return "./images/top/movie3/" + i + ".jpg"; 44799 }) 44800 }, 44801 4: { 44802 line1Color: 0x0082cd, 44803 line2Color: 0xfff33f, 44804 line3Color: 0xa72037, 44805 bgColor: 0xeed28c, 44806 charaSizePc: 75, 44807 charaSizeSp: 85, 44808 charaPosSp: { x: -4, y: -17 }, 44809 charaPosPc: { x: -2, y: -20 }, 44810 circle: "./images/top/4-circle.png", 44811 chara: "./images/top/chara-4.png", 44812 bg: "./images/top/4-bg.png", 44813 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 92), function (i) { 44814 return "./images/top/movie4/" + i + ".jpg"; 44815 }) 44816 }, 44817 5: { 44818 line1Color: 0xfdce02, 44819 line2Color: 0x187fc4, 44820 line3Color: 0xe6002e, 44821 bgColor: 0x799c48, 44822 charaSizePc: 52, 44823 charaSizeSp: 68, 44824 charaPosSp: { x: 0, y: -12 }, 44825 charaPosPc: { x: 0, y: -7 }, 44826 circle: "./images/top/5-circle.png", 44827 chara: "./images/top/chara-5.png", 44828 bg: "./images/top/5-bg.png", 44829 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 100), function (i) { 44830 return "./images/top/movie5/" + i + ".jpg"; 44831 }) 44832 }, 44833 6: { 44834 line1Color: 15945624, 44835 line2Color: 14656320, 44836 line3Color: 16119032, 44837 bgColor: 15525910, 44838 charaSizePc: 52, 44839 charaSizeSp: 68, 44840 charaPosSp: { x: 0, y: -12 }, 44841 charaPosPc: { x: 0, y: -7 }, 44842 circle: "./images/top/6-circle.png", 44843 chara: "./images/top/chara-6.png", 44844 bg: "./images/top/6-bg.png", 44845 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 96), function (i) { 44846 return "./images/top/movie6/" + i + ".jpg"; 44847 }) 44848 }, 44849 7: { 44850 line1Color: 0x33a1db, 44851 line2Color: 0xe8343d, 44852 line3Color: 0xffffff, 44853 bgColor: 0x748693, 44854 charaSizePc: 52, 44855 charaSizeSp: 68, 44856 charaPosSp: { x: 0, y: -12 }, 44857 charaPosPc: { x: 0, y: -7 }, 44858 circle: "./images/top/7-circle.png", 44859 chara: "./images/top/chara-7.png", 44860 bg: "./images/top/7-bg.png", 44861 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 99), function (i) { 44862 return "./images/top/movie7/" + i + ".jpg"; 44863 }) 44864 }, 44865 8: { 44866 line1Color: 0x231815, 44867 line2Color: 0x00ad68, 44868 line3Color: 0xf9f5c4, 44869 bgColor: 0xfd6b0d, 44870 charaSizePc: 50, 44871 charaSizeSp: 70, 44872 charaPosSp: { x: 10, y: 10 }, 44873 charaPosPc: { x: 8, y: -9 }, 44874 circle: "./images/top/8-circle.png", 44875 chara: "./images/top/chara-8.png", 44876 bg: "./images/top/8-bg.png", 44877 movieFrames: _lodash2.default.map(_lodash2.default.range(1, 84), function (i) { 44878 return "./images/top/movie8/" + i + ".jpg"; 44879 }) 44880 } 44881 }; 44882 44883 function radian(angle) { 44884 return angle / 180 * Math.PI; 44885 } 44886 44887 var params = { 44888 sp: {
44889 cameraZ: 47, 44890 circleY: -1 44891 }, 44892 pc: { 44893 cameraZ: 36, 44894 circleY: -8 44895 } 44896 }; 44897 44898 var TopVisual = exports.TopVisual = function () { 44899 function TopVisual(_ref) { 44900 var _ref$isSp = _ref.isSp, 44901 isSp = _ref$isSp === undefined ? false : _ref$isSp, 44902 _ref$query = _ref.query, 44903 query = _ref$query === undefined ? ".top-visual-three" : _ref$query, 44904 _ref$charaNo = _ref.charaNo, 44905 charaNo = _ref$charaNo === undefined ? 1 : _ref$charaNo, 44906 _ref$height = _ref.height, 44907 height = _ref$height === undefined ? window.innerHeight : _ref$height, 44908 _ref$width = _ref.width, 44909 width = _ref$width === undefined ? window.innerWidth : _ref$width; 44910 44911 _classCallCheck(this, TopVisual); 44912 44913 this.isSp = isSp; 44914 width = this.minWidth(); 44915 this._inactive = true; 44916 this.$loading = (0, _jquery2.default)(".loading"); 44917 this.$root = (0, _jquery2.default)("html"); 44918 this.charaNo = charaNo; 44919 this.render = this.render.bind(this); 44920 this.params = isSp ? params.sp : params.pc; 44921 this.$el = (0, _jquery2.default)(query); 44922 this.started = false; 44923 this.startAnimate = false; 44924 this.scene = new THREE.Scene(); 44925 this.group = new THREE.Group(); 44926 this.scene.add(this.group); 44927 this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000); 44928 this.camera.position.z = this.params.cameraZ; 44929 44930 // dom (sp) 44931 this.$chara = (0, _jquery2.default)(".top-visual_chara"); 44932 this.$line1 = (0, _jquery2.default)(".top-visual_line1"); 44933 this.$line2 = (0, _jquery2.default)(".top-visual_line2"); 44934 this.$line3 = (0, _jquery2.default)(".top-visual_line3"); 44935 44936 if (this.isSp) { 44937 this.renderer = new THREE.CanvasRenderer({ canvas: this.$el[0], alpha: true }); 44938 } else { 44939 this.renderer = new THREE.WebGLRenderer({ canvas: this.$el[0], alpha: true }); 44940 } 44941 this.renderer.setPixelRatio(this.isSp ? 1 : window.devicePixelRatio); 44942 this.renderer.setSize(width, height); 44943 44944 if (!isSp) { 44945 (0, _jquery2.default)(window).on("mousemove", this.onMousemove.bind(this)); 44946 (0, _jquery2.default)(window).on("resize", this.onResize.bind(this)); 44947 } 44948 this.initialized = false; 44949 requestAnimationFrame(this.render); 44950 } 44951 44952 _createClass(TopVisual, [{ 44953 key: "loadResouce", 44954 value: function loadResouce() { 44955 var _this = this; 44956 44957 return new Promise(function (resolve, reject) { 44958 if (_this.initialized) { 44959 resolve(_this.charaTextures); 44960 return; 44961 } 44962 44963 _this.showLoading(); 44964 44965 // inital load resources 44966 _this.initialized = true; 44967 var promises = _lodash2.default.map(resources, function (resource, num) { 44968 var res = resources[num]; 44969 return _this.loadCharaResource(res); 44970 }); 44971 44972 // waiting.. 44973 promises.push(new Promise(function (resolve) { 44974 _lodash2.default.delay(resolve, 3000); 44975 })); 44976 44977 Promise.all(promises).then(function (charaTextures) { 44978 _this.hideLoading(); 44979 _this.charaTextures = charaTextures; 44980 resolve(charaTextures); 44981 }); 44982 }); 44983 } 44984 }, { 44985 key: "inactive", 44986 value: function inactive() { 44987 this._inactive = false; 44988 } 44989 }, { 44990 key: "showLoading", 44991 value: function showLoading() { 44992 this.$loading.addClass("showed"); 44993 } 44994 }, { 44995 key: "hideLoading", 44996 value: function hideLoading() { 44997 this.$loading.removeClass("showed"); 44998 } 44999 }, { 45000 key: "loadCharaResource", 45001 value: function loadCharaResource(res) { 45002 var _this2 = this; 45003 45004 var loader = new THREE.TextureLoader(); 45005 return new Promise(function (resolve, reject) { 45006 var promises = []; 45007 if (!_this2.isSp) { 45008 // chara 45009 promises.push(new Promise(function (resolve, reject) { 45010 loader.load(res.chara, function (texture) { 45011 resolve(["chara", texture]); 45012 }); 45013 })); 45014 45015 // bg texture 45016 promises.push(new Promise(function (resolve, reject) { 45017 loader.load(res.bg, function (texture) { 45018 return resolve(["bg", texture]); 45019 }); 45020 })); 45021 } 45022 45023 // circle texture 45024 promises.push(new Promise(function (resolve, reject) { 45025 loader.load(res.circle, function (texture) { 45026 resolve(["circle", texture]); 45027 }); 45028 })); 45029 45030 // movie frames 45031 _lodash2.default.map(res.movieFrames, function (url, i) { 45032 promises.push(new Promise(function (resolve, reject) { 45033 loader.load(url, function (texture) { 45034 resolve(["f" + i, texture]); 45035 }); 45036 })); 45037 }); 45038 45039 Promise.all(promises).then(function (results) { 45040 var textures = {}; 45041 _lodash2.default.map(results, function (_ref2) { 45042 var _ref3 = _slicedToArray(_ref2, 2), 45043 key = _ref3[0], 45044 texture = _ref3[1]; 45045 45046 textures[key] = texture; 45047 }); 45048 resolve(textures); 45049 }); 45050 }); 45051 } 45052 }, { 45053 key: "setup", 45054 value: function setup() { 45055 var _this3 = this; 45056 45057 if (this.setuped) { 45058 return; 45059 } 45060 this.setuped = true; 45061 this.loadResouce().then(function (charaTextures) { 45062 var charaNo = _this3.charaNo; 45063 var textures = charaTextures[charaNo - 1]; 45064 var r = resources[charaNo]; 45065 45066 if (!_this3.isSp) { 45067 // chara -------------------------------------------- 45068 var charaTexture = textures["chara"]; 45069 var size = _this3.isSp ? r.charaSizeSp : r.charaSizePc; 45070 var ow = charaTexture.image.width; 45071 var oh = charaTexture.image.height; 45072 var s = ow / oh; 45073 var sizeH = size; 45074 var sizeW = size * s; 45075 if (sizeW > size) { 45076 sizeW = size; 45077 sizeH = size / s; 45078 } 45079 var g = new THREE.PlaneGeometry(sizeW, sizeH); 45080 var m = new THREE.MeshBasicMaterial({ map: charaTexture, overdraw: 0.5, transparent: true }); 45081 _this3.chara = new THREE.Mesh(g, m); 45082 var pos = _this3.isSp ? r.charaPosSp : r.charaPosPc; 45083 _this3.chara.position.set(pos.x, pos.y - 10, 10); 45084 _this3.charaPos = { x: pos.x, y: pos.y, z: 10 }; 45085 45086 _this3.chara.material.opacity = 0; 45087 _this3.scene.add(_this3.chara); 45088 45089 var line1 = _this3.createLine(50, 4, r.line1Color, 120, -20); 45090 line1.position.set(10, 3, 0); 45091 var line2 = _this3.createLine(43, 2, r.line2Color, 130, 0); 45092 line2.position.set(0, 3, 0); 45093 var line3 = _this3.createLine(53, 1, r.line3Color, 140, 20); 45094 line3.position.set(-12, 3, 0); 45095 _this3.group.add(line1); 45096 _this3.group.add(line2); 45097 _this3.group.add(line3); 45098 _this3.line1 = line1; 45099 _this3.line2 = line2; 45100 _this3.line3 = line3; 45101 45102 // bg ------------------------------- 45103 _this3.bg = _this3.createBg(textures); 45104 _this3.group.add(_this3.bg); 45105 } 45106 45107 // circle 45108 _this3.circle = _this3.createCircle(textures); 45109 _this3.circle.position.set(0, _this3.params.circleY, 0); 45110 _this3.group.add(_this3.circle); 45111 45112 // create circle 45113 _this3.updateTime = 0; 45114 _this3.frameIndex = 0; 45115 45116 _this3.start(); 45117 }); 45118 } 45119 }, { 45120 key: "start", 45121 value: function start() { 45122 var _this4 = this; 45123 45124 this._inactive = false;
45125 this.startAnimate = true; 45126 45127 if (!this.isSp) { 45128 _gsap.TweenLite.from(this.camera.position, 1.5, { z: "+=10", ease: _gsap.Cubic.easeInOut, delay: 2.5 }); 45129 _gsap.TweenLite.to(this.chara.position, 1.2, { y: "+=10", ease: _gsap.Cubic.easeOut, delay: 0.5 }); 45130 _gsap.TweenLite.to(this.chara.material, .5, { opacity: 1, delay: 0.5 }); 45131 _gsap.TweenLite.from(this.circle.scale, 2.5, { x: 0.0001, y: 0.0001, z: 0.0001, delay: 0.8 }); 45132 _gsap.TweenLite.to(this.circle.rotation, 3, { z: 3.5, delay: 1.2, ease: _gsap.Cubic.easeOut }); 45133 _gsap.TweenLite.to(this.bg1.material, 1.5, { opacity: 1, delay: 2.9 }); 45134 _gsap.TweenLite.to(this.bg2.material, 1.5, { opacity: 1, delay: 2.6 }); 45135 45136 var s = 20; 45137 _gsap.TweenLite.from(this.line1.scale, 2, { x: s, y: s, z: s, ease: _gsap.Cubic.easeOut, delay: 1.0 }); 45138 _gsap.TweenLite.from(this.line2.scale, 2, { x: s, y: s, z: s, ease: _gsap.Cubic.easeOut, delay: 1.25 }); 45139 _gsap.TweenLite.from(this.line3.scale, 2, { x: s, y: s, z: s, ease: _gsap.Cubic.easeOut, delay: 1.5 }); 45140 45141 _lodash2.default.delay(function () { 45142 requestAnimationFrame(function (time) { 45143 _this4.startTime = time; 45144 _this4.started = true; 45145 _this4.$root.addClass("page-front_started"); 45146 }); 45147 }, 3900); 45148 } else { 45149 this.$chara.addClass("showed"); 45150 this.$line1.addClass("showed"); 45151 this.$line2.addClass("showed"); 45152 this.$line3.addClass("showed"); 45153 45154 _gsap.TweenLite.from(this.circle.scale, 2.5, { delay: 1.0, x: 0.0001, y: 0.0001, z: 0.0001 }); 45155 _gsap.TweenLite.to(this.circle.rotation, 3, { delay: 1.0, z: 3.5, ease: _gsap.Cubic.easeOut }); 45156 45157 requestAnimationFrame(function (time) { 45158 _this4.startTime = time; 45159 _this4.started = true; 45160 _this4.$root.addClass("page-front_started"); 45161 }); 45162 } 45163 } 45164 }, { 45165 key: "changeChara", 45166 value: function changeChara(charaNo) { 45167 this.charaNo = charaNo; 45168 this.$root.removeClass("page-front_started"); 45169 45170 if (this.setuped) { 45171 45172 if (!this.isSp) { 45173 this.started = false; 45174 this.startAnimate = false; 45175 45176 this.group.remove(this.circle); 45177 this.group.remove(this.line1); 45178 this.group.remove(this.line2); 45179 this.group.remove(this.line3); 45180 this.group.remove(this.bg); 45181 this.scene.remove(this.chara); 45182 45183 this.line1.geometry.dispose(); 45184 this.line1.material.dispose(); 45185 this.line2.geometry.dispose(); 45186 this.line2.material.dispose(); 45187 this.line3.geometry.dispose(); 45188 this.line3.material.dispose(); 45189 45190 this.bg1.geometry.dispose(); 45191 this.bg1.material.dispose(); 45192 this.bg2.geometry.dispose(); 45193 this.bg2.material.dispose(); 45194 45195 this.chara.geometry.dispose(); 45196 this.chara.material.dispose(); 45197 this.cricleBg.geometry.dispose(); 45198 this.cricleBg.material.dispose(); 45199 this.frames.map(function (f) { 45200 f.geometry.dispose(); 45201 f.material.dispose(); 45202 }); 45203 } else { 45204 this.group.remove(this.circle); 45205 this.$chara.removeClass("showed"); 45206 this.$line1.removeClass("showed"); 45207 this.$line2.removeClass("showed"); 45208 this.$line3.removeClass("showed"); 45209 } 45210 } 45211 this.setuped = false; 45212 this.setup(); 45213 } 45214 }, { 45215 key: "render", 45216 value: function render(time) { 45217 var _this5 = this; 45218 45219 requestAnimationFrame(this.render); 45220 if (this._inactive) { 45221 return; 45222 } 45223 this.renderer.render(this.scene, this.camera); 45224 45225 if (this.started) { 45226 if (!this.isSp) { 45227 var t = this.startTime - time; 45228 this.line1.rotation.z = radian(Math.sin(t * 0.0006) * 5); 45229 this.line1.rotation.x = radian(Math.sin(t * 0.00008) * 5); 45230 this.line2.rotation.z = radian(Math.sin(t * 0.0005) * 5); 45231 this.line2.rotation.x = radian(Math.sin(t * 0.0003) * 5); 45232 this.line3.rotation.z = radian(Math.sin(t * 0.0002) * 5); 45233 this.line3.rotation.x = radian(Math.sin(t * 0.0003) * 5); 45234 } 45235 } 45236 if (this.startAnimate) { 45237 this.circle.rotation.z += this.isSp ? 0.003 : 0.002; 45238 if (time - this.updateTime > 120) { 45239 var textures = this.charaTextures[this.charaNo - 1]; 45240 var r = resources[this.charaNo]; 45241 this.frameIndex++; 45242 this.updateTime = time;
45243 this.frames.forEach(function (s, i) { 45244 var index = _this5.frameIndex % (r.movieFrames.length - 1); 45245 var angle = 30 * (_this5.frameIndex + i) % 360; 45246 var radius = radian(angle); 45247 var mx = 26.4 * Math.cos(radius); 45248 var my = 26.4 * Math.sin(radius); 45249 s.position.set(mx, my, 0.1); 45250 s.rotation.z = radius; 45251 if (angle === 0) { 45252 s.material.map = textures["f" + index]; 45253 s.material.map.needsUpdate = true; 45254 } 45255 }); 45256 } 45257 } 45258 } 45259 }, { 45260 key: "createBg", 45261 value: function createBg(textures) { 45262 var g = new THREE.PlaneGeometry(200, 200); 45263 var m = new THREE.MeshBasicMaterial({ 45264 map: textures.bg, 45265 transparent: true, 45266 overdraw: 0.5 45267 }); 45268 var bg = new THREE.Mesh(g, m); 45269 var bg2 = new THREE.Mesh(g, m); 45270 bg.position.set(-120, 0, -125); 45271 bg.material.opacity = 0; 45272 bg2.position.set(120, 0, -125); 45273 bg2.material.opacity = 0; 45274 var bgArea = new THREE.Group(); 45275 bgArea.add(bg); 45276 bgArea.add(bg2); 45277 this.bg1 = bg; 45278 this.bg2 = bg2; 45279 return bgArea; 45280 } 45281 }, { 45282 key: "createLine", 45283 value: function createLine(size, width, color, rx, ry) { 45284 var geometry = new THREE.RingGeometry(size, size + width, 128); 45285 var material = new THREE.MeshBasicMaterial({ color: color, side: THREE.DoubleSide, overdraw: 0.5 }); 45286 var line = new THREE.Mesh(geometry, material); 45287 line.scale.set(1, 0.5, 1); 45288 line.rotation.set(radian(rx), radian(ry), 0); 45289 line.updateMatrix(); 45290 line.geometry.applyMatrix(line.matrix); 45291 line.scale.set(1, 1, 1); 45292 line.rotation.set(0, 0, 0); 45293 return line; 45294 } 45295 }, { 45296 key: "createCircle", 45297 value: function createCircle(textures) { 45298 var group = new THREE.Group(); 45299 var g = new THREE.PlaneGeometry(70, 70); 45300 var m = new THREE.MeshBasicMaterial({ 45301 map: textures.circle, 45302 transparent: true, 45303 overdraw: 0.5 45304 }); 45305 var circle = new THREE.Mesh(g, m); 45306 circle.position.set(0, 0, 0.2); 45307 group.add(circle); 45308 this.cricleBg = circle; 45309 this.frames = _lodash2.default.range(12).map(function (i) { 45310 var tex = textures["f" + i]; 45311 var size = 16.2; 45312 var s = 2 / 3; 45313 var g = new THREE.PlaneGeometry(size, size * s); 45314 var m = new THREE.MeshBasicMaterial({ map: tex, overdraw: 0.5 }); 45315 var frame = new THREE.Mesh(g, m); 45316 var r = radian(30 * i); 45317 var mx = 26.3 * Math.cos(r); 45318 var my = 26.3 * Math.sin(r); 45319 frame.position.set(mx, my, 0.1); 45320 frame.rotation.z = r; 45321 group.add(frame); 45322 return frame; 45323 }); 45324 return group; 45325 } 45326 45327 // event handler /////////////////// 45328 45329 }, { 45330 key: "onResize", 45331 value: function onResize() { 45332 var w = this.minWidth(); 45333 var h = window.innerHeight; 45334 this.renderer.setSize(w, h); 45335 this.camera.aspect = w / h; 45336 this.camera.updateProjectionMatrix(); 45337 } 45338 }, { 45339 key: "onMousemove", 45340 value: function onMousemove(e) { 45341 if (this.started) { 45342 var offsetX = e.pageX; 45343 var offsetY = e.pageY; 45344 45345 var ox = offsetX / window.innerWidth; 45346 var oy = offsetY / window.innerHeight; 45347 var deg = 12; 45348 var ry1 = deg * 2 * ox - deg; 45349 var rx1 = deg * 2 * oy - deg; 45350 var deg2 = 5; 45351 var ry2 = deg2 * 2 * ox - deg2; 45352 var rx2 = deg2 * 2 * oy - deg2; 45353 45354 this.group.rotation.set(radian(-rx1), radian(-ry1), 0); 45355 this.chara.rotation.set(radian(-rx2), radian(-ry2), 0); 45356 45357 var pos = 5; 45358 var cp = this.charaPos; 45359 this.chara.position.set(cp.x - pos * 2 * ox + pos, cp.y + pos * 2 * oy - pos, cp.z); 45360 } 45361 } 45362 }, { 45363 key: "minWidth", 45364 value: function minWidth() { 45365 var width = window.innerWidth; 45366 if (this.isSp) { 45367 return width; 45368 } else { 45369 return width < _minWidth ? _minWidth : width; 45370 } 45371 } 45372 }]); 45373 45374 return TopVisual; 45375 }(); 45376 45377 exports.default = TopVisual; 45378 45379/***/ }), 45380/* 310 */ 45381/***/ (function(module, exports, __webpack_require__) { 45382 45383 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global) {/*! 45384 * VERSION: 1.19.1 45385 * DATE: 2017-01-17 45386 * UPDATES AND DOCS AT: http://greensock.com 45387 * 45388 * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin 45389 * 45390 * @license Copyright (c) 2008-2017, GreenSock. All rights reserved. 45391 * This work is subject to the terms at http://greensock.com/standard-license or for
45392 * Club GreenSock members, the software agreement that was issued with your membership. 45393 * 45394 * @author: Jack Doyle, [email protected] 45395 **/ 45396 var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node 45397 (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { 45398 45399 "use strict"; 45400 45401 _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) { 45402 45403 var _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 45404 var b = [], 45405 l = a.length, 45406 i; 45407 for (i = 0; i !== l; b.push(a[i++])); 45408 return b; 45409 }, 45410 _applyCycle = function(vars, targets, i) { 45411 var alt = vars.cycle, 45412 p, val; 45413 for (p in alt) { 45414 val = alt[p]; 45415 vars[p] = (typeof(val) === "function") ? val(i, targets[i]) : val[i % val.length]; 45416 } 45417 delete vars.cycle; 45418 }, 45419 TweenMax = function(target, duration, vars) { 45420 TweenLite.call(this, target, duration, vars); 45421 this._cycle = 0; 45422 this._yoyo = (this.vars.yoyo === true); 45423 this._repeat = this.vars.repeat || 0; 45424 this._repeatDelay = this.vars.repeatDelay || 0; 45425 this._dirty = true; //ensures that if there is any repeat, the totalDuration will get recalculated to accurately report it. 45426 this.render = TweenMax.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method) 45427 }, 45428 _tinyNum = 0.0000000001, 45429 TweenLiteInternals = TweenLite._internals, 45430 _isSelector = TweenLiteInternals.isSelector, 45431 _isArray = TweenLiteInternals.isArray, 45432 p = TweenMax.prototype = TweenLite.to({}, 0.1, {}), 45433 _blankArray = []; 45434 45435 TweenMax.version = "1.19.1"; 45436 p.constructor = TweenMax; 45437 p.kill()._gc = false; 45438 TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf; 45439 TweenMax.getTweensOf = TweenLite.getTweensOf; 45440 TweenMax.lagSmoothing = TweenLite.lagSmoothing; 45441 TweenMax.ticker = TweenLite.ticker; 45442 TweenMax.render = TweenLite.render; 45443 45444 p.invalidate = function() { 45445 this._yoyo = (this.vars.yoyo === true); 45446 this._repeat = this.vars.repeat || 0; 45447 this._repeatDelay = this.vars.repeatDelay || 0; 45448 this._uncache(true); 45449 return TweenLite.prototype.invalidate.call(this); 45450 }; 45451 45452 p.updateTo = function(vars, resetDuration) { 45453 var curRatio = this.ratio, 45454 immediate = this.vars.immediateRender || vars.immediateRender, 45455 p; 45456 if (resetDuration && this._startTime < this._timeline._time) { 45457 this._startTime = this._timeline._time; 45458 this._uncache(false); 45459 if (this._gc) { 45460 this._enabled(true, false); 45461 } else { 45462 this._timeline.insert(this, this._startTime - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. 45463 } 45464 } 45465 for (p in vars) { 45466 this.vars[p] = vars[p]; 45467 } 45468 if (this._initted || immediate) { 45469 if (resetDuration) { 45470 this._initted = false; 45471 if (immediate) { 45472 this.render(0, true, true); 45473 } 45474 } else { 45475 if (this._gc) { 45476 this._enabled(true, false); 45477 } 45478 if (this._notifyPluginsOfEnabled && this._firstPT) { 45479 TweenLite._onPluginEvent("_onDisable", this); //in case a plugin like MotionBlur must perform some cleanup tasks 45480 } 45481 if (this._time / this._duration > 0.998) { //if the tween has finished (or come extremely close to finishing), we just need to rewind it to 0 and then render it again at the end which forces it to re-initialize (parsing the new vars). We allow tweens that are close to finishing (but haven't quite finished) to work this way too because otherwise, the values are so small when determining where to project the starting values that binary math issues creep in and can make the tween appear to render incorrectly when run backwards. 45482 var prevTime = this._totalTime; 45483 this.render(0, true, false); 45484 this._initted = false;
45485 this.render(prevTime, true, false); 45486 } else { 45487 this._initted = false; 45488 this._init(); 45489 if (this._time > 0 || immediate) { 45490 var inv = 1 / (1 - curRatio), 45491 pt = this._firstPT, endValue; 45492 while (pt) { 45493 endValue = pt.s + pt.c; 45494 pt.c *= inv; 45495 pt.s = endValue - pt.c; 45496 pt = pt._next; 45497 } 45498 } 45499 } 45500 } 45501 } 45502 return this; 45503 }; 45504 45505 p.render = function(time, suppressEvents, force) { 45506 if (!this._initted) if (this._duration === 0 && this.vars.repeat) { //zero duration tweens that render immediately have render() called from TweenLite's constructor, before TweenMax's constructor has finished setting _repeat, _repeatDelay, and _yoyo which are critical in determining totalDuration() so we need to call invalidate() which is a low-kb way to get those set properly. 45507 this.invalidate(); 45508 } 45509 var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(), 45510 prevTime = this._time, 45511 prevTotalTime = this._totalTime, 45512 prevCycle = this._cycle, 45513 duration = this._duration, 45514 prevRawPrevTime = this._rawPrevTime, 45515 isComplete, callback, pt, cycleDuration, r, type, pow, rawPrevTime; 45516 if (time >= totalDur - 0.0000001 && time >= 0) { //to work around occasional floating point math artifacts. 45517 this._totalTime = totalDur; 45518 this._cycle = this._repeat; 45519 if (this._yoyo && (this._cycle & 1) !== 0) { 45520 this._time = 0; 45521 this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0; 45522 } else { 45523 this._time = duration; 45524 this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1; 45525 } 45526 if (!this._reversed) { 45527 isComplete = true; 45528 callback = "onComplete"; 45529 force = (force || this._timeline.autoRemoveChildren); //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. 45530 } 45531 if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. 45532 if (this._startTime === this._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate. 45533 time = 0; 45534 } 45535 if (prevRawPrevTime < 0 || (time <= 0 && time >= -0.0000001) || (prevRawPrevTime === _tinyNum && this.data !== "isPause")) if (prevRawPrevTime !== time) { //note: when this.data is "isPause", it's a callback added by addPause() on a timeline that we should not be triggered when LEAVING its exact start time. In other words, tl.addPause(1).play(1) shouldn't pause. 45536 force = true; 45537 if (prevRawPrevTime > _tinyNum) { 45538 callback = "onReverseComplete"; 45539 } 45540 } 45541 this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 45542 } 45543 45544 } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0. 45545 this._totalTime = this._time = this._cycle = 0; 45546 this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0; 45547 if (prevTotalTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) { 45548 callback = "onReverseComplete"; 45549 isComplete = this._reversed; 45550 } 45551 if (time < 0) { 45552 this._active = false;
45553 if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. 45554 if (prevRawPrevTime >= 0) { 45555 force = true; 45556 } 45557 this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 45558 } 45559 } 45560 if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. 45561 force = true; 45562 } 45563 } else { 45564 this._totalTime = this._time = time; 45565 if (this._repeat !== 0) { 45566 cycleDuration = duration + this._repeatDelay; 45567 this._cycle = (this._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 45568 if (this._cycle !== 0) if (this._cycle === this._totalTime / cycleDuration && prevTotalTime <= time) { 45569 this._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning) 45570 } 45571 this._time = this._totalTime - (this._cycle * cycleDuration); 45572 if (this._yoyo) if ((this._cycle & 1) !== 0) { 45573 this._time = duration - this._time; 45574 } 45575 if (this._time > duration) { 45576 this._time = duration; 45577 } else if (this._time < 0) { 45578 this._time = 0; 45579 } 45580 } 45581 45582 if (this._easeType) { 45583 r = this._time / duration; 45584 type = this._easeType; 45585 pow = this._easePower; 45586 if (type === 1 || (type === 3 && r >= 0.5)) { 45587 r = 1 - r; 45588 } 45589 if (type === 3) { 45590 r *= 2; 45591 } 45592 if (pow === 1) { 45593 r *= r; 45594 } else if (pow === 2) { 45595 r *= r * r; 45596 } else if (pow === 3) { 45597 r *= r * r * r; 45598 } else if (pow === 4) { 45599 r *= r * r * r * r; 45600 } 45601 45602 if (type === 1) { 45603 this.ratio = 1 - r; 45604 } else if (type === 2) { 45605 this.ratio = r; 45606 } else if (this._time / duration < 0.5) { 45607 this.ratio = r / 2; 45608 } else { 45609 this.ratio = 1 - (r / 2); 45610 } 45611 45612 } else { 45613 this.ratio = this._ease.getRatio(this._time / duration); 45614 } 45615 45616 } 45617 45618 if (prevTime === this._time && !force && prevCycle === this._cycle) { 45619 if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate. 45620 this._callback("onUpdate"); 45621 } 45622 return; 45623 } else if (!this._initted) { 45624 this._init(); 45625 if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that over
45625writing occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example. 45626 return; 45627 } else if (!force && this._firstPT && ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration))) { //we stick it in the queue for rendering at the very end of the tick - this is a performance optimization because browsers invalidate styles and force a recalculation if you read, write, and then read style data (so it's better to read/read/read/write/write/write than read/write/read/write/read/write). The down side, of course, is that usually you WANT things to render immediately because you may have code running right after that which depends on the change. Like imagine running TweenLite.set(...) and then immediately after that, creating a nother tween that animates the same property to another value; the starting values of that 2nd tween wouldn't be accurate if lazy is true. 45628 this._time = prevTime; 45629 this._totalTime = prevTotalTime; 45630 this._rawPrevTime = prevRawPrevTime; 45631 this._cycle = prevCycle; 45632 TweenLiteInternals.lazyTweens.push(this); 45633 this._lazy = [time, suppressEvents]; 45634 return; 45635 } 45636 //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently. 45637 if (this._time && !isComplete) { 45638 this.ratio = this._ease.getRatio(this._time / duration); 45639 } else if (isComplete && this._ease._calcEnd) { 45640 this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1); 45641 } 45642 } 45643 if (this._lazy !== false) { 45644 this._lazy = false; 45645 } 45646 45647 if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) { 45648 this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done. 45649 } 45650 if (prevTotalTime === 0) { 45651 if (this._initted === 2 && time > 0) { 45652 //this.invalidate(); 45653 this._init(); //will just apply overwriting since _initted of (2) means it was a from() tween that had immediateRender:true 45654 } 45655 if (this._startAt) { 45656 if (time >= 0) { 45657 this._startAt.render(time, suppressEvents, force); 45658 } else if (!callback) { 45659 callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area. 45660 } 45661 } 45662 if (this.vars.onStart) if (this._totalTime !== 0 || duration === 0) if (!suppressEvents) { 45663 this._callback("onStart"); 45664 } 45665 } 45666 45667 pt = this._firstPT; 45668 while (pt) { 45669 if (pt.f) { 45670 pt.t[pt.p](pt.c * this.ratio + pt.s); 45671 } else { 45672 pt.t[pt.p] = pt.c * this.ratio + pt.s; 45673 } 45674 pt = pt._next; 45675 } 45676 45677 if (this._onUpdate) { 45678 if (time < 0) if (this._startAt && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values. 45679 this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. 45680 } 45681 if (!suppressEvents) if (this._totalTime !== prevTotalTime || callback) {
45682 this._callback("onUpdate"); 45683 } 45684 } 45685 if (this._cycle !== prevCycle) if (!suppressEvents) if (!this._gc) if (this.vars.onRepeat) { 45686 this._callback("onRepeat"); 45687 } 45688 if (callback) if (!this._gc || force) { //check gc because there's a chance that kill() could be called in an onUpdate 45689 if (time < 0 && this._startAt && !this._onUpdate && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values. 45690 this._startAt.render(time, suppressEvents, force); 45691 } 45692 if (isComplete) { 45693 if (this._timeline.autoRemoveChildren) { 45694 this._enabled(false, false); 45695 } 45696 this._active = false; 45697 } 45698 if (!suppressEvents && this.vars[callback]) { 45699 this._callback(callback); 45700 } 45701 if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon sce
45701nario, but possible nonetheless. 45702 this._rawPrevTime = 0; 45703 } 45704 } 45705 }; 45706 45707 //---- STATIC FUNCTIONS ----------------------------------------------------------------------------------------------------------- 45708 45709 TweenMax.to = function(target, duration, vars) { 45710 return new TweenMax(target, duration, vars); 45711 }; 45712 45713 TweenMax.from = function(target, duration, vars) { 45714 vars.runBackwards = true; 45715 vars.immediateRender = (vars.immediateRender != false); 45716 return new TweenMax(target, duration, vars); 45717 }; 45718 45719 TweenMax.fromTo = function(target, duration, fromVars, toVars) { 45720 toVars.startAt = fromVars; 45721 toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); 45722 return new TweenMax(target, duration, toVars); 45723 }; 45724 45725 TweenMax.staggerTo = TweenMax.allTo = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 45726 stagger = stagger || 0; 45727 var delay = 0, 45728 a = [], 45729 finalComplete = function() { 45730 if (vars.onComplete) { 45731 vars.onComplete.apply(vars.onCompleteScope || this, arguments); 45732 } 45733 onCompleteAll.apply(onCompleteAllScope || vars.callbackScope || this, onCompleteAllParams || _blankArray); 45734 }, 45735 cycle = vars.cycle, 45736 fromCycle = (vars.startAt && vars.startAt.cycle), 45737 l, copy, i, p; 45738 if (!_isArray(targets)) { 45739 if (typeof(targets) === "string") { 45740 targets = TweenLite.selector(targets) || targets; 45741 } 45742 if (_isSelector(targets)) { 45743 targets = _slice(targets); 45744 } 45745 } 45746 targets = targets || []; 45747 if (stagger < 0) { 45748 targets = _slice(targets); 45749 targets.reverse(); 45750 stagger *= -1; 45751 } 45752 l = targets.length - 1; 45753 for (i = 0; i <= l; i++) { 45754 copy = {}; 45755 for (p in vars) { 45756 copy[p] = vars[p]; 45757 } 45758 if (cycle) { 45759 _applyCycle(copy, targets, i); 45760 if (copy.duration != null) { 45761 duration = copy.duration; 45762 delete copy.duration; 45763 } 45764 } 45765 if (fromCycle) { 45766 fromCycle = copy.startAt = {}; 45767 for (p in vars.startAt) { 45768 fromCycle[p] = vars.startAt[p]; 45769 } 45770 _applyCycle(copy.startAt, targets, i); 45771 } 45772 copy.delay = delay + (copy.delay || 0); 45773 if (i === l && onCompleteAll) { 45774 copy.onComplete = finalComplete; 45775 } 45776 a[i] = new TweenMax(targets[i], duration, copy); 45777 delay += stagger; 45778 } 45779 return a; 45780 }; 45781 45782 TweenMax.staggerFrom = TweenMax.allFrom = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 45783 vars.runBackwards = true; 45784 vars.immediateRender = (vars.immediateRender != false); 45785 return TweenMax.staggerTo(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope); 45786 }; 45787 45788 TweenMax.staggerFromTo = TweenMax.allFromTo = function(targets, duration, fromVars, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 45789 toVars.startAt = fromVars; 45790 toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); 45791 return TweenMax.staggerTo(targets, duration, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope); 45792 }; 45793 45794 TweenMax.delayedCall = function(delay, callback, params, scope, useFrames) { 45795 return new TweenMax(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, useFrames:useFrames, overwrite:0}); 45796 }; 45797 45798 TweenMax.set = function(target, vars) { 45799 return new TweenMax(target, 0, vars); 45800 }; 45801 45802 TweenMax.isTweening = function(target) { 45803 return (TweenLite.getTweensOf(target, true).length > 0); 45804 }; 45805 45806 var _getChildrenOf = function(timeline, includeTimelines) { 45807 var a = [], 45808 cnt = 0, 45809 tween = timeline._first; 45810 while (tween) { 45811 if (tween instanceof TweenLite) { 45812 a[cnt++] = tween; 45813 } else { 45814 if (includeTimelines) { 45815 a[cnt++] = tween; 45816 } 45817 a = a.concat(_getChildrenOf(tween, includeTimelines)); 45818 cnt = a.length; 45819 } 45820 tween = tween._next; 45821 } 45822 return a; 45823 }, 45824 getAllTweens = TweenMax.getAllTweens = function(includeTimelines) { 45825 return _getChildrenOf(Animation._rootTimeline, includeTimelines).concat( _getChildrenOf(Animation._rootFramesTimeline, includeTimelines) ); 45826 }; 45827 45828 TweenMax.killAll = function(complete, tweens, delayedCalls, timelines) { 45829 if (tweens == null) { 45830 tweens = true; 45831 } 45832 if (delayedCalls == null) { 45833 delayedCalls = true; 45834 } 45835 var a = getAllTweens((timelines != false)), 45836 l = a.length, 45837 allTrue = (tweens && delayedCalls && timelines), 45838 isDC, tween, i; 45839 for (i = 0; i < l; i++) { 45840 tween = a[i]; 45841 if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) { 45842 if (complete) { 45843 tween.totalTime(tween._reversed ? 0 : tween.totalDuration()); 45844 } else { 45845 tween._enabled(false, false); 45846 } 45847 } 45848 } 45849 }; 45850 45851 TweenMax.killChildTweensOf = function(parent, complete) { 45852 if (parent == null) { 45853 return; 45854 } 45855 var tl = TweenLiteInternals.tweenLookup, 45856 a, curParent, p, i, l; 45857 if (typeof(parent) === "string") { 45858 parent = TweenLite.selector(parent) || parent; 45859 } 45860 if (_isSelector(parent)) { 45861 parent = _slice(parent); 45862 } 45863 if (_isArray(parent)) { 45864 i = parent.length; 45865 while (--i > -1) { 45866 TweenMax.killChildTweensOf(parent[i], complete); 45867 } 45868 return; 45869 } 45870 a = []; 45871 for (p in tl) { 45872 curParent = tl[p].target.parentNode; 45873 while (curParent) { 45874 if (curParent === parent) { 45875 a = a.concat(tl[p].tweens); 45876 } 45877 curParent = curParent.parentNode; 45878 } 45879 } 45880 l = a.length; 45881 for (i = 0; i < l; i++) { 45882 if (complete) { 45883 a[i].totalTime(a[i].totalDuration()); 45884 } 45885 a[i]._enabled(false, false); 45886 } 45887 }; 45888 45889 var _changePause = function(pause, tweens, delayedCalls, timelines) { 45890 tweens = (tweens !== false); 45891 delayedCalls = (delayedCalls !== false); 45892 timelines = (timelines !== false); 45893 var a = getAllTweens(timelines), 45894 allTrue = (tweens && delayedCalls && timelines), 45895 i = a.length, 45896 isDC, tween; 45897 while (--i > -1) { 45898 tween = a[i]; 45899 if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) { 45900 tween.paused(pause); 45901 } 45902 } 45903 }; 45904 45905 TweenMax.pauseAll = function(tweens, delayedCalls, timelines) { 45906 _changePause(true, tweens, delayedCalls, timelines); 45907 }; 45908 45909 TweenMax.resumeAll = function(tweens, delayedCalls, timelines) { 45910 _changePause(false, tweens, delayedCalls, timelines); 45911 }; 45912 45913 TweenMax.globalTimeScale = function(value) { 45914 var tl = Animation._rootTimeline, 45915 t = TweenLite.ticker.time; 45916 if (!arguments.length) { 45917 return tl._timeScale; 45918 } 45919 value = value || _tinyNum; //can't allow zero because it'll throw the math off 45920 tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value); 45921 tl = Animation._rootFramesTimeline; 45922 t = TweenLite.ticker.frame; 45923 tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value); 45924 tl._timeScale = Animation._rootTimeline._timeScale = value; 45925 return value; 45926 }; 45927 45928 45929 //---- GETTERS / SETTERS ---------------------------------------------------------------------------------------------------------- 45930 45931 p.progress = function(value, suppressEvents) { 45932 return (!arguments.length) ? this._time / this.duration() : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents); 45933 }; 45934 45935 p.totalProgress = function(value, suppressEvents) { 45936 return (!arguments.length) ? this._totalTime / this.totalDuration() : this.totalTime( this.totalDuration() * value, suppressEvents); 45937 }; 45938 45939 p.time = function(value, suppressEvents) { 45940 if (!arguments.length) { 45941 return this._time; 45942 } 45943 if (this._dirty) { 45944 this.totalDuration(); 45945 } 45946 if (value > this._duration) { 45947 value = this._duration; 45948 } 45949 if (this._yoyo && (this._cycle & 1) !== 0) { 45950 value = (this._duration - value) + (this._cycle * (this._duration + this._repeatDelay)); 45951 } else if (this._repeat !== 0) { 45952 value += this._cycle * (this._duration + this._repeatDelay); 45953 } 45954 return this.totalTime(value, suppressEvents); 45955 }; 45956 45957 p.duration = function(value) { 45958 if (!arguments.length) { 45959 return this._duration; //don't set _dirty = false because there could be repeats that haven't been factored
45959into the _totalDuration yet. Otherwise, if you create a repeated TweenMax and then immediately check its duration(), it would cache the value and the totalDuration would not be correct, thus repeats wouldn't take effect. 45960 } 45961 return Animation.prototype.duration.call(this, value); 45962 }; 45963 45964 p.totalDuration = function(value) { 45965 if (!arguments.length) { 45966 if (this._dirty) { 45967 //instead of Infinity, we use 999999999999 so that we can accommodate reverses 45968 this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat); 45969 this._dirty = false; 45970 } 45971 return this._totalDuration; 45972 } 45973 return (this._repeat === -1) ? this : this.duration( (value - (this._repeat * this._repeatDelay)) / (this._repeat + 1) ); 45974 }; 45975 45976 p.repeat = function(value) { 45977 if (!arguments.length) { 45978 return this._repeat; 45979 } 45980 this._repeat = value; 45981 return this._uncache(true); 45982 }; 45983 45984 p.repeatDelay = function(value) { 45985 if (!arguments.length) { 45986 return this._repeatDelay; 45987 } 45988 this._repeatDelay = value; 45989 return this._uncache(true); 45990 }; 45991 45992 p.yoyo = function(value) { 45993 if (!arguments.length) { 45994 return this._yoyo; 45995 } 45996 this._yoyo = value; 45997 return this; 45998 }; 45999 46000 46001 return TweenMax; 46002 46003 }, true); 46004 46005 46006 46007 46008 46009 46010 46011 46012 /* 46013 * ---------------------------------------------------------------- 46014 * TimelineLite 46015 * ---------------------------------------------------------------- 46016 */ 46017 _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) { 46018 46019 var TimelineLite = function(vars) { 46020 SimpleTimeline.call(this, vars); 46021 this._labels = {}; 46022 this.autoRemoveChildren = (this.vars.autoRemoveChildren === true); 46023 this.smoothChildTiming = (this.vars.smoothChildTiming === true); 46024 this._sortChildren = true; 46025 this._onUpdate = this.vars.onUpdate; 46026 var v = this.vars, 46027 val, p; 46028 for (p in v) { 46029 val = v[p]; 46030 if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) { 46031 v[p] = this._swapSelfInParams(val); 46032 } 46033 } 46034 if (_isArray(v.tweens)) { 46035 this.add(v.tweens, 0, v.align, v.stagger); 46036 } 46037 }, 46038 _tinyNum = 0.0000000001, 46039 TweenLiteInternals = TweenLite._internals, 46040 _internals = TimelineLite._internals = {}, 46041 _isSelector = TweenLiteInternals.isSelector, 46042 _isArray = TweenLiteInternals.isArray, 46043 _lazyTweens = TweenLiteInternals.lazyTweens, 46044 _lazyRender = TweenLiteInternals.lazyRender, 46045 _globals = _gsScope._gsDefine.globals, 46046 _copy = function(vars) { 46047 var copy = {}, p; 46048 for (p in vars) { 46049 copy[p] = vars[p]; 46050 } 46051 return copy; 46052 }, 46053 _applyCycle = function(vars, targets, i) { 46054 var alt = vars.cycle, 46055 p, val; 46056 for (p in alt) { 46057 val = alt[p]; 46058 vars[p] = (typeof(val) === "function") ? val(i, targets[i]) : val[i % val.length]; 46059 } 46060 delete vars.cycle; 46061 }, 46062 _pauseCallback = _internals.pauseCallback = function() {}, 46063 _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 46064 var b = [], 46065 l = a.length, 46066 i; 46067 for (i = 0; i !== l; b.push(a[i++])); 46068 return b; 46069 }, 46070 p = TimelineLite.prototype = new SimpleTimeline(); 46071 46072 TimelineLite.version = "1.19.1"; 46073 p.constructor = TimelineLite; 46074 p.kill()._gc = p._forcingPlayhead = p._hasPause = false; 46075 46076 /* might use later... 46077 //translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales. 46078 function localToGlobal(time, animation) { 46079 while (animation) { 46080 time = (time / animation._timeScale) + animation._startTime; 46081 animation = animation.timeline; 46082 } 46083 return time; 46084 } 46085 46086 //translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales 46087 function globalToLocal(time, animation) { 46088 var scale = 1; 46089 time -= localToGlobal(0, animation); 46090 while (animation) { 46091 scale *= animation._timeScale; 46092 animation = animation.timeline; 46093 } 46094 return time * scale; 46095 } 46096 */ 46097 46098 p.to = function(target, duration, vars, position) { 46099 var Engine = (vars.repeat && _globals.TweenMax) || TweenLite; 46100 return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position); 46101 }; 46102 46103 p.from = function(target, duration, vars, position) { 46104 return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, vars), position); 46105 }; 46106 46107 p.fromTo = function(target, duration, fromVars, toVars, position) { 46108 var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite; 46109 return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position); 46110 }; 46111 46112 p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 46113 var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}), 46114 cycle = vars.cycle, 46115 copy, i; 46116 if (typeof(targets) === "string") { 46117 targets = TweenLite.selector(targets) || targets; 46118 } 46119 targets = targets || []; 46120 if (_isSelector(targets)) { //senses if the targets object is a selector. If it is, we should translate it into an array.
46121 targets = _slice(targets); 46122 } 46123 stagger = stagger || 0; 46124 if (stagger < 0) { 46125 targets = _slice(targets); 46126 targets.reverse(); 46127 stagger *= -1; 46128 } 46129 for (i = 0; i < targets.length; i++) { 46130 copy = _copy(vars); 46131 if (copy.startAt) { 46132 copy.startAt = _copy(copy.startAt); 46133 if (copy.startAt.cycle) { 46134 _applyCycle(copy.startAt, targets, i); 46135 } 46136 } 46137 if (cycle) { 46138 _applyCycle(copy, targets, i); 46139 if (copy.duration != null) { 46140 duration = copy.duration; 46141 delete copy.duration; 46142 } 46143 } 46144 tl.to(targets[i], duration, copy, i * stagger); 46145 } 46146 return this.add(tl, position); 46147 }; 46148 46149 p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 46150 vars.immediateRender = (vars.immediateRender != false); 46151 vars.runBackwards = true; 46152 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); 46153 }; 46154 46155 p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { 46156 toVars.startAt = fromVars; 46157 toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); 46158 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); 46159 }; 46160 46161 p.call = function(callback, params, scope, position) { 46162 return this.add( TweenLite.delayedCall(0, callback, params, scope), position); 46163 }; 46164 46165 p.set = function(target, vars, position) { 46166 position = this._parseTimeOrLabel(position, 0, true); 46167 if (vars.immediateRender == null) { 46168 vars.immediateRender = (position === this._time && !this._paused); 46169 } 46170 return this.add( new TweenLite(target, 0, vars), position); 46171 }; 46172 46173 TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) { 46174 vars = vars || {}; 46175 if (vars.smoothChildTiming == null) { 46176 vars.smoothChildTiming = true; 46177 } 46178 var tl = new TimelineLite(vars), 46179 root = tl._timeline, 46180 tween, next; 46181 if (ignoreDelayedCalls == null) { 46182 ignoreDelayedCalls = true; 46183 } 46184 root._remove(tl, true); 46185 tl._startTime = 0; 46186 tl._rawPrevTime = tl._time = tl._totalTime = root._time; 46187 tween = root._first; 46188 while (tween) { 46189 next = tween._next; 46190 if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) { 46191 tl.add(tween, tween._startTime - tween._delay); 46192 } 46193 tween = next; 46194 } 46195 root.add(tl, 0); 46196 return tl; 46197 }; 46198 46199 p.add = function(value, position, align, stagger) { 46200 var curTime, l, i, child, tl, beforeRawTime; 46201 if (typeof(position) !== "number") { 46202 position = this._parseTimeOrLabel(position, 0, true, value); 46203 } 46204 if (!(value instanceof Animation)) { 46205 if ((value instanceof Array) || (value && value.push && _isArray(value))) { 46206 align = align || "normal"; 46207 stagger = stagger || 0; 46208 curTime = position; 46209 l = value.length; 46210 for (i = 0; i < l; i++) { 46211 if (_isArray(child = value[i])) { 46212 child = new TimelineLite({tweens:child}); 46213 } 46214 this.add(child, curTime); 46215 if (typeof(child) !== "string" && typeof(child) !== "function") { 46216 if (align === "sequence") { 46217 curTime = child._startTime + (child.totalDuration() / child._timeScale); 46218 } else if (align === "start") { 46219 child._startTime -= child.delay(); 46220 } 46221 } 46222 curTime += stagger; 46223 } 46224 return this._uncache(true); 46225 } else if (typeof(value) === "string") { 46226 return this.addLabel(value, position); 46227 } else if (typeof(value) === "function") { 46228 value = TweenLite.delayedCall(0, value); 46229 } else { 46230 throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string."); 46231 } 46232 } 46233 46234 SimpleTimeline.prototype.add.call(this, value, position); 46235 46236 //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. 46237 if (this._gc || this._time === this._duration) if (!this._paused) if (this._duration < this.duration()) { 46238 //in case any of the ancestors had completed but should now be enabled... 46239 tl = this; 46240 beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect. 46241 while (tl._timeline) { 46242 if (beforeRawTime && tl._timeline.smoothChildTiming) { 46243 tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it. 46244 } else if (tl._gc) { 46245 tl._enabled(true, false); 46246 } 46247 tl = tl._timeline; 46248 } 46249 } 46250 46251 return this; 46252 }; 46253 46254 p.remove = function(value) { 46255 if (value instanceof Animation) { 46256 this._remove(value, false); 46257 var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline. 46258 value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct. 46259 return this; 46260 } else if (value instanceof Array || (value && value.push && _isArray(value))) { 46261 var i = value.length; 46262 while (--i > -1) { 46263 this.remove(value[i]); 46264 } 46265 return this; 46266 } else if (typeof(value) === "string") { 46267 return this.removeLabel(value); 46268 } 46269 return this.kill(null, value); 46270 }; 46271 46272 p._remove = function(tween, skipDisable) { 46273 SimpleTimeline.prototype._remove.call(this, tween, skipDisable); 46274 var last = this._last; 46275 if (!last) { 46276 this._time = this._totalTime = this._duration = this._totalDuration = 0; 46277 } else if (this._time > this.duration()) { 46278 this._time = this._duration; 46279 this._totalTime = this._totalDuration; 46280 } 46281 return this; 46282 }; 46283 46284 p.append = function(value, offsetOrLabel) { 46285 return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value)); 46286 }; 46287 46288 p.insert = p.insertMultiple = function(value, position, align, stagger) { 46289 return this.add(value, position || 0, align, stagger); 46290 }; 46291 46292 p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) { 46293 return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger); 46294 }; 46295 46296 p.addLabel = function(label, position) { 46297 this._labels[label] = this._parseTimeOrLabel(position); 46298 return this; 46299 }; 46300 46301 p.addPause = function(position, callback, params, scope) { 46302 var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this); 46303 t.vars.onComplete = t.vars.onReverseComplete = callback;
46304 t.data = "isPause"; 46305 this._hasPause = true; 46306 return this.add(t, position); 46307 }; 46308 46309 p.removeLabel = function(label) { 46310 delete this._labels[label]; 46311 return this; 46312 }; 46313 46314 p.getLabelTime = function(label) { 46315 return (this._labels[label] != null) ? this._labels[label] : -1; 46316 }; 46317 46318 p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) { 46319 var i; 46320 //if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration(). 46321 if (ignore instanceof Animation && ignore.timeline === this) { 46322 this.remove(ignore); 46323 } else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) { 46324 i = ignore.length; 46325 while (--i > -1) { 46326 if (ignore[i] instanceof Animation && ignore[i].timeline === this) { 46327 this.remove(ignore[i]); 46328 } 46329 } 46330 } 46331 if (typeof(offsetOrLabel) === "string") { 46332 return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - this.duration() : 0, appendIfAbsent); 46333 } 46334 offsetOrLabel = offsetOrLabel || 0; 46335 if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). 46336 i = timeOrLabel.indexOf("="); 46337 if (i === -1) { 46338 if (this._labels[timeOrLabel] == null) { 46339 return appendIfAbsent ? (this._labels[timeOrLabel] = this.duration() + offsetOrLabel) : offsetOrLabel; 46340 } 46341 return this._labels[timeOrLabel] + offsetOrLabel; 46342 } 46343 offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1)); 46344 timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : this.duration(); 46345 } else if (timeOrLabel == null) { 46346 timeOrLabel = this.duration(); 46347 } 46348 return Number(timeOrLabel) + offsetOrLabel; 46349 }; 46350 46351 p.seek = function(position, suppressEvents) { 46352 return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false)); 46353 }; 46354 46355 p.stop = function() { 46356 return this.paused(true); 46357 }; 46358 46359 p.gotoAndPlay = function(position, suppressEvents) { 46360 return this.play(position, suppressEvents); 46361 }; 46362 46363 p.gotoAndStop = function(position, suppressEvents) { 46364 return this.pause(position, suppressEvents); 46365 }; 46366 46367 p.render = function(time, suppressEvents, force) { 46368 if (this._gc) { 46369 this._enabled(true, false); 46370 } 46371 var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(), 46372 prevTime = this._time, 46373 prevStart = this._startTime, 46374 prevTimeScale = this._timeScale, 46375 prevPaused = this._paused, 46376 tween, isComplete, next, callback, internalForce, pauseTween, curTime; 46377 if (time >= totalDur - 0.0000001 && time >= 0) { //to work around occasional floating point math artifacts. 46378 this._totalTime = this._time = totalDur; 46379 if (!this._reversed) if (!this._hasPausedChild()) { 46380 isComplete = true; 46381 callback = "onComplete"; 46382 internalForce = !!this._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. 46383 if (this._duration === 0) if ((time <= 0 && time >= -0.0000001) || this._rawPrevTime < 0 || this._rawPrevTime === _tinyNum) if (this._rawPrevTime !== time && this._first) { 46384 internalForce = true; 46385 if (this._rawPrevTime > _tinyNum) { 46386 callback = "onReverseComplete"; 46387 } 46388 } 46389 } 46390 this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 46391 time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. 46392 46393 } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0. 46394 this._totalTime = this._time = 0; 46395 if (prevTime !== 0 || (this._duration === 0 && this._rawPrevTime !== _tinyNum && (this._rawPrevTime > 0 || (time < 0 && this._rawPrevTime >= 0)))) { 46396 callback = "onReverseComplete"; 46397 isComplete = this._reversed; 46398 } 46399 if (time < 0) { 46400 this._active = false;
46401 if (this._timeline.autoRemoveChildren && this._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing. 46402 internalForce = isComplete = true; 46403 callback = "onReverseComplete"; 46404 } else if (this._rawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state. 46405 internalForce = true; 46406 } 46407 this._rawPrevTime = time; 46408 } else { 46409 this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 46410 if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good). 46411 tween = this._first; 46412 while (tween && tween._startTime === 0) { 46413 if (!tween._duration) { 46414 isComplete = false; 46415 } 46416 tween = tween._next; 46417 } 46418 } 46419 time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline) 46420 if (!this._initted) { 46421 internalForce = true; 46422 } 46423 } 46424 46425 } else { 46426 46427 if (this._hasPause && !this._forcingPlayhead && !suppressEvents) { 46428 if (time >= prevTime) { 46429 tween = this._first; 46430 while (tween && tween._startTime <= time && !pauseTween) { 46431 if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && this._rawPrevTime === 0)) { 46432 pauseTween = tween; 46433 } 46434 tween = tween._next; 46435 } 46436 } else { 46437 tween = this._last; 46438 while (tween && tween._startTime >= time && !pauseTween) { 46439 if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) { 46440 pauseTween = tween; 46441 } 46442 tween = tween._prev; 46443 } 46444 } 46445 if (pauseTween) { 46446 this._time = time = pauseTween._startTime; 46447 this._totalTime = time + (this._cycle * (this._totalDuration + this._repeatDelay)); 46448 } 46449 } 46450 46451 this._totalTime = this._time = this._rawPrevTime = time; 46452 } 46453 if ((this._time === prevTime || !this._first) && !force && !internalForce && !pauseTween) { 46454 return; 46455 } else if (!this._initted) { 46456 this._initted = true; 46457 } 46458 46459 if (!this._active) if (!this._paused && this._time !== prevTime && time > 0) { 46460 this._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example. 46461 } 46462 46463 if (prevTime === 0) if (this.vars.onStart) if (this._time !== 0 || !this._duration) if (!suppressEvents) { 46464 this._callback("onStart"); 46465 } 46466 46467 curTime = this._time; 46468 if (curTime >= prevTime) { 46469 tween = this._first; 46470 while (tween) { 46471 next = tween._next; //record it here because the value could change after rendering... 46472 if (curTime !== this._time || (this._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 46473 break; 46474 } else if (tween._active || (tween._startTime <= curTime && !tween._paused && !tween._gc)) { 46475 if (pauseTween === tween) { 46476 this.pause(); 46477 } 46478 if (!tween._reversed) { 46479 tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 46480 } else { 46481 tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 46482 } 46483 } 46484 tween = next; 46485 } 46486 } else { 46487 tween = this._last; 46488 while (tween) { 46489 next = tween._prev; //record it here because the value could change after rendering... 46490 if (curTime !== this._time || (this._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 46491 break; 46492 } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) { 46493 if (pauseTween === tween) { 46494 pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse. 46495 while (pauseTween && pauseTween.endTime() > this._time) { 46496 pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force); 46497 pauseTween = pauseTween._prev; 46498 } 46499 pauseTween = null; 46500 this.pause(); 46501 } 46502 if (!tween._reversed) { 46503 tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 46504 } else { 46505 tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 46506 } 46507 } 46508 tween = next; 46509 } 46510 } 46511 46512 if (this._onUpdate) if (!suppressEvents) { 46513 if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. 46514 _lazyRender(); 46515 }
46516 this._callback("onUpdate"); 46517 } 46518 46519 if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate 46520 if (isComplete) { 46521 if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values. 46522 _lazyRender(); 46523 } 46524 if (this._timeline.autoRemoveChildren) { 46525 this._enabled(false, false); 46526 } 46527 this._active = false; 46528 } 46529 if (!suppressEvents && this.vars[callback]) { 46530 this._callback(callback); 46531 } 46532 } 46533 }; 46534 46535 p._hasPausedChild = function() { 46536 var tween = this._first; 46537 while (tween) { 46538 if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) { 46539 return true; 46540 } 46541 tween = tween._next; 46542 } 46543 return false; 46544 }; 46545 46546 p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) { 46547 ignoreBeforeTime = ignoreBeforeTime || -9999999999; 46548 var a = [], 46549 tween = this._first, 46550 cnt = 0; 46551 while (tween) { 46552 if (tween._startTime < ignoreBeforeTime) { 46553 //do nothing 46554 } else if (tween instanceof TweenLite) { 46555 if (tweens !== false) { 46556 a[cnt++] = tween; 46557 } 46558 } else { 46559 if (timelines !== false) { 46560 a[cnt++] = tween; 46561 } 46562 if (nested !== false) { 46563 a = a.concat(tween.getChildren(true, tweens, timelines)); 46564 cnt = a.length; 46565 } 46566 } 46567 tween = tween._next; 46568 } 46569 return a; 46570 }; 46571 46572 p.getTweensOf = function(target, nested) { 46573 var disabled = this._gc, 46574 a = [], 46575 cnt = 0, 46576 tweens, i; 46577 if (disabled) { 46578 this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here. 46579 } 46580 tweens = TweenLite.getTweensOf(target); 46581 i = tweens.length; 46582 while (--i > -1) { 46583 if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) { 46584 a[cnt++] = tweens[i]; 46585 } 46586 } 46587 if (disabled) { 46588 this._enabled(false, true); 46589 } 46590 return a; 46591 }; 46592 46593 p.recent = function() { 46594 return this._recent; 46595 }; 46596 46597 p._contains = function(tween) { 46598 var tl = tween.timeline; 46599 while (tl) { 46600 if (tl === this) { 46601 return true; 46602 } 46603 tl = tl.timeline; 46604 } 46605 return false; 46606 }; 46607 46608 p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) { 46609 ignoreBeforeTime = ignoreBeforeTime || 0; 46610 var tween = this._first, 46611 labels = this._labels, 46612 p; 46613 while (tween) { 46614 if (tween._startTime >= ignoreBeforeTime) { 46615 tween._startTime += amount; 46616 } 46617 tween = tween._next; 46618 } 46619 if (adjustLabels) { 46620 for (p in labels) { 46621 if (labels[p] >= ignoreBeforeTime) { 46622 labels[p] += amount; 46623 } 46624 } 46625 } 46626 return this._uncache(true); 46627 }; 46628 46629 p._kill = function(vars, target) { 46630 if (!vars && !target) { 46631 return this._enabled(false, false); 46632 } 46633 var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target), 46634 i = tweens.length, 46635 changed = false; 46636 while (--i > -1) { 46637 if (tweens[i]._kill(vars, target)) { 46638 changed = true; 46639 } 46640 } 46641 return changed; 46642 }; 46643 46644 p.clear = function(labels) { 46645 var tweens = this.getChildren(false, true, true), 46646 i = tweens.length; 46647 this._time = this._totalTime = 0; 46648 while (--i > -1) { 46649 tweens[i]._enabled(false, false); 46650 } 46651 if (labels !== false) { 46652 this._labels = {}; 46653 } 46654 return this._uncache(true); 46655 }; 46656 46657 p.invalidate = function() { 46658 var tween = this._first; 46659 while (tween) { 46660 tween.invalidate(); 46661 tween = tween._next; 46662 } 46663 return Animation.prototype.invalidate.call(this);; 46664 }; 46665 46666 p._enabled = function(enabled, ignoreTimeline) { 46667 if (enabled === this._gc) { 46668 var tween = this._first; 46669 while (tween) { 46670 tween._enabled(enabled, true); 46671 tween = tween._next; 46672 } 46673 } 46674 return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline); 46675 }; 46676 46677 p.totalTime = function(time, suppressEvents, uncapped) { 46678 this._forcingPlayhead = true; 46679 var val = Animation.prototype.totalTime.apply(this, arguments); 46680 this._forcingPlayhead = false;
46681 return val; 46682 }; 46683 46684 p.duration = function(value) { 46685 if (!arguments.length) { 46686 if (this._dirty) { 46687 this.totalDuration(); //just triggers recalculation 46688 } 46689 return this._duration; 46690 } 46691 if (this.duration() !== 0 && value !== 0) { 46692 this.timeScale(this._duration / value); 46693 } 46694 return this; 46695 }; 46696 46697 p.totalDuration = function(value) { 46698 if (!arguments.length) { 46699 if (this._dirty) { 46700 var max = 0, 46701 tween = this._last, 46702 prevStart = 999999999999, 46703 prev, end; 46704 while (tween) { 46705 prev = tween._prev; //record it here in case the tween changes position in the sequence... 46706 if (tween._dirty) { 46707 tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it. 46708 } 46709 if (tween._startTime > prevStart && this._sortChildren && !tween._paused) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence 46710 this.add(tween, tween._startTime - tween._delay); 46711 } else { 46712 prevStart = tween._startTime; 46713 } 46714 if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. 46715 max -= tween._startTime; 46716 if (this._timeline.smoothChildTiming) { 46717 this._startTime += tween._startTime / this._timeScale; 46718 } 46719 this.shiftChildren(-tween._startTime, false, -9999999999); 46720 prevStart = 0; 46721 } 46722 end = tween._startTime + (tween._totalDuration / tween._timeScale); 46723 if (end > max) { 46724 max = end; 46725 } 46726 tween = prev; 46727 } 46728 this._duration = this._totalDuration = max; 46729 this._dirty = false; 46730 } 46731 return this._totalDuration; 46732 } 46733 return (value && this.totalDuration()) ? this.timeScale(this._totalDuration / value) : this; 46734 }; 46735 46736 p.paused = function(value) { 46737 if (!value) { //if there's a pause directly at the spot from where we're unpausing, skip it. 46738 var tween = this._first, 46739 time = this._time; 46740 while (tween) { 46741 if (tween._startTime === time && tween.data === "isPause") { 46742 tween._rawPrevTime = 0; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire. 46743 } 46744 tween = tween._next; 46745 } 46746 } 46747 return Animation.prototype.paused.apply(this, arguments); 46748 }; 46749 46750 p.usesFrames = function() { 46751 var tl = this._timeline; 46752 while (tl._timeline) { 46753 tl = tl._timeline; 46754 } 46755 return (tl === Animation._rootFramesTimeline); 46756 }; 46757 46758 p.rawTime = function(wrapRepeats) { 46759 return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale; 46760 }; 46761 46762 return TimelineLite; 46763 46764 }, true); 46765 46766 46767 46768 46769 46770 46771 46772 46773 46774 46775 46776 46777 46778 /* 46779 * ---------------------------------------------------------------- 46780 * TimelineMax 46781 * ---------------------------------------------------------------- 46782 */ 46783 _gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) { 46784 46785 var TimelineMax = function(vars) { 46786 TimelineLite.call(this, vars); 46787 this._repeat = this.vars.repeat || 0; 46788 this._repeatDelay = this.vars.repeatDelay || 0; 46789 this._cycle = 0; 46790 this._yoyo = (this.vars.yoyo === true); 46791 this._dirty = true; 46792 }, 46793 _tinyNum = 0.0000000001, 46794 TweenLiteInternals = TweenLite._internals, 46795 _lazyTweens = TweenLiteInternals.lazyTweens, 46796 _lazyRender = TweenLiteInternals.lazyRender, 46797 _globals = _gsScope._gsDefine.globals, 46798 _easeNone = new Ease(null, null, 1, 0), 46799 p = TimelineMax.prototype = new TimelineLite(); 46800 46801 p.constructor = TimelineMax; 46802 p.kill()._gc = false; 46803 TimelineMax.version = "1.19.1"; 46804 46805 p.invalidate = function() { 46806 this._yoyo = (this.vars.yoyo === true); 46807 this._repeat = this.vars.repeat || 0; 46808 this._repeatDelay = this.vars.repeatDelay || 0; 46809 this._uncache(true); 46810 return TimelineLite.prototype.invalidate.call(this); 46811 }; 46812 46813 p.addCallback = function(callback, position, params, scope) { 46814 return this.add( TweenLite.delayedCall(0, callback, params, scope), position); 46815 }; 46816 46817 p.removeCallback = function(callback, position) { 46818 if (callback) { 46819 if (position == null) { 46820 this._kill(null, callback); 46821 } else { 46822 var a = this.getTweensOf(callback, false), 46823 i = a.length, 46824 time = this._parseTimeOrLabel(position); 46825 while (--i > -1) { 46826 if (a[i]._startTime === time) { 46827 a[i]._enabled(false, false); 46828 } 46829 } 46830 } 46831 } 46832 return this; 46833 }; 46834 46835 p.removePause = function(position) { 46836 return this.removeCallback(TimelineLite._internals.pauseCallback, position); 46837 }; 46838 46839 p.tweenTo = function(position, vars) { 46840 vars = vars || {}; 46841 var copy = {ease:_easeNone, useFrames:this.usesFrames(), immediateRender:false}, 46842 Engine = (vars.repeat && _globals.TweenMax) || TweenLite, 46843 duration, p, t; 46844 for (p in vars) { 46845 copy[p] = vars[p]; 46846 } 46847 copy.time = this._parseTimeOrLabel(position); 46848 duration = (Math.abs(Number(copy.time) - this._time) / this._timeScale) || 0.001; 46849 t = new Engine(this, duration, copy); 46850 copy.onStart = function() { 46851 t.target.paused(true); 46852 if (t.vars.time !== t.target.time() && duration === t.duration()) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all. 46853 t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale ); 46854 } 46855 if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it. 46856 vars.onStart.apply(vars.onStartScope || vars.callbackScope || t, vars.onStartParams || []); //don't use t._callback("onStart") or it'll point to the copy.onStart and we'll get a recursion error. 46857 } 46858 }; 46859 return t; 46860 }; 46861 46862 p.tweenFromTo = function(fromPosition, toPosition, vars) { 46863 vars = vars || {}; 46864 fromPosition = this._parseTimeOrLabel(fromPosition); 46865 vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this}; 46866 vars.immediateRender = (vars.immediateRender !== false); 46867 var t = this.tweenTo(toPosition, vars); 46868 return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001); 46869 }; 46870 46871 p.render = function(time, suppressEvents, force) { 46872 if (this._gc) { 46873 this._enabled(true, false); 46874 } 46875 var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(), 46876 dur = this._duration, 46877 prevTime = this._time, 46878 prevTotalTime = this._totalTime, 46879 prevStart = this._startTime, 46880 prevTimeScale = this._timeScale, 46881 prevRawPrevTime = this._rawPrevTime, 46882 prevPaused = this._paused, 46883 prevCycle = this._cycle, 46884 tween, isComplete, next, callback, internalForce, cycleDuration, pauseTween, curTime; 46885 if (time >= totalDur - 0.0000001 && time >= 0) { //to work around occasional floating point math artifacts. 46886 if (!this._locked) { 46887 this._totalTime = totalDur; 46888 this._cycle = this._repeat; 46889 } 46890 if (!this._reversed) if (!this._hasPausedChild()) { 46891 isComplete = true; 46892 callback = "onComplete"; 46893 internalForce = !!this._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. 46894 if (this._duration === 0) if ((time <= 0 && time >= -0.0000001) || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time && this._first) { 46895 internalForce = true; 46896 if (prevRawPrevTime > _tinyNum) { 46897 callback = "onReverseComplete"; 46898 } 46899 } 46900 } 46901 this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 46902 if (this._yoyo && (this._cycle & 1) !== 0) { 46903 this._time = time = 0; 46904 } else { 46905 this._time = dur; 46906 time = dur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. We cannot do less then 0.0001 because the same issue can occur when the duration is extremely large like 999999999999 in
46906which case adding 0.00000001, for example, causes it to act like nothing was added. 46907 } 46908 46909 } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0. 46910 if (!this._locked) { 46911 this._totalTime = this._cycle = 0; 46912 } 46913 this._time = 0; 46914 if (prevTime !== 0 || (dur === 0 && prevRawPrevTime !== _tinyNum && (prevRawPrevTime > 0 || (time < 0 && prevRawPrevTime >= 0)) && !this._locked)) { //edge case for checking time < 0 && prevRawPrevTime >= 0: a zero-duration fromTo() tween inside a zero-duration timeline (yeah, very rare) 46915 callback = "onReverseComplete"; 46916 isComplete = this._reversed; 46917 } 46918 if (time < 0) { 46919 this._active = false; 46920 if (this._timeline.autoRemoveChildren && this._reversed) { 46921 internalForce = isComplete = true; 46922 callback = "onReverseComplete"; 46923 } else if (prevRawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state. 46924 internalForce = true; 46925 } 46926 this._rawPrevTime = time; 46927 } else { 46928 this._rawPrevTime = (dur || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 46929 if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good). 46930 tween = this._first; 46931 while (tween && tween._startTime === 0) { 46932 if (!tween._duration) { 46933 isComplete = false; 46934 } 46935 tween = tween._next; 46936 } 46937 } 46938 time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline) 46939 if (!this._initted) { 46940 internalForce = true; 46941 } 46942 } 46943 46944 } else { 46945 if (dur === 0 && prevRawPrevTime < 0) { //without this, zero-duration repeating timelines (like with a simple callback nested at the very beginning and a repeatDelay) wouldn't render the first time through. 46946 internalForce = true; 46947 } 46948 this._time = this._rawPrevTime = time; 46949 if (!this._locked) { 46950 this._totalTime = time; 46951 if (this._repeat !== 0) { 46952 cycleDuration = dur + this._repeatDelay; 46953 this._cycle = (this._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but it gets reported as 0.79999999!) 46954 if (this._cycle !== 0) if (this._cycle === this._totalTime / cycleDuration && prevTotalTime <= time) { 46955 this._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning) 46956 } 46957 this._time = this._totalTime - (this._cycle * cycleDuration); 46958 if (this._yoyo) if ((this._cycle & 1) !== 0) { 46959 this._time = dur - this._time; 46960 } 46961 if (this._time > dur) { 46962 this._time = dur; 46963 time = dur + 0.0001; //to avoid occasional floating point rounding error 46964 } else if (this._time < 0) { 46965 this._time = time = 0; 46966 } else { 46967 time = this._time; 46968 } 46969 } 46970 } 46971 46972 if (this._hasPause && !this._forcingPlayhead && !suppressEvents && time < dur) { 46973 time = this._time; 46974 if (time >= prevTime || (this._repeat && prevCycle !== this._cycle)) { 46975 tween = this._first; 46976 while (tween && tween._startTime <= time && !pauseTween) { 46977 if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && this._rawPrevTime === 0)) { 46978 pauseTween = tween; 46979 } 46980 tween = tween._next; 46981 } 46982 } else { 46983 tween = this._last; 46984 while (tween && tween._startTime >= time && !pauseTween) { 46985 if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) { 46986 pauseTween = tween; 46987 } 46988 tween = tween._prev; 46989 } 46990 } 46991 if (pauseTween) { 46992 this._time = time = pauseTween._startTime; 46993 this._totalTime = time + (this._cycle * (this._totalDuration + this._repeatDelay)); 46994 } 46995 } 46996 46997 } 46998 46999 if (this._cycle !== prevCycle) if (!this._locked) { 47000 /* 47001 make sure children at the end/beginning of the timeline are rendered properly. If, for example, 47002 a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
47003 would get transated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there 47004 could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So 47005 we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must 47006 ensure that zero-duration tweens at the very beginning or end of the TimelineMax work. 47007 */ 47008 var backwards = (this._yoyo && (prevCycle & 1) !== 0), 47009 wrap = (backwards === (this._yoyo && (this._cycle & 1) !== 0)), 47010 recTotalTime = this._totalTime, 47011 recCycle = this._cycle, 47012 recRawPrevTime = this._rawPrevTime, 47013 recTime = this._time; 47014 47015 this._totalTime = prevCycle * dur; 47016 if (this._cycle < prevCycle) { 47017 backwards = !backwards; 47018 } else { 47019 this._totalTime += dur; 47020 } 47021 this._time = prevTime; //temporarily revert _time so that render() renders the children in the correct order. Without this, tweens won't rewind correctly. We could arhictect things in a "cleaner" way by splitting out the rendering queue into a separate method but for performance reasons, we kept it all inside this method. 47022 47023 this._rawPrevTime = (dur === 0) ? prevRawPrevTime - 0.0001 : prevRawPrevTime; 47024 this._cycle = prevCycle; 47025 this._locked = true; //prevents changes to totalTime and skips repeat/yoyo behavior when we recursively call render() 47026 prevTime = (backwards) ? 0 : dur; 47027 this.render(prevTime, suppressEvents, (dur === 0)); 47028 if (!suppressEvents) if (!this._gc) { 47029 if (this.vars.onRepeat) { 47030 this._cycle = recCycle; //in case the onRepeat alters the playhead or invalidates(), we shouldn't stay locked or use the previous cycle. 47031 this._locked = false; 47032 this._callback("onRepeat"); 47033 } 47034 } 47035 if (prevTime !== this._time) { //in case there's a callback like onComplete in a nested tween/timeline that changes the playhead position, like via seek(), we should just abort. 47036 return; 47037 } 47038 if (wrap) { 47039 this._cycle = prevCycle; //if there's an onRepeat, we reverted this above, so make sure it's set properly again. We also unlocked in that scenario, so reset that too. 47040 this._locked = true; 47041 prevTime = (backwards) ? dur + 0.0001 : -0.0001; 47042 this.render(prevTime, true, false); 47043 } 47044 this._locked = false; 47045 if (this._paused && !prevPaused) { //if the render() triggered callback that paused this timeline, we should abort (very rare, but possible) 47046 return; 47047 } 47048 this._time = recTime; 47049 this._totalTime = recTotalTime; 47050 this._cycle = recCycle; 47051 this._rawPrevTime = recRawPrevTime; 47052 } 47053 47054 if ((this._time === prevTime || !this._first) && !force && !internalForce && !pauseTween) { 47055 if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate. 47056 this._callback("onUpdate"); 47057 } 47058 return; 47059 } else if (!this._initted) { 47060 this._initted = true; 47061 } 47062 47063 if (!this._active) if (!this._paused && this._totalTime !== prevTotalTime && time > 0) { 47064 this._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example. 47065 } 47066 47067 if (prevTotalTime === 0) if (this.vars.onStart) if (this._totalTime !== 0 || !this._totalDuration) if (!suppressEvents) { 47068 this._callback("onStart"); 47069 } 47070 47071 curTime = this._time; 47072 if (curTime >= prevTime) { 47073 tween = this._first; 47074 while (tween) { 47075 next = tween._next; //record it here because the value could change after rendering... 47076 if (curTime !== this._time || (this._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 47077 break; 47078 } else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) { 47079 if (pauseTween === tween) { 47080 this.pause(); 47081 } 47082 if (!tween._reversed) { 47083 tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 47084 } else { 47085 tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 47086 } 47087 } 47088 tween = next; 47089 } 47090 } else { 47091 tween = this._last; 47092 while (tween) { 47093 next = tween._prev; //record it here because the value could change after rendering... 47094 if (curTime !== this._time || (this._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 47095 break; 47096 } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) { 47097 if (pauseTween === tween) { 47098 pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse. 47099 while (pauseTween && pauseTween.endTime() > this._time) { 47100 pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force); 47101 pauseTween = pauseTween._prev; 47102 } 47103 pauseTween = null; 47104 this.pause(); 47105 } 47106 if (!tween._reversed) { 47107 tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 47108 } else { 47109 tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 47110 } 47111 } 47112 tween = next; 47113 } 47114 } 47115 47116 if (this._onUpdate) if (!suppressEvents) { 47117 if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. 47118 _lazyRender(); 47119 }
47120 this._callback("onUpdate"); 47121 } 47122 if (callback) if (!this._locked) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate 47123 if (isComplete) { 47124 if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values. 47125 _lazyRender(); 47126 } 47127 if (this._timeline.autoRemoveChildren) { 47128 this._enabled(false, false); 47129 } 47130 this._active = false; 47131 } 47132 if (!suppressEvents && this.vars[callback]) { 47133 this._callback(callback); 47134 } 47135 } 47136 }; 47137 47138 p.getActive = function(nested, tweens, timelines) { 47139 if (nested == null) { 47140 nested = true; 47141 } 47142 if (tweens == null) { 47143 tweens = true; 47144 } 47145 if (timelines == null) { 47146 timelines = false; 47147 } 47148 var a = [], 47149 all = this.getChildren(nested, tweens, timelines), 47150 cnt = 0, 47151 l = all.length, 47152 i, tween; 47153 for (i = 0; i < l; i++) { 47154 tween = all[i]; 47155 if (tween.isActive()) { 47156 a[cnt++] = tween; 47157 } 47158 } 47159 return a; 47160 }; 47161 47162 47163 p.getLabelAfter = function(time) { 47164 if (!time) if (time !== 0) { //faster than isNan() 47165 time = this._time; 47166 } 47167 var labels = this.getLabelsArray(), 47168 l = labels.length, 47169 i; 47170 for (i = 0; i < l; i++) { 47171 if (labels[i].time > time) { 47172 return labels[i].name; 47173 } 47174 } 47175 return null; 47176 }; 47177 47178 p.getLabelBefore = function(time) { 47179 if (time == null) { 47180 time = this._time; 47181 } 47182 var labels = this.getLabelsArray(), 47183 i = labels.length; 47184 while (--i > -1) { 47185 if (labels[i].time < time) { 47186 return labels[i].name; 47187 } 47188 } 47189 return null; 47190 }; 47191 47192 p.getLabelsArray = function() { 47193 var a = [], 47194 cnt = 0, 47195 p; 47196 for (p in this._labels) { 47197 a[cnt++] = {time:this._labels[p], name:p}; 47198 } 47199 a.sort(function(a,b) { 47200 return a.time - b.time; 47201 }); 47202 return a; 47203 }; 47204 47205 p.invalidate = function() { 47206 this._locked = false; //unlock and set cycle in case invalidate() is called from inside an onRepeat 47207 return TimelineLite.prototype.invalidate.call(this); 47208 }; 47209 47210 47211 //---- GETTERS / SETTERS ------------------------------------------------------------------------------------------------------- 47212 47213 p.progress = function(value, suppressEvents) { 47214 return (!arguments.length) ? this._time / this.duration() : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents); 47215 }; 47216 47217 p.totalProgress = function(value, suppressEvents) { 47218 return (!arguments.length) ? this._totalTime / this.totalDuration() : this.totalTime( this.totalDuration() * value, suppressEvents); 47219 }; 47220 47221 p.totalDuration = function(value) { 47222 if (!arguments.length) { 47223 if (this._dirty) { 47224 TimelineLite.prototype.totalDuration.call(this); //just forces refresh 47225 //Instead of Infinity, we use 999999999999 so that we can accommodate reverses. 47226 this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat); 47227 } 47228 return this._totalDuration; 47229 } 47230 return (this._repeat === -1 || !value) ? this : this.timeScale( this.totalDuration() / value ); 47231 }; 47232 47233 p.time = function(value, suppressEvents) { 47234 if (!arguments.length) { 47235 return this._time; 47236 } 47237 if (this._dirty) { 47238 this.totalDuration(); 47239 } 47240 if (value > this._duration) { 47241 value = this._duration; 47242 } 47243 if (this._yoyo && (this._cycle & 1) !== 0) { 47244 value = (this._duration - value) + (this._cycle * (this._duration + this._repeatDelay)); 47245 } else if (this._repeat !== 0) { 47246 value += this._cycle * (this._duration + this._repeatDelay); 47247 } 47248 return this.totalTime(value, suppressEvents); 47249 }; 47250 47251 p.repeat = function(value) { 47252 if (!arguments.length) { 47253 return this._repeat; 47254 } 47255 this._repeat = value; 47256 return this._uncache(true); 47257 }; 47258 47259 p.repeatDelay = function(value) { 47260 if (!arguments.length) { 47261 return this._repeatDelay; 47262 } 47263 this._repeatDelay = value; 47264 return this._uncache(true); 47265 }; 47266 47267 p.yoyo = function(value) { 47268 if (!arguments.length) { 47269 return this._yoyo; 47270 } 47271 this._yoyo = value; 47272 return this; 47273 }; 47274 47275 p.currentLabel = function(value) { 47276 if (!arguments.length) { 47277 return this.getLabelBefore(this._time + 0.00000001); 47278 } 47279 return this.seek(value, true); 47280 }; 47281 47282 return TimelineMax; 47283 47284 }, true); 47285 47286 47287 47288 47289 47290 47291 47292 47293 47294 47295 47296 47297 /* 47298 * ---------------------------------------------------------------- 47299 * BezierPlugin 47300 * ---------------------------------------------------------------- 47301 */ 47302 (function() { 47303 47304 var _RAD2DEG = 180 / Math.PI, 47305 _r1 = [], 47306 _r2 = [], 47307 _r3 = [], 47308 _corProps = {}, 47309 _globals = _gsScope._gsDefine.globals, 47310 Segment = function(a, b, c, d) { 47311 if (c === d) { //if c and d match, the final autoRotate value could lock at -90 degrees, so differentiate them slightly. 47312 c = d - (d - b) / 1000000; 47313 } 47314 if (a === b) { //if a and b match, the starting autoRotate value could lock at -90 degrees, so differentiate them slightly. 47315 b = a + (c - a) / 1000000; 47316 } 47317 this.a = a; 47318 this.b = b; 47319 this.c = c; 47320 this.d = d; 47321 this.da = d - a; 47322 this.ca = c - a; 47323 this.ba = b - a; 47324 }, 47325 _correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,", 47326 cubicToQuadratic = function(a, b, c, d) { 47327 var q1 = {a:a}, 47328 q2 = {}, 47329 q3 = {}, 47330 q4 = {c:d}, 47331 mab = (a + b) / 2, 47332 mbc = (b + c) / 2, 47333 mcd = (c + d) / 2, 47334 mabc = (mab + mbc) / 2, 47335 mbcd = (mbc + mcd) / 2, 47336 m8 = (mbcd - mabc) / 8; 47337 q1.b = mab + (a - mab) / 4; 47338 q2.b = mabc + m8; 47339 q1.c = q2.a = (q1.b + q2.b) / 2; 47340 q2.c = q3.a = (mabc + mbcd) / 2; 47341 q3.b = mbcd - m8; 47342 q4.b = mcd + (d - mcd) / 4; 47343 q3.c = q4.a = (q3.b + q4.b) / 2; 47344 return [q1, q2, q3, q4]; 47345 }, 47346 _calculateControlPoints = function(a, curviness, quad, basic, correlate) { 47347 var l = a.length - 1, 47348 ii = 0, 47349 cp1 = a[0].a, 47350 i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl; 47351 for (i = 0; i < l; i++) { 47352 seg = a[ii]; 47353 p1 = seg.a; 47354 p2 = seg.d; 47355 p3 = a[ii+1].d; 47356 47357 if (correlate) { 47358 r1 = _r1[i]; 47359 r2 = _r2[i]; 47360 tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5); 47361 m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0)); 47362 m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0)); 47363 mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0)); 47364 } else { 47365 m1 = p2 - (p2 - p1) * curviness * 0.5; 47366 m2 = p2 + (p3 - p2) * curviness * 0.5; 47367 mm = p2 - (m1 + m2) / 2; 47368 } 47369 m1 += mm; 47370 m2 += mm; 47371 47372 seg.c = cp2 = m1; 47373 if (i !== 0) { 47374 seg.b = cp1; 47375 } else { 47376 seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly. 47377 } 47378 47379 seg.da = p2 - p1; 47380 seg.ca = cp2 - p1; 47381 seg.ba = cp1 - p1; 47382 47383 if (quad) { 47384 qb = cubicToQuadratic(p1, cp1, cp2, p2); 47385 a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); 47386 ii += 4; 47387 } else { 47388 ii++; 47389 } 47390 47391 cp1 = m2; 47392 } 47393 seg = a[ii]; 47394 seg.b = cp1; 47395 seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly. 47396 seg.da = seg.d - seg.a; 47397 seg.ca = seg.c - seg.a; 47398 seg.ba = cp1 - seg.a; 47399 if (quad) { 47400 qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d); 47401 a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); 47402 } 47403 }, 47404 _parseAnchors = function(values, p, correlate, prepend) { 47405 var a = [], 47406 l, i, p1, p2, p3, tmp; 47407 if (prepend) {
47408 values = [prepend].concat(values); 47409 i = values.length; 47410 while (--i > -1) { 47411 if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") { 47412 values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons 47413 } 47414 } 47415 } 47416 l = values.length - 2; 47417 if (l < 0) { 47418 a[0] = new Segment(values[0][p], 0, 0, values[(l < -1) ? 0 : 1][p]); 47419 return a; 47420 } 47421 for (i = 0; i < l; i++) { 47422 p1 = values[i][p]; 47423 p2 = values[i+1][p]; 47424 a[i] = new Segment(p1, 0, 0, p2); 47425 if (correlate) { 47426 p3 = values[i+2][p]; 47427 _r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1); 47428 _r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2); 47429 } 47430 } 47431 a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]); 47432 return a; 47433 }, 47434 bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) { 47435 var obj = {}, 47436 props = [], 47437 first = prepend || values[0], 47438 i, p, a, j, r, l, seamless, last; 47439 correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate; 47440 if (curviness == null) { 47441 curviness = 1; 47442 } 47443 for (p in values[0]) { 47444 props.push(p); 47445 } 47446 //check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later) 47447 if (values.length > 1) { 47448 last = values[values.length - 1]; 47449 seamless = true; 47450 i = props.length; 47451 while (--i > -1) { 47452 p = props[i]; 47453 if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors. 47454 seamless = false; 47455 break; 47456 } 47457 } 47458 if (seamless) { 47459 values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens 47460 if (prepend) { 47461 values.unshift(prepend); 47462 } 47463 values.push(values[1]); 47464 prepend = values[values.length - 3]; 47465 } 47466 } 47467 _r1.length = _r2.length = _r3.length = 0; 47468 i = props.length; 47469 while (--i > -1) { 47470 p = props[i]; 47471 _corProps[p] = (correlate.indexOf(","+p+",") !== -1); 47472 obj[p] = _parseAnchors(values, p, _corProps[p], prepend); 47473 } 47474 i = _r1.length; 47475 while (--i > -1) { 47476 _r1[i] = Math.sqrt(_r1[i]); 47477 _r2[i] = Math.sqrt(_r2[i]); 47478 } 47479 if (!basic) { 47480 i = props.length; 47481 while (--i > -1) { 47482 if (_corProps[p]) { 47483 a = obj[props[i]]; 47484 l = a.length - 1; 47485 for (j = 0; j < l; j++) { 47486 r = (a[j+1].da / _r2[j] + a[j].da / _r1[j]) || 0; 47487 _r3[j] = (_r3[j] || 0) + r * r; 47488 } 47489 } 47490 } 47491 i = _r3.length; 47492 while (--i > -1) { 47493 _r3[i] = Math.sqrt(_r3[i]); 47494 } 47495 } 47496 i = props.length; 47497 j = quadratic ? 4 : 1; 47498 while (--i > -1) { 47499 p = props[i]; 47500 a = obj[p]; 47501 _calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties 47502 if (seamless) { 47503 a.splice(0, j); 47504 a.splice(a.length - j, j); 47505 } 47506 } 47507 return obj; 47508 }, 47509 _parseBezierData = function(values, type, prepend) { 47510 type = type || "soft"; 47511 var obj = {}, 47512 inc = (type === "cubic") ? 3 : 2, 47513 soft = (type === "soft"), 47514 props = [], 47515 a, b, c, d, cur, i, j, l, p, cnt, tmp; 47516 if (soft && prepend) { 47517 values = [prepend].concat(values); 47518 } 47519 if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; } 47520 for (p in values[0]) { 47521 props.push(p); 47522 } 47523 i = props.length; 47524 while (--i > -1) { 47525 p = props[i]; 47526 obj[p] = cur = []; 47527 cnt = 0; 47528 l = values.length; 47529 for (j = 0; j < l; j++) { 47530 a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp); 47531 if (soft) if (j > 1) if (j < l - 1) { 47532 cur[cnt++] = (a + cur[cnt-2]) / 2; 47533 } 47534 cur[cnt++] = a; 47535 } 47536 l = cnt - inc + 1; 47537 cnt = 0; 47538 for (j = 0; j < l; j += inc) { 47539 a = cur[j]; 47540 b = cur[j+1]; 47541 c = cur[j+2]; 47542 d = (inc === 2) ? 0 : cur[j+3]; 47543 cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); 47544 } 47545 cur.length = cnt; 47546 } 47547 return obj; 47548 }, 47549 _addCubicLengths = function(a, steps, resolution) { 47550 var inc = 1 / resolution, 47551 j = a.length, 47552 d, d1, s, da, ca, ba, p, i, inv, bez, index; 47553 while (--j > -1) { 47554 bez = a[j]; 47555 s = bez.a; 47556 da = bez.d - s; 47557 ca = bez.c - s; 47558 ba = bez.b - s; 47559 d = d1 = 0; 47560 for (i = 1; i <= resolution; i++) { 47561 p = inc * i; 47562 inv = 1 - p; 47563 d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p); 47564 index = j * resolution + i - 1; 47565 steps[index] = (steps[index] || 0) + d * d; 47566 } 47567 } 47568 }, 47569 _parseLengthData = function(obj, resolution) { 47570 resolution = resolution >> 0 || 6; 47571 var a = [], 47572 lengths = [], 47573 d = 0, 47574 total = 0, 47575 threshold = resolution - 1, 47576 segments = [], 47577 curLS = [], //current length segments array 47578 p, i, l, index; 47579 for (p in obj) { 47580 _addCubicLengths(obj[p], a, resolution); 47581 } 47582 l = a.length; 47583 for (i = 0; i < l; i++) { 47584 d += Math.sqrt(a[i]); 47585 index = i % resolution; 47586 curLS[index] = d; 47587 if (index === threshold) { 47588 total += d; 47589 index = (i / resolution) >> 0; 47590 segments[index] = curLS; 47591 lengths[index] = total; 47592 d = 0; 47593 curLS = []; 47594 } 47595 } 47596 return {length:total, lengths:lengths, segments:segments}; 47597 }, 47598 47599 47600 47601 BezierPlugin = _gsScope._gsDefine.plugin({ 47602 propName: "bezier", 47603 priority: -1, 47604 version: "1.3.7", 47605 API: 2, 47606 global:true, 47607 47608 //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. 47609 init: function(target, vars, tween) { 47610 this._target = target; 47611 if (vars instanceof Array) { 47612 vars = {values:vars}; 47613 } 47614 this._func = {}; 47615 this._mod = {}; 47616 this._props = []; 47617 this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10); 47618 var values = vars.values || [], 47619 first = {}, 47620 second = values[0], 47621 autoRotate = vars.autoRotate || tween.vars.orientToBezier, 47622 p, isFunc, i, j, prepend; 47623 47624 this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null; 47625 for (p in second) { 47626 this._props.push(p); 47627 } 47628 47629 i = this._props.length; 47630 while (--i > -1) { 47631 p = this._props[i]; 47632 47633 this._overwriteProps.push(p); 47634 isFunc = this._func[p] = (typeof(target[p]) === "function"); 47635 first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); 47636 if (!prepend) if (first[p] !== values[0][p]) { 47637 prepend = first; 47638 } 47639 } 47640 this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first); 47641 this._segCount = this._beziers[p].length; 47642 47643 if (this._timeRes) { 47644 var ld = _parseLengthData(this._beziers, this._timeRes); 47645 this._length = ld.length; 47646 this._lengths = ld.lengths; 47647 this._segments = ld.segments; 47648 this._l1 = this._li = this._s1 = this._si = 0; 47649 this._l2 = this._lengths[0]; 47650 this._curSeg = this._segments[0]; 47651 this._s2 = this._curSeg[0]; 47652 this._prec = 1 / this._curSeg.length; 47653 } 47654 47655 if ((autoRotate = this._autoRotate)) { 47656 this._initialRotations = []; 47657 if (!(autoRotate[0] instanceof Array)) { 47658 this._autoRotate = autoRotate = [autoRotate]; 47659 } 47660 i = autoRotate.length; 47661 while (--i > -1) { 47662 for (j = 0; j < 3; j++) { 47663 p = autoRotate[i][j]; 47664 this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false;
47665 } 47666 p = autoRotate[i][2]; 47667 this._initialRotations[i] = (this._func[p] ? this._func[p].call(this._target) : this._target[p]) || 0; 47668 this._overwriteProps.push(p); 47669 } 47670 } 47671 this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1. 47672 return true; 47673 }, 47674 47675 //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) 47676 set: function(v) { 47677 var segments = this._segCount, 47678 func = this._func, 47679 target = this._target, 47680 notStart = (v !== this._startRatio), 47681 curIndex, inv, i, p, b, t, val, l, lengths, curSeg; 47682 if (!this._timeRes) { 47683 curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0; 47684 t = (v - (curIndex * (1 / segments))) * segments; 47685 } else { 47686 lengths = this._lengths; 47687 curSeg = this._curSeg; 47688 v *= this._length; 47689 i = this._li; 47690 //find the appropriate segment (if the currently cached one isn't correct) 47691 if (v > this._l2 && i < segments - 1) { 47692 l = segments - 1; 47693 while (i < l && (this._l2 = lengths[++i]) <= v) { } 47694 this._l1 = lengths[i-1]; 47695 this._li = i; 47696 this._curSeg = curSeg = this._segments[i]; 47697 this._s2 = curSeg[(this._s1 = this._si = 0)]; 47698 } else if (v < this._l1 && i > 0) { 47699 while (i > 0 && (this._l1 = lengths[--i]) >= v) { } 47700 if (i === 0 && v < this._l1) { 47701 this._l1 = 0; 47702 } else { 47703 i++; 47704 } 47705 this._l2 = lengths[i]; 47706 this._li = i; 47707 this._curSeg = curSeg = this._segments[i]; 47708 this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0; 47709 this._s2 = curSeg[this._si]; 47710 } 47711 curIndex = i; 47712 //now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one) 47713 v -= this._l1; 47714 i = this._si; 47715 if (v > this._s2 && i < curSeg.length - 1) { 47716 l = curSeg.length - 1; 47717 while (i < l && (this._s2 = curSeg[++i]) <= v) { } 47718 this._s1 = curSeg[i-1]; 47719 this._si = i; 47720 } else if (v < this._s1 && i > 0) { 47721 while (i > 0 && (this._s1 = curSeg[--i]) >= v) { } 47722 if (i === 0 && v < this._s1) { 47723 this._s1 = 0; 47724 } else { 47725 i++; 47726 } 47727 this._s2 = curSeg[i]; 47728 this._si = i; 47729 } 47730 t = ((i + (v - this._s1) / (this._s2 - this._s1)) * this._prec) || 0; 47731 } 47732 inv = 1 - t; 47733 47734 i = this._props.length; 47735 while (--i > -1) { 47736 p = this._props[i]; 47737 b = this._beziers[p][curIndex]; 47738 val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a; 47739 if (this._mod[p]) { 47740 val = this._mod[p](val, target); 47741 } 47742 if (func[p]) { 47743 target[p](val); 47744 } else { 47745 target[p] = val; 47746 } 47747 } 47748 47749 if (this._autoRotate) { 47750 var ar = this._autoRotate, 47751 b2, x1, y1, x2, y2, add, conv; 47752 i = ar.length; 47753 while (--i > -1) { 47754 p = ar[i][2]; 47755 add = ar[i][3] || 0; 47756 conv = (ar[i][4] === true) ? 1 : _RAD2DEG; 47757 b = this._beziers[ar[i][0]]; 47758 b2 = this._beziers[ar[i][1]]; 47759 47760 if (b && b2) { //in case one of the properties got overwritten. 47761 b = b[curIndex]; 47762 b2 = b2[curIndex]; 47763 47764 x1 = b.a + (b.b - b.a) * t; 47765 x2 = b.b + (b.c - b.b) * t; 47766 x1 += (x2 - x1) * t; 47767 x2 += ((b.c + (b.d - b.c) * t) - x2) * t; 47768 47769 y1 = b2.a + (b2.b - b2.a) * t; 47770 y2 = b2.b + (b2.c - b2.b) * t; 47771 y1 += (y2 - y1) * t; 47772 y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t; 47773 47774 val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i]; 47775 47776 if (this._mod[p]) { 47777 val = this._mod[p](val, target); //for modProps 47778 } 47779 47780 if (func[p]) { 47781 target[p](val); 47782 } else { 47783 target[p] = val; 47784 } 47785 } 47786 } 47787 } 47788 } 47789 }), 47790 p = BezierPlugin.prototype; 47791 47792 47793 BezierPlugin.bezierThrough = bezierThrough; 47794 BezierPlugin.cubicToQuadratic = cubicToQuadratic; 47795 BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite 47796 BezierPlugin.quadraticToCubic = function(a, b, c) { 47797 return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); 47798 }; 47799 47800 BezierPlugin._cssRegister = function() { 47801 var CSSPlugin = _globals.CSSPlugin; 47802 if (!CSSPlugin) { 47803 return; 47804 } 47805 var _internals = CSSPlugin._internals, 47806 _parseToProxy = _internals._parseToProxy, 47807 _setPluginRatio = _internals._setPluginRatio, 47808 CSSPropTween = _internals.CSSPropTween; 47809 _internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) { 47810 if (e instanceof Array) { 47811 e = {values:e}; 47812 } 47813 plugin = new BezierPlugin(); 47814 var values = e.values, 47815 l = values.length - 1, 47816 pluginValues = [], 47817 v = {}, 47818 i, p, data; 47819 if (l < 0) { 47820 return pt; 47821 } 47822 for (i = 0; i <= l; i++) { 47823 data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i)); 47824 pluginValues[i] = data.end; 47825 } 47826 for (p in e) { 47827 v[p] = e[p]; //duplicate the vars object because we need to alter some things which w
47827ould cause problems if the user plans to reuse the same vars object for another tween. 47828 } 47829 v.values = pluginValues; 47830 pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2); 47831 pt.data = data; 47832 pt.plugin = plugin; 47833 pt.setRatio = _setPluginRatio; 47834 if (v.autoRotate === 0) { 47835 v.autoRotate = true; 47836 } 47837 if (v.autoRotate && !(v.autoRotate instanceof Array)) { 47838 i = (v.autoRotate === true) ? 0 : Number(v.autoRotate); 47839 v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false; 47840 } 47841 if (v.autoRotate) { 47842 if (!cssp._transform) { 47843 cssp._enableTransforms(false); 47844 } 47845 data.autoRotate = cssp._target._gsTransform; 47846 data.proxy.rotation = data.autoRotate.rotation || 0; 47847 cssp._overwriteProps.push("rotation"); 47848 } 47849 plugin._onInitTween(data.proxy, v, cssp._tween); 47850 return pt; 47851 }}); 47852 }; 47853 47854 p._mod = function(lookup) { 47855 var op = this._overwriteProps, 47856 i = op.length, 47857 val; 47858 while (--i > -1) { 47859 val = lookup[op[i]]; 47860 if (val && typeof(val) === "function") { 47861 this._mod[op[i]] = val; 47862 } 47863 } 47864 }; 47865 47866 p._kill = function(lookup) { 47867 var a = this._props, 47868 p, i; 47869 for (p in this._beziers) { 47870 if (p in lookup) { 47871 delete this._beziers[p]; 47872 delete this._func[p]; 47873 i = a.length; 47874 while (--i > -1) { 47875 if (a[i] === p) { 47876 a.splice(i, 1); 47877 } 47878 } 47879 } 47880 } 47881 a = this._autoRotate; 47882 if (a) { 47883 i = a.length; 47884 while (--i > -1) { 47885 if (lookup[a[i][2]]) { 47886 a.splice(i, 1); 47887 } 47888 } 47889 } 47890 return this._super._kill.call(this, lookup); 47891 }; 47892 47893 }()); 47894 47895 47896 47897 47898 47899 47900 47901 47902 47903 47904 47905 47906 47907 47908 /* 47909 * ---------------------------------------------------------------- 47910 * CSSPlugin 47911 * ---------------------------------------------------------------- 47912 */ 47913 _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) { 47914 47915 /** @constructor **/ 47916 var CSSPlugin = function() { 47917 TweenPlugin.call(this, "css"); 47918 this._overwriteProps.length = 0; 47919 this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method) 47920 }, 47921 _globals = _gsScope._gsDefine.globals, 47922 _hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called. 47923 _suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance 47924 _cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter 47925 _overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification. 47926 _specialProps = {}, 47927 p = CSSPlugin.prototype = new TweenPlugin("css"); 47928 47929 p.constructor = CSSPlugin; 47930 CSSPlugin.version = "1.19.1"; 47931 CSSPlugin.API = 2; 47932 CSSPlugin.defaultTransformPerspective = 0; 47933 CSSPlugin.defaultSkewType = "compensated"; 47934 CSSPlugin.defaultSmoothOrigin = true; 47935 p = "px"; //we'll reuse the "p" variable to keep file size down 47936 CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""}; 47937 47938 47939 var _numExp = /(?:\-|\.|\b)(\d|\.|e\-)+/g, 47940 _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, 47941 _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)" 47942 _NaNExp = /(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g, //also allows scientific notation and doesn't kill the leading -/+ in -= and += 47943 _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g, 47944 _opacityExp = /opacity *= *([^)]*)/i, 47945 _opacityValExp = /opacity:([^;]*)/i, 47946 _alphaFilterExp = /alpha\(opacity *=.+?\)/i, 47947 _rgbhslExp = /^(rgb|hsl)/, 47948 _capsExp = /([A-Z])/g, 47949 _camelExp = /-([a-z])/gi, 47950 _urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage)
47951 _camelFunc = function(s, g) { return g.toUpperCase(); }, 47952 _horizExp = /(?:Left|Right|Width)/i, 47953 _ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi, 47954 _ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i, 47955 _commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis 47956 _complexExp = /[\s,\(]/i, //for testing a string to find if it has a space, comma, or open parenthesis (clues that it's a complex value) 47957 _DEG2RAD = Math.PI / 180, 47958 _RAD2DEG = 180 / Math.PI, 47959 _forcePT = {}, 47960 _dummyElement = {style:{}}, 47961 _doc = _gsScope.document || {createElement: function() {return _dummyElement;}}, 47962 _createElement = function(type, ns) { 47963 return _doc.createElementNS ? _doc.createElementNS(ns || "http://www.w3.org/1999/xhtml", type) : _doc.createElement(type); 47964 }, 47965 _tempDiv = _createElement("div"), 47966 _tempImg = _createElement("img"), 47967 _internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins 47968 _agent = (_gsScope.navigator || {}).userAgent || "", 47969 _autoRound, 47970 _reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance). 47971 47972 _isSafari, 47973 _isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element. 47974 _isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!) 47975 _ieVers, 47976 _supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version. 47977 var i = _agent.indexOf("Android"), 47978 a = _createElement("a"); 47979 _isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || parseFloat(_agent.substr(i+8, 2)) > 3)); 47980 _isSafariLT6 = (_isSafari && (parseFloat(_agent.substr(_agent.indexOf("Version/")+8, 2)) < 6)); 47981 _isFirefox = (_agent.indexOf("Firefox") !== -1); 47982 if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent) || (/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) { 47983 _ieVers = parseFloat( RegExp.$1 ); 47984 } 47985 if (!a) { 47986 return false; 47987 } 47988 a.style.cssText = "top:1px;opacity:.55;"; 47989 return /^0.55/.test(a.style.opacity); 47990 }()), 47991 _getIEOpacity = function(v) { 47992 return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1); 47993 }, 47994 _log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE. 47995 if (_gsScope.console) { 47996 console.log(s); 47997 } 47998 }, 47999 _target, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params 48000 _index, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params 48001 48002 _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-" 48003 _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz". 48004 48005 // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all) 48006 _checkPropPrefix = function(p, e) { 48007 e = e || _tempDiv; 48008 var s = e.style, 48009 a, i; 48010 if (s[p] !== undefined) { 48011 return p; 48012 } 48013 p = p.charAt(0).toUpperCase() + p.substr(1); 48014 a = ["O","Moz","ms","Ms","Webkit"]; 48015 i = 5; 48016 while (--i > -1 && s[a[i]+p] === undefined) { } 48017 if (i >= 0) { 48018 _prefix = (i === 3) ? "ms" : a[i]; 48019 _prefixCSS = "-" + _prefix.toLowerCase() + "-"; 48020 return _prefix + p; 48021 } 48022 return null; 48023 }, 48024 48025 _getComputedStyle = _doc.defaultView ? _doc.defaultView.getComputedStyle : function() {}, 48026 48027 /** 48028 * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do: 48029 * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left"); 48030 * 48031 * @param {!Object} t Target element whose style property you want to query 48032 * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.) 48033 * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call. 48034 * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value. 48035 * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto". 48036 * @return {?string} The current property value 48037 */ 48038 _getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) { 48039 var rv; 48040 if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here. 48041 return _getIEOpacity(t); 48042 } 48043 if (!calc && t.style[p]) { 48044 rv = t.style[p]; 48045 } else if ((cs = cs || _getComputedStyle(t))) { 48046 rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); 48047 } else if (t.currentStyle) { 48048 rv = t.currentStyle[p]; 48049 } 48050 return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv; 48051 }, 48052 48053 /** 48054 * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number. 48055 * @param {!Object} t Target element 48056 * @param {!string} p Property name (like "left", "top", "marginLeft", etc.) 48057 * @param {!number} v Value 48058 * @param {string=} sfx Suffix (like "px" or "%" or "em") 48059 * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect. 48060 * @return {number} value in pixels 48061 */ 48062 _convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) { 48063 if (sfx === "px" || !sfx) { return v; } 48064 if (sfx === "auto" || !v) { return 0; } 48065 var horiz = _horizExp.test(p), 48066 node = t, 48067 style = _tempDiv.style, 48068 neg = (v < 0), 48069 precise = (v === 1), 48070 pix, cache, time; 48071 if (neg) { 48072 v = -v; 48073 } 48074 if (precise) { 48075 v *= 100; 48076 } 48077 if (sfx === "%" && p.indexOf("border") !== -1) { 48078 pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight); 48079 } else { 48080 style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;"; 48081 if (sfx === "%" || !node.appendChild || sfx.charAt(0) === "v" || sfx === "rem") { 48082 node = t.parentNode || _doc.body; 48083 cache = node._gsCache; 48084 time = TweenLite.ticker.frame; 48085 if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick) 48086 return cache.width * v / 100; 48087 } 48088 style[(horiz ? "width" : "height")] = v + sfx; 48089 } else { 48090 style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx; 48091 } 48092 node.appendChild(_tempDiv); 48093 pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]); 48094 node.removeChild(_tempDiv); 48095 if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) { 48096 cache = node._gsCache = node._gsCache || {}; 48097 cache.time = time; 48098 cache.width = pix / v * 100; 48099 } 48100 if (pix === 0 && !recurse) { 48101 pix = _convertToPixels(t, p, v, sfx, true); 48102 } 48103 } 48104 if (precise) { 48105 pix /= 100; 48106 } 48107 return neg ? -pix : pix; 48108 }, 48109 _calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop 48110 if (_getStyle(t, "position", cs) !== "absolute") { return 0; } 48111 var dim = ((p === "left") ? "Left" : "Top"),
48112 v = _getStyle(t, "margin" + dim, cs); 48113 return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0); 48114 }, 48115 48116 // @private returns at object containing ALL of the style properties in camelCase and their associated values. 48117 _getAllStyles = function(t, cs) { 48118 var s = {}, 48119 i, tr, p; 48120 if ((cs = cs || _getComputedStyle(t, null))) { 48121 if ((i = cs.length)) { 48122 while (--i > -1) { 48123 p = cs[i]; 48124 if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. 48125 s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p); 48126 } 48127 } 48128 } else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop. 48129 for (i in cs) { 48130 if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. 48131 s[i] = cs[i]; 48132 } 48133 } 48134 } 48135 } else if ((cs = t.currentStyle || t.style)) { 48136 for (i in cs) { 48137 if (typeof(i) === "string" && s[i] === undefined) { 48138 s[i.replace(_camelExp, _camelFunc)] = cs[i]; 48139 } 48140 } 48141 } 48142 if (!_supportsOpacity) { 48143 s.opacity = _getIEOpacity(t); 48144 } 48145 tr = _getTransform(t, cs, false); 48146 s.rotation = tr.rotation; 48147 s.skewX = tr.skewX; 48148 s.scaleX = tr.scaleX; 48149 s.scaleY = tr.scaleY; 48150 s.x = tr.x; 48151 s.y = tr.y; 48152 if (_supports3D) { 48153 s.z = tr.z; 48154 s.rotationX = tr.rotationX; 48155 s.rotationY = tr.rotationY; 48156 s.scaleZ = tr.scaleZ; 48157 } 48158 if (s.filters) { 48159 delete s.filters; 48160 } 48161 return s; 48162 }, 48163 48164 // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object c
48164ontaining only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details. 48165 _cssDif = function(t, s1, s2, vars, forceLookup) { 48166 var difs = {}, 48167 style = t.style, 48168 val, p, mpt; 48169 for (p in s2) { 48170 if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") { 48171 difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween. 48172 if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes. 48173 mpt = new MiniPropTween(style, p, style[p], mpt); 48174 } 48175 } 48176 } 48177 if (vars) { 48178 for (p in vars) { //copy properties (except className) 48179 if (p !== "className") { 48180 difs[p] = vars[p]; 48181 } 48182 } 48183 } 48184 return {difs:difs, firstMPT:mpt}; 48185 }, 48186 _dimensions = {width:["Left","Right"], height:["Top","Bottom"]}, 48187 _margins = ["marginLeft","marginRight","marginTop","marginBottom"], 48188 48189 /** 48190 * @private Gets the width or height of an element 48191 * @param {!Object} t Target element 48192 * @param {!string} p Property name ("width" or "height") 48193 * @param {Object=} cs Computed style object (if one exists). Just a speed optimization. 48194 * @return {number} Dimension (in pixels) 48195 */ 48196 _getDimension = function(t, p, cs) { 48197 if ((t.nodeName + "").toLowerCase() === "svg") { //Chrome no longer supports offsetWidth/offsetHeight on SVG elements. 48198 return (cs || _getComputedStyle(t))[p] || 0; 48199 } else if (t.getCTM && _isSVG(t)) { 48200 return t.getBBox()[p] || 0; 48201 } 48202 var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight), 48203 a = _dimensions[p], 48204 i = a.length; 48205 cs = cs || _getComputedStyle(t, null); 48206 while (--i > -1) { 48207 v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0; 48208 v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0; 48209 } 48210 return v; 48211 }, 48212 48213 // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value) 48214 _parsePosition = function(v, recObj) { 48215 if (v === "contain" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto". 48216 return v + " "; 48217 } 48218 if (v == null || v === "") { 48219 v = "0 0"; 48220 } 48221 var a = v.split(" "), 48222 x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0], 48223 y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1], 48224 i; 48225 if (a.length > 3 && !recObj) { //multiple positions 48226 a = v.split(", ").join(",").split(","); 48227 v = []; 48228 for (i = 0; i < a.length; i++) { 48229 v.push(_parsePosition(a[i])); 48230 } 48231 return v.join(","); 48232 } 48233 if (y == null) { 48234 y = (x === "center") ? "50%" : "0"; 48235 } else if (y === "center") { 48236 y = "50%"; 48237 } 48238 if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it c
48238ould be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative. 48239 x = "50%"; 48240 } 48241 v = x + " " + y + ((a.length > 2) ? " " + a[2] : ""); 48242 if (recObj) { 48243 recObj.oxp = (x.indexOf("%") !== -1); 48244 recObj.oyp = (y.indexOf("%") !== -1); 48245 recObj.oxr = (x.charAt(1) === "="); 48246 recObj.oyr = (y.charAt(1) === "="); 48247 recObj.ox = parseFloat(x.replace(_NaNExp, "")); 48248 recObj.oy = parseFloat(y.replace(_NaNExp, "")); 48249 recObj.v = v; 48250 } 48251 return recObj || v; 48252 }, 48253 48254 /** 48255 * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!) 48256 * @param {(number|string)} e End value which is typically a string, but could be a number 48257 * @param {(number|string)} b Beginning value which is typically a string but could be a number 48258 * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized) 48259 */ 48260 _parseChange = function(e, b) { 48261 if (typeof(e) === "function") { 48262 e = e(_index, _target); 48263 } 48264 return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : (parseFloat(e) - parseFloat(b)) || 0; 48265 }, 48266 48267 /** 48268 * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. 48269 * @param {Object} v Value to be parsed 48270 * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) 48271 * @return {number} Parsed value 48272 */ 48273 _parseVal = function(v, d) { 48274 if (typeof(v) === "function") { 48275 v = v(_index, _target); 48276 } 48277 return (v == null) ? d : (typeof(v) === "string" && v.charAt(1) === "=") ? parseInt(v.charAt(0) + "1", 10) * parseFloat(v.substr(2)) + d : parseFloat(v) || 0; 48278 }, 48279 48280 /** 48281 * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly. 48282 * @param {Object} v Value to be parsed 48283 * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) 48284 * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY" 48285 * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation. 48286 * @return {number} parsed angle in radians 48287 */ 48288 _parseAngle = function(v, d, p, directionalEnd) { 48289 var min = 0.000001, 48290 cap, split, dif, result, isRelative; 48291 if (typeof(v) === "function") { 48292 v = v(_index, _target); 48293 } 48294 if (v == null) { 48295 result = d; 48296 } else if (typeof(v) === "number") { 48297 result = v; 48298 } else { 48299 cap = 360; 48300 split = v.split("_"); 48301 isRelative = (v.charAt(1) === "="); 48302 dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d); 48303 if (split.length) { 48304 if (directionalEnd) { 48305 directionalEnd[p] = d + dif; 48306 } 48307 if (v.indexOf("short") !== -1) { 48308 dif = dif % cap; 48309 if (dif !== dif % (cap / 2)) { 48310 dif = (dif < 0) ? dif + cap : dif - cap; 48311 } 48312 } 48313 if (v.indexOf("_cw") !== -1 && dif < 0) { 48314 dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; 48315 } else if (v.indexOf("ccw") !== -1 && dif > 0) { 48316 dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; 48317 } 48318 } 48319 result = d + dif; 48320 } 48321 if (result < min && result > -min) { 48322 result = 0; 48323 } 48324 return result; 48325 }, 48326 48327 _colorLookup = {aqua:[0,255,255], 48328 lime:[0,255,0], 48329 silver:[192,192,192], 48330 black:[0,0,0], 48331 maroon:[128,0,0], 48332 teal:[0,128,128], 48333 blue:[0,0,255], 48334 navy:[0,0,128], 48335 white:[255,255,255], 48336 fuchsia:[255,0,255], 48337 olive:[128,128,0], 48338 yellow:[255,255,0], 48339 orange:[255,165,0], 48340 gray:[128,128,128], 48341 purple:[128,0,128], 48342 green:[0,128,0], 48343 red:[255,0,0], 48344 pink:[255,192,203], 48345 cyan:[0,255,255], 48346 transparent:[255,255,255,0]}, 48347 48348 _hue = function(h, m1, m2) { 48349 h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; 48350 return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; 48351 }, 48352 48353 /** 48354 * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). 48355 * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. 48356 * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() 48357 * @return {Array.<number>} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. 48358 */ 48359 _parseColor = CSSPlugin.parseColor = function(v, toHSL) { 48360 var a, r, g, b, h, s, l, max, min, d, wasHSL; 48361 if (!v) { 48362 a = _colorLookup.black; 48363 } else if (typeof(v) === "number") { 48364 a = [v >> 16, (v >> 8) & 255, v & 255]; 48365 } else { 48366 if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. 48367 v = v.substr(0, v.length - 1); 48368 } 48369 if (_colorLookup[v]) { 48370 a = _colorLookup[v]; 48371 } else if (v.charAt(0) === "#") { 48372 if (v.length === 4) { //for shorthand like #9F0 48373 r = v.charAt(1); 48374 g = v.charAt(2); 48375 b = v.charAt(3); 48376 v = "#" + r + r + g + g + b + b; 48377 } 48378 v = parseInt(v.substr(1), 16); 48379 a = [v >> 16, (v >> 8) & 255, v & 255]; 48380 } else if (v.substr(0, 3) === "hsl") { 48381 a = wasHSL = v.match(_numExp); 48382 if (!toHSL) { 48383 h = (Number(a[0]) % 360) / 360;
48384 s = Number(a[1]) / 100; 48385 l = Number(a[2]) / 100; 48386 g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; 48387 r = l * 2 - g; 48388 if (a.length > 3) { 48389 a[3] = Number(v[3]); 48390 } 48391 a[0] = _hue(h + 1 / 3, r, g); 48392 a[1] = _hue(h, r, g); 48393 a[2] = _hue(h - 1 / 3, r, g); 48394 } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. 48395 return v.match(_relNumExp); 48396 } 48397 } else { 48398 a = v.match(_numExp) || _colorLookup.transparent; 48399 } 48400 a[0] = Number(a[0]); 48401 a[1] = Number(a[1]); 48402 a[2] = Number(a[2]); 48403 if (a.length > 3) { 48404 a[3] = Number(a[3]); 48405 } 48406 } 48407 if (toHSL && !wasHSL) { 48408 r = a[0] / 255; 48409 g = a[1] / 255; 48410 b = a[2] / 255; 48411 max = Math.max(r, g, b); 48412 min = Math.min(r, g, b); 48413 l = (max + min) / 2; 48414 if (max === min) { 48415 h = s = 0; 48416 } else { 48417 d = max - min; 48418 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 48419 h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; 48420 h *= 60; 48421 } 48422 a[0] = (h + 0.5) | 0; 48423 a[1] = (s * 100 + 0.5) | 0; 48424 a[2] = (l * 100 + 0.5) | 0; 48425 } 48426 return a; 48427 }, 48428 _formatColors = function(s, toHSL) { 48429 var colors = s.match(_colorExp) || [], 48430 charIndex = 0, 48431 parsed = colors.length ? "" : s, 48432 i, color, temp; 48433 for (i = 0; i < colors.length; i++) { 48434 color = colors[i]; 48435 temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); 48436 charIndex += temp.length + color.length; 48437 color = _parseColor(color, toHSL); 48438 if (color.length === 3) { 48439 color.push(1); 48440 } 48441 parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; 48442 } 48443 return parsed + s.substr(charIndex); 48444 }, 48445 _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. 48446 48447 for (p in _colorLookup) { 48448 _colorExp += "|" + p + "\\b"; 48449 } 48450 _colorExp = new RegExp(_colorExp+")", "gi"); 48451 48452 CSSPlugin.colorStringFilter = function(a) { 48453 var combined = a[0] + a[1], 48454 toHSL; 48455 if (_colorExp.test(combined)) { 48456 toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); 48457 a[0] = _formatColors(a[0], toHSL); 48458 a[1] = _formatColors(a[1], toHSL); 48459 } 48460 _colorExp.lastIndex = 0; 48461 }; 48462 48463 if (!TweenLite.defaultStringFilter) { 48464 TweenLite.defaultStringFilter = CSSPlugin.colorStringFilter; 48465 } 48466 48467 /** 48468 * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned. 48469 * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned. 48470 * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't. 48471 * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc. 48472 * @return {Function} formatter function 48473 */ 48474 var _getFormatter = function(dflt, clr, collapsible, multi) { 48475 if (dflt == null) { 48476 return function(v) {return v;}; 48477 } 48478 var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "", 48479 dVals = dflt.split(dColor).join("").match(_valuesExp) || [], 48480 pfx = dflt.substr(0, dflt.indexOf(dVals[0])), 48481 sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "", 48482 delim = (dflt.indexOf(" ") !== -1) ? " " : ",", 48483 numVals = dVals.length, 48484 dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "", 48485 formatter; 48486 if (!numVals) { 48487 return function(v) {return v;}; 48488 } 48489 if (clr) { 48490 formatter = function(v) { 48491 var color, vals, i, a; 48492 if (typeof(v) === "number") { 48493 v += dSfx; 48494 } else if (multi && _commasOutsideParenExp.test(v)) { 48495 a = v.replace(_commasOutsideParenExp, "|").split("|"); 48496 for (i = 0; i < a.length; i++) { 48497 a[i] = formatter(a[i]); 48498 } 48499 return a.join(","); 48500 } 48501 color = (v.match(_colorExp) || [dColor])[0]; 48502 vals = v.split(color).join("").match(_valuesExp) || []; 48503 i = vals.length; 48504 if (numVals > i--) { 48505 while (++i < numVals) { 48506 vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; 48507 } 48508 } 48509 return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : ""); 48510 }; 48511 return formatter; 48512 48513 } 48514 formatter = function(v) { 48515 var vals, a, i; 48516 if (typeof(v) === "number") { 48517 v += dSfx; 48518 } else if (multi && _commasOutsideParenExp.test(v)) { 48519 a = v.replace(_commasOutsideParenExp, "|").split("|"); 48520 for (i = 0; i < a.length; i++) { 48521 a[i] = formatter(a[i]); 48522 } 48523 return a.join(","); 48524 } 48525 vals = v.match(_valuesExp) || []; 48526 i = vals.length; 48527 if (numVals > i--) { 48528 while (++i < numVals) { 48529 vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; 48530 } 48531 } 48532 return pfx + vals.join(delim) + sfx; 48533 }; 48534 return formatter; 48535 }, 48536 48537 /** 48538 * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges. 48539 * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft" 48540 * @return {Function} a formatter function 48541 */ 48542 _getEdgeParser = function(props) { 48543 props = props.split(","); 48544 return function(t, e, p, cssp, pt, plugin, vars) { 48545 var a = (e + "").split(" "), 48546 i; 48547 vars = {}; 48548 for (i = 0; i < 4; i++) { 48549 vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)]; 48550 } 48551 return cssp.parse(t, vars, pt, plugin); 48552 }; 48553 }, 48554 48555 // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color. 48556 _setPluginRatio = _internals._setPluginRatio = function(v) { 48557 this.plugin.setRatio(v); 48558 var d = this.data, 48559 proxy = d.proxy, 48560 mpt = d.firstMPT, 48561 min = 0.000001, 48562 val, pt, i, str, p; 48563 while (mpt) { 48564 val = proxy[mpt.v]; 48565 if (mpt.r) { 48566 val = Math.round(val); 48567 } else if (val < min && val > -min) { 48568 val = 0; 48569 } 48570 mpt.t[mpt.p] = val; 48571 mpt = mpt._next; 48572 } 48573 if (d.autoRotate) { 48574 d.autoRotate.rotation = d.mod ? d.mod(proxy.rotation, this.t) : proxy.rotation; //special case for ModifyPlugin to hook into an auto-rotating bezier 48575 } 48576 //at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method. Same for "b" at the beginning. 48577 if (v === 1 || v === 0) { 48578 mpt = d.firstMPT; 48579 p = (v === 1) ? "e" : "b"; 48580 while (mpt) { 48581 pt = mpt.t; 48582 if (!pt.type) { 48583 pt[p] = pt.s + pt.xs0; 48584 } else if (pt.type === 1) { 48585 str = pt.xs0 + pt.s + pt.xs1; 48586 for (i = 1; i < pt.l; i++) {
48587 str += pt["xn"+i] + pt["xs"+(i+1)]; 48588 } 48589 pt[p] = str; 48590 } 48591 mpt = mpt._next; 48592 } 48593 } 48594 }, 48595 48596 /** 48597 * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value. 48598 * @param {!Object} t target object whose property we're tweening (often a CSSPropTween) 48599 * @param {!string} p property name 48600 * @param {(number|string|object)} v value 48601 * @param {MiniPropTween=} next next MiniPropTween in the linked list 48602 * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer 48603 */ 48604 MiniPropTween = function(t, p, v, next, r) { 48605 this.t = t; 48606 this.p = p; 48607 this.v = v; 48608 this.r = r; 48609 if (next) { 48610 next._prev = this; 48611 this._next = next; 48612 } 48613 }, 48614 48615 /** 48616 * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element. 48617 * This method returns an object that has the following properties:
48618 * - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin. This is what we feed to the external _onInitTween() as the target 48619 * - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values 48620 * - firstMPT: the first MiniPropTween in the linked list 48621 * - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter. 48622 * @param {!Object} t target object to be tweened 48623 * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed 48624 * @param {!CSSPlugin} cssp The CSSPlugin instance 48625 * @param {CSSPropTween=} pt the next CSSPropTween in the linked list 48626 * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values 48627 * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter. 48628 * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions) 48629 */ 48630 _parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) { 48631 var bpt = pt, 48632 start = {}, 48633 end = {}, 48634 transform = cssp._transform, 48635 oldForce = _forcePT, 48636 i, p, xp, mpt, firstPT; 48637 cssp._transform = null; 48638 _forcePT = vars; 48639 pt = firstPT = cssp.parse(t, vars, pt, plugin); 48640 _forcePT = oldForce; 48641 //break off from the linked list so the new ones are isolated. 48642 if (shallow) { 48643 cssp._transform = transform; 48644 if (bpt) { 48645 bpt._prev = null; 48646 if (bpt._prev) { 48647 bpt._prev._next = null; 48648 } 48649 } 48650 } 48651 while (pt && pt !== bpt) { 48652 if (pt.type <= 1) { 48653 p = pt.p; 48654 end[p] = pt.s + pt.c; 48655 start[p] = pt.s; 48656 if (!shallow) { 48657 mpt = new MiniPropTween(pt, "s", p, mpt, pt.r); 48658 pt.c = 0; 48659 } 48660 if (pt.type === 1) { 48661 i = pt.l; 48662 while (--i > 0) { 48663 xp = "xn" + i; 48664 p = pt.p + "_" + xp; 48665 end[p] = pt.data[xp]; 48666 start[p] = pt[xp]; 48667 if (!shallow) { 48668 mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]); 48669 } 48670 } 48671 } 48672 } 48673 pt = pt._next; 48674 } 48675 return {proxy:start, end:end, firstMPT:mpt, pt:firstPT}; 48676 }, 48677 48678 48679 48680 /** 48681 * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory. 48682 * CSSPropTweens have the following optional properties as well (not defined through the constructor): 48683 * - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc. 48684 * - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list) 48685 * - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subt
48685weens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request. 48686 * - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target. 48687 * - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible. 48688 * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything. 48689 * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width". 48690 * @param {number} s Starting numeric value 48691 * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95. 48692 * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it. 48693 * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update. 48694 * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip" 48695 * @param {boolean=} r If true, the value(s) should be rounded 48696 * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0. 48697 * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues. 48698 * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues. 48699 */ 48700 CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) { 48701 this.t = t; //target 48702 this.p = p; //property 48703 this.s = s; //starting value 48704 this.c = c; //change value 48705 this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at) 48706 if (!(t instanceof CSSPropTween)) { 48707 _overwriteProps.push(this.n); 48708 } 48709 this.r = r; //round (boolean) 48710 this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work 48711 if (pr) { 48712 this.pr = pr; 48713 _hasPriority = true; 48714 } 48715 this.b = (b === undefined) ? s : b; 48716 this.e = (e === undefined) ? s + c : e; 48717 if (next) { 48718 this._next = next; 48719 next._prev = this; 48720 } 48721 }, 48722 48723 _addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween
48724 var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp); 48725 pt.b = start; 48726 pt.e = pt.xs0 = end; 48727 return pt; 48728 }, 48729 48730 /** 48731 * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example: 48732 * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt); 48733 * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio(). 48734 * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method. 48735 * 48736 * @param {!Object} t Target whose property will be tweened 48737 * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow") 48738 * @param {string} b Beginning value 48739 * @param {string} e Ending value 48740 * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization) 48741 * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match 48742 * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this). 48743 * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0. 48744 * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300} 48745 * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here. 48746 * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call. 48747 */ 48748 _parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) { 48749 //DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e); 48750 b = b || dflt || ""; 48751 if (typeof(e) === "function") { 48752 e = e(_index, _target); 48753 } 48754 pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e); 48755 e += ""; //ensures it's a string 48756 if (clrs && _colorExp.test(e + b)) { //if colors are found, normalize the formatting to rgba() or hsla(). 48757 e = [b, e]; 48758 CSSPlugin.colorStringFilter(e); 48759 b = e[0]; 48760 e = e[1]; 48761 } 48762 var ba = b.split(", ").join(",").split(" "), //beginning array 48763 ea = e.split(", ").join(",").split(" "), //ending array 48764 l = ba.length, 48765 autoRound = (_autoRound !== false), 48766 i, xi, ni, bv, ev, bnums, enums, bn, hasAlpha, temp, cv, str, useHSL; 48767 if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) { 48768 ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); 48769 ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); 48770 l = ba.length; 48771 } 48772 if (l !== ea.length) { 48773 //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); 48774 ba = (dflt || "").split(" "); 48775 l = ba.length; 48776 } 48777 pt.plugin = plugin; 48778 pt.setRatio = setRatio; 48779 _colorExp.lastIndex = 0; 48780 for (i = 0; i < l; i++) { 48781 bv = ba[i]; 48782 ev = ea[i]; 48783 bn = parseFloat(bv); 48784 //if the value begins with a number (most common). It's fine if it has a suffix like px 48785 if (bn || bn === 0) { 48786 pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1), true); 48787 48788 //if the value is a color 48789 } else if (clrs && _colorExp.test(bv)) { 48790 str = ev.indexOf(")") + 1; 48791 str = ")" + (str ? ev.substr(str) : ""); //if there's a comma or ) at the end, retain it. 48792 useHSL = (ev.indexOf("hsl") !== -1 && _supportsOpacity); 48793 bv = _parseColor(bv, useHSL); 48794 ev = _parseColor(ev, useHSL); 48795 hasAlpha = (bv.length + ev.length > 6); 48796 if (hasAlpha && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color 48797 pt["xs" + pt.l] += pt.l ? " transparent" : "transparent";
48798 pt.e = pt.e.split(ea[i]).join("transparent"); 48799 } else { 48800 if (!_supportsOpacity) { //old versions of IE don't support rgba(). 48801 hasAlpha = false; 48802 } 48803 if (useHSL) { 48804 pt.appendXtra((hasAlpha ? "hsla(" : "hsl("), bv[0], _parseChange(ev[0], bv[0]), ",", false, true) 48805 .appendXtra("", bv[1], _parseChange(ev[1], bv[1]), "%,", false) 48806 .appendXtra("", bv[2], _parseChange(ev[2], bv[2]), (hasAlpha ? "%," : "%" + str), false); 48807 } else { 48808 pt.appendXtra((hasAlpha ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", true, true) 48809 .appendXtra("", bv[1], ev[1] - bv[1], ",", true) 48810 .appendXtra("", bv[2], ev[2] - bv[2], (hasAlpha ? "," : str), true); 48811 } 48812 48813 if (hasAlpha) { 48814 bv = (bv.length < 4) ? 1 : bv[3]; 48815 pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false); 48816 } 48817 } 48818 _colorExp.lastIndex = 0; //otherwise the test() on the RegExp could move the lastIndex and taint future results. 48819 48820 } else { 48821 bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array 48822 48823 //if no number is found, treat it as a non-tweening value and just append the string to the current xs. 48824 if (!bnums) { 48825 pt["xs" + pt.l] += (pt.l || pt["xs" + pt.l]) ? " " + ev : ev; 48826 48827 //loop through all the numbers that are found and construct the extra values on the pt. 48828 } else { 48829 enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5 48830 if (!enums || enums.length !== bnums.length) { 48831 //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); 48832 return pt; 48833 } 48834 ni = 0; 48835 for (xi = 0; xi < bnums.length; xi++) { 48836 cv = bnums[xi]; 48837 temp = bv.indexOf(cv, ni); 48838 pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px"), (xi === 0)); 48839 ni = temp + cv.length; 48840 } 48841 pt["xs" + pt.l] += bv.substr(ni); 48842 } 48843 } 48844 } 48845 //if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly. 48846 if (e.indexOf("=") !== -1) if (pt.data) { 48847 str = pt.xs0 + pt.data.s; 48848 for (i = 1; i < pt.l; i++) { 48849 str += pt["xs" + i] + pt.data["xn" + i]; 48850 } 48851 pt.e = str + pt["xs" + i]; 48852 } 48853 if (!pt.l) { 48854 pt.type = -1; 48855 pt.xs0 = pt.e; 48856 } 48857 return pt.xfirst || pt; 48858 }, 48859 i = 9; 48860 48861 48862 p = CSSPropTween.prototype; 48863 p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc. 48864 while (--i > 0) { 48865 p["xn" + i] = 0; 48866 p["xs" + i] = ""; 48867 } 48868 p.xs0 = ""; 48869 p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null; 48870 48871 48872 /** 48873 * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this: 48874 * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)" 48875 * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method). 48876 * @param {string=} pfx Prefix (if any) 48877 * @param {!number} s Starting value 48878 * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95. 48879 * @param {string=} sfx Suffix (if any) 48880 * @param {boolean=} r Round (if true). 48881 * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space. 48882 * @return {CSSPropTween} returns itself so that multiple methods can be chained together. 48883 */ 48884 p.appendXtra = function(pfx, s, c, sfx, r, pad) { 48885 var pt = this, 48886 l = pt.l; 48887 pt["xs" + l] += (pad && (l || pt["xs" + l])) ? " " + pfx : pfx || ""; 48888 if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value! 48889 pt["xs" + l] += s + (sfx || ""); 48890 return pt; 48891 } 48892 pt.l++; 48893 pt.type = pt.setRatio ? 2 : 1; 48894 pt["xs" + pt.l] = sfx || ""; 48895 if (l > 0) { 48896 pt.data["xn" + l] = s + c; 48897 pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method) 48898 pt["xn" + l] = s; 48899 if (!pt.plugin) { 48900 pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr); 48901 pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly. 48902 } 48903 return pt; 48904 } 48905 pt.data = {s:s + c}; 48906 pt.rxp = {}; 48907 pt.s = s; 48908 pt.c = c; 48909 pt.r = r; 48910 return pt; 48911 }; 48912 48913 /** 48914 * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly. 48915 * @param {!string} p Property name (like "boxShadow" or "throwProps") 48916 * @param {Object=}
48916 options An object containing any of the following configuration options: 48917 * - defaultValue: the default value 48918 * - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker) 48919 * - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.) 48920 * - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O) 48921 * - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc. 48922 * - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0. 48923 * - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out. 48924 * - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc. 48925 * - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default). 48926 */ 48927 var SpecialProp = function(p, options) { 48928 options = options || {}; 48929 this.p = options.prefix ? _checkPropPrefix(p) || p : p; 48930 _specialProps[p] = _specialProps[this.p] = this; 48931 this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi); 48932 if (options.parser) { 48933 this.parse = options.parser; 48934 } 48935 this.clrs = options.color; 48936 this.multi = options.multi; 48937 this.keyword = options.keyword; 48938 this.dflt = options.defaultValue; 48939 this.pr = options.priority || 0; 48940 }, 48941 48942 //shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin. 48943 _registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) { 48944 if (typeof(options) !== "object") { 48945 options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin 48946 } 48947 var a = p.split(","), 48948 d = options.defaultValue, 48949 i, temp; 48950 defaults = defaults || [d]; 48951 for (i = 0; i < a.length; i++) { 48952 options.prefix = (i === 0 && options.prefix); 48953 options.defaultValue = defaults[i] || d; 48954 temp = new SpecialProp(a[i], options); 48955 } 48956 }, 48957 48958 //creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file. 48959 _registerPluginProp = _internals._registerPluginProp = function(p) { 48960 if (!_specialProps[p]) { 48961 var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin"; 48962 _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) { 48963 var pluginClass = _globals.com.greensock.plugins[pluginName]; 48964 if (!pluginClass) { 48965 _log("Error: " + pluginName + " js file not loaded."); 48966 return pt; 48967 } 48968 pluginClass._cssRegister(); 48969 return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars); 48970 }}
48970); 48971 } 48972 }; 48973 48974 48975 p = SpecialProp.prototype; 48976 48977 /** 48978 * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list) 48979 * @param {!Object} t target element 48980 * @param {(string|number|object)} b beginning value 48981 * @param {(string|number|object)} e ending (destination) value 48982 * @param {CSSPropTween=} pt next CSSPropTween in the linked list 48983 * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here. 48984 * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here. 48985 * @return {CSSPropTween=} First CSSPropTween in the linked list 48986 */ 48987 p.parseComplex = function(t, b, e, pt, plugin, setRatio) { 48988 var kwd = this.keyword, 48989 i, ba, ea, l, bi, ei; 48990 //if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example) 48991 if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) { 48992 ba = b.replace(_commasOutsideParenExp, "|").split("|"); 48993 ea = e.replace(_commasOutsideParenExp, "|").split("|"); 48994 } else if (kwd) { 48995 ba = [b]; 48996 ea = [e]; 48997 } 48998 if (ea) { 48999 l = (ea.length > ba.length) ? ea.length : ba.length; 49000 for (i = 0; i < l; i++) { 49001 b = ba[i] = ba[i] || this.dflt; 49002 e = ea[i] = ea[i] || this.dflt; 49003 if (kwd) { 49004 bi = b.indexOf(kwd); 49005 ei = e.indexOf(kwd); 49006 if (bi !== ei) { 49007 if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one. 49008 ba[i] = ba[i].split(kwd).join(""); 49009 } else if (bi === -1) { //if the keyword isn't in the beginning, add it. 49010 ba[i] += " " + kwd; 49011 } 49012 } 49013 } 49014 } 49015 b = ba.join(", "); 49016 e = ea.join(", "); 49017 } 49018 return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio); 49019 }; 49020 49021 /** 49022 * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call: 49023 * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this); 49024 * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that). 49025 * @param {!Object} t Target object whose property is being tweened 49026 * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object). 49027 * @param {!string} p Property name 49028 * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween. 49029 * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it) 49030 * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance. 49031 * @param {Object=} vars Original vars object that contains the data for parsing. 49032 * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call. 49033 */ 49034 p.parse = function(t, e, p, cssp, pt, plugin, vars) { 49035 return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin); 49036 }; 49037 49038 /** 49039 * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters: 49040 * 1) Target object whose property should be tweened (typically a DOM element) 49041 * 2) The end/destination value (could be a string, number, object, or whatever you want) 49042 * 3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration) 49043 * 49044 * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example: 49045 * 49046 * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) { 49047 * var start = target.style.width;
49048 * return function(ratio) { 49049 * target.style.width = (start + value * ratio) + "px"; 49050 * console.log("set width to " + target.style.width); 49051 * } 49052 * }, 0); 49053 * 49054 * Then, when I do this tween, it will trigger my special property: 49055 * 49056 * TweenLite.to(element, 1, {css:{myCustomProp:100}}); 49057 * 49058 * In the example, of course, we're just changing the width, but you can do anything you want. 49059 * 49060 * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}}) 49061 * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function. 49062 * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones. 49063 */ 49064 CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) { 49065 _registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) { 49066 var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority); 49067 rv.plugin = plugin; 49068 rv.setRatio = onInitTween(t, e, cssp._tween, p); 49069 return rv; 49070 }, priority:priority}); 49071 }; 49072 49073 49074 49075 49076 49077 49078 //transform-related methods and properties 49079 CSSPlugin.useSVGTransformAttr = true; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this). 49080 var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","), 49081 _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform. 49082 _transformPropCSS = _prefixCSS + "transform", 49083 _transformOriginProp = _checkPropPrefix("transformOrigin"), 49084 _supports3D = (_checkPropPrefix("perspective") !== null), 49085 Transform = _internals.Transform = function() { 49086 this.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0; 49087 this.force3D = (CSSPlugin.defaultForce3D === false || !_supports3D) ? false : CSSPlugin.defaultForce3D || "auto"; 49088 }, 49089 _SVGElement = _gsScope.SVGElement, 49090 _useSVGTransformAttr, 49091 //Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future. 49092 49093 _createSVG = function(type, container, attributes) { 49094 var element = _doc.createElementNS("http://www.w3.org/2000/svg", type), 49095 reg = /([a-z])([A-Z])/g, 49096 p; 49097 for (p in attributes) { 49098 element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]); 49099 } 49100 container.appendChild(element); 49101 return element; 49102 }, 49103 _docElement = _doc.documentElement || {}, 49104 _forceSVGTransformAttr = (function() { 49105 //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element 49106 var force = _ieVers || (/Android/i.test(_agent) && !_gsScope.chrome), 49107 svg, rect, width; 49108 if (_doc.createElementNS && !force) { //IE8 and earlier doesn't support SVG anyway 49109 svg = _createSVG("svg", _docElement); 49110 rect = _createSVG("rect", svg, {width:100, height:50, x:100}); 49111 width = rect.getBoundingClientRect().width; 49112 rect.style[_transformOriginProp] = "50% 50%"; 49113 rect.style[_transformProp] = "scaleX(0.5)"; 49114 force = (width === rect.getBoundingClientRect().width && !(_is
49114Firefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D). 49115 _docElement.removeChild(svg); 49116 } 49117 return force; 49118 })(), 49119 _parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin, skipRecord) { 49120 var tm = e._gsTransform, 49121 m = _getMatrix(e, true), 49122 v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld; 49123 if (tm) { 49124 xOriginOld = tm.xOrigin; //record the original values before we alter them. 49125 yOriginOld = tm.yOrigin; 49126 } 49127 if (!absolute || (v = absolute.split(" ")).length < 2) { 49128 b = e.getBBox(); 49129 if (b.x === 0 && b.y === 0 && b.width + b.height === 0) { //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. 49130 b = {x: parseFloat(e.hasAttribute("x") ? e.getAttribute("x") : e.hasAttribute("cx") ? e.getAttribute("cx") : 0) || 0, y: parseFloat(e.hasAttribute("y") ? e.getAttribute("y") : e.hasAttribute("cy") ? e.getAttribute("cy") : 0) || 0, width:0, height:0}; 49131 } 49132 local = _parsePosition(local).split(" "); 49133 v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x, 49134 (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y]; 49135 } 49136 decoratee.xOrigin = xOrigin = parseFloat(v[0]); 49137 decoratee.yOrigin = yOrigin = parseFloat(v[1]); 49138 if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas. 49139 a = m[0]; 49140 b = m[1]; 49141 c = m[2]; 49142 d = m[3]; 49143 tx = m[4]; 49144 ty = m[5]; 49145 determinant = (a * d - b * c); 49146 if (determinant) { //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. 49147 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant); 49148 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant); 49149 xOrigin = decoratee.xOrigin = v[0] = x; 49150 yOrigin = decoratee.yOrigin = v[1] = y; 49151 } 49152 } 49153 if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly 49154 if (skipRecord) { 49155 decoratee.xOffset = tm.xOffset; 49156 decoratee.yOffset = tm.yOffset; 49157 tm = decoratee; 49158 } 49159 if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) { 49160 x = xOrigin - xOriginOld; 49161 y = yOrigin - yOriginOld; 49162 //originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility. 49163 //tm.x -= x - (x * m[0] + y * m[2]); 49164 //tm.y -= y - (x * m[1] + y * m[3]); 49165 tm.xOffset += (x * m[0] + y * m[2]) - x; 49166 tm.yOffset += (x * m[1] + y * m[3]) - y; 49167 } else { 49168 tm.xOffset = tm.yOffset = 0; 49169 } 49170 } 49171 if (!skipRecord) { 49172 e.setAttribute("data-svg-origin", v.join(" ")); 49173 } 49174 }, 49175 _getBBoxHack = function(swapIfPossible) { //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a <defs> element and/or <mask>. We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). 49176 var svg = _createElement("svg", this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), 49177 oldParent = this.parentNode, 49178 oldSibling = this.nextSibling, 49179 oldCSS = this.style.cssText, 49180 bbox; 49181 _docElement.appendChild(svg); 49182 svg.appendChild(this); 49183 this.style.display = "block"; 49184 if (swapIfPossible) { 49185 try { 49186 bbox = this.getBBox(); 49187 this._originalGetBBox = this.getBBox; 49188 this.getBBox = _getBBoxHack; 49189 } catch (e) { } 49190 } else if (this._originalGetBBox) { 49191 bbox = this._originalGetBBox(); 49192 } 49193 if (oldSibling) { 49194 oldParent.insertBefore(this, oldSibling); 49195 } else { 49196 oldParent.appendChild(this); 49197 } 49198 _docElement.removeChild(svg); 49199 this.style.cssText = oldCSS; 49200 return bbox; 49201 }, 49202 _getBBox = function(e) { 49203 try { 49204 return e.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a <symbol> or <defs>). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 49205 } catch (error) { 49206 return _getBBoxHack.call(e, true); 49207 } 49208 }, 49209 _isSVG = function(e) { //reports if the element is an SVG on which getBBox() actually works 49210 return !!(_SVGElement && e.getCTM && _getBBox(e) && (!e.parentNode || e.ownerSVGElement)); 49211 }, 49212 _identity2DMatrix = [1,0,0,1,0,0], 49213 _getMatrix = function(e, force2D) { 49214 var tm = e._gsTransform || new Transform(), 49215 rnd = 100000, 49216 style = e.style, 49217 isDefault, s, m, n, dec, none; 49218 if (_transformProp) { 49219 s = _getStyle(e, _transformPropCSS, null, true); 49220 } else if (e.currentStyle) { 49221 //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix. 49222 s = e.currentStyle.filter.match(_ieGetMatrixExp); 49223 s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : ""; 49224 }
49225 isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); 49226 if (isDefault && _transformProp && ((none = (_getComputedStyle(e).display === "none")) || !e.parentNode)) { 49227 if (none) { //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". 49228 n = style.display; 49229 style.display = "block"; 49230 } 49231 if (!e.parentNode) { 49232 dec = 1; //flag 49233 _docElement.appendChild(e); 49234 } 49235 s = _getStyle(e, _transformPropCSS, null, true); 49236 isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); 49237 if (n) { 49238 style.display = n; 49239 } else if (none) { 49240 _removeProp(style, "display"); 49241 } 49242 if (dec) { 49243 _docElement.removeChild(e); 49244 } 49245 } 49246 if (tm.svg || (e.getCTM && _isSVG(e))) { 49247 if (isDefault && (style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values 49248 s = style[_transformProp]; 49249 isDefault = 0; 49250 } 49251 m = e.getAttribute("transform"); 49252 if (isDefault && m) { 49253 if (m.indexOf("matrix") !== -1) { //just in case there's a "transform" value specified as an attribute instead of CSS style. Accept either a matrix() or simple translate() value though. 49254 s = m; 49255 isDefault = 0; 49256 } else if (m.indexOf("translate") !== -1) { 49257 s = "matrix(1,0,0,1," + m.match(/(?:\-|\b)[\d\-\.e]+\b/gi).join(",") + ")"; 49258 isDefault = 0; 49259 } 49260 } 49261 } 49262 if (isDefault) { 49263 return _identity2DMatrix; 49264 } 49265 //split the matrix values out into an array (m for matrix) 49266 m = (s || "").match(_numExp) || []; 49267 i = m.length; 49268 while (--i > -1) { 49269 n = Number(m[i]); 49270 m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example). 49271 } 49272 return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m; 49273 }, 49274 49275 /** 49276 * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. 49277 * @param {!Object} t target element 49278 * @param {Object=} cs computed style object (optional) 49279 * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...} 49280 * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style) 49281 * @return {object}
49281 object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...} 49282 */ 49283 _getTransform = _internals.getTransform = function(t, cs, rec, parse) { 49284 if (t._gsTransform && rec && !parse) { 49285 return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things. 49286 } 49287 var tm = rec ? t._gsTransform || new Transform() : new Transform(), 49288 invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. 49289 min = 0.00002, 49290 rnd = 100000, 49291 zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0, 49292 defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0, 49293 m, i, scaleX, scaleY, rotation, skewX; 49294 49295 tm.svg = !!(t.getCTM && _isSVG(t)); 49296 if (tm.svg) { 49297 _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin")); 49298 _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr; 49299 } 49300 m = _getMatrix(t); 49301 if (m !== _identity2DMatrix) { 49302 49303 if (m.length === 16) { 49304 //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values) 49305 var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3], 49306 a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7], 49307 a13 = m[8], a23 = m[9], a33 = m[10], 49308 a14 = m[12], a24 = m[13], a34 = m[14], 49309 a43 = m[11], 49310 angle = Math.atan2(a32, a33), 49311 t1, t2, t3, t4, cos, sin; 49312 49313 //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari 49314 if (tm.zOrigin) { 49315 a34 = -tm.zOrigin; 49316 a14 = a13*a34-m[12]; 49317 a24 = a23*a34-m[13]; 49318 a34 = a33*a34+tm.zOrigin-m[14]; 49319 } 49320 tm.rotationX = angle * _RAD2DEG; 49321 //rotationX 49322 if (angle) { 49323 cos = Math.cos(-angle); 49324 sin = Math.sin(-angle); 49325 t1 = a12*cos+a13*sin; 49326 t2 = a22*cos+a23*sin; 49327 t3 = a32*cos+a33*sin; 49328 a13 = a12*-sin+a13*cos; 49329 a23 = a22*-sin+a23*cos; 49330 a33 = a32*-sin+a33*cos; 49331 a43 = a42*-sin+a43*cos; 49332 a12 = t1; 49333 a22 = t2; 49334 a32 = t3; 49335 } 49336 //rotationY 49337 angle = Math.atan2(-a31, a33); 49338 tm.rotationY = angle * _RAD2DEG; 49339 if (angle) { 49340 cos = Math.cos(-angle); 49341 sin = Math.sin(-angle); 49342 t1 = a11*cos-a13*sin; 49343 t2 = a21*cos-a23*sin; 49344 t3 = a31*cos-a33*sin; 49345 a23 = a21*sin+a23*cos; 49346 a33 = a31*sin+a33*cos; 49347 a43 = a41*sin+a43*cos; 49348 a11 = t1; 49349 a21 = t2; 49350 a31 = t3; 49351 } 49352 //rotationZ 49353 angle = Math.atan2(a21, a11); 49354 tm.rotation = angle * _RAD2DEG; 49355 if (angle) { 49356 cos = Math.cos(-angle); 49357 sin = Math.sin(-angle); 49358 a11 = a11*cos+a12*sin; 49359 t2 = a21*cos+a22*sin; 49360 a22 = a21*-sin+a22*cos; 49361 a32 = a31*-sin+a32*cos; 49362 a21 = t2; 49363 } 49364 49365 if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. 49366 tm.rotationX = tm.rotation = 0; 49367 tm.rotationY = 180 - tm.rotationY; 49368 } 49369 49370 tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd; 49371 tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd; 49372 tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd; 49373 if (tm.rotationX || tm.rotationY) { 49374 tm.skewX = 0; 49375 } else { 49376 tm.skewX = (a12 || a22) ? Math.atan2(a12, a22) * _RAD2DEG + tm.rotation : tm.skewX || 0; 49377 if (Math.abs(tm.skewX) > 90 && Math.abs(tm.skewX) < 270) { 49378 if (invX) { 49379 tm.scaleX *= -1; 49380 tm.skewX += (tm.rotation <= 0) ? 180 : -180; 49381 tm.rotation += (tm.rotation <= 0) ? 180 : -180; 49382 } else { 49383 tm.scaleY *= -1; 49384 tm.skewX += (tm.skewX <= 0) ? 180 : -180; 49385 } 49386 } 49387 } 49388 tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0; 49389 tm.x = a14; 49390 tm.y = a24; 49391 tm.z = a34; 49392 if (tm.svg) { 49393 tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12); 49394 tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22); 49395 } 49396 49397 } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY))) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those. 49398 var k = (m.length >= 6), 49399 a = k ? m[0] : 1, 49400 b = m[1] || 0, 49401 c = m[2] || 0, 49402 d = k ? m[3] : 1; 49403 tm.x = m[4] || 0; 49404 tm.y = m[5] || 0; 49405 scaleX = Math.sqrt(a * a + b * b); 49406 scaleY = Math.sqrt(d * d + c * c); 49407 rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). 49408 skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0; 49409 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 49410 if (invX) { 49411 scaleX *= -1; 49412 skewX += (rotation <= 0) ? 180 : -180; 49413 rotation += (rotation <= 0) ? 180 : -180; 49414 } else { 49415 scaleY *= -1; 49416 skewX += (skewX <= 0) ? 180 : -180; 49417 } 49418 } 49419 tm.scaleX = scaleX; 49420 tm.scaleY = scaleY; 49421 tm.rotation = rotation; 49422 tm.skewX = skewX; 49423 if (_supports3D) { 49424 tm.rotationX = tm.rotationY = tm.z = 0; 49425 tm.perspective = defaultTransformPerspective; 49426 tm.scaleZ = 1; 49427 } 49428 if (tm.svg) { 49429 tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c); 49430 tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d); 49431 } 49432 } 49433 tm.zOrigin = zOrigin;
49434 //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate. 49435 for (i in tm) { 49436 if (tm[i] < min) if (tm[i] > -min) { 49437 tm[i] = 0; 49438 } 49439 } 49440 } 49441 //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin); 49442 if (rec) { 49443 t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) 49444 if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean. 49445 if (_useSVGTransformAttr && t.style[_transformProp]) { 49446 TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it). 49447 _removeProp(t.style, _transformProp); 49448 }); 49449 } else if (!_useSVGTransformAttr && t.getAttribute("transform")) { 49450 TweenLite.delayedCall(0.001, function(){ 49451 t.removeAttribute("transform"); 49452 }); 49453 } 49454 } 49455 } 49456 return tm; 49457 }, 49458 49459 //for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms) 49460 _setIETransformRatio = function(v) { 49461 var t = this.data, //refers to the element's _gsTransform object 49462 ang = -t.rotation * _DEG2RAD, 49463 skew = ang + t.skewX * _DEG2RAD, 49464 rnd = 100000, 49465 a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd, 49466 b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd, 49467 c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd, 49468 d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd, 49469 style = this.t.style, 49470 cs = this.t.currentStyle, 49471 filters, val; 49472 if (!cs) { 49473 return; 49474 } 49475 val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted) 49476 b = -c; 49477 c = -val; 49478 filters = cs.filter; 49479 style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight 49480 var w = this.t.offsetWidth, 49481 h = this.t.offsetHeight, 49482 clip = (cs.position !== "absolute"), 49483 m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d, 49484 ox = t.x + (w * t.xPercent / 100), 49485 oy = t.y + (h * t.yPercent / 100), 49486 dx, dy; 49487 49488 //if transformOrigin is being used, adjust the offset x and y 49489 if (t.ox != null) { 49490 dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2; 49491 dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2; 49492 ox += dx - (dx * a + dy * b); 49493 oy += dy - (dx * c + dy * d); 49494 } 49495 49496 if (!clip) { 49497 m += ", sizingMethod='auto expand')"; 49498 } else { 49499 dx = (w / 2); 49500 dy = (h / 2); 49501 //translate to ensure that transformations occur around the correct origin (default is center). 49502 m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")"; 49503 } 49504 if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) {
49505 style.filter = filters.replace(_ieSetMatrixExp, m); 49506 } else { 49507 style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha. 49508 } 49509 49510 //at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance. 49511 if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) { 49512 style.removeAttribute("filter"); 49513 } 49514 49515 //we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration). 49516 if (!clip) { 49517 var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom 49518 marg, prop, dif; 49519 dx = t.ieOffsetX || 0; 49520 dy = t.ieOffsetY || 0; 49521 t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox); 49522 t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy); 49523 for (i = 0; i < 4; i++) { 49524 prop = _margins[i]; 49525 marg = cs[prop]; 49526 //we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes) 49527 val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0; 49528 if (val !== t[prop]) { 49529 dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible. 49530 } else { 49531 dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY; 49532 } 49533 style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px"; 49534 } 49535 } 49536 }, 49537 49538 /* translates a super small decimal to a string WITHOUT scientific notation 49539 _safeDecimal = function(n) { 49540 var s = (n < 0 ? -n : n) + "", 49541 a = s.split("e-"); 49542 return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join(""); 49543 }, 49544 */ 49545 49546 _setTransformRatio = _internals.set3DTransformRatio = _internals.setTransformRatio = function(v) { 49547 var t = this.data, //refers to the element's _gsTransform object 49548 style = this.t.style, 49549 angle = t.rotation, 49550 rotationX = t.rotationX, 49551 rotationY = t.rotationY, 49552 sx = t.scaleX, 49553 sy = t.scaleY, 49554 sz = t.scaleZ, 49555 x = t.x, 49556 y = t.y, 49557 z = t.z, 49558 isSVG = t.svg, 49559 perspective = t.perspective, 49560 force3D = t.force3D, 49561 skewY = t.skewY, 49562 skewX = t.skewX, 49563 t1, a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, 49564 zOrigin, min, cos, sin, t2, transform, comma, zero, skew, rnd; 49565 if (skewY) { //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. 49566 skewX += skewY; 49567 angle += skewY; 49568 } 49569 49570 //check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true) 49571 if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX && sz === 1) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween. 49572 49573 //2D 49574 if (angle || skewX || isSVG) { 49575 angle *= _DEG2RAD; 49576 skew = skewX * _DEG2RAD; 49577 rnd = 100000; 49578 a11 = Math.cos(angle) * sx; 49579 a21 = Math.sin(angle) * sx; 49580 a12 = Math.sin(angle - skew) * -sy;
49581 a22 = Math.cos(angle - skew) * sy; 49582 if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does 49583 t1 = Math.tan(skew - skewY * _DEG2RAD); 49584 t1 = Math.sqrt(1 + t1 * t1); 49585 a12 *= t1; 49586 a22 *= t1; 49587 if (skewY) { 49588 t1 = Math.tan(skewY * _DEG2RAD); 49589 t1 = Math.sqrt(1 + t1 * t1); 49590 a11 *= t1; 49591 a21 *= t1; 49592 } 49593 } 49594 if (isSVG) { 49595 x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; 49596 y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; 49597 if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it. 49598 min = this.t.getBBox(); 49599 x += t.xPercent * 0.01 * min.width; 49600 y += t.yPercent * 0.01 * min.height; 49601 } 49602 min = 0.000001; 49603 if (x < min) if (x > -min) { 49604 x = 0; 49605 } 49606 if (y < min) if (y > -min) { 49607 y = 0; 49608 } 49609 } 49610 transform = (((a11 * rnd) | 0) / rnd) + "," + (((a21 * rnd) | 0) / rnd) + "," + (((a12 * rnd) | 0) / rnd) + "," + (((a22 * rnd) | 0) / rnd) + "," + x + "," + y + ")"; 49611 if (isSVG && _useSVGTransformAttr) {
49612 this.t.setAttribute("transform", "matrix(" + transform); 49613 } else { 49614 //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places. 49615 style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + transform; 49616 } 49617 } else { 49618 style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + sx + ",0,0," + sy + "," + x + "," + y + ")"; 49619 } 49620 return; 49621 49622 } 49623 if (_isFirefox) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue. 49624 min = 0.0001; 49625 if (sx < min && sx > -min) { 49626 sx = sz = 0.00002; 49627 } 49628 if (sy < min && sy > -min) { 49629 sy = sz = 0.00002; 49630 } 49631 if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z). 49632 perspective = 0; 49633 } 49634 } 49635 if (angle || skewX) { 49636 angle *= _DEG2RAD; 49637 cos = a11 = Math.cos(angle); 49638 sin = a21 = Math.sin(angle); 49639 if (skewX) { 49640 angle -= skewX * _DEG2RAD; 49641 cos = Math.cos(angle); 49642 sin = Math.sin(angle); 49643 if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does 49644 t1 = Math.tan((skewX - skewY) * _DEG2RAD); 49645 t1 = Math.sqrt(1 + t1 * t1); 49646 cos *= t1; 49647 sin *= t1; 49648 if (t.skewY) { 49649 t1 = Math.tan(skewY * _DEG2RAD); 49650 t1 = Math.sqrt(1 + t1 * t1); 49651 a11 *= t1; 49652 a21 *= t1; 49653 } 49654 } 49655 } 49656 a12 = -sin; 49657 a22 = cos; 49658 49659 } else if (!rotationY && !rotationX && sz === 1 && !perspective && !isSVG) { //if we're only translating and/or 2D scaling, this is faster... 49660 style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : ""); 49661 return; 49662 } else { 49663 a11 = a22 = 1; 49664 a12 = a21 = 0; 49665 } 49666 // KEY INDEX AFFECTS 49667 // a11 0 rotation, rotationY, scaleX 49668 // a21 1 rotation, rotationY, scaleX 49669 // a31 2 rotationY, scaleX 49670 // a41 3 rotationY, scaleX 49671 // a12 4 rotation, skewX, rotationX, scaleY 49672 // a22 5 rotation, skewX, rotationX, scaleY 49673 // a32 6 rotationX, scaleY 49674 // a42 7 rotationX, scaleY 49675 // a13 8 rotationY, rotationX, scaleZ 49676 // a23 9 rotationY, rotationX, scaleZ 49677 // a33 10 rotationY, rotationX, scaleZ 49678 // a43 11 rotationY, rotationX, perspective, scaleZ 49679 // a14 12 x, zOrigin, svgOrigin 49680 // a24 13 y, zOrigin, svgOrigin 49681 // a34 14 z, zOrigin 49682 // a44 15 49683 // rotation: Math.atan2(a21, a11) 49684 // rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11)) 49685 // rotationX: Math.atan2(a32, a33) 49686 a33 = 1; 49687 a13 = a23 = a31 = a32 = a41 = a42 = 0; 49688 a43 = (perspective) ? -1 / perspective : 0; 49689 zOrigin = t.zOrigin; 49690 min = 0.000001; //threshold below which browsers use scientific notation which won't work. 49691 comma = ","; 49692 zero = "0"; 49693 angle = rotationY * _DEG2RAD; 49694 if (angle) { 49695 cos = Math.cos(angle); 49696 sin = Math.sin(angle);
49697 a31 = -sin; 49698 a41 = a43*-sin; 49699 a13 = a11*sin; 49700 a23 = a21*sin; 49701 a33 = cos; 49702 a43 *= cos; 49703 a11 *= cos; 49704 a21 *= cos; 49705 } 49706 angle = rotationX * _DEG2RAD; 49707 if (angle) { 49708 cos = Math.cos(angle); 49709 sin = Math.sin(angle); 49710 t1 = a12*cos+a13*sin; 49711 t2 = a22*cos+a23*sin; 49712 a32 = a33*sin; 49713 a42 = a43*sin; 49714 a13 = a12*-sin+a13*cos; 49715 a23 = a22*-sin+a23*cos; 49716 a33 = a33*cos; 49717 a43 = a43*cos; 49718 a12 = t1; 49719 a22 = t2; 49720 } 49721 if (sz !== 1) { 49722 a13*=sz; 49723 a23*=sz; 49724 a33*=sz; 49725 a43*=sz; 49726 } 49727 if (sy !== 1) { 49728 a12*=sy; 49729 a22*=sy; 49730 a32*=sy; 49731 a42*=sy; 49732 } 49733 if (sx !== 1) { 49734 a11*=sx; 49735 a21*=sx; 49736 a31*=sx; 49737 a41*=sx; 49738 } 49739 49740 if (zOrigin || isSVG) { 49741 if (zOrigin) { 49742 x += a13*-zOrigin; 49743 y += a23*-zOrigin; 49744 z += a33*-zOrigin+zOrigin; 49745 } 49746 if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually 49747 x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; 49748 y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; 49749 } 49750 if (x < min && x > -min) { 49751 x = zero; 49752 } 49753 if (y < min && y > -min) { 49754 y = zero; 49755 } 49756 if (z < min && z > -min) { 49757 z = 0; //don't use string because we calculate perspective later and need the number. 49758 } 49759 } 49760 49761 //optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall: 49762 transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d("); 49763 transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); 49764 transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); 49765 if (rotationX || rotationY || sz !== 1) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations) 49766 transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); 49767 transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; 49768 } else { 49769 transform += ",0,0,0,0,1,0,"; 49770 } 49771 transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")"; 49772 49773 style[_transformProp] = transform; 49774 }; 49775 49776 p = Transform.prototype; 49777 p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0; 49778 p.scaleX = p.scaleY = p.scaleZ = 1; 49779 49780 _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, parsingProp, cssp, pt, plugin, vars) { 49781 if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it. 49782 cssp._lastParsedTransform = vars; 49783 var scaleFunc = (vars.scale && typeof(vars.scale) === "function") ? vars.scale : 0, //if there's a function-based "scale" value, swap in the resulting numeric value temporarily. Otherwise, if it's called for both scaleX and scaleY independently, they may not match (like if the function uses Math.random()). 49784 swapFunc; 49785 if (typeof(vars[parsingProp]) === "function") { //whatever property triggers the initial parsing might be a function-based value in which case it already got called in parse(), thus we don't want to call it again in here. The most efficient way to avoid this is to temporarily swap the value directly into the vars object, and then after we do all our parsing in this function, we'll swap it back again. 49786 swapFunc = vars[parsingProp]; 49787 vars[parsingProp] = e; 49788 } 49789 if (scaleFunc) { 49790 vars.scale = scaleFunc(_index, t); 49791 } 49792 var originalGSTransform = t._gsTransform, 49793 style = t.style, 49794 min = 0.000001, 49795 i = _transformProps.length, 49796 v = vars, 49797 endRotations = {}, 49798 transformOriginString = "transformOrigin", 49799 m1 = _getTransform(t, _cs, true, v.parseTransform), 49800 orig = v.transform && ((typeof(v.transform) === "function") ? v.transform(_index, _target) : v.transform), 49801 m2, copy, has3D, hasChange, dr, x, y, matrix, p; 49802 cssp._transform = m1; 49803 if (orig && typeof(orig) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" 49804 copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly. 49805 copy[_transformProp] = orig; 49806 copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly. 49807 copy.position = "absolute"; 49808 _doc.body.appendChild(_tempDiv); 49809 m2 = _getTransform(_tempDiv, null, false); 49810 if (m1.svg) { //if it's an SVG element, x/y part of the matrix will be affected by whatever we use as the origin and the offsets, so compensate here... 49811 x = m1.xOrigin; 49812 y = m1.yOrigin; 49813 m2.x -= m1.xOffset; 49814 m2.y -= m1.yOffset; 49815 if (v.transformOrigin || v.svgOrigin) { //if this tween is altering the origin, we must factor that in here. The actual work of recording the transformOrigin values and setting up the PropTween is done later (still inside this function) so we cannot leave the changes intact here - we only want to update the x/y accordingly. 49816 orig = {}; 49817 _parseSVGOrigin(t, _parsePosition(v.transformOrigin), orig, v.svgOrigin, v.smoothOrigin, true); 49818 x = orig.xOrigin; 49819 y = orig.yOrigin; 49820 m2.x -= orig.xOffset - m1.xOffset; 49821 m2.y -= orig.yOffset - m1.yOffset; 49822 } 49823 if (x || y) { 49824 matrix = _getMatrix(_tempDiv, true); 49825 m2.x -= x - (x * matrix[0] + y * matrix[2]); 49826 m2.y -= y - (x * matrix[1] + y * matrix[3]); 49827 } 49828 } 49829 _doc.body.removeChild(_tempDiv); 49830 if (!m2.perspective) { 49831 m2.perspective = m1.perspective; //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. 49832 } 49833 if (v.xPercent != null) { 49834 m2.xPercent = _parseVal(v.xPercent, m1.xPercent); 49835 } 49836 if (v.yPercent != null) { 49837 m2.yPercent = _parseVal(v.yPercent, m1.yPercent); 49838 } 49839 } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) 49840 m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), 49841 scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), 49842 scaleZ:_parseVal(v.scaleZ, m1.scaleZ), 49843 x:_parseVal(v.x, m1.x), 49844 y:_parseVal(v.y, m1.y), 49845 z:_parseVal(v.z, m1.z), 49846 xPercent:_parseVal(v.xPercent, m1.xPercent), 49847 yPercent:_parseVal(v.yPercent, m1.yPercent), 49848 perspective:_parseVal(v.transformPerspective, m1.perspective)}; 49849 dr = v.directionalRotation; 49850 if (dr != null) { 49851 if (typeof(dr) === "object") { 49852 for (copy in dr) { 49853 v[copy] = dr[copy]; 49854 } 49855 } else { 49856 v.rotation = dr; 49857 } 49858 } 49859 if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) { 49860 m2.x = 0; 49861 m2.xPercent = _parseVal(v.x, m1.xPercent); 49862 } 49863 if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) { 49864 m2.y = 0; 49865 m2.yPercent = _parseVal(v.y, m1.yPercent); 49866 } 49867 49868 m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : ("rotationZ" in v) ? v.rotationZ : m1.rotation, m1.rotation, "rotation", endRotations); 49869 if (_supports3D) { 49870 m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations); 49871 m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations); 49872 }
49873 m2.skewX = _parseAngle(v.skewX, m1.skewX); 49874 m2.skewY = _parseAngle(v.skewY, m1.skewY); 49875 } 49876 if (_supports3D && v.force3D != null) { 49877 m1.force3D = v.force3D; 49878 hasChange = true; 49879 } 49880 49881 m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType; 49882 49883 has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective); 49884 if (!has3D && v.scale != null) { 49885 m2.scaleZ = 1; //no need to tween scaleZ. 49886 } 49887 49888 while (--i > -1) { 49889 p = _transformProps[i]; 49890 orig = m2[p] - m1[p]; 49891 if (orig > min || orig < -min || v[p] != null || _forcePT[p] != null) { 49892 hasChange = true; 49893 pt = new CSSPropTween(m1, p, m1[p], orig, pt); 49894 if (p in endRotations) { 49895 pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested 49896 } 49897 pt.xs0 = 0; //ensures the value stays numeric in setRatio() 49898 pt.plugin = plugin; 49899 cssp._overwriteProps.push(pt.n); 49900 } 49901 } 49902 49903 orig = v.transformOrigin; 49904 if (m1.svg && (orig || v.svgOrigin)) { 49905 x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin 49906 y = m1.yOffset; 49907 _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin); 49908 pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween. 49909 pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString); 49910 if (x !== m1.xOffset || y !== m1.yOffset) { 49911 pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString); 49912 pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString); 49913 } 49914 orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin 49915 } 49916 if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly). 49917 if (_transformProp) { 49918 hasChange = true; 49919 p = _transformOriginProp; 49920 orig = (orig || _getStyle(t, p, _cs, false, "50% 50%")) + ""; //cast as string to avoid errors 49921 pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString); 49922 pt.b = style[p]; 49923 pt.plugin = plugin; 49924 if (_supports3D) { 49925 copy = m1.zOrigin; 49926 orig = orig.split(" "); 49927 m1.zOrigin = ((orig.length > 2 && !(copy !== 0 && orig[2] === "0px")) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method. 49928 pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)! 49929 pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here) 49930 pt.b = copy; 49931 pt.xs0 = pt.e = m1.zOrigin; 49932 } else { 49933 pt.xs0 = pt.e = orig; 49934 } 49935 49936 //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp). 49937 } else { 49938 _parsePosition(orig + "", m1); 49939 } 49940 } 49941 if (hasChange) { 49942 cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms(); 49943 } 49944 if (swapFunc) { 49945 vars[parsingProp] = swapFunc; 49946 } 49947 if (scaleFunc) { 49948 vars.scale = scaleFunc; 49949 } 49950 return pt; 49951 }, prefix:true}); 49952 49953 _registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"}); 49954 49955 _registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { 49956 e = this.format(e); 49957 var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"], 49958 style = t.style, 49959 ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em; 49960 w = parseFloat(t.offsetWidth); 49961 h = parseFloat(t.offsetHeight); 49962 ea1 = e.split(" "); 49963 for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis! 49964 if (this.p.indexOf("border")) { //older browsers used a prefix 49965 props[i] = _checkPropPrefix(props[i]); 49966 }
49967 bs = bs2 = _getStyle(t, props[i], _cs, false, "0px"); 49968 if (bs.indexOf(" ") !== -1) { 49969 bs2 = bs.split(" "); 49970 bs = bs2[0]; 49971 bs2 = bs2[1]; 49972 } 49973 es = es2 = ea1[i]; 49974 bn = parseFloat(bs); 49975 bsfx = bs.substr((bn + "").length); 49976 rel = (es.charAt(1) === "="); 49977 if (rel) { 49978 en = parseInt(es.charAt(0)+"1", 10); 49979 es = es.substr(2); 49980 en *= parseFloat(es); 49981 esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || ""; 49982 } else { 49983 en = parseFloat(es); 49984 esfx = es.substr((en + "").length); 49985 } 49986 if (esfx === "") { 49987 esfx = _suffixMap[p] || bsfx; 49988 } 49989 if (esfx !== bsfx) { 49990 hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent. 49991 vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number 49992 if (esfx === "%") { 49993 bs = (hn / w * 100) + "%"; 49994 bs2 = (vn / h * 100) + "%"; 49995 } else if (esfx === "em") { 49996 em = _convertToPixels(t, "borderLeft", 1, "em"); 49997 bs = (hn / em) + "em"; 49998 bs2 = (vn / em) + "em"; 49999 } else { 50000 bs = hn + "px"; 50001 bs2 = vn + "px"; 50002 } 50003 if (rel) { 50004 es = (parseFloat(bs) + en) + esfx; 50005 es2 = (parseFloat(bs2) + en) + esfx; 50006 } 50007 } 50008 pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt); 50009 } 50010 return pt; 50011 }, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)}); 50012 _registerComplexSpecialProp("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { 50013 return _parseComplex(t.style, p, this.format(_getStyle(t, p, _cs, false, "0px 0px")), this.format(e), false, "0px", pt); 50014 }, prefix:true, formatter:_getFormatter("0px 0px", false, true)}); 50015 _registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) { 50016 var bp = "background-position", 50017 cs = (_cs || _getComputedStyle(t, null)), 50018 bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase 50019 es = this.format(e), 50020 ba, ea, i, pct, overlap, src; 50021 if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1) && es.split(",").length < 2) { 50022 src = _getStyle(t, "backgroundImage").replace(_urlExp, ""); 50023 if (src && src !== "none") { 50024 ba = bs.split(" "); 50025 ea = es.split(" "); 50026 _tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height 50027 i = 2; 50028 while (--i > -1) { 50029 bs = ba[i]; 50030 pct = (bs.indexOf("%") !== -1); 50031 if (pct !== (ea[i].indexOf("%") !== -1)) { 50032 overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height; 50033 ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%"; 50034 } 50035 } 50036 bs = ba.join(" "); 50037 } 50038 } 50039 return this.parseComplex(t.style, bs, es, pt, plugin); 50040 }, formatter:_parsePosition}); 50041 _registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:function(v) { 50042 v += ""; //ensure it's a string 50043 return _parsePosition(v.indexOf(" ") === -1 ? v + " " + v : v); //if set to something like "100% 100%", Safari typically reports the computed style as just "100%" (no 2nd value), but we should ensure that there are two values, so copy the first one. Otherwise, it'd be interpreted as "100% 0" (wrong). 50044 }}); 50045 _registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true}); 50046 _registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true}); 50047 _registerComplexSpecialProp("transformStyle", {prefix:true}); 50048 _registerComplexSpecialProp("backfaceVisibility", {prefix:true}); 50049 _registerComplexSpecialProp("userSelect", {prefix:true}); 50050 _registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")}); 50051 _registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")}); 50052 _registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){ 50053 var b, cs, delim; 50054 if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited. 50055 cs = t.currentStyle; 50056 delim = _ieVers < 8 ? " " : ","; 50057 b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")"; 50058 e = this.format(e).split(",").join(delim); 50059 } else { 50060 b = this.format(_getStyle(t, this.p, _cs, false, this.dflt)); 50061 e = this.format(e); 50062 } 50063 return this.parseComplex(t.style, b, e, pt, plugin); 50064 }}); 50065 _registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true}); 50066 _registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them) 50067 _registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) { 50068 var bw = _getStyle(t, "borderTopWidth", _cs, false, "0px"), 50069 end = this.format(e).split(" "), 50070 esfx = end[0].replace(_suffixExp, ""); 50071 if (esfx !== "px") { //if we're animating to a non-px value, we need to convert the beginning width to that unit. 50072 bw = (parseFloat(bw) / _convertToPixels(t, "borderTopWidth", 1, esfx)) + esfx; 50073 } 50074 return this.parseComplex(t.style, this.format(bw + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), end.join(" "), pt, plugin); 50075 }, color:true, formatter:function(v) { 50076 var a = v.split(" "); 50077 return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0]; 50078 }}); 50079 _registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline). 50080 _registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) { 50081 var s = t.style, 50082 prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat"; 50083 return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e); 50084 }}); 50085 50086 //opacity-related 50087 var _setIEOpacityRatio = function(v) { 50088 var t = this.t, //refers to the element's style property 50089 filters = t.filter || _getStyle(this.data, "filter") || "", 50090 val = (this.s + this.c * v) | 0, 50091 skip; 50092 if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters. 50093 if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) { 50094 t.removeAttribute("filter"); 50095 skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check. 50096 } else {
50097 t.filter = filters.replace(_alphaFilterExp, ""); 50098 skip = true; 50099 } 50100 } 50101 if (!skip) { 50102 if (this.xn1) { 50103 t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame. 50104 } 50105 if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues 50106 if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween) 50107 t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly. 50108 } 50109 } else { 50110 t.filter = filters.replace(_opacityExp, "opacity=" + val); 50111 } 50112 } 50113 }; 50114 _registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) { 50115 var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")), 50116 style = t.style, 50117 isAutoAlpha = (p === "autoAlpha"); 50118 if (typeof(e) === "string" && e.charAt(1) === "=") { 50119 e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b; 50120 } 50121 if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) 50122 b = 0; 50123 } 50124 if (_supportsOpacity) { 50125 pt = new CSSPropTween(style, "opacity", b, e - b, pt); 50126 } else { 50127 pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt); 50128 pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug. 50129 style.zoom = 1; //helps correct an IE issue. 50130 pt.type = 2; 50131 pt.b = "alpha(opacity=" + pt.s + ")"; 50132 pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")"; 50133 pt.data = t; 50134 pt.plugin = plugin; 50135 pt.setRatio = _setIEOpacityRatio; 50136 } 50137 if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier 50138 pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit")); 50139 pt.xs0 = "inherit"; 50140 cssp._overwriteProps.push(pt.n); 50141 cssp._overwriteProps.push(p); 50142 } 50143 return pt; 50144 }}); 50145 50146 50147 var _removeProp = function(s, p) { 50148 if (p) { 50149 if (s.removeProperty) { 50150 if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) 50151 p = "-" + p; 50152 } 50153 s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); 50154 } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" 50155 s.removeAttribute(p); 50156 } 50157 } 50158 }, 50159 _setClassNameRatio = function(v) { 50160 this.t._gsClassPT = this; 50161 if (v === 1 || v === 0) { 50162 this.t.setAttribute("class", (v === 0) ? this.b : this.e); 50163 var mpt = this.data, //first MiniPropTween 50164 s = this.t.style; 50165 while (mpt) { 50166 if (!mpt.v) { 50167 _removeProp(s, mpt.p); 50168 } else { 50169 s[mpt.p] = mpt.v; 50170 } 50171 mpt = mpt._next; 50172 } 50173 if (v === 1 && this.t._gsClassPT === this) { 50174 this.t._gsClassPT = null; 50175 } 50176 } else if (this.t.getAttribute("class") !== this.e) { 50177 this.t.setAttribute("class", this.e); 50178 } 50179 }; 50180 _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) { 50181 var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable. 50182 cssText = t.style.cssText, 50183 difData, bs, cnpt, cnptLookup, mpt; 50184 pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2); 50185 pt.setRatio = _setClassNameRatio; 50186 pt.pr = -11; 50187 _hasPriority = true; 50188 pt.b = b; 50189 bs = _getAllStyles(t, _cs); 50190 //if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfer
50190ing that were there just for class-specific values) 50191 cnpt = t._gsClassPT; 50192 if (cnpt) { 50193 cnptLookup = {}; 50194 mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned. 50195 while (mpt) { 50196 cnptLookup[mpt.p] = 1; 50197 mpt = mpt._next; 50198 } 50199 cnpt.setRatio(1); 50200 } 50201 t._gsClassPT = pt; 50202 pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("(?:\\s|^)" + e.substr(2) + "(?![\\w-])"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : ""); 50203 t.setAttribute("class", pt.e); 50204 difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup); 50205 t.setAttribute("class", b); 50206 pt.data = difData.firstMPT; 50207 t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). 50208 pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself) 50209 return pt; 50210 }}); 50211 50212 50213 var _setClearPropsRatio = function(v) { 50214 if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in). 50215 var s = this.t.style, 50216 transformParse = _specialProps.transform.parse, 50217 a, p, i, clearTransform, transform; 50218 if (this.e === "all") { 50219 s.cssText = ""; 50220 clearTransform = true; 50221 } else { 50222 a = this.e.split(" ").join("").split(","); 50223 i = a.length; 50224 while (--i > -1) { 50225 p = a[i]; 50226 if (_specialProps[p]) { 50227 if (_specialProps[p].parse === transformParse) { 50228 clearTransform = true; 50229 } else { 50230 p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow" 50231 } 50232 } 50233 _removeProp(s, p); 50234 } 50235 } 50236 if (clearTransform) { 50237 _removeProp(s, _transformProp); 50238 transform = this.t._gsTransform; 50239 if (transform) { 50240 if (transform.svg) { 50241 this.t.removeAttribute("data-svg-origin"); 50242 this.t.removeAttribute("transform"); 50243 } 50244 delete this.t._gsTransform; 50245 } 50246 } 50247 50248 } 50249 }; 50250 _registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) { 50251 pt = new CSSPropTween(t, p, 0, 0, pt, 2); 50252 pt.setRatio = _setClearPropsRatio; 50253 pt.e = e; 50254 pt.pr = -10; 50255 pt.data = cssp._tween; 50256 _hasPriority = true; 50257 return pt; 50258 }}); 50259 50260 p = "bezier,throwProps,physicsProps,physics2D".split(","); 50261 i = p.length; 50262 while (i--) { 50263 _registerPluginProp(p[i]); 50264 } 50265 50266 50267 50268 50269 50270 50271 50272 50273 p = CSSPlugin.prototype; 50274 p._firstPT = p._lastParsedTransform = p._transform = null; 50275 50276 //gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. 50277 p._onInitTween = function(target, vars, tween, index) { 50278 if (!target.nodeType) { //css is only for dom elements 50279 return false; 50280 } 50281 this._target = _target = target; 50282 this._tween = tween; 50283 this._vars = vars; 50284 _index = index; 50285 _autoRound = vars.autoRound; 50286 _hasPriority = false;
50287 _suffixMap = vars.suffixMap || CSSPlugin.suffixMap; 50288 _cs = _getComputedStyle(target, ""); 50289 _overwriteProps = this._overwriteProps; 50290 var style = target.style, 50291 v, pt, pt2, first, last, next, zIndex, tpt, threeD; 50292 if (_reqSafariFix) if (style.zIndex === "") { 50293 v = _getStyle(target, "zIndex", _cs); 50294 if (v === "auto" || v === "") { 50295 //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive. 50296 this._addLazySet(style, "zIndex", 0); 50297 } 50298 } 50299 50300 if (typeof(vars) === "string") { 50301 first = style.cssText; 50302 v = _getAllStyles(target, _cs); 50303 style.cssText = first + ";" + vars; 50304 v = _cssDif(target, v, _getAllStyles(target)).difs; 50305 if (!_supportsOpacity && _opacityValExp.test(vars)) { 50306 v.opacity = parseFloat( RegExp.$1 ); 50307 } 50308 vars = v; 50309 style.cssText = first; 50310 } 50311 50312 if (vars.className) { //className tweens will combine any differences they find in the css with the vars that are passed in, so {className:"myClass", scale:0.5, left:20} would work. 50313 this._firstPT = pt = _specialProps.className.parse(target, vars.className, "className", this, null, null, vars); 50314 } else { 50315 this._firstPT = pt = this.parse(target, vars, null); 50316 } 50317 50318 if (this._transformType) { 50319 threeD = (this._transformType === 3); 50320 if (!_transformProp) { 50321 style.zoom = 1; //helps correct an IE issue. 50322 } else if (_isSafari) { 50323 _reqSafariFix = true; 50324 //if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random). 50325 if (style.zIndex === "") { 50326 zIndex = _getStyle(target, "zIndex", _cs); 50327 if (zIndex === "auto" || zIndex === "") { 50328 this._addLazySet(style, "zIndex", 0); 50329 } 50330 } 50331 //Setting WebkitBackfaceVisibility corrects 3 bugs: 50332 // 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update. 50333 // 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. 50334 // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug. 50335 //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween. 50336 if (_isSafariLT6) { 50337 this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden")); 50338 } 50339 } 50340 pt2 = pt; 50341 while (pt2 && pt2._next) { 50342 pt2 = pt2._next; 50343 } 50344 tpt = new CSSPropTween(target, "transform", 0, 0, null, 2); 50345 this._linkCSSP(tpt, null, pt2); 50346 tpt.setRatio = _transformProp ? _setTransformRatio : _setIETransformRatio; 50347 tpt.data = this._transform || _getTransform(target, _cs, true); 50348 tpt.tween = tween; 50349 tpt.pr = -1; //ensures that the transforms get applied after the components are updated. 50350 _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here. 50351 } 50352 50353 if (_hasPriority) { 50354 //reorders the linked list in order of pr (priority) 50355 while (pt) { 50356 next = pt._next; 50357 pt2 = first; 50358 while (pt2 && pt2.pr > pt.pr) { 50359 pt2 = pt2._next; 50360 } 50361 if ((pt._prev = pt2 ? pt2._prev : last)) { 50362 pt._prev._next = pt; 50363 } else { 50364 first = pt; 50365 } 50366 if ((pt._next = pt2)) { 50367 pt2._prev = pt; 50368 } else { 50369 last = pt; 50370 } 50371 pt = next; 50372 } 50373 this._firstPT = first; 50374 } 50375 return true; 50376 }; 50377 50378 50379 p.parse = function(target, vars, pt, plugin) { 50380 var style = target.style, 50381 p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel; 50382 for (p in vars) { 50383 es = vars[p]; //ending value string 50384 if (typeof(es) === "function") { 50385 es = es(_index, _target); 50386 } 50387 sp = _specialProps[p]; //SpecialProp lookup. 50388 if (sp) { 50389 pt = sp.parse(target, es, p, this, pt, plugin, vars); 50390 50391 } else { 50392 bs = _getStyle(target, p, _cs) + ""; 50393 isStr = (typeof(es) === "string"); 50394 if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor: 50395 if (!isStr) { 50396 es = _parseColor(es); 50397 es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")"; 50398 } 50399 pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin); 50400 50401 } else if (isStr && _complexExp.test(es)) { 50402 pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin); 50403 50404 } else { 50405 bn = parseFloat(bs); 50406 bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case. 50407 50408 if (bs === "" || bs === "auto") { 50409 if (p === "width" || p === "height") { 50410 bn = _getDimension(target, p, _cs); 50411 bsfx = "px"; 50412 } else if (p === "left" || p === "top") {
50413 bn = _calculateOffset(target, p, _cs); 50414 bsfx = "px"; 50415 } else { 50416 bn = (p !== "opacity") ? 0 : 1; 50417 bsfx = ""; 50418 } 50419 } 50420 50421 rel = (isStr && es.charAt(1) === "="); 50422 if (rel) { 50423 en = parseInt(es.charAt(0) + "1", 10); 50424 es = es.substr(2); 50425 en *= parseFloat(es); 50426 esfx = es.replace(_suffixExp, ""); 50427 } else { 50428 en = parseFloat(es); 50429 esfx = isStr ? es.replace(_suffixExp, "") : ""; 50430 } 50431 50432 if (esfx === "") { 50433 esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix. 50434 } 50435 50436 es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix. 50437 50438 //if the beginning/ending suffixes don't match, normalize them... 50439 if (bsfx !== esfx) if (esfx !== "") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units! 50440 bn = _convertToPixels(target, p, bn, bsfx); 50441 if (esfx === "%") { 50442 bn /= _convertToPixels(target, p, 100, "%") / 100; 50443 if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens. 50444 bs = bn + "%"; 50445 } 50446 50447 } else if (esfx === "em" || esfx === "rem" || esfx === "vw" || esfx === "vh") { 50448 bn /= _convertToPixels(target, p, 1, esfx); 50449 50450 //otherwise convert to pixels. 50451 } else if (esfx !== "px") { 50452 en = _convertToPixels(target, p, en, esfx); 50453 esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too. 50454 } 50455 if (rel) if (en || en === 0) { 50456 es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here. 50457 } 50458 } 50459 50460 if (rel) { 50461 en += bn; 50462 } 50463 50464 if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly. 50465 pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es); 50466 pt.xs0 = esfx; 50467 //DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0); 50468 } else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) { 50469 _log("invalid " + p + " tween value: " + vars[p]); 50470 } else { 50471 pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es); 50472 pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween. 50473 //DEBUG: _log("non-tweening value "+p+": "+pt.xs0); 50474 } 50475 } 50476 } 50477 if (plugin) if (pt && !pt.plugin) { 50478 pt.plugin = plugin; 50479 } 50480 } 50481 return pt; 50482 }; 50483 50484 50485 //gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. 50486 p.setRatio = function(v) { 50487 var pt = this._firstPT, 50488 min = 0.000001, 50489 val, str, i; 50490 //at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards). 50491 if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) { 50492 while (pt) { 50493 if (pt.type !== 2) { 50494 if (pt.r && pt.type !== -1) { 50495 val = Math.round(pt.s + pt.c); 50496 if (!pt.type) { 50497 pt.t[pt.p] = val + pt.xs0; 50498 } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" 50499 i = pt.l; 50500 str = pt.xs0 + val + pt.xs1; 50501 for (i = 1; i < pt.l; i++) {
50502 str += pt["xn"+i] + pt["xs"+(i+1)]; 50503 } 50504 pt.t[pt.p] = str; 50505 } 50506 } else { 50507 pt.t[pt.p] = pt.e; 50508 } 50509 } else { 50510 pt.setRatio(v); 50511 } 50512 pt = pt._next; 50513 } 50514 50515 } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) { 50516 while (pt) { 50517 val = pt.c * v + pt.s; 50518 if (pt.r) { 50519 val = Math.round(val); 50520 } else if (val < min) if (val > -min) { 50521 val = 0; 50522 } 50523 if (!pt.type) { 50524 pt.t[pt.p] = val + pt.xs0; 50525 } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" 50526 i = pt.l; 50527 if (i === 2) { 50528 pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2; 50529 } else if (i === 3) { 50530 pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3; 50531 } else if (i === 4) { 50532 pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4; 50533 } else if (i === 5) { 50534 pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5; 50535 } else { 50536 str = pt.xs0 + val + pt.xs1; 50537 for (i = 1; i < pt.l; i++) { 50538 str += pt["xn"+i] + pt["xs"+(i+1)]; 50539 } 50540 pt.t[pt.p] = str; 50541 } 50542 50543 } else if (pt.type === -1) { //non-tweening value 50544 pt.t[pt.p] = pt.xs0; 50545 50546 } else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc. 50547 pt.setRatio(v); 50548 } 50549 pt = pt._next; 50550 } 50551 50552 //if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever). 50553 } else { 50554 while (pt) { 50555 if (pt.type !== 2) { 50556 pt.t[pt.p] = pt.b; 50557 } else { 50558 pt.setRatio(v); 50559 } 50560 pt = pt._next; 50561 } 50562 } 50563 }; 50564 50565 /** 50566 * @private 50567 * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called. 50568 * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked 50569 * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call 50570 * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin 50571 * doesn't have any transform-related properties of its own. You can call this method as many times as you 50572 * want and it won't create duplicate CSSPropTweens. 50573 * 50574 * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster) 50575 */ 50576 p._enableTransforms = function(threeD) { 50577 this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values. 50578 this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2; 50579 }; 50580 50581 var lazySet = function(v) { 50582 this.t[this.p] = this.e; 50583 this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop. 50584 }; 50585 /** @private Gives us a way to set a value on the first render (and only the first render). **/ 50586 p._addLazySet = function(t, p, v) { 50587 var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2); 50588 pt.e = v; 50589 pt.setRatio = lazySet; 50590 pt.data = this; 50591 }; 50592 50593 /** @private **/ 50594 p._linkCSSP = function(pt, next, prev, remove) { 50595 if (pt) { 50596 if (next) { 50597 next._prev = pt; 50598 } 50599 if (pt._next) { 50600 pt._next._prev = pt._prev; 50601 } 50602 if (pt._prev) { 50603 pt._prev._next = pt._next; 50604 } else if (this._firstPT === pt) { 50605 this._firstPT = pt._next; 50606 remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed) 50607 } 50608 if (prev) { 50609 prev._next = pt; 50610 } else if (!remove && this._firstPT === null) { 50611 this._firstPT = pt; 50612 } 50613 pt._next = next; 50614 pt._prev = prev; 50615 } 50616 return pt; 50617 }; 50618 50619 p._mod = function(lookup) { 50620 var pt = this._firstPT; 50621 while (pt) { 50622 if (typeof(lookup[pt.p]) === "function" && lookup[pt.p] === Math.round) { //only gets called by RoundPropsPlugin (ModifyPlugin manages all the rendering internally for CSSPlugin properties that need modification). Remember, we handle rounding a bit differently in this plugin for performance reasons, leveraging "r" as an indicator that the value should be roun
50622ded internally.. 50623 pt.r = 1; 50624 } 50625 pt = pt._next; 50626 } 50627 }; 50628 50629 //we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property. 50630 p._kill = function(lookup) { 50631 var copy = lookup, 50632 pt, p, xfirst; 50633 if (lookup.autoAlpha || lookup.alpha) { 50634 copy = {}; 50635 for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere. 50636 copy[p] = lookup[p]; 50637 } 50638 copy.opacity = 1; 50639 if (copy.autoAlpha) { 50640 copy.visibility = 1; 50641 } 50642 } 50643 if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst". 50644 xfirst = pt.xfirst; 50645 if (xfirst && xfirst._prev) { 50646 this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev 50647 } else if (xfirst === this._firstPT) { 50648 this._firstPT = pt._next; 50649 } 50650 if (pt._next) { 50651 this._linkCSSP(pt._next, pt._next._next, xfirst._prev); 50652 } 50653 this._classNamePT = null; 50654 } 50655 pt = this._firstPT; 50656 while (pt) { 50657 if (pt.plugin && pt.plugin !== p && pt.plugin._kill) { //for plugins that are registered with CSSPlugin, we should notify them of the kill. 50658 pt.plugin._kill(lookup); 50659 p = pt.plugin; 50660 } 50661 pt = pt._next; 50662 } 50663 return TweenPlugin.prototype._kill.call(this, copy); 50664 }; 50665 50666 50667 50668 //used by cascadeTo() for gathering all the style properties of each child element into an array for comparison. 50669 var _getChildStyles = function(e, props, targets) { 50670 var children, i, child, type; 50671 if (e.slice) { 50672 i = e.length; 50673 while (--i > -1) { 50674 _getChildStyles(e[i], props, targets); 50675 } 50676 return; 50677 } 50678 children = e.childNodes; 50679 i = children.length; 50680 while (--i > -1) { 50681 child = children[i]; 50682 type = child.type; 50683 if (child.style) { 50684 props.push(_getAllStyles(child)); 50685 if (targets) { 50686 targets.push(child); 50687 } 50688 } 50689 if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) { 50690 _getChildStyles(child, props, targets); 50691 } 50692 } 50693 }; 50694 50695 /** 50696 * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite 50697 * and then compares the style properties of all the target's child elements at the tween's start and end, and 50698 * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting 50699 * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is 50700 * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens 50701 * is because it creates entirely new tweens that may have completely different targets than the original tween, 50702 * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API 50703 * and it would create other problems. For example: 50704 * - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted) 50705 * - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others. 50706 * - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed. 50707 * 50708 * @param {Object} target object to be tweened 50709 * @param {number} Duration in seconds (or frames for frames-based tweens) 50710 * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone} 50711 * @return {Array} An array of TweenLite instances 50712 */ 50713 CSSPlugin.cascadeTo = function(target, duration, vars) { 50714 var tween = TweenLite.to(target, duration, vars), 50715 results = [tween], 50716 b = [], 50717 e = [], 50718 targets = [], 50719 _reservedProps = TweenLite._internals.reservedProps, 50720 i, difs, p, from; 50721 target = tween._targets || tween.target; 50722 _getChildStyles(target, b, targets); 50723 tween.render(duration, true, true); 50724 _getChildStyles(target, e); 50725 tween.render(0, true, true); 50726 tween._enabled(true); 50727 i = targets.length; 50728 while (--i > -1) { 50729 difs = _cssDif(targets[i], b[i], e[i]); 50730 if (difs.firstMPT) { 50731 difs = difs.difs; 50732 for (p in vars) { 50733 if (_reservedProps[p]) { 50734 difs[p] = vars[p]; 50735 } 50736 } 50737 from = {}; 50738 for (p in difs) { 50739 from[p] = b[i][p]; 50740 } 50741 results.push(TweenLite.fromTo(targets[i], duration, from, difs)); 50742 } 50743 } 50744 return results; 50745 }; 50746 50747 TweenPlugin.activate([CSSPlugin]); 50748 return CSSPlugin; 50749 50750 }, true); 50751 50752 50753 50754 50755 50756 50757 50758 50759 50760 50761 50762 /* 50763 * ---------------------------------------------------------------- 50764 * RoundPropsPlugin 50765 * ---------------------------------------------------------------- 50766 */ 50767 (function() { 50768 50769 var RoundPropsPlugin = _gsScope._gsDefine.plugin({ 50770 propName: "roundProps", 50771 version: "1.6.0", 50772 priority: -1, 50773 API: 2, 50774 50775 //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. 50776 init: function(target, value, tween) { 50777 this._tween = tween; 50778 return true; 50779 } 50780 50781 }), 50782 _roundLinkedList = function(node) { 50783 while (node) { 50784 if (!node.f && !node.blob) { 50785 node.m = Math.round; 50786 } 50787 node = node._next; 50788 } 50789 }, 50790 p = RoundPropsPlugin.prototype; 50791 50792 p._onInitAllProps = function() { 50793 var tween = this._tween,
50794 rp = (tween.vars.roundProps.join) ? tween.vars.roundProps : tween.vars.roundProps.split(","), 50795 i = rp.length, 50796 lookup = {}, 50797 rpt = tween._propLookup.roundProps, 50798 prop, pt, next; 50799 while (--i > -1) { 50800 lookup[rp[i]] = Math.round; 50801 } 50802 i = rp.length; 50803 while (--i > -1) { 50804 prop = rp[i]; 50805 pt = tween._firstPT; 50806 while (pt) { 50807 next = pt._next; //record here, because it may get removed 50808 if (pt.pg) { 50809 pt.t._mod(lookup); 50810 } else if (pt.n === prop) { 50811 if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) 50812 _roundLinkedList(pt.t._firstPT); 50813 } else { 50814 this._add(pt.t, prop, pt.s, pt.c); 50815 //remove from linked list 50816 if (next) { 50817 next._prev = pt._prev; 50818 } 50819 if (pt._prev) { 50820 pt._prev._next = next; 50821 } else if (tween._firstPT === pt) { 50822 tween._firstPT = next; 50823 } 50824 pt._next = pt._prev = null; 50825 tween._propLookup[prop] = rpt; 50826 } 50827 } 50828 pt = next; 50829 } 50830 } 50831 return false; 50832 }; 50833 50834 p._add = function(target, p, s, c) { 50835 this._addTween(target, p, s, s + c, p, Math.round); 50836 this._overwriteProps.push(p); 50837 }; 50838 50839 }()); 50840 50841 50842 50843 50844 50845 50846 50847 50848 50849 50850 /* 50851 * ---------------------------------------------------------------- 50852 * AttrPlugin 50853 * ---------------------------------------------------------------- 50854 */ 50855 50856 (function() { 50857 50858 _gsScope._gsDefine.plugin({ 50859 propName: "attr", 50860 API: 2, 50861 version: "0.6.0", 50862 50863 //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. 50864 init: function(target, value, tween, index) { 50865 var p, end; 50866 if (typeof(target.setAttribute) !== "function") { 50867 return false; 50868 } 50869 for (p in value) { 50870 end = value[p]; 50871 if (typeof(end) === "function") { 50872 end = end(index, target); 50873 } 50874 this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p); 50875 this._overwriteProps.push(p); 50876 } 50877 return true; 50878 } 50879 50880 }); 50881 50882 }()); 50883 50884 50885 50886 50887 50888 50889 50890 50891 50892 50893 /* 50894 * ---------------------------------------------------------------- 50895 * DirectionalRotationPlugin 50896 * ---------------------------------------------------------------- 50897 */ 50898 _gsScope._gsDefine.plugin({ 50899 propName: "directionalRotation", 50900 version: "0.3.0", 50901 API: 2, 50902 50903 //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. 50904 init: function(target, value, tween, index) { 50905 if (typeof(value) !== "object") { 50906 value = {rotation:value}; 50907 } 50908 this.finals = {}; 50909 var cap = (value.useRadians === true) ? Math.PI * 2 : 360, 50910 min = 0.000001, 50911 p, v, start, end, dif, split; 50912 for (p in value) { 50913 if (p !== "useRadians") { 50914 end = value[p]; 50915 if (typeof(end) === "function") { 50916 end = end(index, target); 50917 } 50918 split = (end + "").split("_"); 50919 v = split[0]; 50920 start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() ); 50921 end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0; 50922 dif = end - start; 50923 if (split.length) { 50924 v = split.join("_"); 50925 if (v.indexOf("short") !== -1) { 50926 dif = dif % cap; 50927 if (dif !== dif % (cap / 2)) { 50928 dif = (dif < 0) ? dif + cap : dif - cap; 50929 } 50930 } 50931 if (v.indexOf("_cw") !== -1 && dif < 0) { 50932 dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; 50933 } else if (v.indexOf("ccw") !== -1 && dif > 0) { 50934 dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; 50935 } 50936 } 50937 if (dif > min || dif < -min) { 50938 this._addTween(target, p, start, start + dif, p); 50939 this._overwriteProps.push(p); 50940 } 50941 } 50942 } 50943 return true; 50944 }, 50945 50946 //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
50947 set: function(ratio) { 50948 var pt; 50949 if (ratio !== 1) { 50950 this._super.setRatio.call(this, ratio); 50951 } else { 50952 pt = this._firstPT; 50953 while (pt) { 50954 if (pt.f) { 50955 pt.t[pt.p](this.finals[pt.p]); 50956 } else { 50957 pt.t[pt.p] = this.finals[pt.p]; 50958 } 50959 pt = pt._next; 50960 } 50961 } 50962 } 50963 50964 })._autoCSS = true; 50965 50966 50967 50968 50969 50970 50971 50972 50973 50974 50975 50976 /* 50977 * ---------------------------------------------------------------- 50978 * EasePack 50979 * ---------------------------------------------------------------- 50980 */ 50981 _gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) { 50982 50983 var w = (_gsScope.GreenSockGlobals || _gsScope), 50984 gs = w.com.greensock, 50985 _2PI = Math.PI * 2, 50986 _HALF_PI = Math.PI / 2, 50987 _class = gs._class, 50988 _create = function(n, f) { 50989 var C = _class("easing." + n, function(){}, true), 50990 p = C.prototype = new Ease(); 50991 p.constructor = C; 50992 p.getRatio = f; 50993 return C; 50994 }, 50995 _easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist. 50996 _wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) { 50997 var C = _class("easing."+name, { 50998 easeOut:new EaseOut(), 50999 easeIn:new EaseIn(), 51000 easeInOut:new EaseInOut() 51001 }, true); 51002 _easeReg(C, name); 51003 return C; 51004 }, 51005 EasePoint = function(time, value, next) { 51006 this.t = time; 51007 this.v = value; 51008 if (next) { 51009 this.next = next; 51010 next.prev = this; 51011 this.c = next.v - value; 51012 this.gap = next.t - time; 51013 } 51014 }, 51015 51016 //Back 51017 _createBack = function(n, f) { 51018 var C = _class("easing." + n, function(overshoot) { 51019 this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158; 51020 this._p2 = this._p1 * 1.525; 51021 }, true), 51022 p = C.prototype = new Ease(); 51023 p.constructor = C; 51024 p.getRatio = f; 51025 p.config = function(overshoot) { 51026 return new C(overshoot); 51027 }; 51028 return C; 51029 }, 51030 51031 Back = _wrap("Back", 51032 _createBack("BackOut", function(p) { 51033 return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1); 51034 }), 51035 _createBack("BackIn", function(p) { 51036 return p * p * ((this._p1 + 1) * p - this._p1); 51037 }), 51038 _createBack("BackInOut", function(p) { 51039 return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2); 51040 }) 51041 ), 51042 51043 51044 //SlowMo 51045 SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) { 51046 power = (power || power === 0) ? power : 0.7; 51047 if (linearRatio == null) { 51048 linearRatio = 0.7; 51049 } else if (linearRatio > 1) { 51050 linearRatio = 1; 51051 } 51052 this._p = (linearRatio !== 1) ? power : 0; 51053 this._p1 = (1 - linearRatio) / 2; 51054 this._p2 = linearRatio; 51055 this._p3 = this._p1 + this._p2; 51056 this._calcEnd = (yoyoMode === true); 51057 }, true), 51058 p = SlowMo.prototype = new Ease(), 51059 SteppedEase, RoughEase, _createElastic; 51060 51061 p.constructor = SlowMo; 51062 p.getRatio = function(p) { 51063 var r = p + (0.5 - p) * this._p; 51064 if (p < this._p1) { 51065 return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r); 51066 } else if (p > this._p3) { 51067 return this._calcEnd ? 1 - (p = (p - this._p3) / this._p1) * p : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p); 51068 } 51069 return this._calcEnd ? 1 : r; 51070 }; 51071 SlowMo.ease = new SlowMo(0.7, 0.7); 51072 51073 p.config = SlowMo.config = function(linearRatio, power, yoyoMode) { 51074 return new SlowMo(linearRatio, power, yoyoMode); 51075 }; 51076 51077 51078 //SteppedEase 51079 SteppedEase = _class("easing.SteppedEase", function(steps) { 51080 steps = steps || 1; 51081 this._p1 = 1 / steps; 51082 this._p2 = steps + 1; 51083 }, true); 51084 p = SteppedEase.prototype = new Ease(); 51085 p.constructor = SteppedEase; 51086 p.getRatio = function(p) { 51087 if (p < 0) { 51088 p = 0; 51089 } else if (p >= 1) { 51090 p = 0.999999999; 51091 } 51092 return ((this._p2 * p) >> 0) * this._p1; 51093 }; 51094 p.config = SteppedEase.config = function(steps) { 51095 return new SteppedEase(steps); 51096 }; 51097 51098 51099 //RoughEase 51100 RoughEase = _class("easing.RoughEase", function(vars) { 51101 vars = vars || {}; 51102 var taper = vars.taper || "none", 51103 a = [], 51104 cnt = 0, 51105 points = (vars.points || 20) | 0, 51106 i = points, 51107 randomize = (vars.randomize !== false), 51108 clamp = (vars.clamp === true), 51109 template = (vars.template instanceof Ease) ? vars.template : null,
51110 strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4, 51111 x, y, bump, invX, obj, pnt; 51112 while (--i > -1) { 51113 x = randomize ? Math.random() : (1 / points) * i; 51114 y = template ? template.getRatio(x) : x; 51115 if (taper === "none") { 51116 bump = strength; 51117 } else if (taper === "out") { 51118 invX = 1 - x; 51119 bump = invX * invX * strength; 51120 } else if (taper === "in") { 51121 bump = x * x * strength; 51122 } else if (x < 0.5) { //"both" (start) 51123 invX = x * 2; 51124 bump = invX * invX * 0.5 * strength; 51125 } else { //"both" (end) 51126 invX = (1 - x) * 2; 51127 bump = invX * invX * 0.5 * strength; 51128 } 51129 if (randomize) { 51130 y += (Math.random() * bump) - (bump * 0.5); 51131 } else if (i % 2) { 51132 y += bump * 0.5; 51133 } else { 51134 y -= bump * 0.5; 51135 } 51136 if (clamp) { 51137 if (y > 1) { 51138 y = 1; 51139 } else if (y < 0) { 51140 y = 0; 51141 } 51142 } 51143 a[cnt++] = {x:x, y:y}; 51144 } 51145 a.sort(function(a, b) { 51146 return a.x - b.x; 51147 }); 51148 51149 pnt = new EasePoint(1, 1, null); 51150 i = points; 51151 while (--i > -1) { 51152 obj = a[i]; 51153 pnt = new EasePoint(obj.x, obj.y, pnt); 51154 } 51155 51156 this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next); 51157 }, true); 51158 p = RoughEase.prototype = new Ease(); 51159 p.constructor = RoughEase; 51160 p.getRatio = function(p) { 51161 var pnt = this._prev; 51162 if (p > pnt.t) { 51163 while (pnt.next && p >= pnt.t) { 51164 pnt = pnt.next; 51165 } 51166 pnt = pnt.prev; 51167 } else { 51168 while (pnt.prev && p <= pnt.t) { 51169 pnt = pnt.prev; 51170 } 51171 } 51172 this._prev = pnt; 51173 return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c); 51174 }; 51175 p.config = function(vars) { 51176 return new RoughEase(vars); 51177 }; 51178 RoughEase.ease = new RoughEase(); 51179 51180 51181 //Bounce 51182 _wrap("Bounce", 51183 _create("BounceOut", function(p) { 51184 if (p < 1 / 2.75) { 51185 return 7.5625 * p * p; 51186 } else if (p < 2 / 2.75) { 51187 return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; 51188 } else if (p < 2.5 / 2.75) { 51189 return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; 51190 } 51191 return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; 51192 }), 51193 _create("BounceIn", function(p) { 51194 if ((p = 1 - p) < 1 / 2.75) { 51195 return 1 - (7.5625 * p * p); 51196 } else if (p < 2 / 2.75) { 51197 return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75); 51198 } else if (p < 2.5 / 2.75) { 51199 return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375); 51200 } 51201 return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375); 51202 }), 51203 _create("BounceInOut", function(p) { 51204 var invert = (p < 0.5); 51205 if (invert) { 51206 p = 1 - (p * 2); 51207 } else { 51208 p = (p * 2) - 1; 51209 } 51210 if (p < 1 / 2.75) { 51211 p = 7.5625 * p * p; 51212 } else if (p < 2 / 2.75) { 51213 p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; 51214 } else if (p < 2.5 / 2.75) { 51215 p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; 51216 } else { 51217 p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; 51218 } 51219 return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5; 51220 }) 51221 ); 51222 51223 51224 //CIRC 51225 _wrap("Circ", 51226 _create("CircOut", function(p) { 51227 return Math.sqrt(1 - (p = p - 1) * p); 51228 }), 51229 _create("CircIn", function(p) { 51230 return -(Math.sqrt(1 - (p * p)) - 1); 51231 }), 51232 _create("CircInOut", function(p) { 51233 return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1); 51234 }) 51235 ); 51236 51237 51238 //Elastic 51239 _createElastic = function(n, f, def) { 51240 var C = _class("easing." + n, function(amplitude, period) { 51241 this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. 51242 this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1); 51243 this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0); 51244 this._p2 = _2PI / this._p2; //precalculate to optimize 51245 }, true), 51246 p = C.prototype = new Ease(); 51247 p.constructor = C; 51248 p.getRatio = f; 51249 p.config = function(amplitude, period) { 51250 return new C(amplitude, period); 51251 }; 51252 return C; 51253 }; 51254 _wrap("Elastic", 51255 _createElastic("ElasticOut", function(p) { 51256 return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1; 51257 }, 0.3), 51258 _createElastic("ElasticIn", function(p) { 51259 return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 )); 51260 }, 0.3), 51261 _createElastic("ElasticInOut", function(p) { 51262 return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1; 51263 }, 0.45) 51264 ); 51265 51266 51267 //Expo 51268 _wrap("Expo", 51269 _create("ExpoOut", function(p) { 51270 return 1 - Math.pow(2, -10 * p); 51271 }), 51272 _create("ExpoIn", function(p) { 51273 return Math.pow(2, 10 * (p - 1)) - 0.001; 51274 }), 51275 _create("ExpoInOut", function(p) { 51276 return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1))); 51277 }) 51278 ); 51279 51280 51281 //Sine 51282 _wrap("Sine", 51283 _create("SineOut", function(p) { 51284 return Math.sin(p * _HALF_PI); 51285 }), 51286 _create("SineIn", function(p) { 51287 return -Math.cos(p * _HALF_PI) + 1; 51288 }), 51289 _create("SineInOut", function(p) { 51290 return -0.5 * (Math.cos(Math.PI * p) - 1); 51291 }) 51292 ); 51293 51294 _class("easing.EaseLookup", { 51295 find:function(s) { 51296 return Ease.map[s]; 51297 } 51298 }, true); 51299 51300 //register the non-standard eases 51301 _easeReg(w.SlowMo, "SlowMo", "ease,"); 51302 _easeReg(RoughEase, "RoughEase", "ease,");
51303 _easeReg(SteppedEase, "SteppedEase", "ease,"); 51304 51305 return Back; 51306 51307 }, true); 51308 51309 51310 }); 51311 51312 if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case TweenLite was already loaded separately. 51313 51314 51315 51316 51317 51318 51319 51320 51321 51322 51323 51324 /* 51325 * ---------------------------------------------------------------- 51326 * Base classes like TweenLite, SimpleTimeline, Ease, Ticker, etc. 51327 * ---------------------------------------------------------------- 51328 */ 51329 (function(window, moduleName) { 51330 51331 "use strict"; 51332 var _exports = {}, 51333 _doc = window.document, 51334 _globals = window.GreenSockGlobals = window.GreenSockGlobals || window; 51335 if (_globals.TweenLite) { 51336 return; //in case the core set of classes is already loaded, don't instantiate twice. 51337 } 51338 var _namespace = function(ns) { 51339 var a = ns.split("."), 51340 p = _globals, i; 51341 for (i = 0; i < a.length; i++) { 51342 p[a[i]] = p = p[a[i]] || {}; 51343 } 51344 return p; 51345 }, 51346 gs = _namespace("com.greensock"), 51347 _tinyNum = 0.0000000001, 51348 _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 51349 var b = [], 51350 l = a.length, 51351 i; 51352 for (i = 0; i !== l; b.push(a[i++])) {} 51353 return b; 51354 }, 51355 _emptyFunc = function() {}, 51356 _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower) 51357 var toString = Object.prototype.toString, 51358 array = toString.call([]); 51359 return function(obj) { 51360 return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array)); 51361 }; 51362 }()), 51363 a, i, p, _ticker, _tickerActive, 51364 _defLookup = {}, 51365 51366 /** 51367 * @constructor 51368 * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition. 51369 * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is 51370 * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin 51371 * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally. 51372 * 51373 * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found, 51374 * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere, 51375 * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so 51376 * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything 51377 * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock 51378 * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could 51379 * sandbox the banner one like: 51380 * 51381 * <script> 51382 * var gs = window.GreenSockGlobals = {}; //the newer version we're about to load could now be referenced in a "gs" object, like gs.TweenLite.to(...). Use whatever alias you want as long as it's unique, "gs" or "banner" or whatever. 51383 * </script> 51384 * <script src="js/greensock/v1.7/TweenMax.js"></script> 51385 * <script> 51386 * window.GreenSockGlobals = window._gsQueue = window._gsDefine = null; //reset it back to null (along with the special _gsQueue variable) so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...) 51387 * </script> 51388 * <script src="js/greensock/v1.6/TweenMax.js"></script> 51389 * <script> 51390 * gs.TweenLite.to(...); //would use v1.7 51391 * TweenLite.to(...); //would use v1.6 51392 * </script> 51393 * 51394 * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back". 51395 * @param {!Array.<string>}
51395 dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"] 51396 * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition. 51397 * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object) 51398 */ 51399 Definition = function(ns, dependencies, func, global) { 51400 this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses 51401 _defLookup[ns] = this; 51402 this.gsClass = null; 51403 this.func = func; 51404 var _classes = []; 51405 this.check = function(init) { 51406 var i = dependencies.length, 51407 missing = i, 51408 cur, a, n, cl, hasModule; 51409 while (--i > -1) { 51410 if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) { 51411 _classes[i] = cur.gsClass; 51412 missing--; 51413 } else if (init) { 51414 cur.sc.push(this); 51415 } 51416 } 51417 if (missing === 0 && func) { 51418 a = ("com.greensock." + ns).split("."); 51419 n = a.pop(); 51420 cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes); 51421 51422 //exports to multiple environments 51423 if (global) { 51424 _globals[n] = _exports[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.) 51425 hasModule = (typeof(module) !== "undefined" && module.exports); 51426 if (!hasModule && "function" === "function" && __webpack_require__(311)){ //AMD 51427 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { return cl; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 51428 } else if (hasModule){ //node 51429 if (ns === moduleName) { 51430 module.exports = _exports[moduleName] = cl; 51431 for (i in _exports) { 51432 cl[i] = _exports[i]; 51433 } 51434 } else if (_exports[moduleName]) { 51435 _exports[moduleName][n] = cl; 51436 } 51437 } 51438 } 51439 for (i = 0; i < this.sc.length; i++) { 51440 this.sc[i].check(); 51441 } 51442 } 51443 }; 51444 this.check(true); 51445 }, 51446 51447 //used to create Definition instances (which basically registers a class that has dependencies). 51448 _gsDefine = window._gsDefine = function(ns, dependencies, func, global) { 51449 return new Definition(ns, dependencies, func, global); 51450 }, 51451 51452 //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class). 51453 _class = gs._class = function(ns, func, global) { 51454 func = func || function() {}; 51455 _gsDefine(ns, [], function(){ return func; }, global); 51456 return func; 51457 }; 51458 51459 _gsDefine.globals = _globals; 51460 51461 51462 51463 /* 51464 * ---------------------------------------------------------------- 51465 * Ease 51466 * ---------------------------------------------------------------- 51467 */ 51468 var _baseParams = [0, 0, 1, 1], 51469 _blankArray = [], 51470 Ease = _class("easing.Ease", function(func, extraParams, type, power) { 51471 this._func = func; 51472 this._type = type || 0; 51473 this._power = power || 0; 51474 this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams; 51475 }, true), 51476 _easeMap = Ease.map = {}, 51477 _easeReg = Ease.register = function(ease, names, types, create) { 51478 var na = names.split(","), 51479 i = na.length, 51480 ta = (types || "easeIn,easeOut,easeInOut").split(","), 51481 e, name, j, type; 51482 while (--i > -1) { 51483 name = na[i]; 51484 e = create ? _class("easing."+name, null, true) : gs.easing[name] || {}; 51485 j = ta.length; 51486 while (--j > -1) { 51487 type = ta[j]; 51488 _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease(); 51489 } 51490 } 51491 }; 51492 51493 p = Ease.prototype; 51494 p._calcEnd = false;
51495 p.getRatio = function(p) { 51496 if (this._func) { 51497 this._params[0] = p; 51498 return this._func.apply(null, this._params); 51499 } 51500 var t = this._type, 51501 pw = this._power, 51502 r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2; 51503 if (pw === 1) { 51504 r *= r; 51505 } else if (pw === 2) { 51506 r *= r * r; 51507 } else if (pw === 3) { 51508 r *= r * r * r; 51509 } else if (pw === 4) { 51510 r *= r * r * r * r; 51511 } 51512 return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2); 51513 }; 51514 51515 //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut) 51516 a = ["Linear","Quad","Cubic","Quart","Quint,Strong"]; 51517 i = a.length; 51518 while (--i > -1) { 51519 p = a[i]+",Power"+i; 51520 _easeReg(new Ease(null,null,1,i), p, "easeOut", true); 51521 _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : "")); 51522 _easeReg(new Ease(null,null,3,i), p, "easeInOut"); 51523 } 51524 _easeMap.linear = gs.easing.Linear.easeIn; 51525 _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks 51526 51527 51528 /* 51529 * ---------------------------------------------------------------- 51530 * EventDispatcher 51531 * ---------------------------------------------------------------- 51532 */ 51533 var EventDispatcher = _class("events.EventDispatcher", function(target) { 51534 this._listeners = {}; 51535 this._eventTarget = target || this; 51536 }); 51537 p = EventDispatcher.prototype; 51538 51539 p.addEventListener = function(type, callback, scope, useParam, priority) { 51540 priority = priority || 0; 51541 var list = this._listeners[type], 51542 index = 0, 51543 listener, i; 51544 if (this === _ticker && !_tickerActive) { 51545 _ticker.wake(); 51546 } 51547 if (list == null) { 51548 this._listeners[type] = list = []; 51549 } 51550 i = list.length; 51551 while (--i > -1) { 51552 listener = list[i]; 51553 if (listener.c === callback && listener.s === scope) { 51554 list.splice(i, 1); 51555 } else if (index === 0 && listener.pr < priority) { 51556 index = i + 1; 51557 } 51558 } 51559 list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority}); 51560 }; 51561 51562 p.removeEventListener = function(type, callback) { 51563 var list = this._listeners[type], i; 51564 if (list) { 51565 i = list.length; 51566 while (--i > -1) { 51567 if (list[i].c === callback) { 51568 list.splice(i, 1); 51569 return; 51570 } 51571 } 51572 } 51573 }; 51574 51575 p.dispatchEvent = function(type) { 51576 var list = this._listeners[type], 51577 i, t, listener; 51578 if (list) { 51579 i = list.length; 51580 if (i > 1) { 51581 list = list.slice(0); //in case addEventListener() is called from within a listener/callback (otherwise the index could change, resulting in a skip) 51582 } 51583 t = this._eventTarget; 51584 while (--i > -1) { 51585 listener = list[i]; 51586 if (listener) { 51587 if (listener.up) { 51588 listener.c.call(listener.s || t, {type:type, target:t}); 51589 } else { 51590 listener.c.call(listener.s || t); 51591 } 51592 } 51593 } 51594 } 51595 }; 51596 51597 51598 /* 51599 * ---------------------------------------------------------------- 51600 * Ticker 51601 * ---------------------------------------------------------------- 51602 */ 51603 var _reqAnimFrame = window.requestAnimationFrame, 51604 _cancelAnimFrame = window.cancelAnimationFrame, 51605 _getTime = Date.now || function() {return new Date().getTime();}, 51606 _lastUpdate = _getTime(); 51607 51608 //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill. 51609 a = ["ms","moz","webkit","o"]; 51610 i = a.length; 51611 while (--i > -1 && !_reqAnimFrame) { 51612 _reqAnimFrame = window[a[i] + "RequestAnimationFrame"]; 51613 _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"]; 51614 } 51615 51616 _class("Ticker", function(fps, useRAF) { 51617 var _self = this, 51618 _startTime = _getTime(), 51619 _useRAF = (useRAF !== false && _reqAnimFrame) ? "auto" : false, 51620 _lagThreshold = 500, 51621 _adjustedLag = 33, 51622 _tickWord = "tick", //helps reduce gc burden 51623 _fps, _req, _id, _gap, _nextTime, 51624 _tick = function(manual) {
51625 var elapsed = _getTime() - _lastUpdate, 51626 overlap, dispatch; 51627 if (elapsed > _lagThreshold) { 51628 _startTime += elapsed - _adjustedLag; 51629 } 51630 _lastUpdate += elapsed; 51631 _self.time = (_lastUpdate - _startTime) / 1000; 51632 overlap = _self.time - _nextTime; 51633 if (!_fps || overlap > 0 || manual === true) { 51634 _self.frame++; 51635 _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap); 51636 dispatch = true; 51637 } 51638 if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. 51639 _id = _req(_tick); 51640 } 51641 if (dispatch) { 51642 _self.dispatchEvent(_tickWord); 51643 } 51644 }; 51645 51646 EventDispatcher.call(_self); 51647 _self.time = _self.frame = 0; 51648 _self.tick = function() { 51649 _tick(true); 51650 }; 51651 51652 _self.lagSmoothing = function(threshold, adjustedLag) { 51653 _lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited 51654 _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0); 51655 }; 51656 51657 _self.sleep = function() { 51658 if (_id == null) { 51659 return; 51660 } 51661 if (!_useRAF || !_cancelAnimFrame) { 51662 clearTimeout(_id); 51663 } else { 51664 _cancelAnimFrame(_id); 51665 } 51666 _req = _emptyFunc; 51667 _id = null; 51668 if (_self === _ticker) { 51669 _tickerActive = false; 51670 } 51671 }; 51672 51673 _self.wake = function(seamless) { 51674 if (_id !== null) { 51675 _self.sleep(); 51676 } else if (seamless) { 51677 _startTime += -_lastUpdate + (_lastUpdate = _getTime()); 51678 } else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout(). 51679 _lastUpdate = _getTime() - _lagThreshold + 5; 51680 } 51681 _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame; 51682 if (_self === _ticker) { 51683 _tickerActive = true; 51684 } 51685 _tick(2); 51686 }; 51687 51688 _self.fps = function(value) { 51689 if (!arguments.length) { 51690 return _fps; 51691 } 51692 _fps = value; 51693 _gap = 1 / (_fps || 60); 51694 _nextTime = this.time + _gap; 51695 _self.wake(); 51696 }; 51697 51698 _self.useRAF = function(value) { 51699 if (!arguments.length) { 51700 return _useRAF; 51701 } 51702 _self.sleep(); 51703 _useRAF = value; 51704 _self.fps(_fps); 51705 }; 51706 _self.fps(fps); 51707 51708 //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition. 51709 setTimeout(function() { 51710 if (_useRAF === "auto" && _self.frame < 5 && _doc.visibilityState !== "hidden") { 51711 _self.useRAF(false); 51712 } 51713 }, 1500); 51714 }); 51715 51716 p = gs.Ticker.prototype = new gs.events.EventDispatcher(); 51717 p.constructor = gs.Ticker; 51718 51719 51720 /* 51721 * ---------------------------------------------------------------- 51722 * Animation 51723 * ---------------------------------------------------------------- 51724 */ 51725 var Animation = _class("core.Animation", function(duration, vars) { 51726 this.vars = vars = vars || {}; 51727 this._duration = this._totalDuration = duration || 0; 51728 this._delay = Number(vars.delay) || 0; 51729 this._timeScale = 1; 51730 this._active = (vars.immediateRender === true); 51731 this.data = vars.data; 51732 this._reversed = (vars.reversed === true); 51733 51734 if (!_rootTimeline) { 51735 return; 51736 } 51737 if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly. 51738 _ticker.wake(); 51739 } 51740 51741 var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline; 51742 tl.add(this, tl._time); 51743 51744 if (this.vars.paused) { 51745 this.paused(true); 51746 } 51747 }); 51748 51749 _ticker = Animation.ticker = new gs.Ticker(); 51750 p = Animation.prototype; 51751 p._dirty = p._gc = p._initted = p._paused = false;
51752 p._totalTime = p._time = 0; 51753 p._rawPrevTime = -1; 51754 p._next = p._last = p._onUpdate = p._timeline = p.timeline = null; 51755 p._paused = false; 51756 51757 51758 //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker. 51759 var _checkTimeout = function() { 51760 if (_tickerActive && _getTime() - _lastUpdate > 2000) { 51761 _ticker.wake(); 51762 } 51763 setTimeout(_checkTimeout, 2000); 51764 }; 51765 _checkTimeout(); 51766 51767 51768 p.play = function(from, suppressEvents) { 51769 if (from != null) { 51770 this.seek(from, suppressEvents); 51771 } 51772 return this.reversed(false).paused(false); 51773 }; 51774 51775 p.pause = function(atTime, suppressEvents) { 51776 if (atTime != null) { 51777 this.seek(atTime, suppressEvents); 51778 } 51779 return this.paused(true); 51780 }; 51781 51782 p.resume = function(from, suppressEvents) { 51783 if (from != null) { 51784 this.seek(from, suppressEvents); 51785 } 51786 return this.paused(false); 51787 }; 51788 51789 p.seek = function(time, suppressEvents) { 51790 return this.totalTime(Number(time), suppressEvents !== false); 51791 }; 51792 51793 p.restart = function(includeDelay, suppressEvents) { 51794 return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true); 51795 }; 51796 51797 p.reverse = function(from, suppressEvents) { 51798 if (from != null) { 51799 this.seek((from || this.totalDuration()), suppressEvents); 51800 } 51801 return this.reversed(true).paused(false); 51802 }; 51803 51804 p.render = function(time, suppressEvents, force) { 51805 //stub - we override this method in subclasses. 51806 }; 51807 51808 p.invalidate = function() { 51809 this._time = this._totalTime = 0; 51810 this._initted = this._gc = false; 51811 this._rawPrevTime = -1; 51812 if (this._gc || !this.timeline) { 51813 this._enabled(true); 51814 } 51815 return this; 51816 }; 51817 51818 p.isActive = function() { 51819 var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active. 51820 startTime = this._startTime, 51821 rawTime; 51822 return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale)); 51823 }; 51824 51825 p._enabled = function (enabled, ignoreTimeline) { 51826 if (!_tickerActive) { 51827 _ticker.wake(); 51828 } 51829 this._gc = !enabled; 51830 this._active = this.isActive(); 51831 if (ignoreTimeline !== true) { 51832 if (enabled && !this.timeline) { 51833 this._timeline.add(this, this._startTime - this._delay); 51834 } else if (!enabled && this.timeline) { 51835 this._timeline._remove(this, true); 51836 } 51837 } 51838 return false; 51839 }; 51840 51841 51842 p._kill = function(vars, target) { 51843 return this._enabled(false, false); 51844 }; 51845 51846 p.kill = function(vars, target) { 51847 this._kill(vars, target); 51848 return this; 51849 }; 51850 51851 p._uncache = function(includeSelf) { 51852 var tween = includeSelf ? this : this.timeline; 51853 while (tween) { 51854 tween._dirty = true; 51855 tween = tween.timeline; 51856 } 51857 return this; 51858 }; 51859 51860 p._swapSelfInParams = function(params) { 51861 var i = params.length, 51862 copy = params.concat(); 51863 while (--i > -1) { 51864 if (params[i] === "{self}") { 51865 copy[i] = this; 51866 } 51867 } 51868 return copy; 51869 }; 51870 51871 p._callback = function(type) { 51872 var v = this.vars, 51873 callback = v[type], 51874 params = v[type + "Params"], 51875 scope = v[type + "Scope"] || v.callbackScope || this, 51876 l = params ? params.length : 0; 51877 switch (l) { //speed optimization; call() is faster than apply() so use it when there are only a few parameters (which is by far most common). Previously we simply did var v = this.vars; v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray); 51878 case 0: callback.call(scope); break; 51879 case 1: callback.call(scope, params[0]); break; 51880 case 2: callback.call(scope, params[0], params[1]); break; 51881 default: callback.apply(scope, params); 51882 } 51883 }; 51884 51885 //----Animation getters/setters -------------------------------------------------------- 51886 51887 p.eventCallback = function(type, callback, params, scope) { 51888 if ((type || "").substr(0,2) === "on") { 51889 var v = this.vars; 51890 if (arguments.length === 1) { 51891 return v[type]; 51892 } 51893 if (callback == null) { 51894 delete v[type]; 51895 } else { 51896 v[type] = callback; 51897 v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params; 51898 v[type + "Scope"] = scope; 51899 } 51900 if (type === "onUpdate") { 51901 this._onUpdate = callback; 51902 } 51903 } 51904 return this; 51905 }; 51906 51907 p.delay = function(value) { 51908 if (!arguments.length) { 51909 return this._delay; 51910 } 51911 if (this._timeline.smoothChildTiming) { 51912 this.startTime( this._startTime + value - this._delay ); 51913 }
51914 this._delay = value; 51915 return this; 51916 }; 51917 51918 p.duration = function(value) { 51919 if (!arguments.length) { 51920 this._dirty = false; 51921 return this._duration; 51922 } 51923 this._duration = this._totalDuration = value; 51924 this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration. 51925 if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) { 51926 this.totalTime(this._totalTime * (value / this._duration), true); 51927 } 51928 return this; 51929 }; 51930 51931 p.totalDuration = function(value) { 51932 this._dirty = false; 51933 return (!arguments.length) ? this._totalDuration : this.duration(value); 51934 }; 51935 51936 p.time = function(value, suppressEvents) { 51937 if (!arguments.length) { 51938 return this._time; 51939 } 51940 if (this._dirty) { 51941 this.totalDuration(); 51942 } 51943 return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents); 51944 }; 51945 51946 p.totalTime = function(time, suppressEvents, uncapped) { 51947 if (!_tickerActive) { 51948 _ticker.wake(); 51949 } 51950 if (!arguments.length) { 51951 return this._totalTime; 51952 } 51953 if (this._timeline) { 51954 if (time < 0 && !uncapped) { 51955 time += this.totalDuration(); 51956 } 51957 if (this._timeline.smoothChildTiming) { 51958 if (this._dirty) { 51959 this.totalDuration(); 51960 } 51961 var totalDuration = this._totalDuration, 51962 tl = this._timeline; 51963 if (time > totalDuration && !uncapped) { 51964 time = totalDuration; 51965 } 51966 this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale); 51967 if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. 51968 this._uncache(false); 51969 } 51970 //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed. 51971 if (tl._timeline) { 51972 while (tl._timeline) { 51973 if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) { 51974 tl.totalTime(tl._totalTime, true); 51975 } 51976 tl = tl._timeline; 51977 } 51978 } 51979 } 51980 if (this._gc) { 51981 this._enabled(true, false); 51982 } 51983 if (this._totalTime !== time || this._duration === 0) { 51984 if (_lazyTweens.length) { 51985 _lazyRender(); 51986 } 51987 this.render(time, suppressEvents, false); 51988 if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. 51989 _lazyRender(); 51990 } 51991 } 51992 } 51993 return this; 51994 }; 51995 51996 p.progress = p.totalProgress = function(value, suppressEvents) { 51997 var duration = this.duration(); 51998 return (!arguments.length) ? (duration ? this._time / duration : this.ratio) : this.totalTime(duration * value, suppressEvents); 51999 }; 52000 52001 p.startTime = function(value) { 52002 if (!arguments.length) { 52003 return this._startTime; 52004 } 52005 if (value !== this._startTime) { 52006 this._startTime = value; 52007 if (this.timeline) if (this.timeline._sortChildren) { 52008 this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. 52009 } 52010 } 52011 return this; 52012 }; 52013 52014 p.endTime = function(includeRepeats) { 52015 return this._startTime + ((includeRepeats != false) ? this.totalDuration() : this.duration()) / this._timeScale; 52016 }; 52017 52018 p.timeScale = function(value) { 52019 if (!arguments.length) { 52020 return this._timeScale; 52021 } 52022 value = value || _tinyNum; //can't allow zero because it'll throw the math off 52023 if (this._timeline && this._timeline.smoothChildTiming) { 52024 var pauseTime = this._pauseTime, 52025 t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime(); 52026 this._startTime = t - ((t - this._startTime) * this._timeScale / value); 52027 } 52028 this._timeScale = value; 52029 return this._uncache(false); 52030 }; 52031 52032 p.reversed = function(value) { 52033 if (!arguments.length) { 52034 return this._reversed; 52035 } 52036 if (value != this._reversed) { 52037 this._reversed = value; 52038 this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true); 52039 } 52040 return this; 52041 }; 52042 52043 p.paused = function(value) { 52044 if (!arguments.length) { 52045 return this._paused; 52046 } 52047 var tl = this._timeline, 52048 raw, elapsed; 52049 if (value != this._paused) if (tl) { 52050 if (!_tickerActive && !value) { 52051 _ticker.wake(); 52052 } 52053 raw = tl.rawTime();
52054 elapsed = raw - this._pauseTime; 52055 if (!value && tl.smoothChildTiming) { 52056 this._startTime += elapsed; 52057 this._uncache(false); 52058 } 52059 this._pauseTime = value ? raw : null; 52060 this._paused = value; 52061 this._active = this.isActive(); 52062 if (!value && elapsed !== 0 && this._initted && this.duration()) { 52063 raw = tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale; 52064 this.render(raw, (raw === this._totalTime), true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render. 52065 } 52066 } 52067 if (this._gc && !value) { 52068 this._enabled(true, false); 52069 } 52070 return this; 52071 }; 52072 52073 52074 /* 52075 * ---------------------------------------------------------------- 52076 * SimpleTimeline 52077 * ---------------------------------------------------------------- 52078 */ 52079 var SimpleTimeline = _class("core.SimpleTimeline", function(vars) { 52080 Animation.call(this, 0, vars); 52081 this.autoRemoveChildren = this.smoothChildTiming = true; 52082 }); 52083 52084 p = SimpleTimeline.prototype = new Animation(); 52085 p.constructor = SimpleTimeline; 52086 p.kill()._gc = false; 52087 p._first = p._last = p._recent = null; 52088 p._sortChildren = false; 52089 52090 p.add = p.insert = function(child, position, align, stagger) { 52091 var prevTween, st; 52092 child._startTime = Number(position || 0) + child._delay; 52093 if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order). 52094 child._pauseTime = child._startTime + ((this.rawTime() - child._startTime) / child._timeScale); 52095 } 52096 if (child.timeline) { 52097 child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one. 52098 } 52099 child.timeline = child._timeline = this; 52100 if (child._gc) { 52101 child._enabled(true, true); 52102 } 52103 prevTween = this._last; 52104 if (this._sortChildren) { 52105 st = child._startTime; 52106 while (prevTween && prevTween._startTime > st) { 52107 prevTween = prevTween._prev; 52108 } 52109 } 52110 if (prevTween) { 52111 child._next = prevTween._next; 52112 prevTween._next = child; 52113 } else { 52114 child._next = this._first; 52115 this._first = child; 52116 } 52117 if (child._next) { 52118 child._next._prev = child; 52119 } else { 52120 this._last = child; 52121 } 52122 child._prev = prevTween; 52123 this._recent = child; 52124 if (this._timeline) { 52125 this._uncache(true); 52126 } 52127 return this; 52128 }; 52129 52130 p._remove = function(tween, skipDisable) { 52131 if (tween.timeline === this) { 52132 if (!skipDisable) { 52133 tween._enabled(false, true); 52134 } 52135 52136 if (tween._prev) { 52137 tween._prev._next = tween._next; 52138 } else if (this._first === tween) { 52139 this._first = tween._next; 52140 } 52141 if (tween._next) { 52142 tween._next._prev = tween._prev; 52143 } else if (this._last === tween) { 52144 this._last = tween._prev; 52145 } 52146 tween._next = tween._prev = tween.timeline = null; 52147 if (tween === this._recent) { 52148 this._recent = this._last; 52149 } 52150 52151 if (this._timeline) { 52152 this._uncache(true); 52153 } 52154 } 52155 return this; 52156 }; 52157 52158 p.render = function(time, suppressEvents, force) { 52159 var tween = this._first, 52160 next; 52161 this._totalTime = this._time = this._rawPrevTime = time; 52162 while (tween) { 52163 next = tween._next; //record it here because the value could change after rendering... 52164 if (tween._active || (time >= tween._startTime && !tween._paused)) { 52165 if (!tween._reversed) { 52166 tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 52167 } else { 52168 tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 52169 } 52170 } 52171 tween = next; 52172 } 52173 }; 52174 52175 p.rawTime = function() { 52176 if (!_tickerActive) { 52177 _ticker.wake(); 52178 } 52179 return this._totalTime; 52180 }; 52181 52182 /* 52183 * ---------------------------------------------------------------- 52184 * TweenLite 52185 * ---------------------------------------------------------------- 52186 */ 52187 var TweenLite = _class("TweenLite", function(target, duration, vars) { 52188 Animation.call(this, duration, vars); 52189 this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method) 52190 52191 if (target == null) { 52192 throw "Cannot tween a null target."; 52193 } 52194 52195 this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; 52196 52197 var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))),
52198 overwrite = this.vars.overwrite, 52199 i, targ, targets; 52200 52201 this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite]; 52202 52203 if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") { 52204 this._targets = targets = _slice(target); //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 52205 this._propLookup = []; 52206 this._siblings = []; 52207 for (i = 0; i < targets.length; i++) { 52208 targ = targets[i]; 52209 if (!targ) { 52210 targets.splice(i--, 1); 52211 continue; 52212 } else if (typeof(targ) === "string") { 52213 targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings 52214 if (typeof(targ) === "string") { 52215 targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case) 52216 } 52217 continue; 52218 } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself. 52219 targets.splice(i--, 1); 52220 this._targets = targets = targets.concat(_slice(targ)); 52221 continue; 52222 } 52223 this._siblings[i] = _register(targ, this, false); 52224 if (overwrite === 1) if (this._siblings[i].length > 1) { 52225 _applyOverwrite(targ, this, null, 1, this._siblings[i]); 52226 } 52227 } 52228 52229 } else { 52230 this._propLookup = {}; 52231 this._siblings = _register(target, this, false); 52232 if (overwrite === 1) if (this._siblings.length > 1) { 52233 _applyOverwrite(target, this, null, 1, this._siblings); 52234 } 52235 } 52236 if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) { 52237 this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) 52238 this.render(Math.min(0, -this._delay)); //in case delay is negative 52239 } 52240 }, true), 52241 _isSelector = function(v) { 52242 return (v && v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox. 52243 }, 52244 _autoCSS = function(vars, target) { 52245 var css = {}, 52246 p; 52247 for (p in vars) { 52248 if (!_reservedProps[p] && (!(p in target) || p === "transform" || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties. 52249 css[p] = vars[p]; 52250 delete vars[p]; 52251 } 52252 } 52253 vars.css = css; 52254 }; 52255 52256 p = TweenLite.prototype = new Animation(); 52257 p.constructor = TweenLite; 52258 p.kill()._gc = false; 52259 52260 //----TweenLite defaults, overwrite management, and root updates ---------------------------------------------------- 52261 52262 p.ratio = 0; 52263 p._firstPT = p._targets = p._overwrittenProps = p._startAt = null; 52264 p._notifyPluginsOfEnabled = p._lazy = false; 52265 52266 TweenLite.version = "1.19.1"; 52267 TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1); 52268 TweenLite.defaultOverwrite = "auto"; 52269 TweenLite.ticker = _ticker; 52270 TweenLite.autoSleep = 120; 52271 TweenLite.lagSmoothing = function(threshold, adjustedLag) {
52272 _ticker.lagSmoothing(threshold, adjustedLag); 52273 }; 52274 52275 TweenLite.selector = window.$ || window.jQuery || function(e) { 52276 var selector = window.$ || window.jQuery; 52277 if (selector) { 52278 TweenLite.selector = selector; 52279 return selector(e); 52280 } 52281 return (typeof(_doc) === "undefined") ? e : (_doc.querySelectorAll ? _doc.querySelectorAll(e) : _doc.getElementById((e.charAt(0) === "#") ? e.substr(1) : e)); 52282 }; 52283 52284 var _lazyTweens = [], 52285 _lazyLookup = {}, 52286 _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, 52287 //_nonNumbersExp = /(?:([\-+](?!(\d|=)))|[^\d\-+=e]|(e(?![\-+][\d])))+/ig, 52288 _setRatio = function(v) { 52289 var pt = this._firstPT, 52290 min = 0.000001, 52291 val; 52292 while (pt) { 52293 val = !pt.blob ? pt.c * v + pt.s : (v === 1) ? this.end : v ? this.join("") : this.start; 52294 if (pt.m) { 52295 val = pt.m(val, this._target || pt.t); 52296 } else if (val < min) if (val > -min && !pt.blob) { //prevents issues with converting very small numbers to strings in the browser 52297 val = 0; 52298 } 52299 if (!pt.f) { 52300 pt.t[pt.p] = val; 52301 } else if (pt.fp) { 52302 pt.t[pt.p](pt.fp, val); 52303 } else { 52304 pt.t[pt.p](val); 52305 } 52306 pt = pt._next; 52307 } 52308 }, 52309 //compares two strings (start/end), finds the numbers that are different and spits back an array representing the whole value but with the changing values isolated as elements. For example, "rgb(0,0,0)" and "rgb(100,50,0)" would become ["rgb(", 0, ",", 50, ",0)"]. Notice it merges the parts that are identical (performance optimization). The array also has a linked list of PropTweens attached starting with _firstPT that contain the tweening data (t, p, s, c, f, etc.). It also stores the starting value as a "start" property so that we can revert to it if/when necessary, like when a tween rewinds fully. If the quantity of numbers differs between the start and end, it will always prioritize the end value(s). The pt parameter is optional - it's for a PropTween that will be appended to the end of the linked list and is typically for actually setting the value after all of the elements have been updated (with array.join("")). 52310 _blobDif = function(start, end, filter, pt) { 52311 var a = [], 52312 charIndex = 0, 52313 s = "", 52314 color = 0, 52315 startNums, endNums, num, i, l, nonNumbers, currentNum; 52316 a.start = start; 52317 a.end = end; 52318 start = a[0] = start + ""; //ensure values are strings 52319 end = a[1] = end + ""; 52320 if (filter) { 52321 filter(a); //pass an array with the starting and ending values and let the filter do whatever it needs to the values. 52322 start = a[0]; 52323 end = a[1]; 52324 } 52325 a.length = 0; 52326 startNums = start.match(_numbersExp) || []; 52327 endNums = end.match(_numbersExp) || []; 52328 if (pt) { 52329 pt._next = null; 52330 pt.blob = 1; 52331 a._firstPT = a._applyPT = pt; //apply last in the linked list (which means inserting it first) 52332 } 52333 l = endNums.length; 52334 for (i = 0; i < l; i++) { 52335 currentNum = endNums[i]; 52336 nonNumbers = end.substr(charIndex, end.indexOf(currentNum, charIndex)-charIndex); 52337 s += (nonNumbers || !i) ? nonNumbers : ","; //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 52338 charIndex += nonNumbers.length; 52339 if (color) { //sense rgba() values and round them. 52340 color = (color + 1) % 5; 52341 } else if (nonNumbers.substr(-5) === "rgba(") { 52342 color = 1; 52343 } 52344 if (currentNum === startNums[i] || startNums.length <= i) { 52345 s += currentNum; 52346 } else { 52347 if (s) { 52348 a.push(s); 52349 s = ""; 52350 } 52351 num = parseFloat(startNums[i]); 52352 a.push(num); 52353 a._firstPT = {_next: a._firstPT, t:a, p: a.length-1, s:num, c:((currentNum.charAt(1) === "=") ? parseInt(currentNum.charAt(0) + "1", 10) * parseFloat(currentNum.substr(2)) : (parseFloat(currentNum) - num)) || 0, f:0, m:(color && color < 4) ? Math.round : 0}; 52354 //note: we don't set _prev because we'll never need to remove individual PropTweens from this list. 52355 } 52356 charIndex += currentNum.length; 52357 } 52358 s += end.substr(charIndex); 52359 if (s) { 52360 a.push(s); 52361 } 52362 a.setRatio = _setRatio; 52363 return a; 52364 }, 52365 //note: "funcParam" is only necessary for function-based getters/setters that require an extra parameter like getAttribute("width") and setAttribute("width", value). In this example, funcParam would be "width". Used by AttrPlugin for example. 52366 _addPropTween = function(target, prop, start, end, overwriteProp, mod, funcParam, stringFilter, index) { 52367 if (typeof(end) === "function") { 52368 end = end(index || 0, target); 52369 } 52370 var type = typeof(target[prop]), 52371 getterName = (type !== "function") ? "" : ((prop.indexOf("set") || typeof(target["get" + prop.substr(3)]) !== "function") ? prop : "get" + prop.substr(3)), 52372 s = (start !== "get") ? start : !getterName ? target[prop] : funcParam ? target[getterName](funcParam) : target[getterName](), 52373 isRelative = (typeof(end) === "string" && end.charAt(1) === "="), 52374 pt = {t:target, p:prop, s:s, f:(type === "function"), pg:0, n:overwriteProp || prop, m:(!mod ? 0 : (typeof(mod) === "function") ? mod : Math.round), pr:0, c:isRelative ? parseInt(end.charAt(0) + "1", 10) * parseFloat(end.substr(2)) : (parseFloat(end) - s) || 0}, 52375 blob; 52376 52377 if (typeof(s) !== "number" || (typeof(end) !== "number" && !isRelative)) { 52378 if (funcParam || isNaN(s) || (!isRelative && isNaN(end)) || typeof(s) === "boolean" || typeof(end) === "boolean") { 52379 //a blob (string that has multiple numbers in it) 52380 pt.fp = funcParam; 52381 blob = _blobDif(s, (isRelative ? pt.s + pt.c : end), stringFilter || TweenLite.defaultStringFilter, pt); 52382 pt = {t: blob, p: "setRatio", s: 0, c: 1, f: 2, pg: 0, n: overwriteProp || prop, pr: 0, m: 0}; //"2" indicates it's a Blob property tween. Needed for RoundPropsPlugin for example. 52383 } else { 52384 pt.s = parseFloat(s); 52385 if (!isRelative) { 52386 pt.c = (parseFloat(end) - pt.s) || 0; 52387 } 52388 } 52389 } 52390 if (pt.c) { //only add it to the linked list if there's a change. 52391 if ((pt._next = this._firstPT)) { 52392 pt._next._prev = pt; 52393 } 52394 this._firstPT = pt; 52395 return pt; 52396 } 52397 }, 52398 _internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector, lazyTweens:_lazyTweens, blobDif:_blobDif}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object. 52399 _plugins = TweenLite._plugins = {}, 52400 _tweenLookup = _internals.tweenLookup = {}, 52401 _tweenLookupNum = 0, 52402 _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUp
52402date:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1, callbackScope:1, stringFilter:1, id:1}, 52403 _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0}, 52404 _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(), 52405 _rootTimeline = Animation._rootTimeline = new SimpleTimeline(), 52406 _nextGCFrame = 30, 52407 _lazyRender = _internals.lazyRender = function() { 52408 var i = _lazyTweens.length, 52409 tween; 52410 _lazyLookup = {}; 52411 while (--i > -1) { 52412 tween = _lazyTweens[i]; 52413 if (tween && tween._lazy !== false) { 52414 tween.render(tween._lazy[0], tween._lazy[1], true); 52415 tween._lazy = false; 52416 } 52417 } 52418 _lazyTweens.length = 0; 52419 }; 52420 52421 _rootTimeline._startTime = _ticker.time; 52422 _rootFramesTimeline._startTime = _ticker.frame; 52423 _rootTimeline._active = _rootFramesTimeline._active = true; 52424 setTimeout(_lazyRender, 1); //on some mobile devices, there isn't a "tick" before code runs which means any lazy renders wouldn't run before the next official "tick". 52425 52426 Animation._updateRoot = TweenLite.render = function() { 52427 var i, a, p; 52428 if (_lazyTweens.length) { //if code is run outside of the requestAnimationFrame loop, there may be tweens queued AFTER the engine refreshed, so we need to ensure any pending renders occur before we refresh again. 52429 _lazyRender(); 52430 } 52431 _rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false); 52432 _rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false); 52433 if (_lazyTweens.length) { 52434 _lazyRender(); 52435 } 52436 if (_ticker.frame >= _nextGCFrame) { //dump garbage every 120 frames or whatever the user sets TweenLite.autoSleep to 52437 _nextGCFrame = _ticker.frame + (parseInt(TweenLite.autoSleep, 10) || 120); 52438 for (p in _tweenLookup) { 52439 a = _tweenLookup[p].tweens; 52440 i = a.length; 52441 while (--i > -1) { 52442 if (a[i]._gc) { 52443 a.splice(i, 1); 52444 } 52445 } 52446 if (a.length === 0) { 52447 delete _tweenLookup[p]; 52448 } 52449 } 52450 //if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly 52451 p = _rootTimeline._first; 52452 if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) { 52453 while (p && p._paused) { 52454 p = p._next; 52455 } 52456 if (!p) { 52457 _ticker.sleep(); 52458 } 52459 } 52460 } 52461 }; 52462 52463 _ticker.addEventListener("tick", Animation._updateRoot); 52464 52465 var _register = function(target, tween, scrub) { 52466 var id = target._gsTweenID, a, i; 52467 if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) { 52468 _tweenLookup[id] = {target:target, tweens:[]}; 52469 } 52470 if (tween) { 52471 a = _tweenLookup[id].tweens; 52472 a[(i = a.length)] = tween; 52473 if (scrub) { 52474 while (--i > -1) { 52475 if (a[i] === tween) { 52476 a.splice(i, 1); 52477 } 52478 } 52479 } 52480 } 52481 return _tweenLookup[id].tweens; 52482 }, 52483 _onOverwrite = function(overwrittenTween, overwritingTween, target, killedProps) { 52484 var func = overwrittenTween.vars.onOverwrite, r1, r2; 52485 if (func) { 52486 r1 = func(overwrittenTween, overwritingTween, target, killedProps); 52487 } 52488 func = TweenLite.onOverwrite; 52489 if (func) { 52490 r2 = func(overwrittenTween, overwritingTween, target, killedProps); 52491 } 52492 return (r1 !== false && r2 !== false); 52493 }, 52494 _applyOverwrite = function(target, tween, props, mode, siblings) { 52495 var i, changed, curTween, l; 52496 if (mode === 1 || mode >= 4) { 52497 l = siblings.length; 52498 for (i = 0; i < l; i++) { 52499 if ((curTween = siblings[i]) !== tween) { 52500 if (!curTween._gc) { 52501 if (curTween._kill(null, target, tween)) { 52502 changed = true; 52503 } 52504 } 52505 } else if (mode === 5) { 52506 break; 52507 } 52508 } 52509 return changed; 52510 } 52511 //NOTE: Add 0.0000000001 to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example) 52512 var startTime = tween._startTime + _tinyNum, 52513 overlaps = [], 52514 oCount = 0, 52515 zeroDur = (tween._duration === 0), 52516 globalStart; 52517 i = siblings.length; 52518 while (--i > -1) { 52519 if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) { 52520 //ignore 52521 } else if (curTween._timeline !== tween._timeline) { 52522 globalStart = globalStart || _checkOverlap(tween, 0, zeroDur); 52523 if (_checkOverlap(curTween, globalStart, zeroDur) === 0) { 52524 overlaps[oCount++] = curTween; 52525 } 52526 } else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) { 52527 overlaps[oCount++] = curTween; 52528 } 52529 } 52530 52531 i = oCount; 52532 while (--i > -1) { 52533 curTween = overlaps[i]; 52534 if (mode === 2) if (curTween._kill(props, target, tween)) { 52535 changed = true; 52536 } 52537 if (mode !== 2 || (!curTween._firstPT && curTween._initted)) { 52538 if (mode !== 2 && !_onOverwrite(curTween, tween)) { 52539 continue; 52540 } 52541 if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween. 52542 changed = true; 52543 } 52544 } 52545 } 52546 return changed; 52547 }, 52548 _checkOverlap = function(tween, reference, zeroDur) { 52549 var tl = tween._timeline, 52550 ts = tl._timeScale, 52551 t = tween._startTime; 52552 while (tl._timeline) { 52553 t += tl._startTime; 52554 ts *= tl._timeScale; 52555 if (tl._paused) { 52556 return -100; 52557 } 52558 tl = tl._timeline; 52559 } 52560 t /= ts; 52561 return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum; 52562 }; 52563 52564 52565 //---- TweenLite instance methods ----------------------------------------------------------------------------- 52566 52567 p._init = function() { 52568 var v = this.vars, 52569 op = this._overwrittenProps, 52570 dur = this._duration, 52571 immediate = !!v.immediateRender, 52572 ease = v.ease, 52573 i, initPlugins, pt, p, startVars, l; 52574 if (v.startAt) { 52575 if (this._startAt) { 52576 this._startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change. 52577 this._startAt.kill(); 52578 } 52579 startVars = {}; 52580 for (p in v.startAt) { //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, 1, from, to).fromTo(e, 1, to, from); 52581 startVars[p] = v.startAt[p]; 52582 } 52583 startVars.overwrite = false;
52584 startVars.immediateRender = true; 52585 startVars.lazy = (immediate && v.lazy !== false); 52586 startVars.startAt = startVars.delay = null; //no nesting of startAt objects allowed (otherwise it could cause an infinite loop). 52587 this._startAt = TweenLite.to(this.target, 0, startVars); 52588 if (immediate) { 52589 if (this._time > 0) { 52590 this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()). 52591 } else if (dur !== 0) { 52592 return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. 52593 } 52594 } 52595 } else if (v.runBackwards && dur !== 0) { 52596 //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) 52597 if (this._startAt) { 52598 this._startAt.render(-1, true); 52599 this._startAt.kill(); 52600 this._startAt = null; 52601 } else { 52602 if (this._time !== 0) { //in rare cases (like if a from() tween runs and then is invalidate()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0 52603 immediate = false; 52604 } 52605 pt = {}; 52606 for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through. 52607 if (!_reservedProps[p] || p === "autoCSS") { 52608 pt[p] = v[p]; 52609 } 52610 } 52611 pt.overwrite = 0; 52612 pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. 52613 pt.lazy = (immediate && v.lazy !== false); 52614 pt.immediateRender = immediate; //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) 52615 this._startAt = TweenLite.to(this.target, 0, pt); 52616 if (!immediate) { 52617 this._startAt._init(); //ensures that the initial values are recorded 52618 this._startAt._enabled(false); //no need to have the tween render on the next cycle. Disable it because we'll always manually control the renders of the _startAt tween. 52619 if (this.vars.immediateRender) { 52620 this._startAt = null; 52621 } 52622 } else if (this._time === 0) { 52623 return; 52624 } 52625 } 52626 } 52627 this._ease = ease = (!ease) ? TweenLite.defaultEase : (ease instanceof Ease) ? ease : (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase; 52628 if (v.easeParams instanceof Array && ease.config) { 52629 this._ease = ease.config.apply(ease, v.easeParams); 52630 } 52631 this._easeType = this._ease._type; 52632 this._easePower = this._ease._power; 52633 this._firstPT = null; 52634 52635 if (this._targets) { 52636 l = this._targets.length; 52637 for (i = 0; i < l; i++) { 52638 if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null), i) ) { 52639 initPlugins = true; 52640 } 52641 } 52642 } else { 52643 initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op, 0); 52644 } 52645 52646 if (initPlugins) { 52647 TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite 52648 } 52649 if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live. 52650 this._enabled(false, false); 52651 } 52652 if (v.runBackwards) { 52653 pt = this._firstPT; 52654 while (pt) { 52655 pt.s += pt.c; 52656 pt.c = -pt.c; 52657 pt = pt._next; 52658 } 52659 } 52660 this._onUpdate = v.onUpdate; 52661 this._initted = true; 52662 }; 52663 52664 p._initProps = function(target, propLookup, siblings, overwrittenProps, index) { 52665 var p, i, initPlugins, plugin, pt, v; 52666 if (target == null) { 52667 return false;
52668 } 52669 52670 if (_lazyLookup[target._gsTweenID]) { 52671 _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end) 52672 } 52673 52674 if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe. 52675 _autoCSS(this.vars, target); 52676 } 52677 for (p in this.vars) { 52678 v = this.vars[p]; 52679 if (_reservedProps[p]) { 52680 if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) { 52681 this.vars[p] = v = this._swapSelfInParams(v, this); 52682 } 52683 52684 } else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this, index)) { 52685 52686 //t - target [object] 52687 //p - property [string] 52688 //s - start [number] 52689 //c - change [number] 52690 //f - isFunction [boolean] 52691 //n - name [string] 52692 //pg - isPlugin [boolean] 52693 //pr - priority [number] 52694 //m - mod [function | 0] 52695 this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:1, n:p, pg:1, pr:plugin._priority, m:0}; 52696 i = plugin._overwriteProps.length; 52697 while (--i > -1) { 52698 propLookup[plugin._overwriteProps[i]] = this._firstPT; 52699 } 52700 if (plugin._priority || plugin._onInitAllProps) { 52701 initPlugins = true; 52702 } 52703 if (plugin._onDisable || plugin._onEnable) { 52704 this._notifyPluginsOfEnabled = true; 52705 } 52706 if (pt._next) { 52707 pt._next._prev = pt; 52708 } 52709 52710 } else { 52711 propLookup[p] = _addPropTween.call(this, target, p, "get", v, p, 0, null, this.vars.stringFilter, index); 52712 } 52713 } 52714 52715 if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first) 52716 return this._initProps(target, propLookup, siblings, overwrittenProps, index); 52717 } 52718 if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) { 52719 this._kill(propLookup, target); 52720 return this._initProps(target, propLookup, siblings, overwrittenProps, index); 52721 } 52722 if (this._firstPT) if ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration)) { //zero duration tweens don't lazy render by default; everything else does. 52723 _lazyLookup[target._gsTweenID] = true; 52724 } 52725 return initPlugins; 52726 }; 52727 52728 p.render = function(time, suppressEvents, force) { 52729 var prevTime = this._time, 52730 duration = this._duration, 52731 prevRawPrevTime = this._rawPrevTime, 52732 isComplete, callback, pt, rawPrevTime; 52733 if (time >= duration - 0.0000001 && time >= 0) { //to work around occasional floating point math artifacts. 52734 this._totalTime = this._time = duration; 52735 this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1; 52736 if (!this._reversed ) { 52737 isComplete = true; 52738 callback = "onComplete"; 52739 force = (force || this._timeline.autoRemoveChildren); //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. 52740 } 52741 if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. 52742 if (this._startTime === this._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent roun
52742ding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate. 52743 time = 0; 52744 } 52745 if (prevRawPrevTime < 0 || (time <= 0 && time >= -0.0000001) || (prevRawPrevTime === _tinyNum && this.data !== "isPause")) if (prevRawPrevTime !== time) { //note: when this.data is "isPause", it's a callback added by addPause() on a timeline that we should not be triggered when LEAVING its exact start time. In other words, tl.addPause(1).play(1) shouldn't pause. 52746 force = true; 52747 if (prevRawPrevTime > _tinyNum) { 52748 callback = "onReverseComplete"; 52749 } 52750 } 52751 this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 52752 } 52753 52754 } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0. 52755 this._totalTime = this._time = 0; 52756 this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0; 52757 if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) { 52758 callback = "onReverseComplete"; 52759 isComplete = this._reversed; 52760 } 52761 if (time < 0) { 52762 this._active = false; 52763 if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. 52764 if (prevRawPrevTime >= 0 && !(prevRawPrevTime === _tinyNum && this.data === "isPause")) { 52765 force = true; 52766 } 52767 this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. 52768 } 52769 } 52770 if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. 52771 force = true; 52772 } 52773 } else { 52774 this._totalTime = this._time = time; 52775 52776 if (this._easeType) { 52777 var r = time / duration, type = this._easeType, pow = this._easePower; 52778 if (type === 1 || (type === 3 && r >= 0.5)) { 52779 r = 1 - r; 52780 } 52781 if (type === 3) { 52782 r *= 2; 52783 } 52784 if (pow === 1) { 52785 r *= r; 52786 } else if (pow === 2) { 52787 r *= r * r; 52788 } else if (pow === 3) { 52789 r *= r * r * r; 52790 } else if (pow === 4) { 52791 r *= r * r * r * r; 52792 } 52793 52794 if (type === 1) { 52795 this.ratio = 1 - r; 52796 } else if (type === 2) { 52797 this.ratio = r; 52798 } else if (time / duration < 0.5) { 52799 this.ratio = r / 2; 52800 } else { 52801 this.ratio = 1 - (r / 2); 52802 } 52803 52804 } else { 52805 this.ratio = this._ease.getRatio(time / duration); 52806 } 52807 } 52808 52809 if (this._time === prevTime && !force) { 52810 return; 52811 } else if (!this._initted) { 52812 this._init(); 52813 if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that over
52813writing occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example. 52814 return; 52815 } else if (!force && this._firstPT && ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration))) { 52816 this._time = this._totalTime = prevTime; 52817 this._rawPrevTime = prevRawPrevTime; 52818 _lazyTweens.push(this); 52819 this._lazy = [time, suppressEvents]; 52820 return; 52821 } 52822 //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently. 52823 if (this._time && !isComplete) { 52824 this.ratio = this._ease.getRatio(this._time / duration); 52825 } else if (isComplete && this._ease._calcEnd) { 52826 this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1); 52827 } 52828 } 52829 if (this._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occurring now (imagine a lazy tween instantiating and then immediately the user calls tween.seek(tween.duration()), skipping to the end - the end render would be forced, and then if we didn't flush the lazy render, it'd fire AFTER the seek(), rendering it at the wrong time. 52830 this._lazy = false; 52831 } 52832 if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) { 52833 this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done. 52834 } 52835 if (prevTime === 0) { 52836 if (this._startAt) { 52837 if (time >= 0) { 52838 this._startAt.render(time, suppressEvents, force); 52839 } else if (!callback) { 52840 callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area. 52841 } 52842 } 52843 if (this.vars.onStart) if (this._time !== 0 || duration === 0) if (!suppressEvents) { 52844 this._callback("onStart"); 52845 } 52846 } 52847 pt = this._firstPT; 52848 while (pt) { 52849 if (pt.f) { 52850 pt.t[pt.p](pt.c * this.ratio + pt.s); 52851 } else { 52852 pt.t[pt.p] = pt.c * this.ratio + pt.s; 52853 } 52854 pt = pt._next; 52855 } 52856 52857 if (this._onUpdate) { 52858 if (time < 0) if (this._startAt && time !== -0.0001) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values. 52859 this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. 52860 } 52861 if (!suppressEvents) if (this._time !== prevTime || isComplete || force) { 52862 this._callback("onUpdate"); 52863 } 52864 } 52865 if (callback) if (!this._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate 52866 if (time < 0 && this._startAt && !this._onUpdate && time !== -0.0001) { //-0.0001 is a special value that we use when looping back to the beginning of a repeated TimelineMax, in which case we shouldn't render the _startAt values. 52867 this._startAt.render(time, suppressEvents, force); 52868 } 52869 if (isComplete) { 52870 if (this._timeline.autoRemoveChildren) { 52871 this._enabled(false, false); 52872 } 52873 this._active = false;
52874 } 52875 if (!suppressEvents && this.vars[callback]) { 52876 this._callback(callback); 52877 } 52878 if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless. 52879 this._rawPrevTime = 0; 52880 } 52881 } 52882 }; 52883 52884 p._kill = function(vars, target, overwritingTween) { 52885 if (vars === "all") { 52886 vars = null; 52887 } 52888 if (vars == null) if (target == null || target === this.target) { 52889 this._lazy = false; 52890 return this._enabled(false, false); 52891 } 52892 target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target; 52893 var simultaneousOverwrite = (overwritingTween && this._time && overwritingTween._startTime === this._startTime && this._timeline === overwritingTween._timeline), 52894 i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed; 52895 if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") { 52896 i = target.length; 52897 while (--i > -1) { 52898 if (this._kill(vars, target[i], overwritingTween)) { 52899 changed = true; 52900 } 52901 } 52902 } else { 52903 if (this._targets) { 52904 i = this._targets.length; 52905 while (--i > -1) { 52906 if (target === this._targets[i]) { 52907 propLookup = this._propLookup[i] || {}; 52908 this._overwrittenProps = this._overwrittenProps || []; 52909 overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all"; 52910 break; 52911 } 52912 } 52913 } else if (target !== this.target) { 52914 return false; 52915 } else { 52916 propLookup = this._propLookup; 52917 overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all"; 52918 } 52919 52920 if (propLookup) { 52921 killProps = vars || propLookup; 52922 record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin) 52923 if (overwritingTween && (TweenLite.onOverwrite || this.vars.onOverwrite)) { 52924 for (p in killProps) { 52925 if (propLookup[p]) { 52926 if (!killed) { 52927 killed = []; 52928 } 52929 killed.push(p); 52930 } 52931 } 52932 if ((killed || !vars) && !_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it). 52933 return false; 52934 } 52935 } 52936 52937 for (p in killProps) { 52938 if ((pt = propLookup[p])) { 52939 if (simultaneousOverwrite) { //if another tween overwrites this one and they both start at exactly the same time, yet this tween has already rendered once (for example, at 0.001) because it's first in the queue, we should revert the values to where they were at 0 so that the starting values aren't contaminated on the overwriting tween. 52940 if (pt.f) { 52941 pt.t[pt.p](pt.s); 52942 } else { 52943 pt.t[pt.p] = pt.s; 52944 } 52945 changed = true; 52946 } 52947 if (pt.pg && pt.t._kill(killProps)) { 52948 changed = true; //some plugins need to be notified so they can perform cleanup tasks first 52949 } 52950 if (!pt.pg || pt.t._overwriteProps.length === 0) { 52951 if (pt._prev) { 52952 pt._prev._next = pt._next; 52953 } else if (pt === this._firstPT) { 52954 this._firstPT = pt._next; 52955 } 52956 if (pt._next) { 52957 pt._next._prev = pt._prev; 52958 } 52959 pt._next = pt._prev = null; 52960 } 52961 delete propLookup[p]; 52962 } 52963 if (record) { 52964 overwrittenProps[p] = 1; 52965 } 52966 } 52967 if (!this._firstPT && this._initted) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. 52968 this._enabled(false, false); 52969 } 52970 } 52971 } 52972 return changed; 52973 }; 52974 52975 p.invalidate = function() { 52976 if (this._notifyPluginsOfEnabled) { 52977 TweenLite._onPluginEvent("_onDisable", this); 52978 } 52979 this._firstPT = this._overwrittenProps = this._startAt = this._onUpdate = null; 52980 this._notifyPluginsOfEnabled = this._active = this._lazy = false;
52981 this._propLookup = (this._targets) ? {} : []; 52982 Animation.prototype.invalidate.call(this); 52983 if (this.vars.immediateRender) { 52984 this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) 52985 this.render(Math.min(0, -this._delay)); //in case delay is negative. 52986 } 52987 return this; 52988 }; 52989 52990 p._enabled = function(enabled, ignoreTimeline) { 52991 if (!_tickerActive) { 52992 _ticker.wake(); 52993 } 52994 if (enabled && this._gc) { 52995 var targets = this._targets, 52996 i; 52997 if (targets) { 52998 i = targets.length; 52999 while (--i > -1) { 53000 this._siblings[i] = _register(targets[i], this, true); 53001 } 53002 } else { 53003 this._siblings = _register(this.target, this, true); 53004 } 53005 } 53006 Animation.prototype._enabled.call(this, enabled, ignoreTimeline); 53007 if (this._notifyPluginsOfEnabled) if (this._firstPT) { 53008 return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this); 53009 } 53010 return false; 53011 }; 53012 53013 53014 //----TweenLite static methods ----------------------------------------------------- 53015 53016 TweenLite.to = function(target, duration, vars) { 53017 return new TweenLite(target, duration, vars); 53018 }; 53019 53020 TweenLite.from = function(target, duration, vars) { 53021 vars.runBackwards = true; 53022 vars.immediateRender = (vars.immediateRender != false); 53023 return new TweenLite(target, duration, vars); 53024 }; 53025 53026 TweenLite.fromTo = function(target, duration, fromVars, toVars) { 53027 toVars.startAt = fromVars; 53028 toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); 53029 return new TweenLite(target, duration, toVars); 53030 }; 53031 53032 TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) { 53033 return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0}); 53034 }; 53035 53036 TweenLite.set = function(target, vars) { 53037 return new TweenLite(target, 0, vars); 53038 }; 53039 53040 TweenLite.getTweensOf = function(target, onlyActive) { 53041 if (target == null) { return []; } 53042 target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; 53043 var i, a, j, t; 53044 if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") { 53045 i = target.length; 53046 a = []; 53047 while (--i > -1) { 53048 a = a.concat(TweenLite.getTweensOf(target[i], onlyActive)); 53049 } 53050 i = a.length; 53051 //now get rid of any duplicates (tweens of arrays of objects could cause duplicates) 53052 while (--i > -1) { 53053 t = a[i]; 53054 j = i; 53055 while (--j > -1) { 53056 if (t === a[j]) { 53057 a.splice(i, 1); 53058 } 53059 } 53060 } 53061 } else { 53062 a = _register(target).concat(); 53063 i = a.length; 53064 while (--i > -1) { 53065 if (a[i]._gc || (onlyActive && !a[i].isActive())) { 53066 a.splice(i, 1); 53067 } 53068 } 53069 } 53070 return a; 53071 }; 53072 53073 TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) { 53074 if (typeof(onlyActive) === "object") { 53075 vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted) 53076 onlyActive = false; 53077 } 53078 var a = TweenLite.getTweensOf(target, onlyActive), 53079 i = a.length; 53080 while (--i > -1) { 53081 a[i]._kill(vars, target); 53082 } 53083 }; 53084 53085 53086 53087 /* 53088 * ---------------------------------------------------------------- 53089 * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another script call before loading plugins which is easy to forget) 53090 * ---------------------------------------------------------------- 53091 */ 53092 var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) { 53093 this._overwriteProps = (props || "").split(","); 53094 this._propName = this._overwriteProps[0]; 53095 this._priority = priority || 0; 53096 this._super = TweenPlugin.prototype; 53097 }, true); 53098 53099 p = TweenPlugin.prototype; 53100 TweenPlugin.version = "1.19.0"; 53101 TweenPlugin.API = 2; 53102 p._firstPT = null; 53103 p._addTween = _addPropTween; 53104 p.setRatio = _setRatio; 53105 53106 p._kill = function(lookup) { 53107 var a = this._overwriteProps, 53108 pt = this._firstPT, 53109 i; 53110 if (lookup[this._propName] != null) { 53111 this._overwriteProps = []; 53112 } else { 53113 i = a.length; 53114 while (--i > -1) { 53115 if (lookup[a[i]] != null) { 53116 a.splice(i, 1); 53117 } 53118 } 53119 } 53120 while (pt) { 53121 if (lookup[pt.n] != null) { 53122 if (pt._next) { 53123 pt._next._prev = pt._prev; 53124 } 53125 if (pt._prev) { 53126 pt._prev._next = pt._next; 53127 pt._prev = null; 53128 } else if (this._firstPT === pt) { 53129 this._firstPT = pt._next; 53130 } 53131 } 53132 pt = pt._next; 53133 } 53134 return false;
53135 }; 53136 53137 p._mod = p._roundProps = function(lookup) { 53138 var pt = this._firstPT, 53139 val; 53140 while (pt) { 53141 val = lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ]); 53142 if (val && typeof(val) === "function") { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here. 53143 if (pt.f === 2) { 53144 pt.t._applyPT.m = val; 53145 } else { 53146 pt.m = val; 53147 } 53148 } 53149 pt = pt._next; 53150 } 53151 }; 53152 53153 TweenLite._onPluginEvent = function(type, tween) { 53154 var pt = tween._firstPT, 53155 changed, pt2, first, last, next; 53156 if (type === "_onInitAllProps") { 53157 //sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame. 53158 while (pt) { 53159 next = pt._next; 53160 pt2 = first; 53161 while (pt2 && pt2.pr > pt.pr) { 53162 pt2 = pt2._next; 53163 } 53164 if ((pt._prev = pt2 ? pt2._prev : last)) { 53165 pt._prev._next = pt; 53166 } else { 53167 first = pt; 53168 } 53169 if ((pt._next = pt2)) { 53170 pt2._prev = pt; 53171 } else { 53172 last = pt; 53173 } 53174 pt = next; 53175 } 53176 pt = tween._firstPT = first; 53177 } 53178 while (pt) { 53179 if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) { 53180 changed = true; 53181 } 53182 pt = pt._next; 53183 } 53184 return changed; 53185 }; 53186 53187 TweenPlugin.activate = function(plugins) { 53188 var i = plugins.length; 53189 while (--i > -1) { 53190 if (plugins[i].API === TweenPlugin.API) { 53191 _plugins[(new plugins[i]())._propName] = plugins[i]; 53192 } 53193 } 53194 return true; 53195 }; 53196 53197 //provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations. 53198 _gsDefine.plugin = function(config) { 53199 if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; } 53200 var propName = config.propName, 53201 priority = config.priority || 0, 53202 overwriteProps = config.overwriteProps, 53203 map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_mod", mod:"_mod", initAll:"_onInitAllProps"}, 53204 Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin", 53205 function() { 53206 TweenPlugin.call(this, propName, priority); 53207 this._overwriteProps = overwriteProps || []; 53208 }, (config.global === true)), 53209 p = Plugin.prototype = new TweenPlugin(propName), 53210 prop; 53211 p.constructor = Plugin; 53212 Plugin.API = config.API; 53213 for (prop in map) { 53214 if (typeof(config[prop]) === "function") { 53215 p[map[prop]] = config[prop]; 53216 } 53217 } 53218 Plugin.version = config.version; 53219 TweenPlugin.activate([Plugin]); 53220 return Plugin; 53221 }; 53222 53223 53224 //now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you. 53225 a = window._gsQueue; 53226 if (a) { 53227 for (i = 0; i < a.length; i++) { 53228 a[i](); 53229 } 53230 for (p in _defLookup) { 53231 if (!_defLookup[p].func) { 53232 window.console.log("GSAP encountered missing dependency: " + p); 53233 } 53234 } 53235 } 53236 53237 _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated 53238 53239 })((typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window, "TweenMax"); 53240 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 53241 53242/***/ }), 53243/* 311 */ 53244/***/ (function(module, exports) { 53245 53246 /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__; 53247 53248 /* WEBPACK VAR INJECTION */}.call(exports, {})) 53249 53250/***/ }), 53251/* 312 */ 53252/***/ (function(module, exports, __webpack_require__) { 53253 53254 "use strict"; 53255 53256 Object.defineProperty(exports, "__esModule", { 53257 value: true 53258 }); 53259 exports.setupPages = setupPages; 53260 exports.reloadPage = reloadPage; 53261 exports.currentPageName = currentPageName; 53262 exports.showPage = showPage; 53263 53264 var _jquery = __webpack_require__(303); 53265 53266 var _jquery2 = _interopRequireDefault(_jquery); 53267 53268 var _bgm = __webpack_require__(299); 53269 53270 var _bgm2 = _interopRequireDefault(_bgm); 53271 53272 var _events = __webpack_require__(301); 53273 53274 var _events2 = _interopRequireDefault(_events); 53275 53276 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 53277 53278 var pages = {}; 53279 function setupPages() { 53280 pages = { 53281 goods: { $el: (0, _jquery2.default)("#goods") }, 53282 front: { $el: (0, _jquery2.default)("#front") }, 53283 rewards: { $el: (0, _jquery2.default)("#rewards") },
53284 cast: { $el: (0, _jquery2.default)("#cast") }, 53285 music: { $el: (0, _jquery2.default)("#music") }, 53286 movie: { $el: (0, _jquery2.default)("#movie") }, 53287 news: { $el: (0, _jquery2.default)("#news") }, 53288 staff: { $el: (0, _jquery2.default)("#staff") }, 53289 story: { $el: (0, _jquery2.default)("#story") }, 53290 special: { $el: (0, _jquery2.default)("#special") }, 53291 interview_1: { $el: (0, _jquery2.default)("#interview-1") }, 53292 interview_2: { $el: (0, _jquery2.default)("#interview-2") }, 53293 interview_3: { $el: (0, _jquery2.default)("#interview-3") }, 53294 interview_4: { $el: (0, _jquery2.default)("#interview-4") }, 53295 interview_5: { $el: (0, _jquery2.default)("#interview-5") }, 53296 interview_6: { $el: (0, _jquery2.default)("#interview-6") }, 53297 interview_7: { $el: (0, _jquery2.default)("#interview-7") }, 53298 interview_8: { $el: (0, _jquery2.default)("#interview-8") } 53299 }; 53300 } 53301 var lastPage = ""; 53302 function reloadPage() { 53303 var name = currentPageName(window.location.hash); 53304 var page = void 0; 53305 53306 switch (name) { 53307 case "front": 53308 _events2.default.emit("showFront"); 53309 _bgm2.default.active(); 53310 page = showPage(pages.front); 53311 break; 53312 default: 53313 _bgm2.default.inactive(); 53314 if (lastPage === "front") { 53315 _events2.default.emit("hideFront"); 53316 } 53317 page = showPage(pages[name]); 53318 break; 53319 } 53320 lastPage = name; 53321 return page; 53322 } 53323 function currentPageName(hash) { 53324 switch (hash) { 53325 case "#goods": 53326 return "goods"; 53327 case "#rewards": 53328 return "rewards"; 53329 case "#cast": 53330 return "cast"; 53331 case "#staff": 53332 return "staff"; 53333 case "#music": 53334 return "music"; 53335 case "#movie": 53336 return "movie"; 53337 case "#news": 53338 return "news"; 53339 case "#story": 53340 return "story"; 53341 case "#special": 53342 return "special"; 53343 case "#interview-1": 53344 return "interview_1"; 53345 case "#interview-2": 53346 return "interview_2"; 53347 case "#interview-3": 53348 return "interview_3";
53349 case "#interview-4": 53350 return "interview_4"; 53351 case "#interview-5": 53352 return "interview_5"; 53353 case "#interview-6": 53354 return "interview_6"; 53355 case "#interview-7": 53356 return "interview_7"; 53357 default: 53358 return "front"; 53359 } 53360 } 53361 53362 function showPage(page) { 53363 _.forEach(pages, function (p) { 53364 p.$el.attr("data-page-show", 0); 53365 }); 53366 page.$el.attr("data-page-show", 1); 53367 window.scrollTo(window.scrollX, 0); 53368 return page; 53369 } 53370 53371/***/ }), 53372/* 313 */ 53373/***/ (function(module, exports) { 53374 53375 "use strict"; 53376 53377 Object.defineProperty(exports, "__esModule", { 53378 value: true 53379 }); 53380 var ENABLE_VISIBILITY = "hidden" in document || "webkitHidden" in document; 53381 var ENABLE_PAGESHOW = /iPhone|iPad|iPod/.test(navigator.userAgent); 53382 var ENABLE_FOCUS = "onfocus" in window && "onblur" in window; 53383 53384 var _keyword = ""; // hidden state keyword. "hidden" or "webkitHidden" or "pagehide" or "blur" 53385 var _callbacks = []; // callback function array. [callback, ...] 53386 var _lastHiddenState = false; // last hidden state. 53387 53388 // --- class / interfaces ---------------------------------- 53389 var PageVisibilityEvent = { 53390 "enable": ENABLE_VISIBILITY || ENABLE_PAGESHOW || ENABLE_FOCUS, 53391 "on": PageVisibilityEvent_on, // PageVisibilityEvent.on(callback:Function):void 53392 "off": PageVisibilityEvent_off, // PageVisibilityEvent.off(callback:Function):void 53393 "end": PageVisibilityEvent_end, // PageVisibilityEvent.end():void 53394 "isHidden": PageVisibilityEvent_isHidden }; 53395 53396 if (ENABLE_VISIBILITY || ENABLE_PAGESHOW | ENABLE_FOCUS) { 53397 _keyword = _event(true); 53398 } 53399 53400 // --- implements ------------------------------------------ 53401 function PageVisibilityEvent_on(callback) { 53402 // @arg Function - callback(pageHide:Boolean, eventType:EventTypeString):void 53403 53404 var pos = _callbacks.indexOf(callback); // find registered callback 53405 53406 if (pos < 0) { 53407 // already -> ignore 53408 _callbacks.push(callback); 53409 } 53410 } 53411 53412 function PageVisibilityEvent_off(callback) { 53413 // @arg Function 53414 53415 53416 var pos = _callbacks.indexOf(callback); // find registered callback 53417 53418 if (pos >= 0) { 53419 _callbacks.splice(pos, 1); 53420 } 53421 } 53422 53423 function PageVisibilityEvent_end() { 53424 // @desc cleanup, release all events and event listeners. 53425 _callbacks = []; 53426 _event(false); // detach 53427 } 53428 53429 function PageVisibilityEvent_isHidden() { 53430 // @ret Boolean - true is page hidden 53431 // @desc get current PageVisibility state. 53432 return _lastHiddenState; 53433 } 53434 53435 function _event(attach) { 53436 // @arg Boolean - true is attach, false is detach 53437 // @ret String - hidden state keyword 53438 var method = attach ? "addEventListener" : "removeEventListener"; 53439 53440 if (ENABLE_VISIBILITY) { 53441 if ("hidden" in document) { 53442 document[method]("visibilitychange", _handlePageVisibilityEvent); 53443 return "hidden"; 53444 } else if ("webkitHidden" in document) { 53445 document[method]("webkitvisibilitychange", _handlePageVisibilityEvent); 53446 return "webkitHidden"; 53447 } 53448 } else if (ENABLE_PAGESHOW) { 53449 window[method]("pageshow", _handlePageShowAndFocusEvent); 53450 window[method]("pagehide", _handlePageShowAndFocusEvent); 53451 return "pagehide"; 53452 } else if (ENABLE_FOCUS) { 53453 window[method]("focus", _handlePageShowAndFocusEvent); 53454 window[method]("blur", _handlePageShowAndFocusEvent); 53455 return "blur"; 53456 } 53457 return ""; 53458 } 53459 53460 function _handlePageVisibilityEvent(event) { 53461 // @arg Event - PageVisibility event. 53462 _handleEvent(document[_keyword] || false, event["type"]); 53463 } 53464 53465 function _handlePageShowAndFocusEvent(event) { 53466 // @arg Event - pageshow, pagehide, focus, blur event. 53467 _handleEvent(event["type"] === _keyword, event["type"]); 53468 } 53469 53470 function _handleEvent(hidden, eventType) { 53471 // @arg Boolean 53472 if (_lastHiddenState !== hidden) { 53473 _lastHiddenState = hidden; // update current state. 53474 for (var i = 0, iz = _callbacks.length; i < iz; ++i) { 53475 if (_callbacks[i]) { 53476 _callbacks[i](hidden, eventType); 53477 } 53478 } 53479 } 53480 } 53481 53482 exports.default = PageVisibilityEvent; 53483 53484/***/ }) 53485/******/ ]);
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.