vendor: 5,636 bytes, lines 1-209
1webpackJsonp([0,2],[ 2/* 0 */ 3/***/ (function(module, exports, __webpack_require__) { 4 5 __webpack_require__(1); 6 __webpack_require__(332); 7 module.exports = __webpack_require__(333); 8 9 10/***/ }), 11/* 1 */ 12/***/ (function(module, exports, __webpack_require__) { 13 14 /* WEBPACK VAR INJECTION */(function(global) {"use strict"; 15 16 __webpack_require__(2); 17 18 __webpack_require__(328); 19 20 __webpack_require__(329); 21 22 if (global._babelPolyfill) { 23 throw new Error("only one instance of babel-polyfill is allowed"); 24 } 25 global._babelPolyfill = true; 26 27 var DEFINE_PROPERTY = "defineProperty"; 28 function define(O, key, value) { 29 O[key] || Object[DEFINE_PROPERTY](O, key, { 30 writable: true, 31 configurable: true, 32 value: value 33 }); 34 } 35 36 define(String.prototype, "padLeft", "".padStart); 37 define(String.prototype, "padRight", "".padEnd); 38 39 "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) { 40 [][key] && define(Array, key, Function.call.bind([][key])); 41 }); 42 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 43 44/***/ }), 45/* 2 */ 46/***/ (function(module, exports, __webpack_require__) { 47 48 __webpack_require__(3); 49 __webpack_require__(53); 50 __webpack_require__(54); 51 __webpack_require__(55); 52 __webpack_require__(56); 53 __webpack_require__(58); 54 __webpack_require__(60); 55 __webpack_require__(61); 56 __webpack_require__(62); 57 __webpack_require__(63); 58 __webpack_require__(64); 59 __webpack_require__(65); 60 __webpack_require__(66); 61 __webpack_require__(67); 62 __webpack_require__(68); 63 __webpack_require__(70); 64 __webpack_require__(72); 65 __webpack_require__(74); 66 __webpack_require__(76); 67 __webpack_require__(79); 68 __webpack_require__(80); 69 __webpack_require__(81); 70 __webpack_require__(85); 71 __webpack_require__(87); 72 __webpack_require__(89); 73 __webpack_require__(92); 74 __webpack_require__(93); 75 __webpack_require__(94); 76 __webpack_require__(95); 77 __webpack_require__(97); 78 __webpack_require__(98); 79 __webpack_require__(99); 80 __webpack_require__(100); 81 __webpack_require__(101); 82 __webpack_require__(102); 83 __webpack_require__(103); 84 __webpack_require__(105); 85 __webpack_require__(106); 86 __webpack_require__(107); 87 __webpack_require__(109); 88 __webpack_require__(110); 89 __webpack_require__(111); 90 __webpack_require__(113); 91 __webpack_require__(115); 92 __webpack_require__(116); 93 __webpack_require__(117); 94 __webpack_require__(118); 95 __webpack_require__(119); 96 __webpack_require__(120); 97 __webpack_require__(121); 98 __webpack_require__(122); 99 __webpack_require__(123); 100 __webpack_require__(124); 101 __webpack_require__(125); 102 __webpack_require__(126); 103 __webpack_require__(127); 104 __webpack_require__(132); 105 __webpack_require__(133); 106 __webpack_require__(137); 107 __webpack_require__(138); 108 __webpack_require__(139); 109 __webpack_require__(140); 110 __webpack_require__(142); 111 __webpack_require__(143); 112 __webpack_require__(144); 113 __webpack_require__(145); 114 __webpack_require__(146); 115 __webpack_require__(147); 116 __webpack_require__(148); 117 __webpack_require__(149); 118 __webpack_require__(150); 119 __webpack_require__(151); 120 __webpack_require__(152); 121 __webpack_require__(153); 122 __webpack_require__(154); 123 __webpack_require__(155); 124 __webpack_require__(156); 125 __webpack_require__(158); 126 __webpack_require__(159); 127 __webpack_require__(161); 128 __webpack_require__(162); 129 __webpack_require__(168); 130 __webpack_require__(169); 131 __webpack_require__(171); 132 __webpack_require__(172); 133 __webpack_require__(173); 134 __webpack_require__(177); 135 __webpack_require__(178); 136 __webpack_require__(179); 137 __webpack_require__(180); 138 __webpack_require__(181); 139 __webpack_require__(183); 140 __webpack_require__(184); 141 __webpack_require__(185); 142 __webpack_require__(186); 143 __webpack_require__(189); 144 __webpack_require__(191); 145 __webpack_require__(192); 146 __webpack_require__(193); 147 __webpack_require__(195); 148 __webpack_require__(197); 149 __webpack_require__(199); 150 __webpack_require__(201); 151 __webpack_require__(202); 152 __webpack_require__(203); 153 __webpack_require__(207); 154 __webpack_require__(208); 155 __webpack_require__(209); 156 __webpack_require__(211); 157 __webpack_require__(221); 158 __webpack_require__(225); 159 __webpack_require__(226); 160 __webpack_require__(228); 161 __webpack_require__(229); 162 __webpack_require__(233); 163 __webpack_require__(234); 164 __webpack_require__(236); 165 __webpack_require__(237); 166 __webpack_require__(238); 167 __webpack_require__(239); 168 __webpack_require__(240); 169 __webpack_require__(241); 170 __webpack_require__(242); 171 __webpack_require__(243); 172 __webpack_require__(244); 173 __webpack_require__(245); 174 __webpack_require__(246); 175 __webpack_require__(247); 176 __webpack_require__(248); 177 __webpack_require__(249); 178 __webpack_require__(250); 179 __webpack_require__(251); 180 __webpack_require__(252); 181 __webpack_require__(253); 182 __webpack_require__(254); 183 __webpack_require__(256); 184 __webpack_require__(257); 185 __webpack_require__(258); 186 __webpack_require__(259); 187 __webpack_require__(260); 188 __webpack_require__(262); 189 __webpack_require__(263); 190 __webpack_require__(264); 191 __webpack_require__(266); 192 __webpack_require__(267); 193 __webpack_require__(268); 194 __webpack_require__(269); 195 __webpack_require__(270); 196 __webpack_require__(271); 197 __webpack_require__(272); 198 __webpack_require__(273); 199 __webpack_require__(275); 200 __webpack_require__(276); 201 __webpack_require__(278); 202 __webpack_require__(279); 203 __webpack_require__(280); 204 __webpack_require__(281); 205 __webpack_require__(284); 206 __webpack_require__(285); 207 __webpack_require__(287); 208 __webpack_require__(288); 209 __webpack_require__(289);
vendor: 4,105 bytes, lines 210-334
210 __webpack_require__(290); 211 __webpack_require__(292); 212 __webpack_require__(293); 213 __webpack_require__(294); 214 __webpack_require__(295); 215 __webpack_require__(296); 216 __webpack_require__(297); 217 __webpack_require__(298); 218 __webpack_require__(299); 219 __webpack_require__(300); 220 __webpack_require__(301); 221 __webpack_require__(303); 222 __webpack_require__(304); 223 __webpack_require__(305); 224 __webpack_require__(306); 225 __webpack_require__(307); 226 __webpack_require__(308); 227 __webpack_require__(309); 228 __webpack_require__(310); 229 __webpack_require__(311); 230 __webpack_require__(312); 231 __webpack_require__(313); 232 __webpack_require__(315); 233 __webpack_require__(316); 234 __webpack_require__(317); 235 __webpack_require__(318); 236 __webpack_require__(319); 237 __webpack_require__(320); 238 __webpack_require__(321); 239 __webpack_require__(322); 240 __webpack_require__(323); 241 __webpack_require__(324); 242 __webpack_require__(325); 243 __webpack_require__(326); 244 __webpack_require__(327); 245 module.exports = __webpack_require__(9); 246 247 248/***/ }), 249/* 3 */ 250/***/ (function(module, exports, __webpack_require__) { 251 252 'use strict'; 253 // ECMAScript 6 symbols shim 254 var global = __webpack_require__(4); 255 var has = __webpack_require__(5); 256 var DESCRIPTORS = __webpack_require__(6); 257 var $export = __webpack_require__(8); 258 var redefine = __webpack_require__(18); 259 var META = __webpack_require__(25).KEY; 260 var $fails = __webpack_require__(7); 261 var shared = __webpack_require__(21); 262 var setToStringTag = __webpack_require__(26); 263 var uid = __webpack_require__(19); 264 var wks = __webpack_require__(27); 265 var wksExt = __webpack_require__(28); 266 var wksDefine = __webpack_require__(29); 267 var enumKeys = __webpack_require__(30); 268 var isArray = __webpack_require__(45); 269 var anObject = __webpack_require__(12); 270 var isObject = __webpack_require__(13); 271 var toObject = __webpack_require__(46); 272 var toIObject = __webpack_require__(33); 273 var toPrimitive = __webpack_require__(16); 274 var createDesc = __webpack_require__(17); 275 var _create = __webpack_require__(47); 276 var gOPNExt = __webpack_require__(50); 277 var $GOPD = __webpack_require__(52); 278 var $GOPS = __webpack_require__(43); 279 var $DP = __webpack_require__(11); 280 var $keys = __webpack_require__(31); 281 var gOPD = $GOPD.f; 282 var dP = $DP.f; 283 var gOPN = gOPNExt.f; 284 var $Symbol = global.Symbol; 285 var $JSON = global.JSON; 286 var _stringify = $JSON && $JSON.stringify; 287 var PROTOTYPE = 'prototype'; 288 var HIDDEN = wks('_hidden'); 289 var TO_PRIMITIVE = wks('toPrimitive'); 290 var isEnum = {}.propertyIsEnumerable; 291 var SymbolRegistry = shared('symbol-registry'); 292 var AllSymbols = shared('symbols'); 293 var OPSymbols = shared('op-symbols'); 294 var ObjectProto = Object[PROTOTYPE]; 295 var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f; 296 var QObject = global.QObject; 297 // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 298 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; 299 300 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 301 var setSymbolDesc = DESCRIPTORS && $fails(function () { 302 return _create(dP({}, 'a', { 303 get: function () { return dP(this, 'a', { value: 7 }).a; } 304 })).a != 7; 305 }) ? function (it, key, D) { 306 var protoDesc = gOPD(ObjectProto, key); 307 if (protoDesc) delete ObjectProto[key]; 308 dP(it, key, D); 309 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); 310 } : dP; 311 312 var wrap = function (tag) { 313 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); 314 sym._k = tag; 315 return sym; 316 }; 317 318 var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { 319 return typeof it == 'symbol'; 320 } : function (it) { 321 return it instanceof $Symbol; 322 }; 323 324 var $defineProperty = function defineProperty(it, key, D) { 325 if (it === ObjectProto) $defineProperty(OPSymbols, key, D); 326 anObject(it); 327 key = toPrimitive(key, true); 328 anObject(D); 329 if (has(AllSymbols, key)) { 330 if (!D.enumerable) { 331 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); 332 it[HIDDEN][key] = true; 333 } else { 334 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
vendor: 13,745 bytes, lines 335-750
335 D = _create(D, { enumerable: createDesc(0, false) }); 336 } return setSymbolDesc(it, key, D); 337 } return dP(it, key, D); 338 }; 339 var $defineProperties = function defineProperties(it, P) { 340 anObject(it); 341 var keys = enumKeys(P = toIObject(P)); 342 var i = 0; 343 var l = keys.length; 344 var key; 345 while (l > i) $defineProperty(it, key = keys[i++], P[key]); 346 return it; 347 }; 348 var $create = function create(it, P) { 349 return P === undefined ? _create(it) : $defineProperties(_create(it), P); 350 }; 351 var $propertyIsEnumerable = function propertyIsEnumerable(key) { 352 var E = isEnum.call(this, key = toPrimitive(key, true)); 353 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; 354 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; 355 }; 356 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { 357 it = toIObject(it); 358 key = toPrimitive(key, true); 359 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; 360 var D = gOPD(it, key); 361 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; 362 return D; 363 }; 364 var $getOwnPropertyNames = function getOwnPropertyNames(it) { 365 var names = gOPN(toIObject(it)); 366 var result = []; 367 var i = 0; 368 var key; 369 while (names.length > i) { 370 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); 371 } return result; 372 }; 373 var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { 374 var IS_OP = it === ObjectProto; 375 var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); 376 var result = []; 377 var i = 0; 378 var key; 379 while (names.length > i) { 380 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); 381 } return result; 382 }; 383 384 // 19.4.1.1 Symbol([description]) 385 if (!USE_NATIVE) { 386 $Symbol = function Symbol() { 387 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); 388 var tag = uid(arguments.length > 0 ? arguments[0] : undefined); 389 var $set = function (value) { 390 if (this === ObjectProto) $set.call(OPSymbols, value); 391 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; 392 setSymbolDesc(this, tag, createDesc(1, value)); 393 }; 394 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); 395 return wrap(tag); 396 }; 397 redefine($Symbol[PROTOTYPE], 'toString', function toString() { 398 return this._k; 399 }); 400 401 $GOPD.f = $getOwnPropertyDescriptor; 402 $DP.f = $defineProperty; 403 __webpack_require__(51).f = gOPNExt.f = $getOwnPropertyNames; 404 __webpack_require__(44).f = $propertyIsEnumerable; 405 $GOPS.f = $getOwnPropertySymbols; 406 407 if (DESCRIPTORS && !__webpack_require__(22)) { 408 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); 409 } 410 411 wksExt.f = function (name) { 412 return wrap(wks(name)); 413 }; 414 } 415 416 $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); 417 418 for (var es6Symbols = ( 419 // 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 420 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' 421 ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); 422 423 for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); 424 425 $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { 426 // 19.4.2.1 Symbol.for(key) 427 'for': function (key) { 428 return has(SymbolRegistry, key += '') 429 ? SymbolRegistry[key] 430 : SymbolRegistry[key] = $Symbol(key); 431 }, 432 // 19.4.2.5 Symbol.keyFor(sym) 433 keyFor: function keyFor(sym) { 434 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); 435 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; 436 }, 437 useSetter: function () { setter = true; }, 438 useSimple: function () { setter = false; } 439 }); 440 441 $export($export.S + $export.F * !USE_NATIVE, 'Object', { 442 // 19.1.2.2 Object.create(O [, Properties]) 443 create: $create, 444 // 19.1.2.4 Object.defineProperty(O, P, Attributes) 445 defineProperty: $defineProperty, 446 // 19.1.2.3 Object.defineProperties(O, Properties) 447 defineProperties: $defineProperties, 448 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 449 getOwnPropertyDescriptor: $getOwnPropertyDescriptor, 450 // 19.1.2.7 Object.getOwnPropertyNames(O) 451 getOwnPropertyNames: $getOwnPropertyNames, 452 // 19.1.2.8 Object.getOwnPropertySymbols(O) 453 getOwnPropertySymbols: $getOwnPropertySymbols 454 }); 455 456 // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives 457 // https://bugs.chromium.org/p/v8/issues/detail?id=3443 458 var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); }); 459 460 $export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', { 461 getOwnPropertySymbols: function getOwnPropertySymbols(it) { 462 return $GOPS.f(toObject(it)); 463 } 464 }); 465 466 // 24.3.2 JSON.stringify(value [, replacer [, space]]) 467 $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { 468 var S = $Symbol(); 469 // MS Edge converts symbol values to JSON as {} 470 // WebKit converts symbol values to JSON as null 471 // V8 throws on boxed symbols 472 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; 473 })), 'JSON', { 474 stringify: function stringify(it) { 475 var args = [it]; 476 var i = 1; 477 var replacer, $replacer; 478 while (arguments.length > i) args.push(arguments[i++]); 479 $replacer = replacer = args[1]; 480 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined 481 if (!isArray(replacer)) replacer = function (key, value) { 482 if (typeof $replacer == 'function') value = $replacer.call(this, key, value); 483 if (!isSymbol(value)) return value; 484 }; 485 args[1] = replacer; 486 return _stringify.apply($JSON, args); 487 } 488 }); 489 490 // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) 491 $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(10)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); 492 // 19.4.3.5 Symbol.prototype[@@toStringTag] 493 setToStringTag($Symbol, 'Symbol'); 494 // 20.2.1.9 Math[@@toStringTag] 495 setToStringTag(Math, 'Math', true); 496 // 24.3.3 JSON[@@toStringTag] 497 setToStringTag(global.JSON, 'JSON', true); 498 499 500/***/ }), 501/* 4 */ 502/***/ (function(module, exports) { 503 504 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 505 var global = module.exports = typeof window != 'undefined' && window.Math == Math 506 ? window : typeof self != 'undefined' && self.Math == Math ? self 507 // eslint-disable-next-line no-new-func 508 : Function('return this')(); 509 if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef 510 511 512/***/ }), 513/* 5 */ 514/***/ (function(module, exports) { 515 516 var hasOwnProperty = {}.hasOwnProperty; 517 module.exports = function (it, key) { 518 return hasOwnProperty.call(it, key); 519 }; 520 521 522/***/ }), 523/* 6 */ 524/***/ (function(module, exports, __webpack_require__) { 525 526 // Thank's IE8 for his funny defineProperty 527 module.exports = !__webpack_require__(7)(function () { 528 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; 529 }); 530 531 532/***/ }), 533/* 7 */ 534/***/ (function(module, exports) { 535 536 module.exports = function (exec) { 537 try { 538 return !!exec(); 539 } catch (e) { 540 return true; 541 } 542 }; 543 544 545/***/ }), 546/* 8 */ 547/***/ (function(module, exports, __webpack_require__) { 548 549 var global = __webpack_require__(4); 550 var core = __webpack_require__(9); 551 var hide = __webpack_require__(10); 552 var redefine = __webpack_require__(18); 553 var ctx = __webpack_require__(23); 554 var PROTOTYPE = 'prototype'; 555 556 var $export = function (type, name, source) { 557 var IS_FORCED = type & $export.F; 558 var IS_GLOBAL = type & $export.G; 559 var IS_STATIC = type & $export.S; 560 var IS_PROTO = type & $export.P; 561 var IS_BIND = type & $export.B; 562 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; 563 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); 564 var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); 565 var 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/***/ }), 595/* 9 */ 596/***/ (function(module, exports) { 597 598 var core = module.exports = { version: '2.6.12' }; 599 if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef 600 601 602/***/ }), 603/* 10 */ 604/***/ (function(module, exports, __webpack_require__) { 605 606 var dP = __webpack_require__(11); 607 var createDesc = __webpack_require__(17); 608 module.exports = __webpack_require__(6) ? function (object, key, value) { 609 return dP.f(object, key, createDesc(1, value)); 610 } : function (object, key, value) { 611 object[key] = value; 612 return object; 613 }; 614 615 616/***/ }), 617/* 11 */ 618/***/ (function(module, exports, __webpack_require__) { 619 620 var anObject = __webpack_require__(12); 621 var IE8_DOM_DEFINE = __webpack_require__(14); 622 var toPrimitive = __webpack_require__(16); 623 var dP = Object.defineProperty; 624 625 exports.f = __webpack_require__(6) ? Object.defineProperty : function defineProperty(O, P, Attributes) { 626 anObject(O); 627 P = toPrimitive(P, true); 628 anObject(Attributes); 629 if (IE8_DOM_DEFINE) try { 630 return dP(O, P, Attributes); 631 } catch (e) { /* empty */ } 632 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); 633 if ('value' in Attributes) O[P] = Attributes.value; 634 return O; 635 }; 636 637 638/***/ }), 639/* 12 */ 640/***/ (function(module, exports, __webpack_require__) { 641 642 var isObject = __webpack_require__(13); 643 module.exports = function (it) { 644 if (!isObject(it)) throw TypeError(it + ' is not an object!'); 645 return it; 646 }; 647 648 649/***/ }), 650/* 13 */ 651/***/ (function(module, exports) { 652 653 module.exports = function (it) { 654 return typeof it === 'object' ? it !== null : typeof it === 'function'; 655 }; 656 657 658/***/ }), 659/* 14 */ 660/***/ (function(module, exports, __webpack_require__) { 661 662 module.exports = !__webpack_require__(6) && !__webpack_require__(7)(function () { 663 return Object.defineProperty(__webpack_require__(15)('div'), 'a', { get: function () { return 7; } }).a != 7; 664 }); 665 666 667/***/ }), 668/* 15 */ 669/***/ (function(module, exports, __webpack_require__) { 670 671 var isObject = __webpack_require__(13); 672 var document = __webpack_require__(4).document; 673 // typeof document.createElement is 'object' in old IE 674 var is = isObject(document) && isObject(document.createElement); 675 module.exports = function (it) { 676 return is ? document.createElement(it) : {}; 677 }; 678 679 680/***/ }), 681/* 16 */ 682/***/ (function(module, exports, __webpack_require__) { 683 684 // 7.1.1 ToPrimitive(input [, PreferredType]) 685 var isObject = __webpack_require__(13); 686 // instead of the ES6 spec version, we didn't implement @@toPrimitive case 687 // and the second argument - flag - preferred type is a string 688 module.exports = function (it, S) { 689 if (!isObject(it)) return it; 690 var fn, val; 691 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 692 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; 693 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 694 throw TypeError("Can't convert object to primitive value"); 695 }; 696 697 698/***/ }), 699/* 17 */ 700/***/ (function(module, exports) { 701 702 module.exports = function (bitmap, value) { 703 return { 704 enumerable: !(bitmap & 1), 705 configurable: !(bitmap & 2), 706 writable: !(bitmap & 4), 707 value: value 708 }; 709 }; 710 711 712/***/ }), 713/* 18 */ 714/***/ (function(module, exports, __webpack_require__) { 715 716 var global = __webpack_require__(4); 717 var hide = __webpack_require__(10); 718 var has = __webpack_require__(5); 719 var SRC = __webpack_require__(19)('src'); 720 var $toString = __webpack_require__(20); 721 var TO_STRING = 'toString'; 722 var TPL = ('' + $toString).split(TO_STRING); 723 724 __webpack_require__(9).inspectSource = function (it) { 725 return $toString.call(it); 726 }; 727 728 (module.exports = function (O, key, val, safe) { 729 var isFunction = typeof val == 'function'; 730 if (isFunction) has(val, 'name') || hide(val, 'name', key); 731 if (O[key] === val) return; 732 if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); 733 if (O === global) { 734 O[key] = val; 735 } else if (!safe) { 736 delete O[key]; 737 hide(O, key, val); 738 } else if (O[key]) { 739 O[key] = val; 740 } else { 741 hide(O, key, val); 742 } 743 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 744 })(Function.prototype, TO_STRING, function toString() { 745 return typeof this == 'function' && this[SRC] || $toString.call(this); 746 }); 747 748 749/***/ }), 750/* 19 */
vendor: 7,116 bytes, lines 751-1021
751/***/ (function(module, exports) { 752 753 var id = 0; 754 var px = Math.random(); 755 module.exports = function (key) { 756 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 757 }; 758 759 760/***/ }), 761/* 20 */ 762/***/ (function(module, exports, __webpack_require__) { 763 764 module.exports = __webpack_require__(21)('native-function-to-string', Function.toString); 765 766 767/***/ }), 768/* 21 */ 769/***/ (function(module, exports, __webpack_require__) { 770 771 var core = __webpack_require__(9); 772 var global = __webpack_require__(4); 773 var SHARED = '__core-js_shared__'; 774 var store = global[SHARED] || (global[SHARED] = {}); 775 776 (module.exports = function (key, value) { 777 return store[key] || (store[key] = value !== undefined ? value : {}); 778 })('versions', []).push({ 779 version: core.version, 780 mode: __webpack_require__(22) ? 'pure' : 'global', 781 copyright: '© 2020 Denis Pushkarev (zloirock.ru)' 782 }); 783 784 785/***/ }), 786/* 22 */ 787/***/ (function(module, exports) { 788 789 module.exports = false; 790 791 792/***/ }), 793/* 23 */ 794/***/ (function(module, exports, __webpack_require__) { 795 796 // optional / simple context binding 797 var aFunction = __webpack_require__(24); 798 module.exports = function (fn, that, length) { 799 aFunction(fn); 800 if (that === undefined) return fn; 801 switch (length) { 802 case 1: return function (a) { 803 return fn.call(that, a); 804 }; 805 case 2: return function (a, b) { 806 return fn.call(that, a, b); 807 }; 808 case 3: return function (a, b, c) { 809 return fn.call(that, a, b, c); 810 }; 811 } 812 return function (/* ...args */) { 813 return fn.apply(that, arguments); 814 }; 815 }; 816 817 818/***/ }), 819/* 24 */ 820/***/ (function(module, exports) { 821 822 module.exports = function (it) { 823 if (typeof it != 'function') throw TypeError(it + ' is not a function!'); 824 return it; 825 }; 826 827 828/***/ }), 829/* 25 */ 830/***/ (function(module, exports, __webpack_require__) { 831 832 var META = __webpack_require__(19)('meta'); 833 var isObject = __webpack_require__(13); 834 var has = __webpack_require__(5); 835 var setDesc = __webpack_require__(11).f; 836 var id = 0; 837 var isExtensible = Object.isExtensible || function () { 838 return true; 839 }; 840 var FREEZE = !__webpack_require__(7)(function () { 841 return isExtensible(Object.preventExtensions({})); 842 }); 843 var setMeta = function (it) { 844 setDesc(it, META, { value: { 845 i: 'O' + ++id, // object ID 846 w: {} // weak collections IDs 847 } }); 848 }; 849 var fastKey = function (it, create) { 850 // return primitive with prefix 851 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; 852 if (!has(it, META)) { 853 // can't set metadata to uncaught frozen object 854 if (!isExtensible(it)) return 'F'; 855 // not necessary to add metadata 856 if (!create) return 'E'; 857 // add missing metadata 858 setMeta(it); 859 // return object ID 860 } return it[META].i; 861 }; 862 var getWeak = function (it, create) { 863 if (!has(it, META)) { 864 // can't set metadata to uncaught frozen object 865 if (!isExtensible(it)) return true; 866 // not necessary to add metadata 867 if (!create) return false; 868 // add missing metadata 869 setMeta(it); 870 // return hash weak collections IDs 871 } return it[META].w; 872 }; 873 // add metadata on freeze-family methods calling 874 var onFreeze = function (it) { 875 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); 876 return it; 877 }; 878 var meta = module.exports = { 879 KEY: META, 880 NEED: false, 881 fastKey: fastKey, 882 getWeak: getWeak, 883 onFreeze: onFreeze 884 }; 885 886 887/***/ }), 888/* 26 */ 889/***/ (function(module, exports, __webpack_require__) { 890 891 var def = __webpack_require__(11).f; 892 var has = __webpack_require__(5); 893 var TAG = __webpack_require__(27)('toStringTag'); 894 895 module.exports = function (it, tag, stat) { 896 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); 897 }; 898 899 900/***/ }), 901/* 27 */ 902/***/ (function(module, exports, __webpack_require__) { 903 904 var store = __webpack_require__(21)('wks'); 905 var uid = __webpack_require__(19); 906 var Symbol = __webpack_require__(4).Symbol; 907 var USE_SYMBOL = typeof Symbol == 'function'; 908 909 var $exports = module.exports = function (name) { 910 return store[name] || (store[name] = 911 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); 912 }; 913 914 $exports.store = store; 915 916 917/***/ }), 918/* 28 */ 919/***/ (function(module, exports, __webpack_require__) { 920 921 exports.f = __webpack_require__(27); 922 923 924/***/ }), 925/* 29 */ 926/***/ (function(module, exports, __webpack_require__) { 927 928 var global = __webpack_require__(4); 929 var core = __webpack_require__(9); 930 var LIBRARY = __webpack_require__(22); 931 var wksExt = __webpack_require__(28); 932 var defineProperty = __webpack_require__(11).f; 933 module.exports = function (name) { 934 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); 935 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); 936 }; 937 938 939/***/ }), 940/* 30 */ 941/***/ (function(module, exports, __webpack_require__) { 942 943 // all enumerable object keys, includes symbols 944 var getKeys = __webpack_require__(31); 945 var gOPS = __webpack_require__(43); 946 var pIE = __webpack_require__(44); 947 module.exports = function (it) { 948 var result = getKeys(it); 949 var getSymbols = gOPS.f; 950 if (getSymbols) { 951 var symbols = getSymbols(it); 952 var isEnum = pIE.f; 953 var i = 0; 954 var key; 955 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); 956 } return result; 957 }; 958 959 960/***/ }), 961/* 31 */ 962/***/ (function(module, exports, __webpack_require__) { 963 964 // 19.1.2.14 / 15.2.3.14 Object.keys(O) 965 var $keys = __webpack_require__(32); 966 var enumBugKeys = __webpack_require__(42); 967 968 module.exports = Object.keys || function keys(O) { 969 return $keys(O, enumBugKeys); 970 }; 971 972 973/***/ }), 974/* 32 */ 975/***/ (function(module, exports, __webpack_require__) { 976 977 var has = __webpack_require__(5); 978 var toIObject = __webpack_require__(33); 979 var arrayIndexOf = __webpack_require__(37)(false); 980 var IE_PROTO = __webpack_require__(41)('IE_PROTO'); 981 982 module.exports = function (object, names) { 983 var O = toIObject(object); 984 var i = 0; 985 var result = []; 986 var key; 987 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); 988 // Don't enum bug & hidden keys 989 while (names.length > i) if (has(O, key = names[i++])) { 990 ~arrayIndexOf(result, key) || result.push(key); 991 } 992 return result; 993 }; 994 995 996/***/ }), 997/* 33 */ 998/***/ (function(module, exports, __webpack_require__) { 999 1000 // to indexed object, toObject with fallback for non-array-like ES3 strings 1001 var IObject = __webpack_require__(34); 1002 var defined = __webpack_require__(36); 1003 module.exports = function (it) { 1004 return IObject(defined(it)); 1005 }; 1006 1007 1008/***/ }), 1009/* 34 */ 1010/***/ (function(module, exports, __webpack_require__) { 1011 1012 // fallback for non-array-like ES3 and non-enumerable old V8 strings 1013 var cof = __webpack_require__(35); 1014 // eslint-disable-next-line no-prototype-builtins 1015 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { 1016 return cof(it) == 'String' ? it.split('') : Object(it); 1017 }; 1018 1019 1020/***/ }), 1021/* 35 */
vendor: 2,412 bytes, lines 1022-1114
1022/***/ (function(module, exports) { 1023 1024 var toString = {}.toString; 1025 1026 module.exports = function (it) { 1027 return toString.call(it).slice(8, -1); 1028 }; 1029 1030 1031/***/ }), 1032/* 36 */ 1033/***/ (function(module, exports) { 1034 1035 // 7.2.1 RequireObjectCoercible(argument) 1036 module.exports = function (it) { 1037 if (it == undefined) throw TypeError("Can't call method on " + it); 1038 return it; 1039 }; 1040 1041 1042/***/ }), 1043/* 37 */ 1044/***/ (function(module, exports, __webpack_require__) { 1045 1046 // false -> Array#indexOf 1047 // true -> Array#includes 1048 var toIObject = __webpack_require__(33); 1049 var toLength = __webpack_require__(38); 1050 var toAbsoluteIndex = __webpack_require__(40); 1051 module.exports = function (IS_INCLUDES) { 1052 return function ($this, el, fromIndex) { 1053 var O = toIObject($this); 1054 var length = toLength(O.length); 1055 var index = toAbsoluteIndex(fromIndex, length); 1056 var value; 1057 // Array#includes uses SameValueZero equality algorithm 1058 // eslint-disable-next-line no-self-compare 1059 if (IS_INCLUDES && el != el) while (length > index) { 1060 value = O[index++]; 1061 // eslint-disable-next-line no-self-compare 1062 if (value != value) return true; 1063 // Array#indexOf ignores holes, Array#includes - not 1064 } else for (;length > index; index++) if (IS_INCLUDES || index in O) { 1065 if (O[index] === el) return IS_INCLUDES || index || 0; 1066 } return !IS_INCLUDES && -1; 1067 }; 1068 }; 1069 1070 1071/***/ }), 1072/* 38 */ 1073/***/ (function(module, exports, __webpack_require__) { 1074 1075 // 7.1.15 ToLength 1076 var toInteger = __webpack_require__(39); 1077 var min = Math.min; 1078 module.exports = function (it) { 1079 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 1080 }; 1081 1082 1083/***/ }), 1084/* 39 */ 1085/***/ (function(module, exports) { 1086 1087 // 7.1.4 ToInteger 1088 var ceil = Math.ceil; 1089 var floor = Math.floor; 1090 module.exports = function (it) { 1091 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 1092 }; 1093 1094 1095/***/ }), 1096/* 40 */ 1097/***/ (function(module, exports, __webpack_require__) { 1098 1099 var toInteger = __webpack_require__(39); 1100 var max = Math.max; 1101 var min = Math.min; 1102 module.exports = function (index, length) { 1103 index = toInteger(index); 1104 return index < 0 ? max(index + length, 0) : min(index, length); 1105 }; 1106 1107 1108/***/ }), 1109/* 41 */ 1110/***/ (function(module, exports, __webpack_require__) { 1111 1112 var shared = __webpack_require__(21)('keys'); 1113 var uid = __webpack_require__(19); 1114 module.exports = function (key) {
vendor: 6,271 bytes, lines 1115-1344
1115 return shared[key] || (shared[key] = uid(key)); 1116 }; 1117 1118 1119/***/ }), 1120/* 42 */ 1121/***/ (function(module, exports) { 1122 1123 // IE 8- don't enum bug keys 1124 module.exports = ( 1125 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' 1126 ).split(','); 1127 1128 1129/***/ }), 1130/* 43 */ 1131/***/ (function(module, exports) { 1132 1133 exports.f = Object.getOwnPropertySymbols; 1134 1135 1136/***/ }), 1137/* 44 */ 1138/***/ (function(module, exports) { 1139 1140 exports.f = {}.propertyIsEnumerable; 1141 1142 1143/***/ }), 1144/* 45 */ 1145/***/ (function(module, exports, __webpack_require__) { 1146 1147 // 7.2.2 IsArray(argument) 1148 var cof = __webpack_require__(35); 1149 module.exports = Array.isArray || function isArray(arg) { 1150 return cof(arg) == 'Array'; 1151 }; 1152 1153 1154/***/ }), 1155/* 46 */ 1156/***/ (function(module, exports, __webpack_require__) { 1157 1158 // 7.1.13 ToObject(argument) 1159 var defined = __webpack_require__(36); 1160 module.exports = function (it) { 1161 return Object(defined(it)); 1162 }; 1163 1164 1165/***/ }), 1166/* 47 */ 1167/***/ (function(module, exports, __webpack_require__) { 1168 1169 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 1170 var anObject = __webpack_require__(12); 1171 var dPs = __webpack_require__(48); 1172 var enumBugKeys = __webpack_require__(42); 1173 var IE_PROTO = __webpack_require__(41)('IE_PROTO'); 1174 var Empty = function () { /* empty */ }; 1175 var PROTOTYPE = 'prototype'; 1176 1177 // Create object with fake `null` prototype: use iframe Object with cleared prototype 1178 var createDict = function () { 1179 // Thrash, waste and sodomy: IE GC bug 1180 var iframe = __webpack_require__(15)('iframe'); 1181 var i = enumBugKeys.length; 1182 var lt = '<'; 1183 var gt = '>'; 1184 var iframeDocument; 1185 iframe.style.display = 'none'; 1186 __webpack_require__(49).appendChild(iframe); 1187 iframe.src = 'javascript:'; // eslint-disable-line no-script-url 1188 // createDict = iframe.contentWindow.Object; 1189 // html.removeChild(iframe); 1190 iframeDocument = iframe.contentWindow.document; 1191 iframeDocument.open(); 1192 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); 1193 iframeDocument.close(); 1194 createDict = iframeDocument.F; 1195 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; 1196 return createDict(); 1197 }; 1198 1199 module.exports = Object.create || function create(O, Properties) { 1200 var result; 1201 if (O !== null) { 1202 Empty[PROTOTYPE] = anObject(O); 1203 result = new Empty(); 1204 Empty[PROTOTYPE] = null; 1205 // add "__proto__" for Object.getPrototypeOf polyfill 1206 result[IE_PROTO] = O; 1207 } else result = createDict(); 1208 return Properties === undefined ? result : dPs(result, Properties); 1209 }; 1210 1211 1212/***/ }), 1213/* 48 */ 1214/***/ (function(module, exports, __webpack_require__) { 1215 1216 var dP = __webpack_require__(11); 1217 var anObject = __webpack_require__(12); 1218 var getKeys = __webpack_require__(31); 1219 1220 module.exports = __webpack_require__(6) ? Object.defineProperties : function defineProperties(O, Properties) { 1221 anObject(O); 1222 var keys = getKeys(Properties); 1223 var length = keys.length; 1224 var i = 0; 1225 var P; 1226 while (length > i) dP.f(O, P = keys[i++], Properties[P]); 1227 return O; 1228 }; 1229 1230 1231/***/ }), 1232/* 49 */ 1233/***/ (function(module, exports, __webpack_require__) { 1234 1235 var document = __webpack_require__(4).document; 1236 module.exports = document && document.documentElement; 1237 1238 1239/***/ }), 1240/* 50 */ 1241/***/ (function(module, exports, __webpack_require__) { 1242 1243 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window 1244 var toIObject = __webpack_require__(33); 1245 var gOPN = __webpack_require__(51).f; 1246 var toString = {}.toString; 1247 1248 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames 1249 ? Object.getOwnPropertyNames(window) : []; 1250 1251 var getWindowNames = function (it) { 1252 try { 1253 return gOPN(it); 1254 } catch (e) { 1255 return windowNames.slice(); 1256 } 1257 }; 1258 1259 module.exports.f = function getOwnPropertyNames(it) { 1260 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); 1261 }; 1262 1263 1264/***/ }), 1265/* 51 */ 1266/***/ (function(module, exports, __webpack_require__) { 1267 1268 // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) 1269 var $keys = __webpack_require__(32); 1270 var hiddenKeys = __webpack_require__(42).concat('length', 'prototype'); 1271 1272 exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 1273 return $keys(O, hiddenKeys); 1274 }; 1275 1276 1277/***/ }), 1278/* 52 */ 1279/***/ (function(module, exports, __webpack_require__) { 1280 1281 var pIE = __webpack_require__(44); 1282 var createDesc = __webpack_require__(17); 1283 var toIObject = __webpack_require__(33); 1284 var toPrimitive = __webpack_require__(16); 1285 var has = __webpack_require__(5); 1286 var IE8_DOM_DEFINE = __webpack_require__(14); 1287 var gOPD = Object.getOwnPropertyDescriptor; 1288 1289 exports.f = __webpack_require__(6) ? gOPD : function getOwnPropertyDescriptor(O, P) { 1290 O = toIObject(O); 1291 P = toPrimitive(P, true); 1292 if (IE8_DOM_DEFINE) try { 1293 return gOPD(O, P); 1294 } catch (e) { /* empty */ } 1295 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); 1296 }; 1297 1298 1299/***/ }), 1300/* 53 */ 1301/***/ (function(module, exports, __webpack_require__) { 1302 1303 var $export = __webpack_require__(8); 1304 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 1305 $export($export.S, 'Object', { create: __webpack_require__(47) }); 1306 1307 1308/***/ }), 1309/* 54 */ 1310/***/ (function(module, exports, __webpack_require__) { 1311 1312 var $export = __webpack_require__(8); 1313 // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) 1314 $export($export.S + $export.F * !__webpack_require__(6), 'Object', { defineProperty: __webpack_require__(11).f }); 1315 1316 1317/***/ }), 1318/* 55 */ 1319/***/ (function(module, exports, __webpack_require__) { 1320 1321 var $export = __webpack_require__(8); 1322 // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) 1323 $export($export.S + $export.F * !__webpack_require__(6), 'Object', { defineProperties: __webpack_require__(48) }); 1324 1325 1326/***/ }), 1327/* 56 */ 1328/***/ (function(module, exports, __webpack_require__) { 1329 1330 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 1331 var toIObject = __webpack_require__(33); 1332 var $getOwnPropertyDescriptor = __webpack_require__(52).f; 1333 1334 __webpack_require__(57)('getOwnPropertyDescriptor', function () { 1335 return function getOwnPropertyDescriptor(it, key) { 1336 return $getOwnPropertyDescriptor(toIObject(it), key); 1337 }; 1338 }); 1339 1340 1341/***/ }), 1342/* 57 */ 1343/***/ (function(module, exports, __webpack_require__) { 1344
vendor: 35,937 bytes, lines 1345-2678
1345 // most Object methods by ES6 should accept primitives 1346 var $export = __webpack_require__(8); 1347 var core = __webpack_require__(9); 1348 var fails = __webpack_require__(7); 1349 module.exports = function (KEY, exec) { 1350 var fn = (core.Object || {})[KEY] || Object[KEY]; 1351 var exp = {}; 1352 exp[KEY] = exec(fn); 1353 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); 1354 }; 1355 1356 1357/***/ }), 1358/* 58 */ 1359/***/ (function(module, exports, __webpack_require__) { 1360 1361 // 19.1.2.9 Object.getPrototypeOf(O) 1362 var toObject = __webpack_require__(46); 1363 var $getPrototypeOf = __webpack_require__(59); 1364 1365 __webpack_require__(57)('getPrototypeOf', function () { 1366 return function getPrototypeOf(it) { 1367 return $getPrototypeOf(toObject(it)); 1368 }; 1369 }); 1370 1371 1372/***/ }), 1373/* 59 */ 1374/***/ (function(module, exports, __webpack_require__) { 1375 1376 // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) 1377 var has = __webpack_require__(5); 1378 var toObject = __webpack_require__(46); 1379 var IE_PROTO = __webpack_require__(41)('IE_PROTO'); 1380 var ObjectProto = Object.prototype; 1381 1382 module.exports = Object.getPrototypeOf || function (O) { 1383 O = toObject(O); 1384 if (has(O, IE_PROTO)) return O[IE_PROTO]; 1385 if (typeof O.constructor == 'function' && O instanceof O.constructor) { 1386 return O.constructor.prototype; 1387 } return O instanceof Object ? ObjectProto : null; 1388 }; 1389 1390 1391/***/ }), 1392/* 60 */ 1393/***/ (function(module, exports, __webpack_require__) { 1394 1395 // 19.1.2.14 Object.keys(O) 1396 var toObject = __webpack_require__(46); 1397 var $keys = __webpack_require__(31); 1398 1399 __webpack_require__(57)('keys', function () { 1400 return function keys(it) { 1401 return $keys(toObject(it)); 1402 }; 1403 }); 1404 1405 1406/***/ }), 1407/* 61 */ 1408/***/ (function(module, exports, __webpack_require__) { 1409 1410 // 19.1.2.7 Object.getOwnPropertyNames(O) 1411 __webpack_require__(57)('getOwnPropertyNames', function () { 1412 return __webpack_require__(50).f; 1413 }); 1414 1415 1416/***/ }), 1417/* 62 */ 1418/***/ (function(module, exports, __webpack_require__) { 1419 1420 // 19.1.2.5 Object.freeze(O) 1421 var isObject = __webpack_require__(13); 1422 var meta = __webpack_require__(25).onFreeze; 1423 1424 __webpack_require__(57)('freeze', function ($freeze) { 1425 return function freeze(it) { 1426 return $freeze && isObject(it) ? $freeze(meta(it)) : it; 1427 }; 1428 }); 1429 1430 1431/***/ }), 1432/* 63 */ 1433/***/ (function(module, exports, __webpack_require__) { 1434 1435 // 19.1.2.17 Object.seal(O) 1436 var isObject = __webpack_require__(13); 1437 var meta = __webpack_require__(25).onFreeze; 1438 1439 __webpack_require__(57)('seal', function ($seal) { 1440 return function seal(it) { 1441 return $seal && isObject(it) ? $seal(meta(it)) : it; 1442 }; 1443 }); 1444 1445 1446/***/ }), 1447/* 64 */ 1448/***/ (function(module, exports, __webpack_require__) { 1449 1450 // 19.1.2.15 Object.preventExtensions(O) 1451 var isObject = __webpack_require__(13); 1452 var meta = __webpack_require__(25).onFreeze; 1453 1454 __webpack_require__(57)('preventExtensions', function ($preventExtensions) { 1455 return function preventExtensions(it) { 1456 return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; 1457 }; 1458 }); 1459 1460 1461/***/ }), 1462/* 65 */ 1463/***/ (function(module, exports, __webpack_require__) { 1464 1465 // 19.1.2.12 Object.isFrozen(O) 1466 var isObject = __webpack_require__(13); 1467 1468 __webpack_require__(57)('isFrozen', function ($isFrozen) { 1469 return function isFrozen(it) { 1470 return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; 1471 }; 1472 }); 1473 1474 1475/***/ }), 1476/* 66 */ 1477/***/ (function(module, exports, __webpack_require__) { 1478 1479 // 19.1.2.13 Object.isSealed(O) 1480 var isObject = __webpack_require__(13); 1481 1482 __webpack_require__(57)('isSealed', function ($isSealed) { 1483 return function isSealed(it) { 1484 return isObject(it) ? $isSealed ? $isSealed(it) : false : true; 1485 }; 1486 }); 1487 1488 1489/***/ }), 1490/* 67 */ 1491/***/ (function(module, exports, __webpack_require__) { 1492 1493 // 19.1.2.11 Object.isExtensible(O) 1494 var isObject = __webpack_require__(13); 1495 1496 __webpack_require__(57)('isExtensible', function ($isExtensible) { 1497 return function isExtensible(it) { 1498 return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; 1499 }; 1500 }); 1501 1502 1503/***/ }), 1504/* 68 */ 1505/***/ (function(module, exports, __webpack_require__) { 1506 1507 // 19.1.3.1 Object.assign(target, source) 1508 var $export = __webpack_require__(8); 1509 1510 $export($export.S + $export.F, 'Object', { assign: __webpack_require__(69) }); 1511 1512 1513/***/ }), 1514/* 69 */ 1515/***/ (function(module, exports, __webpack_require__) { 1516 1517 'use strict'; 1518 // 19.1.2.1 Object.assign(target, source, ...) 1519 var DESCRIPTORS = __webpack_require__(6); 1520 var getKeys = __webpack_require__(31); 1521 var gOPS = __webpack_require__(43); 1522 var pIE = __webpack_require__(44); 1523 var toObject = __webpack_require__(46); 1524 var IObject = __webpack_require__(34); 1525 var $assign = Object.assign; 1526 1527 // should work with symbols and should have deterministic property order (V8 bug) 1528 module.exports = !$assign || __webpack_require__(7)(function () { 1529 var A = {}; 1530 var B = {}; 1531 // eslint-disable-next-line no-undef 1532 var S = Symbol(); 1533 var K = 'abcdefghijklmnopqrst'; 1534 A[S] = 7; 1535 K.split('').forEach(function (k) { B[k] = k; }); 1536 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; 1537 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars 1538 var T = toObject(target); 1539 var aLen = arguments.length; 1540 var index = 1; 1541 var getSymbols = gOPS.f; 1542 var isEnum = pIE.f; 1543 while (aLen > index) { 1544 var S = IObject(arguments[index++]); 1545 var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); 1546 var length = keys.length; 1547 var j = 0; 1548 var key; 1549 while (length > j) { 1550 key = keys[j++]; 1551 if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key]; 1552 } 1553 } return T; 1554 } : $assign; 1555 1556 1557/***/ }), 1558/* 70 */ 1559/***/ (function(module, exports, __webpack_require__) { 1560 1561 // 19.1.3.10 Object.is(value1, value2) 1562 var $export = __webpack_require__(8); 1563 $export($export.S, 'Object', { is: __webpack_require__(71) }); 1564 1565 1566/***/ }), 1567/* 71 */ 1568/***/ (function(module, exports) { 1569 1570 // 7.2.9 SameValue(x, y) 1571 module.exports = Object.is || function is(x, y) { 1572 // eslint-disable-next-line no-self-compare 1573 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; 1574 }; 1575 1576 1577/***/ }), 1578/* 72 */ 1579/***/ (function(module, exports, __webpack_require__) { 1580 1581 // 19.1.3.19 Object.setPrototypeOf(O, proto) 1582 var $export = __webpack_require__(8); 1583 $export($export.S, 'Object', { setPrototypeOf: __webpack_require__(73).set }); 1584 1585 1586/***/ }), 1587/* 73 */ 1588/***/ (function(module, exports, __webpack_require__) { 1589 1590 // Works with __proto__ only. Old v8 can't work with null proto objects. 1591 /* eslint-disable no-proto */ 1592 var isObject = __webpack_require__(13); 1593 var anObject = __webpack_require__(12); 1594 var check = function (O, proto) { 1595 anObject(O); 1596 if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); 1597 }; 1598 module.exports = { 1599 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line 1600 function (test, buggy, set) { 1601 try { 1602 set = __webpack_require__(23)(Function.call, __webpack_require__(52).f(Object.prototype, '__proto__').set, 2); 1603 set(test, []); 1604 buggy = !(test instanceof Array); 1605 } catch (e) { buggy = true; } 1606 return function setPrototypeOf(O, proto) { 1607 check(O, proto); 1608 if (buggy) O.__proto__ = proto; 1609 else set(O, proto); 1610 return O; 1611 }; 1612 }({}, false) : undefined), 1613 check: check 1614 }; 1615 1616 1617/***/ }), 1618/* 74 */ 1619/***/ (function(module, exports, __webpack_require__) { 1620 1621 'use strict'; 1622 // 19.1.3.6 Object.prototype.toString() 1623 var classof = __webpack_require__(75); 1624 var test = {}; 1625 test[__webpack_require__(27)('toStringTag')] = 'z'; 1626 if (test + '' != '[object z]') { 1627 __webpack_require__(18)(Object.prototype, 'toString', function toString() { 1628 return '[object ' + classof(this) + ']'; 1629 }, true); 1630 } 1631 1632 1633/***/ }), 1634/* 75 */ 1635/***/ (function(module, exports, __webpack_require__) { 1636 1637 // getting tag from 19.1.3.6 Object.prototype.toString() 1638 var cof = __webpack_require__(35); 1639 var TAG = __webpack_require__(27)('toStringTag'); 1640 // ES3 wrong here 1641 var ARG = cof(function () { return arguments; }()) == 'Arguments'; 1642 1643 // fallback for IE11 Script Access Denied error 1644 var tryGet = function (it, key) { 1645 try { 1646 return it[key]; 1647 } catch (e) { /* empty */ } 1648 }; 1649 1650 module.exports = function (it) { 1651 var O, T, B; 1652 return it === undefined ? 'Undefined' : it === null ? 'Null' 1653 // @@toStringTag case 1654 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T 1655 // builtinTag case 1656 : ARG ? cof(O) 1657 // ES3 arguments fallback 1658 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; 1659 }; 1660 1661 1662/***/ }), 1663/* 76 */ 1664/***/ (function(module, exports, __webpack_require__) { 1665 1666 // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) 1667 var $export = __webpack_require__(8); 1668 1669 $export($export.P, 'Function', { bind: __webpack_require__(77) }); 1670 1671 1672/***/ }), 1673/* 77 */ 1674/***/ (function(module, exports, __webpack_require__) { 1675 1676 'use strict'; 1677 var aFunction = __webpack_require__(24); 1678 var isObject = __webpack_require__(13); 1679 var invoke = __webpack_require__(78); 1680 var arraySlice = [].slice; 1681 var factories = {}; 1682 1683 var construct = function (F, len, args) { 1684 if (!(len in factories)) { 1685 for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; 1686 // eslint-disable-next-line no-new-func 1687 factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); 1688 } return factories[len](F, args); 1689 }; 1690 1691 module.exports = Function.bind || function bind(that /* , ...args */) { 1692 var fn = aFunction(this); 1693 var partArgs = arraySlice.call(arguments, 1); 1694 var bound = function (/* args... */) { 1695 var args = partArgs.concat(arraySlice.call(arguments)); 1696 return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); 1697 }; 1698 if (isObject(fn.prototype)) bound.prototype = fn.prototype; 1699 return bound; 1700 }; 1701 1702 1703/***/ }), 1704/* 78 */ 1705/***/ (function(module, exports) { 1706 1707 // fast apply, http://jsperf.lnkit.com/fast-apply/5 1708 module.exports = function (fn, args, that) { 1709 var un = that === undefined; 1710 switch (args.length) { 1711 case 0: return un ? fn() 1712 : fn.call(that); 1713 case 1: return un ? fn(args[0]) 1714 : fn.call(that, args[0]); 1715 case 2: return un ? fn(args[0], args[1]) 1716 : fn.call(that, args[0], args[1]); 1717 case 3: return un ? fn(args[0], args[1], args[2]) 1718 : fn.call(that, args[0], args[1], args[2]); 1719 case 4: return un ? fn(args[0], args[1], args[2], args[3]) 1720 : fn.call(that, args[0], args[1], args[2], args[3]); 1721 } return fn.apply(that, args); 1722 }; 1723 1724 1725/***/ }), 1726/* 79 */ 1727/***/ (function(module, exports, __webpack_require__) { 1728 1729 var dP = __webpack_require__(11).f; 1730 var FProto = Function.prototype; 1731 var nameRE = /^\s*function ([^ (]*)/; 1732 var NAME = 'name'; 1733 1734 // 19.2.4.2 name 1735 NAME in FProto || __webpack_require__(6) && dP(FProto, NAME, { 1736 configurable: true, 1737 get: function () { 1738 try { 1739 return ('' + this).match(nameRE)[1]; 1740 } catch (e) { 1741 return ''; 1742 } 1743 } 1744 }); 1745 1746 1747/***/ }), 1748/* 80 */ 1749/***/ (function(module, exports, __webpack_require__) { 1750 1751 'use strict'; 1752 var isObject = __webpack_require__(13); 1753 var getPrototypeOf = __webpack_require__(59); 1754 var HAS_INSTANCE = __webpack_require__(27)('hasInstance'); 1755 var FunctionProto = Function.prototype; 1756 // 19.2.3.6 Function.prototype[@@hasInstance](V) 1757 if (!(HAS_INSTANCE in FunctionProto)) __webpack_require__(11).f(FunctionProto, HAS_INSTANCE, { value: function (O) { 1758 if (typeof this != 'function' || !isObject(O)) return false; 1759 if (!isObject(this.prototype)) return O instanceof this; 1760 // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: 1761 while (O = getPrototypeOf(O)) if (this.prototype === O) return true; 1762 return false; 1763 } }); 1764 1765 1766/***/ }), 1767/* 81 */ 1768/***/ (function(module, exports, __webpack_require__) { 1769 1770 var $export = __webpack_require__(8); 1771 var $parseInt = __webpack_require__(82); 1772 // 18.2.5 parseInt(string, radix) 1773 $export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); 1774 1775 1776/***/ }), 1777/* 82 */ 1778/***/ (function(module, exports, __webpack_require__) { 1779 1780 var $parseInt = __webpack_require__(4).parseInt; 1781 var $trim = __webpack_require__(83).trim; 1782 var ws = __webpack_require__(84); 1783 var hex = /^[-+]?0[xX]/; 1784 1785 module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { 1786 var string = $trim(String(str), 3); 1787 return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); 1788 } : $parseInt; 1789 1790 1791/***/ }), 1792/* 83 */ 1793/***/ (function(module, exports, __webpack_require__) { 1794 1795 var $export = __webpack_require__(8); 1796 var defined = __webpack_require__(36); 1797 var fails = __webpack_require__(7); 1798 var spaces = __webpack_require__(84); 1799 var space = '[' + spaces + ']'; 1800 var non = '\u200b\u0085'; 1801 var ltrim = RegExp('^' + space + space + '*'); 1802 var rtrim = RegExp(space + space + '*$'); 1803 1804 var exporter = function (KEY, exec, ALIAS) { 1805 var exp = {}; 1806 var FORCE = fails(function () { 1807 return !!spaces[KEY]() || non[KEY]() != non; 1808 }); 1809 var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; 1810 if (ALIAS) exp[ALIAS] = fn; 1811 $export($export.P + $export.F * FORCE, 'String', exp); 1812 }; 1813 1814 // 1 -> String#trimLeft 1815 // 2 -> String#trimRight 1816 // 3 -> String#trim 1817 var trim = exporter.trim = function (string, TYPE) { 1818 string = String(defined(string)); 1819 if (TYPE & 1) string = string.replace(ltrim, ''); 1820 if (TYPE & 2) string = string.replace(rtrim, ''); 1821 return string; 1822 }; 1823 1824 module.exports = exporter; 1825 1826 1827/***/ }), 1828/* 84 */ 1829/***/ (function(module, exports) { 1830 1831 module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + 1832 '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 1833 1834 1835/***/ }), 1836/* 85 */ 1837/***/ (function(module, exports, __webpack_require__) { 1838 1839 var $export = __webpack_require__(8); 1840 var $parseFloat = __webpack_require__(86); 1841 // 18.2.4 parseFloat(string) 1842 $export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat }); 1843 1844 1845/***/ }), 1846/* 86 */ 1847/***/ (function(module, exports, __webpack_require__) { 1848 1849 var $parseFloat = __webpack_require__(4).parseFloat; 1850 var $trim = __webpack_require__(83).trim; 1851 1852 module.exports = 1 / $parseFloat(__webpack_require__(84) + '-0') !== -Infinity ? function parseFloat(str) { 1853 var string = $trim(String(str), 3); 1854 var result = $parseFloat(string); 1855 return result === 0 && string.charAt(0) == '-' ? -0 : result; 1856 } : $parseFloat; 1857 1858 1859/***/ }), 1860/* 87 */ 1861/***/ (function(module, exports, __webpack_require__) { 1862 1863 'use strict'; 1864 var global = __webpack_require__(4); 1865 var has = __webpack_require__(5); 1866 var cof = __webpack_require__(35); 1867 var inheritIfRequired = __webpack_require__(88); 1868 var toPrimitive = __webpack_require__(16); 1869 var fails = __webpack_require__(7); 1870 var gOPN = __webpack_require__(51).f; 1871 var gOPD = __webpack_require__(52).f; 1872 var dP = __webpack_require__(11).f; 1873 var $trim = __webpack_require__(83).trim; 1874 var NUMBER = 'Number'; 1875 var $Number = global[NUMBER]; 1876 var Base = $Number; 1877 var proto = $Number.prototype; 1878 // Opera ~12 has broken Object#toString 1879 var BROKEN_COF = cof(__webpack_require__(47)(proto)) == NUMBER; 1880 var TRIM = 'trim' in String.prototype; 1881 1882 // 7.1.3 ToNumber(argument) 1883 var toNumber = function (argument) { 1884 var it = toPrimitive(argument, false); 1885 if (typeof it == 'string' && it.length > 2) { 1886 it = TRIM ? it.trim() : $trim(it, 3); 1887 var first = it.charCodeAt(0); 1888 var third, radix, maxCode; 1889 if (first === 43 || first === 45) { 1890 third = it.charCodeAt(2); 1891 if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix 1892 } else if (first === 48) { 1893 switch (it.charCodeAt(1)) { 1894 case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i 1895 case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i 1896 default: return +it; 1897 } 1898 for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { 1899 code = digits.charCodeAt(i); 1900 // parseInt parses a string to a first unavailable symbol 1901 // but ToNumber should return NaN if a string contains unavailable symbols 1902 if (code < 48 || code > maxCode) return NaN; 1903 } return parseInt(digits, radix); 1904 } 1905 } return +it; 1906 }; 1907 1908 if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { 1909 $Number = function Number(value) { 1910 var it = arguments.length < 1 ? 0 : value; 1911 var that = this; 1912 return that instanceof $Number 1913 // check on 1..constructor(foo) case 1914 && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) 1915 ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); 1916 }; 1917 for (var keys = __webpack_require__(6) ? gOPN(Base) : ( 1918 // ES3: 1919 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + 1920 // ES6 (in case, if modules with ES6 Number statics required before): 1921 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 1922 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' 1923 ).split(','), j = 0, key; keys.length > j; j++) { 1924 if (has(Base, key = keys[j]) && !has($Number, key)) { 1925 dP($Number, key, gOPD(Base, key)); 1926 } 1927 } 1928 $Number.prototype = proto; 1929 proto.constructor = $Number; 1930 __webpack_require__(18)(global, NUMBER, $Number); 1931 } 1932 1933 1934/***/ }), 1935/* 88 */ 1936/***/ (function(module, exports, __webpack_require__) { 1937 1938 var isObject = __webpack_require__(13); 1939 var setPrototypeOf = __webpack_require__(73).set; 1940 module.exports = function (that, target, C) { 1941 var S = target.constructor; 1942 var P; 1943 if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { 1944 setPrototypeOf(that, P); 1945 } return that; 1946 }; 1947 1948 1949/***/ }), 1950/* 89 */ 1951/***/ (function(module, exports, __webpack_require__) { 1952 1953 'use strict'; 1954 var $export = __webpack_require__(8); 1955 var toInteger = __webpack_require__(39); 1956 var aNumberValue = __webpack_require__(90); 1957 var repeat = __webpack_require__(91); 1958 var $toFixed = 1.0.toFixed; 1959 var floor = Math.floor; 1960 var data = [0, 0, 0, 0, 0, 0]; 1961 var ERROR = 'Number.toFixed: incorrect invocation!'; 1962 var ZERO = '0'; 1963 1964 var multiply = function (n, c) { 1965 var i = -1; 1966 var c2 = c; 1967 while (++i < 6) { 1968 c2 += n * data[i]; 1969 data[i] = c2 % 1e7; 1970 c2 = floor(c2 / 1e7); 1971 } 1972 }; 1973 var divide = function (n) { 1974 var i = 6; 1975 var c = 0; 1976 while (--i >= 0) { 1977 c += data[i]; 1978 data[i] = floor(c / n); 1979 c = (c % n) * 1e7; 1980 } 1981 }; 1982 var numToString = function () { 1983 var i = 6; 1984 var s = ''; 1985 while (--i >= 0) { 1986 if (s !== '' || i === 0 || data[i] !== 0) { 1987 var t = String(data[i]); 1988 s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; 1989 } 1990 } return s; 1991 }; 1992 var pow = function (x, n, acc) { 1993 return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); 1994 }; 1995 var log = function (x) { 1996 var n = 0; 1997 var x2 = x; 1998 while (x2 >= 4096) { 1999 n += 12; 2000 x2 /= 4096; 2001 } 2002 while (x2 >= 2) { 2003 n += 1; 2004 x2 /= 2; 2005 } return n; 2006 }; 2007 2008 $export($export.P + $export.F * (!!$toFixed && ( 2009 0.00008.toFixed(3) !== '0.000' || 2010 0.9.toFixed(0) !== '1' || 2011 1.255.toFixed(2) !== '1.25' || 2012 1000000000000000128.0.toFixed(0) !== '1000000000000000128' 2013 ) || !__webpack_require__(7)(function () { 2014 // V8 ~ Android 4.3- 2015 $toFixed.call({}); 2016 })), 'Number', { 2017 toFixed: function toFixed(fractionDigits) { 2018 var x = aNumberValue(this, ERROR); 2019 var f = toInteger(fractionDigits); 2020 var s = ''; 2021 var m = ZERO; 2022 var e, z, j, k; 2023 if (f < 0 || f > 20) throw RangeError(ERROR); 2024 // eslint-disable-next-line no-self-compare 2025 if (x != x) return 'NaN'; 2026 if (x <= -1e21 || x >= 1e21) return String(x); 2027 if (x < 0) { 2028 s = '-'; 2029 x = -x; 2030 } 2031 if (x > 1e-21) { 2032 e = log(x * pow(2, 69, 1)) - 69; 2033 z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); 2034 z *= 0x10000000000000; 2035 e = 52 - e; 2036 if (e > 0) { 2037 multiply(0, z); 2038 j = f; 2039 while (j >= 7) { 2040 multiply(1e7, 0); 2041 j -= 7; 2042 } 2043 multiply(pow(10, j, 1), 0); 2044 j = e - 1; 2045 while (j >= 23) { 2046 divide(1 << 23); 2047 j -= 23; 2048 } 2049 divide(1 << j); 2050 multiply(1, 1); 2051 divide(2); 2052 m = numToString(); 2053 } else { 2054 multiply(0, z); 2055 multiply(1 << -e, 0); 2056 m = numToString() + repeat.call(ZERO, f); 2057 } 2058 } 2059 if (f > 0) { 2060 k = m.length; 2061 m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); 2062 } else { 2063 m = s + m; 2064 } return m; 2065 } 2066 }); 2067 2068 2069/***/ }), 2070/* 90 */ 2071/***/ (function(module, exports, __webpack_require__) { 2072 2073 var cof = __webpack_require__(35); 2074 module.exports = function (it, msg) { 2075 if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); 2076 return +it; 2077 }; 2078 2079 2080/***/ }), 2081/* 91 */ 2082/***/ (function(module, exports, __webpack_require__) { 2083 2084 'use strict'; 2085 var toInteger = __webpack_require__(39); 2086 var defined = __webpack_require__(36); 2087 2088 module.exports = function repeat(count) { 2089 var str = String(defined(this)); 2090 var res = ''; 2091 var n = toInteger(count); 2092 if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); 2093 for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; 2094 return res; 2095 }; 2096 2097 2098/***/ }), 2099/* 92 */ 2100/***/ (function(module, exports, __webpack_require__) { 2101 2102 'use strict'; 2103 var $export = __webpack_require__(8); 2104 var $fails = __webpack_require__(7); 2105 var aNumberValue = __webpack_require__(90); 2106 var $toPrecision = 1.0.toPrecision; 2107 2108 $export($export.P + $export.F * ($fails(function () { 2109 // IE7- 2110 return $toPrecision.call(1, undefined) !== '1'; 2111 }) || !$fails(function () { 2112 // V8 ~ Android 4.3- 2113 $toPrecision.call({}); 2114 })), 'Number', { 2115 toPrecision: function toPrecision(precision) { 2116 var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); 2117 return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); 2118 } 2119 }); 2120 2121 2122/***/ }), 2123/* 93 */ 2124/***/ (function(module, exports, __webpack_require__) { 2125 2126 // 20.1.2.1 Number.EPSILON 2127 var $export = __webpack_require__(8); 2128 2129 $export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); 2130 2131 2132/***/ }), 2133/* 94 */ 2134/***/ (function(module, exports, __webpack_require__) { 2135 2136 // 20.1.2.2 Number.isFinite(number) 2137 var $export = __webpack_require__(8); 2138 var _isFinite = __webpack_require__(4).isFinite; 2139 2140 $export($export.S, 'Number', { 2141 isFinite: function isFinite(it) { 2142 return typeof it == 'number' && _isFinite(it); 2143 } 2144 }); 2145 2146 2147/***/ }), 2148/* 95 */ 2149/***/ (function(module, exports, __webpack_require__) { 2150 2151 // 20.1.2.3 Number.isInteger(number) 2152 var $export = __webpack_require__(8); 2153 2154 $export($export.S, 'Number', { isInteger: __webpack_require__(96) }); 2155 2156 2157/***/ }), 2158/* 96 */ 2159/***/ (function(module, exports, __webpack_require__) { 2160 2161 // 20.1.2.3 Number.isInteger(number) 2162 var isObject = __webpack_require__(13); 2163 var floor = Math.floor; 2164 module.exports = function isInteger(it) { 2165 return !isObject(it) && isFinite(it) && floor(it) === it; 2166 }; 2167 2168 2169/***/ }), 2170/* 97 */ 2171/***/ (function(module, exports, __webpack_require__) { 2172 2173 // 20.1.2.4 Number.isNaN(number) 2174 var $export = __webpack_require__(8); 2175 2176 $export($export.S, 'Number', { 2177 isNaN: function isNaN(number) { 2178 // eslint-disable-next-line no-self-compare 2179 return number != number; 2180 } 2181 }); 2182 2183 2184/***/ }), 2185/* 98 */ 2186/***/ (function(module, exports, __webpack_require__) { 2187 2188 // 20.1.2.5 Number.isSafeInteger(number) 2189 var $export = __webpack_require__(8); 2190 var isInteger = __webpack_require__(96); 2191 var abs = Math.abs; 2192 2193 $export($export.S, 'Number', { 2194 isSafeInteger: function isSafeInteger(number) { 2195 return isInteger(number) && abs(number) <= 0x1fffffffffffff; 2196 } 2197 }); 2198 2199 2200/***/ }), 2201/* 99 */ 2202/***/ (function(module, exports, __webpack_require__) { 2203 2204 // 20.1.2.6 Number.MAX_SAFE_INTEGER 2205 var $export = __webpack_require__(8); 2206 2207 $export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); 2208 2209 2210/***/ }), 2211/* 100 */ 2212/***/ (function(module, exports, __webpack_require__) { 2213 2214 // 20.1.2.10 Number.MIN_SAFE_INTEGER 2215 var $export = __webpack_require__(8); 2216 2217 $export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); 2218 2219 2220/***/ }), 2221/* 101 */ 2222/***/ (function(module, exports, __webpack_require__) { 2223 2224 var $export = __webpack_require__(8); 2225 var $parseFloat = __webpack_require__(86); 2226 // 20.1.2.12 Number.parseFloat(string) 2227 $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat }); 2228 2229 2230/***/ }), 2231/* 102 */ 2232/***/ (function(module, exports, __webpack_require__) { 2233 2234 var $export = __webpack_require__(8); 2235 var $parseInt = __webpack_require__(82); 2236 // 20.1.2.13 Number.parseInt(string, radix) 2237 $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt }); 2238 2239 2240/***/ }), 2241/* 103 */ 2242/***/ (function(module, exports, __webpack_require__) { 2243 2244 // 20.2.2.3 Math.acosh(x) 2245 var $export = __webpack_require__(8); 2246 var log1p = __webpack_require__(104); 2247 var sqrt = Math.sqrt; 2248 var $acosh = Math.acosh; 2249 2250 $export($export.S + $export.F * !($acosh 2251 // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 2252 && Math.floor($acosh(Number.MAX_VALUE)) == 710 2253 // Tor Browser bug: Math.acosh(Infinity) -> NaN 2254 && $acosh(Infinity) == Infinity 2255 ), 'Math', { 2256 acosh: function acosh(x) { 2257 return (x = +x) < 1 ? NaN : x > 94906265.62425156 2258 ? Math.log(x) + Math.LN2 2259 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); 2260 } 2261 }); 2262 2263 2264/***/ }), 2265/* 104 */ 2266/***/ (function(module, exports) { 2267 2268 // 20.2.2.20 Math.log1p(x) 2269 module.exports = Math.log1p || function log1p(x) { 2270 return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); 2271 }; 2272 2273 2274/***/ }), 2275/* 105 */ 2276/***/ (function(module, exports, __webpack_require__) { 2277 2278 // 20.2.2.5 Math.asinh(x) 2279 var $export = __webpack_require__(8); 2280 var $asinh = Math.asinh; 2281 2282 function asinh(x) { 2283 return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); 2284 } 2285 2286 // Tor Browser bug: Math.asinh(0) -> -0 2287 $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh }); 2288 2289 2290/***/ }), 2291/* 106 */ 2292/***/ (function(module, exports, __webpack_require__) { 2293 2294 // 20.2.2.7 Math.atanh(x) 2295 var $export = __webpack_require__(8); 2296 var $atanh = Math.atanh; 2297 2298 // Tor Browser bug: Math.atanh(-0) -> 0 2299 $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { 2300 atanh: function atanh(x) { 2301 return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; 2302 } 2303 }); 2304 2305 2306/***/ }), 2307/* 107 */ 2308/***/ (function(module, exports, __webpack_require__) { 2309 2310 // 20.2.2.9 Math.cbrt(x) 2311 var $export = __webpack_require__(8); 2312 var sign = __webpack_require__(108); 2313 2314 $export($export.S, 'Math', { 2315 cbrt: function cbrt(x) { 2316 return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); 2317 } 2318 }); 2319 2320 2321/***/ }), 2322/* 108 */ 2323/***/ (function(module, exports) { 2324 2325 // 20.2.2.28 Math.sign(x) 2326 module.exports = Math.sign || function sign(x) { 2327 // eslint-disable-next-line no-self-compare 2328 return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; 2329 }; 2330 2331 2332/***/ }), 2333/* 109 */ 2334/***/ (function(module, exports, __webpack_require__) { 2335 2336 // 20.2.2.11 Math.clz32(x) 2337 var $export = __webpack_require__(8); 2338 2339 $export($export.S, 'Math', { 2340 clz32: function clz32(x) { 2341 return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; 2342 } 2343 }); 2344 2345 2346/***/ }), 2347/* 110 */ 2348/***/ (function(module, exports, __webpack_require__) { 2349 2350 // 20.2.2.12 Math.cosh(x) 2351 var $export = __webpack_require__(8); 2352 var exp = Math.exp; 2353 2354 $export($export.S, 'Math', { 2355 cosh: function cosh(x) { 2356 return (exp(x = +x) + exp(-x)) / 2; 2357 } 2358 }); 2359 2360 2361/***/ }), 2362/* 111 */ 2363/***/ (function(module, exports, __webpack_require__) { 2364 2365 // 20.2.2.14 Math.expm1(x) 2366 var $export = __webpack_require__(8); 2367 var $expm1 = __webpack_require__(112); 2368 2369 $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); 2370 2371 2372/***/ }), 2373/* 112 */ 2374/***/ (function(module, exports) { 2375 2376 // 20.2.2.14 Math.expm1(x) 2377 var $expm1 = Math.expm1; 2378 module.exports = (!$expm1 2379 // Old FF bug 2380 || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 2381 // Tor Browser bug 2382 || $expm1(-2e-17) != -2e-17 2383 ) ? function expm1(x) { 2384 return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; 2385 } : $expm1; 2386 2387 2388/***/ }), 2389/* 113 */ 2390/***/ (function(module, exports, __webpack_require__) { 2391 2392 // 20.2.2.16 Math.fround(x) 2393 var $export = __webpack_require__(8); 2394 2395 $export($export.S, 'Math', { fround: __webpack_require__(114) }); 2396 2397 2398/***/ }), 2399/* 114 */ 2400/***/ (function(module, exports, __webpack_require__) { 2401 2402 // 20.2.2.16 Math.fround(x) 2403 var sign = __webpack_require__(108); 2404 var pow = Math.pow; 2405 var EPSILON = pow(2, -52); 2406 var EPSILON32 = pow(2, -23); 2407 var MAX32 = pow(2, 127) * (2 - EPSILON32); 2408 var MIN32 = pow(2, -126); 2409 2410 var roundTiesToEven = function (n) { 2411 return n + 1 / EPSILON - 1 / EPSILON; 2412 }; 2413 2414 module.exports = Math.fround || function fround(x) { 2415 var $abs = Math.abs(x); 2416 var $sign = sign(x); 2417 var a, result; 2418 if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; 2419 a = (1 + EPSILON32 / EPSILON) * $abs; 2420 result = a - (a - $abs); 2421 // eslint-disable-next-line no-self-compare 2422 if (result > MAX32 || result != result) return $sign * Infinity; 2423 return $sign * result; 2424 }; 2425 2426 2427/***/ }), 2428/* 115 */ 2429/***/ (function(module, exports, __webpack_require__) { 2430 2431 // 20.2.2.17 Math.hypot([value1[, value2[, ⦠]]]) 2432 var $export = __webpack_require__(8); 2433 var abs = Math.abs; 2434 2435 $export($export.S, 'Math', { 2436 hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars 2437 var sum = 0; 2438 var i = 0; 2439 var aLen = arguments.length; 2440 var larg = 0; 2441 var arg, div; 2442 while (i < aLen) { 2443 arg = abs(arguments[i++]); 2444 if (larg < arg) { 2445 div = larg / arg; 2446 sum = sum * div * div + 1; 2447 larg = arg; 2448 } else if (arg > 0) { 2449 div = arg / larg; 2450 sum += div * div; 2451 } else sum += arg; 2452 } 2453 return larg === Infinity ? Infinity : larg * Math.sqrt(sum); 2454 } 2455 }); 2456 2457 2458/***/ }), 2459/* 116 */ 2460/***/ (function(module, exports, __webpack_require__) { 2461 2462 // 20.2.2.18 Math.imul(x, y) 2463 var $export = __webpack_require__(8); 2464 var $imul = Math.imul; 2465 2466 // some WebKit versions fails with big numbers, some has wrong arity 2467 $export($export.S + $export.F * __webpack_require__(7)(function () { 2468 return $imul(0xffffffff, 5) != -5 || $imul.length != 2; 2469 }), 'Math', { 2470 imul: function imul(x, y) { 2471 var UINT16 = 0xffff; 2472 var xn = +x; 2473 var yn = +y; 2474 var xl = UINT16 & xn; 2475 var yl = UINT16 & yn; 2476 return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); 2477 } 2478 }); 2479 2480 2481/***/ }), 2482/* 117 */ 2483/***/ (function(module, exports, __webpack_require__) { 2484 2485 // 20.2.2.21 Math.log10(x) 2486 var $export = __webpack_require__(8); 2487 2488 $export($export.S, 'Math', { 2489 log10: function log10(x) { 2490 return Math.log(x) * Math.LOG10E; 2491 } 2492 }); 2493 2494 2495/***/ }), 2496/* 118 */ 2497/***/ (function(module, exports, __webpack_require__) { 2498 2499 // 20.2.2.20 Math.log1p(x) 2500 var $export = __webpack_require__(8); 2501 2502 $export($export.S, 'Math', { log1p: __webpack_require__(104) }); 2503 2504 2505/***/ }), 2506/* 119 */ 2507/***/ (function(module, exports, __webpack_require__) { 2508 2509 // 20.2.2.22 Math.log2(x) 2510 var $export = __webpack_require__(8); 2511 2512 $export($export.S, 'Math', { 2513 log2: function log2(x) { 2514 return Math.log(x) / Math.LN2; 2515 } 2516 }); 2517 2518 2519/***/ }), 2520/* 120 */ 2521/***/ (function(module, exports, __webpack_require__) { 2522 2523 // 20.2.2.28 Math.sign(x) 2524 var $export = __webpack_require__(8); 2525 2526 $export($export.S, 'Math', { sign: __webpack_require__(108) }); 2527 2528 2529/***/ }), 2530/* 121 */ 2531/***/ (function(module, exports, __webpack_require__) { 2532 2533 // 20.2.2.30 Math.sinh(x) 2534 var $export = __webpack_require__(8); 2535 var expm1 = __webpack_require__(112); 2536 var exp = Math.exp; 2537 2538 // V8 near Chromium 38 has a problem with very small numbers 2539 $export($export.S + $export.F * __webpack_require__(7)(function () { 2540 return !Math.sinh(-2e-17) != -2e-17; 2541 }), 'Math', { 2542 sinh: function sinh(x) { 2543 return Math.abs(x = +x) < 1 2544 ? (expm1(x) - expm1(-x)) / 2 2545 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); 2546 } 2547 }); 2548 2549 2550/***/ }), 2551/* 122 */ 2552/***/ (function(module, exports, __webpack_require__) { 2553 2554 // 20.2.2.33 Math.tanh(x) 2555 var $export = __webpack_require__(8); 2556 var expm1 = __webpack_require__(112); 2557 var exp = Math.exp; 2558 2559 $export($export.S, 'Math', { 2560 tanh: function tanh(x) { 2561 var a = expm1(x = +x); 2562 var b = expm1(-x); 2563 return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); 2564 } 2565 }); 2566 2567 2568/***/ }), 2569/* 123 */ 2570/***/ (function(module, exports, __webpack_require__) { 2571 2572 // 20.2.2.34 Math.trunc(x) 2573 var $export = __webpack_require__(8); 2574 2575 $export($export.S, 'Math', { 2576 trunc: function trunc(it) { 2577 return (it > 0 ? Math.floor : Math.ceil)(it); 2578 } 2579 }); 2580 2581 2582/***/ }), 2583/* 124 */ 2584/***/ (function(module, exports, __webpack_require__) { 2585 2586 var $export = __webpack_require__(8); 2587 var toAbsoluteIndex = __webpack_require__(40); 2588 var fromCharCode = String.fromCharCode; 2589 var $fromCodePoint = String.fromCodePoint; 2590 2591 // length should be 1, old FF problem 2592 $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { 2593 // 21.1.2.2 String.fromCodePoint(...codePoints) 2594 fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars 2595 var res = []; 2596 var aLen = arguments.length; 2597 var i = 0; 2598 var code; 2599 while (aLen > i) { 2600 code = +arguments[i++]; 2601 if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); 2602 res.push(code < 0x10000 2603 ? fromCharCode(code) 2604 : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) 2605 ); 2606 } return res.join(''); 2607 } 2608 }); 2609 2610 2611/***/ }), 2612/* 125 */ 2613/***/ (function(module, exports, __webpack_require__) { 2614 2615 var $export = __webpack_require__(8); 2616 var toIObject = __webpack_require__(33); 2617 var toLength = __webpack_require__(38); 2618 2619 $export($export.S, 'String', { 2620 // 21.1.2.4 String.raw(callSite, ...substitutions) 2621 raw: function raw(callSite) { 2622 var tpl = toIObject(callSite.raw); 2623 var len = toLength(tpl.length); 2624 var aLen = arguments.length; 2625 var res = []; 2626 var i = 0; 2627 while (len > i) { 2628 res.push(String(tpl[i++])); 2629 if (i < aLen) res.push(String(arguments[i])); 2630 } return res.join(''); 2631 } 2632 }); 2633 2634 2635/***/ }), 2636/* 126 */ 2637/***/ (function(module, exports, __webpack_require__) { 2638 2639 'use strict'; 2640 // 21.1.3.25 String.prototype.trim() 2641 __webpack_require__(83)('trim', function ($trim) { 2642 return function trim() { 2643 return $trim(this, 3); 2644 }; 2645 }); 2646 2647 2648/***/ }), 2649/* 127 */ 2650/***/ (function(module, exports, __webpack_require__) { 2651 2652 'use strict'; 2653 var $at = __webpack_require__(128)(true); 2654 2655 // 21.1.3.27 String.prototype[@@iterator]() 2656 __webpack_require__(129)(String, 'String', function (iterated) { 2657 this._t = String(iterated); // target 2658 this._i = 0; // next index 2659 // 21.1.5.2.1 %StringIteratorPrototype%.next() 2660 }, function () { 2661 var O = this._t; 2662 var index = this._i; 2663 var point; 2664 if (index >= O.length) return { value: undefined, done: true }; 2665 point = $at(O, index); 2666 this._i += point.length; 2667 return { value: point, done: false }; 2668 }); 2669 2670 2671/***/ }), 2672/* 128 */ 2673/***/ (function(module, exports, __webpack_require__) { 2674 2675 var toInteger = __webpack_require__(39); 2676 var defined = __webpack_require__(36); 2677 // true -> String#at 2678 // false ->
vendor: 1,842 bytes, lines 2678-2727
2678 String#codePointAt 2679 module.exports = function (TO_STRING) { 2680 return function (that, pos) { 2681 var s = String(defined(that)); 2682 var i = toInteger(pos); 2683 var l = s.length; 2684 var a, b; 2685 if (i < 0 || i >= l) return TO_STRING ? '' : undefined; 2686 a = s.charCodeAt(i); 2687 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff 2688 ? TO_STRING ? s.charAt(i) : a 2689 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; 2690 }; 2691 }; 2692 2693 2694/***/ }), 2695/* 129 */ 2696/***/ (function(module, exports, __webpack_require__) { 2697 2698 'use strict'; 2699 var LIBRARY = __webpack_require__(22); 2700 var $export = __webpack_require__(8); 2701 var redefine = __webpack_require__(18); 2702 var hide = __webpack_require__(10); 2703 var Iterators = __webpack_require__(130); 2704 var $iterCreate = __webpack_require__(131); 2705 var setToStringTag = __webpack_require__(26); 2706 var getPrototypeOf = __webpack_require__(59); 2707 var ITERATOR = __webpack_require__(27)('iterator'); 2708 var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` 2709 var FF_ITERATOR = '@@iterator'; 2710 var KEYS = 'keys'; 2711 var VALUES = 'values'; 2712 2713 var returnThis = function () { return this; }; 2714 2715 module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { 2716 $iterCreate(Constructor, NAME, next); 2717 var getMethod = function (kind) { 2718 if (!BUGGY && kind in proto) return proto[kind]; 2719 switch (kind) { 2720 case KEYS: return function keys() { return new Constructor(this, kind); }; 2721 case VALUES: return function values() { return new Constructor(this, kind); }; 2722 } return function entries() { return new Constructor(this, kind); }; 2723 }; 2724 var TAG = NAME + ' Iterator'; 2725 var DEF_VALUES = DEFAULT == VALUES; 2726 var VALUES_BUG = false; 2727 var proto = Base.prototype;
vendor: 69,484 bytes, lines 2728-4953
2728 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; 2729 var $default = $native || getMethod(DEFAULT); 2730 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; 2731 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; 2732 var methods, key, IteratorPrototype; 2733 // Fix native 2734 if ($anyNative) { 2735 IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); 2736 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { 2737 // Set @@toStringTag to native iterators 2738 setToStringTag(IteratorPrototype, TAG, true); 2739 // fix for some old engines 2740 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); 2741 } 2742 } 2743 // fix Array#{values, @@iterator}.name in V8 / FF 2744 if (DEF_VALUES && $native && $native.name !== VALUES) { 2745 VALUES_BUG = true; 2746 $default = function values() { return $native.call(this); }; 2747 } 2748 // Define iterator 2749 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { 2750 hide(proto, ITERATOR, $default); 2751 } 2752 // Plug for library 2753 Iterators[NAME] = $default; 2754 Iterators[TAG] = returnThis; 2755 if (DEFAULT) { 2756 methods = { 2757 values: DEF_VALUES ? $default : getMethod(VALUES), 2758 keys: IS_SET ? $default : getMethod(KEYS), 2759 entries: $entries 2760 }; 2761 if (FORCED) for (key in methods) { 2762 if (!(key in proto)) redefine(proto, key, methods[key]); 2763 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); 2764 } 2765 return methods; 2766 }; 2767 2768 2769/***/ }), 2770/* 130 */ 2771/***/ (function(module, exports) { 2772 2773 module.exports = {}; 2774 2775 2776/***/ }), 2777/* 131 */ 2778/***/ (function(module, exports, __webpack_require__) { 2779 2780 'use strict'; 2781 var create = __webpack_require__(47); 2782 var descriptor = __webpack_require__(17); 2783 var setToStringTag = __webpack_require__(26); 2784 var IteratorPrototype = {}; 2785 2786 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() 2787 __webpack_require__(10)(IteratorPrototype, __webpack_require__(27)('iterator'), function () { return this; }); 2788 2789 module.exports = function (Constructor, NAME, next) { 2790 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); 2791 setToStringTag(Constructor, NAME + ' Iterator'); 2792 }; 2793 2794 2795/***/ }), 2796/* 132 */ 2797/***/ (function(module, exports, __webpack_require__) { 2798 2799 'use strict'; 2800 var $export = __webpack_require__(8); 2801 var $at = __webpack_require__(128)(false); 2802 $export($export.P, 'String', { 2803 // 21.1.3.3 String.prototype.codePointAt(pos) 2804 codePointAt: function codePointAt(pos) { 2805 return $at(this, pos); 2806 } 2807 }); 2808 2809 2810/***/ }), 2811/* 133 */ 2812/***/ (function(module, exports, __webpack_require__) { 2813 2814 // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) 2815 'use strict'; 2816 var $export = __webpack_require__(8); 2817 var toLength = __webpack_require__(38); 2818 var context = __webpack_require__(134); 2819 var ENDS_WITH = 'endsWith'; 2820 var $endsWith = ''[ENDS_WITH]; 2821 2822 $export($export.P + $export.F * __webpack_require__(136)(ENDS_WITH), 'String', { 2823 endsWith: function endsWith(searchString /* , endPosition = @length */) { 2824 var that = context(this, searchString, ENDS_WITH); 2825 var endPosition = arguments.length > 1 ? arguments[1] : undefined; 2826 var len = toLength(that.length); 2827 var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); 2828 var search = String(searchString); 2829 return $endsWith 2830 ? $endsWith.call(that, search, end) 2831 : that.slice(end - search.length, end) === search; 2832 } 2833 }); 2834 2835 2836/***/ }), 2837/* 134 */ 2838/***/ (function(module, exports, __webpack_require__) { 2839 2840 // helper for String#{startsWith, endsWith, includes} 2841 var isRegExp = __webpack_require__(135); 2842 var defined = __webpack_require__(36); 2843 2844 module.exports = function (that, searchString, NAME) { 2845 if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); 2846 return String(defined(that)); 2847 }; 2848 2849 2850/***/ }), 2851/* 135 */ 2852/***/ (function(module, exports, __webpack_require__) { 2853 2854 // 7.2.8 IsRegExp(argument) 2855 var isObject = __webpack_require__(13); 2856 var cof = __webpack_require__(35); 2857 var MATCH = __webpack_require__(27)('match'); 2858 module.exports = function (it) { 2859 var isRegExp; 2860 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); 2861 }; 2862 2863 2864/***/ }), 2865/* 136 */ 2866/***/ (function(module, exports, __webpack_require__) { 2867 2868 var MATCH = __webpack_require__(27)('match'); 2869 module.exports = function (KEY) { 2870 var re = /./; 2871 try { 2872 '/./'[KEY](re); 2873 } catch (e) { 2874 try { 2875 re[MATCH] = false; 2876 return !'/./'[KEY](re); 2877 } catch (f) { /* empty */ } 2878 } return true; 2879 }; 2880 2881 2882/***/ }), 2883/* 137 */ 2884/***/ (function(module, exports, __webpack_require__) { 2885 2886 // 21.1.3.7 String.prototype.includes(searchString, position = 0) 2887 'use strict'; 2888 var $export = __webpack_require__(8); 2889 var context = __webpack_require__(134); 2890 var INCLUDES = 'includes'; 2891 2892 $export($export.P + $export.F * __webpack_require__(136)(INCLUDES), 'String', { 2893 includes: function includes(searchString /* , position = 0 */) { 2894 return !!~context(this, searchString, INCLUDES) 2895 .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); 2896 } 2897 }); 2898 2899 2900/***/ }), 2901/* 138 */ 2902/***/ (function(module, exports, __webpack_require__) { 2903 2904 var $export = __webpack_require__(8); 2905 2906 $export($export.P, 'String', { 2907 // 21.1.3.13 String.prototype.repeat(count) 2908 repeat: __webpack_require__(91) 2909 }); 2910 2911 2912/***/ }), 2913/* 139 */ 2914/***/ (function(module, exports, __webpack_require__) { 2915 2916 // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) 2917 'use strict'; 2918 var $export = __webpack_require__(8); 2919 var toLength = __webpack_require__(38); 2920 var context = __webpack_require__(134); 2921 var STARTS_WITH = 'startsWith'; 2922 var $startsWith = ''[STARTS_WITH]; 2923 2924 $export($export.P + $export.F * __webpack_require__(136)(STARTS_WITH), 'String', { 2925 startsWith: function startsWith(searchString /* , position = 0 */) { 2926 var that = context(this, searchString, STARTS_WITH); 2927 var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); 2928 var search = String(searchString); 2929 return $startsWith 2930 ? $startsWith.call(that, search, index) 2931 : that.slice(index, index + search.length) === search; 2932 } 2933 }); 2934 2935 2936/***/ }), 2937/* 140 */ 2938/***/ (function(module, exports, __webpack_require__) { 2939 2940 'use strict'; 2941 // B.2.3.2 String.prototype.anchor(name) 2942 __webpack_require__(141)('anchor', function (createHTML) { 2943 return function anchor(name) { 2944 return createHTML(this, 'a', 'name', name); 2945 }; 2946 }); 2947 2948 2949/***/ }), 2950/* 141 */ 2951/***/ (function(module, exports, __webpack_require__) { 2952 2953 var $export = __webpack_require__(8); 2954 var fails = __webpack_require__(7); 2955 var defined = __webpack_require__(36); 2956 var quot = /"/g; 2957 // B.2.3.2.1 CreateHTML(string, tag, attribute, value) 2958 var createHTML = function (string, tag, attribute, value) { 2959 var S = String(defined(string)); 2960 var p1 = '<' + tag; 2961 if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; 2962 return p1 + '>' + S + '</' + tag + '>'; 2963 }; 2964 module.exports = function (NAME, exec) { 2965 var O = {}; 2966 O[NAME] = exec(createHTML); 2967 $export($export.P + $export.F * fails(function () { 2968 var test = ''[NAME]('"'); 2969 return test !== test.toLowerCase() || test.split('"').length > 3; 2970 }), 'String', O); 2971 }; 2972 2973 2974/***/ }), 2975/* 142 */ 2976/***/ (function(module, exports, __webpack_require__) { 2977 2978 'use strict'; 2979 // B.2.3.3 String.prototype.big() 2980 __webpack_require__(141)('big', function (createHTML) { 2981 return function big() { 2982 return createHTML(this, 'big', '', ''); 2983 }; 2984 }); 2985 2986 2987/***/ }), 2988/* 143 */ 2989/***/ (function(module, exports, __webpack_require__) { 2990 2991 'use strict'; 2992 // B.2.3.4 String.prototype.blink() 2993 __webpack_require__(141)('blink', function (createHTML) { 2994 return function blink() { 2995 return createHTML(this, 'blink', '', ''); 2996 }; 2997 }); 2998 2999 3000/***/ }), 3001/* 144 */ 3002/***/ (function(module, exports, __webpack_require__) { 3003 3004 'use strict'; 3005 // B.2.3.5 String.prototype.bold() 3006 __webpack_require__(141)('bold', function (createHTML) { 3007 return function bold() { 3008 return createHTML(this, 'b', '', ''); 3009 }; 3010 }); 3011 3012 3013/***/ }), 3014/* 145 */ 3015/***/ (function(module, exports, __webpack_require__) { 3016 3017 'use strict'; 3018 // B.2.3.6 String.prototype.fixed() 3019 __webpack_require__(141)('fixed', function (createHTML) { 3020 return function fixed() { 3021 return createHTML(this, 'tt', '', ''); 3022 }; 3023 }); 3024 3025 3026/***/ }), 3027/* 146 */ 3028/***/ (function(module, exports, __webpack_require__) { 3029 3030 'use strict'; 3031 // B.2.3.7 String.prototype.fontcolor(color) 3032 __webpack_require__(141)('fontcolor', function (createHTML) { 3033 return function fontcolor(color) { 3034 return createHTML(this, 'font', 'color', color); 3035 }; 3036 }); 3037 3038 3039/***/ }), 3040/* 147 */ 3041/***/ (function(module, exports, __webpack_require__) { 3042 3043 'use strict'; 3044 // B.2.3.8 String.prototype.fontsize(size) 3045 __webpack_require__(141)('fontsize', function (createHTML) { 3046 return function fontsize(size) { 3047 return createHTML(this, 'font', 'size', size); 3048 }; 3049 }); 3050 3051 3052/***/ }), 3053/* 148 */ 3054/***/ (function(module, exports, __webpack_require__) { 3055 3056 'use strict'; 3057 // B.2.3.9 String.prototype.italics() 3058 __webpack_require__(141)('italics', function (createHTML) { 3059 return function italics() { 3060 return createHTML(this, 'i', '', ''); 3061 }; 3062 }); 3063 3064 3065/***/ }), 3066/* 149 */ 3067/***/ (function(module, exports, __webpack_require__) { 3068 3069 'use strict'; 3070 // B.2.3.10 String.prototype.link(url) 3071 __webpack_require__(141)('link', function (createHTML) { 3072 return function link(url) { 3073 return createHTML(this, 'a', 'href', url); 3074 }; 3075 }); 3076 3077 3078/***/ }), 3079/* 150 */ 3080/***/ (function(module, exports, __webpack_require__) { 3081 3082 'use strict'; 3083 // B.2.3.11 String.prototype.small() 3084 __webpack_require__(141)('small', function (createHTML) { 3085 return function small() { 3086 return createHTML(this, 'small', '', ''); 3087 }; 3088 }); 3089 3090 3091/***/ }), 3092/* 151 */ 3093/***/ (function(module, exports, __webpack_require__) { 3094 3095 'use strict'; 3096 // B.2.3.12 String.prototype.strike() 3097 __webpack_require__(141)('strike', function (createHTML) { 3098 return function strike() { 3099 return createHTML(this, 'strike', '', ''); 3100 }; 3101 }); 3102 3103 3104/***/ }), 3105/* 152 */ 3106/***/ (function(module, exports, __webpack_require__) { 3107 3108 'use strict'; 3109 // B.2.3.13 String.prototype.sub() 3110 __webpack_require__(141)('sub', function (createHTML) { 3111 return function sub() { 3112 return createHTML(this, 'sub', '', ''); 3113 }; 3114 }); 3115 3116 3117/***/ }), 3118/* 153 */ 3119/***/ (function(module, exports, __webpack_require__) { 3120 3121 'use strict'; 3122 // B.2.3.14 String.prototype.sup() 3123 __webpack_require__(141)('sup', function (createHTML) { 3124 return function sup() { 3125 return createHTML(this, 'sup', '', ''); 3126 }; 3127 }); 3128 3129 3130/***/ }), 3131/* 154 */ 3132/***/ (function(module, exports, __webpack_require__) { 3133 3134 // 20.3.3.1 / 15.9.4.4 Date.now() 3135 var $export = __webpack_require__(8); 3136 3137 $export($export.S, 'Date', { now: function () { return new Date().getTime(); } }); 3138 3139 3140/***/ }), 3141/* 155 */ 3142/***/ (function(module, exports, __webpack_require__) { 3143 3144 'use strict'; 3145 var $export = __webpack_require__(8); 3146 var toObject = __webpack_require__(46); 3147 var toPrimitive = __webpack_require__(16); 3148 3149 $export($export.P + $export.F * __webpack_require__(7)(function () { 3150 return new Date(NaN).toJSON() !== null 3151 || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; 3152 }), 'Date', { 3153 // eslint-disable-next-line no-unused-vars 3154 toJSON: function toJSON(key) { 3155 var O = toObject(this); 3156 var pv = toPrimitive(O); 3157 return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); 3158 } 3159 }); 3160 3161 3162/***/ }), 3163/* 156 */ 3164/***/ (function(module, exports, __webpack_require__) { 3165 3166 // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() 3167 var $export = __webpack_require__(8); 3168 var toISOString = __webpack_require__(157); 3169 3170 // PhantomJS / old WebKit has a broken implementations 3171 $export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { 3172 toISOString: toISOString 3173 }); 3174 3175 3176/***/ }), 3177/* 157 */ 3178/***/ (function(module, exports, __webpack_require__) { 3179 3180 'use strict'; 3181 // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() 3182 var fails = __webpack_require__(7); 3183 var getTime = Date.prototype.getTime; 3184 var $toISOString = Date.prototype.toISOString; 3185 3186 var lz = function (num) { 3187 return num > 9 ? num : '0' + num; 3188 }; 3189 3190 // PhantomJS / old WebKit has a broken implementations 3191 module.exports = (fails(function () { 3192 return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; 3193 }) || !fails(function () { 3194 $toISOString.call(new Date(NaN)); 3195 })) ? function toISOString() { 3196 if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); 3197 var d = this; 3198 var y = d.getUTCFullYear(); 3199 var m = d.getUTCMilliseconds(); 3200 var s = y < 0 ? '-' : y > 9999 ? '+' : ''; 3201 return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + 3202 '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 3203 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + 3204 ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; 3205 } : $toISOString; 3206 3207 3208/***/ }), 3209/* 158 */ 3210/***/ (function(module, exports, __webpack_require__) { 3211 3212 var DateProto = Date.prototype; 3213 var INVALID_DATE = 'Invalid Date'; 3214 var TO_STRING = 'toString'; 3215 var $toString = DateProto[TO_STRING]; 3216 var getTime = DateProto.getTime; 3217 if (new Date(NaN) + '' != INVALID_DATE) { 3218 __webpack_require__(18)(DateProto, TO_STRING, function toString() { 3219 var value = getTime.call(this); 3220 // eslint-disable-next-line no-self-compare 3221 return value === value ? $toString.call(this) : INVALID_DATE; 3222 }); 3223 } 3224 3225 3226/***/ }), 3227/* 159 */ 3228/***/ (function(module, exports, __webpack_require__) { 3229 3230 var TO_PRIMITIVE = __webpack_require__(27)('toPrimitive'); 3231 var proto = Date.prototype; 3232 3233 if (!(TO_PRIMITIVE in proto)) __webpack_require__(10)(proto, TO_PRIMITIVE, __webpack_require__(160)); 3234 3235 3236/***/ }), 3237/* 160 */ 3238/***/ (function(module, exports, __webpack_require__) { 3239 3240 'use strict'; 3241 var anObject = __webpack_require__(12); 3242 var toPrimitive = __webpack_require__(16); 3243 var NUMBER = 'number'; 3244 3245 module.exports = function (hint) { 3246 if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint'); 3247 return toPrimitive(anObject(this), hint != NUMBER); 3248 }; 3249 3250 3251/***/ }), 3252/* 161 */ 3253/***/ (function(module, exports, __webpack_require__) { 3254 3255 // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) 3256 var $export = __webpack_require__(8); 3257 3258 $export($export.S, 'Array', { isArray: __webpack_require__(45) }); 3259 3260 3261/***/ }), 3262/* 162 */ 3263/***/ (function(module, exports, __webpack_require__) { 3264 3265 'use strict'; 3266 var ctx = __webpack_require__(23); 3267 var $export = __webpack_require__(8); 3268 var toObject = __webpack_require__(46); 3269 var call = __webpack_require__(163); 3270 var isArrayIter = __webpack_require__(164); 3271 var toLength = __webpack_require__(38); 3272 var createProperty = __webpack_require__(165); 3273 var getIterFn = __webpack_require__(166); 3274 3275 $export($export.S + $export.F * !__webpack_require__(167)(function (iter) { Array.from(iter); }), 'Array', { 3276 // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) 3277 from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { 3278 var O = toObject(arrayLike); 3279 var C = typeof this == 'function' ? this : Array; 3280 var aLen = arguments.length; 3281 var mapfn = aLen > 1 ? arguments[1] : undefined; 3282 var mapping = mapfn !== undefined; 3283 var index = 0; 3284 var iterFn = getIterFn(O); 3285 var length, result, step, iterator; 3286 if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); 3287 // if object isn't iterable or it's array with default iterator - use simple case 3288 if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { 3289 for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { 3290 createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); 3291 } 3292 } else { 3293 length = toLength(O.length); 3294 for (result = new C(length); length > index; index++) { 3295 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); 3296 } 3297 } 3298 result.length = index; 3299 return result; 3300 } 3301 }); 3302 3303 3304/***/ }), 3305/* 163 */ 3306/***/ (function(module, exports, __webpack_require__) { 3307 3308 // call something on iterator step with safe closing on error 3309 var anObject = __webpack_require__(12); 3310 module.exports = function (iterator, fn, value, entries) { 3311 try { 3312 return entries ? fn(anObject(value)[0], value[1]) : fn(value); 3313 // 7.4.6 IteratorClose(iterator, completion) 3314 } catch (e) { 3315 var ret = iterator['return']; 3316 if (ret !== undefined) anObject(ret.call(iterator)); 3317 throw e; 3318 } 3319 }; 3320 3321 3322/***/ }), 3323/* 164 */ 3324/***/ (function(module, exports, __webpack_require__) { 3325 3326 // check on default Array iterator 3327 var Iterators = __webpack_require__(130); 3328 var ITERATOR = __webpack_require__(27)('iterator'); 3329 var ArrayProto = Array.prototype; 3330 3331 module.exports = function (it) { 3332 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); 3333 }; 3334 3335 3336/***/ }), 3337/* 165 */ 3338/***/ (function(module, exports, __webpack_require__) { 3339 3340 'use strict'; 3341 var $defineProperty = __webpack_require__(11); 3342 var createDesc = __webpack_require__(17); 3343 3344 module.exports = function (object, index, value) { 3345 if (index in object) $defineProperty.f(object, index, createDesc(0, value)); 3346 else object[index] = value; 3347 }; 3348 3349 3350/***/ }), 3351/* 166 */ 3352/***/ (function(module, exports, __webpack_require__) { 3353 3354 var classof = __webpack_require__(75); 3355 var ITERATOR = __webpack_require__(27)('iterator'); 3356 var Iterators = __webpack_require__(130); 3357 module.exports = __webpack_require__(9).getIteratorMethod = function (it) { 3358 if (it != undefined) return it[ITERATOR] 3359 || it['@@iterator'] 3360 || Iterators[classof(it)]; 3361 }; 3362 3363 3364/***/ }), 3365/* 167 */ 3366/***/ (function(module, exports, __webpack_require__) { 3367 3368 var ITERATOR = __webpack_require__(27)('iterator'); 3369 var SAFE_CLOSING = false; 3370 3371 try { 3372 var riter = [7][ITERATOR](); 3373 riter['return'] = function () { SAFE_CLOSING = true; }; 3374 // eslint-disable-next-line no-throw-literal 3375 Array.from(riter, function () { throw 2; }); 3376 } catch (e) { /* empty */ } 3377 3378 module.exports = function (exec, skipClosing) { 3379 if (!skipClosing && !SAFE_CLOSING) return false; 3380 var safe = false; 3381 try { 3382 var arr = [7]; 3383 var iter = arr[ITERATOR](); 3384 iter.next = function () { return { done: safe = true }; }; 3385 arr[ITERATOR] = function () { return iter; }; 3386 exec(arr); 3387 } catch (e) { /* empty */ } 3388 return safe; 3389 }; 3390 3391 3392/***/ }), 3393/* 168 */ 3394/***/ (function(module, exports, __webpack_require__) { 3395 3396 'use strict'; 3397 var $export = __webpack_require__(8); 3398 var createProperty = __webpack_require__(165); 3399 3400 // WebKit Array.of isn't generic 3401 $export($export.S + $export.F * __webpack_require__(7)(function () { 3402 function F() { /* empty */ } 3403 return !(Array.of.call(F) instanceof F); 3404 }), 'Array', { 3405 // 22.1.2.3 Array.of( ...items) 3406 of: function of(/* ...args */) { 3407 var index = 0; 3408 var aLen = arguments.length; 3409 var result = new (typeof this == 'function' ? this : Array)(aLen); 3410 while (aLen > index) createProperty(result, index, arguments[index++]); 3411 result.length = aLen; 3412 return result; 3413 } 3414 }); 3415 3416 3417/***/ }), 3418/* 169 */ 3419/***/ (function(module, exports, __webpack_require__) { 3420 3421 'use strict'; 3422 // 22.1.3.13 Array.prototype.join(separator) 3423 var $export = __webpack_require__(8); 3424 var toIObject = __webpack_require__(33); 3425 var arrayJoin = [].join; 3426 3427 // fallback for not array-like strings 3428 $export($export.P + $export.F * (__webpack_require__(34) != Object || !__webpack_require__(170)(arrayJoin)), 'Array', { 3429 join: function join(separator) { 3430 return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); 3431 } 3432 }); 3433 3434 3435/***/ }), 3436/* 170 */ 3437/***/ (function(module, exports, __webpack_require__) { 3438 3439 'use strict'; 3440 var fails = __webpack_require__(7); 3441 3442 module.exports = function (method, arg) { 3443 return !!method && fails(function () { 3444 // eslint-disable-next-line no-useless-call 3445 arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); 3446 }); 3447 }; 3448 3449 3450/***/ }), 3451/* 171 */ 3452/***/ (function(module, exports, __webpack_require__) { 3453 3454 'use strict'; 3455 var $export = __webpack_require__(8); 3456 var html = __webpack_require__(49); 3457 var cof = __webpack_require__(35); 3458 var toAbsoluteIndex = __webpack_require__(40); 3459 var toLength = __webpack_require__(38); 3460 var arraySlice = [].slice; 3461 3462 // fallback for not array-like ES3 strings and DOM objects 3463 $export($export.P + $export.F * __webpack_require__(7)(function () { 3464 if (html) arraySlice.call(html); 3465 }), 'Array', { 3466 slice: function slice(begin, end) { 3467 var len = toLength(this.length); 3468 var klass = cof(this); 3469 end = end === undefined ? len : end; 3470 if (klass == 'Array') return arraySlice.call(this, begin, end); 3471 var start = toAbsoluteIndex(begin, len); 3472 var upTo = toAbsoluteIndex(end, len); 3473 var size = toLength(upTo - start); 3474 var cloned = new Array(size); 3475 var i = 0; 3476 for (; i < size; i++) cloned[i] = klass == 'String' 3477 ? this.charAt(start + i) 3478 : this[start + i]; 3479 return cloned; 3480 } 3481 }); 3482 3483 3484/***/ }), 3485/* 172 */ 3486/***/ (function(module, exports, __webpack_require__) { 3487 3488 'use strict'; 3489 var $export = __webpack_require__(8); 3490 var aFunction = __webpack_require__(24); 3491 var toObject = __webpack_require__(46); 3492 var fails = __webpack_require__(7); 3493 var $sort = [].sort; 3494 var test = [1, 2, 3]; 3495 3496 $export($export.P + $export.F * (fails(function () { 3497 // IE8- 3498 test.sort(undefined); 3499 }) || !fails(function () { 3500 // V8 bug 3501 test.sort(null); 3502 // Old WebKit 3503 }) || !__webpack_require__(170)($sort)), 'Array', { 3504 // 22.1.3.25 Array.prototype.sort(comparefn) 3505 sort: function sort(comparefn) { 3506 return comparefn === undefined 3507 ? $sort.call(toObject(this)) 3508 : $sort.call(toObject(this), aFunction(comparefn)); 3509 } 3510 }); 3511 3512 3513/***/ }), 3514/* 173 */ 3515/***/ (function(module, exports, __webpack_require__) { 3516 3517 'use strict'; 3518 var $export = __webpack_require__(8); 3519 var $forEach = __webpack_require__(174)(0); 3520 var STRICT = __webpack_require__(170)([].forEach, true); 3521 3522 $export($export.P + $export.F * !STRICT, 'Array', { 3523 // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) 3524 forEach: function forEach(callbackfn /* , thisArg */) { 3525 return $forEach(this, callbackfn, arguments[1]); 3526 } 3527 }); 3528 3529 3530/***/ }), 3531/* 174 */ 3532/***/ (function(module, exports, __webpack_require__) { 3533 3534 // 0 -> Array#forEach 3535 // 1 -> Array#map 3536 // 2 -> Array#filter 3537 // 3 -> Array#some 3538 // 4 -> Array#every 3539 // 5 -> Array#find 3540 // 6 -> Array#findIndex 3541 var ctx = __webpack_require__(23); 3542 var IObject = __webpack_require__(34); 3543 var toObject = __webpack_require__(46); 3544 var toLength = __webpack_require__(38); 3545 var asc = __webpack_require__(175); 3546 module.exports = function (TYPE, $create) { 3547 var IS_MAP = TYPE == 1; 3548 var IS_FILTER = TYPE == 2; 3549 var IS_SOME = TYPE == 3; 3550 var IS_EVERY = TYPE == 4; 3551 var IS_FIND_INDEX = TYPE == 6; 3552 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; 3553 var create = $create || asc; 3554 return function ($this, callbackfn, that) { 3555 var O = toObject($this); 3556 var self = IObject(O); 3557 var f = ctx(callbackfn, that, 3); 3558 var length = toLength(self.length); 3559 var index = 0; 3560 var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; 3561 var val, res; 3562 for (;length > index; index++) if (NO_HOLES || index in self) { 3563 val = self[index]; 3564 res = f(val, index, O); 3565 if (TYPE) { 3566 if (IS_MAP) result[index] = res; // map 3567 else if (res) switch (TYPE) { 3568 case 3: return true; // some 3569 case 5: return val; // find 3570 case 6: return index; // findIndex 3571 case 2: result.push(val); // filter 3572 } else if (IS_EVERY) return false; // every 3573 } 3574 } 3575 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; 3576 }; 3577 }; 3578 3579 3580/***/ }), 3581/* 175 */ 3582/***/ (function(module, exports, __webpack_require__) { 3583 3584 // 9.4.2.3 ArraySpeciesCreate(originalArray, length) 3585 var speciesConstructor = __webpack_require__(176); 3586 3587 module.exports = function (original, length) { 3588 return new (speciesConstructor(original))(length); 3589 }; 3590 3591 3592/***/ }), 3593/* 176 */ 3594/***/ (function(module, exports, __webpack_require__) { 3595 3596 var isObject = __webpack_require__(13); 3597 var isArray = __webpack_require__(45); 3598 var SPECIES = __webpack_require__(27)('species'); 3599 3600 module.exports = function (original) { 3601 var C; 3602 if (isArray(original)) { 3603 C = original.constructor; 3604 // cross-realm fallback 3605 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; 3606 if (isObject(C)) { 3607 C = C[SPECIES]; 3608 if (C === null) C = undefined; 3609 } 3610 } return C === undefined ? Array : C; 3611 }; 3612 3613 3614/***/ }), 3615/* 177 */ 3616/***/ (function(module, exports, __webpack_require__) { 3617 3618 'use strict'; 3619 var $export = __webpack_require__(8); 3620 var $map = __webpack_require__(174)(1); 3621 3622 $export($export.P + $export.F * !__webpack_require__(170)([].map, true), 'Array', { 3623 // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) 3624 map: function map(callbackfn /* , thisArg */) { 3625 return $map(this, callbackfn, arguments[1]); 3626 } 3627 }); 3628 3629 3630/***/ }), 3631/* 178 */ 3632/***/ (function(module, exports, __webpack_require__) { 3633 3634 'use strict'; 3635 var $export = __webpack_require__(8); 3636 var $filter = __webpack_require__(174)(2); 3637 3638 $export($export.P + $export.F * !__webpack_require__(170)([].filter, true), 'Array', { 3639 // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) 3640 filter: function filter(callbackfn /* , thisArg */) { 3641 return $filter(this, callbackfn, arguments[1]); 3642 } 3643 }); 3644 3645 3646/***/ }), 3647/* 179 */ 3648/***/ (function(module, exports, __webpack_require__) { 3649 3650 'use strict'; 3651 var $export = __webpack_require__(8); 3652 var $some = __webpack_require__(174)(3); 3653 3654 $export($export.P + $export.F * !__webpack_require__(170)([].some, true), 'Array', { 3655 // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) 3656 some: function some(callbackfn /* , thisArg */) { 3657 return $some(this, callbackfn, arguments[1]); 3658 } 3659 }); 3660 3661 3662/***/ }), 3663/* 180 */ 3664/***/ (function(module, exports, __webpack_require__) { 3665 3666 'use strict'; 3667 var $export = __webpack_require__(8); 3668 var $every = __webpack_require__(174)(4); 3669 3670 $export($export.P + $export.F * !__webpack_require__(170)([].every, true), 'Array', { 3671 // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) 3672 every: function every(callbackfn /* , thisArg */) { 3673 return $every(this, callbackfn, arguments[1]); 3674 } 3675 }); 3676 3677 3678/***/ }), 3679/* 181 */ 3680/***/ (function(module, exports, __webpack_require__) { 3681 3682 'use strict'; 3683 var $export = __webpack_require__(8); 3684 var $reduce = __webpack_require__(182); 3685 3686 $export($export.P + $export.F * !__webpack_require__(170)([].reduce, true), 'Array', { 3687 // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) 3688 reduce: function reduce(callbackfn /* , initialValue */) { 3689 return $reduce(this, callbackfn, arguments.length, arguments[1], false); 3690 } 3691 }); 3692 3693 3694/***/ }), 3695/* 182 */ 3696/***/ (function(module, exports, __webpack_require__) { 3697 3698 var aFunction = __webpack_require__(24); 3699 var toObject = __webpack_require__(46); 3700 var IObject = __webpack_require__(34); 3701 var toLength = __webpack_require__(38); 3702 3703 module.exports = function (that, callbackfn, aLen, memo, isRight) { 3704 aFunction(callbackfn); 3705 var O = toObject(that); 3706 var self = IObject(O); 3707 var length = toLength(O.length); 3708 var index = isRight ? length - 1 : 0; 3709 var i = isRight ? -1 : 1; 3710 if (aLen < 2) for (;;) { 3711 if (index in self) { 3712 memo = self[index]; 3713 index += i; 3714 break; 3715 } 3716 index += i; 3717 if (isRight ? index < 0 : length <= index) { 3718 throw TypeError('Reduce of empty array with no initial value'); 3719 } 3720 } 3721 for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { 3722 memo = callbackfn(memo, self[index], index, O); 3723 } 3724 return memo; 3725 }; 3726 3727 3728/***/ }), 3729/* 183 */ 3730/***/ (function(module, exports, __webpack_require__) { 3731 3732 'use strict'; 3733 var $export = __webpack_require__(8); 3734 var $reduce = __webpack_require__(182); 3735 3736 $export($export.P + $export.F * !__webpack_require__(170)([].reduceRight, true), 'Array', { 3737 // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) 3738 reduceRight: function reduceRight(callbackfn /* , initialValue */) { 3739 return $reduce(this, callbackfn, arguments.length, arguments[1], true); 3740 } 3741 }); 3742 3743 3744/***/ }), 3745/* 184 */ 3746/***/ (function(module, exports, __webpack_require__) { 3747 3748 'use strict'; 3749 var $export = __webpack_require__(8); 3750 var $indexOf = __webpack_require__(37)(false); 3751 var $native = [].indexOf; 3752 var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; 3753 3754 $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(170)($native)), 'Array', { 3755 // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) 3756 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { 3757 return NEGATIVE_ZERO 3758 // convert -0 to +0 3759 ? $native.apply(this, arguments) || 0 3760 : $indexOf(this, searchElement, arguments[1]); 3761 } 3762 }); 3763 3764 3765/***/ }), 3766/* 185 */ 3767/***/ (function(module, exports, __webpack_require__) { 3768 3769 'use strict'; 3770 var $export = __webpack_require__(8); 3771 var toIObject = __webpack_require__(33); 3772 var toInteger = __webpack_require__(39); 3773 var toLength = __webpack_require__(38); 3774 var $native = [].lastIndexOf; 3775 var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; 3776 3777 $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(170)($native)), 'Array', { 3778 // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) 3779 lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { 3780 // convert -0 to +0 3781 if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; 3782 var O = toIObject(this); 3783 var length = toLength(O.length); 3784 var index = length - 1; 3785 if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1])); 3786 if (index < 0) index = length + index; 3787 for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; 3788 return -1; 3789 } 3790 }); 3791 3792 3793/***/ }), 3794/* 186 */ 3795/***/ (function(module, exports, __webpack_require__) { 3796 3797 // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 3798 var $export = __webpack_require__(8); 3799 3800 $export($export.P, 'Array', { copyWithin: __webpack_require__(187) }); 3801 3802 __webpack_require__(188)('copyWithin'); 3803 3804 3805/***/ }), 3806/* 187 */ 3807/***/ (function(module, exports, __webpack_require__) { 3808 3809 // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 3810 'use strict'; 3811 var toObject = __webpack_require__(46); 3812 var toAbsoluteIndex = __webpack_require__(40); 3813 var toLength = __webpack_require__(38); 3814 3815 module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { 3816 var O = toObject(this); 3817 var len = toLength(O.length); 3818 var to = toAbsoluteIndex(target, len); 3819 var from = toAbsoluteIndex(start, len); 3820 var end = arguments.length > 2 ? arguments[2] : undefined; 3821 var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); 3822 var inc = 1; 3823 if (from < to && to < from + count) { 3824 inc = -1; 3825 from += count - 1; 3826 to += count - 1; 3827 } 3828 while (count-- > 0) { 3829 if (from in O) O[to] = O[from]; 3830 else delete O[to]; 3831 to += inc; 3832 from += inc; 3833 } return O; 3834 }; 3835 3836 3837/***/ }), 3838/* 188 */ 3839/***/ (function(module, exports, __webpack_require__) { 3840 3841 // 22.1.3.31 Array.prototype[@@unscopables] 3842 var UNSCOPABLES = __webpack_require__(27)('unscopables'); 3843 var ArrayProto = Array.prototype; 3844 if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(10)(ArrayProto, UNSCOPABLES, {}); 3845 module.exports = function (key) { 3846 ArrayProto[UNSCOPABLES][key] = true; 3847 }; 3848 3849 3850/***/ }), 3851/* 189 */ 3852/***/ (function(module, exports, __webpack_require__) { 3853 3854 // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 3855 var $export = __webpack_require__(8); 3856 3857 $export($export.P, 'Array', { fill: __webpack_require__(190) }); 3858 3859 __webpack_require__(188)('fill'); 3860 3861 3862/***/ }), 3863/* 190 */ 3864/***/ (function(module, exports, __webpack_require__) { 3865 3866 // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 3867 'use strict'; 3868 var toObject = __webpack_require__(46); 3869 var toAbsoluteIndex = __webpack_require__(40); 3870 var toLength = __webpack_require__(38); 3871 module.exports = function fill(value /* , start = 0, end = @length */) { 3872 var O = toObject(this); 3873 var length = toLength(O.length); 3874 var aLen = arguments.length; 3875 var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); 3876 var end = aLen > 2 ? arguments[2] : undefined; 3877 var endPos = end === undefined ? length : toAbsoluteIndex(end, length); 3878 while (endPos > index) O[index++] = value; 3879 return O; 3880 }; 3881 3882 3883/***/ }), 3884/* 191 */ 3885/***/ (function(module, exports, __webpack_require__) { 3886 3887 'use strict'; 3888 // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) 3889 var $export = __webpack_require__(8); 3890 var $find = __webpack_require__(174)(5); 3891 var KEY = 'find'; 3892 var forced = true; 3893 // Shouldn't skip holes 3894 if (KEY in []) Array(1)[KEY](function () { forced = false; }); 3895 $export($export.P + $export.F * forced, 'Array', { 3896 find: function find(callbackfn /* , that = undefined */) { 3897 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 3898 } 3899 }); 3900 __webpack_require__(188)(KEY); 3901 3902 3903/***/ }), 3904/* 192 */ 3905/***/ (function(module, exports, __webpack_require__) { 3906 3907 'use strict'; 3908 // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) 3909 var $export = __webpack_require__(8); 3910 var $find = __webpack_require__(174)(6); 3911 var KEY = 'findIndex'; 3912 var forced = true; 3913 // Shouldn't skip holes 3914 if (KEY in []) Array(1)[KEY](function () { forced = false; }); 3915 $export($export.P + $export.F * forced, 'Array', { 3916 findIndex: function findIndex(callbackfn /* , that = undefined */) { 3917 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 3918 } 3919 }); 3920 __webpack_require__(188)(KEY); 3921 3922 3923/***/ }), 3924/* 193 */ 3925/***/ (function(module, exports, __webpack_require__) { 3926 3927 __webpack_require__(194)('Array'); 3928 3929 3930/***/ }), 3931/* 194 */ 3932/***/ (function(module, exports, __webpack_require__) { 3933 3934 'use strict'; 3935 var global = __webpack_require__(4); 3936 var dP = __webpack_require__(11); 3937 var DESCRIPTORS = __webpack_require__(6); 3938 var SPECIES = __webpack_require__(27)('species'); 3939 3940 module.exports = function (KEY) { 3941 var C = global[KEY]; 3942 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { 3943 configurable: true, 3944 get: function () { return this; } 3945 }); 3946 }; 3947 3948 3949/***/ }), 3950/* 195 */ 3951/***/ (function(module, exports, __webpack_require__) { 3952 3953 'use strict'; 3954 var addToUnscopables = __webpack_require__(188); 3955 var step = __webpack_require__(196); 3956 var Iterators = __webpack_require__(130); 3957 var toIObject = __webpack_require__(33); 3958 3959 // 22.1.3.4 Array.prototype.entries() 3960 // 22.1.3.13 Array.prototype.keys() 3961 // 22.1.3.29 Array.prototype.values() 3962 // 22.1.3.30 Array.prototype[@@iterator]() 3963 module.exports = __webpack_require__(129)(Array, 'Array', function (iterated, kind) { 3964 this._t = toIObject(iterated); // target 3965 this._i = 0; // next index 3966 this._k = kind; // kind 3967 // 22.1.5.2.1 %ArrayIteratorPrototype%.next() 3968 }, function () { 3969 var O = this._t; 3970 var kind = this._k; 3971 var index = this._i++; 3972 if (!O || index >= O.length) { 3973 this._t = undefined; 3974 return step(1); 3975 } 3976 if (kind == 'keys') return step(0, index); 3977 if (kind == 'values') return step(0, O[index]); 3978 return step(0, [index, O[index]]); 3979 }, 'values'); 3980 3981 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) 3982 Iterators.Arguments = Iterators.Array; 3983 3984 addToUnscopables('keys'); 3985 addToUnscopables('values'); 3986 addToUnscopables('entries'); 3987 3988 3989/***/ }), 3990/* 196 */ 3991/***/ (function(module, exports) { 3992 3993 module.exports = function (done, value) { 3994 return { value: value, done: !!done }; 3995 }; 3996 3997 3998/***/ }), 3999/* 197 */ 4000/***/ (function(module, exports, __webpack_require__) { 4001 4002 var global = __webpack_require__(4); 4003 var inheritIfRequired = __webpack_require__(88); 4004 var dP = __webpack_require__(11).f; 4005 var gOPN = __webpack_require__(51).f; 4006 var isRegExp = __webpack_require__(135); 4007 var $flags = __webpack_require__(198); 4008 var $RegExp = global.RegExp; 4009 var Base = $RegExp; 4010 var proto = $RegExp.prototype; 4011 var re1 = /a/g; 4012 var re2 = /a/g; 4013 // "new" creates a new object, old webkit buggy here 4014 var CORRECT_NEW = new $RegExp(re1) !== re1; 4015 4016 if (__webpack_require__(6) && (!CORRECT_NEW || __webpack_require__(7)(function () { 4017 re2[__webpack_require__(27)('match')] = false; 4018 // RegExp constructor can alter flags and IsRegExp works correct with @@match 4019 return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; 4020 }))) { 4021 $RegExp = function RegExp(p, f) { 4022 var tiRE = this instanceof $RegExp; 4023 var piRE = isRegExp(p); 4024 var fiU = f === undefined; 4025 return !tiRE && piRE && p.constructor === $RegExp && fiU ? p 4026 : inheritIfRequired(CORRECT_NEW 4027 ? new Base(piRE && !fiU ? p.source : p, f) 4028 : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) 4029 , tiRE ? this : proto, $RegExp); 4030 }; 4031 var proxy = function (key) { 4032 key in $RegExp || dP($RegExp, key, { 4033 configurable: true, 4034 get: function () { return Base[key]; }, 4035 set: function (it) { Base[key] = it; } 4036 }); 4037 }; 4038 for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); 4039 proto.constructor = $RegExp; 4040 $RegExp.prototype = proto; 4041 __webpack_require__(18)(global, 'RegExp', $RegExp); 4042 } 4043 4044 __webpack_require__(194)('RegExp'); 4045 4046 4047/***/ }), 4048/* 198 */ 4049/***/ (function(module, exports, __webpack_require__) { 4050 4051 'use strict'; 4052 // 21.2.5.3 get RegExp.prototype.flags 4053 var anObject = __webpack_require__(12); 4054 module.exports = function () { 4055 var that = anObject(this); 4056 var result = ''; 4057 if (that.global) result += 'g'; 4058 if (that.ignoreCase) result += 'i'; 4059 if (that.multiline) result += 'm'; 4060 if (that.unicode) result += 'u'; 4061 if (that.sticky) result += 'y'; 4062 return result; 4063 }; 4064 4065 4066/***/ }), 4067/* 199 */ 4068/***/ (function(module, exports, __webpack_require__) { 4069 4070 'use strict'; 4071 var regexpExec = __webpack_require__(200); 4072 __webpack_require__(8)({ 4073 target: 'RegExp', 4074 proto: true, 4075 forced: regexpExec !== /./.exec 4076 }, { 4077 exec: regexpExec 4078 }); 4079 4080 4081/***/ }), 4082/* 200 */ 4083/***/ (function(module, exports, __webpack_require__) { 4084 4085 'use strict'; 4086 4087 var regexpFlags = __webpack_require__(198); 4088 4089 var nativeExec = RegExp.prototype.exec; 4090 // This always refers to the native implementation, because the 4091 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, 4092 // which loads this file before patching the method. 4093 var nativeReplace = String.prototype.replace; 4094 4095 var patchedExec = nativeExec; 4096 4097 var LAST_INDEX = 'lastIndex'; 4098 4099 var UPDATES_LAST_INDEX_WRONG = (function () { 4100 var re1 = /a/, 4101 re2 = /b*/g; 4102 nativeExec.call(re1, 'a'); 4103 nativeExec.call(re2, 'a'); 4104 return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; 4105 })(); 4106 4107 // nonparticipating capturing group, copied from es5-shim's String#split patch. 4108 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; 4109 4110 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; 4111 4112 if (PATCH) { 4113 patchedExec = function exec(str) { 4114 var re = this; 4115 var lastIndex, reCopy, match, i; 4116 4117 if (NPCG_INCLUDED) { 4118 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); 4119 } 4120 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; 4121 4122 match = nativeExec.call(re, str); 4123 4124 if (UPDATES_LAST_INDEX_WRONG && match) { 4125 re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; 4126 } 4127 if (NPCG_INCLUDED && match && match.length > 1) { 4128 // Fix browsers whose `exec` methods don't consistently return `undefined` 4129 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ 4130 // eslint-disable-next-line no-loop-func 4131 nativeReplace.call(match[0], reCopy, function () { 4132 for (i = 1; i < arguments.length - 2; i++) { 4133 if (arguments[i] === undefined) match[i] = undefined; 4134 } 4135 }); 4136 } 4137 4138 return match; 4139 }; 4140 } 4141 4142 module.exports = patchedExec; 4143 4144 4145/***/ }), 4146/* 201 */ 4147/***/ (function(module, exports, __webpack_require__) { 4148 4149 'use strict'; 4150 __webpack_require__(202); 4151 var anObject = __webpack_require__(12); 4152 var $flags = __webpack_require__(198); 4153 var DESCRIPTORS = __webpack_require__(6); 4154 var TO_STRING = 'toString'; 4155 var $toString = /./[TO_STRING]; 4156 4157 var define = function (fn) { 4158 __webpack_require__(18)(RegExp.prototype, TO_STRING, fn, true); 4159 }; 4160 4161 // 21.2.5.14 RegExp.prototype.toString() 4162 if (__webpack_require__(7)(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { 4163 define(function toString() { 4164 var R = anObject(this); 4165 return '/'.concat(R.source, '/', 4166 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); 4167 }); 4168 // FF44- RegExp#toString has a wrong name 4169 } else if ($toString.name != TO_STRING) { 4170 define(function toString() { 4171 return $toString.call(this); 4172 }); 4173 } 4174 4175 4176/***/ }), 4177/* 202 */ 4178/***/ (function(module, exports, __webpack_require__) { 4179 4180 // 21.2.5.3 get RegExp.prototype.flags() 4181 if (__webpack_require__(6) && /./g.flags != 'g') __webpack_require__(11).f(RegExp.prototype, 'flags', { 4182 configurable: true, 4183 get: __webpack_require__(198) 4184 }); 4185 4186 4187/***/ }), 4188/* 203 */ 4189/***/ (function(module, exports, __webpack_require__) { 4190 4191 'use strict'; 4192 4193 var anObject = __webpack_require__(12); 4194 var toLength = __webpack_require__(38); 4195 var advanceStringIndex = __webpack_require__(204); 4196 var regExpExec = __webpack_require__(205); 4197 4198 // @@match logic 4199 __webpack_require__(206)('match', 1, function (defined, MATCH, $match, maybeCallNative) { 4200 return [ 4201 // `String.prototype.match` method 4202 // https://tc39.github.io/ecma262/#sec-string.prototype.match 4203 function match(regexp) { 4204 var O = defined(this); 4205 var fn = regexp == undefined ? undefined : regexp[MATCH]; 4206 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); 4207 }, 4208 // `RegExp.prototype[@@match]` method 4209 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match 4210 function (regexp) { 4211 var res = maybeCallNative($match, regexp, this); 4212 if (res.done) return res.value; 4213 var rx = anObject(regexp); 4214 var S = String(this); 4215 if (!rx.global) return regExpExec(rx, S); 4216 var fullUnicode = rx.unicode; 4217 rx.lastIndex = 0; 4218 var A = []; 4219 var n = 0; 4220 var result; 4221 while ((result = regExpExec(rx, S)) !== null) { 4222 var matchStr = String(result[0]); 4223 A[n] = matchStr; 4224 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); 4225 n++; 4226 } 4227 return n === 0 ? null : A; 4228 } 4229 ]; 4230 }); 4231 4232 4233/***/ }), 4234/* 204 */ 4235/***/ (function(module, exports, __webpack_require__) { 4236 4237 'use strict'; 4238 var at = __webpack_require__(128)(true); 4239 4240 // `AdvanceStringIndex` abstract operation 4241 // https://tc39.github.io/ecma262/#sec-advancestringindex 4242 module.exports = function (S, index, unicode) { 4243 return index + (unicode ? at(S, index).length : 1); 4244 }; 4245 4246 4247/***/ }), 4248/* 205 */ 4249/***/ (function(module, exports, __webpack_require__) { 4250 4251 'use strict'; 4252 4253 var classof = __webpack_require__(75); 4254 var builtinExec = RegExp.prototype.exec; 4255 4256 // `RegExpExec` abstract operation 4257 // https://tc39.github.io/ecma262/#sec-regexpexec 4258 module.exports = function (R, S) { 4259 var exec = R.exec; 4260 if (typeof exec === 'function') { 4261 var result = exec.call(R, S); 4262 if (typeof result !== 'object') { 4263 throw new TypeError('RegExp exec method returned something other than an Object or null'); 4264 } 4265 return result; 4266 } 4267 if (classof(R) !== 'RegExp') { 4268 throw new TypeError('RegExp#exec called on incompatible receiver'); 4269 } 4270 return builtinExec.call(R, S); 4271 }; 4272 4273 4274/***/ }), 4275/* 206 */ 4276/***/ (function(module, exports, __webpack_require__) { 4277 4278 'use strict'; 4279 __webpack_require__(199); 4280 var redefine = __webpack_require__(18); 4281 var hide = __webpack_require__(10); 4282 var fails = __webpack_require__(7); 4283 var defined = __webpack_require__(36); 4284 var wks = __webpack_require__(27); 4285 var regexpExec = __webpack_require__(200); 4286 4287 var SPECIES = wks('species'); 4288 4289 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { 4290 // #replace needs built-in support for named groups. 4291 // #match works fine because it just return the exec results, even if it has 4292 // a "grops" property. 4293 var re = /./; 4294 re.exec = function () { 4295 var result = []; 4296 result.groups = { a: '7' }; 4297 return result; 4298 }; 4299 return ''.replace(re, '$<a>') !== '7'; 4300 }); 4301 4302 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { 4303 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec 4304 var re = /(?:)/; 4305 var originalExec = re.exec; 4306 re.exec = function () { return originalExec.apply(this, arguments); }; 4307 var result = 'ab'.split(re); 4308 return result.length === 2 && result[0] === 'a' && result[1] === 'b'; 4309 })(); 4310 4311 module.exports = function (KEY, length, exec) { 4312 var SYMBOL = wks(KEY); 4313 4314 var DELEGATES_TO_SYMBOL = !fails(function () { 4315 // String methods call symbol-named RegEp methods 4316 var O = {}; 4317 O[SYMBOL] = function () { return 7; }; 4318 return ''[KEY](O) != 7; 4319 }); 4320 4321 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () { 4322 // Symbol-named RegExp methods call .exec 4323 var execCalled = false; 4324 var re = /a/; 4325 re.exec = function () { execCalled = true; return null; }; 4326 if (KEY === 'split') { 4327 // RegExp[@@split] doesn't call the regex's exec method, but first creates 4328 // a new one. We need to return the patched regex when creating the new one. 4329 re.constructor = {}; 4330 re.constructor[SPECIES] = function () { return re; }; 4331 } 4332 re[SYMBOL](''); 4333 return !execCalled; 4334 }) : undefined; 4335 4336 if ( 4337 !DELEGATES_TO_SYMBOL || 4338 !DELEGATES_TO_EXEC || 4339 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || 4340 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) 4341 ) { 4342 var nativeRegExpMethod = /./[SYMBOL]; 4343 var fns = exec( 4344 defined, 4345 SYMBOL, 4346 ''[KEY], 4347 function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { 4348 if (regexp.exec === regexpExec) { 4349 if (DELEGATES_TO_SYMBOL && !forceStringMethod) { 4350 // The native String method already delegates to @@method (this 4351 // polyfilled function), leasing to infinite recursion. 4352 // We avoid it by directly calling the native @@method method. 4353 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; 4354 } 4355 return { done: true, value: nativeMethod.call(str, regexp, arg2) }; 4356 } 4357 return { done: false }; 4358 } 4359 ); 4360 var strfn = fns[0]; 4361 var rxfn = fns[1]; 4362 4363 redefine(String.prototype, KEY, strfn); 4364 hide(RegExp.prototype, SYMBOL, length == 2 4365 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) 4366 // 21.2.5.11 RegExp.prototype[@@split](string, limit) 4367 ? function (string, arg) { return rxfn.call(string, this, arg); } 4368 // 21.2.5.6 RegExp.prototype[@@match](string) 4369 // 21.2.5.9 RegExp.prototype[@@search](string) 4370 : function (string) { return rxfn.call(string, this); } 4371 ); 4372 } 4373 }; 4374 4375 4376/***/ }), 4377/* 207 */ 4378/***/ (function(module, exports, __webpack_require__) { 4379 4380 'use strict'; 4381 4382 var anObject = __webpack_require__(12); 4383 var toObject = __webpack_require__(46); 4384 var toLength = __webpack_require__(38); 4385 var toInteger = __webpack_require__(39); 4386 var advanceStringIndex = __webpack_require__(204); 4387 var regExpExec = __webpack_require__(205); 4388 var max = Math.max; 4389 var min = Math.min; 4390 var floor = Math.floor; 4391 var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g; 4392 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g; 4393 4394 var maybeToString = function (it) { 4395 return it === undefined ? it : String(it); 4396 }; 4397 4398 // @@replace logic 4399 __webpack_require__(206)('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { 4400 return [ 4401 // `String.prototype.replace` method 4402 // https://tc39.github.io/ecma262/#sec-string.prototype.replace 4403 function replace(searchValue, replaceValue) { 4404 var O = defined(this); 4405 var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; 4406 return fn !== undefined 4407 ? fn.call(searchValue, O, replaceValue) 4408 : $replace.call(String(O), searchValue, replaceValue); 4409 }, 4410 // `RegExp.prototype[@@replace]` method 4411 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace 4412 function (regexp, replaceValue) { 4413 var res = maybeCallNative($replace, regexp, this, replaceValue); 4414 if (res.done) return res.value; 4415 4416 var rx = anObject(regexp); 4417 var S = String(this); 4418 var functionalReplace = typeof replaceValue === 'function'; 4419 if (!functionalReplace) replaceValue = String(replaceValue); 4420 var global = rx.global; 4421 if (global) { 4422 var fullUnicode = rx.unicode; 4423 rx.lastIndex = 0; 4424 } 4425 var results = []; 4426 while (true) { 4427 var result = regExpExec(rx, S); 4428 if (result === null) break; 4429 results.push(result); 4430 if (!global) break; 4431 var matchStr = String(result[0]); 4432 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); 4433 } 4434 var accumulatedResult = ''; 4435 var nextSourcePosition = 0; 4436 for (var i = 0; i < results.length; i++) { 4437 result = results[i]; 4438 var matched = String(result[0]); 4439 var position = max(min(toInteger(result.index), S.length), 0); 4440 var captures = []; 4441 // NOTE: This is equivalent to 4442 // captures = result.slice(1).map(maybeToString) 4443 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in 4444 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and 4445 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. 4446 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); 4447 var namedCaptures = result.groups; 4448 if (functionalReplace) { 4449 var replacerArgs = [matched].concat(captures, position, S); 4450 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); 4451 var replacement = String(replaceValue.apply(undefined, replacerArgs)); 4452 } else { 4453 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); 4454 } 4455 if (position >= nextSourcePosition) { 4456 accumulatedResult += S.slice(nextSourcePosition, position) + replacement; 4457 nextSourcePosition = position + matched.length; 4458 } 4459 } 4460 return accumulatedResult + S.slice(nextSourcePosition); 4461 } 4462 ]; 4463 4464 // https://tc39.github.io/ecma262/#sec-getsubstitution 4465 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { 4466 var tailPos = position + matched.length; 4467 var m = captures.length; 4468 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; 4469 if (namedCaptures !== undefined) { 4470 namedCaptures = toObject(namedCaptures); 4471 symbols = SUBSTITUTION_SYMBOLS; 4472 } 4473 return $replace.call(replacement, symbols, function (match, ch) { 4474 var capture; 4475 switch (ch.charAt(0)) { 4476 case '$': return '$'; 4477 case '&': return matched; 4478 case '`': return str.slice(0, position); 4479 case "'": return str.slice(tailPos); 4480 case '<': 4481 capture = namedCaptures[ch.slice(1, -1)]; 4482 break; 4483 default: // \d\d? 4484 var n = +ch; 4485 if (n === 0) return match; 4486 if (n > m) { 4487 var f = floor(n / 10); 4488 if (f === 0) return match; 4489 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); 4490 return match; 4491 } 4492 capture = captures[n - 1]; 4493 } 4494 return capture === undefined ? '' : capture; 4495 }); 4496 } 4497 }); 4498 4499 4500/***/ }), 4501/* 208 */ 4502/***/ (function(module, exports, __webpack_require__) { 4503 4504 'use strict'; 4505 4506 var anObject = __webpack_require__(12); 4507 var sameValue = __webpack_require__(71); 4508 var regExpExec = __webpack_require__(205); 4509 4510 // @@search logic 4511 __webpack_require__(206)('search', 1, function (defined, SEARCH, $search, maybeCallNative) { 4512 return [ 4513 // `String.prototype.search` method 4514 // https://tc39.github.io/ecma262/#sec-string.prototype.search 4515 function search(regexp) { 4516 var O = defined(this); 4517 var fn = regexp == undefined ? undefined : regexp[SEARCH]; 4518 return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); 4519 }, 4520 // `RegExp.prototype[@@search]` method 4521 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search 4522 function (regexp) { 4523 var res = maybeCallNative($search, regexp, this); 4524 if (res.done) return res.value; 4525 var rx = anObject(regexp); 4526 var S = String(this); 4527 var previousLastIndex = rx.lastIndex; 4528 if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; 4529 var result = regExpExec(rx, S); 4530 if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; 4531 return result === null ? -1 : result.index; 4532 } 4533 ]; 4534 }); 4535 4536 4537/***/ }), 4538/* 209 */ 4539/***/ (function(module, exports, __webpack_require__) { 4540 4541 'use strict'; 4542 4543 var isRegExp = __webpack_require__(135); 4544 var anObject = __webpack_require__(12); 4545 var speciesConstructor = __webpack_require__(210); 4546 var advanceStringIndex = __webpack_require__(204); 4547 var toLength = __webpack_require__(38); 4548 var callRegExpExec = __webpack_require__(205); 4549 var regexpExec = __webpack_require__(200); 4550 var fails = __webpack_require__(7); 4551 var $min = Math.min; 4552 var $push = [].push; 4553 var $SPLIT = 'split'; 4554 var LENGTH = 'length'; 4555 var LAST_INDEX = 'lastIndex'; 4556 var MAX_UINT32 = 0xffffffff; 4557 4558 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError 4559 var SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); }); 4560 4561 // @@split logic 4562 __webpack_require__(206)('split', 2, function (defined, SPLIT, $split, maybeCallNative) { 4563 var internalSplit; 4564 if ( 4565 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 4566 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 4567 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || 4568 '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || 4569 '.'[$SPLIT](/()()/)[LENGTH] > 1 || 4570 ''[$SPLIT](/.?/)[LENGTH] 4571 ) { 4572 // based on es5-shim implementation, need to rework it 4573 internalSplit = function (separator, limit) { 4574 var string = String(this); 4575 if (separator === undefined && limit === 0) return []; 4576 // If `separator` is not a regex, use native split 4577 if (!isRegExp(separator)) return $split.call(string, separator, limit); 4578 var output = []; 4579 var flags = (separator.ignoreCase ? 'i' : '') + 4580 (separator.multiline ? 'm' : '') + 4581 (separator.unicode ? 'u' : '') + 4582 (separator.sticky ? 'y' : ''); 4583 var lastLastIndex = 0; 4584 var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0; 4585 // Make `global` and avoid `lastIndex` issues by working with a copy 4586 var separatorCopy = new RegExp(separator.source, flags + 'g'); 4587 var match, lastIndex, lastLength; 4588 while (match = regexpExec.call(separatorCopy, string)) { 4589 lastIndex = separatorCopy[LAST_INDEX]; 4590 if (lastIndex > lastLastIndex) { 4591 output.push(string.slice(lastLastIndex, match.index)); 4592 if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); 4593 lastLength = match[0][LENGTH]; 4594 lastLastIndex = lastIndex; 4595 if (output[LENGTH] >= splitLimit) break; 4596 } 4597 if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop 4598 } 4599 if (lastLastIndex === string[LENGTH]) { 4600 if (lastLength || !separatorCopy.test('')) output.push(''); 4601 } else output.push(string.slice(lastLastIndex)); 4602 return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; 4603 }; 4604 // Chakra, V8 4605 } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { 4606 internalSplit = function (separator, limit) { 4607 return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); 4608 }; 4609 } else { 4610 internalSplit = $split; 4611 } 4612 4613 return [ 4614 // `String.prototype.split` method 4615 // https://tc39.github.io/ecma262/#sec-string.prototype.split 4616 function split(separator, limit) { 4617 var O = defined(this); 4618 var splitter = separator == undefined ? undefined : separator[SPLIT]; 4619 return splitter !== undefined 4620 ? splitter.call(separator, O, limit) 4621 : internalSplit.call(String(O), separator, limit); 4622 }, 4623 // `RegExp.prototype[@@split]` method 4624 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split 4625 // 4626 // NOTE: This cannot be properly polyfilled in engines that don't support 4627 // the 'y' flag. 4628 function (regexp, limit) { 4629 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split); 4630 if (res.done) return res.value; 4631 4632 var rx = anObject(regexp); 4633 var S = String(this); 4634 var C = speciesConstructor(rx, RegExp); 4635 4636 var unicodeMatching = rx.unicode; 4637 var flags = (rx.ignoreCase ? 'i' : '') + 4638 (rx.multiline ? 'm' : '') + 4639 (rx.unicode ? 'u' : '') + 4640 (SUPPORTS_Y ? 'y' : 'g'); 4641 4642 // ^(? + rx + ) is needed, in combination with some S slicing, to 4643 // simulate the 'y' flag. 4644 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); 4645 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; 4646 if (lim === 0) return []; 4647 if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; 4648 var p = 0; 4649 var q = 0; 4650 var A = []; 4651 while (q < S.length) { 4652 splitter.lastIndex = SUPPORTS_Y ? q : 0; 4653 var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); 4654 var e; 4655 if ( 4656 z === null || 4657 (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p 4658 ) { 4659 q = advanceStringIndex(S, q, unicodeMatching); 4660 } else { 4661 A.push(S.slice(p, q)); 4662 if (A.length === lim) return A; 4663 for (var i = 1; i <= z.length - 1; i++) { 4664 A.push(z[i]); 4665 if (A.length === lim) return A; 4666 } 4667 q = p = e; 4668 } 4669 } 4670 A.push(S.slice(p)); 4671 return A; 4672 } 4673 ]; 4674 }); 4675 4676 4677/***/ }), 4678/* 210 */ 4679/***/ (function(module, exports, __webpack_require__) { 4680 4681 // 7.3.20 SpeciesConstructor(O, defaultConstructor) 4682 var anObject = __webpack_require__(12); 4683 var aFunction = __webpack_require__(24); 4684 var SPECIES = __webpack_require__(27)('species'); 4685 module.exports = function (O, D) { 4686 var C = anObject(O).constructor; 4687 var S; 4688 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); 4689 }; 4690 4691 4692/***/ }), 4693/* 211 */ 4694/***/ (function(module, exports, __webpack_require__) { 4695 4696 'use strict'; 4697 var LIBRARY = __webpack_require__(22); 4698 var global = __webpack_require__(4); 4699 var ctx = __webpack_require__(23); 4700 var classof = __webpack_require__(75); 4701 var $export = __webpack_require__(8); 4702 var isObject = __webpack_require__(13); 4703 var aFunction = __webpack_require__(24); 4704 var anInstance = __webpack_require__(212); 4705 var forOf = __webpack_require__(213); 4706 var speciesConstructor = __webpack_require__(210); 4707 var task = __webpack_require__(214).set; 4708 var microtask = __webpack_require__(215)(); 4709 var newPromiseCapabilityModule = __webpack_require__(216); 4710 var perform = __webpack_require__(217); 4711 var userAgent = __webpack_require__(218); 4712 var promiseResolve = __webpack_require__(219); 4713 var PROMISE = 'Promise'; 4714 var TypeError = global.TypeError; 4715 var process = global.process; 4716 var versions = process && process.versions; 4717 var v8 = versions && versions.v8 || ''; 4718 var $Promise = global[PROMISE]; 4719 var isNode = classof(process) == 'process'; 4720 var empty = function () { /* empty */ }; 4721 var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; 4722 var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; 4723 4724 var USE_NATIVE = !!function () { 4725 try { 4726 // correct subclassing with @@species support 4727 var promise = $Promise.resolve(1); 4728 var FakePromise = (promise.constructor = {})[__webpack_require__(27)('species')] = function (exec) { 4729 exec(empty, empty); 4730 }; 4731 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test 4732 return (isNode || typeof PromiseRejectionEvent == 'function') 4733 && promise.then(empty) instanceof FakePromise 4734 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables 4735 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 4736 // we can't detect it synchronously, so just check versions 4737 && v8.indexOf('6.6') !== 0 4738 && userAgent.indexOf('Chrome/66') === -1; 4739 } catch (e) { /* empty */ } 4740 }(); 4741 4742 // helpers 4743 var isThenable = function (it) { 4744 var then; 4745 return isObject(it) && typeof (then = it.then) == 'function' ? then : false; 4746 }; 4747 var notify = function (promise, isReject) { 4748 if (promise._n) return; 4749 promise._n = true; 4750 var chain = promise._c; 4751 microtask(function () { 4752 var value = promise._v; 4753 var ok = promise._s == 1; 4754 var i = 0; 4755 var run = function (reaction) { 4756 var handler = ok ? reaction.ok : reaction.fail; 4757 var resolve = reaction.resolve; 4758 var reject = reaction.reject; 4759 var domain = reaction.domain; 4760 var result, then, exited; 4761 try { 4762 if (handler) { 4763 if (!ok) { 4764 if (promise._h == 2) onHandleUnhandled(promise); 4765 promise._h = 1; 4766 } 4767 if (handler === true) result = value; 4768 else { 4769 if (domain) domain.enter(); 4770 result = handler(value); // may throw 4771 if (domain) { 4772 domain.exit(); 4773 exited = true; 4774 } 4775 } 4776 if (result === reaction.promise) { 4777 reject(TypeError('Promise-chain cycle')); 4778 } else if (then = isThenable(result)) { 4779 then.call(result, resolve, reject); 4780 } else resolve(result); 4781 } else reject(value); 4782 } catch (e) { 4783 if (domain && !exited) domain.exit(); 4784 reject(e); 4785 } 4786 }; 4787 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach 4788 promise._c = []; 4789 promise._n = false; 4790 if (isReject && !promise._h) onUnhandled(promise); 4791 }); 4792 }; 4793 var onUnhandled = function (promise) { 4794 task.call(global, function () { 4795 var value = promise._v; 4796 var unhandled = isUnhandled(promise); 4797 var result, handler, console; 4798 if (unhandled) { 4799 result = perform(function () { 4800 if (isNode) { 4801 process.emit('unhandledRejection', value, promise); 4802 } else if (handler = global.onunhandledrejection) { 4803 handler({ promise: promise, reason: value }); 4804 } else if ((console = global.console) && console.error) { 4805 console.error('Unhandled promise rejection', value); 4806 } 4807 }); 4808 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should 4809 promise._h = isNode || isUnhandled(promise) ? 2 : 1; 4810 } promise._a = undefined; 4811 if (unhandled && result.e) throw result.v; 4812 }); 4813 }; 4814 var isUnhandled = function (promise) { 4815 return promise._h !== 1 && (promise._a || promise._c).length === 0; 4816 }; 4817 var onHandleUnhandled = function (promise) { 4818 task.call(global, function () { 4819 var handler; 4820 if (isNode) { 4821 process.emit('rejectionHandled', promise); 4822 } else if (handler = global.onrejectionhandled) { 4823 handler({ promise: promise, reason: promise._v }); 4824 } 4825 }); 4826 }; 4827 var $reject = function (value) { 4828 var promise = this; 4829 if (promise._d) return; 4830 promise._d = true; 4831 promise = promise._w || promise; // unwrap 4832 promise._v = value; 4833 promise._s = 2; 4834 if (!promise._a) promise._a = promise._c.slice(); 4835 notify(promise, true); 4836 }; 4837 var $resolve = function (value) { 4838 var promise = this; 4839 var then; 4840 if (promise._d) return; 4841 promise._d = true; 4842 promise = promise._w || promise; // unwrap 4843 try { 4844 if (promise === value) throw TypeError("Promise can't be resolved itself"); 4845 if (then = isThenable(value)) { 4846 microtask(function () { 4847 var wrapper = { _w: promise, _d: false }; // wrap 4848 try { 4849 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); 4850 } catch (e) { 4851 $reject.call(wrapper, e); 4852 } 4853 }); 4854 } else { 4855 promise._v = value; 4856 promise._s = 1; 4857 notify(promise, false); 4858 } 4859 } catch (e) { 4860 $reject.call({ _w: promise, _d: false }, e); // wrap 4861 } 4862 }; 4863 4864 // constructor polyfill 4865 if (!USE_NATIVE) { 4866 // 25.4.3.1 Promise(executor) 4867 $Promise = function Promise(executor) { 4868 anInstance(this, $Promise, PROMISE, '_h'); 4869 aFunction(executor); 4870 Internal.call(this); 4871 try { 4872 executor(ctx($resolve, this, 1), ctx($reject, this, 1)); 4873 } catch (err) { 4874 $reject.call(this, err); 4875 } 4876 }; 4877 // eslint-disable-next-line no-unused-vars 4878 Internal = function Promise(executor) { 4879 this._c = []; // <- awaiting reactions 4880 this._a = undefined; // <- checked in isUnhandled reactions 4881 this._s = 0; // <- state 4882 this._d = false; // <- done 4883 this._v = undefined; // <- value 4884 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled 4885 this._n = false; // <- notify 4886 }; 4887 Internal.prototype = __webpack_require__(220)($Promise.prototype, { 4888 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) 4889 then: function then(onFulfilled, onRejected) { 4890 var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); 4891 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; 4892 reaction.fail = typeof onRejected == 'function' && onRejected; 4893 reaction.domain = isNode ? process.domain : undefined; 4894 this._c.push(reaction); 4895 if (this._a) this._a.push(reaction); 4896 if (this._s) notify(this, false); 4897 return reaction.promise; 4898 }, 4899 // 25.4.5.1 Promise.prototype.catch(onRejected) 4900 'catch': function (onRejected) { 4901 return this.then(undefined, onRejected); 4902 } 4903 }); 4904 OwnPromiseCapability = function () { 4905 var promise = new Internal(); 4906 this.promise = promise; 4907 this.resolve = ctx($resolve, promise, 1); 4908 this.reject = ctx($reject, promise, 1); 4909 }; 4910 newPromiseCapabilityModule.f = newPromiseCapability = function (C) { 4911 return C === $Promise || C === Wrapper 4912 ? new OwnPromiseCapability(C) 4913 : newGenericPromiseCapability(C); 4914 }; 4915 } 4916 4917 $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); 4918 __webpack_require__(26)($Promise, PROMISE); 4919 __webpack_require__(194)(PROMISE); 4920 Wrapper = __webpack_require__(9)[PROMISE]; 4921 4922 // statics 4923 $export($export.S + $export.F * !USE_NATIVE, PROMISE, { 4924 // 25.4.4.5 Promise.reject(r) 4925 reject: function reject(r) { 4926 var capability = newPromiseCapability(this); 4927 var $$reject = capability.reject; 4928 $$reject(r); 4929 return capability.promise; 4930 } 4931 }); 4932 $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { 4933 // 25.4.4.6 Promise.resolve(x) 4934 resolve: function resolve(x) { 4935 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); 4936 } 4937 }); 4938 $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(167)(function (iter) { 4939 $Promise.all(iter)['catch'](empty); 4940 })), PROMISE, { 4941 // 25.4.4.1 Promise.all(iterable) 4942 all: function all(iterable) { 4943 var C = this; 4944 var capability = newPromiseCapability(C); 4945 var resolve = capability.resolve; 4946 var reject = capability.reject; 4947 var result = perform(function () { 4948 var values = []; 4949 var index = 0; 4950 var remaining = 1; 4951 forOf(iterable, false, function (promise) { 4952 var $index = index++; 4953 var alreadyCalled = false;
vendor: 5,242 bytes, lines 4954-5121
4954 values.push(undefined); 4955 remaining++; 4956 C.resolve(promise).then(function (value) { 4957 if (alreadyCalled) return; 4958 alreadyCalled = true; 4959 values[$index] = value; 4960 --remaining || resolve(values); 4961 }, reject); 4962 }); 4963 --remaining || resolve(values); 4964 }); 4965 if (result.e) reject(result.v); 4966 return capability.promise; 4967 }, 4968 // 25.4.4.4 Promise.race(iterable) 4969 race: function race(iterable) { 4970 var C = this; 4971 var capability = newPromiseCapability(C); 4972 var reject = capability.reject; 4973 var result = perform(function () { 4974 forOf(iterable, false, function (promise) { 4975 C.resolve(promise).then(capability.resolve, reject); 4976 }); 4977 }); 4978 if (result.e) reject(result.v); 4979 return capability.promise; 4980 } 4981 }); 4982 4983 4984/***/ }), 4985/* 212 */ 4986/***/ (function(module, exports) { 4987 4988 module.exports = function (it, Constructor, name, forbiddenField) { 4989 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { 4990 throw TypeError(name + ': incorrect invocation!'); 4991 } return it; 4992 }; 4993 4994 4995/***/ }), 4996/* 213 */ 4997/***/ (function(module, exports, __webpack_require__) { 4998 4999 var ctx = __webpack_require__(23); 5000 var call = __webpack_require__(163); 5001 var isArrayIter = __webpack_require__(164); 5002 var anObject = __webpack_require__(12); 5003 var toLength = __webpack_require__(38); 5004 var getIterFn = __webpack_require__(166); 5005 var BREAK = {}; 5006 var RETURN = {}; 5007 var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { 5008 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); 5009 var f = ctx(fn, that, entries ? 2 : 1); 5010 var index = 0; 5011 var length, step, iterator, result; 5012 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); 5013 // fast case for arrays with default iterator 5014 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { 5015 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); 5016 if (result === BREAK || result === RETURN) return result; 5017 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { 5018 result = call(iterator, f, step.value, entries); 5019 if (result === BREAK || result === RETURN) return result; 5020 } 5021 }; 5022 exports.BREAK = BREAK; 5023 exports.RETURN = RETURN; 5024 5025 5026/***/ }), 5027/* 214 */ 5028/***/ (function(module, exports, __webpack_require__) { 5029 5030 var ctx = __webpack_require__(23); 5031 var invoke = __webpack_require__(78); 5032 var html = __webpack_require__(49); 5033 var cel = __webpack_require__(15); 5034 var global = __webpack_require__(4); 5035 var process = global.process; 5036 var setTask = global.setImmediate; 5037 var clearTask = global.clearImmediate; 5038 var MessageChannel = global.MessageChannel; 5039 var Dispatch = global.Dispatch; 5040 var counter = 0; 5041 var queue = {}; 5042 var ONREADYSTATECHANGE = 'onreadystatechange'; 5043 var defer, channel, port; 5044 var run = function () { 5045 var id = +this; 5046 // eslint-disable-next-line no-prototype-builtins 5047 if (queue.hasOwnProperty(id)) { 5048 var fn = queue[id]; 5049 delete queue[id]; 5050 fn(); 5051 } 5052 }; 5053 var listener = function (event) { 5054 run.call(event.data); 5055 }; 5056 // Node.js 0.9+ & IE10+ has setImmediate, otherwise: 5057 if (!setTask || !clearTask) { 5058 setTask = function setImmediate(fn) { 5059 var args = []; 5060 var i = 1; 5061 while (arguments.length > i) args.push(arguments[i++]); 5062 queue[++counter] = function () { 5063 // eslint-disable-next-line no-new-func 5064 invoke(typeof fn == 'function' ? fn : Function(fn), args); 5065 }; 5066 defer(counter); 5067 return counter; 5068 }; 5069 clearTask = function clearImmediate(id) { 5070 delete queue[id]; 5071 }; 5072 // Node.js 0.8- 5073 if (__webpack_require__(35)(process) == 'process') { 5074 defer = function (id) { 5075 process.nextTick(ctx(run, id, 1)); 5076 }; 5077 // Sphere (JS game engine) Dispatch API 5078 } else if (Dispatch && Dispatch.now) { 5079 defer = function (id) { 5080 Dispatch.now(ctx(run, id, 1)); 5081 }; 5082 // Browsers with MessageChannel, includes WebWorkers 5083 } else if (MessageChannel) { 5084 channel = new MessageChannel(); 5085 port = channel.port2; 5086 channel.port1.onmessage = listener; 5087 defer = ctx(port.postMessage, port, 1); 5088 // Browsers with postMessage, skip WebWorkers 5089 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' 5090 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { 5091 defer = function (id) { 5092 global.postMessage(id + '', '*'); 5093 }; 5094 global.addEventListener('message', listener, false); 5095 // IE8- 5096 } else if (ONREADYSTATECHANGE in cel('script')) { 5097 defer = function (id) { 5098 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { 5099 html.removeChild(this); 5100 run.call(id); 5101 }; 5102 }; 5103 // Rest old browsers 5104 } else { 5105 defer = function (id) { 5106 setTimeout(ctx(run, id, 1), 0); 5107 }; 5108 } 5109 } 5110 module.exports = { 5111 set: setTask, 5112 clear: clearTask 5113 }; 5114 5115 5116/***/ }), 5117/* 215 */ 5118/***/ (function(module, exports, __webpack_require__) { 5119 5120 var global = __webpack_require__(4); 5121 var macrotask = __webpack_require__(214).set;
vendor: 4,311 bytes, lines 5122-5285
5122 var Observer = global.MutationObserver || global.WebKitMutationObserver; 5123 var process = global.process; 5124 var Promise = global.Promise; 5125 var isNode = __webpack_require__(35)(process) == 'process'; 5126 5127 module.exports = function () { 5128 var head, last, notify; 5129 5130 var flush = function () { 5131 var parent, fn; 5132 if (isNode && (parent = process.domain)) parent.exit(); 5133 while (head) { 5134 fn = head.fn; 5135 head = head.next; 5136 try { 5137 fn(); 5138 } catch (e) { 5139 if (head) notify(); 5140 else last = undefined; 5141 throw e; 5142 } 5143 } last = undefined; 5144 if (parent) parent.enter(); 5145 }; 5146 5147 // Node.js 5148 if (isNode) { 5149 notify = function () { 5150 process.nextTick(flush); 5151 }; 5152 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 5153 } else if (Observer && !(global.navigator && global.navigator.standalone)) { 5154 var toggle = true; 5155 var node = document.createTextNode(''); 5156 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new 5157 notify = function () { 5158 node.data = toggle = !toggle; 5159 }; 5160 // environments with maybe non-completely correct, but existent Promise 5161 } else if (Promise && Promise.resolve) { 5162 // Promise.resolve without an argument throws an error in LG WebOS 2 5163 var promise = Promise.resolve(undefined); 5164 notify = function () { 5165 promise.then(flush); 5166 }; 5167 // for other environments - macrotask based on: 5168 // - setImmediate 5169 // - MessageChannel 5170 // - window.postMessag 5171 // - onreadystatechange 5172 // - setTimeout 5173 } else { 5174 notify = function () { 5175 // strange IE + webpack dev server bug - use .call(global) 5176 macrotask.call(global, flush); 5177 }; 5178 } 5179 5180 return function (fn) { 5181 var task = { fn: fn, next: undefined }; 5182 if (last) last.next = task; 5183 if (!head) { 5184 head = task; 5185 notify(); 5186 } last = task; 5187 }; 5188 }; 5189 5190 5191/***/ }), 5192/* 216 */ 5193/***/ (function(module, exports, __webpack_require__) { 5194 5195 'use strict'; 5196 // 25.4.1.5 NewPromiseCapability(C) 5197 var aFunction = __webpack_require__(24); 5198 5199 function PromiseCapability(C) { 5200 var resolve, reject; 5201 this.promise = new C(function ($$resolve, $$reject) { 5202 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); 5203 resolve = $$resolve; 5204 reject = $$reject; 5205 }); 5206 this.resolve = aFunction(resolve); 5207 this.reject = aFunction(reject); 5208 } 5209 5210 module.exports.f = function (C) { 5211 return new PromiseCapability(C); 5212 }; 5213 5214 5215/***/ }), 5216/* 217 */ 5217/***/ (function(module, exports) { 5218 5219 module.exports = function (exec) { 5220 try { 5221 return { e: false, v: exec() }; 5222 } catch (e) { 5223 return { e: true, v: e }; 5224 } 5225 }; 5226 5227 5228/***/ }), 5229/* 218 */ 5230/***/ (function(module, exports, __webpack_require__) { 5231 5232 var global = __webpack_require__(4); 5233 var navigator = global.navigator; 5234 5235 module.exports = navigator && navigator.userAgent || ''; 5236 5237 5238/***/ }), 5239/* 219 */ 5240/***/ (function(module, exports, __webpack_require__) { 5241 5242 var anObject = __webpack_require__(12); 5243 var isObject = __webpack_require__(13); 5244 var newPromiseCapability = __webpack_require__(216); 5245 5246 module.exports = function (C, x) { 5247 anObject(C); 5248 if (isObject(x) && x.constructor === C) return x; 5249 var promiseCapability = newPromiseCapability.f(C); 5250 var resolve = promiseCapability.resolve; 5251 resolve(x); 5252 return promiseCapability.promise; 5253 }; 5254 5255 5256/***/ }), 5257/* 220 */ 5258/***/ (function(module, exports, __webpack_require__) { 5259 5260 var redefine = __webpack_require__(18); 5261 module.exports = function (target, src, safe) { 5262 for (var key in src) redefine(target, key, src[key], safe); 5263 return target; 5264 }; 5265 5266 5267/***/ }), 5268/* 221 */ 5269/***/ (function(module, exports, __webpack_require__) { 5270 5271 'use strict'; 5272 var strong = __webpack_require__(222); 5273 var validate = __webpack_require__(223); 5274 var MAP = 'Map'; 5275 5276 // 23.1 Map Objects 5277 module.exports = __webpack_require__(224)(MAP, function (get) { 5278 return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 5279 }, { 5280 // 23.1.3.6 Map.prototype.get(key) 5281 get: function get(key) { 5282 var entry = strong.getEntry(validate(this, MAP), key); 5283 return entry && entry.v; 5284 }, 5285 // 23.1.3.9 Map.prototype.set(key, value)
vendor: 31,792 bytes, lines 5286-6219
5286 set: function set(key, value) { 5287 return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); 5288 } 5289 }, strong, true); 5290 5291 5292/***/ }), 5293/* 222 */ 5294/***/ (function(module, exports, __webpack_require__) { 5295 5296 'use strict'; 5297 var dP = __webpack_require__(11).f; 5298 var create = __webpack_require__(47); 5299 var redefineAll = __webpack_require__(220); 5300 var ctx = __webpack_require__(23); 5301 var anInstance = __webpack_require__(212); 5302 var forOf = __webpack_require__(213); 5303 var $iterDefine = __webpack_require__(129); 5304 var step = __webpack_require__(196); 5305 var setSpecies = __webpack_require__(194); 5306 var DESCRIPTORS = __webpack_require__(6); 5307 var fastKey = __webpack_require__(25).fastKey; 5308 var validate = __webpack_require__(223); 5309 var SIZE = DESCRIPTORS ? '_s' : 'size'; 5310 5311 var getEntry = function (that, key) { 5312 // fast case 5313 var index = fastKey(key); 5314 var entry; 5315 if (index !== 'F') return that._i[index]; 5316 // frozen object case 5317 for (entry = that._f; entry; entry = entry.n) { 5318 if (entry.k == key) return entry; 5319 } 5320 }; 5321 5322 module.exports = { 5323 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { 5324 var C = wrapper(function (that, iterable) { 5325 anInstance(that, C, NAME, '_i'); 5326 that._t = NAME; // collection type 5327 that._i = create(null); // index 5328 that._f = undefined; // first entry 5329 that._l = undefined; // last entry 5330 that[SIZE] = 0; // size 5331 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); 5332 }); 5333 redefineAll(C.prototype, { 5334 // 23.1.3.1 Map.prototype.clear() 5335 // 23.2.3.2 Set.prototype.clear() 5336 clear: function clear() { 5337 for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { 5338 entry.r = true; 5339 if (entry.p) entry.p = entry.p.n = undefined; 5340 delete data[entry.i]; 5341 } 5342 that._f = that._l = undefined; 5343 that[SIZE] = 0; 5344 }, 5345 // 23.1.3.3 Map.prototype.delete(key) 5346 // 23.2.3.4 Set.prototype.delete(value) 5347 'delete': function (key) { 5348 var that = validate(this, NAME); 5349 var entry = getEntry(that, key); 5350 if (entry) { 5351 var next = entry.n; 5352 var prev = entry.p; 5353 delete that._i[entry.i]; 5354 entry.r = true; 5355 if (prev) prev.n = next; 5356 if (next) next.p = prev; 5357 if (that._f == entry) that._f = next; 5358 if (that._l == entry) that._l = prev; 5359 that[SIZE]--; 5360 } return !!entry; 5361 }, 5362 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) 5363 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) 5364 forEach: function forEach(callbackfn /* , that = undefined */) { 5365 validate(this, NAME); 5366 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); 5367 var entry; 5368 while (entry = entry ? entry.n : this._f) { 5369 f(entry.v, entry.k, this); 5370 // revert to the last existing entry 5371 while (entry && entry.r) entry = entry.p; 5372 } 5373 }, 5374 // 23.1.3.7 Map.prototype.has(key) 5375 // 23.2.3.7 Set.prototype.has(value) 5376 has: function has(key) { 5377 return !!getEntry(validate(this, NAME), key); 5378 } 5379 }); 5380 if (DESCRIPTORS) dP(C.prototype, 'size', { 5381 get: function () { 5382 return validate(this, NAME)[SIZE]; 5383 } 5384 }); 5385 return C; 5386 }, 5387 def: function (that, key, value) { 5388 var entry = getEntry(that, key); 5389 var prev, index; 5390 // change existing entry 5391 if (entry) { 5392 entry.v = value; 5393 // create new entry 5394 } else { 5395 that._l = entry = { 5396 i: index = fastKey(key, true), // <- index 5397 k: key, // <- key 5398 v: value, // <- value 5399 p: prev = that._l, // <- previous entry 5400 n: undefined, // <- next entry 5401 r: false // <- removed 5402 }; 5403 if (!that._f) that._f = entry; 5404 if (prev) prev.n = entry; 5405 that[SIZE]++; 5406 // add to index 5407 if (index !== 'F') that._i[index] = entry; 5408 } return that; 5409 }, 5410 getEntry: getEntry, 5411 setStrong: function (C, NAME, IS_MAP) { 5412 // add .keys, .values, .entries, [@@iterator] 5413 // 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 5414 $iterDefine(C, NAME, function (iterated, kind) { 5415 this._t = validate(iterated, NAME); // target 5416 this._k = kind; // kind 5417 this._l = undefined; // previous 5418 }, function () { 5419 var that = this; 5420 var kind = that._k; 5421 var entry = that._l; 5422 // revert to the last existing entry 5423 while (entry && entry.r) entry = entry.p; 5424 // get next entry 5425 if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { 5426 // or finish the iteration 5427 that._t = undefined; 5428 return step(1); 5429 } 5430 // return step by kind 5431 if (kind == 'keys') return step(0, entry.k); 5432 if (kind == 'values') return step(0, entry.v); 5433 return step(0, [entry.k, entry.v]); 5434 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); 5435 5436 // add [@@species], 23.1.2.2, 23.2.2.2 5437 setSpecies(NAME); 5438 } 5439 }; 5440 5441 5442/***/ }), 5443/* 223 */ 5444/***/ (function(module, exports, __webpack_require__) { 5445 5446 var isObject = __webpack_require__(13); 5447 module.exports = function (it, TYPE) { 5448 if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); 5449 return it; 5450 }; 5451 5452 5453/***/ }), 5454/* 224 */ 5455/***/ (function(module, exports, __webpack_require__) { 5456 5457 'use strict'; 5458 var global = __webpack_require__(4); 5459 var $export = __webpack_require__(8); 5460 var redefine = __webpack_require__(18); 5461 var redefineAll = __webpack_require__(220); 5462 var meta = __webpack_require__(25); 5463 var forOf = __webpack_require__(213); 5464 var anInstance = __webpack_require__(212); 5465 var isObject = __webpack_require__(13); 5466 var fails = __webpack_require__(7); 5467 var $iterDetect = __webpack_require__(167); 5468 var setToStringTag = __webpack_require__(26); 5469 var inheritIfRequired = __webpack_require__(88); 5470 5471 module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { 5472 var Base = global[NAME]; 5473 var C = Base; 5474 var ADDER = IS_MAP ? 'set' : 'add'; 5475 var proto = C && C.prototype; 5476 var O = {}; 5477 var fixMethod = function (KEY) { 5478 var fn = proto[KEY]; 5479 redefine(proto, KEY, 5480 KEY == 'delete' ? function (a) { 5481 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); 5482 } : KEY == 'has' ? function has(a) { 5483 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); 5484 } : KEY == 'get' ? function get(a) { 5485 return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); 5486 } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } 5487 : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } 5488 ); 5489 }; 5490 if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { 5491 new C().entries().next(); 5492 }))) { 5493 // create collection constructor 5494 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); 5495 redefineAll(C.prototype, methods); 5496 meta.NEED = true; 5497 } else { 5498 var instance = new C(); 5499 // early implementations not supports chaining 5500 var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; 5501 // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false 5502 var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); 5503 // most early implementations doesn't supports iterables, most modern - not close it correctly 5504 var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new 5505 // for early implementations -0 and +0 not the same 5506 var BUGGY_ZERO = !IS_WEAK && fails(function () { 5507 // V8 ~ Chromium 42- fails only with 5+ elements 5508 var $instance = new C(); 5509 var index = 5; 5510 while (index--) $instance[ADDER](index, index); 5511 return !$instance.has(-0); 5512 }); 5513 if (!ACCEPT_ITERABLES) { 5514 C = wrapper(function (target, iterable) { 5515 anInstance(target, C, NAME); 5516 var that = inheritIfRequired(new Base(), target, C); 5517 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); 5518 return that; 5519 }); 5520 C.prototype = proto; 5521 proto.constructor = C; 5522 } 5523 if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { 5524 fixMethod('delete'); 5525 fixMethod('has'); 5526 IS_MAP && fixMethod('get'); 5527 } 5528 if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); 5529 // weak collections should not contains .clear method 5530 if (IS_WEAK && proto.clear) delete proto.clear; 5531 } 5532 5533 setToStringTag(C, NAME); 5534 5535 O[NAME] = C; 5536 $export($export.G + $export.W + $export.F * (C != Base), O); 5537 5538 if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); 5539 5540 return C; 5541 }; 5542 5543 5544/***/ }), 5545/* 225 */ 5546/***/ (function(module, exports, __webpack_require__) { 5547 5548 'use strict'; 5549 var strong = __webpack_require__(222); 5550 var validate = __webpack_require__(223); 5551 var SET = 'Set'; 5552 5553 // 23.2 Set Objects 5554 module.exports = __webpack_require__(224)(SET, function (get) { 5555 return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 5556 }, { 5557 // 23.2.3.1 Set.prototype.add(value) 5558 add: function add(value) { 5559 return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); 5560 } 5561 }, strong); 5562 5563 5564/***/ }), 5565/* 226 */ 5566/***/ (function(module, exports, __webpack_require__) { 5567 5568 'use strict'; 5569 var global = __webpack_require__(4); 5570 var each = __webpack_require__(174)(0); 5571 var redefine = __webpack_require__(18); 5572 var meta = __webpack_require__(25); 5573 var assign = __webpack_require__(69); 5574 var weak = __webpack_require__(227); 5575 var isObject = __webpack_require__(13); 5576 var validate = __webpack_require__(223); 5577 var NATIVE_WEAK_MAP = __webpack_require__(223); 5578 var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; 5579 var WEAK_MAP = 'WeakMap'; 5580 var getWeak = meta.getWeak; 5581 var isExtensible = Object.isExtensible; 5582 var uncaughtFrozenStore = weak.ufstore; 5583 var InternalMap; 5584 5585 var wrapper = function (get) { 5586 return function WeakMap() { 5587 return get(this, arguments.length > 0 ? arguments[0] : undefined); 5588 }; 5589 }; 5590 5591 var methods = { 5592 // 23.3.3.3 WeakMap.prototype.get(key) 5593 get: function get(key) { 5594 if (isObject(key)) { 5595 var data = getWeak(key); 5596 if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); 5597 return data ? data[this._i] : undefined; 5598 } 5599 }, 5600 // 23.3.3.5 WeakMap.prototype.set(key, value) 5601 set: function set(key, value) { 5602 return weak.def(validate(this, WEAK_MAP), key, value); 5603 } 5604 }; 5605 5606 // 23.3 WeakMap Objects 5607 var $WeakMap = module.exports = __webpack_require__(224)(WEAK_MAP, wrapper, methods, weak, true, true); 5608 5609 // IE11 WeakMap frozen keys fix 5610 if (NATIVE_WEAK_MAP && IS_IE11) { 5611 InternalMap = weak.getConstructor(wrapper, WEAK_MAP); 5612 assign(InternalMap.prototype, methods); 5613 meta.NEED = true; 5614 each(['delete', 'has', 'get', 'set'], function (key) { 5615 var proto = $WeakMap.prototype; 5616 var method = proto[key]; 5617 redefine(proto, key, function (a, b) { 5618 // store frozen objects on internal weakmap shim 5619 if (isObject(a) && !isExtensible(a)) { 5620 if (!this._f) this._f = new InternalMap(); 5621 var result = this._f[key](a, b); 5622 return key == 'set' ? this : result; 5623 // store all the rest on native weakmap 5624 } return method.call(this, a, b); 5625 }); 5626 }); 5627 } 5628 5629 5630/***/ }), 5631/* 227 */ 5632/***/ (function(module, exports, __webpack_require__) { 5633 5634 'use strict'; 5635 var redefineAll = __webpack_require__(220); 5636 var getWeak = __webpack_require__(25).getWeak; 5637 var anObject = __webpack_require__(12); 5638 var isObject = __webpack_require__(13); 5639 var anInstance = __webpack_require__(212); 5640 var forOf = __webpack_require__(213); 5641 var createArrayMethod = __webpack_require__(174); 5642 var $has = __webpack_require__(5); 5643 var validate = __webpack_require__(223); 5644 var arrayFind = createArrayMethod(5); 5645 var arrayFindIndex = createArrayMethod(6); 5646 var id = 0; 5647 5648 // fallback for uncaught frozen keys 5649 var uncaughtFrozenStore = function (that) { 5650 return that._l || (that._l = new UncaughtFrozenStore()); 5651 }; 5652 var UncaughtFrozenStore = function () { 5653 this.a = []; 5654 }; 5655 var findUncaughtFrozen = function (store, key) { 5656 return arrayFind(store.a, function (it) { 5657 return it[0] === key; 5658 }); 5659 }; 5660 UncaughtFrozenStore.prototype = { 5661 get: function (key) { 5662 var entry = findUncaughtFrozen(this, key); 5663 if (entry) return entry[1]; 5664 }, 5665 has: function (key) { 5666 return !!findUncaughtFrozen(this, key); 5667 }, 5668 set: function (key, value) { 5669 var entry = findUncaughtFrozen(this, key); 5670 if (entry) entry[1] = value; 5671 else this.a.push([key, value]); 5672 }, 5673 'delete': function (key) { 5674 var index = arrayFindIndex(this.a, function (it) { 5675 return it[0] === key; 5676 }); 5677 if (~index) this.a.splice(index, 1); 5678 return !!~index; 5679 } 5680 }; 5681 5682 module.exports = { 5683 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { 5684 var C = wrapper(function (that, iterable) { 5685 anInstance(that, C, NAME, '_i'); 5686 that._t = NAME; // collection type 5687 that._i = id++; // collection id 5688 that._l = undefined; // leak store for uncaught frozen objects 5689 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); 5690 }); 5691 redefineAll(C.prototype, { 5692 // 23.3.3.2 WeakMap.prototype.delete(key) 5693 // 23.4.3.3 WeakSet.prototype.delete(value) 5694 'delete': function (key) { 5695 if (!isObject(key)) return false; 5696 var data = getWeak(key); 5697 if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); 5698 return data && $has(data, this._i) && delete data[this._i]; 5699 }, 5700 // 23.3.3.4 WeakMap.prototype.has(key) 5701 // 23.4.3.4 WeakSet.prototype.has(value) 5702 has: function has(key) { 5703 if (!isObject(key)) return false; 5704 var data = getWeak(key); 5705 if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); 5706 return data && $has(data, this._i); 5707 } 5708 }); 5709 return C; 5710 }, 5711 def: function (that, key, value) { 5712 var data = getWeak(anObject(key), true); 5713 if (data === true) uncaughtFrozenStore(that).set(key, value); 5714 else data[that._i] = value; 5715 return that; 5716 }, 5717 ufstore: uncaughtFrozenStore 5718 }; 5719 5720 5721/***/ }), 5722/* 228 */ 5723/***/ (function(module, exports, __webpack_require__) { 5724 5725 'use strict'; 5726 var weak = __webpack_require__(227); 5727 var validate = __webpack_require__(223); 5728 var WEAK_SET = 'WeakSet'; 5729 5730 // 23.4 WeakSet Objects 5731 __webpack_require__(224)(WEAK_SET, function (get) { 5732 return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; 5733 }, { 5734 // 23.4.3.1 WeakSet.prototype.add(value) 5735 add: function add(value) { 5736 return weak.def(validate(this, WEAK_SET), value, true); 5737 } 5738 }, weak, false, true); 5739 5740 5741/***/ }), 5742/* 229 */ 5743/***/ (function(module, exports, __webpack_require__) { 5744 5745 'use strict'; 5746 var $export = __webpack_require__(8); 5747 var $typed = __webpack_require__(230); 5748 var buffer = __webpack_require__(231); 5749 var anObject = __webpack_require__(12); 5750 var toAbsoluteIndex = __webpack_require__(40); 5751 var toLength = __webpack_require__(38); 5752 var isObject = __webpack_require__(13); 5753 var ArrayBuffer = __webpack_require__(4).ArrayBuffer; 5754 var speciesConstructor = __webpack_require__(210); 5755 var $ArrayBuffer = buffer.ArrayBuffer; 5756 var $DataView = buffer.DataView; 5757 var $isView = $typed.ABV && ArrayBuffer.isView; 5758 var $slice = $ArrayBuffer.prototype.slice; 5759 var VIEW = $typed.VIEW; 5760 var ARRAY_BUFFER = 'ArrayBuffer'; 5761 5762 $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer }); 5763 5764 $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { 5765 // 24.1.3.1 ArrayBuffer.isView(arg) 5766 isView: function isView(it) { 5767 return $isView && $isView(it) || isObject(it) && VIEW in it; 5768 } 5769 }); 5770 5771 $export($export.P + $export.U + $export.F * __webpack_require__(7)(function () { 5772 return !new $ArrayBuffer(2).slice(1, undefined).byteLength; 5773 }), ARRAY_BUFFER, { 5774 // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) 5775 slice: function slice(start, end) { 5776 if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix 5777 var len = anObject(this).byteLength; 5778 var first = toAbsoluteIndex(start, len); 5779 var fin = toAbsoluteIndex(end === undefined ? len : end, len); 5780 var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first)); 5781 var viewS = new $DataView(this); 5782 var viewT = new $DataView(result); 5783 var index = 0; 5784 while (first < fin) { 5785 viewT.setUint8(index++, viewS.getUint8(first++)); 5786 } return result; 5787 } 5788 }); 5789 5790 __webpack_require__(194)(ARRAY_BUFFER); 5791 5792 5793/***/ }), 5794/* 230 */ 5795/***/ (function(module, exports, __webpack_require__) { 5796 5797 var global = __webpack_require__(4); 5798 var hide = __webpack_require__(10); 5799 var uid = __webpack_require__(19); 5800 var TYPED = uid('typed_array'); 5801 var VIEW = uid('view'); 5802 var ABV = !!(global.ArrayBuffer && global.DataView); 5803 var CONSTR = ABV; 5804 var i = 0; 5805 var l = 9; 5806 var Typed; 5807 5808 var TypedArrayConstructors = ( 5809 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' 5810 ).split(','); 5811 5812 while (i < l) { 5813 if (Typed = global[TypedArrayConstructors[i++]]) { 5814 hide(Typed.prototype, TYPED, true); 5815 hide(Typed.prototype, VIEW, true); 5816 } else CONSTR = false; 5817 } 5818 5819 module.exports = { 5820 ABV: ABV, 5821 CONSTR: CONSTR, 5822 TYPED: TYPED, 5823 VIEW: VIEW 5824 }; 5825 5826 5827/***/ }), 5828/* 231 */ 5829/***/ (function(module, exports, __webpack_require__) { 5830 5831 'use strict'; 5832 var global = __webpack_require__(4); 5833 var DESCRIPTORS = __webpack_require__(6); 5834 var LIBRARY = __webpack_require__(22); 5835 var $typed = __webpack_require__(230); 5836 var hide = __webpack_require__(10); 5837 var redefineAll = __webpack_require__(220); 5838 var fails = __webpack_require__(7); 5839 var anInstance = __webpack_require__(212); 5840 var toInteger = __webpack_require__(39); 5841 var toLength = __webpack_require__(38); 5842 var toIndex = __webpack_require__(232); 5843 var gOPN = __webpack_require__(51).f; 5844 var dP = __webpack_require__(11).f; 5845 var arrayFill = __webpack_require__(190); 5846 var setToStringTag = __webpack_require__(26); 5847 var ARRAY_BUFFER = 'ArrayBuffer'; 5848 var DATA_VIEW = 'DataView'; 5849 var PROTOTYPE = 'prototype'; 5850 var WRONG_LENGTH = 'Wrong length!'; 5851 var WRONG_INDEX = 'Wrong index!'; 5852 var $ArrayBuffer = global[ARRAY_BUFFER]; 5853 var $DataView = global[DATA_VIEW]; 5854 var Math = global.Math; 5855 var RangeError = global.RangeError; 5856 // eslint-disable-next-line no-shadow-restricted-names 5857 var Infinity = global.Infinity; 5858 var BaseBuffer = $ArrayBuffer; 5859 var abs = Math.abs; 5860 var pow = Math.pow; 5861 var floor = Math.floor; 5862 var log = Math.log; 5863 var LN2 = Math.LN2; 5864 var BUFFER = 'buffer'; 5865 var BYTE_LENGTH = 'byteLength'; 5866 var BYTE_OFFSET = 'byteOffset'; 5867 var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; 5868 var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; 5869 var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; 5870 5871 // IEEE754 conversions based on https://github.com/feross/ieee754 5872 function packIEEE754(value, mLen, nBytes) { 5873 var buffer = new Array(nBytes); 5874 var eLen = nBytes * 8 - mLen - 1; 5875 var eMax = (1 << eLen) - 1; 5876 var eBias = eMax >> 1; 5877 var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; 5878 var i = 0; 5879 var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; 5880 var e, m, c; 5881 value = abs(value); 5882 // eslint-disable-next-line no-self-compare 5883 if (value != value || value === Infinity) { 5884 // eslint-disable-next-line no-self-compare 5885 m = value != value ? 1 : 0; 5886 e = eMax; 5887 } else { 5888 e = floor(log(value) / LN2); 5889 if (value * (c = pow(2, -e)) < 1) { 5890 e--; 5891 c *= 2; 5892 } 5893 if (e + eBias >= 1) { 5894 value += rt / c; 5895 } else { 5896 value += rt * pow(2, 1 - eBias); 5897 } 5898 if (value * c >= 2) { 5899 e++; 5900 c /= 2; 5901 } 5902 if (e + eBias >= eMax) { 5903 m = 0; 5904 e = eMax; 5905 } else if (e + eBias >= 1) { 5906 m = (value * c - 1) * pow(2, mLen); 5907 e = e + eBias; 5908 } else { 5909 m = value * pow(2, eBias - 1) * pow(2, mLen); 5910 e = 0; 5911 } 5912 } 5913 for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); 5914 e = e << mLen | m; 5915 eLen += mLen; 5916 for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); 5917 buffer[--i] |= s * 128; 5918 return buffer; 5919 } 5920 function unpackIEEE754(buffer, mLen, nBytes) { 5921 var eLen = nBytes * 8 - mLen - 1; 5922 var eMax = (1 << eLen) - 1; 5923 var eBias = eMax >> 1; 5924 var nBits = eLen - 7; 5925 var i = nBytes - 1; 5926 var s = buffer[i--]; 5927 var e = s & 127; 5928 var m; 5929 s >>= 7; 5930 for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); 5931 m = e & (1 << -nBits) - 1; 5932 e >>= -nBits; 5933 nBits += mLen; 5934 for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); 5935 if (e === 0) { 5936 e = 1 - eBias; 5937 } else if (e === eMax) { 5938 return m ? NaN : s ? -Infinity : Infinity; 5939 } else { 5940 m = m + pow(2, mLen); 5941 e = e - eBias; 5942 } return (s ? -1 : 1) * m * pow(2, e - mLen); 5943 } 5944 5945 function unpackI32(bytes) { 5946 return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; 5947 } 5948 function packI8(it) { 5949 return [it & 0xff]; 5950 } 5951 function packI16(it) { 5952 return [it & 0xff, it >> 8 & 0xff]; 5953 } 5954 function packI32(it) { 5955 return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; 5956 } 5957 function packF64(it) { 5958 return packIEEE754(it, 52, 8); 5959 } 5960 function packF32(it) { 5961 return packIEEE754(it, 23, 4); 5962 } 5963 5964 function addGetter(C, key, internal) { 5965 dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); 5966 } 5967 5968 function get(view, bytes, index, isLittleEndian) { 5969 var numIndex = +index; 5970 var intIndex = toIndex(numIndex); 5971 if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); 5972 var store = view[$BUFFER]._b; 5973 var start = intIndex + view[$OFFSET]; 5974 var pack = store.slice(start, start + bytes); 5975 return isLittleEndian ? pack : pack.reverse(); 5976 } 5977 function set(view, bytes, index, conversion, value, isLittleEndian) { 5978 var numIndex = +index; 5979 var intIndex = toIndex(numIndex); 5980 if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); 5981 var store = view[$BUFFER]._b; 5982 var start = intIndex + view[$OFFSET]; 5983 var pack = conversion(+value); 5984 for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; 5985 } 5986 5987 if (!$typed.ABV) { 5988 $ArrayBuffer = function ArrayBuffer(length) { 5989 anInstance(this, $ArrayBuffer, ARRAY_BUFFER); 5990 var byteLength = toIndex(length); 5991 this._b = arrayFill.call(new Array(byteLength), 0); 5992 this[$LENGTH] = byteLength; 5993 }; 5994 5995 $DataView = function DataView(buffer, byteOffset, byteLength) { 5996 anInstance(this, $DataView, DATA_VIEW); 5997 anInstance(buffer, $ArrayBuffer, DATA_VIEW); 5998 var bufferLength = buffer[$LENGTH]; 5999 var offset = toInteger(byteOffset); 6000 if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); 6001 byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); 6002 if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); 6003 this[$BUFFER] = buffer; 6004 this[$OFFSET] = offset; 6005 this[$LENGTH] = byteLength; 6006 }; 6007 6008 if (DESCRIPTORS) { 6009 addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); 6010 addGetter($DataView, BUFFER, '_b'); 6011 addGetter($DataView, BYTE_LENGTH, '_l'); 6012 addGetter($DataView, BYTE_OFFSET, '_o'); 6013 } 6014 6015 redefineAll($DataView[PROTOTYPE], { 6016 getInt8: function getInt8(byteOffset) { 6017 return get(this, 1, byteOffset)[0] << 24 >> 24; 6018 }, 6019 getUint8: function getUint8(byteOffset) { 6020 return get(this, 1, byteOffset)[0]; 6021 }, 6022 getInt16: function getInt16(byteOffset /* , littleEndian */) { 6023 var bytes = get(this, 2, byteOffset, arguments[1]); 6024 return (bytes[1] << 8 | bytes[0]) << 16 >> 16; 6025 }, 6026 getUint16: function getUint16(byteOffset /* , littleEndian */) { 6027 var bytes = get(this, 2, byteOffset, arguments[1]); 6028 return bytes[1] << 8 | bytes[0]; 6029 }, 6030 getInt32: function getInt32(byteOffset /* , littleEndian */) { 6031 return unpackI32(get(this, 4, byteOffset, arguments[1])); 6032 }, 6033 getUint32: function getUint32(byteOffset /* , littleEndian */) { 6034 return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; 6035 }, 6036 getFloat32: function getFloat32(byteOffset /* , littleEndian */) { 6037 return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); 6038 }, 6039 getFloat64: function getFloat64(byteOffset /* , littleEndian */) { 6040 return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); 6041 }, 6042 setInt8: function setInt8(byteOffset, value) { 6043 set(this, 1, byteOffset, packI8, value); 6044 }, 6045 setUint8: function setUint8(byteOffset, value) { 6046 set(this, 1, byteOffset, packI8, value); 6047 }, 6048 setInt16: function setInt16(byteOffset, value /* , littleEndian */) { 6049 set(this, 2, byteOffset, packI16, value, arguments[2]); 6050 }, 6051 setUint16: function setUint16(byteOffset, value /* , littleEndian */) { 6052 set(this, 2, byteOffset, packI16, value, arguments[2]); 6053 }, 6054 setInt32: function setInt32(byteOffset, value /* , littleEndian */) { 6055 set(this, 4, byteOffset, packI32, value, arguments[2]); 6056 }, 6057 setUint32: function setUint32(byteOffset, value /* , littleEndian */) { 6058 set(this, 4, byteOffset, packI32, value, arguments[2]); 6059 }, 6060 setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { 6061 set(this, 4, byteOffset, packF32, value, arguments[2]); 6062 }, 6063 setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { 6064 set(this, 8, byteOffset, packF64, value, arguments[2]); 6065 } 6066 }); 6067 } else { 6068 if (!fails(function () { 6069 $ArrayBuffer(1); 6070 }) || !fails(function () { 6071 new $ArrayBuffer(-1); // eslint-disable-line no-new 6072 }) || fails(function () { 6073 new $ArrayBuffer(); // eslint-disable-line no-new 6074 new $ArrayBuffer(1.5); // eslint-disable-line no-new 6075 new $ArrayBuffer(NaN); // eslint-disable-line no-new 6076 return $ArrayBuffer.name != ARRAY_BUFFER; 6077 })) { 6078 $ArrayBuffer = function ArrayBuffer(length) { 6079 anInstance(this, $ArrayBuffer); 6080 return new BaseBuffer(toIndex(length)); 6081 }; 6082 var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; 6083 for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { 6084 if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); 6085 } 6086 if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; 6087 } 6088 // iOS Safari 7.x bug 6089 var view = new $DataView(new $ArrayBuffer(2)); 6090 var $setInt8 = $DataView[PROTOTYPE].setInt8; 6091 view.setInt8(0, 2147483648); 6092 view.setInt8(1, 2147483649); 6093 if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { 6094 setInt8: function setInt8(byteOffset, value) { 6095 $setInt8.call(this, byteOffset, value << 24 >> 24); 6096 }, 6097 setUint8: function setUint8(byteOffset, value) { 6098 $setInt8.call(this, byteOffset, value << 24 >> 24); 6099 } 6100 }, true); 6101 } 6102 setToStringTag($ArrayBuffer, ARRAY_BUFFER); 6103 setToStringTag($DataView, DATA_VIEW); 6104 hide($DataView[PROTOTYPE], $typed.VIEW, true); 6105 exports[ARRAY_BUFFER] = $ArrayBuffer; 6106 exports[DATA_VIEW] = $DataView; 6107 6108 6109/***/ }), 6110/* 232 */ 6111/***/ (function(module, exports, __webpack_require__) { 6112 6113 // https://tc39.github.io/ecma262/#sec-toindex 6114 var toInteger = __webpack_require__(39); 6115 var toLength = __webpack_require__(38); 6116 module.exports = function (it) { 6117 if (it === undefined) return 0; 6118 var number = toInteger(it); 6119 var length = toLength(number); 6120 if (number !== length) throw RangeError('Wrong length!'); 6121 return length; 6122 }; 6123 6124 6125/***/ }), 6126/* 233 */ 6127/***/ (function(module, exports, __webpack_require__) { 6128 6129 var $export = __webpack_require__(8); 6130 $export($export.G + $export.W + $export.F * !__webpack_require__(230).ABV, { 6131 DataView: __webpack_require__(231).DataView 6132 }); 6133 6134 6135/***/ }), 6136/* 234 */ 6137/***/ (function(module, exports, __webpack_require__) { 6138 6139 __webpack_require__(235)('Int8', 1, function (init) { 6140 return function Int8Array(data, byteOffset, length) { 6141 return init(this, data, byteOffset, length); 6142 }; 6143 }); 6144 6145 6146/***/ }), 6147/* 235 */ 6148/***/ (function(module, exports, __webpack_require__) { 6149 6150 'use strict'; 6151 if (__webpack_require__(6)) { 6152 var LIBRARY = __webpack_require__(22); 6153 var global = __webpack_require__(4); 6154 var fails = __webpack_require__(7); 6155 var $export = __webpack_require__(8); 6156 var $typed = __webpack_require__(230); 6157 var $buffer = __webpack_require__(231); 6158 var ctx = __webpack_require__(23); 6159 var anInstance = __webpack_require__(212); 6160 var propertyDesc = __webpack_require__(17); 6161 var hide = __webpack_require__(10); 6162 var redefineAll = __webpack_require__(220); 6163 var toInteger = __webpack_require__(39); 6164 var toLength = __webpack_require__(38); 6165 var toIndex = __webpack_require__(232); 6166 var toAbsoluteIndex = __webpack_require__(40); 6167 var toPrimitive = __webpack_require__(16); 6168 var has = __webpack_require__(5); 6169 var classof = __webpack_require__(75); 6170 var isObject = __webpack_require__(13); 6171 var toObject = __webpack_require__(46); 6172 var isArrayIter = __webpack_require__(164); 6173 var create = __webpack_require__(47); 6174 var getPrototypeOf = __webpack_require__(59); 6175 var gOPN = __webpack_require__(51).f; 6176 var getIterFn = __webpack_require__(166); 6177 var uid = __webpack_require__(19); 6178 var wks = __webpack_require__(27); 6179 var createArrayMethod = __webpack_require__(174); 6180 var createArrayIncludes = __webpack_require__(37); 6181 var speciesConstructor = __webpack_require__(210); 6182 var ArrayIterators = __webpack_require__(195); 6183 var Iterators = __webpack_require__(130); 6184 var $iterDetect = __webpack_require__(167); 6185 var setSpecies = __webpack_require__(194); 6186 var arrayFill = __webpack_require__(190); 6187 var arrayCopyWithin = __webpack_require__(187); 6188 var $DP = __webpack_require__(11); 6189 var $GOPD = __webpack_require__(52); 6190 var dP = $DP.f; 6191 var gOPD = $GOPD.f; 6192 var RangeError = global.RangeError; 6193 var TypeError = global.TypeError; 6194 var Uint8Array = global.Uint8Array; 6195 var ARRAY_BUFFER = 'ArrayBuffer'; 6196 var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; 6197 var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; 6198 var PROTOTYPE = 'prototype'; 6199 var ArrayProto = Array[PROTOTYPE]; 6200 var $ArrayBuffer = $buffer.ArrayBuffer; 6201 var $DataView = $buffer.DataView; 6202 var arrayForEach = createArrayMethod(0); 6203 var arrayFilter = createArrayMethod(2); 6204 var arraySome = createArrayMethod(3); 6205 var arrayEvery = createArrayMethod(4); 6206 var arrayFind = createArrayMethod(5); 6207 var arrayFindIndex = createArrayMethod(6); 6208 var arrayIncludes = createArrayIncludes(true); 6209 var arrayIndexOf = createArrayIncludes(false); 6210 var arrayValues = ArrayIterators.values; 6211 var arrayKeys = ArrayIterators.keys; 6212 var arrayEntries = ArrayIterators.entries; 6213 var arrayLastIndexOf = ArrayProto.lastIndexOf; 6214 var arrayReduce = ArrayProto.reduce; 6215 var arrayReduceRight = ArrayProto.reduceRight; 6216 var arrayJoin = ArrayProto.join; 6217 var arraySort = ArrayProto.sort; 6218 var arraySlice = ArrayProto.slice; 6219 var arrayToString = ArrayProto.toString;
vendor: 13,453 bytes, lines 6220-6569
6220 var arrayToLocaleString = ArrayProto.toLocaleString; 6221 var ITERATOR = wks('iterator'); 6222 var TAG = wks('toStringTag'); 6223 var TYPED_CONSTRUCTOR = uid('typed_constructor'); 6224 var DEF_CONSTRUCTOR = uid('def_constructor'); 6225 var ALL_CONSTRUCTORS = $typed.CONSTR; 6226 var TYPED_ARRAY = $typed.TYPED; 6227 var VIEW = $typed.VIEW; 6228 var WRONG_LENGTH = 'Wrong length!'; 6229 6230 var $map = createArrayMethod(1, function (O, length) { 6231 return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); 6232 }); 6233 6234 var LITTLE_ENDIAN = fails(function () { 6235 // eslint-disable-next-line no-undef 6236 return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; 6237 }); 6238 6239 var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { 6240 new Uint8Array(1).set({}); 6241 }); 6242 6243 var toOffset = function (it, BYTES) { 6244 var offset = toInteger(it); 6245 if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); 6246 return offset; 6247 }; 6248 6249 var validate = function (it) { 6250 if (isObject(it) && TYPED_ARRAY in it) return it; 6251 throw TypeError(it + ' is not a typed array!'); 6252 }; 6253 6254 var allocate = function (C, length) { 6255 if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { 6256 throw TypeError('It is not a typed array constructor!'); 6257 } return new C(length); 6258 }; 6259 6260 var speciesFromList = function (O, list) { 6261 return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); 6262 }; 6263 6264 var fromList = function (C, list) { 6265 var index = 0; 6266 var length = list.length; 6267 var result = allocate(C, length); 6268 while (length > index) result[index] = list[index++]; 6269 return result; 6270 }; 6271 6272 var addGetter = function (it, key, internal) { 6273 dP(it, key, { get: function () { return this._d[internal]; } }); 6274 }; 6275 6276 var $from = function from(source /* , mapfn, thisArg */) { 6277 var O = toObject(source); 6278 var aLen = arguments.length; 6279 var mapfn = aLen > 1 ? arguments[1] : undefined; 6280 var mapping = mapfn !== undefined; 6281 var iterFn = getIterFn(O); 6282 var i, length, values, result, step, iterator; 6283 if (iterFn != undefined && !isArrayIter(iterFn)) { 6284 for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { 6285 values.push(step.value); 6286 } O = values; 6287 } 6288 if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); 6289 for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { 6290 result[i] = mapping ? mapfn(O[i], i) : O[i]; 6291 } 6292 return result; 6293 }; 6294 6295 var $of = function of(/* ...items */) { 6296 var index = 0; 6297 var length = arguments.length; 6298 var result = allocate(this, length); 6299 while (length > index) result[index] = arguments[index++]; 6300 return result; 6301 }; 6302 6303 // iOS Safari 6.x fails here 6304 var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); 6305 6306 var $toLocaleString = function toLocaleString() { 6307 return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); 6308 }; 6309 6310 var proto = { 6311 copyWithin: function copyWithin(target, start /* , end */) { 6312 return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); 6313 }, 6314 every: function every(callbackfn /* , thisArg */) { 6315 return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 6316 }, 6317 fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars 6318 return arrayFill.apply(validate(this), arguments); 6319 }, 6320 filter: function filter(callbackfn /* , thisArg */) { 6321 return speciesFromList(this, arrayFilter(validate(this), callbackfn, 6322 arguments.length > 1 ? arguments[1] : undefined)); 6323 }, 6324 find: function find(predicate /* , thisArg */) { 6325 return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); 6326 }, 6327 findIndex: function findIndex(predicate /* , thisArg */) { 6328 return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); 6329 }, 6330 forEach: function forEach(callbackfn /* , thisArg */) { 6331 arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 6332 }, 6333 indexOf: function indexOf(searchElement /* , fromIndex */) { 6334 return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); 6335 }, 6336 includes: function includes(searchElement /* , fromIndex */) { 6337 return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); 6338 }, 6339 join: function join(separator) { // eslint-disable-line no-unused-vars 6340 return arrayJoin.apply(validate(this), arguments); 6341 }, 6342 lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars 6343 return arrayLastIndexOf.apply(validate(this), arguments); 6344 }, 6345 map: function map(mapfn /* , thisArg */) { 6346 return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); 6347 }, 6348 reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars 6349 return arrayReduce.apply(validate(this), arguments); 6350 }, 6351 reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars 6352 return arrayReduceRight.apply(validate(this), arguments); 6353 }, 6354 reverse: function reverse() { 6355 var that = this; 6356 var length = validate(that).length; 6357 var middle = Math.floor(length / 2); 6358 var index = 0; 6359 var value; 6360 while (index < middle) { 6361 value = that[index]; 6362 that[index++] = that[--length]; 6363 that[length] = value; 6364 } return that; 6365 }, 6366 some: function some(callbackfn /* , thisArg */) { 6367 return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); 6368 }, 6369 sort: function sort(comparefn) { 6370 return arraySort.call(validate(this), comparefn); 6371 }, 6372 subarray: function subarray(begin, end) { 6373 var O = validate(this); 6374 var length = O.length; 6375 var $begin = toAbsoluteIndex(begin, length); 6376 return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( 6377 O.buffer, 6378 O.byteOffset + $begin * O.BYTES_PER_ELEMENT, 6379 toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) 6380 ); 6381 } 6382 }; 6383 6384 var $slice = function slice(start, end) { 6385 return speciesFromList(this, arraySlice.call(validate(this), start, end)); 6386 }; 6387 6388 var $set = function set(arrayLike /* , offset */) { 6389 validate(this); 6390 var offset = toOffset(arguments[1], 1); 6391 var length = this.length; 6392 var src = toObject(arrayLike); 6393 var len = toLength(src.length); 6394 var index = 0; 6395 if (len + offset > length) throw RangeError(WRONG_LENGTH); 6396 while (index < len) this[offset + index] = src[index++]; 6397 }; 6398 6399 var $iterators = { 6400 entries: function entries() { 6401 return arrayEntries.call(validate(this)); 6402 }, 6403 keys: function keys() { 6404 return arrayKeys.call(validate(this)); 6405 }, 6406 values: function values() { 6407 return arrayValues.call(validate(this)); 6408 } 6409 }; 6410 6411 var isTAIndex = function (target, key) { 6412 return isObject(target) 6413 && target[TYPED_ARRAY] 6414 && typeof key != 'symbol' 6415 && key in target 6416 && String(+key) == String(key); 6417 }; 6418 var $getDesc = function getOwnPropertyDescriptor(target, key) { 6419 return isTAIndex(target, key = toPrimitive(key, true)) 6420 ? propertyDesc(2, target[key]) 6421 : gOPD(target, key); 6422 }; 6423 var $setDesc = function defineProperty(target, key, desc) { 6424 if (isTAIndex(target, key = toPrimitive(key, true)) 6425 && isObject(desc) 6426 && has(desc, 'value') 6427 && !has(desc, 'get') 6428 && !has(desc, 'set') 6429 // TODO: add validation descriptor w/o calling accessors 6430 && !desc.configurable 6431 && (!has(desc, 'writable') || desc.writable) 6432 && (!has(desc, 'enumerable') || desc.enumerable) 6433 ) { 6434 target[key] = desc.value; 6435 return target; 6436 } return dP(target, key, desc); 6437 }; 6438 6439 if (!ALL_CONSTRUCTORS) { 6440 $GOPD.f = $getDesc; 6441 $DP.f = $setDesc; 6442 } 6443 6444 $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { 6445 getOwnPropertyDescriptor: $getDesc, 6446 defineProperty: $setDesc 6447 }); 6448 6449 if (fails(function () { arrayToString.call({}); })) { 6450 arrayToString = arrayToLocaleString = function toString() { 6451 return arrayJoin.call(this); 6452 }; 6453 } 6454 6455 var $TypedArrayPrototype$ = redefineAll({}, proto); 6456 redefineAll($TypedArrayPrototype$, $iterators); 6457 hide($TypedArrayPrototype$, ITERATOR, $iterators.values); 6458 redefineAll($TypedArrayPrototype$, { 6459 slice: $slice, 6460 set: $set, 6461 constructor: function () { /* noop */ }, 6462 toString: arrayToString, 6463 toLocaleString: $toLocaleString 6464 }); 6465 addGetter($TypedArrayPrototype$, 'buffer', 'b'); 6466 addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); 6467 addGetter($TypedArrayPrototype$, 'byteLength', 'l'); 6468 addGetter($TypedArrayPrototype$, 'length', 'e'); 6469 dP($TypedArrayPrototype$, TAG, { 6470 get: function () { return this[TYPED_ARRAY]; } 6471 }); 6472 6473 // eslint-disable-next-line max-statements 6474 module.exports = function (KEY, BYTES, wrapper, CLAMPED) { 6475 CLAMPED = !!CLAMPED; 6476 var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; 6477 var GETTER = 'get' + KEY; 6478 var SETTER = 'set' + KEY; 6479 var TypedArray = global[NAME]; 6480 var Base = TypedArray || {}; 6481 var TAC = TypedArray && getPrototypeOf(TypedArray); 6482 var FORCED = !TypedArray || !$typed.ABV; 6483 var O = {}; 6484 var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; 6485 var getter = function (that, index) { 6486 var data = that._d; 6487 return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); 6488 }; 6489 var setter = function (that, index, value) { 6490 var data = that._d; 6491 if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; 6492 data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); 6493 }; 6494 var addElement = function (that, index) { 6495 dP(that, index, { 6496 get: function () { 6497 return getter(this, index); 6498 }, 6499 set: function (value) { 6500 return setter(this, index, value); 6501 }, 6502 enumerable: true 6503 }); 6504 }; 6505 if (FORCED) { 6506 TypedArray = wrapper(function (that, data, $offset, $length) { 6507 anInstance(that, TypedArray, NAME, '_d'); 6508 var index = 0; 6509 var offset = 0; 6510 var buffer, byteLength, length, klass; 6511 if (!isObject(data)) { 6512 length = toIndex(data); 6513 byteLength = length * BYTES; 6514 buffer = new $ArrayBuffer(byteLength); 6515 } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { 6516 buffer = data; 6517 offset = toOffset($offset, BYTES); 6518 var $len = data.byteLength; 6519 if ($length === undefined) { 6520 if ($len % BYTES) throw RangeError(WRONG_LENGTH); 6521 byteLength = $len - offset; 6522 if (byteLength < 0) throw RangeError(WRONG_LENGTH); 6523 } else { 6524 byteLength = toLength($length) * BYTES; 6525 if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); 6526 } 6527 length = byteLength / BYTES; 6528 } else if (TYPED_ARRAY in data) { 6529 return fromList(TypedArray, data); 6530 } else { 6531 return $from.call(TypedArray, data); 6532 } 6533 hide(that, '_d', { 6534 b: buffer, 6535 o: offset, 6536 l: byteLength, 6537 e: length, 6538 v: new $DataView(buffer) 6539 }); 6540 while (index < length) addElement(that, index++); 6541 }); 6542 TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); 6543 hide(TypedArrayPrototype, 'constructor', TypedArray); 6544 } else if (!fails(function () { 6545 TypedArray(1); 6546 }) || !fails(function () { 6547 new TypedArray(-1); // eslint-disable-line no-new 6548 }) || !$iterDetect(function (iter) { 6549 new TypedArray(); // eslint-disable-line no-new 6550 new TypedArray(null); // eslint-disable-line no-new 6551 new TypedArray(1.5); // eslint-disable-line no-new 6552 new TypedArray(iter); // eslint-disable-line no-new 6553 }, true)) { 6554 TypedArray = wrapper(function (that, data, $offset, $length) { 6555 anInstance(that, TypedArray, NAME); 6556 var klass; 6557 // `ws` module bug, temporarily remove validation length for Uint8Array 6558 // https://github.com/websockets/ws/pull/645 6559 if (!isObject(data)) return new Base(toIndex(data)); 6560 if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { 6561 return $length !== undefined 6562 ? new Base(data, toOffset($offset, BYTES), $length) 6563 : $offset !== undefined 6564 ? new Base(data, toOffset($offset, BYTES)) 6565 : new Base(data); 6566 } 6567 if (TYPED_ARRAY in data) return fromList(TypedArray, data); 6568 return $from.call(TypedArray, data); 6569 });
vendor: 14,311 bytes, lines 6570-7038
6570 arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { 6571 if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); 6572 }); 6573 TypedArray[PROTOTYPE] = TypedArrayPrototype; 6574 if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; 6575 } 6576 var $nativeIterator = TypedArrayPrototype[ITERATOR]; 6577 var CORRECT_ITER_NAME = !!$nativeIterator 6578 && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); 6579 var $iterator = $iterators.values; 6580 hide(TypedArray, TYPED_CONSTRUCTOR, true); 6581 hide(TypedArrayPrototype, TYPED_ARRAY, NAME); 6582 hide(TypedArrayPrototype, VIEW, true); 6583 hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); 6584 6585 if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { 6586 dP(TypedArrayPrototype, TAG, { 6587 get: function () { return NAME; } 6588 }); 6589 } 6590 6591 O[NAME] = TypedArray; 6592 6593 $export($export.G + $export.W + $export.F * (TypedArray != Base), O); 6594 6595 $export($export.S, NAME, { 6596 BYTES_PER_ELEMENT: BYTES 6597 }); 6598 6599 $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { 6600 from: $from, 6601 of: $of 6602 }); 6603 6604 if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); 6605 6606 $export($export.P, NAME, proto); 6607 6608 setSpecies(NAME); 6609 6610 $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); 6611 6612 $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); 6613 6614 if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; 6615 6616 $export($export.P + $export.F * fails(function () { 6617 new TypedArray(1).slice(); 6618 }), NAME, { slice: $slice }); 6619 6620 $export($export.P + $export.F * (fails(function () { 6621 return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); 6622 }) || !fails(function () { 6623 TypedArrayPrototype.toLocaleString.call([1, 2]); 6624 })), NAME, { toLocaleString: $toLocaleString }); 6625 6626 Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; 6627 if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); 6628 }; 6629 } else module.exports = function () { /* empty */ }; 6630 6631 6632/***/ }), 6633/* 236 */ 6634/***/ (function(module, exports, __webpack_require__) { 6635 6636 __webpack_require__(235)('Uint8', 1, function (init) { 6637 return function Uint8Array(data, byteOffset, length) { 6638 return init(this, data, byteOffset, length); 6639 }; 6640 }); 6641 6642 6643/***/ }), 6644/* 237 */ 6645/***/ (function(module, exports, __webpack_require__) { 6646 6647 __webpack_require__(235)('Uint8', 1, function (init) { 6648 return function Uint8ClampedArray(data, byteOffset, length) { 6649 return init(this, data, byteOffset, length); 6650 }; 6651 }, true); 6652 6653 6654/***/ }), 6655/* 238 */ 6656/***/ (function(module, exports, __webpack_require__) { 6657 6658 __webpack_require__(235)('Int16', 2, function (init) { 6659 return function Int16Array(data, byteOffset, length) { 6660 return init(this, data, byteOffset, length); 6661 }; 6662 }); 6663 6664 6665/***/ }), 6666/* 239 */ 6667/***/ (function(module, exports, __webpack_require__) { 6668 6669 __webpack_require__(235)('Uint16', 2, function (init) { 6670 return function Uint16Array(data, byteOffset, length) { 6671 return init(this, data, byteOffset, length); 6672 }; 6673 }); 6674 6675 6676/***/ }), 6677/* 240 */ 6678/***/ (function(module, exports, __webpack_require__) { 6679 6680 __webpack_require__(235)('Int32', 4, function (init) { 6681 return function Int32Array(data, byteOffset, length) { 6682 return init(this, data, byteOffset, length); 6683 }; 6684 }); 6685 6686 6687/***/ }), 6688/* 241 */ 6689/***/ (function(module, exports, __webpack_require__) { 6690 6691 __webpack_require__(235)('Uint32', 4, function (init) { 6692 return function Uint32Array(data, byteOffset, length) { 6693 return init(this, data, byteOffset, length); 6694 }; 6695 }); 6696 6697 6698/***/ }), 6699/* 242 */ 6700/***/ (function(module, exports, __webpack_require__) { 6701 6702 __webpack_require__(235)('Float32', 4, function (init) { 6703 return function Float32Array(data, byteOffset, length) { 6704 return init(this, data, byteOffset, length); 6705 }; 6706 }); 6707 6708 6709/***/ }), 6710/* 243 */ 6711/***/ (function(module, exports, __webpack_require__) { 6712 6713 __webpack_require__(235)('Float64', 8, function (init) { 6714 return function Float64Array(data, byteOffset, length) { 6715 return init(this, data, byteOffset, length); 6716 }; 6717 }); 6718 6719 6720/***/ }), 6721/* 244 */ 6722/***/ (function(module, exports, __webpack_require__) { 6723 6724 // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) 6725 var $export = __webpack_require__(8); 6726 var aFunction = __webpack_require__(24); 6727 var anObject = __webpack_require__(12); 6728 var rApply = (__webpack_require__(4).Reflect || {}).apply; 6729 var fApply = Function.apply; 6730 // MS Edge argumentsList argument is optional 6731 $export($export.S + $export.F * !__webpack_require__(7)(function () { 6732 rApply(function () { /* empty */ }); 6733 }), 'Reflect', { 6734 apply: function apply(target, thisArgument, argumentsList) { 6735 var T = aFunction(target); 6736 var L = anObject(argumentsList); 6737 return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); 6738 } 6739 }); 6740 6741 6742/***/ }), 6743/* 245 */ 6744/***/ (function(module, exports, __webpack_require__) { 6745 6746 // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) 6747 var $export = __webpack_require__(8); 6748 var create = __webpack_require__(47); 6749 var aFunction = __webpack_require__(24); 6750 var anObject = __webpack_require__(12); 6751 var isObject = __webpack_require__(13); 6752 var fails = __webpack_require__(7); 6753 var bind = __webpack_require__(77); 6754 var rConstruct = (__webpack_require__(4).Reflect || {}).construct; 6755 6756 // MS Edge supports only 2 arguments and argumentsList argument is optional 6757 // FF Nightly sets third argument as `new.target`, but does not create `this` from it 6758 var NEW_TARGET_BUG = fails(function () { 6759 function F() { /* empty */ } 6760 return !(rConstruct(function () { /* empty */ }, [], F) instanceof F); 6761 }); 6762 var ARGS_BUG = !fails(function () { 6763 rConstruct(function () { /* empty */ }); 6764 }); 6765 6766 $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { 6767 construct: function construct(Target, args /* , newTarget */) { 6768 aFunction(Target); 6769 anObject(args); 6770 var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); 6771 if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); 6772 if (Target == newTarget) { 6773 // w/o altered newTarget, optimization for 0-4 arguments 6774 switch (args.length) { 6775 case 0: return new Target(); 6776 case 1: return new Target(args[0]); 6777 case 2: return new Target(args[0], args[1]); 6778 case 3: return new Target(args[0], args[1], args[2]); 6779 case 4: return new Target(args[0], args[1], args[2], args[3]); 6780 } 6781 // w/o altered newTarget, lot of arguments case 6782 var $args = [null]; 6783 $args.push.apply($args, args); 6784 return new (bind.apply(Target, $args))(); 6785 } 6786 // with altered newTarget, not support built-in constructors 6787 var proto = newTarget.prototype; 6788 var instance = create(isObject(proto) ? proto : Object.prototype); 6789 var result = Function.apply.call(Target, instance, args); 6790 return isObject(result) ? result : instance; 6791 } 6792 }); 6793 6794 6795/***/ }), 6796/* 246 */ 6797/***/ (function(module, exports, __webpack_require__) { 6798 6799 // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) 6800 var dP = __webpack_require__(11); 6801 var $export = __webpack_require__(8); 6802 var anObject = __webpack_require__(12); 6803 var toPrimitive = __webpack_require__(16); 6804 6805 // MS Edge has broken Reflect.defineProperty - throwing instead of returning false 6806 $export($export.S + $export.F * __webpack_require__(7)(function () { 6807 // eslint-disable-next-line no-undef 6808 Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); 6809 }), 'Reflect', { 6810 defineProperty: function defineProperty(target, propertyKey, attributes) { 6811 anObject(target); 6812 propertyKey = toPrimitive(propertyKey, true); 6813 anObject(attributes); 6814 try { 6815 dP.f(target, propertyKey, attributes); 6816 return true; 6817 } catch (e) { 6818 return false; 6819 } 6820 } 6821 }); 6822 6823 6824/***/ }), 6825/* 247 */ 6826/***/ (function(module, exports, __webpack_require__) { 6827 6828 // 26.1.4 Reflect.deleteProperty(target, propertyKey) 6829 var $export = __webpack_require__(8); 6830 var gOPD = __webpack_require__(52).f; 6831 var anObject = __webpack_require__(12); 6832 6833 $export($export.S, 'Reflect', { 6834 deleteProperty: function deleteProperty(target, propertyKey) { 6835 var desc = gOPD(anObject(target), propertyKey); 6836 return desc && !desc.configurable ? false : delete target[propertyKey]; 6837 } 6838 }); 6839 6840 6841/***/ }), 6842/* 248 */ 6843/***/ (function(module, exports, __webpack_require__) { 6844 6845 'use strict'; 6846 // 26.1.5 Reflect.enumerate(target) 6847 var $export = __webpack_require__(8); 6848 var anObject = __webpack_require__(12); 6849 var Enumerate = function (iterated) { 6850 this._t = anObject(iterated); // target 6851 this._i = 0; // next index 6852 var keys = this._k = []; // keys 6853 var key; 6854 for (key in iterated) keys.push(key); 6855 }; 6856 __webpack_require__(131)(Enumerate, 'Object', function () { 6857 var that = this; 6858 var keys = that._k; 6859 var key; 6860 do { 6861 if (that._i >= keys.length) return { value: undefined, done: true }; 6862 } while (!((key = keys[that._i++]) in that._t)); 6863 return { value: key, done: false }; 6864 }); 6865 6866 $export($export.S, 'Reflect', { 6867 enumerate: function enumerate(target) { 6868 return new Enumerate(target); 6869 } 6870 }); 6871 6872 6873/***/ }), 6874/* 249 */ 6875/***/ (function(module, exports, __webpack_require__) { 6876 6877 // 26.1.6 Reflect.get(target, propertyKey [, receiver]) 6878 var gOPD = __webpack_require__(52); 6879 var getPrototypeOf = __webpack_require__(59); 6880 var has = __webpack_require__(5); 6881 var $export = __webpack_require__(8); 6882 var isObject = __webpack_require__(13); 6883 var anObject = __webpack_require__(12); 6884 6885 function get(target, propertyKey /* , receiver */) { 6886 var receiver = arguments.length < 3 ? target : arguments[2]; 6887 var desc, proto; 6888 if (anObject(target) === receiver) return target[propertyKey]; 6889 if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') 6890 ? desc.value 6891 : desc.get !== undefined 6892 ? desc.get.call(receiver) 6893 : undefined; 6894 if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver); 6895 } 6896 6897 $export($export.S, 'Reflect', { get: get }); 6898 6899 6900/***/ }), 6901/* 250 */ 6902/***/ (function(module, exports, __webpack_require__) { 6903 6904 // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) 6905 var gOPD = __webpack_require__(52); 6906 var $export = __webpack_require__(8); 6907 var anObject = __webpack_require__(12); 6908 6909 $export($export.S, 'Reflect', { 6910 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { 6911 return gOPD.f(anObject(target), propertyKey); 6912 } 6913 }); 6914 6915 6916/***/ }), 6917/* 251 */ 6918/***/ (function(module, exports, __webpack_require__) { 6919 6920 // 26.1.8 Reflect.getPrototypeOf(target) 6921 var $export = __webpack_require__(8); 6922 var getProto = __webpack_require__(59); 6923 var anObject = __webpack_require__(12); 6924 6925 $export($export.S, 'Reflect', { 6926 getPrototypeOf: function getPrototypeOf(target) { 6927 return getProto(anObject(target)); 6928 } 6929 }); 6930 6931 6932/***/ }), 6933/* 252 */ 6934/***/ (function(module, exports, __webpack_require__) { 6935 6936 // 26.1.9 Reflect.has(target, propertyKey) 6937 var $export = __webpack_require__(8); 6938 6939 $export($export.S, 'Reflect', { 6940 has: function has(target, propertyKey) { 6941 return propertyKey in target; 6942 } 6943 }); 6944 6945 6946/***/ }), 6947/* 253 */ 6948/***/ (function(module, exports, __webpack_require__) { 6949 6950 // 26.1.10 Reflect.isExtensible(target) 6951 var $export = __webpack_require__(8); 6952 var anObject = __webpack_require__(12); 6953 var $isExtensible = Object.isExtensible; 6954 6955 $export($export.S, 'Reflect', { 6956 isExtensible: function isExtensible(target) { 6957 anObject(target); 6958 return $isExtensible ? $isExtensible(target) : true; 6959 } 6960 }); 6961 6962 6963/***/ }), 6964/* 254 */ 6965/***/ (function(module, exports, __webpack_require__) { 6966 6967 // 26.1.11 Reflect.ownKeys(target) 6968 var $export = __webpack_require__(8); 6969 6970 $export($export.S, 'Reflect', { ownKeys: __webpack_require__(255) }); 6971 6972 6973/***/ }), 6974/* 255 */ 6975/***/ (function(module, exports, __webpack_require__) { 6976 6977 // all object keys, includes non-enumerable and symbols 6978 var gOPN = __webpack_require__(51); 6979 var gOPS = __webpack_require__(43); 6980 var anObject = __webpack_require__(12); 6981 var Reflect = __webpack_require__(4).Reflect; 6982 module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { 6983 var keys = gOPN.f(anObject(it)); 6984 var getSymbols = gOPS.f; 6985 return getSymbols ? keys.concat(getSymbols(it)) : keys; 6986 }; 6987 6988 6989/***/ }), 6990/* 256 */ 6991/***/ (function(module, exports, __webpack_require__) { 6992 6993 // 26.1.12 Reflect.preventExtensions(target) 6994 var $export = __webpack_require__(8); 6995 var anObject = __webpack_require__(12); 6996 var $preventExtensions = Object.preventExtensions; 6997 6998 $export($export.S, 'Reflect', { 6999 preventExtensions: function preventExtensions(target) { 7000 anObject(target); 7001 try { 7002 if ($preventExtensions) $preventExtensions(target); 7003 return true; 7004 } catch (e) { 7005 return false; 7006 } 7007 } 7008 }); 7009 7010 7011/***/ }), 7012/* 257 */ 7013/***/ (function(module, exports, __webpack_require__) { 7014 7015 // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) 7016 var dP = __webpack_require__(11); 7017 var gOPD = __webpack_require__(52); 7018 var getPrototypeOf = __webpack_require__(59); 7019 var has = __webpack_require__(5); 7020 var $export = __webpack_require__(8); 7021 var createDesc = __webpack_require__(17); 7022 var anObject = __webpack_require__(12); 7023 var isObject = __webpack_require__(13); 7024 7025 function set(target, propertyKey, V /* , receiver */) { 7026 var receiver = arguments.length < 4 ? target : arguments[3]; 7027 var ownDesc = gOPD.f(anObject(target), propertyKey); 7028 var existingDescriptor, proto; 7029 if (!ownDesc) { 7030 if (isObject(proto = getPrototypeOf(target))) { 7031 return set(proto, propertyKey, V, receiver); 7032 } 7033 ownDesc = createDesc(0); 7034 } 7035 if (has(ownDesc, 'value')) { 7036 if (ownDesc.writable === false || !isObject(receiver)) return false; 7037 if (existingDescriptor = gOPD.f(receiver, propertyKey)) { 7038 if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
vendor: 16,001 bytes, lines 7039-7613
7039 existingDescriptor.value = V; 7040 dP.f(receiver, propertyKey, existingDescriptor); 7041 } else dP.f(receiver, propertyKey, createDesc(0, V)); 7042 return true; 7043 } 7044 return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); 7045 } 7046 7047 $export($export.S, 'Reflect', { set: set }); 7048 7049 7050/***/ }), 7051/* 258 */ 7052/***/ (function(module, exports, __webpack_require__) { 7053 7054 // 26.1.14 Reflect.setPrototypeOf(target, proto) 7055 var $export = __webpack_require__(8); 7056 var setProto = __webpack_require__(73); 7057 7058 if (setProto) $export($export.S, 'Reflect', { 7059 setPrototypeOf: function setPrototypeOf(target, proto) { 7060 setProto.check(target, proto); 7061 try { 7062 setProto.set(target, proto); 7063 return true; 7064 } catch (e) { 7065 return false; 7066 } 7067 } 7068 }); 7069 7070 7071/***/ }), 7072/* 259 */ 7073/***/ (function(module, exports, __webpack_require__) { 7074 7075 'use strict'; 7076 // https://github.com/tc39/Array.prototype.includes 7077 var $export = __webpack_require__(8); 7078 var $includes = __webpack_require__(37)(true); 7079 7080 $export($export.P, 'Array', { 7081 includes: function includes(el /* , fromIndex = 0 */) { 7082 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); 7083 } 7084 }); 7085 7086 __webpack_require__(188)('includes'); 7087 7088 7089/***/ }), 7090/* 260 */ 7091/***/ (function(module, exports, __webpack_require__) { 7092 7093 'use strict'; 7094 // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap 7095 var $export = __webpack_require__(8); 7096 var flattenIntoArray = __webpack_require__(261); 7097 var toObject = __webpack_require__(46); 7098 var toLength = __webpack_require__(38); 7099 var aFunction = __webpack_require__(24); 7100 var arraySpeciesCreate = __webpack_require__(175); 7101 7102 $export($export.P, 'Array', { 7103 flatMap: function flatMap(callbackfn /* , thisArg */) { 7104 var O = toObject(this); 7105 var sourceLen, A; 7106 aFunction(callbackfn); 7107 sourceLen = toLength(O.length); 7108 A = arraySpeciesCreate(O, 0); 7109 flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]); 7110 return A; 7111 } 7112 }); 7113 7114 __webpack_require__(188)('flatMap'); 7115 7116 7117/***/ }), 7118/* 261 */ 7119/***/ (function(module, exports, __webpack_require__) { 7120 7121 'use strict'; 7122 // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray 7123 var isArray = __webpack_require__(45); 7124 var isObject = __webpack_require__(13); 7125 var toLength = __webpack_require__(38); 7126 var ctx = __webpack_require__(23); 7127 var IS_CONCAT_SPREADABLE = __webpack_require__(27)('isConcatSpreadable'); 7128 7129 function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) { 7130 var targetIndex = start; 7131 var sourceIndex = 0; 7132 var mapFn = mapper ? ctx(mapper, thisArg, 3) : false; 7133 var element, spreadable; 7134 7135 while (sourceIndex < sourceLen) { 7136 if (sourceIndex in source) { 7137 element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; 7138 7139 spreadable = false; 7140 if (isObject(element)) { 7141 spreadable = element[IS_CONCAT_SPREADABLE]; 7142 spreadable = spreadable !== undefined ? !!spreadable : isArray(element); 7143 } 7144 7145 if (spreadable && depth > 0) { 7146 targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; 7147 } else { 7148 if (targetIndex >= 0x1fffffffffffff) throw TypeError(); 7149 target[targetIndex] = element; 7150 } 7151 7152 targetIndex++; 7153 } 7154 sourceIndex++; 7155 } 7156 return targetIndex; 7157 } 7158 7159 module.exports = flattenIntoArray; 7160 7161 7162/***/ }), 7163/* 262 */ 7164/***/ (function(module, exports, __webpack_require__) { 7165 7166 'use strict'; 7167 // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten 7168 var $export = __webpack_require__(8); 7169 var flattenIntoArray = __webpack_require__(261); 7170 var toObject = __webpack_require__(46); 7171 var toLength = __webpack_require__(38); 7172 var toInteger = __webpack_require__(39); 7173 var arraySpeciesCreate = __webpack_require__(175); 7174 7175 $export($export.P, 'Array', { 7176 flatten: function flatten(/* depthArg = 1 */) { 7177 var depthArg = arguments[0]; 7178 var O = toObject(this); 7179 var sourceLen = toLength(O.length); 7180 var A = arraySpeciesCreate(O, 0); 7181 flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); 7182 return A; 7183 } 7184 }); 7185 7186 __webpack_require__(188)('flatten'); 7187 7188 7189/***/ }), 7190/* 263 */ 7191/***/ (function(module, exports, __webpack_require__) { 7192 7193 'use strict'; 7194 // https://github.com/mathiasbynens/String.prototype.at 7195 var $export = __webpack_require__(8); 7196 var $at = __webpack_require__(128)(true); 7197 var $fails = __webpack_require__(7); 7198 7199 var FORCED = $fails(function () { 7200 return 'ð ®·'.at(0) !== 'ð ®·'; 7201 }); 7202 7203 $export($export.P + $export.F * FORCED, 'String', { 7204 at: function at(pos) { 7205 return $at(this, pos); 7206 } 7207 }); 7208 7209 7210/***/ }), 7211/* 264 */ 7212/***/ (function(module, exports, __webpack_require__) { 7213 7214 'use strict'; 7215 // https://github.com/tc39/proposal-string-pad-start-end 7216 var $export = __webpack_require__(8); 7217 var $pad = __webpack_require__(265); 7218 var userAgent = __webpack_require__(218); 7219 7220 // https://github.com/zloirock/core-js/issues/280 7221 var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); 7222 7223 $export($export.P + $export.F * WEBKIT_BUG, 'String', { 7224 padStart: function padStart(maxLength /* , fillString = ' ' */) { 7225 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); 7226 } 7227 }); 7228 7229 7230/***/ }), 7231/* 265 */ 7232/***/ (function(module, exports, __webpack_require__) { 7233 7234 // https://github.com/tc39/proposal-string-pad-start-end 7235 var toLength = __webpack_require__(38); 7236 var repeat = __webpack_require__(91); 7237 var defined = __webpack_require__(36); 7238 7239 module.exports = function (that, maxLength, fillString, left) { 7240 var S = String(defined(that)); 7241 var stringLength = S.length; 7242 var fillStr = fillString === undefined ? ' ' : String(fillString); 7243 var intMaxLength = toLength(maxLength); 7244 if (intMaxLength <= stringLength || fillStr == '') return S; 7245 var fillLen = intMaxLength - stringLength; 7246 var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); 7247 if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); 7248 return left ? stringFiller + S : S + stringFiller; 7249 }; 7250 7251 7252/***/ }), 7253/* 266 */ 7254/***/ (function(module, exports, __webpack_require__) { 7255 7256 'use strict'; 7257 // https://github.com/tc39/proposal-string-pad-start-end 7258 var $export = __webpack_require__(8); 7259 var $pad = __webpack_require__(265); 7260 var userAgent = __webpack_require__(218); 7261 7262 // https://github.com/zloirock/core-js/issues/280 7263 var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); 7264 7265 $export($export.P + $export.F * WEBKIT_BUG, 'String', { 7266 padEnd: function padEnd(maxLength /* , fillString = ' ' */) { 7267 return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); 7268 } 7269 }); 7270 7271 7272/***/ }), 7273/* 267 */ 7274/***/ (function(module, exports, __webpack_require__) { 7275 7276 'use strict'; 7277 // https://github.com/sebmarkbage/ecmascript-string-left-right-trim 7278 __webpack_require__(83)('trimLeft', function ($trim) { 7279 return function trimLeft() { 7280 return $trim(this, 1); 7281 }; 7282 }, 'trimStart'); 7283 7284 7285/***/ }), 7286/* 268 */ 7287/***/ (function(module, exports, __webpack_require__) { 7288 7289 'use strict'; 7290 // https://github.com/sebmarkbage/ecmascript-string-left-right-trim 7291 __webpack_require__(83)('trimRight', function ($trim) { 7292 return function trimRight() { 7293 return $trim(this, 2); 7294 }; 7295 }, 'trimEnd'); 7296 7297 7298/***/ }), 7299/* 269 */ 7300/***/ (function(module, exports, __webpack_require__) { 7301 7302 'use strict'; 7303 // https://tc39.github.io/String.prototype.matchAll/ 7304 var $export = __webpack_require__(8); 7305 var defined = __webpack_require__(36); 7306 var toLength = __webpack_require__(38); 7307 var isRegExp = __webpack_require__(135); 7308 var getFlags = __webpack_require__(198); 7309 var RegExpProto = RegExp.prototype; 7310 7311 var $RegExpStringIterator = function (regexp, string) { 7312 this._r = regexp; 7313 this._s = string; 7314 }; 7315 7316 __webpack_require__(131)($RegExpStringIterator, 'RegExp String', function next() { 7317 var match = this._r.exec(this._s); 7318 return { value: match, done: match === null }; 7319 }); 7320 7321 $export($export.P, 'String', { 7322 matchAll: function matchAll(regexp) { 7323 defined(this); 7324 if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); 7325 var S = String(this); 7326 var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp); 7327 var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); 7328 rx.lastIndex = toLength(regexp.lastIndex); 7329 return new $RegExpStringIterator(rx, S); 7330 } 7331 }); 7332 7333 7334/***/ }), 7335/* 270 */ 7336/***/ (function(module, exports, __webpack_require__) { 7337 7338 __webpack_require__(29)('asyncIterator'); 7339 7340 7341/***/ }), 7342/* 271 */ 7343/***/ (function(module, exports, __webpack_require__) { 7344 7345 __webpack_require__(29)('observable'); 7346 7347 7348/***/ }), 7349/* 272 */ 7350/***/ (function(module, exports, __webpack_require__) { 7351 7352 // https://github.com/tc39/proposal-object-getownpropertydescriptors 7353 var $export = __webpack_require__(8); 7354 var ownKeys = __webpack_require__(255); 7355 var toIObject = __webpack_require__(33); 7356 var gOPD = __webpack_require__(52); 7357 var createProperty = __webpack_require__(165); 7358 7359 $export($export.S, 'Object', { 7360 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { 7361 var O = toIObject(object); 7362 var getDesc = gOPD.f; 7363 var keys = ownKeys(O); 7364 var result = {}; 7365 var i = 0; 7366 var key, desc; 7367 while (keys.length > i) { 7368 desc = getDesc(O, key = keys[i++]); 7369 if (desc !== undefined) createProperty(result, key, desc); 7370 } 7371 return result; 7372 } 7373 }); 7374 7375 7376/***/ }), 7377/* 273 */ 7378/***/ (function(module, exports, __webpack_require__) { 7379 7380 // https://github.com/tc39/proposal-object-values-entries 7381 var $export = __webpack_require__(8); 7382 var $values = __webpack_require__(274)(false); 7383 7384 $export($export.S, 'Object', { 7385 values: function values(it) { 7386 return $values(it); 7387 } 7388 }); 7389 7390 7391/***/ }), 7392/* 274 */ 7393/***/ (function(module, exports, __webpack_require__) { 7394 7395 var DESCRIPTORS = __webpack_require__(6); 7396 var getKeys = __webpack_require__(31); 7397 var toIObject = __webpack_require__(33); 7398 var isEnum = __webpack_require__(44).f; 7399 module.exports = function (isEntries) { 7400 return function (it) { 7401 var O = toIObject(it); 7402 var keys = getKeys(O); 7403 var length = keys.length; 7404 var i = 0; 7405 var result = []; 7406 var key; 7407 while (length > i) { 7408 key = keys[i++]; 7409 if (!DESCRIPTORS || isEnum.call(O, key)) { 7410 result.push(isEntries ? [key, O[key]] : O[key]); 7411 } 7412 } 7413 return result; 7414 }; 7415 }; 7416 7417 7418/***/ }), 7419/* 275 */ 7420/***/ (function(module, exports, __webpack_require__) { 7421 7422 // https://github.com/tc39/proposal-object-values-entries 7423 var $export = __webpack_require__(8); 7424 var $entries = __webpack_require__(274)(true); 7425 7426 $export($export.S, 'Object', { 7427 entries: function entries(it) { 7428 return $entries(it); 7429 } 7430 }); 7431 7432 7433/***/ }), 7434/* 276 */ 7435/***/ (function(module, exports, __webpack_require__) { 7436 7437 'use strict'; 7438 var $export = __webpack_require__(8); 7439 var toObject = __webpack_require__(46); 7440 var aFunction = __webpack_require__(24); 7441 var $defineProperty = __webpack_require__(11); 7442 7443 // B.2.2.2 Object.prototype.__defineGetter__(P, getter) 7444 __webpack_require__(6) && $export($export.P + __webpack_require__(277), 'Object', { 7445 __defineGetter__: function __defineGetter__(P, getter) { 7446 $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); 7447 } 7448 }); 7449 7450 7451/***/ }), 7452/* 277 */ 7453/***/ (function(module, exports, __webpack_require__) { 7454 7455 'use strict'; 7456 // Forced replacement prototype accessors methods 7457 module.exports = __webpack_require__(22) || !__webpack_require__(7)(function () { 7458 var K = Math.random(); 7459 // In FF throws only define methods 7460 // eslint-disable-next-line no-undef, no-useless-call 7461 __defineSetter__.call(null, K, function () { /* empty */ }); 7462 delete __webpack_require__(4)[K]; 7463 }); 7464 7465 7466/***/ }), 7467/* 278 */ 7468/***/ (function(module, exports, __webpack_require__) { 7469 7470 'use strict'; 7471 var $export = __webpack_require__(8); 7472 var toObject = __webpack_require__(46); 7473 var aFunction = __webpack_require__(24); 7474 var $defineProperty = __webpack_require__(11); 7475 7476 // B.2.2.3 Object.prototype.__defineSetter__(P, setter) 7477 __webpack_require__(6) && $export($export.P + __webpack_require__(277), 'Object', { 7478 __defineSetter__: function __defineSetter__(P, setter) { 7479 $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); 7480 } 7481 }); 7482 7483 7484/***/ }), 7485/* 279 */ 7486/***/ (function(module, exports, __webpack_require__) { 7487 7488 'use strict'; 7489 var $export = __webpack_require__(8); 7490 var toObject = __webpack_require__(46); 7491 var toPrimitive = __webpack_require__(16); 7492 var getPrototypeOf = __webpack_require__(59); 7493 var getOwnPropertyDescriptor = __webpack_require__(52).f; 7494 7495 // B.2.2.4 Object.prototype.__lookupGetter__(P) 7496 __webpack_require__(6) && $export($export.P + __webpack_require__(277), 'Object', { 7497 __lookupGetter__: function __lookupGetter__(P) { 7498 var O = toObject(this); 7499 var K = toPrimitive(P, true); 7500 var D; 7501 do { 7502 if (D = getOwnPropertyDescriptor(O, K)) return D.get; 7503 } while (O = getPrototypeOf(O)); 7504 } 7505 }); 7506 7507 7508/***/ }), 7509/* 280 */ 7510/***/ (function(module, exports, __webpack_require__) { 7511 7512 'use strict'; 7513 var $export = __webpack_require__(8); 7514 var toObject = __webpack_require__(46); 7515 var toPrimitive = __webpack_require__(16); 7516 var getPrototypeOf = __webpack_require__(59); 7517 var getOwnPropertyDescriptor = __webpack_require__(52).f; 7518 7519 // B.2.2.5 Object.prototype.__lookupSetter__(P) 7520 __webpack_require__(6) && $export($export.P + __webpack_require__(277), 'Object', { 7521 __lookupSetter__: function __lookupSetter__(P) { 7522 var O = toObject(this); 7523 var K = toPrimitive(P, true); 7524 var D; 7525 do { 7526 if (D = getOwnPropertyDescriptor(O, K)) return D.set; 7527 } while (O = getPrototypeOf(O)); 7528 } 7529 }); 7530 7531 7532/***/ }), 7533/* 281 */ 7534/***/ (function(module, exports, __webpack_require__) { 7535 7536 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 7537 var $export = __webpack_require__(8); 7538 7539 $export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(282)('Map') }); 7540 7541 7542/***/ }), 7543/* 282 */ 7544/***/ (function(module, exports, __webpack_require__) { 7545 7546 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 7547 var classof = __webpack_require__(75); 7548 var from = __webpack_require__(283); 7549 module.exports = function (NAME) { 7550 return function toJSON() { 7551 if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); 7552 return from(this); 7553 }; 7554 }; 7555 7556 7557/***/ }), 7558/* 283 */ 7559/***/ (function(module, exports, __webpack_require__) { 7560 7561 var forOf = __webpack_require__(213); 7562 7563 module.exports = function (iter, ITERATOR) { 7564 var result = []; 7565 forOf(iter, false, result.push, result, ITERATOR); 7566 return result; 7567 }; 7568 7569 7570/***/ }), 7571/* 284 */ 7572/***/ (function(module, exports, __webpack_require__) { 7573 7574 // https://github.com/DavidBruant/Map-Set.prototype.toJSON 7575 var $export = __webpack_require__(8); 7576 7577 $export($export.P + $export.R, 'Set', { toJSON: __webpack_require__(282)('Set') }); 7578 7579 7580/***/ }), 7581/* 285 */ 7582/***/ (function(module, exports, __webpack_require__) { 7583 7584 // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of 7585 __webpack_require__(286)('Map'); 7586 7587 7588/***/ }), 7589/* 286 */ 7590/***/ (function(module, exports, __webpack_require__) { 7591 7592 'use strict'; 7593 // https://tc39.github.io/proposal-setmap-offrom/ 7594 var $export = __webpack_require__(8); 7595 7596 module.exports = function (COLLECTION) { 7597 $export($export.S, COLLECTION, { of: function of() { 7598 var length = arguments.length; 7599 var A = new Array(length); 7600 while (length--) A[length] = arguments[length]; 7601 return new this(A); 7602 } }); 7603 }; 7604 7605 7606/***/ }), 7607/* 287 */ 7608/***/ (function(module, exports, __webpack_require__) { 7609 7610 // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of 7611 __webpack_require__(286)('Set'); 7612 7613
vendor: 1,640 bytes, lines 7614-7679
7614/***/ }), 7615/* 288 */ 7616/***/ (function(module, exports, __webpack_require__) { 7617 7618 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of 7619 __webpack_require__(286)('WeakMap'); 7620 7621 7622/***/ }), 7623/* 289 */ 7624/***/ (function(module, exports, __webpack_require__) { 7625 7626 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of 7627 __webpack_require__(286)('WeakSet'); 7628 7629 7630/***/ }), 7631/* 290 */ 7632/***/ (function(module, exports, __webpack_require__) { 7633 7634 // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from 7635 __webpack_require__(291)('Map'); 7636 7637 7638/***/ }), 7639/* 291 */ 7640/***/ (function(module, exports, __webpack_require__) { 7641 7642 'use strict'; 7643 // https://tc39.github.io/proposal-setmap-offrom/ 7644 var $export = __webpack_require__(8); 7645 var aFunction = __webpack_require__(24); 7646 var ctx = __webpack_require__(23); 7647 var forOf = __webpack_require__(213); 7648 7649 module.exports = function (COLLECTION) { 7650 $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { 7651 var mapFn = arguments[1]; 7652 var mapping, A, n, cb; 7653 aFunction(this); 7654 mapping = mapFn !== undefined; 7655 if (mapping) aFunction(mapFn); 7656 if (source == undefined) return new this(); 7657 A = []; 7658 if (mapping) { 7659 n = 0; 7660 cb = ctx(mapFn, arguments[2], 2); 7661 forOf(source, false, function (nextItem) { 7662 A.push(cb(nextItem, n++)); 7663 }); 7664 } else { 7665 forOf(source, false, A.push, A); 7666 } 7667 return new this(A); 7668 } }); 7669 }; 7670 7671 7672/***/ }), 7673/* 292 */ 7674/***/ (function(module, exports, __webpack_require__) { 7675 7676 // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from 7677 __webpack_require__(291)('Set'); 7678 7679
vendor: 19,680 bytes, lines 7680-8356
7680/***/ }), 7681/* 293 */ 7682/***/ (function(module, exports, __webpack_require__) { 7683 7684 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from 7685 __webpack_require__(291)('WeakMap'); 7686 7687 7688/***/ }), 7689/* 294 */ 7690/***/ (function(module, exports, __webpack_require__) { 7691 7692 // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from 7693 __webpack_require__(291)('WeakSet'); 7694 7695 7696/***/ }), 7697/* 295 */ 7698/***/ (function(module, exports, __webpack_require__) { 7699 7700 // https://github.com/tc39/proposal-global 7701 var $export = __webpack_require__(8); 7702 7703 $export($export.G, { global: __webpack_require__(4) }); 7704 7705 7706/***/ }), 7707/* 296 */ 7708/***/ (function(module, exports, __webpack_require__) { 7709 7710 // https://github.com/tc39/proposal-global 7711 var $export = __webpack_require__(8); 7712 7713 $export($export.S, 'System', { global: __webpack_require__(4) }); 7714 7715 7716/***/ }), 7717/* 297 */ 7718/***/ (function(module, exports, __webpack_require__) { 7719 7720 // https://github.com/ljharb/proposal-is-error 7721 var $export = __webpack_require__(8); 7722 var cof = __webpack_require__(35); 7723 7724 $export($export.S, 'Error', { 7725 isError: function isError(it) { 7726 return cof(it) === 'Error'; 7727 } 7728 }); 7729 7730 7731/***/ }), 7732/* 298 */ 7733/***/ (function(module, exports, __webpack_require__) { 7734 7735 // https://rwaldron.github.io/proposal-math-extensions/ 7736 var $export = __webpack_require__(8); 7737 7738 $export($export.S, 'Math', { 7739 clamp: function clamp(x, lower, upper) { 7740 return Math.min(upper, Math.max(lower, x)); 7741 } 7742 }); 7743 7744 7745/***/ }), 7746/* 299 */ 7747/***/ (function(module, exports, __webpack_require__) { 7748 7749 // https://rwaldron.github.io/proposal-math-extensions/ 7750 var $export = __webpack_require__(8); 7751 7752 $export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 }); 7753 7754 7755/***/ }), 7756/* 300 */ 7757/***/ (function(module, exports, __webpack_require__) { 7758 7759 // https://rwaldron.github.io/proposal-math-extensions/ 7760 var $export = __webpack_require__(8); 7761 var RAD_PER_DEG = 180 / Math.PI; 7762 7763 $export($export.S, 'Math', { 7764 degrees: function degrees(radians) { 7765 return radians * RAD_PER_DEG; 7766 } 7767 }); 7768 7769 7770/***/ }), 7771/* 301 */ 7772/***/ (function(module, exports, __webpack_require__) { 7773 7774 // https://rwaldron.github.io/proposal-math-extensions/ 7775 var $export = __webpack_require__(8); 7776 var scale = __webpack_require__(302); 7777 var fround = __webpack_require__(114); 7778 7779 $export($export.S, 'Math', { 7780 fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { 7781 return fround(scale(x, inLow, inHigh, outLow, outHigh)); 7782 } 7783 }); 7784 7785 7786/***/ }), 7787/* 302 */ 7788/***/ (function(module, exports) { 7789 7790 // https://rwaldron.github.io/proposal-math-extensions/ 7791 module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { 7792 if ( 7793 arguments.length === 0 7794 // eslint-disable-next-line no-self-compare 7795 || x != x 7796 // eslint-disable-next-line no-self-compare 7797 || inLow != inLow 7798 // eslint-disable-next-line no-self-compare 7799 || inHigh != inHigh 7800 // eslint-disable-next-line no-self-compare 7801 || outLow != outLow 7802 // eslint-disable-next-line no-self-compare 7803 || outHigh != outHigh 7804 ) return NaN; 7805 if (x === Infinity || x === -Infinity) return x; 7806 return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; 7807 }; 7808 7809 7810/***/ }), 7811/* 303 */ 7812/***/ (function(module, exports, __webpack_require__) { 7813 7814 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 7815 var $export = __webpack_require__(8); 7816 7817 $export($export.S, 'Math', { 7818 iaddh: function iaddh(x0, x1, y0, y1) { 7819 var $x0 = x0 >>> 0; 7820 var $x1 = x1 >>> 0; 7821 var $y0 = y0 >>> 0; 7822 return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; 7823 } 7824 }); 7825 7826 7827/***/ }), 7828/* 304 */ 7829/***/ (function(module, exports, __webpack_require__) { 7830 7831 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 7832 var $export = __webpack_require__(8); 7833 7834 $export($export.S, 'Math', { 7835 isubh: function isubh(x0, x1, y0, y1) { 7836 var $x0 = x0 >>> 0; 7837 var $x1 = x1 >>> 0; 7838 var $y0 = y0 >>> 0; 7839 return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; 7840 } 7841 }); 7842 7843 7844/***/ }), 7845/* 305 */ 7846/***/ (function(module, exports, __webpack_require__) { 7847 7848 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 7849 var $export = __webpack_require__(8); 7850 7851 $export($export.S, 'Math', { 7852 imulh: function imulh(u, v) { 7853 var UINT16 = 0xffff; 7854 var $u = +u; 7855 var $v = +v; 7856 var u0 = $u & UINT16; 7857 var v0 = $v & UINT16; 7858 var u1 = $u >> 16; 7859 var v1 = $v >> 16; 7860 var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); 7861 return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); 7862 } 7863 }); 7864 7865 7866/***/ }), 7867/* 306 */ 7868/***/ (function(module, exports, __webpack_require__) { 7869 7870 // https://rwaldron.github.io/proposal-math-extensions/ 7871 var $export = __webpack_require__(8); 7872 7873 $export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI }); 7874 7875 7876/***/ }), 7877/* 307 */ 7878/***/ (function(module, exports, __webpack_require__) { 7879 7880 // https://rwaldron.github.io/proposal-math-extensions/ 7881 var $export = __webpack_require__(8); 7882 var DEG_PER_RAD = Math.PI / 180; 7883 7884 $export($export.S, 'Math', { 7885 radians: function radians(degrees) { 7886 return degrees * DEG_PER_RAD; 7887 } 7888 }); 7889 7890 7891/***/ }), 7892/* 308 */ 7893/***/ (function(module, exports, __webpack_require__) { 7894 7895 // https://rwaldron.github.io/proposal-math-extensions/ 7896 var $export = __webpack_require__(8); 7897 7898 $export($export.S, 'Math', { scale: __webpack_require__(302) }); 7899 7900 7901/***/ }), 7902/* 309 */ 7903/***/ (function(module, exports, __webpack_require__) { 7904 7905 // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 7906 var $export = __webpack_require__(8); 7907 7908 $export($export.S, 'Math', { 7909 umulh: function umulh(u, v) { 7910 var UINT16 = 0xffff; 7911 var $u = +u; 7912 var $v = +v; 7913 var u0 = $u & UINT16; 7914 var v0 = $v & UINT16; 7915 var u1 = $u >>> 16; 7916 var v1 = $v >>> 16; 7917 var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); 7918 return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); 7919 } 7920 }); 7921 7922 7923/***/ }), 7924/* 310 */ 7925/***/ (function(module, exports, __webpack_require__) { 7926 7927 // http://jfbastien.github.io/papers/Math.signbit.html 7928 var $export = __webpack_require__(8); 7929 7930 $export($export.S, 'Math', { signbit: function signbit(x) { 7931 // eslint-disable-next-line no-self-compare 7932 return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0; 7933 } }); 7934 7935 7936/***/ }), 7937/* 311 */ 7938/***/ (function(module, exports, __webpack_require__) { 7939 7940 // https://github.com/tc39/proposal-promise-finally 7941 'use strict'; 7942 var $export = __webpack_require__(8); 7943 var core = __webpack_require__(9); 7944 var global = __webpack_require__(4); 7945 var speciesConstructor = __webpack_require__(210); 7946 var promiseResolve = __webpack_require__(219); 7947 7948 $export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { 7949 var C = speciesConstructor(this, core.Promise || global.Promise); 7950 var isFunction = typeof onFinally == 'function'; 7951 return this.then( 7952 isFunction ? function (x) { 7953 return promiseResolve(C, onFinally()).then(function () { return x; }); 7954 } : onFinally, 7955 isFunction ? function (e) { 7956 return promiseResolve(C, onFinally()).then(function () { throw e; }); 7957 } : onFinally 7958 ); 7959 } }); 7960 7961 7962/***/ }), 7963/* 312 */ 7964/***/ (function(module, exports, __webpack_require__) { 7965 7966 'use strict'; 7967 // https://github.com/tc39/proposal-promise-try 7968 var $export = __webpack_require__(8); 7969 var newPromiseCapability = __webpack_require__(216); 7970 var perform = __webpack_require__(217); 7971 7972 $export($export.S, 'Promise', { 'try': function (callbackfn) { 7973 var promiseCapability = newPromiseCapability.f(this); 7974 var result = perform(callbackfn); 7975 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); 7976 return promiseCapability.promise; 7977 } }); 7978 7979 7980/***/ }), 7981/* 313 */ 7982/***/ (function(module, exports, __webpack_require__) { 7983 7984 var metadata = __webpack_require__(314); 7985 var anObject = __webpack_require__(12); 7986 var toMetaKey = metadata.key; 7987 var ordinaryDefineOwnMetadata = metadata.set; 7988 7989 metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { 7990 ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); 7991 } }); 7992 7993 7994/***/ }), 7995/* 314 */ 7996/***/ (function(module, exports, __webpack_require__) { 7997 7998 var Map = __webpack_require__(221); 7999 var $export = __webpack_require__(8); 8000 var shared = __webpack_require__(21)('metadata'); 8001 var store = shared.store || (shared.store = new (__webpack_require__(226))()); 8002 8003 var getOrCreateMetadataMap = function (target, targetKey, create) { 8004 var targetMetadata = store.get(target); 8005 if (!targetMetadata) { 8006 if (!create) return undefined; 8007 store.set(target, targetMetadata = new Map()); 8008 } 8009 var keyMetadata = targetMetadata.get(targetKey); 8010 if (!keyMetadata) { 8011 if (!create) return undefined; 8012 targetMetadata.set(targetKey, keyMetadata = new Map()); 8013 } return keyMetadata; 8014 }; 8015 var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { 8016 var metadataMap = getOrCreateMetadataMap(O, P, false); 8017 return metadataMap === undefined ? false : metadataMap.has(MetadataKey); 8018 }; 8019 var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { 8020 var metadataMap = getOrCreateMetadataMap(O, P, false); 8021 return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); 8022 }; 8023 var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { 8024 getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); 8025 }; 8026 var ordinaryOwnMetadataKeys = function (target, targetKey) { 8027 var metadataMap = getOrCreateMetadataMap(target, targetKey, false); 8028 var keys = []; 8029 if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); 8030 return keys; 8031 }; 8032 var toMetaKey = function (it) { 8033 return it === undefined || typeof it == 'symbol' ? it : String(it); 8034 }; 8035 var exp = function (O) { 8036 $export($export.S, 'Reflect', O); 8037 }; 8038 8039 module.exports = { 8040 store: store, 8041 map: getOrCreateMetadataMap, 8042 has: ordinaryHasOwnMetadata, 8043 get: ordinaryGetOwnMetadata, 8044 set: ordinaryDefineOwnMetadata, 8045 keys: ordinaryOwnMetadataKeys, 8046 key: toMetaKey, 8047 exp: exp 8048 }; 8049 8050 8051/***/ }), 8052/* 315 */ 8053/***/ (function(module, exports, __webpack_require__) { 8054 8055 var metadata = __webpack_require__(314); 8056 var anObject = __webpack_require__(12); 8057 var toMetaKey = metadata.key; 8058 var getOrCreateMetadataMap = metadata.map; 8059 var store = metadata.store; 8060 8061 metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { 8062 var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); 8063 var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); 8064 if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; 8065 if (metadataMap.size) return true; 8066 var targetMetadata = store.get(target); 8067 targetMetadata['delete'](targetKey); 8068 return !!targetMetadata.size || store['delete'](target); 8069 } }); 8070 8071 8072/***/ }), 8073/* 316 */ 8074/***/ (function(module, exports, __webpack_require__) { 8075 8076 var metadata = __webpack_require__(314); 8077 var anObject = __webpack_require__(12); 8078 var getPrototypeOf = __webpack_require__(59); 8079 var ordinaryHasOwnMetadata = metadata.has; 8080 var ordinaryGetOwnMetadata = metadata.get; 8081 var toMetaKey = metadata.key; 8082 8083 var ordinaryGetMetadata = function (MetadataKey, O, P) { 8084 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); 8085 if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); 8086 var parent = getPrototypeOf(O); 8087 return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; 8088 }; 8089 8090 metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { 8091 return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 8092 } }); 8093 8094 8095/***/ }), 8096/* 317 */ 8097/***/ (function(module, exports, __webpack_require__) { 8098 8099 var Set = __webpack_require__(225); 8100 var from = __webpack_require__(283); 8101 var metadata = __webpack_require__(314); 8102 var anObject = __webpack_require__(12); 8103 var getPrototypeOf = __webpack_require__(59); 8104 var ordinaryOwnMetadataKeys = metadata.keys; 8105 var toMetaKey = metadata.key; 8106 8107 var ordinaryMetadataKeys = function (O, P) { 8108 var oKeys = ordinaryOwnMetadataKeys(O, P); 8109 var parent = getPrototypeOf(O); 8110 if (parent === null) return oKeys; 8111 var pKeys = ordinaryMetadataKeys(parent, P); 8112 return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; 8113 }; 8114 8115 metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { 8116 return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); 8117 } }); 8118 8119 8120/***/ }), 8121/* 318 */ 8122/***/ (function(module, exports, __webpack_require__) { 8123 8124 var metadata = __webpack_require__(314); 8125 var anObject = __webpack_require__(12); 8126 var ordinaryGetOwnMetadata = metadata.get; 8127 var toMetaKey = metadata.key; 8128 8129 metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { 8130 return ordinaryGetOwnMetadata(metadataKey, anObject(target) 8131 , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 8132 } }); 8133 8134 8135/***/ }), 8136/* 319 */ 8137/***/ (function(module, exports, __webpack_require__) { 8138 8139 var metadata = __webpack_require__(314); 8140 var anObject = __webpack_require__(12); 8141 var ordinaryOwnMetadataKeys = metadata.keys; 8142 var toMetaKey = metadata.key; 8143 8144 metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { 8145 return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); 8146 } }); 8147 8148 8149/***/ }), 8150/* 320 */ 8151/***/ (function(module, exports, __webpack_require__) { 8152 8153 var metadata = __webpack_require__(314); 8154 var anObject = __webpack_require__(12); 8155 var getPrototypeOf = __webpack_require__(59); 8156 var ordinaryHasOwnMetadata = metadata.has; 8157 var toMetaKey = metadata.key; 8158 8159 var ordinaryHasMetadata = function (MetadataKey, O, P) { 8160 var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); 8161 if (hasOwn) return true; 8162 var parent = getPrototypeOf(O); 8163 return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; 8164 }; 8165 8166 metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { 8167 return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 8168 } }); 8169 8170 8171/***/ }), 8172/* 321 */ 8173/***/ (function(module, exports, __webpack_require__) { 8174 8175 var metadata = __webpack_require__(314); 8176 var anObject = __webpack_require__(12); 8177 var ordinaryHasOwnMetadata = metadata.has; 8178 var toMetaKey = metadata.key; 8179 8180 metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { 8181 return ordinaryHasOwnMetadata(metadataKey, anObject(target) 8182 , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); 8183 } }); 8184 8185 8186/***/ }), 8187/* 322 */ 8188/***/ (function(module, exports, __webpack_require__) { 8189 8190 var $metadata = __webpack_require__(314); 8191 var anObject = __webpack_require__(12); 8192 var aFunction = __webpack_require__(24); 8193 var toMetaKey = $metadata.key; 8194 var ordinaryDefineOwnMetadata = $metadata.set; 8195 8196 $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { 8197 return function decorator(target, targetKey) { 8198 ordinaryDefineOwnMetadata( 8199 metadataKey, metadataValue, 8200 (targetKey !== undefined ? anObject : aFunction)(target), 8201 toMetaKey(targetKey) 8202 ); 8203 }; 8204 } }); 8205 8206 8207/***/ }), 8208/* 323 */ 8209/***/ (function(module, exports, __webpack_require__) { 8210 8211 // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask 8212 var $export = __webpack_require__(8); 8213 var microtask = __webpack_require__(215)(); 8214 var process = __webpack_require__(4).process; 8215 var isNode = __webpack_require__(35)(process) == 'process'; 8216 8217 $export($export.G, { 8218 asap: function asap(fn) { 8219 var domain = isNode && process.domain; 8220 microtask(domain ? domain.bind(fn) : fn); 8221 } 8222 }); 8223 8224 8225/***/ }), 8226/* 324 */ 8227/***/ (function(module, exports, __webpack_require__) { 8228 8229 'use strict'; 8230 // https://github.com/zenparsing/es-observable 8231 var $export = __webpack_require__(8); 8232 var global = __webpack_require__(4); 8233 var core = __webpack_require__(9); 8234 var microtask = __webpack_require__(215)(); 8235 var OBSERVABLE = __webpack_require__(27)('observable'); 8236 var aFunction = __webpack_require__(24); 8237 var anObject = __webpack_require__(12); 8238 var anInstance = __webpack_require__(212); 8239 var redefineAll = __webpack_require__(220); 8240 var hide = __webpack_require__(10); 8241 var forOf = __webpack_require__(213); 8242 var RETURN = forOf.RETURN; 8243 8244 var getMethod = function (fn) { 8245 return fn == null ? undefined : aFunction(fn); 8246 }; 8247 8248 var cleanupSubscription = function (subscription) { 8249 var cleanup = subscription._c; 8250 if (cleanup) { 8251 subscription._c = undefined; 8252 cleanup(); 8253 } 8254 }; 8255 8256 var subscriptionClosed = function (subscription) { 8257 return subscription._o === undefined; 8258 }; 8259 8260 var closeSubscription = function (subscription) { 8261 if (!subscriptionClosed(subscription)) { 8262 subscription._o = undefined; 8263 cleanupSubscription(subscription); 8264 } 8265 }; 8266 8267 var Subscription = function (observer, subscriber) { 8268 anObject(observer); 8269 this._c = undefined; 8270 this._o = observer; 8271 observer = new SubscriptionObserver(this); 8272 try { 8273 var cleanup = subscriber(observer); 8274 var subscription = cleanup; 8275 if (cleanup != null) { 8276 if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); }; 8277 else aFunction(cleanup); 8278 this._c = cleanup; 8279 } 8280 } catch (e) { 8281 observer.error(e); 8282 return; 8283 } if (subscriptionClosed(this)) cleanupSubscription(this); 8284 }; 8285 8286 Subscription.prototype = redefineAll({}, { 8287 unsubscribe: function unsubscribe() { closeSubscription(this); } 8288 }); 8289 8290 var SubscriptionObserver = function (subscription) { 8291 this._s = subscription; 8292 }; 8293 8294 SubscriptionObserver.prototype = redefineAll({}, { 8295 next: function next(value) { 8296 var subscription = this._s; 8297 if (!subscriptionClosed(subscription)) { 8298 var observer = subscription._o; 8299 try { 8300 var m = getMethod(observer.next); 8301 if (m) return m.call(observer, value); 8302 } catch (e) { 8303 try { 8304 closeSubscription(subscription); 8305 } finally { 8306 throw e; 8307 } 8308 } 8309 } 8310 }, 8311 error: function error(value) { 8312 var subscription = this._s; 8313 if (subscriptionClosed(subscription)) throw value; 8314 var observer = subscription._o; 8315 subscription._o = undefined; 8316 try { 8317 var m = getMethod(observer.error); 8318 if (!m) throw value; 8319 value = m.call(observer, value); 8320 } catch (e) { 8321 try { 8322 cleanupSubscription(subscription); 8323 } finally { 8324 throw e; 8325 } 8326 } cleanupSubscription(subscription); 8327 return value; 8328 }, 8329 complete: function complete(value) { 8330 var subscription = this._s; 8331 if (!subscriptionClosed(subscription)) { 8332 var observer = subscription._o; 8333 subscription._o = undefined; 8334 try { 8335 var m = getMethod(observer.complete); 8336 value = m ? m.call(observer, value) : undefined; 8337 } catch (e) { 8338 try { 8339 cleanupSubscription(subscription); 8340 } finally { 8341 throw e; 8342 } 8343 } cleanupSubscription(subscription); 8344 return value; 8345 } 8346 } 8347 }); 8348 8349 var $Observable = function Observable(subscriber) { 8350 anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); 8351 }; 8352 8353 redefineAll($Observable.prototype, { 8354 subscribe: function subscribe(observer) { 8355 return new Subscription(observer, this._f); 8356 },
vendor: 5,042 bytes, lines 8357-8526
8357 forEach: function forEach(fn) { 8358 var that = this; 8359 return new (core.Promise || global.Promise)(function (resolve, reject) { 8360 aFunction(fn); 8361 var subscription = that.subscribe({ 8362 next: function (value) { 8363 try { 8364 return fn(value); 8365 } catch (e) { 8366 reject(e); 8367 subscription.unsubscribe(); 8368 } 8369 }, 8370 error: reject, 8371 complete: resolve 8372 }); 8373 }); 8374 } 8375 }); 8376 8377 redefineAll($Observable, { 8378 from: function from(x) { 8379 var C = typeof this === 'function' ? this : $Observable; 8380 var method = getMethod(anObject(x)[OBSERVABLE]); 8381 if (method) { 8382 var observable = anObject(method.call(x)); 8383 return observable.constructor === C ? observable : new C(function (observer) { 8384 return observable.subscribe(observer); 8385 }); 8386 } 8387 return new C(function (observer) { 8388 var done = false; 8389 microtask(function () { 8390 if (!done) { 8391 try { 8392 if (forOf(x, false, function (it) { 8393 observer.next(it); 8394 if (done) return RETURN; 8395 }) === RETURN) return; 8396 } catch (e) { 8397 if (done) throw e; 8398 observer.error(e); 8399 return; 8400 } observer.complete(); 8401 } 8402 }); 8403 return function () { done = true; }; 8404 }); 8405 }, 8406 of: function of() { 8407 for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++]; 8408 return new (typeof this === 'function' ? this : $Observable)(function (observer) { 8409 var done = false; 8410 microtask(function () { 8411 if (!done) { 8412 for (var j = 0; j < items.length; ++j) { 8413 observer.next(items[j]); 8414 if (done) return; 8415 } observer.complete(); 8416 } 8417 }); 8418 return function () { done = true; }; 8419 }); 8420 } 8421 }); 8422 8423 hide($Observable.prototype, OBSERVABLE, function () { return this; }); 8424 8425 $export($export.G, { Observable: $Observable }); 8426 8427 __webpack_require__(194)('Observable'); 8428 8429 8430/***/ }), 8431/* 325 */ 8432/***/ (function(module, exports, __webpack_require__) { 8433 8434 // ie9- setTimeout & setInterval additional parameters fix 8435 var global = __webpack_require__(4); 8436 var $export = __webpack_require__(8); 8437 var userAgent = __webpack_require__(218); 8438 var slice = [].slice; 8439 var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check 8440 var wrap = function (set) { 8441 return function (fn, time /* , ...args */) { 8442 var boundArgs = arguments.length > 2; 8443 var args = boundArgs ? slice.call(arguments, 2) : false; 8444 return set(boundArgs ? function () { 8445 // eslint-disable-next-line no-new-func 8446 (typeof fn == 'function' ? fn : Function(fn)).apply(this, args); 8447 } : fn, time); 8448 }; 8449 }; 8450 $export($export.G + $export.B + $export.F * MSIE, { 8451 setTimeout: wrap(global.setTimeout), 8452 setInterval: wrap(global.setInterval) 8453 }); 8454 8455 8456/***/ }), 8457/* 326 */ 8458/***/ (function(module, exports, __webpack_require__) { 8459 8460 var $export = __webpack_require__(8); 8461 var $task = __webpack_require__(214); 8462 $export($export.G + $export.B, { 8463 setImmediate: $task.set, 8464 clearImmediate: $task.clear 8465 }); 8466 8467 8468/***/ }), 8469/* 327 */ 8470/***/ (function(module, exports, __webpack_require__) { 8471 8472 var $iterators = __webpack_require__(195); 8473 var getKeys = __webpack_require__(31); 8474 var redefine = __webpack_require__(18); 8475 var global = __webpack_require__(4); 8476 var hide = __webpack_require__(10); 8477 var Iterators = __webpack_require__(130); 8478 var wks = __webpack_require__(27); 8479 var ITERATOR = wks('iterator'); 8480 var TO_STRING_TAG = wks('toStringTag'); 8481 var ArrayValues = Iterators.Array; 8482 8483 var DOMIterables = { 8484 CSSRuleList: true, // TODO: Not spec compliant, should be false. 8485 CSSStyleDeclaration: false, 8486 CSSValueList: false, 8487 ClientRectList: false, 8488 DOMRectList: false, 8489 DOMStringList: false, 8490 DOMTokenList: true, 8491 DataTransferItemList: false, 8492 FileList: false, 8493 HTMLAllCollection: false, 8494 HTMLCollection: false, 8495 HTMLFormElement: false, 8496 HTMLSelectElement: false, 8497 MediaList: true, // TODO: Not spec compliant, should be false. 8498 MimeTypeArray: false, 8499 NamedNodeMap: false, 8500 NodeList: true, 8501 PaintRequestList: false, 8502 Plugin: false, 8503 PluginArray: false, 8504 SVGLengthList: false, 8505 SVGNumberList: false, 8506 SVGPathSegList: false, 8507 SVGPointList: false, 8508 SVGStringList: false, 8509 SVGTransformList: false, 8510 SourceBufferList: false, 8511 StyleSheetList: true, // TODO: Not spec compliant, should be false. 8512 TextTrackCueList: false, 8513 TextTrackList: false, 8514 TouchList: false 8515 }; 8516 8517 for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { 8518 var NAME = collections[i]; 8519 var explicit = DOMIterables[NAME]; 8520 var Collection = global[NAME]; 8521 var proto = Collection && Collection.prototype; 8522 var key; 8523 if (proto) { 8524 if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); 8525 if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); 8526 Iterators[NAME] = ArrayValues;
vendor: 14,201 bytes, lines 8527-8887
8527 if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); 8528 } 8529 } 8530 8531 8532/***/ }), 8533/* 328 */ 8534/***/ (function(module, exports) { 8535 8536 /* WEBPACK VAR INJECTION */(function(global) {/** 8537 * Copyright (c) 2014, Facebook, Inc. 8538 * All rights reserved. 8539 * 8540 * This source code is licensed under the BSD-style license found in the 8541 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An 8542 * additional grant of patent rights can be found in the PATENTS file in 8543 * the same directory. 8544 */ 8545 8546 !(function(global) { 8547 "use strict"; 8548 8549 var Op = Object.prototype; 8550 var hasOwn = Op.hasOwnProperty; 8551 var undefined; // More compressible than void 0. 8552 var $Symbol = typeof Symbol === "function" ? Symbol : {}; 8553 var iteratorSymbol = $Symbol.iterator || "@@iterator"; 8554 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; 8555 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 8556 8557 var inModule = typeof module === "object"; 8558 var runtime = global.regeneratorRuntime; 8559 if (runtime) { 8560 if (inModule) { 8561 // If regeneratorRuntime is defined globally and we're in a module, 8562 // make the exports object identical to regeneratorRuntime. 8563 module.exports = runtime; 8564 } 8565 // Don't bother evaluating the rest of this file if the runtime was 8566 // already defined globally. 8567 return; 8568 } 8569 8570 // Define the runtime globally (as expected by generated code) as either 8571 // module.exports (if we're in a module) or a new, empty object. 8572 runtime = global.regeneratorRuntime = inModule ? module.exports : {}; 8573 8574 function wrap(innerFn, outerFn, self, tryLocsList) { 8575 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. 8576 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; 8577 var generator = Object.create(protoGenerator.prototype); 8578 var context = new Context(tryLocsList || []); 8579 8580 // The ._invoke method unifies the implementations of the .next, 8581 // .throw, and .return methods. 8582 generator._invoke = makeInvokeMethod(innerFn, self, context); 8583 8584 return generator; 8585 } 8586 runtime.wrap = wrap; 8587 8588 // Try/catch helper to minimize deoptimizations. Returns a completion 8589 // record like context.tryEntries[i].completion. This interface could 8590 // have been (and was previously) designed to take a closure to be 8591 // invoked without arguments, but in all the cases we care about we 8592 // already have an existing method we want to call, so there's no need 8593 // to create a new function object. We can even get away with assuming 8594 // the method takes exactly one argument, since that happens to be true 8595 // in every case, so we don't have to touch the arguments object. The 8596 // only additional allocation required is the completion record, which 8597 // has a stable shape and so hopefully should be cheap to allocate. 8598 function tryCatch(fn, obj, arg) { 8599 try { 8600 return { type: "normal", arg: fn.call(obj, arg) }; 8601 } catch (err) { 8602 return { type: "throw", arg: err }; 8603 } 8604 } 8605 8606 var GenStateSuspendedStart = "suspendedStart"; 8607 var GenStateSuspendedYield = "suspendedYield"; 8608 var GenStateExecuting = "executing"; 8609 var GenStateCompleted = "completed"; 8610 8611 // Returning this object from the innerFn has the same effect as 8612 // breaking out of the dispatch switch statement. 8613 var ContinueSentinel = {}; 8614 8615 // Dummy constructor functions that we use as the .constructor and 8616 // .constructor.prototype properties for functions that return Generator 8617 // objects. For full spec compliance, you may wish to configure your 8618 // minifier not to mangle the names of these two functions. 8619 function Generator() {} 8620 function GeneratorFunction() {} 8621 function GeneratorFunctionPrototype() {} 8622 8623 // This is a polyfill for %IteratorPrototype% for environments that 8624 // don't natively support it. 8625 var IteratorPrototype = {}; 8626 IteratorPrototype[iteratorSymbol] = function () { 8627 return this; 8628 }; 8629 8630 var getProto = Object.getPrototypeOf; 8631 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 8632 if (NativeIteratorPrototype && 8633 NativeIteratorPrototype !== Op && 8634 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { 8635 // This environment has a native %IteratorPrototype%; use it instead 8636 // of the polyfill. 8637 IteratorPrototype = NativeIteratorPrototype; 8638 } 8639 8640 var Gp = GeneratorFunctionPrototype.prototype = 8641 Generator.prototype = Object.create(IteratorPrototype); 8642 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; 8643 GeneratorFunctionPrototype.constructor = GeneratorFunction; 8644 GeneratorFunctionPrototype[toStringTagSymbol] = 8645 GeneratorFunction.displayName = "GeneratorFunction"; 8646 8647 // Helper for defining the .next, .throw, and .return methods of the 8648 // Iterator interface in terms of a single ._invoke method. 8649 function defineIteratorMethods(prototype) { 8650 ["next", "throw", "return"].forEach(function(method) { 8651 prototype[method] = function(arg) { 8652 return this._invoke(method, arg); 8653 }; 8654 }); 8655 } 8656 8657 runtime.isGeneratorFunction = function(genFun) { 8658 var ctor = typeof genFun === "function" && genFun.constructor; 8659 return ctor 8660 ? ctor === GeneratorFunction || 8661 // For the native GeneratorFunction constructor, the best we can 8662 // do is to check its .name property. 8663 (ctor.displayName || ctor.name) === "GeneratorFunction" 8664 : false; 8665 }; 8666 8667 runtime.mark = function(genFun) { 8668 if (Object.setPrototypeOf) { 8669 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); 8670 } else { 8671 genFun.__proto__ = GeneratorFunctionPrototype; 8672 if (!(toStringTagSymbol in genFun)) { 8673 genFun[toStringTagSymbol] = "GeneratorFunction"; 8674 } 8675 } 8676 genFun.prototype = Object.create(Gp); 8677 return genFun; 8678 }; 8679 8680 // Within the body of any async function, `await x` is transformed to 8681 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 8682 // `hasOwn.call(value, "__await")` to determine if the yielded value is 8683 // meant to be awaited. 8684 runtime.awrap = function(arg) { 8685 return { __await: arg }; 8686 }; 8687 8688 function AsyncIterator(generator) { 8689 function invoke(method, arg, resolve, reject) { 8690 var record = tryCatch(generator[method], generator, arg); 8691 if (record.type === "throw") { 8692 reject(record.arg); 8693 } else { 8694 var result = record.arg; 8695 var value = result.value; 8696 if (value && 8697 typeof value === "object" && 8698 hasOwn.call(value, "__await")) { 8699 return Promise.resolve(value.__await).then(function(value) { 8700 invoke("next", value, resolve, reject); 8701 }, function(err) { 8702 invoke("throw", err, resolve, reject); 8703 }); 8704 } 8705 8706 return Promise.resolve(value).then(function(unwrapped) { 8707 // When a yielded Promise is resolved, its final value becomes 8708 // the .value of the Promise<{value,done}> result for the 8709 // current iteration. If the Promise is rejected, however, the 8710 // result for this iteration will be rejected with the same 8711 // reason. Note that rejections of yielded Promises are not 8712 // thrown back into the generator function, as is the case 8713 // when an awaited Promise is rejected. This difference in 8714 // behavior between yield and await is important, because it 8715 // allows the consumer to decide what to do with the yielded 8716 // rejection (swallow it and continue, manually .throw it back 8717 // into the generator, abandon iteration, whatever). With 8718 // await, by contrast, there is no opportunity to examine the 8719 // rejection reason outside the generator function, so the 8720 // only option is to throw it from the await expression, and 8721 // let the generator function handle the exception. 8722 result.value = unwrapped; 8723 resolve(result); 8724 }, reject); 8725 } 8726 } 8727 8728 if (typeof global.process === "object" && global.process.domain) { 8729 invoke = global.process.domain.bind(invoke); 8730 } 8731 8732 var previousPromise; 8733 8734 function enqueue(method, arg) { 8735 function callInvokeWithMethodAndArg() { 8736 return new Promise(function(resolve, reject) { 8737 invoke(method, arg, resolve, reject); 8738 }); 8739 } 8740 8741 return previousPromise = 8742 // If enqueue has been called before, then we want to wait until 8743 // all previous Promises have been resolved before calling invoke, 8744 // so that results are always delivered in the correct order. If 8745 // enqueue has not been called before, then it is important to 8746 // call invoke immediately, without waiting on a callback to fire, 8747 // so that the async generator function has the opportunity to do 8748 // any necessary setup in a predictable way. This predictability 8749 // is why the Promise constructor synchronously invokes its 8750 // executor callback, and why async functions synchronously 8751 // execute code before the first await. Since we implement simple 8752 // async functions in terms of async generators, it is especially 8753 // important to get this right, even though it requires care. 8754 previousPromise ? previousPromise.then( 8755 callInvokeWithMethodAndArg, 8756 // Avoid propagating failures to Promises returned by later 8757 // invocations of the iterator. 8758 callInvokeWithMethodAndArg 8759 ) : callInvokeWithMethodAndArg(); 8760 } 8761 8762 // Define the unified helper method that is used to implement .next, 8763 // .throw, and .return (see defineIteratorMethods). 8764 this._invoke = enqueue; 8765 } 8766 8767 defineIteratorMethods(AsyncIterator.prototype); 8768 AsyncIterator.prototype[asyncIteratorSymbol] = function () { 8769 return this; 8770 }; 8771 runtime.AsyncIterator = AsyncIterator; 8772 8773 // Note that simple async functions are implemented on top of 8774 // AsyncIterator objects; they just return a Promise for the value of 8775 // the final result produced by the iterator. 8776 runtime.async = function(innerFn, outerFn, self, tryLocsList) { 8777 var iter = new AsyncIterator( 8778 wrap(innerFn, outerFn, self, tryLocsList) 8779 ); 8780 8781 return runtime.isGeneratorFunction(outerFn) 8782 ? iter // If outerFn is a generator, return the full iterator. 8783 : iter.next().then(function(result) { 8784 return result.done ? result.value : iter.next(); 8785 }); 8786 }; 8787 8788 function makeInvokeMethod(innerFn, self, context) { 8789 var state = GenStateSuspendedStart; 8790 8791 return function invoke(method, arg) { 8792 if (state === GenStateExecuting) { 8793 throw new Error("Generator is already running"); 8794 } 8795 8796 if (state === GenStateCompleted) { 8797 if (method === "throw") { 8798 throw arg; 8799 } 8800 8801 // Be forgiving, per 25.3.3.3.3 of the spec: 8802 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 8803 return doneResult(); 8804 } 8805 8806 context.method = method; 8807 context.arg = arg; 8808 8809 while (true) { 8810 var delegate = context.delegate; 8811 if (delegate) { 8812 var delegateResult = maybeInvokeDelegate(delegate, context); 8813 if (delegateResult) { 8814 if (delegateResult === ContinueSentinel) continue; 8815 return delegateResult; 8816 } 8817 } 8818 8819 if (context.method === "next") { 8820 // Setting context._sent for legacy support of Babel's 8821 // function.sent implementation. 8822 context.sent = context._sent = context.arg; 8823 8824 } else if (context.method === "throw") { 8825 if (state === GenStateSuspendedStart) { 8826 state = GenStateCompleted; 8827 throw context.arg; 8828 } 8829 8830 context.dispatchException(context.arg); 8831 8832 } else if (context.method === "return") { 8833 context.abrupt("return", context.arg); 8834 } 8835 8836 state = GenStateExecuting; 8837 8838 var record = tryCatch(innerFn, self, context); 8839 if (record.type === "normal") { 8840 // If an exception is thrown from innerFn, we leave state === 8841 // GenStateExecuting and loop back for another invocation. 8842 state = context.done 8843 ? GenStateCompleted 8844 : GenStateSuspendedYield; 8845 8846 if (record.arg === ContinueSentinel) { 8847 continue; 8848 } 8849 8850 return { 8851 value: record.arg, 8852 done: context.done 8853 }; 8854 8855 } else if (record.type === "throw") { 8856 state = GenStateCompleted; 8857 // Dispatch the exception by looping back around to the 8858 // context.dispatchException(context.arg) call above. 8859 context.method = "throw"; 8860 context.arg = record.arg; 8861 } 8862 } 8863 }; 8864 } 8865 8866 // Call delegate.iterator[context.method](context.arg) and handle the 8867 // result, either by returning a { value, done } result from the 8868 // delegate iterator, or by modifying context.method and context.arg, 8869 // setting context.delegate to null, and returning the ContinueSentinel. 8870 function maybeInvokeDelegate(delegate, context) { 8871 var method = delegate.iterator[context.method]; 8872 if (method === undefined) { 8873 // A .throw or .return when the delegate iterator has no .throw 8874 // method always terminates the yield* loop. 8875 context.delegate = null; 8876 8877 if (context.method === "throw") { 8878 if (delegate.iterator.return) { 8879 // If the delegate iterator has a return method, give it a 8880 // chance to clean up. 8881 context.method = "return"; 8882 context.arg = undefined; 8883 maybeInvokeDelegate(delegate, context); 8884 8885 if (context.method === "throw") { 8886 // If maybeInvokeDelegate(context) changed context.method from 8887 // "return" to "throw", let that override the TypeError below.
vendor: 4,657 bytes, lines 8888-9041
8888 return ContinueSentinel; 8889 } 8890 } 8891 8892 context.method = "throw"; 8893 context.arg = new TypeError( 8894 "The iterator does not provide a 'throw' method"); 8895 } 8896 8897 return ContinueSentinel; 8898 } 8899 8900 var record = tryCatch(method, delegate.iterator, context.arg); 8901 8902 if (record.type === "throw") { 8903 context.method = "throw"; 8904 context.arg = record.arg; 8905 context.delegate = null; 8906 return ContinueSentinel; 8907 } 8908 8909 var info = record.arg; 8910 8911 if (! info) { 8912 context.method = "throw"; 8913 context.arg = new TypeError("iterator result is not an object"); 8914 context.delegate = null; 8915 return ContinueSentinel; 8916 } 8917 8918 if (info.done) { 8919 // Assign the result of the finished delegate to the temporary 8920 // variable specified by delegate.resultName (see delegateYield). 8921 context[delegate.resultName] = info.value; 8922 8923 // Resume execution at the desired location (see delegateYield). 8924 context.next = delegate.nextLoc; 8925 8926 // If context.method was "throw" but the delegate handled the 8927 // exception, let the outer generator proceed normally. If 8928 // context.method was "next", forget context.arg since it has been 8929 // "consumed" by the delegate iterator. If context.method was 8930 // "return", allow the original .return call to continue in the 8931 // outer generator. 8932 if (context.method !== "return") { 8933 context.method = "next"; 8934 context.arg = undefined; 8935 } 8936 8937 } else { 8938 // Re-yield the result returned by the delegate method. 8939 return info; 8940 } 8941 8942 // The delegate iterator is finished, so forget it and continue with 8943 // the outer generator. 8944 context.delegate = null; 8945 return ContinueSentinel; 8946 } 8947 8948 // Define Generator.prototype.{next,throw,return} in terms of the 8949 // unified ._invoke helper method. 8950 defineIteratorMethods(Gp); 8951 8952 Gp[toStringTagSymbol] = "Generator"; 8953 8954 // A Generator should always return itself as the iterator object when the 8955 // @@iterator function is called on it. Some browsers' implementations of the 8956 // iterator prototype chain incorrectly implement this, causing the Generator 8957 // object to not be returned from this call. This ensures that doesn't happen. 8958 // See https://github.com/facebook/regenerator/issues/274 for more details. 8959 Gp[iteratorSymbol] = function() { 8960 return this; 8961 }; 8962 8963 Gp.toString = function() { 8964 return "[object Generator]"; 8965 }; 8966 8967 function pushTryEntry(locs) { 8968 var entry = { tryLoc: locs[0] }; 8969 8970 if (1 in locs) { 8971 entry.catchLoc = locs[1]; 8972 } 8973 8974 if (2 in locs) { 8975 entry.finallyLoc = locs[2]; 8976 entry.afterLoc = locs[3]; 8977 } 8978 8979 this.tryEntries.push(entry); 8980 } 8981 8982 function resetTryEntry(entry) { 8983 var record = entry.completion || {}; 8984 record.type = "normal"; 8985 delete record.arg; 8986 entry.completion = record; 8987 } 8988 8989 function Context(tryLocsList) { 8990 // The root entry object (effectively a try statement without a catch 8991 // or a finally block) gives us a place to store values thrown from 8992 // locations where there is no enclosing try statement. 8993 this.tryEntries = [{ tryLoc: "root" }]; 8994 tryLocsList.forEach(pushTryEntry, this); 8995 this.reset(true); 8996 } 8997 8998 runtime.keys = function(object) { 8999 var keys = []; 9000 for (var key in object) { 9001 keys.push(key); 9002 } 9003 keys.reverse(); 9004 9005 // Rather than returning an object with a next method, we keep 9006 // things simple and return the next function itself. 9007 return function next() { 9008 while (keys.length) { 9009 var key = keys.pop(); 9010 if (key in object) { 9011 next.value = key; 9012 next.done = false; 9013 return next; 9014 } 9015 } 9016 9017 // To avoid creating an additional object, we just hang the .value 9018 // and .done properties off the next function object itself. This 9019 // also ensures that the minifier will not anonymize the function. 9020 next.done = true; 9021 return next; 9022 }; 9023 }; 9024 9025 function values(iterable) { 9026 if (iterable) { 9027 var iteratorMethod = iterable[iteratorSymbol]; 9028 if (iteratorMethod) { 9029 return iteratorMethod.call(iterable); 9030 } 9031 9032 if (typeof iterable.next === "function") { 9033 return iterable; 9034 } 9035 9036 if (!isNaN(iterable.length)) { 9037 var i = -1, next = function next() { 9038 while (++i < iterable.length) { 9039 if (hasOwn.call(iterable, i)) { 9040 next.value = iterable[i]; 9041 next.done = false;
vendor: 4,367 bytes, lines 9042-9201
9042 return next; 9043 } 9044 } 9045 9046 next.value = undefined; 9047 next.done = true; 9048 9049 return next; 9050 }; 9051 9052 return next.next = next; 9053 } 9054 } 9055 9056 // Return an iterator with no values. 9057 return { next: doneResult }; 9058 } 9059 runtime.values = values; 9060 9061 function doneResult() { 9062 return { value: undefined, done: true }; 9063 } 9064 9065 Context.prototype = { 9066 constructor: Context, 9067 9068 reset: function(skipTempReset) { 9069 this.prev = 0; 9070 this.next = 0; 9071 // Resetting context._sent for legacy support of Babel's 9072 // function.sent implementation. 9073 this.sent = this._sent = undefined; 9074 this.done = false; 9075 this.delegate = null; 9076 9077 this.method = "next"; 9078 this.arg = undefined; 9079 9080 this.tryEntries.forEach(resetTryEntry); 9081 9082 if (!skipTempReset) { 9083 for (var name in this) { 9084 // Not sure about the optimal order of these conditions: 9085 if (name.charAt(0) === "t" && 9086 hasOwn.call(this, name) && 9087 !isNaN(+name.slice(1))) { 9088 this[name] = undefined; 9089 } 9090 } 9091 } 9092 }, 9093 9094 stop: function() { 9095 this.done = true; 9096 9097 var rootEntry = this.tryEntries[0]; 9098 var rootRecord = rootEntry.completion; 9099 if (rootRecord.type === "throw") { 9100 throw rootRecord.arg; 9101 } 9102 9103 return this.rval; 9104 }, 9105 9106 dispatchException: function(exception) { 9107 if (this.done) { 9108 throw exception; 9109 } 9110 9111 var context = this; 9112 function handle(loc, caught) { 9113 record.type = "throw"; 9114 record.arg = exception; 9115 context.next = loc; 9116 9117 if (caught) { 9118 // If the dispatched exception was caught by a catch block, 9119 // then let that catch block handle the exception normally. 9120 context.method = "next"; 9121 context.arg = undefined; 9122 } 9123 9124 return !! caught; 9125 } 9126 9127 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 9128 var entry = this.tryEntries[i]; 9129 var record = entry.completion; 9130 9131 if (entry.tryLoc === "root") { 9132 // Exception thrown outside of any try block that could handle 9133 // it, so set the completion value of the entire function to 9134 // throw the exception. 9135 return handle("end"); 9136 } 9137 9138 if (entry.tryLoc <= this.prev) { 9139 var hasCatch = hasOwn.call(entry, "catchLoc"); 9140 var hasFinally = hasOwn.call(entry, "finallyLoc"); 9141 9142 if (hasCatch && hasFinally) { 9143 if (this.prev < entry.catchLoc) { 9144 return handle(entry.catchLoc, true); 9145 } else if (this.prev < entry.finallyLoc) { 9146 return handle(entry.finallyLoc); 9147 } 9148 9149 } else if (hasCatch) { 9150 if (this.prev < entry.catchLoc) { 9151 return handle(entry.catchLoc, true); 9152 } 9153 9154 } else if (hasFinally) { 9155 if (this.prev < entry.finallyLoc) { 9156 return handle(entry.finallyLoc); 9157 } 9158 9159 } else { 9160 throw new Error("try statement without catch or finally"); 9161 } 9162 } 9163 } 9164 }, 9165 9166 abrupt: function(type, arg) { 9167 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 9168 var entry = this.tryEntries[i]; 9169 if (entry.tryLoc <= this.prev && 9170 hasOwn.call(entry, "finallyLoc") && 9171 this.prev < entry.finallyLoc) { 9172 var finallyEntry = entry; 9173 break; 9174 } 9175 } 9176 9177 if (finallyEntry && 9178 (type === "break" || 9179 type === "continue") && 9180 finallyEntry.tryLoc <= arg && 9181 arg <= finallyEntry.finallyLoc) { 9182 // Ignore the finally entry if control is not jumping to a 9183 // location outside the try/catch block. 9184 finallyEntry = null; 9185 } 9186 9187 var record = finallyEntry ? finallyEntry.completion : {}; 9188 record.type = type; 9189 record.arg = arg; 9190 9191 if (finallyEntry) { 9192 this.method = "next"; 9193 this.next = finallyEntry.finallyLoc; 9194 return ContinueSentinel; 9195 } 9196 9197 return this.complete(record); 9198 }, 9199 9200 complete: function(record, afterLoc) { 9201 if (record.type === "throw") {
9202 throw record.arg; 9203 } 9204 9205 if (record.type === "break" || 9206 record.type === "continue") { 9207 this.next = record.arg; 9208 } else if (record.type === "return") { 9209 this.rval = this.arg = record.arg; 9210 this.method = "return"; 9211 this.next = "end"; 9212 } else if (record.type === "normal" && afterLoc) { 9213 this.next = afterLoc; 9214 } 9215 9216 return ContinueSentinel; 9217 }, 9218 9219 finish: function(finallyLoc) { 9220 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 9221 var entry = this.tryEntries[i]; 9222 if (entry.finallyLoc === finallyLoc) { 9223 this.complete(entry.completion, entry.afterLoc); 9224 resetTryEntry(entry); 9225 return ContinueSentinel; 9226 } 9227 } 9228 }, 9229 9230 "catch": function(tryLoc) { 9231 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 9232 var entry = this.tryEntries[i]; 9233 if (entry.tryLoc === tryLoc) { 9234 var record = entry.completion; 9235 if (record.type === "throw") { 9236 var thrown = record.arg; 9237 resetTryEntry(entry); 9238 } 9239 return thrown; 9240 } 9241 } 9242 9243 // The context.catch method must only be called with a location 9244 // argument that corresponds to a known catch block. 9245 throw new Error("illegal catch attempt"); 9246 }, 9247 9248 delegateYield: function(iterable, resultName, nextLoc) { 9249 this.delegate = { 9250 iterator: values(iterable), 9251 resultName: resultName, 9252 nextLoc: nextLoc 9253 }; 9254 9255 if (this.method === "next") { 9256 // Deliberately forget the last sent value so that we don't 9257 // accidentally pass it on to the delegate. 9258 this.arg = undefined; 9259 } 9260 9261 return ContinueSentinel; 9262 } 9263 }; 9264 })( 9265 // Among the various tricks for obtaining a reference to the global 9266 // object, this seems to be the most reliable technique that does not 9267 // use indirect eval (which violates Content Security Policy). 9268 typeof global === "object" ? global : 9269 typeof window === "object" ? window : 9270 typeof self === "object" ? self : this 9271 ); 9272 9273 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 9274 9275/***/ }), 9276/* 329 */ 9277/***/ (function(module, exports, __webpack_require__) { 9278 9279 __webpack_require__(330); 9280 module.exports = __webpack_require__(9).RegExp.escape; 9281 9282 9283/***/ }), 9284/* 330 */ 9285/***/ (function(module, exports, __webpack_require__) { 9286 9287 // https://github.com/benjamingr/RexExp.escape 9288 var $export = __webpack_require__(8); 9289 var $re = __webpack_require__(331)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); 9290 9291 $export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } }); 9292 9293 9294/***/ }), 9295/* 331 */ 9296/***/ (function(module, exports) { 9297 9298 module.exports = function (regExp, replace) { 9299 var replacer = replace === Object(replace) ? function (part) { 9300 return replace[part]; 9301 } : replace; 9302 return function (it) { 9303 return String(it).replace(regExp, replacer); 9304 }; 9305 }; 9306 9307 9308/***/ }), 9309/* 332 */ 9310/***/ (function(module, exports) { 9311 9312 if (window.NodeList && !NodeList.prototype.forEach) { 9313 NodeList.prototype.forEach = function (callback, thisArg) { 9314 thisArg = thisArg || window; 9315 for (var i = 0; i < this.length; i++) { 9316 callback.call(thisArg, this[i], i, this); 9317 } 9318 }; 9319 } 9320 9321 9322/***/ }), 9323/* 333 */ 9324/***/ (function(module, exports, __webpack_require__) { 9325 9326 'use strict'; 9327 9328 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; }; })(); 9329 9330 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9331 9332 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 9333 9334 var _utilRouting = __webpack_require__(334); 9335 9336 var _utilRouting2 = _interopRequireDefault(_utilRouting); 9337 9338 // import Foundation from 'foundation-sites'; 9339 9340 var devicejs = __webpack_require__(432); 9341 var imagesLoaded = __webpack_require__(344); 9342 var owlCarousel = __webpack_require__(433); 9343 var lightcase = __webpack_require__(434); 9344 var simplyScroll = __webpack_require__(435); 9345 9346 $(function () { 9347 var app = new App(); 9348 }); 9349 9350 var App = (function () { 9351 function App(el) { 9352 _classCallCheck(this, App); 9353 9354 this.el = el; 9355 this.$el = $(el); 9356 this.initialize(); 9357 } 9358 9359 _createClass(App, [{ 9360 key: 'initialize', 9361 value: function initialize() { 9362 var _this2 = this; 9363 9364 var _this = this; 9365 // routing.js loadå¾ 9366 !/* require.ensure */(function () { 9367 (0, _utilRouting2['default'])(); 9368 _this2.common_scripts(); 9369 }(__webpack_require__)); 9370 } 9371 }, { 9372 key: 'common_scripts', 9373 value: function common_scripts() { 9374 // common scripts 9375 console.log('common scripts here !'); 9376 setCarousel(); 9377 setUp(); 9378 } 9379 }]); 9380 9381 return App; 9382 })(); 9383 9384 function setUp() { 9385 if ($("#notify").length) { 9386 var notify_interval; 9387 notify_interval = setInterval(function () { 9388 $("#notify").addClass("notify-hide"); 9389 clearInterval(notify_interval); 9390 }, 8000); 9391 } 9392 9393 $("#philosophy-photos").simplyScroll({ 9394 pauseOnHover: false, 9395 pauseOnTouch: false 9396 }); 9397 9398 $('.more').click(function () { 9399 var target = $(this).attr("href").split('#')[1]; 9400 var label = $(this).html().split('ã')[0]; 9401 if ($('.s-more-' + target).is(':visible')) { 9402 $(this).html(label + 'ã表示'); 9403 } else { 9404 $(this).html(label + 'ãé表示'); 9405 } 9406 $('.s-more-' + target).slideToggle(); 9407 }); 9408 9409 $('.movie').click(function () { 9410 var html_str; 9411 var movie_str = $(this).attr("data-movie"); 9412 var domain = movie_str.split('/')[2]; 9413 if (domain == 'www.youtube.com') { 9414 html_str = '<iframe src="' + movie_str + '?rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>'; 9415 } else if (domain == 'player.vimeo.com') { 9416 html_str = '<iframe src="' + movie_str + '?autoplay=1&title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; 9417 } 9418 $(this).find('.preview, .playbtn').remove(); 9419 $(this).append(html_str); 9420 }); 9421 9422 $('.header-account a, .close').click(function () { 9423 $('body').toggleClass('signin-nav-open'); 9424 }); 9425 9426 if ($('.s-list.update-list').length) { 9427 var update_height_array = new Array(); 9428 $('.s-list.update-list li').each(function () { 9429 var h = $(this).find('.update').height(); 9430 console.log(h); 9431 update_height_array.push(h); 9432 }); 9433 var max_height = Math.max.apply(null, update_height_array); //=> 8 9434 $('.s-list.update-list li').each(function () { 9435 $(this).find('.update').height(max_height); 9436 }); 9437 } 9438 9439 $('a[data-rel^=lightcase]').lightcase({ 9440 inline: { 9441 width: '800px' 9442 }, 9443 onStart: { 9444 start: function start() { 9445 $('html, body').addClass('modal'); 9446 } 9447 }, 9448 onClose: { 9449 close: function close() { 9450 $('html, body').removeClass('modal'); 9451 } 9452 } 9453 }); 9454 } 9455 9456 function setCarousel() { 9457 $('.background.owl-carousel').owlCarousel({ 9458 singleItem: true, 9459 items: 1, 9460 loop: true, 9461 autoplay: true, 9462 autoplayTimeout: 2800, 9463 autoplayHoverPause: false, 9464 animateOut: 'fadeOut', 9465 nav: false 9466 }); 9467 9468 $('.history.owl-carousel').owlCarousel({ 9469 singleItem: true, 9470 items: 1, 9471 loop: true, 9472 center: true, 9473 autoplay: true, 9474 nav: true, 9475 navText: ["<img src='/images/arrow_prev.svg' />", "<img src='/images/arrow_next.svg' />"], 9476 autoplayTimeout: 10000 9477 }); 9478 9479 $('.comments.owl-carousel').owlCarousel({ 9480 singleItem: true, 9481 items: 1, 9482 loop: true, 9483 // autoplay: true, 9484 autoplayTimeout: 5000 9485 }); 9486 $('.carousel.owl-carousel').owlCarousel({ 9487 autoWidth: true, 9488 items: 4 9489 }); 9490 $('.banner.owl-carousel').owlCarousel({ 9491 center: true, 9492 items: 1, 9493 loop: true, 9494 nav: true, 9495 navText: ["<img src='/images/arrow_prev.svg' />", "<img src='/images/arrow_next.svg' />"], 9496 autoplayTimeout: 5000, 9497 autoplayHoverPause: true, 9498 responsive: { 9499 0: { 9500 stagePadding: 60 9501 }, 9502 640: { 9503 stagePadding: 160 9504 } 9505 } 9506 }); 9507 9508 $('.mission-list.owl-carousel').owlCarousel({ 9509 autoWidth: true, 9510 items: 4 9511 }); 9512 9513 $('.support-list.owl-carousel').owlCarousel({ 9514 autoWidth: true, 9515 items: 4 9516 }); 9517 } 9518 9519/***/ }), 9520/* 334 */ 9521/***/ (function(module, exports, __webpack_require__) { 9522 9523 'use strict'; 9524 9525 Object.defineProperty(exports, '__esModule', { 9526 value: true 9527 }); 9528 9529 exports['default'] = function () { 9530 var body = document.getElementsByTagName('body'); 9531 var pageId = body[0].getAttribute('data-page-id'); 9532 if (pageId) { 9533 var Module = __webpack_require__(335)("./" + pageId); 9534 new Module(pageId); 9535 } 9536 }; 9537 9538 module.exports = exports['default']; 9539 9540/***/ }), 9541/* 335 */ 9542/***/ (function(module, exports, __webpack_require__) { 9543 9544 var map = { 9545 "./about": 336, 9546 "./about.js": 336, 9547 "./agreements": 337, 9548 "./agreements.js": 337, 9549 "./confirmation_new": 341, 9550 "./confirmation_new.js": 341, 9551 "./contact_new": 342, 9552 "./contact_new.js": 342, 9553 "./discover_category": 343, 9554 "./discover_category.js": 343, 9555 "./discover_category_project": 349, 9556 "./discover_category_project.js": 349, 9557 "./discover_curator": 350, 9558 "./discover_curator.js": 350, 9559 "./discover_curator_project": 351, 9560 "./discover_curator_project.js": 351, 9561 "./discover_feature": 352, 9562 "./discover_feature.js": 352, 9563 "./discover_feature_project": 353, 9564 "./discover_feature_project.js": 353, 9565 "./discover_tag": 354, 9566 "./discover_tag.js": 354, 9567 "./discover_tag_project": 355, 9568 "./discover_tag_project.js": 355, 9569 "./followers": 356,
9570 "./followers.js": 356, 9571 "./follows": 357, 9572 "./follows.js": 357, 9573 "./follows_search": 358, 9574 "./follows_search.js": 358, 9575 "./home": 359, 9576 "./home.js": 359, 9577 "./mails_received": 374, 9578 "./mails_received.js": 374, 9579 "./mails_sent": 375, 9580 "./mails_sent.js": 375, 9581 "./message": 376, 9582 "./message.js": 376, 9583 "./new_project": 377, 9584 "./new_project.js": 377, 9585 "./password_new": 378, 9586 "./password_new.js": 378, 9587 "./payment_confirm": 379, 9588 "./payment_confirm.js": 379, 9589 "./payment_information": 380, 9590 "./payment_information.js": 380, 9591 "./payment_information_bank": 381, 9592 "./payment_information_bank.js": 381, 9593 "./payment_information_card": 382, 9594 "./payment_information_card.js": 382, 9595 "./payment_information_card_edit": 383, 9596 "./payment_information_card_edit.js": 383, 9597 "./payment_information_store": 384, 9598 "./payment_information_store.js": 384, 9599 "./payment_new": 385, 9600 "./payment_new.js": 385, 9601 "./payment_new_concept": 387, 9602 "./payment_new_concept.js": 387, 9603 "./profile": 388, 9604 "./profile.js": 388, 9605 "./profile_confirmation": 389, 9606 "./profile_confirmation.js": 389, 9607 "./profile_edit": 390, 9608 "./profile_edit.js": 390, 9609 "./profile_edit_email": 391, 9610 "./profile_edit_email.js": 391, 9611 "./profile_edit_image": 392, 9612 "./profile_edit_image.js": 392, 9613 "./profile_edit_password": 420, 9614 "./profile_edit_password.js": 420, 9615 "./profile_mail_subscriptions": 421, 9616 "./profile_mail_subscriptions.js": 421, 9617 "./profile_twitter": 422, 9618 "./profile_twitter.js": 422, 9619 "./profile_user_address": 423, 9620 "./profile_user_address.js": 423, 9621 "./project": 424, 9622 "./project.js": 424, 9623 "./sign_in": 425, 9624 "./sign_in.js": 425, 9625 "./sign_up": 426, 9626 "./sign_up.js": 426, 9627 "./signout": 427, 9628 "./signout.js": 427, 9629 "./trust": 428, 9630 "./trust.js": 428, 9631 "./withdrawal_first": 429, 9632 "./withdrawal_first.js": 429, 9633 "./withdrawal_second": 430, 9634 "./withdrawal_second.js": 430, 9635 "./withdrawal_validation": 431, 9636 "./withdrawal_validation.js": 431 9637 }; 9638 function webpackContext(req) { 9639 return __webpack_require__(webpackContextResolve(req)); 9640 }; 9641 function webpackContextResolve(req) { 9642 return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); 9643 }; 9644 webpackContext.keys = function webpackContextKeys() { 9645 return Object.keys(map); 9646 }; 9647 webpackContext.resolve = webpackContextResolve; 9648 module.exports = webpackContext; 9649 webpackContext.id = 335; 9650 9651 9652/***/ }), 9653/* 336 */ 9654/***/ (function(module, exports) { 9655 9656 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 9657 9658 'use strict'; 9659 9660 Object.defineProperty(exports, '__esModule', { 9661 value: true 9662 }); 9663 9664 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 9665 9666 var About = function About(args) { 9667 _classCallCheck(this, About); 9668 9669 // code 9670 console.log('about.js loaded'); 9671 } 9672 9673 // methods 9674 ; 9675 9676 exports['default'] = About; 9677 module.exports = exports['default']; 9678 9679/***/ }), 9680/* 337 */ 9681/***/ (function(module, exports, __webpack_require__) { 9682 9683 'use strict'; 9684 9685 Object.defineProperty(exports, '__esModule', { 9686 value: true 9687 }); 9688 9689 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 9690 9691 var validate = __webpack_require__(338); 9692 9693 var Agreements = function Agreements(args) { 9694 _classCallCheck(this, Agreements); 9695 9696 console.log('agreements.js loaded'); 9697 9698 // Form validation 9699 var values = [true, '1', 1]; 9700 9701 var constraints = { 9702 'terms_of_service[agree]': { 9703 presence: { 9704 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 9705 }, 9706 inclusion: { 9707 within: [true, '1'], 9708 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 9709 } 9710 } 9711 }; 9712 9713 // Hook up the form so we can prevent it from being posted 9714 var form = document.getElementById("agreements_form"); 9715 form.onsubmit = function (ev) { 9716 ev.preventDefault(); 9717 handleFormSubmit(form); 9718 }; 9719 9720 // Hook up the inputs to validate on the fly 9721 var inputs = document.querySelectorAll("input, textarea, select");
9722 inputs.forEach(function (element) { 9723 element.onchange = function (elem) { 9724 var errors = validate(form, constraints, { fullMessages: false }) || {}; 9725 showErrorsForInput(this, errors[this.name]); 9726 }; 9727 }); 9728 9729 function handleFormSubmit(form, input) { 9730 // validate the form against the constraints 9731 var errors = validate(form, constraints, { fullMessages: false }); 9732 // then we update the form to reflect the results 9733 showErrors(form, errors || {}); 9734 if (!errors) { 9735 showSuccess(); 9736 } 9737 } 9738 9739 // Updates the inputs with the validation errors 9740 function showErrors(form, errors) { 9741 // We loop through all the inputs and show the errors for that input 9742 form.querySelectorAll(".input_validate").forEach(function (input) { 9743 // Since the errors can be null if no errors were found we need to handle that 9744 showErrorsForInput(input, errors && errors[input.name]); 9745 }); 9746 } 9747 9748 // Shows the errors for a specific input 9749 function showErrorsForInput(input, errors) { 9750 // This is the root of the input 9751 var formGroup = closestParent(input.parentNode, "form-group"); 9752 // Find where the error messages will be insert into 9753 var messages = formGroup.querySelector(".error-messages"); 9754 // First we remove any old messages and resets the classes 9755 resetFormGroup(formGroup, messages); 9756 // If we have errors 9757 if (errors) { 9758 // we first mark the group has having errors 9759 formGroup.classList.add("has-error"); 9760 // then we append all the errors 9761 errors.forEach(function (error) { 9762 addError(messages, error); 9763 }); 9764 } else { 9765 // otherwise we simply mark it as success 9766 formGroup.classList.add("has-success"); 9767 } 9768 } 9769 9770 // Recusively finds the closest parent that has the specified class 9771 function closestParent(_x, _x2) { 9772 var _again = true; 9773 9774 _function: while (_again) { 9775 var child = _x, 9776 className = _x2; 9777 _again = false; 9778 9779 if (!child || child == document) { 9780 return null; 9781 } 9782 if (child.classList.contains(className)) { 9783 return child; 9784 } else { 9785 _x = child.parentNode; 9786 _x2 = className; 9787 _again = true; 9788 continue _function; 9789 } 9790 } 9791 } 9792 9793 function resetFormGroup(formGroup, messages) { 9794 // Remove the success and error classes 9795 formGroup.classList.remove("has-error"); 9796 formGroup.classList.remove("has-success"); 9797 messages.classList.remove("show"); 9798 // and remove any old messages 9799 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 9800 // el.parentNode.removeChild(el); 9801 // }); 9802 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 9803 element.parentNode.removeChild(element); 9804 }); 9805 } 9806 9807 // Adds the specified error with the following markup 9808 // <p class="help-block error">[message]</p> 9809 function addError(messages, error) { 9810 var block = document.createElement("p"); 9811 block.classList.add("help-block"); 9812 block.classList.add("error"); 9813 block.innerText = error; 9814 messages.appendChild(block); 9815 messages.classList.add("show"); 9816 } 9817 9818 function showSuccess() { 9819 form.submit(); 9820 } 9821 } 9822 9823 // methods 9824 ; 9825 9826 exports['default'] = Agreements; 9827 module.exports = exports['default']; 9828 9829/***/ }), 9830/* 338 */ 9831/***/ (function(module, exports, __webpack_require__) { 9832 9833 /* WEBPACK VAR INJECTION */(function(module) {/*! 9834 * validate.js 0.12.0 9835 * 9836 * (c) 2013-2017 Nicklas Ansman, 2013 Wrapp 9837 * Validate.js may be freely distributed under the MIT license. 9838 * For all details and documentation: 9839 * http://validatejs.org/ 9840 */ 9841 9842 (function(exports, module, define) { 9843 "use strict"; 9844 9845 // The main function that calls the validators specified by the constraints. 9846 // The options are the following: 9847 // - format (string) - An option that controls how the returned value is formatted 9848 // * flat - Returns a flat array of just the error messages 9849 // * grouped - Returns the messages grouped by attribute (default) 9850 // * detailed - Returns an array of the raw validation data 9851 // - fullMessages (boolean) - If `true` (default) the attribute name is prepended to the error. 9852 // 9853 // Please note that the options are also passed to each validator.
vendor: 36,154 bytes, lines 9854-11023
9854 var validate = function(attributes, constraints, options) { 9855 options = v.extend({}, v.options, options); 9856 9857 var results = v.runValidations(attributes, constraints, options) 9858 , attr 9859 , validator; 9860 9861 if (results.some(function(r) { return v.isPromise(r.error); })) { 9862 throw new Error("Use validate.async if you want support for promises"); 9863 } 9864 return validate.processValidationResults(results, options); 9865 }; 9866 9867 var v = validate; 9868 9869 // Copies over attributes from one or more sources to a single destination. 9870 // Very much similar to underscore's extend. 9871 // The first argument is the target object and the remaining arguments will be 9872 // used as sources. 9873 v.extend = function(obj) { 9874 [].slice.call(arguments, 1).forEach(function(source) { 9875 for (var attr in source) { 9876 obj[attr] = source[attr]; 9877 } 9878 }); 9879 return obj; 9880 }; 9881 9882 v.extend(validate, { 9883 // This is the version of the library as a semver. 9884 // The toString function will allow it to be coerced into a string 9885 version: { 9886 major: 0, 9887 minor: 12, 9888 patch: 0, 9889 metadata: null, 9890 toString: function() { 9891 var version = v.format("%{major}.%{minor}.%{patch}", v.version); 9892 if (!v.isEmpty(v.version.metadata)) { 9893 version += "+" + v.version.metadata; 9894 } 9895 return version; 9896 } 9897 }, 9898 9899 // Below is the dependencies that are used in validate.js 9900 9901 // The constructor of the Promise implementation. 9902 // If you are using Q.js, RSVP or any other A+ compatible implementation 9903 // override this attribute to be the constructor of that promise. 9904 // Since jQuery promises aren't A+ compatible they won't work. 9905 Promise: typeof Promise !== "undefined" ? Promise : /* istanbul ignore next */ null, 9906 9907 EMPTY_STRING_REGEXP: /^\s*$/, 9908 9909 // Runs the validators specified by the constraints object. 9910 // Will return an array of the format: 9911 // [{attribute: "<attribute name>", error: "<validation result>"}, ...] 9912 runValidations: function(attributes, constraints, options) { 9913 var results = [] 9914 , attr 9915 , validatorName 9916 , value 9917 , validators 9918 , validator 9919 , validatorOptions 9920 , error; 9921 9922 if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) { 9923 attributes = v.collectFormValues(attributes); 9924 } 9925 9926 // Loops through each constraints, finds the correct validator and run it. 9927 for (attr in constraints) { 9928 value = v.getDeepObjectValue(attributes, attr); 9929 // This allows the constraints for an attribute to be a function. 9930 // The function will be called with the value, attribute name, the complete dict of 9931 // attributes as well as the options and constraints passed in. 9932 // This is useful when you want to have different 9933 // validations depending on the attribute value. 9934 validators = v.result(constraints[attr], value, attributes, attr, options, constraints); 9935 9936 for (validatorName in validators) { 9937 validator = v.validators[validatorName]; 9938 9939 if (!validator) { 9940 error = v.format("Unknown validator %{name}", {name: validatorName}); 9941 throw new Error(error); 9942 } 9943 9944 validatorOptions = validators[validatorName]; 9945 // This allows the options to be a function. The function will be 9946 // called with the value, attribute name, the complete dict of 9947 // attributes as well as the options and constraints passed in. 9948 // This is useful when you want to have different 9949 // validations depending on the attribute value. 9950 validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); 9951 if (!validatorOptions) { 9952 continue; 9953 } 9954 results.push({ 9955 attribute: attr, 9956 value: value, 9957 validator: validatorName, 9958 globalOptions: options, 9959 attributes: attributes, 9960 options: validatorOptions, 9961 error: validator.call(validator, 9962 value, 9963 validatorOptions, 9964 attr, 9965 attributes, 9966 options) 9967 }); 9968 } 9969 } 9970 9971 return results; 9972 }, 9973 9974 // Takes the output from runValidations and converts it to the correct 9975 // output format. 9976 processValidationResults: function(errors, options) { 9977 errors = v.pruneEmptyErrors(errors, options); 9978 errors = v.expandMultipleErrors(errors, options); 9979 errors = v.convertErrorMessages(errors, options); 9980 9981 var format = options.format || "grouped"; 9982 9983 if (typeof v.formatters[format] === 'function') { 9984 errors = v.formatters[format](errors); 9985 } else { 9986 throw new Error(v.format("Unknown format %{format}", options)); 9987 } 9988 9989 return v.isEmpty(errors) ? undefined : errors; 9990 }, 9991 9992 // Runs the validations with support for promises. 9993 // This function will return a promise that is settled when all the 9994 // validation promises have been completed. 9995 // It can be called even if no validations returned a promise. 9996 async: function(attributes, constraints, options) { 9997 options = v.extend({}, v.async.options, options); 9998 9999 var WrapErrors = options.wrapErrors || function(errors) { 10000 return errors; 10001 }; 10002 10003 // Removes unknown attributes 10004 if (options.cleanAttributes !== false) { 10005 attributes = v.cleanAttributes(attributes, constraints); 10006 } 10007 10008 var results = v.runValidations(attributes, constraints, options); 10009 10010 return new v.Promise(function(resolve, reject) { 10011 v.waitForResults(results).then(function() { 10012 var errors = v.processValidationResults(results, options); 10013 if (errors) { 10014 reject(new WrapErrors(errors, options, attributes, constraints)); 10015 } else { 10016 resolve(attributes); 10017 } 10018 }, function(err) { 10019 reject(err); 10020 }); 10021 }); 10022 }, 10023 10024 single: function(value, constraints, options) { 10025 options = v.extend({}, v.single.options, options, { 10026 format: "flat", 10027 fullMessages: false 10028 }); 10029 return v({single: value}, {single: constraints}, options); 10030 }, 10031 10032 // Returns a promise that is resolved when all promises in the results array 10033 // are settled. The promise returned from this function is always resolved, 10034 // never rejected. 10035 // This function modifies the input argument, it replaces the promises 10036 // with the value returned from the promise. 10037 waitForResults: function(results) { 10038 // Create a sequence of all the results starting with a resolved promise. 10039 return results.reduce(function(memo, result) { 10040 // If this result isn't a promise skip it in the sequence. 10041 if (!v.isPromise(result.error)) { 10042 return memo; 10043 } 10044 10045 return memo.then(function() { 10046 return result.error.then(function(error) { 10047 result.error = error || null; 10048 }); 10049 }); 10050 }, new v.Promise(function(r) { r(); })); // A resolved promise 10051 }, 10052 10053 // If the given argument is a call: function the and: function return the value 10054 // otherwise just return the value. Additional arguments will be passed as 10055 // arguments to the function. 10056 // Example: 10057 // ``` 10058 // result('foo') // 'foo' 10059 // result(Math.max, 1, 2) // 2 10060 // ``` 10061 result: function(value) { 10062 var args = [].slice.call(arguments, 1); 10063 if (typeof value === 'function') { 10064 value = value.apply(null, args); 10065 } 10066 return value; 10067 }, 10068 10069 // Checks if the value is a number. This function does not consider NaN a 10070 // number like many other `isNumber` functions do. 10071 isNumber: function(value) { 10072 return typeof value === 'number' && !isNaN(value); 10073 }, 10074 10075 // Returns false if the object is not a function 10076 isFunction: function(value) { 10077 return typeof value === 'function'; 10078 }, 10079 10080 // A simple check to verify that the value is an integer. Uses `isNumber` 10081 // and a simple modulo check. 10082 isInteger: function(value) { 10083 return v.isNumber(value) && value % 1 === 0; 10084 }, 10085 10086 // Checks if the value is a boolean 10087 isBoolean: function(value) { 10088 return typeof value === 'boolean'; 10089 }, 10090 10091 // Uses the `Object` function to check if the given argument is an object. 10092 isObject: function(obj) { 10093 return obj === Object(obj); 10094 }, 10095 10096 // Simply checks if the object is an instance of a date 10097 isDate: function(obj) { 10098 return obj instanceof Date; 10099 }, 10100 10101 // Returns false if the object is `null` of `undefined` 10102 isDefined: function(obj) { 10103 return obj !== null && obj !== undefined; 10104 }, 10105 10106 // Checks if the given argument is a promise. Anything with a `then` 10107 // function is considered a promise. 10108 isPromise: function(p) { 10109 return !!p && v.isFunction(p.then); 10110 }, 10111 10112 isJqueryElement: function(o) { 10113 return o && v.isString(o.jquery); 10114 }, 10115 10116 isDomElement: function(o) { 10117 if (!o) { 10118 return false; 10119 } 10120 10121 if (!o.querySelectorAll || !o.querySelector) { 10122 return false; 10123 } 10124 10125 if (v.isObject(document) && o === document) { 10126 return true; 10127 } 10128 10129 // http://stackoverflow.com/a/384380/699304 10130 /* istanbul ignore else */ 10131 if (typeof HTMLElement === "object") { 10132 return o instanceof HTMLElement; 10133 } else { 10134 return o && 10135 typeof o === "object" && 10136 o !== null && 10137 o.nodeType === 1 && 10138 typeof o.nodeName === "string"; 10139 } 10140 }, 10141 10142 isEmpty: function(value) { 10143 var attr; 10144 10145 // Null and undefined are empty 10146 if (!v.isDefined(value)) { 10147 return true; 10148 } 10149 10150 // functions are non empty 10151 if (v.isFunction(value)) { 10152 return false; 10153 } 10154 10155 // Whitespace only strings are empty 10156 if (v.isString(value)) { 10157 return v.EMPTY_STRING_REGEXP.test(value); 10158 } 10159 10160 // For arrays we use the length property 10161 if (v.isArray(value)) { 10162 return value.length === 0; 10163 } 10164 10165 // Dates have no attributes but aren't empty 10166 if (v.isDate(value)) { 10167 return false; 10168 } 10169 10170 // If we find at least one property we consider it non empty 10171 if (v.isObject(value)) { 10172 for (attr in value) { 10173 return false; 10174 } 10175 return true; 10176 } 10177 10178 return false; 10179 }, 10180 10181 // Formats the specified strings with the given values like so: 10182 // ``` 10183 // format("Foo: %{foo}", {foo: "bar"}) // "Foo bar" 10184 // ``` 10185 // If you want to write %{...} without having it replaced simply 10186 // prefix it with % like this `Foo: %%{foo}` and it will be returned 10187 // as `"Foo: %{foo}"` 10188 format: v.extend(function(str, vals) { 10189 if (!v.isString(str)) { 10190 return str; 10191 } 10192 return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) { 10193 if (m1 === '%') { 10194 return "%{" + m2 + "}"; 10195 } else { 10196 return String(vals[m2]); 10197 } 10198 }); 10199 }, { 10200 // Finds %{key} style patterns in the given string 10201 FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g 10202 }), 10203 10204 // "Prettifies" the given string. 10205 // Prettifying means replacing [.\_-] with spaces as well as splitting 10206 // camel case words. 10207 prettify: function(str) { 10208 if (v.isNumber(str)) { 10209 // If there are more than 2 decimals round it to two 10210 if ((str * 100) % 1 === 0) { 10211 return "" + str; 10212 } else { 10213 return parseFloat(Math.round(str * 100) / 100).toFixed(2); 10214 } 10215 } 10216 10217 if (v.isArray(str)) { 10218 return str.map(function(s) { return v.prettify(s); }).join(", "); 10219 } 10220 10221 if (v.isObject(str)) { 10222 return str.toString(); 10223 } 10224 10225 // Ensure the string is actually a string 10226 str = "" + str; 10227 10228 return str 10229 // Splits keys separated by periods 10230 .replace(/([^\s])\.([^\s])/g, '$1 $2') 10231 // Removes backslashes 10232 .replace(/\\+/g, '') 10233 // Replaces - and - with space 10234 .replace(/[_-]/g, ' ') 10235 // Splits camel cased words 10236 .replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { 10237 return "" + m1 + " " + m2.toLowerCase(); 10238 }) 10239 .toLowerCase(); 10240 }, 10241 10242 stringifyValue: function(value, options) { 10243 var prettify = options && options.prettify || v.prettify; 10244 return prettify(value); 10245 }, 10246 10247 isString: function(value) { 10248 return typeof value === 'string'; 10249 }, 10250 10251 isArray: function(value) { 10252 return {}.toString.call(value) === '[object Array]'; 10253 }, 10254 10255 // Checks if the object is a hash, which is equivalent to an object that 10256 // is neither an array nor a function. 10257 isHash: function(value) { 10258 return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); 10259 }, 10260 10261 contains: function(obj, value) { 10262 if (!v.isDefined(obj)) { 10263 return false; 10264 } 10265 if (v.isArray(obj)) { 10266 return obj.indexOf(value) !== -1; 10267 } 10268 return value in obj; 10269 }, 10270 10271 unique: function(array) { 10272 if (!v.isArray(array)) { 10273 return array; 10274 } 10275 return array.filter(function(el, index, array) { 10276 return array.indexOf(el) == index; 10277 }); 10278 }, 10279 10280 forEachKeyInKeypath: function(object, keypath, callback) { 10281 if (!v.isString(keypath)) { 10282 return undefined; 10283 } 10284 10285 var key = "" 10286 , i 10287 , escape = false; 10288 10289 for (i = 0; i < keypath.length; ++i) { 10290 switch (keypath[i]) { 10291 case '.': 10292 if (escape) { 10293 escape = false; 10294 key += '.'; 10295 } else { 10296 object = callback(object, key, false); 10297 key = ""; 10298 } 10299 break; 10300 10301 case '\\': 10302 if (escape) { 10303 escape = false; 10304 key += '\\'; 10305 } else { 10306 escape = true; 10307 } 10308 break; 10309 10310 default: 10311 escape = false; 10312 key += keypath[i]; 10313 break; 10314 } 10315 } 10316 10317 return callback(object, key, true); 10318 }, 10319 10320 getDeepObjectValue: function(obj, keypath) { 10321 if (!v.isObject(obj)) { 10322 return undefined; 10323 } 10324 10325 return v.forEachKeyInKeypath(obj, keypath, function(obj, key) { 10326 if (v.isObject(obj)) { 10327 return obj[key]; 10328 } 10329 }); 10330 }, 10331 10332 // This returns an object with all the values of the form. 10333 // It uses the input name as key and the value as value 10334 // So for example this: 10335 // <input type="text" name="email" value="[email protected]" /> 10336 // would return: 10337 // {email: "[email protected]"} 10338 collectFormValues: function(form, options) { 10339 var values = {} 10340 , i 10341 , j 10342 , input 10343 , inputs 10344 , option 10345 , value; 10346 10347 if (v.isJqueryElement(form)) { 10348 form = form[0]; 10349 } 10350 10351 if (!form) { 10352 return values; 10353 } 10354 10355 options = options || {}; 10356 10357 inputs = form.querySelectorAll("input[name], textarea[name]"); 10358 for (i = 0; i < inputs.length; ++i) { 10359 input = inputs.item(i); 10360 10361 if (v.isDefined(input.getAttribute("data-ignored"))) { 10362 continue; 10363 } 10364 10365 name = input.name.replace(/\./g, "\\\\."); 10366 value = v.sanitizeFormValue(input.value, options); 10367 if (input.type === "number") { 10368 value = value ? +value : null; 10369 } else if (input.type === "checkbox") { 10370 if (input.attributes.value) { 10371 if (!input.checked) { 10372 value = values[name] || null; 10373 } 10374 } else { 10375 value = input.checked; 10376 } 10377 } else if (input.type === "radio") { 10378 if (!input.checked) { 10379 value = values[name] || null; 10380 } 10381 } 10382 values[name] = value; 10383 } 10384 10385 inputs = form.querySelectorAll("select[name]"); 10386 for (i = 0; i < inputs.length; ++i) { 10387 input = inputs.item(i); 10388 if (v.isDefined(input.getAttribute("data-ignored"))) { 10389 continue; 10390 } 10391 10392 if (input.multiple) { 10393 value = []; 10394 for (j in input.options) { 10395 option = input.options[j]; 10396 if (option && option.selected) { 10397 value.push(v.sanitizeFormValue(option.value, options)); 10398 } 10399 } 10400 } else { 10401 var _val = typeof input.options[input.selectedIndex] !== 'undefined' ? input.options[input.selectedIndex].value : ''; 10402 value = v.sanitizeFormValue(_val, options); 10403 } 10404 values[input.name] = value; 10405 } 10406 10407 return values; 10408 }, 10409 10410 sanitizeFormValue: function(value, options) { 10411 if (options.trim && v.isString(value)) { 10412 value = value.trim(); 10413 } 10414 10415 if (options.nullify !== false && value === "") { 10416 return null; 10417 } 10418 return value; 10419 }, 10420 10421 capitalize: function(str) { 10422 if (!v.isString(str)) { 10423 return str; 10424 } 10425 return str[0].toUpperCase() + str.slice(1); 10426 }, 10427 10428 // Remove all errors who's error attribute is empty (null or undefined) 10429 pruneEmptyErrors: function(errors) { 10430 return errors.filter(function(error) { 10431 return !v.isEmpty(error.error); 10432 }); 10433 }, 10434 10435 // In 10436 // [{error: ["err1", "err2"], ...}] 10437 // Out 10438 // [{error: "err1", ...}, {error: "err2", ...}] 10439 // 10440 // All attributes in an error with multiple messages are duplicated 10441 // when expanding the errors. 10442 expandMultipleErrors: function(errors) { 10443 var ret = []; 10444 errors.forEach(function(error) { 10445 // Removes errors without a message 10446 if (v.isArray(error.error)) { 10447 error.error.forEach(function(msg) { 10448 ret.push(v.extend({}, error, {error: msg})); 10449 }); 10450 } else { 10451 ret.push(error); 10452 } 10453 }); 10454 return ret; 10455 }, 10456 10457 // Converts the error mesages by prepending the attribute name unless the 10458 // message is prefixed by ^ 10459 convertErrorMessages: function(errors, options) { 10460 options = options || {}; 10461 10462 var ret = [] 10463 , prettify = options.prettify || v.prettify; 10464 errors.forEach(function(errorInfo) { 10465 var error = v.result(errorInfo.error, 10466 errorInfo.value, 10467 errorInfo.attribute, 10468 errorInfo.options, 10469 errorInfo.attributes, 10470 errorInfo.globalOptions); 10471 10472 if (!v.isString(error)) { 10473 ret.push(errorInfo); 10474 return; 10475 } 10476 10477 if (error[0] === '^') { 10478 error = error.slice(1); 10479 } else if (options.fullMessages !== false) { 10480 error = v.capitalize(prettify(errorInfo.attribute)) + " " + error; 10481 } 10482 error = error.replace(/\\\^/g, "^"); 10483 error = v.format(error, { 10484 value: v.stringifyValue(errorInfo.value, options) 10485 }); 10486 ret.push(v.extend({}, errorInfo, {error: error})); 10487 }); 10488 return ret; 10489 }, 10490 10491 // In: 10492 // [{attribute: "<attributeName>", ...}] 10493 // Out: 10494 // {"<attributeName>": [{attribute: "<attributeName>", ...}]} 10495 groupErrorsByAttribute: function(errors) { 10496 var ret = {}; 10497 errors.forEach(function(error) { 10498 var list = ret[error.attribute]; 10499 if (list) { 10500 list.push(error); 10501 } else { 10502 ret[error.attribute] = [error]; 10503 } 10504 }); 10505 return ret; 10506 }, 10507 10508 // In: 10509 // [{error: "<message 1>", ...}, {error: "<message 2>", ...}] 10510 // Out: 10511 // ["<message 1>", "<message 2>"] 10512 flattenErrorsToArray: function(errors) { 10513 return errors 10514 .map(function(error) { return error.error; }) 10515 .filter(function(value, index, self) { 10516 return self.indexOf(value) === index; 10517 }); 10518 }, 10519 10520 cleanAttributes: function(attributes, whitelist) { 10521 function whitelistCreator(obj, key, last) { 10522 if (v.isObject(obj[key])) { 10523 return obj[key]; 10524 } 10525 return (obj[key] = last ? true : {}); 10526 } 10527 10528 function buildObjectWhitelist(whitelist) { 10529 var ow = {} 10530 , lastObject 10531 , attr; 10532 for (attr in whitelist) { 10533 if (!whitelist[attr]) { 10534 continue; 10535 } 10536 v.forEachKeyInKeypath(ow, attr, whitelistCreator); 10537 } 10538 return ow; 10539 } 10540 10541 function cleanRecursive(attributes, whitelist) { 10542 if (!v.isObject(attributes)) { 10543 return attributes; 10544 } 10545 10546 var ret = v.extend({}, attributes) 10547 , w 10548 , attribute; 10549 10550 for (attribute in attributes) { 10551 w = whitelist[attribute]; 10552 10553 if (v.isObject(w)) { 10554 ret[attribute] = cleanRecursive(ret[attribute], w); 10555 } else if (!w) { 10556 delete ret[attribute]; 10557 } 10558 } 10559 return ret; 10560 } 10561 10562 if (!v.isObject(whitelist) || !v.isObject(attributes)) { 10563 return {}; 10564 } 10565 10566 whitelist = buildObjectWhitelist(whitelist); 10567 return cleanRecursive(attributes, whitelist); 10568 }, 10569 10570 exposeModule: function(validate, root, exports, module, define) { 10571 if (exports) { 10572 if (module && module.exports) { 10573 exports = module.exports = validate; 10574 } 10575 exports.validate = validate; 10576 } else { 10577 root.validate = validate; 10578 if (validate.isFunction(define) && define.amd) { 10579 define([], function () { return validate; }); 10580 } 10581 } 10582 }, 10583 10584 warn: function(msg) { 10585 if (typeof console !== "undefined" && console.warn) { 10586 console.warn("[validate.js] " + msg); 10587 } 10588 }, 10589 10590 error: function(msg) { 10591 if (typeof console !== "undefined" && console.error) { 10592 console.error("[validate.js] " + msg); 10593 } 10594 } 10595 }); 10596 10597 validate.validators = { 10598 // Presence validates that the value isn't empty 10599 presence: function(value, options) { 10600 options = v.extend({}, this.options, options); 10601 if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { 10602 return options.message || this.message || "can't be blank"; 10603 } 10604 }, 10605 length: function(value, options, attribute) { 10606 // Empty values are allowed 10607 if (!v.isDefined(value)) { 10608 return; 10609 } 10610 10611 options = v.extend({}, this.options, options); 10612 10613 var is = options.is 10614 , maximum = options.maximum 10615 , minimum = options.minimum 10616 , tokenizer = options.tokenizer || function(val) { return val; } 10617 , err 10618 , errors = []; 10619 10620 value = tokenizer(value); 10621 var length = value.length; 10622 if(!v.isNumber(length)) { 10623 v.error(v.format("Attribute %{attr} has a non numeric value for `length`", {attr: attribute})); 10624 return options.message || this.notValid || "has an incorrect length"; 10625 } 10626 10627 // Is checks 10628 if (v.isNumber(is) && length !== is) { 10629 err = options.wrongLength || 10630 this.wrongLength || 10631 "is the wrong length (should be %{count} characters)"; 10632 errors.push(v.format(err, {count: is})); 10633 } 10634 10635 if (v.isNumber(minimum) && length < minimum) { 10636 err = options.tooShort || 10637 this.tooShort || 10638 "is too short (minimum is %{count} characters)"; 10639 errors.push(v.format(err, {count: minimum})); 10640 } 10641 10642 if (v.isNumber(maximum) && length > maximum) { 10643 err = options.tooLong || 10644 this.tooLong || 10645 "is too long (maximum is %{count} characters)"; 10646 errors.push(v.format(err, {count: maximum})); 10647 } 10648 10649 if (errors.length > 0) { 10650 return options.message || errors; 10651 } 10652 }, 10653 numericality: function(value, options, attribute, attributes, globalOptions) { 10654 // Empty values are fine 10655 if (!v.isDefined(value)) { 10656 return; 10657 } 10658 10659 options = v.extend({}, this.options, options); 10660 10661 var errors = [] 10662 , name 10663 , count 10664 , checks = { 10665 greaterThan: function(v, c) { return v > c; }, 10666 greaterThanOrEqualTo: function(v, c) { return v >= c; }, 10667 equalTo: function(v, c) { return v === c; }, 10668 lessThan: function(v, c) { return v < c; }, 10669 lessThanOrEqualTo: function(v, c) { return v <= c; }, 10670 divisibleBy: function(v, c) { return v % c === 0; } 10671 } 10672 , prettify = options.prettify || 10673 (globalOptions && globalOptions.prettify) || 10674 v.prettify; 10675 10676 // Strict will check that it is a valid looking number 10677 if (v.isString(value) && options.strict) { 10678 var pattern = "^-?(0|[1-9]\\d*)"; 10679 if (!options.onlyInteger) { 10680 pattern += "(\\.\\d+)?"; 10681 } 10682 pattern += "$"; 10683 10684 if (!(new RegExp(pattern).test(value))) { 10685 return options.message || 10686 options.notValid || 10687 this.notValid || 10688 this.message || 10689 "must be a valid number"; 10690 } 10691 } 10692 10693 // Coerce the value to a number unless we're being strict. 10694 if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { 10695 value = +value; 10696 } 10697 10698 // If it's not a number we shouldn't continue since it will compare it. 10699 if (!v.isNumber(value)) { 10700 return options.message || 10701 options.notValid || 10702 this.notValid || 10703 this.message || 10704 "is not a number"; 10705 } 10706 10707 // Same logic as above, sort of. Don't bother with comparisons if this 10708 // doesn't pass. 10709 if (options.onlyInteger && !v.isInteger(value)) { 10710 return options.message || 10711 options.notInteger || 10712 this.notInteger || 10713 this.message || 10714 "must be an integer"; 10715 } 10716 10717 for (name in checks) { 10718 count = options[name]; 10719 if (v.isNumber(count) && !checks[name](value, count)) { 10720 // This picks the default message if specified 10721 // For example the greaterThan check uses the message from 10722 // this.notGreaterThan so we capitalize the name and prepend "not" 10723 var key = "not" + v.capitalize(name); 10724 var msg = options[key] || 10725 this[key] || 10726 this.message || 10727 "must be %{type} %{count}"; 10728 10729 errors.push(v.format(msg, { 10730 count: count, 10731 type: prettify(name) 10732 })); 10733 } 10734 } 10735 10736 if (options.odd && value % 2 !== 1) { 10737 errors.push(options.notOdd || 10738 this.notOdd || 10739 this.message || 10740 "must be odd"); 10741 } 10742 if (options.even && value % 2 !== 0) { 10743 errors.push(options.notEven || 10744 this.notEven || 10745 this.message || 10746 "must be even"); 10747 } 10748 10749 if (errors.length) { 10750 return options.message || errors; 10751 } 10752 }, 10753 datetime: v.extend(function(value, options) { 10754 if (!v.isFunction(this.parse) || !v.isFunction(this.format)) { 10755 throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator"); 10756 } 10757 10758 // Empty values are fine 10759 if (!v.isDefined(value)) { 10760 return; 10761 } 10762 10763 options = v.extend({}, this.options, options); 10764 10765 var err 10766 , errors = [] 10767 , earliest = options.earliest ? this.parse(options.earliest, options) : NaN 10768 , latest = options.latest ? this.parse(options.latest, options) : NaN; 10769 10770 value = this.parse(value, options); 10771 10772 // 86400000 is the number of milliseconds in a day, this is used to remove 10773 // the time from the date 10774 if (isNaN(value) || options.dateOnly && value % 86400000 !== 0) { 10775 err = options.notValid || 10776 options.message || 10777 this.notValid || 10778 "must be a valid date"; 10779 return v.format(err, {value: arguments[0]}); 10780 } 10781 10782 if (!isNaN(earliest) && value < earliest) { 10783 err = options.tooEarly || 10784 options.message || 10785 this.tooEarly || 10786 "must be no earlier than %{date}"; 10787 err = v.format(err, { 10788 value: this.format(value, options), 10789 date: this.format(earliest, options) 10790 }); 10791 errors.push(err); 10792 } 10793 10794 if (!isNaN(latest) && value > latest) { 10795 err = options.tooLate || 10796 options.message || 10797 this.tooLate || 10798 "must be no later than %{date}"; 10799 err = v.format(err, { 10800 date: this.format(latest, options), 10801 value: this.format(value, options) 10802 }); 10803 errors.push(err); 10804 } 10805 10806 if (errors.length) { 10807 return v.unique(errors); 10808 } 10809 }, { 10810 parse: null, 10811 format: null 10812 }), 10813 date: function(value, options) { 10814 options = v.extend({}, options, {dateOnly: true}); 10815 return v.validators.datetime.call(v.validators.datetime, value, options); 10816 }, 10817 format: function(value, options) { 10818 if (v.isString(options) || (options instanceof RegExp)) { 10819 options = {pattern: options}; 10820 } 10821 10822 options = v.extend({}, this.options, options); 10823 10824 var message = options.message || this.message || "is invalid" 10825 , pattern = options.pattern 10826 , match; 10827 10828 // Empty values are allowed 10829 if (!v.isDefined(value)) { 10830 return; 10831 } 10832 if (!v.isString(value)) { 10833 return message; 10834 } 10835 10836 if (v.isString(pattern)) { 10837 pattern = new RegExp(options.pattern, options.flags); 10838 } 10839 match = pattern.exec(value); 10840 if (!match || match[0].length != value.length) { 10841 return message; 10842 } 10843 }, 10844 inclusion: function(value, options) { 10845 // Empty values are fine 10846 if (!v.isDefined(value)) { 10847 return; 10848 } 10849 if (v.isArray(options)) { 10850 options = {within: options}; 10851 } 10852 options = v.extend({}, this.options, options); 10853 if (v.contains(options.within, value)) { 10854 return; 10855 } 10856 var message = options.message || 10857 this.message || 10858 "^%{value} is not included in the list"; 10859 return v.format(message, {value: value}); 10860 }, 10861 exclusion: function(value, options) { 10862 // Empty values are fine 10863 if (!v.isDefined(value)) { 10864 return; 10865 } 10866 if (v.isArray(options)) { 10867 options = {within: options}; 10868 } 10869 options = v.extend({}, this.options, options); 10870 if (!v.contains(options.within, value)) { 10871 return; 10872 } 10873 var message = options.message || this.message || "^%{value} is restricted"; 10874 return v.format(message, {value: value}); 10875 }, 10876 email: v.extend(function(value, options) { 10877 options = v.extend({}, this.options, options); 10878 var message = options.message || this.message || "is not a valid email"; 10879 // Empty values are fine 10880 if (!v.isDefined(value)) { 10881 return; 10882 } 10883 if (!v.isString(value)) { 10884 return message; 10885 } 10886 if (!this.PATTERN.exec(value)) { 10887 return message; 10888 } 10889 }, { 10890 PATTERN: /^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i 10891 }), 10892 equality: function(value, options, attribute, attributes, globalOptions) { 10893 if (!v.isDefined(value)) { 10894 return; 10895 } 10896 10897 if (v.isString(options)) { 10898 options = {attribute: options}; 10899 } 10900 options = v.extend({}, this.options, options); 10901 var message = options.message || 10902 this.message || 10903 "is not equal to %{attribute}"; 10904 10905 if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) { 10906 throw new Error("The attribute must be a non empty string"); 10907 } 10908 10909 var otherValue = v.getDeepObjectValue(attributes, options.attribute) 10910 , comparator = options.comparator || function(v1, v2) { 10911 return v1 === v2; 10912 } 10913 , prettify = options.prettify || 10914 (globalOptions && globalOptions.prettify) || 10915 v.prettify; 10916 10917 if (!comparator(value, otherValue, options, attribute, attributes)) { 10918 return v.format(message, {attribute: prettify(options.attribute)}); 10919 } 10920 }, 10921 10922 // A URL validator that is used to validate URLs with the ability to 10923 // restrict schemes and some domains. 10924 url: function(value, options) { 10925 if (!v.isDefined(value)) { 10926 return; 10927 } 10928 10929 options = v.extend({}, this.options, options); 10930 10931 var message = options.message || this.message || "is not a valid url" 10932 , schemes = options.schemes || this.schemes || ['http', 'https'] 10933 , allowLocal = options.allowLocal || this.allowLocal || false; 10934 10935 if (!v.isString(value)) { 10936 return message; 10937 } 10938 10939 // https://gist.github.com/dperini/729294 10940 var regex = 10941 "^" + 10942 // protocol identifier 10943 "(?:(?:" + schemes.join("|") + ")://)" + 10944 // user:pass authentication 10945 "(?:\\S+(?::\\S*)?@)?" + 10946 "(?:"; 10947 10948 var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; 10949 10950 if (allowLocal) { 10951 tld += "?"; 10952 } else { 10953 regex += 10954 // IP address exclusion 10955 // private & local networks 10956 "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + 10957 "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + 10958 "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})"; 10959 } 10960 10961 regex += 10962 // IP address dotted notation octets 10963 // excludes loopback network 0.0.0.0 10964 // excludes reserved space >= 224.0.0.0 10965 // excludes network & broacast addresses 10966 // (first & last IP address of each class) 10967 "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + 10968 "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + 10969 "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + 10970 "|" + 10971 // host name 10972 "(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" + 10973 // domain name 10974 "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + 10975 tld + 10976 ")" + 10977 // port number 10978 "(?::\\d{2,5})?" + 10979 // resource path 10980 "(?:[/?#]\\S*)?" + 10981 "$"; 10982 10983 var PATTERN = new RegExp(regex, 'i'); 10984 if (!PATTERN.exec(value)) { 10985 return message; 10986 } 10987 } 10988 }; 10989 10990 validate.formatters = { 10991 detailed: function(errors) {return errors;}, 10992 flat: v.flattenErrorsToArray, 10993 grouped: function(errors) { 10994 var attr; 10995 10996 errors = v.groupErrorsByAttribute(errors); 10997 for (attr in errors) { 10998 errors[attr] = v.flattenErrorsToArray(errors[attr]); 10999 } 11000 return errors; 11001 }, 11002 constraint: function(errors) { 11003 var attr; 11004 errors = v.groupErrorsByAttribute(errors); 11005 for (attr in errors) { 11006 errors[attr] = errors[attr].map(function(result) { 11007 return result.validator; 11008 }).sort(); 11009 } 11010 return errors; 11011 } 11012 }; 11013 11014 validate.exposeModule(validate, this, exports, module, __webpack_require__(340)); 11015 }).call(this, 11016 true ? /* istanbul ignore next */ exports : null, 11017 true ? /* istanbul ignore next */ module : null, 11018 __webpack_require__(340)); 11019 11020 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(339)(module))) 11021 11022/***/ }), 11023/* 339 */
11024/***/ (function(module, exports) { 11025 11026 module.exports = function(module) { 11027 if(!module.webpackPolyfill) { 11028 module.deprecate = function() {}; 11029 module.paths = []; 11030 // module.parent = undefined by default 11031 module.children = []; 11032 module.webpackPolyfill = 1; 11033 } 11034 return module; 11035 } 11036 11037 11038/***/ }), 11039/* 340 */ 11040/***/ (function(module, exports) { 11041 11042 module.exports = function() { throw new Error("define cannot be used indirect"); }; 11043 11044 11045/***/ }), 11046/* 341 */ 11047/***/ (function(module, exports, __webpack_require__) { 11048 11049 'use strict'; 11050 11051 Object.defineProperty(exports, '__esModule', { 11052 value: true 11053 }); 11054 11055 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 11056 11057 var validate = __webpack_require__(338); 11058 11059 var NewConfirmation = function NewConfirmation(args) { 11060 _classCallCheck(this, NewConfirmation); 11061 11062 console.log('comfirmation_new.js loaded'); 11063 11064 // Form validation 11065 var constraints = { 11066 'user[email]': { 11067 email: { 11068 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 11069 }, 11070 presence: { 11071 message: "å ¥åãã¦ãã ãã" 11072 } 11073 } 11074 }; 11075 11076 // Hook up the form so we can prevent it from being posted 11077 var form = document.getElementById("confirmation_form"); 11078 form.onsubmit = function (ev) { 11079 ev.preventDefault(); 11080 handleFormSubmit(form); 11081 }; 11082 11083 // Hook up the inputs to validate on the fly 11084 var inputs = document.querySelectorAll("input, textarea, select"); 11085 inputs.forEach(function (element) { 11086 element.onchange = function (elem) { 11087 var errors = validate(form, constraints, { fullMessages: false }) || {}; 11088 showErrorsForInput(this, errors[this.name]); 11089 }; 11090 }); 11091 11092 function handleFormSubmit(form, input) { 11093 // validate the form against the constraints 11094 var errors = validate(form, constraints, { fullMessages: false }); 11095 // then we update the form to reflect the results 11096 showErrors(form, errors || {}); 11097 if (!errors) { 11098 showSuccess(); 11099 } 11100 } 11101 11102 // Updates the inputs with the validation errors 11103 function showErrors(form, errors) { 11104 // We loop through all the inputs and show the errors for that input 11105 form.querySelectorAll(".input_validate").forEach(function (input) { 11106 // Since the errors can be null if no errors were found we need to handle that 11107 showErrorsForInput(input, errors && errors[input.name]); 11108 }); 11109 } 11110 11111 // Shows the errors for a specific input 11112 function showErrorsForInput(input, errors) { 11113 // This is the root of the input 11114 var formGroup = closestParent(input.parentNode, "form-group"); 11115 // Find where the error messages will be insert into 11116 var messages = formGroup.querySelector(".error-messages"); 11117 // First we remove any old messages and resets the classes 11118 resetFormGroup(formGroup, messages); 11119 // If we have errors 11120 if (errors) { 11121 // we first mark the group has having errors 11122 formGroup.classList.add("has-error"); 11123 // then we append all the errors 11124 errors.forEach(function (error) { 11125 addError(messages, error); 11126 }); 11127 } else { 11128 // otherwise we simply mark it as success 11129 formGroup.classList.add("has-success"); 11130 } 11131 } 11132 11133 // Recusively finds the closest parent that has the specified class 11134 function closestParent(_x, _x2) { 11135 var _again = true; 11136 11137 _function: while (_again) { 11138 var child = _x, 11139 className = _x2; 11140 _again = false; 11141 11142 if (!child || child == document) { 11143 return null; 11144 } 11145 if (child.classList.contains(className)) { 11146 return child; 11147 } else { 11148 _x = child.parentNode; 11149 _x2 = className; 11150 _again = true; 11151 continue _function; 11152 } 11153 } 11154 } 11155 11156 function resetFormGroup(formGroup, messages) { 11157 // Remove the success and error classes 11158 formGroup.classList.remove("has-error"); 11159 formGroup.classList.remove("has-success"); 11160 messages.classList.remove("show"); 11161 // and remove any old messages 11162 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 11163 // el.parentNode.removeChild(el); 11164 // }); 11165 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 11166 element.parentNode.removeChild(element); 11167 }); 11168 } 11169 11170 // Adds the specified error with the following markup 11171 // <p class="help-block error">[message]</p> 11172 function addError(messages, error) { 11173 var block = document.createElement("p"); 11174 block.classList.add("help-block"); 11175 block.classList.add("error"); 11176 block.innerText = error; 11177 messages.appendChild(block); 11178 messages.classList.add("show"); 11179 } 11180 11181 function showSuccess() { 11182 form.submit(); 11183 } 11184 } 11185 11186 // methods 11187 ; 11188 11189 exports['default'] = NewConfirmation; 11190 module.exports = exports['default']; 11191 11192/***/ }), 11193/* 342 */ 11194/***/ (function(module, exports, __webpack_require__) { 11195 11196 'use strict'; 11197 11198 Object.defineProperty(exports, '__esModule', { 11199 value: true 11200 }); 11201 11202 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 11203 11204 var validate = __webpack_require__(338); 11205 11206 var NewContact = function NewContact(args) { 11207 _classCallCheck(this, NewContact); 11208 11209 console.log('contact_new.js loaded'); 11210 11211 // Form validation 11212 var constraints = { 11213 'contact[email]': { 11214 email: { 11215 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 11216 }, 11217 presence: { 11218 message: "å ¥åãã¦ãã ãã" 11219 } 11220 }, 11221 'contact[family_name]': { 11222 presence: { 11223 message: "å ¥åãã¦ãã ãã" 11224 } 11225 }, 11226 'contact[first_name]': { 11227 presence: { 11228 message: "å ¥åãã¦ãã ãã" 11229 } 11230 }, 11231 'contact[description]': { 11232 presence: { 11233 message: "å ¥åãã¦ãã ãã" 11234 } 11235 } 11236 }; 11237 11238 // Hook up the form so we can prevent it from being posted 11239 var form = document.getElementById("contact_form"); 11240 form.onsubmit = function (ev) { 11241 ev.preventDefault(); 11242 handleFormSubmit(form); 11243 }; 11244 11245 // Hook up the inputs to validate on the fly 11246 var inputs = document.querySelectorAll("input, textarea, select");
11247 inputs.forEach(function (element) { 11248 element.onchange = function (elem) { 11249 var errors = validate(form, constraints, { fullMessages: false }) || {}; 11250 showErrorsForInput(this, errors[this.name]); 11251 }; 11252 }); 11253 11254 function handleFormSubmit(form, input) { 11255 // validate the form against the constraints 11256 var errors = validate(form, constraints, { fullMessages: false }); 11257 // then we update the form to reflect the results 11258 showErrors(form, errors || {}); 11259 if (!errors) { 11260 showSuccess(); 11261 } 11262 } 11263 11264 // Updates the inputs with the validation errors 11265 function showErrors(form, errors) { 11266 // We loop through all the inputs and show the errors for that input 11267 form.querySelectorAll(".input_validate").forEach(function (input) { 11268 // Since the errors can be null if no errors were found we need to handle that 11269 showErrorsForInput(input, errors && errors[input.name]); 11270 }); 11271 } 11272 11273 // Shows the errors for a specific input 11274 function showErrorsForInput(input, errors) { 11275 // This is the root of the input 11276 var formGroup = closestParent(input.parentNode, "form-group"); 11277 // Find where the error messages will be insert into 11278 var messages = formGroup.querySelector(".error-messages"); 11279 // First we remove any old messages and resets the classes 11280 resetFormGroup(formGroup, messages); 11281 // If we have errors 11282 if (errors) { 11283 // we first mark the group has having errors 11284 formGroup.classList.add("has-error"); 11285 // then we append all the errors 11286 errors.forEach(function (error) { 11287 addError(messages, error); 11288 }); 11289 } else { 11290 // otherwise we simply mark it as success 11291 formGroup.classList.add("has-success"); 11292 } 11293 } 11294 11295 // Recusively finds the closest parent that has the specified class 11296 function closestParent(_x, _x2) { 11297 var _again = true; 11298 11299 _function: while (_again) { 11300 var child = _x, 11301 className = _x2; 11302 _again = false; 11303 11304 if (!child || child == document) { 11305 return null; 11306 } 11307 if (child.classList.contains(className)) { 11308 return child; 11309 } else { 11310 _x = child.parentNode; 11311 _x2 = className; 11312 _again = true; 11313 continue _function; 11314 } 11315 } 11316 } 11317 11318 function resetFormGroup(formGroup, messages) { 11319 // Remove the success and error classes 11320 formGroup.classList.remove("has-error"); 11321 formGroup.classList.remove("has-success"); 11322 messages.classList.remove("show"); 11323 // and remove any old messages 11324 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 11325 // el.parentNode.removeChild(el); 11326 // }); 11327 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 11328 element.parentNode.removeChild(element); 11329 }); 11330 } 11331 11332 // Adds the specified error with the following markup 11333 // <p class="help-block error">[message]</p> 11334 function addError(messages, error) { 11335 var block = document.createElement("p"); 11336 block.classList.add("help-block"); 11337 block.classList.add("error"); 11338 block.innerText = error; 11339 messages.appendChild(block); 11340 messages.classList.add("show"); 11341 } 11342 11343 function showSuccess() { 11344 form.submit(); 11345 } 11346 } 11347 11348 // methods 11349 ; 11350 11351 exports['default'] = NewContact; 11352 module.exports = exports['default']; 11353 11354/***/ }), 11355/* 343 */ 11356/***/ (function(module, exports, __webpack_require__) { 11357 11358 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 11359 // Must use "const" or "var" 11360 'use strict'; 11361 11362 Object.defineProperty(exports, '__esModule', { 11363 value: true 11364 }); 11365 11366 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; }; })(); 11367 11368 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 11369 11370 var imagesLoaded = __webpack_require__(344); 11371 var velocity = __webpack_require__(346); 11372 11373 var Index = (function () { 11374 function Index(id) { 11375 var _this = this; 11376 11377 _classCallCheck(this, Index); 11378 11379 this.id = id; 11380 __webpack_require__.e/* nsure */(1, function () { 11381 _this.initialize(); 11382 }); 11383 } 11384 11385 _createClass(Index, [{ 11386 key: 'initialize', 11387 value: function initialize() { 11388 this.sample_imagesloaded(); 11389 this.sample_message(); 11390 this.sample_velocity(); 11391 } 11392 11393 // methods 11394 }, { 11395 key: 'sample_imagesloaded', 11396 value: function sample_imagesloaded() { 11397 imagesLoaded('#main', function () { 11398 console.log('loaded'); 11399 }); 11400 } 11401 }, { 11402 key: 'sample_message', 11403 value: function sample_message() { 11404 var message = __webpack_require__(347); 11405 console.log(message(this.id + '.js loaded')); 11406 } 11407 }, { 11408 key: 'sample_velocity', 11409 value: function sample_velocity() { 11410 var $article = $('.m-list-article'); 11411 $article.on('mouseenter', function (e) { 11412 var $el = $(e.currentTarget).find('img'); 11413 $el.velocity({ 11414 // 'scale': 1.1 11415 }, { 11416 easing: 'easeOutQuart', 11417 duration: 500 11418 }); 11419 }); 11420 $article.on('mouseleave', function (e) { 11421 var $el = $(e.currentTarget).find('img'); 11422 $el.velocity({ 11423 'scale': 1 11424 }, { 11425 easing: 'easeOutQuart', 11426 duration: 500 11427 }); 11428 }); 11429 } 11430 }]); 11431 11432 return Index; 11433 })(); 11434 11435 exports['default'] = Index; 11436 module.exports = exports['default']; 11437 11438/***/ }), 11439/* 344 */ 11440/***/ (function(module, exports, __webpack_require__) { 11441 11442 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 11443 * imagesLoaded v4.1.4 11444 * JavaScript is all like "You images are done yet or what?" 11445 * MIT License 11446 */ 11447 11448 ( function( window, factory ) { 'use strict'; 11449 // universal module definition 11450 11451 /*global define: false, module: false, require: false */ 11452 11453 if ( true ) { 11454 // AMD 11455 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ 11456 __webpack_require__(345) 11457 ], __WEBPACK_AMD_DEFINE_RESULT__ = function( EvEmitter ) { 11458 return factory( window, EvEmitter ); 11459 }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 11460 } else if ( typeof module == 'object' && module.exports ) { 11461 // CommonJS 11462 module.exports = factory( 11463 window, 11464 require('ev-emitter') 11465 ); 11466 } else { 11467 // browser global 11468 window.imagesLoaded = factory( 11469 window, 11470 window.EvEmitter 11471 ); 11472 } 11473 11474 })( typeof window !== 'undefined' ? window : this, 11475 11476 // -------------------------- factory -------------------------- // 11477 11478 function factory( window, EvEmitter ) { 11479 11480 'use strict'; 11481 11482 var $ = window.jQuery; 11483 var console = window.console; 11484 11485 // -------------------------- helpers -------------------------- // 11486 11487 // extend objects 11488 function extend( a, b ) { 11489 for ( var prop in b ) { 11490 a[ prop ] = b[ prop ]; 11491 } 11492 return a; 11493 } 11494 11495 var arraySlice = Array.prototype.slice; 11496 11497 // turn element or nodeList into an array 11498 function makeArray( obj ) { 11499 if ( Array.isArray( obj ) ) { 11500 // use object if already an array 11501 return obj; 11502 } 11503 11504 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 11505 if ( isArrayLike ) { 11506 // convert nodeList to array 11507 return arraySlice.call( obj ); 11508 } 11509 11510 // array of single index 11511 return [ obj ]; 11512 } 11513 11514 // -------------------------- imagesLoaded -------------------------- // 11515 11516 /** 11517 * @param {Array, Element, NodeList, String} elem 11518 * @param {Object or Function} options - if function, use as callback 11519 * @param {Function} onAlways - callback function 11520 */ 11521 function ImagesLoaded( elem, options, onAlways ) { 11522 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 11523 if ( !( this instanceof ImagesLoaded ) ) { 11524 return new ImagesLoaded( elem, options, onAlways ); 11525 } 11526 // use elem as selector string 11527 var queryElem = elem; 11528 if ( typeof elem == 'string' ) { 11529 queryElem = document.querySelectorAll( elem ); 11530 } 11531 // bail if bad element 11532 if ( !queryElem ) { 11533 console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); 11534 return; 11535 } 11536 11537 this.elements = makeArray( queryElem ); 11538 this.options = extend( {}, this.options ); 11539 // shift arguments if no options set 11540 if ( typeof options == 'function' ) { 11541 onAlways = options; 11542 } else { 11543 extend( this.options, options ); 11544 } 11545 11546 if ( onAlways ) { 11547 this.on( 'always', onAlways ); 11548 } 11549 11550 this.getImages(); 11551 11552 if ( $ ) { 11553 // add jQuery Deferred object 11554 this.jqDeferred = new $.Deferred(); 11555 } 11556 11557 // HACK check async to allow time to bind listeners 11558 setTimeout( this.check.bind( this ) ); 11559 } 11560 11561 ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 11562 11563 ImagesLoaded.prototype.options = {}; 11564 11565 ImagesLoaded.prototype.getImages = function() { 11566 this.images = []; 11567 11568 // filter & find items if we have an item selector
vendor: 4,504 bytes, lines 11569-11725
11569 this.elements.forEach( this.addElementImages, this ); 11570 }; 11571 11572 /** 11573 * @param {Node} element 11574 */ 11575 ImagesLoaded.prototype.addElementImages = function( elem ) { 11576 // filter siblings 11577 if ( elem.nodeName == 'IMG' ) { 11578 this.addImage( elem ); 11579 } 11580 // get background image on element 11581 if ( this.options.background === true ) { 11582 this.addElementBackgroundImages( elem ); 11583 } 11584 11585 // find children 11586 // no non-element nodes, #143 11587 var nodeType = elem.nodeType; 11588 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 11589 return; 11590 } 11591 var childImgs = elem.querySelectorAll('img'); 11592 // concat childElems to filterFound array 11593 for ( var i=0; i < childImgs.length; i++ ) { 11594 var img = childImgs[i]; 11595 this.addImage( img ); 11596 } 11597 11598 // get child background images 11599 if ( typeof this.options.background == 'string' ) { 11600 var children = elem.querySelectorAll( this.options.background ); 11601 for ( i=0; i < children.length; i++ ) { 11602 var child = children[i]; 11603 this.addElementBackgroundImages( child ); 11604 } 11605 } 11606 }; 11607 11608 var elementNodeTypes = { 11609 1: true, 11610 9: true, 11611 11: true 11612 }; 11613 11614 ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 11615 var style = getComputedStyle( elem ); 11616 if ( !style ) { 11617 // Firefox returns null if in a hidden iframe https://bugzil.la/548397 11618 return; 11619 } 11620 // get url inside url("...") 11621 var reURL = /url\((['"])?(.*?)\1\)/gi; 11622 var matches = reURL.exec( style.backgroundImage ); 11623 while ( matches !== null ) { 11624 var url = matches && matches[2]; 11625 if ( url ) { 11626 this.addBackground( url, elem ); 11627 } 11628 matches = reURL.exec( style.backgroundImage ); 11629 } 11630 }; 11631 11632 /** 11633 * @param {Image} img 11634 */ 11635 ImagesLoaded.prototype.addImage = function( img ) { 11636 var loadingImage = new LoadingImage( img ); 11637 this.images.push( loadingImage ); 11638 }; 11639 11640 ImagesLoaded.prototype.addBackground = function( url, elem ) { 11641 var background = new Background( url, elem ); 11642 this.images.push( background ); 11643 }; 11644 11645 ImagesLoaded.prototype.check = function() { 11646 var _this = this; 11647 this.progressedCount = 0; 11648 this.hasAnyBroken = false; 11649 // complete if no images 11650 if ( !this.images.length ) { 11651 this.complete(); 11652 return; 11653 } 11654 11655 function onProgress( image, elem, message ) { 11656 // HACK - Chrome triggers event before object properties have changed. #83 11657 setTimeout( function() { 11658 _this.progress( image, elem, message ); 11659 }); 11660 } 11661 11662 this.images.forEach( function( loadingImage ) { 11663 loadingImage.once( 'progress', onProgress ); 11664 loadingImage.check(); 11665 }); 11666 }; 11667 11668 ImagesLoaded.prototype.progress = function( image, elem, message ) { 11669 this.progressedCount++; 11670 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 11671 // progress event 11672 this.emitEvent( 'progress', [ this, image, elem ] ); 11673 if ( this.jqDeferred && this.jqDeferred.notify ) { 11674 this.jqDeferred.notify( this, image ); 11675 } 11676 // check if completed 11677 if ( this.progressedCount == this.images.length ) { 11678 this.complete(); 11679 } 11680 11681 if ( this.options.debug && console ) { 11682 console.log( 'progress: ' + message, image, elem ); 11683 } 11684 }; 11685 11686 ImagesLoaded.prototype.complete = function() { 11687 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 11688 this.isComplete = true; 11689 this.emitEvent( eventName, [ this ] ); 11690 this.emitEvent( 'always', [ this ] ); 11691 if ( this.jqDeferred ) { 11692 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 11693 this.jqDeferred[ jqMethod ]( this ); 11694 } 11695 }; 11696 11697 // -------------------------- -------------------------- // 11698 11699 function LoadingImage( img ) { 11700 this.img = img; 11701 } 11702 11703 LoadingImage.prototype = Object.create( EvEmitter.prototype ); 11704 11705 LoadingImage.prototype.check = function() { 11706 // If complete is true and browser supports natural sizes, 11707 // try to check for image status manually. 11708 var isComplete = this.getIsImageComplete(); 11709 if ( isComplete ) { 11710 // report based on naturalWidth 11711 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 11712 return; 11713 } 11714 11715 // If none of the checks above matched, simulate loading on detached element. 11716 this.proxyImage = new Image(); 11717 this.proxyImage.addEventListener( 'load', this ); 11718 this.proxyImage.addEventListener( 'error', this ); 11719 // bind to image as well for Firefox. #191 11720 this.img.addEventListener( 'load', this ); 11721 this.img.addEventListener( 'error', this ); 11722 this.proxyImage.src = this.img.src; 11723 }; 11724 11725 LoadingImage.prototype.getIsImageComplete = function() {
vendor: 6,256 bytes, lines 11726-11948
11726 // check for non-zero, non-undefined naturalWidth 11727 // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 11728 return this.img.complete && this.img.naturalWidth; 11729 }; 11730 11731 LoadingImage.prototype.confirm = function( isLoaded, message ) { 11732 this.isLoaded = isLoaded; 11733 this.emitEvent( 'progress', [ this, this.img, message ] ); 11734 }; 11735 11736 // ----- events ----- // 11737 11738 // trigger specified handler for event type 11739 LoadingImage.prototype.handleEvent = function( event ) { 11740 var method = 'on' + event.type; 11741 if ( this[ method ] ) { 11742 this[ method ]( event ); 11743 } 11744 }; 11745 11746 LoadingImage.prototype.onload = function() { 11747 this.confirm( true, 'onload' ); 11748 this.unbindEvents(); 11749 }; 11750 11751 LoadingImage.prototype.onerror = function() { 11752 this.confirm( false, 'onerror' ); 11753 this.unbindEvents(); 11754 }; 11755 11756 LoadingImage.prototype.unbindEvents = function() { 11757 this.proxyImage.removeEventListener( 'load', this ); 11758 this.proxyImage.removeEventListener( 'error', this ); 11759 this.img.removeEventListener( 'load', this ); 11760 this.img.removeEventListener( 'error', this ); 11761 }; 11762 11763 // -------------------------- Background -------------------------- // 11764 11765 function Background( url, element ) { 11766 this.url = url; 11767 this.element = element; 11768 this.img = new Image(); 11769 } 11770 11771 // inherit LoadingImage prototype 11772 Background.prototype = Object.create( LoadingImage.prototype ); 11773 11774 Background.prototype.check = function() { 11775 this.img.addEventListener( 'load', this ); 11776 this.img.addEventListener( 'error', this ); 11777 this.img.src = this.url; 11778 // check if image is already complete 11779 var isComplete = this.getIsImageComplete(); 11780 if ( isComplete ) { 11781 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 11782 this.unbindEvents(); 11783 } 11784 }; 11785 11786 Background.prototype.unbindEvents = function() { 11787 this.img.removeEventListener( 'load', this ); 11788 this.img.removeEventListener( 'error', this ); 11789 }; 11790 11791 Background.prototype.confirm = function( isLoaded, message ) { 11792 this.isLoaded = isLoaded; 11793 this.emitEvent( 'progress', [ this, this.element, message ] ); 11794 }; 11795 11796 // -------------------------- jQuery -------------------------- // 11797 11798 ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 11799 jQuery = jQuery || window.jQuery; 11800 if ( !jQuery ) { 11801 return; 11802 } 11803 // set local variable 11804 $ = jQuery; 11805 // $().imagesLoaded() 11806 $.fn.imagesLoaded = function( options, callback ) { 11807 var instance = new ImagesLoaded( this, options, callback ); 11808 return instance.jqDeferred.promise( $(this) ); 11809 }; 11810 }; 11811 // try making plugin 11812 ImagesLoaded.makeJQueryPlugin(); 11813 11814 // -------------------------- -------------------------- // 11815 11816 return ImagesLoaded; 11817 11818 }); 11819 11820 11821/***/ }), 11822/* 345 */ 11823/***/ (function(module, exports, __webpack_require__) { 11824 11825 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/** 11826 * EvEmitter v1.1.0 11827 * Lil' event emitter 11828 * MIT License 11829 */ 11830 11831 /* jshint unused: true, undef: true, strict: true */ 11832 11833 ( function( global, factory ) { 11834 // universal module definition 11835 /* jshint strict: false */ /* globals define, module, window */ 11836 if ( true ) { 11837 // AMD - RequireJS 11838 !(__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__)); 11839 } else if ( typeof module == 'object' && module.exports ) { 11840 // CommonJS - Browserify, Webpack 11841 module.exports = factory(); 11842 } else { 11843 // Browser globals 11844 global.EvEmitter = factory(); 11845 } 11846 11847 }( typeof window != 'undefined' ? window : this, function() { 11848 11849 "use strict"; 11850 11851 function EvEmitter() {} 11852 11853 var proto = EvEmitter.prototype; 11854 11855 proto.on = function( eventName, listener ) { 11856 if ( !eventName || !listener ) { 11857 return; 11858 } 11859 // set events hash 11860 var events = this._events = this._events || {}; 11861 // set listeners array 11862 var listeners = events[ eventName ] = events[ eventName ] || []; 11863 // only add once 11864 if ( listeners.indexOf( listener ) == -1 ) { 11865 listeners.push( listener ); 11866 } 11867 11868 return this; 11869 }; 11870 11871 proto.once = function( eventName, listener ) { 11872 if ( !eventName || !listener ) { 11873 return; 11874 } 11875 // add event 11876 this.on( eventName, listener ); 11877 // set once flag 11878 // set onceEvents hash 11879 var onceEvents = this._onceEvents = this._onceEvents || {}; 11880 // set onceListeners object 11881 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 11882 // set flag 11883 onceListeners[ listener ] = true; 11884 11885 return this; 11886 }; 11887 11888 proto.off = function( eventName, listener ) { 11889 var listeners = this._events && this._events[ eventName ]; 11890 if ( !listeners || !listeners.length ) { 11891 return; 11892 } 11893 var index = listeners.indexOf( listener ); 11894 if ( index != -1 ) { 11895 listeners.splice( index, 1 ); 11896 } 11897 11898 return this; 11899 }; 11900 11901 proto.emitEvent = function( eventName, args ) { 11902 var listeners = this._events && this._events[ eventName ]; 11903 if ( !listeners || !listeners.length ) { 11904 return; 11905 } 11906 // copy over to avoid interference if .off() in listener 11907 listeners = listeners.slice(0); 11908 args = args || []; 11909 // once stuff 11910 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 11911 11912 for ( var i=0; i < listeners.length; i++ ) { 11913 var listener = listeners[i] 11914 var isOnce = onceListeners && onceListeners[ listener ]; 11915 if ( isOnce ) { 11916 // remove listener 11917 // remove before trigger to prevent recursion 11918 this.off( eventName, listener ); 11919 // unset once flag 11920 delete onceListeners[ listener ]; 11921 } 11922 // trigger listener 11923 listener.apply( this, args ); 11924 } 11925 11926 return this; 11927 }; 11928 11929 proto.allOff = function() { 11930 delete this._events; 11931 delete this._onceEvents; 11932 }; 11933 11934 return EvEmitter; 11935 11936 })); 11937 11938 11939/***/ }), 11940/* 346 */ 11941/***/ (function(module, exports, __webpack_require__) { 11942 11943 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! VelocityJS.org (1.5.2). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ 11944 11945 /************************* 11946 Velocity jQuery Shim 11947 *************************/ 11948
vendor: 42,848 bytes, lines 11949-13290
11949 /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ 11950 11951 /* 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. */ 11952 /* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */ 11953 /* Browser support: Using this shim instead of jQuery proper removes support for IE8. */ 11954 11955 (function(window) { 11956 "use strict"; 11957 /*************** 11958 Setup 11959 ***************/ 11960 11961 /* If jQuery is already loaded, there's no point in loading this shim. */ 11962 if (window.jQuery) { 11963 return; 11964 } 11965 11966 /* jQuery base. */ 11967 var $ = function(selector, context) { 11968 return new $.fn.init(selector, context); 11969 }; 11970 11971 /******************** 11972 Private Methods 11973 ********************/ 11974 11975 /* jQuery */ 11976 $.isWindow = function(obj) { 11977 /* jshint eqeqeq: false */ 11978 return obj && obj === obj.window; 11979 }; 11980 11981 /* jQuery */ 11982 $.type = function(obj) { 11983 if (!obj) { 11984 return obj + ""; 11985 } 11986 11987 return typeof obj === "object" || typeof obj === "function" ? 11988 class2type[toString.call(obj)] || "object" : 11989 typeof obj; 11990 }; 11991 11992 /* jQuery */ 11993 $.isArray = Array.isArray || function(obj) { 11994 return $.type(obj) === "array"; 11995 }; 11996 11997 /* jQuery */ 11998 function isArraylike(obj) { 11999 var length = obj.length, 12000 type = $.type(obj); 12001 12002 if (type === "function" || $.isWindow(obj)) { 12003 return false; 12004 } 12005 12006 if (obj.nodeType === 1 && length) { 12007 return true; 12008 } 12009 12010 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj; 12011 } 12012 12013 /*************** 12014 $ Methods 12015 ***************/ 12016 12017 /* jQuery: Support removed for IE<9. */ 12018 $.isPlainObject = function(obj) { 12019 var key; 12020 12021 if (!obj || $.type(obj) !== "object" || obj.nodeType || $.isWindow(obj)) { 12022 return false; 12023 } 12024 12025 try { 12026 if (obj.constructor && 12027 !hasOwn.call(obj, "constructor") && 12028 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 12029 return false; 12030 } 12031 } catch (e) { 12032 return false; 12033 } 12034 12035 for (key in obj) { 12036 } 12037 12038 return key === undefined || hasOwn.call(obj, key); 12039 }; 12040 12041 /* jQuery */ 12042 $.each = function(obj, callback, args) { 12043 var value, 12044 i = 0, 12045 length = obj.length, 12046 isArray = isArraylike(obj); 12047 12048 if (args) { 12049 if (isArray) { 12050 for (; i < length; i++) { 12051 value = callback.apply(obj[i], args); 12052 12053 if (value === false) { 12054 break; 12055 } 12056 } 12057 } else { 12058 for (i in obj) { 12059 if (!obj.hasOwnProperty(i)) { 12060 continue; 12061 } 12062 value = callback.apply(obj[i], args); 12063 12064 if (value === false) { 12065 break; 12066 } 12067 } 12068 } 12069 12070 } else { 12071 if (isArray) { 12072 for (; i < length; i++) { 12073 value = callback.call(obj[i], i, obj[i]); 12074 12075 if (value === false) { 12076 break; 12077 } 12078 } 12079 } else { 12080 for (i in obj) { 12081 if (!obj.hasOwnProperty(i)) { 12082 continue; 12083 } 12084 value = callback.call(obj[i], i, obj[i]); 12085 12086 if (value === false) { 12087 break; 12088 } 12089 } 12090 } 12091 } 12092 12093 return obj; 12094 }; 12095 12096 /* Custom */ 12097 $.data = function(node, key, value) { 12098 /* $.getData() */ 12099 if (value === undefined) { 12100 var getId = node[$.expando], 12101 store = getId && cache[getId]; 12102 12103 if (key === undefined) { 12104 return store; 12105 } else if (store) { 12106 if (key in store) { 12107 return store[key]; 12108 } 12109 } 12110 /* $.setData() */ 12111 } else if (key !== undefined) { 12112 var setId = node[$.expando] || (node[$.expando] = ++$.uuid); 12113 12114 cache[setId] = cache[setId] || {}; 12115 cache[setId][key] = value; 12116 12117 return value; 12118 } 12119 }; 12120 12121 /* Custom */ 12122 $.removeData = function(node, keys) { 12123 var id = node[$.expando], 12124 store = id && cache[id]; 12125 12126 if (store) { 12127 // Cleanup the entire store if no keys are provided. 12128 if (!keys) { 12129 delete cache[id]; 12130 } else { 12131 $.each(keys, function(_, key) { 12132 delete store[key]; 12133 }); 12134 } 12135 } 12136 }; 12137 12138 /* jQuery */ 12139 $.extend = function() { 12140 var src, copyIsArray, copy, name, options, clone, 12141 target = arguments[0] || {}, 12142 i = 1, 12143 length = arguments.length, 12144 deep = false; 12145 12146 if (typeof target === "boolean") { 12147 deep = target; 12148 12149 target = arguments[i] || {}; 12150 i++; 12151 } 12152 12153 if (typeof target !== "object" && $.type(target) !== "function") { 12154 target = {}; 12155 } 12156 12157 if (i === length) { 12158 target = this; 12159 i--; 12160 } 12161 12162 for (; i < length; i++) { 12163 if ((options = arguments[i])) { 12164 for (name in options) { 12165 if (!options.hasOwnProperty(name)) { 12166 continue; 12167 } 12168 src = target[name]; 12169 copy = options[name]; 12170 12171 if (target === copy) { 12172 continue; 12173 } 12174 12175 if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) { 12176 if (copyIsArray) { 12177 copyIsArray = false; 12178 clone = src && $.isArray(src) ? src : []; 12179 12180 } else { 12181 clone = src && $.isPlainObject(src) ? src : {}; 12182 } 12183 12184 target[name] = $.extend(deep, clone, copy); 12185 12186 } else if (copy !== undefined) { 12187 target[name] = copy; 12188 } 12189 } 12190 } 12191 } 12192 12193 return target; 12194 }; 12195 12196 /* jQuery 1.4.3 */ 12197 $.queue = function(elem, type, data) { 12198 function $makeArray(arr, results) { 12199 var ret = results || []; 12200 12201 if (arr) { 12202 if (isArraylike(Object(arr))) { 12203 /* $.merge */ 12204 (function(first, second) { 12205 var len = +second.length, 12206 j = 0, 12207 i = first.length; 12208 12209 while (j < len) { 12210 first[i++] = second[j++]; 12211 } 12212 12213 if (len !== len) { 12214 while (second[j] !== undefined) { 12215 first[i++] = second[j++]; 12216 } 12217 } 12218 12219 first.length = i; 12220 12221 return first; 12222 })(ret, typeof arr === "string" ? [arr] : arr); 12223 } else { 12224 [].push.call(ret, arr); 12225 } 12226 } 12227 12228 return ret; 12229 } 12230 12231 if (!elem) { 12232 return; 12233 } 12234 12235 type = (type || "fx") + "queue"; 12236 12237 var q = $.data(elem, type); 12238 12239 if (!data) { 12240 return q || []; 12241 } 12242 12243 if (!q || $.isArray(data)) { 12244 q = $.data(elem, type, $makeArray(data)); 12245 } else { 12246 q.push(data); 12247 } 12248 12249 return q; 12250 }; 12251 12252 /* jQuery 1.4.3 */ 12253 $.dequeue = function(elems, type) { 12254 /* Custom: Embed element iteration. */ 12255 $.each(elems.nodeType ? [elems] : elems, function(i, elem) { 12256 type = type || "fx"; 12257 12258 var queue = $.queue(elem, type), 12259 fn = queue.shift(); 12260 12261 if (fn === "inprogress") { 12262 fn = queue.shift(); 12263 } 12264 12265 if (fn) { 12266 if (type === "fx") { 12267 queue.unshift("inprogress"); 12268 } 12269 12270 fn.call(elem, function() { 12271 $.dequeue(elem, type); 12272 }); 12273 } 12274 }); 12275 }; 12276 12277 /****************** 12278 $.fn Methods 12279 ******************/ 12280 12281 /* jQuery */ 12282 $.fn = $.prototype = { 12283 init: function(selector) { 12284 /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */ 12285 if (selector.nodeType) { 12286 this[0] = selector; 12287 12288 return this; 12289 } else { 12290 throw new Error("Not a DOM node."); 12291 } 12292 }, 12293 offset: function() { 12294 /* jQuery altered code: Dropped disconnected DOM node checking. */ 12295 var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : {top: 0, left: 0}; 12296 12297 return { 12298 top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), 12299 left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) 12300 }; 12301 }, 12302 position: function() { 12303 /* jQuery */ 12304 function offsetParentFn(elem) { 12305 var offsetParent = elem.offsetParent; 12306 12307 while (offsetParent && (offsetParent.nodeName.toLowerCase() !== "html" && offsetParent.style && offsetParent.style.position.toLowerCase() === "static")) { 12308 offsetParent = offsetParent.offsetParent; 12309 } 12310 12311 return offsetParent || document; 12312 } 12313 12314 /* Zepto */ 12315 var elem = this[0], 12316 offsetParent = offsetParentFn(elem), 12317 offset = this.offset(), 12318 parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? {top: 0, left: 0} : $(offsetParent).offset(); 12319 12320 offset.top -= parseFloat(elem.style.marginTop) || 0; 12321 offset.left -= parseFloat(elem.style.marginLeft) || 0; 12322 12323 if (offsetParent.style) { 12324 parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0; 12325 parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0; 12326 } 12327 12328 return { 12329 top: offset.top - parentOffset.top, 12330 left: offset.left - parentOffset.left 12331 }; 12332 } 12333 }; 12334 12335 /********************** 12336 Private Variables 12337 **********************/ 12338 12339 /* For $.data() */ 12340 var cache = {}; 12341 $.expando = "velocity" + (new Date().getTime()); 12342 $.uuid = 0; 12343 12344 /* For $.queue() */ 12345 var class2type = {}, 12346 hasOwn = class2type.hasOwnProperty, 12347 toString = class2type.toString; 12348 12349 var types = "Boolean Number String Function Array Date RegExp Object Error".split(" "); 12350 for (var i = 0; i < types.length; i++) { 12351 class2type["[object " + types[i] + "]"] = types[i].toLowerCase(); 12352 } 12353 12354 /* Makes $(node) possible, without having to call init. */ 12355 $.fn.init.prototype = $.fn; 12356 12357 /* Globalize Velocity onto the window, and assign its Utilities property. */ 12358 window.Velocity = {Utilities: $}; 12359 })(window); 12360 12361 /****************** 12362 Velocity.js 12363 ******************/ 12364 12365 (function(factory) { 12366 "use strict"; 12367 /* CommonJS module. */ 12368 if (typeof module === "object" && typeof module.exports === "object") { 12369 module.exports = factory(); 12370 /* AMD module. */ 12371 } else if (true) { 12372 !(__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__)); 12373 /* Browser globals. */ 12374 } else { 12375 factory(); 12376 } 12377 }(function() { 12378 "use strict"; 12379 return function(global, window, document, undefined) { 12380 12381 /*************** 12382 Summary 12383 ***************/ 12384 12385 /* 12386 - CSS: CSS stack that works independently from the rest of Velocity. 12387 - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. 12388 - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. 12389 - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. 12390 Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). 12391 - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 12392 - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. 12393 - completeCall(): Handles the cleanup process for each Velocity call. 12394 */ 12395 12396 /********************* 12397 Helper Functions 12398 *********************/ 12399 12400 /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ 12401 var IE = (function() { 12402 if (document.documentMode) { 12403 return document.documentMode; 12404 } else { 12405 for (var i = 7; i > 4; i--) { 12406 var div = document.createElement("div"); 12407 12408 div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; 12409 12410 if (div.getElementsByTagName("span").length) { 12411 div = null; 12412 12413 return i; 12414 } 12415 } 12416 } 12417 12418 return undefined; 12419 })(); 12420 12421 /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ 12422 var rAFShim = (function() { 12423 var timeLast = 0; 12424 12425 return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { 12426 var timeCurrent = (new Date()).getTime(), 12427 timeDelta; 12428 12429 /* Dynamically set delay on a per-tick basis to match 60fps. */ 12430 /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ 12431 timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); 12432 timeLast = timeCurrent + timeDelta; 12433 12434 return setTimeout(function() { 12435 callback(timeCurrent + timeDelta); 12436 }, timeDelta); 12437 }; 12438 })(); 12439 12440 var performance = (function() { 12441 var perf = window.performance || {}; 12442 12443 if (typeof perf.now !== "function") { 12444 var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : (new Date()).getTime(); 12445 12446 perf.now = function() { 12447 return (new Date()).getTime() - nowOffset; 12448 }; 12449 } 12450 return perf; 12451 })(); 12452 12453 /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ 12454 function compactSparseArray(array) { 12455 var index = -1, 12456 length = array ? array.length : 0, 12457 result = []; 12458 12459 while (++index < length) { 12460 var value = array[index]; 12461 12462 if (value) { 12463 result.push(value); 12464 } 12465 } 12466 12467 return result; 12468 } 12469 12470 /** 12471 * Shim for "fixing" IE's lack of support (IE < 9) for applying slice 12472 * on host objects like NamedNodeMap, NodeList, and HTMLCollection 12473 * (technically, since host objects have been implementation-dependent, 12474 * at least before ES2015, IE hasn't needed to work this way). 12475 * Also works on strings, fixes IE < 9 to allow an explicit undefined 12476 * for the 2nd argument (as in Firefox), and prevents errors when 12477 * called on other DOM objects. 12478 */ 12479 var _slice = (function() { 12480 var slice = Array.prototype.slice; 12481 12482 try { 12483 // Can't be used with DOM elements in IE < 9 12484 slice.call(document.documentElement); 12485 return slice; 12486 } catch (e) { // Fails in IE < 9 12487 12488 // This will work for genuine arrays, array-like objects, 12489 // NamedNodeMap (attributes, entities, notations), 12490 // NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes), 12491 // and will not fail on other DOM objects (as do DOM elements in IE < 9) 12492 return function(begin, end) { 12493 var len = this.length; 12494 12495 if (typeof begin !== "number") { 12496 begin = 0; 12497 } 12498 // IE < 9 gets unhappy with an undefined end argument 12499 if (typeof end !== "number") { 12500 end = len; 12501 } 12502 // For native Array objects, we use the native slice function 12503 if (this.slice) { 12504 return slice.call(this, begin, end); 12505 } 12506 // For array like object we handle it ourselves. 12507 var i, 12508 cloned = [], 12509 // Handle negative value for "begin" 12510 start = (begin >= 0) ? begin : Math.max(0, len + begin), 12511 // Handle negative value for "end" 12512 upTo = end < 0 ? len + end : Math.min(end, len), 12513 // Actual expected size of the slice 12514 size = upTo - start; 12515 12516 if (size > 0) { 12517 cloned = new Array(size); 12518 if (this.charAt) { 12519 for (i = 0; i < size; i++) { 12520 cloned[i] = this.charAt(start + i); 12521 } 12522 } else { 12523 for (i = 0; i < size; i++) { 12524 cloned[i] = this[start + i]; 12525 } 12526 } 12527 } 12528 return cloned; 12529 }; 12530 } 12531 })(); 12532 12533 /* .indexOf doesn't exist in IE<9 */ 12534 var _inArray = (function() { 12535 if (Array.prototype.includes) { 12536 return function(arr, val) { 12537 return arr.includes(val); 12538 }; 12539 } 12540 if (Array.prototype.indexOf) { 12541 return function(arr, val) { 12542 return arr.indexOf(val) >= 0; 12543 }; 12544 } 12545 return function(arr, val) { 12546 for (var i = 0; i < arr.length; i++) { 12547 if (arr[i] === val) { 12548 return true; 12549 } 12550 } 12551 return false; 12552 }; 12553 }); 12554 12555 function sanitizeElements(elements) { 12556 /* Unwrap jQuery/Zepto objects. */ 12557 if (Type.isWrapped(elements)) { 12558 elements = _slice.call(elements); 12559 /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */ 12560 } else if (Type.isNode(elements)) { 12561 elements = [elements]; 12562 } 12563 12564 return elements; 12565 } 12566 12567 var Type = { 12568 isNumber: function(variable) { 12569 return (typeof variable === "number"); 12570 }, 12571 isString: function(variable) { 12572 return (typeof variable === "string"); 12573 }, 12574 isArray: Array.isArray || function(variable) { 12575 return Object.prototype.toString.call(variable) === "[object Array]"; 12576 }, 12577 isFunction: function(variable) { 12578 return Object.prototype.toString.call(variable) === "[object Function]"; 12579 }, 12580 isNode: function(variable) { 12581 return variable && variable.nodeType; 12582 }, 12583 /* Determine if variable is an array-like wrapped jQuery, Zepto or similar element, or even a NodeList etc. */ 12584 /* NOTE: HTMLFormElements also have a length. */ 12585 isWrapped: function(variable) { 12586 return variable 12587 && variable !== window 12588 && Type.isNumber(variable.length) 12589 && !Type.isString(variable) 12590 && !Type.isFunction(variable) 12591 && !Type.isNode(variable) 12592 && (variable.length === 0 || Type.isNode(variable[0])); 12593 }, 12594 isSVG: function(variable) { 12595 return window.SVGElement && (variable instanceof window.SVGElement); 12596 }, 12597 isEmptyObject: function(variable) { 12598 for (var name in variable) { 12599 if (variable.hasOwnProperty(name)) { 12600 return false; 12601 } 12602 } 12603 12604 return true; 12605 } 12606 }; 12607 12608 /***************** 12609 Dependencies 12610 *****************/ 12611 12612 var $, 12613 isJQuery = false; 12614 12615 if (global.fn && global.fn.jquery) { 12616 $ = global; 12617 isJQuery = true; 12618 } else { 12619 $ = window.Velocity.Utilities; 12620 } 12621 12622 if (IE <= 8 && !isJQuery) { 12623 throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); 12624 } else if (IE <= 7) { 12625 /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */ 12626 jQuery.fn.velocity = jQuery.fn.animate; 12627 12628 /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ 12629 return; 12630 } 12631 12632 /***************** 12633 Constants 12634 *****************/ 12635 12636 var DURATION_DEFAULT = 400, 12637 EASING_DEFAULT = "swing"; 12638 12639 /************* 12640 State 12641 *************/ 12642 12643 var Velocity = { 12644 /* Container for page-wide Velocity state data. */ 12645 State: { 12646 /* Detect mobile devices to determine if mobileHA should be turned on. */ 12647 isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent), 12648 /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ 12649 isAndroid: /Android/i.test(window.navigator.userAgent), 12650 isGingerbread: /Android 2\.3\.[3-7]/i.test(window.navigator.userAgent), 12651 isChrome: window.chrome, 12652 isFirefox: /Firefox/i.test(window.navigator.userAgent), 12653 /* Create a cached element for re-use when checking for CSS property prefixes. */ 12654 prefixElement: document.createElement("div"), 12655 /* Cache every prefix match to avoid repeating lookups. */ 12656 prefixMatches: {}, 12657 /* Cache the anchor used for animating window scrolling. */ 12658 scrollAnchor: null, 12659 /* Cache the browser-specific property names associated with the scroll anchor. */ 12660 scrollPropertyLeft: null, 12661 scrollPropertyTop: null, 12662 /* Keep track of whether our RAF tick is running. */ 12663 isTicking: false, 12664 /* Container for every in-progress call to Velocity. */ 12665 calls: [], 12666 delayedElements: { 12667 count: 0 12668 } 12669 }, 12670 /* Velocity's custom CSS stack. Made global for unit testing. */ 12671 CSS: {/* Defined below. */}, 12672 /* A shim of the jQuery utility functions used by Velocity -- provided by Velocity's optional jQuery shim. */ 12673 Utilities: $, 12674 /* Container for the user's custom animation redirects that are referenced by name in place of the properties map argument. */ 12675 Redirects: {/* Manually registered by the user. */}, 12676 Easings: {/* Defined below. */}, 12677 /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */ 12678 Promise: window.Promise, 12679 /* Velocity option defaults, which can be overriden by the user. */ 12680 defaults: { 12681 queue: "", 12682 duration: DURATION_DEFAULT, 12683 easing: EASING_DEFAULT, 12684 begin: undefined, 12685 complete: undefined, 12686 progress: undefined, 12687 display: undefined, 12688 visibility: undefined, 12689 loop: false, 12690 delay: false, 12691 mobileHA: true, 12692 /* Advanced: Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */ 12693 _cacheValues: true, 12694 /* Advanced: Set to false if the promise should always resolve on empty element lists. */ 12695 promiseRejectEmpty: true 12696 }, 12697 /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache. */ 12698 init: function(element) { 12699 $.data(element, "velocity", { 12700 /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ 12701 isSVG: Type.isSVG(element), 12702 /* Keep track of whether the element is currently being animated by Velocity. 12703 This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ 12704 isAnimating: false, 12705 /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 12706 computedStyle: null, 12707 /* Tween data is cached for each animation on the element so that data can be passed across calls -- 12708 in particular, end values are used as subsequent start values in consecutive Velocity calls. */ 12709 tweensContainer: null, 12710 /* The full root property values of each CSS hook being animated on this element are cached so that: 12711 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 12712 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ 12713 rootPropertyValueCache: {}, 12714 /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ 12715 transformCache: {} 12716 }); 12717 }, 12718 /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ 12719 hook: null, /* Defined below. */ 12720 /* Velocity-wide animation time remapping for testing purposes. */ 12721 mock: false, 12722 version: {major: 1, minor: 5, patch: 2}, 12723 /* Set to 1 or 2 (most verbose) to output debug info to console. */ 12724 debug: false, 12725 /* Use rAF high resolution timestamp when available */ 12726 timestamp: true, 12727 /* Pause all animations */ 12728 pauseAll: function(queueName) { 12729 var currentTime = (new Date()).getTime(); 12730 12731 $.each(Velocity.State.calls, function(i, activeCall) { 12732 12733 if (activeCall) { 12734 12735 /* If we have a queueName and this call is not on that queue, skip */ 12736 if (queueName !== undefined && ((activeCall[2].queue !== queueName) || (activeCall[2].queue === false))) { 12737 return true; 12738 } 12739 12740 /* Set call to paused */ 12741 activeCall[5] = { 12742 resume: false 12743 }; 12744 } 12745 }); 12746 12747 /* Pause timers on any currently delayed calls */ 12748 $.each(Velocity.State.delayedElements, function(k, element) { 12749 if (!element) { 12750 return; 12751 } 12752 pauseDelayOnElement(element, currentTime); 12753 }); 12754 }, 12755 /* Resume all animations */ 12756 resumeAll: function(queueName) { 12757 var currentTime = (new Date()).getTime(); 12758 12759 $.each(Velocity.State.calls, function(i, activeCall) { 12760 12761 if (activeCall) { 12762 12763 /* If we have a queueName and this call is not on that queue, skip */ 12764 if (queueName !== undefined && ((activeCall[2].queue !== queueName) || (activeCall[2].queue === false))) { 12765 return true; 12766 } 12767 12768 /* Set call to resumed if it was paused */ 12769 if (activeCall[5]) { 12770 activeCall[5].resume = true; 12771 } 12772 } 12773 }); 12774 /* Resume timers on any currently delayed calls */ 12775 $.each(Velocity.State.delayedElements, function(k, element) { 12776 if (!element) { 12777 return; 12778 } 12779 resumeDelayOnElement(element, currentTime); 12780 }); 12781 } 12782 }; 12783 12784 /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ 12785 if (window.pageYOffset !== undefined) { 12786 Velocity.State.scrollAnchor = window; 12787 Velocity.State.scrollPropertyLeft = "pageXOffset"; 12788 Velocity.State.scrollPropertyTop = "pageYOffset"; 12789 } else { 12790 Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; 12791 Velocity.State.scrollPropertyLeft = "scrollLeft"; 12792 Velocity.State.scrollPropertyTop = "scrollTop"; 12793 } 12794 12795 /* Shorthand alias for jQuery's $.data() utility. */ 12796 function Data(element) { 12797 /* Hardcode a reference to the plugin name. */ 12798 var response = $.data(element, "velocity"); 12799 12800 /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ 12801 return response === null ? undefined : response; 12802 } 12803 12804 /************** 12805 Delay Timer 12806 **************/ 12807 12808 function pauseDelayOnElement(element, currentTime) { 12809 /* Check for any delay timers, and pause the set timeouts (while preserving time data) 12810 to be resumed when the "resume" command is issued */ 12811 var data = Data(element); 12812 if (data && data.delayTimer && !data.delayPaused) { 12813 data.delayRemaining = data.delay - currentTime + data.delayBegin; 12814 data.delayPaused = true; 12815 clearTimeout(data.delayTimer.setTimeout); 12816 } 12817 } 12818 12819 function resumeDelayOnElement(element, currentTime) { 12820 /* Check for any paused timers and resume */ 12821 var data = Data(element); 12822 if (data && data.delayTimer && data.delayPaused) { 12823 /* If the element was mid-delay, re initiate the timeout with the remaining delay */ 12824 data.delayPaused = false; 12825 data.delayTimer.setTimeout = setTimeout(data.delayTimer.next, data.delayRemaining); 12826 } 12827 } 12828 12829 12830 12831 /************** 12832 Easing 12833 **************/ 12834 12835 /* Step easing generator. */ 12836 function generateStep(steps) { 12837 return function(p) { 12838 return Math.round(p * steps) * (1 / steps); 12839 }; 12840 } 12841 12842 /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 12843 function generateBezier(mX1, mY1, mX2, mY2) { 12844 var NEWTON_ITERATIONS = 4, 12845 NEWTON_MIN_SLOPE = 0.001, 12846 SUBDIVISION_PRECISION = 0.0000001, 12847 SUBDIVISION_MAX_ITERATIONS = 10, 12848 kSplineTableSize = 11, 12849 kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), 12850 float32ArraySupported = "Float32Array" in window; 12851 12852 /* Must contain four arguments. */ 12853 if (arguments.length !== 4) { 12854 return false; 12855 } 12856 12857 /* Arguments must be numbers. */ 12858 for (var i = 0; i < 4; ++i) { 12859 if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { 12860 return false; 12861 } 12862 } 12863 12864 /* X values must be in the [0, 1] range. */ 12865 mX1 = Math.min(mX1, 1); 12866 mX2 = Math.min(mX2, 1); 12867 mX1 = Math.max(mX1, 0); 12868 mX2 = Math.max(mX2, 0); 12869 12870 var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 12871 12872 function A(aA1, aA2) { 12873 return 1.0 - 3.0 * aA2 + 3.0 * aA1; 12874 } 12875 function B(aA1, aA2) { 12876 return 3.0 * aA2 - 6.0 * aA1; 12877 } 12878 function C(aA1) { 12879 return 3.0 * aA1; 12880 } 12881 12882 function calcBezier(aT, aA1, aA2) { 12883 return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; 12884 } 12885 12886 function getSlope(aT, aA1, aA2) { 12887 return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); 12888 } 12889 12890 function newtonRaphsonIterate(aX, aGuessT) { 12891 for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 12892 var currentSlope = getSlope(aGuessT, mX1, mX2); 12893 12894 if (currentSlope === 0.0) { 12895 return aGuessT; 12896 } 12897 12898 var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 12899 aGuessT -= currentX / currentSlope; 12900 } 12901 12902 return aGuessT; 12903 } 12904 12905 function calcSampleValues() { 12906 for (var i = 0; i < kSplineTableSize; ++i) { 12907 mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 12908 } 12909 } 12910 12911 function binarySubdivide(aX, aA, aB) { 12912 var currentX, currentT, i = 0; 12913 12914 do { 12915 currentT = aA + (aB - aA) / 2.0; 12916 currentX = calcBezier(currentT, mX1, mX2) - aX; 12917 if (currentX > 0.0) { 12918 aB = currentT; 12919 } else { 12920 aA = currentT; 12921 } 12922 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 12923 12924 return currentT; 12925 } 12926 12927 function getTForX(aX) { 12928 var intervalStart = 0.0, 12929 currentSample = 1, 12930 lastSample = kSplineTableSize - 1; 12931 12932 for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { 12933 intervalStart += kSampleStepSize; 12934 } 12935 12936 --currentSample; 12937 12938 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), 12939 guessForT = intervalStart + dist * kSampleStepSize, 12940 initialSlope = getSlope(guessForT, mX1, mX2); 12941 12942 if (initialSlope >= NEWTON_MIN_SLOPE) { 12943 return newtonRaphsonIterate(aX, guessForT); 12944 } else if (initialSlope === 0.0) { 12945 return guessForT; 12946 } else { 12947 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); 12948 } 12949 } 12950 12951 var _precomputed = false; 12952 12953 function precompute() { 12954 _precomputed = true; 12955 if (mX1 !== mY1 || mX2 !== mY2) { 12956 calcSampleValues(); 12957 } 12958 } 12959 12960 var f = function(aX) { 12961 if (!_precomputed) { 12962 precompute(); 12963 } 12964 if (mX1 === mY1 && mX2 === mY2) { 12965 return aX; 12966 } 12967 if (aX === 0) { 12968 return 0; 12969 } 12970 if (aX === 1) { 12971 return 1; 12972 } 12973 12974 return calcBezier(getTForX(aX), mY1, mY2); 12975 }; 12976 12977 f.getControlPoints = function() { 12978 return [{x: mX1, y: mY1}, {x: mX2, y: mY2}]; 12979 }; 12980 12981 var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; 12982 f.toString = function() { 12983 return str; 12984 }; 12985 12986 return f; 12987 } 12988 12989 /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 12990 /* 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 12991 then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ 12992 var generateSpringRK4 = (function() { 12993 function springAccelerationForState(state) { 12994 return (-state.tension * state.x) - (state.friction * state.v); 12995 } 12996 12997 function springEvaluateStateWithDerivative(initialState, dt, derivative) { 12998 var state = { 12999 x: initialState.x + derivative.dx * dt, 13000 v: initialState.v + derivative.dv * dt, 13001 tension: initialState.tension, 13002 friction: initialState.friction 13003 }; 13004 13005 return {dx: state.v, dv: springAccelerationForState(state)}; 13006 } 13007 13008 function springIntegrateState(state, dt) { 13009 var a = { 13010 dx: state.v, 13011 dv: springAccelerationForState(state) 13012 }, 13013 b = springEvaluateStateWithDerivative(state, dt * 0.5, a), 13014 c = springEvaluateStateWithDerivative(state, dt * 0.5, b), 13015 d = springEvaluateStateWithDerivative(state, dt, c), 13016 dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), 13017 dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); 13018 13019 state.x = state.x + dxdt * dt; 13020 state.v = state.v + dvdt * dt; 13021 13022 return state; 13023 } 13024 13025 return function springRK4Factory(tension, friction, duration) { 13026 13027 var initState = { 13028 x: -1, 13029 v: 0, 13030 tension: null, 13031 friction: null 13032 }, 13033 path = [0], 13034 time_lapsed = 0, 13035 tolerance = 1 / 10000, 13036 DT = 16 / 1000, 13037 have_duration, dt, last_state; 13038 13039 tension = parseFloat(tension) || 500; 13040 friction = parseFloat(friction) || 20; 13041 duration = duration || null; 13042 13043 initState.tension = tension; 13044 initState.friction = friction; 13045 13046 have_duration = duration !== null; 13047 13048 /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ 13049 if (have_duration) { 13050 /* Run the simulation without a duration. */ 13051 time_lapsed = springRK4Factory(tension, friction); 13052 /* Compute the adjusted time delta. */ 13053 dt = time_lapsed / duration * DT; 13054 } else { 13055 dt = DT; 13056 } 13057 13058 while (true) { 13059 /* Next/step function .*/ 13060 last_state = springIntegrateState(last_state || initState, dt); 13061 /* Store the position. */ 13062 path.push(1 + last_state.x); 13063 time_lapsed += 16; 13064 /* If the change threshold is reached, break. */ 13065 if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { 13066 break; 13067 } 13068 } 13069 13070 /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the 13071 computed path and returns a snapshot of the position according to a given percentComplete. */ 13072 return !have_duration ? time_lapsed : function(percentComplete) { 13073 return path[ (percentComplete * (path.length - 1)) | 0 ]; 13074 }; 13075 }; 13076 }()); 13077 13078 /* jQuery easings. */ 13079 Velocity.Easings = { 13080 linear: function(p) { 13081 return p; 13082 }, 13083 swing: function(p) { 13084 return 0.5 - Math.cos(p * Math.PI) / 2; 13085 }, 13086 /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ 13087 spring: function(p) { 13088 return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); 13089 } 13090 }; 13091 13092 /* CSS3 and Robert Penner easings. */ 13093 $.each( 13094 [ 13095 ["ease", [0.25, 0.1, 0.25, 1.0]], 13096 ["ease-in", [0.42, 0.0, 1.00, 1.0]], 13097 ["ease-out", [0.00, 0.0, 0.58, 1.0]], 13098 ["ease-in-out", [0.42, 0.0, 0.58, 1.0]], 13099 ["easeInSine", [0.47, 0, 0.745, 0.715]], 13100 ["easeOutSine", [0.39, 0.575, 0.565, 1]], 13101 ["easeInOutSine", [0.445, 0.05, 0.55, 0.95]], 13102 ["easeInQuad", [0.55, 0.085, 0.68, 0.53]], 13103 ["easeOutQuad", [0.25, 0.46, 0.45, 0.94]], 13104 ["easeInOutQuad", [0.455, 0.03, 0.515, 0.955]], 13105 ["easeInCubic", [0.55, 0.055, 0.675, 0.19]], 13106 ["easeOutCubic", [0.215, 0.61, 0.355, 1]], 13107 ["easeInOutCubic", [0.645, 0.045, 0.355, 1]], 13108 ["easeInQuart", [0.895, 0.03, 0.685, 0.22]], 13109 ["easeOutQuart", [0.165, 0.84, 0.44, 1]], 13110 ["easeInOutQuart", [0.77, 0, 0.175, 1]], 13111 ["easeInQuint", [0.755, 0.05, 0.855, 0.06]], 13112 ["easeOutQuint", [0.23, 1, 0.32, 1]], 13113 ["easeInOutQuint", [0.86, 0, 0.07, 1]], 13114 ["easeInExpo", [0.95, 0.05, 0.795, 0.035]], 13115 ["easeOutExpo", [0.19, 1, 0.22, 1]], 13116 ["easeInOutExpo", [1, 0, 0, 1]], 13117 ["easeInCirc", [0.6, 0.04, 0.98, 0.335]], 13118 ["easeOutCirc", [0.075, 0.82, 0.165, 1]], 13119 ["easeInOutCirc", [0.785, 0.135, 0.15, 0.86]] 13120 ], function(i, easingArray) { 13121 Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); 13122 }); 13123 13124 /* Determine the appropriate easing type given an easing input. */ 13125 function getEasing(value, duration) { 13126 var easing = value; 13127 13128 /* The easing option can either be a string that references a pre-registered easing, 13129 or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ 13130 if (Type.isString(value)) { 13131 /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ 13132 if (!Velocity.Easings[value]) { 13133 easing = false; 13134 } 13135 } else if (Type.isArray(value) && value.length === 1) { 13136 easing = generateStep.apply(null, value); 13137 } else if (Type.isArray(value) && value.length === 2) { 13138 /* springRK4 must be passed the animation's duration. */ 13139 /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing 13140 function generated with default tension and friction values. */ 13141 easing = generateSpringRK4.apply(null, value.concat([duration])); 13142 } else if (Type.isArray(value) && value.length === 4) { 13143 /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ 13144 easing = generateBezier.apply(null, value); 13145 } else { 13146 easing = false; 13147 } 13148 13149 /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) 13150 if the Velocity-wide default has been incorrectly modified. */ 13151 if (easing === false) { 13152 if (Velocity.Easings[Velocity.defaults.easing]) { 13153 easing = Velocity.defaults.easing; 13154 } else { 13155 easing = EASING_DEFAULT; 13156 } 13157 } 13158 13159 return easing; 13160 } 13161 13162 /***************** 13163 CSS Stack 13164 *****************/ 13165 13166 /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. 13167 It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ 13168 /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ 13169 var CSS = Velocity.CSS = { 13170 /************* 13171 RegEx 13172 *************/ 13173 13174 RegEx: { 13175 isHex: /^#([A-f\d]{3}){1,2}$/i, 13176 /* 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". */ 13177 valueUnwrap: /^[A-z]+\((.*)\)$/i, 13178 wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, 13179 /* 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" ]. */ 13180 valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig 13181 }, 13182 /************ 13183 Lists 13184 ************/ 13185 13186 Lists: { 13187 colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], 13188 transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], 13189 transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"], 13190 units: [ 13191 "%", // relative 13192 "em", "ex", "ch", "rem", // font relative 13193 "vw", "vh", "vmin", "vmax", // viewport relative 13194 "cm", "mm", "Q", "in", "pc", "pt", "px", // absolute lengths 13195 "deg", "grad", "rad", "turn", // angles 13196 "s", "ms" // time 13197 ], 13198 colorNames: { 13199 "aliceblue": "240,248,255", 13200 "antiquewhite": "250,235,215", 13201 "aquamarine": "127,255,212", 13202 "aqua": "0,255,255", 13203 "azure": "240,255,255", 13204 "beige": "245,245,220", 13205 "bisque": "255,228,196", 13206 "black": "0,0,0", 13207 "blanchedalmond": "255,235,205", 13208 "blueviolet": "138,43,226", 13209 "blue": "0,0,255", 13210 "brown": "165,42,42", 13211 "burlywood": "222,184,135", 13212 "cadetblue": "95,158,160", 13213 "chartreuse": "127,255,0", 13214 "chocolate": "210,105,30", 13215 "coral": "255,127,80", 13216 "cornflowerblue": "100,149,237", 13217 "cornsilk": "255,248,220", 13218 "crimson": "220,20,60", 13219 "cyan": "0,255,255", 13220 "darkblue": "0,0,139", 13221 "darkcyan": "0,139,139", 13222 "darkgoldenrod": "184,134,11", 13223 "darkgray": "169,169,169", 13224 "darkgrey": "169,169,169", 13225 "darkgreen": "0,100,0", 13226 "darkkhaki": "189,183,107", 13227 "darkmagenta": "139,0,139", 13228 "darkolivegreen": "85,107,47", 13229 "darkorange": "255,140,0", 13230 "darkorchid": "153,50,204", 13231 "darkred": "139,0,0", 13232 "darksalmon": "233,150,122", 13233 "darkseagreen": "143,188,143", 13234 "darkslateblue": "72,61,139", 13235 "darkslategray": "47,79,79", 13236 "darkturquoise": "0,206,209", 13237 "darkviolet": "148,0,211", 13238 "deeppink": "255,20,147", 13239 "deepskyblue": "0,191,255", 13240 "dimgray": "105,105,105", 13241 "dimgrey": "105,105,105", 13242 "dodgerblue": "30,144,255", 13243 "firebrick": "178,34,34", 13244 "floralwhite": "255,250,240", 13245 "forestgreen": "34,139,34", 13246 "fuchsia": "255,0,255", 13247 "gainsboro": "220,220,220", 13248 "ghostwhite": "248,248,255", 13249 "gold": "255,215,0", 13250 "goldenrod": "218,165,32", 13251 "gray": "128,128,128", 13252 "grey": "128,128,128", 13253 "greenyellow": "173,255,47", 13254 "green": "0,128,0", 13255 "honeydew": "240,255,240", 13256 "hotpink": "255,105,180", 13257 "indianred": "205,92,92", 13258 "indigo": "75,0,130", 13259 "ivory": "255,255,240", 13260 "khaki": "240,230,140", 13261 "lavenderblush": "255,240,245", 13262 "lavender": "230,230,250", 13263 "lawngreen": "124,252,0", 13264 "lemonchiffon": "255,250,205", 13265 "lightblue": "173,216,230", 13266 "lightcoral": "240,128,128", 13267 "lightcyan": "224,255,255", 13268 "lightgoldenrodyellow": "250,250,210", 13269 "lightgray": "211,211,211", 13270 "lightgrey": "211,211,211", 13271 "lightgreen": "144,238,144", 13272 "lightpink": "255,182,193", 13273 "lightsalmon": "255,160,122", 13274 "lightseagreen": "32,178,170", 13275 "lightskyblue": "135,206,250", 13276 "lightslategray": "119,136,153", 13277 "lightsteelblue": "176,196,222", 13278 "lightyellow": "255,255,224", 13279 "limegreen": "50,205,50", 13280 "lime": "0,255,0", 13281 "linen": "250,240,230", 13282 "magenta": "255,0,255", 13283 "maroon": "128,0,0", 13284 "mediumaquamarine": "102,205,170", 13285 "mediumblue": "0,0,205", 13286 "mediumorchid": "186,85,211", 13287 "mediumpurple": "147,112,219", 13288 "mediumseagreen": "60,179,113", 13289 "mediumslateblue": "123,104,238", 13290 "mediumspringgreen": "0,250,154",
13291 "mediumturquoise": "72,209,204", 13292 "mediumvioletred": "199,21,133", 13293 "midnightblue": "25,25,112", 13294 "mintcream": "245,255,250", 13295 "mistyrose": "255,228,225", 13296 "moccasin": "255,228,181", 13297 "navajowhite": "255,222,173", 13298 "navy": "0,0,128", 13299 "oldlace": "253,245,230", 13300 "olivedrab": "107,142,35", 13301 "olive": "128,128,0", 13302 "orangered": "255,69,0", 13303 "orange": "255,165,0", 13304 "orchid": "218,112,214", 13305 "palegoldenrod": "238,232,170", 13306 "palegreen": "152,251,152", 13307 "paleturquoise": "175,238,238", 13308 "palevioletred": "219,112,147", 13309 "papayawhip": "255,239,213", 13310 "peachpuff": "255,218,185", 13311 "peru": "205,133,63", 13312 "pink": "255,192,203", 13313 "plum": "221,160,221", 13314 "powderblue": "176,224,230", 13315 "purple": "128,0,128", 13316 "red": "255,0,0", 13317 "rosybrown": "188,143,143", 13318 "royalblue": "65,105,225", 13319 "saddlebrown": "139,69,19", 13320 "salmon": "250,128,114", 13321 "sandybrown": "244,164,96", 13322 "seagreen": "46,139,87", 13323 "seashell": "255,245,238", 13324 "sienna": "160,82,45", 13325 "silver": "192,192,192", 13326 "skyblue": "135,206,235", 13327 "slateblue": "106,90,205", 13328 "slategray": "112,128,144", 13329 "snow": "255,250,250", 13330 "springgreen": "0,255,127", 13331 "steelblue": "70,130,180", 13332 "tan": "210,180,140", 13333 "teal": "0,128,128", 13334 "thistle": "216,191,216", 13335 "tomato": "255,99,71", 13336 "turquoise": "64,224,208", 13337 "violet": "238,130,238", 13338 "wheat": "245,222,179", 13339 "whitesmoke": "245,245,245", 13340 "white": "255,255,255", 13341 "yellowgreen": "154,205,50", 13342 "yellow": "255,255,0" 13343 } 13344 }, 13345 /************ 13346 Hooks 13347 ************/ 13348 13349 /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property 13350 (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ 13351 /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only 13352 tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ 13353 Hooks: { 13354 /******************** 13355 Registration 13356 ********************/ 13357 13358 /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ 13359 /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ 13360 templates: { 13361 "textShadow": ["Color X Y Blur", "black 0px 0px 0px"], 13362 "boxShadow": ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], 13363 "clip": ["Top Right Bottom Left", "0px 0px 0px 0px"], 13364 "backgroundPosition": ["X Y", "0% 0%"], 13365 "transformOrigin": ["X Y Z", "50% 50% 0px"], 13366 "perspectiveOrigin": ["X Y", "50% 50%"] 13367 }, 13368 /* A "registered" hook is one that has been converted from its template form into a live, 13369 tweenable property. It contains data to associate it with its root property. */ 13370 registered: { 13371 /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], 13372 which consists of the subproperty's name, the associated root property's name, 13373 and the subproperty's position in the root's value. */ 13374 }, 13375 /* Convert the templates into individual hooks then append them to the registered object above. */ 13376 register: function() { 13377 /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are 13378 currently set to "transparent" default to their respective template below when color-animated, 13379 and white is typically a closer match to transparent than black is. An exception is made for text ("color"), 13380 which is almost always set closer to black than white. */ 13381 for (var i = 0; i < CSS.Lists.colors.length; i++) { 13382 var rgbComponents = (CSS.Lists.colors[i] === "color") ? "0 0 0 1" : "255 255 255 1"; 13383 CSS.Hooks.templates[CSS.Lists.colors[i]] = ["Red Green Blue Alp
vendor: 164,276 bytes, lines 13383-16719
13383ha", rgbComponents]; 13384 } 13385 13386 var rootProperty, 13387 hookTemplate, 13388 hookNames; 13389 13390 /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. 13391 Thus, we re-arrange the templates accordingly. */ 13392 if (IE) { 13393 for (rootProperty in CSS.Hooks.templates) { 13394 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 13395 continue; 13396 } 13397 hookTemplate = CSS.Hooks.templates[rootProperty]; 13398 hookNames = hookTemplate[0].split(" "); 13399 13400 var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); 13401 13402 if (hookNames[0] === "Color") { 13403 /* Reposition both the hook's name and its default value to the end of their respective strings. */ 13404 hookNames.push(hookNames.shift()); 13405 defaultValues.push(defaultValues.shift()); 13406 13407 /* Replace the existing template for the hook's root property. */ 13408 CSS.Hooks.templates[rootProperty] = [hookNames.join(" "), defaultValues.join(" ")]; 13409 } 13410 } 13411 } 13412 13413 /* Hook registration. */ 13414 for (rootProperty in CSS.Hooks.templates) { 13415 if (!CSS.Hooks.templates.hasOwnProperty(rootProperty)) { 13416 continue; 13417 } 13418 hookTemplate = CSS.Hooks.templates[rootProperty]; 13419 hookNames = hookTemplate[0].split(" "); 13420 13421 for (var j in hookNames) { 13422 if (!hookNames.hasOwnProperty(j)) { 13423 continue; 13424 } 13425 var fullHookName = rootProperty + hookNames[j], 13426 hookPosition = j; 13427 13428 /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) 13429 and the hook's position in its template's default value string. */ 13430 CSS.Hooks.registered[fullHookName] = [rootProperty, hookPosition]; 13431 } 13432 } 13433 }, 13434 /***************************** 13435 Injection and Extraction 13436 *****************************/ 13437 13438 /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ 13439 /* 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. */ 13440 getRoot: function(property) { 13441 var hookData = CSS.Hooks.registered[property]; 13442 13443 if (hookData) { 13444 return hookData[0]; 13445 } else { 13446 /* If there was no hook match, return the property name untouched. */ 13447 return property; 13448 } 13449 }, 13450 getUnit: function(str, start) { 13451 var unit = (str.substr(start || 0, 5).match(/^[a-z%]+/) || [])[0] || ""; 13452 13453 if (unit && _inArray(CSS.Lists.units, unit)) { 13454 return unit; 13455 } 13456 return ""; 13457 }, 13458 fixColors: function(str) { 13459 return str.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g, function($0, $1, $2) { 13460 if (CSS.Lists.colorNames.hasOwnProperty($2)) { 13461 return ($1 ? $1 : "rgba(") + CSS.Lists.colorNames[$2] + ($1 ? "" : ",1)"); 13462 } 13463 return $1 + $2; 13464 }); 13465 }, 13466 /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that 13467 the targeted hook can be injected or extracted at its standard position. */ 13468 cleanRootPropertyValue: function(rootProperty, rootPropertyValue) { 13469 /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ 13470 if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { 13471 rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1]; 13472 } 13473 13474 /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), 13475 default to the root's default value as defined in CSS.Hooks.templates. */ 13476 /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their 13477 zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ 13478 if (CSS.Values.isCSSNullValue(rootPropertyValue)) { 13479 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 13480 } 13481 13482 return rootPropertyValue; 13483 }, 13484 /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ 13485 extractValue: function(fullHookName, rootPropertyValue) { 13486 var hookData = CSS.Hooks.registered[fullHookName]; 13487 13488 if (hookData) { 13489 var hookRoot = hookData[0], 13490 hookPosition = hookData[1]; 13491 13492 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 13493 13494 /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ 13495 return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; 13496 } else { 13497 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 13498 return rootPropertyValue; 13499 } 13500 }, 13501 /* Inject the hook's value into its root property's value. This is used to piece back together the root property 13502 once Velocity has updated one of its individually hooked values through tweening. */ 13503 injectValue: function(fullHookName, hookValue, rootPropertyValue) { 13504 var hookData = CSS.Hooks.registered[fullHookName]; 13505 13506 if (hookData) { 13507 var hookRoot = hookData[0], 13508 hookPosition = hookData[1], 13509 rootPropertyValueParts, 13510 rootPropertyValueUpdated; 13511 13512 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 13513 13514 /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, 13515 then reconstruct the rootPropertyValue string. */ 13516 rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); 13517 rootPropertyValueParts[hookPosition] = hookValue; 13518 rootPropertyValueUpdated = rootPropertyValueParts.join(" "); 13519 13520 return rootPropertyValueUpdated; 13521 } else { 13522 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 13523 return rootPropertyValue; 13524 } 13525 } 13526 }, 13527 /******************* 13528 Normalizations 13529 *******************/ 13530 13531 /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) 13532 and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ 13533 Normalizations: { 13534 /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), 13535 the targeted element (which may need to be queried), and the targeted property value. */ 13536 registered: { 13537 clip: function(type, element, propertyValue) { 13538 switch (type) { 13539 case "name": 13540 return "clip"; 13541 /* Clip needs to be unwrapped and stripped of its commas during extraction. */ 13542 case "extract": 13543 var extracted; 13544 13545 /* If Velocity also extracted this value, skip extraction. */ 13546 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 13547 extracted = propertyValue; 13548 } else { 13549 /* Remove the "rect()" wrapper. */ 13550 extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap); 13551 13552 /* Strip off commas. */ 13553 extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; 13554 } 13555 13556 return extracted; 13557 /* Clip needs to be re-wrapped during injection. */ 13558 case "inject": 13559 return "rect(" + propertyValue + ")"; 13560 } 13561 }, 13562 blur: function(type, element, propertyValue) { 13563 switch (type) { 13564 case "name": 13565 return Velocity.State.isFirefox ? "filter" : "-webkit-filter"; 13566 case "extract": 13567 var extracted = parseFloat(propertyValue); 13568 13569 /* If extracted is NaN, meaning the value isn't already extracted. */ 13570 if (!(extracted || extracted === 0)) { 13571 var blurComponent = propertyValue.toString().match(/blur\(([0-9]+[A-z]+)\)/i); 13572 13573 /* If the filter string had a blur component, return just the blur value and unit type. */ 13574 if (blurComponent) { 13575 extracted = blurComponent[1]; 13576 /* If the component doesn't exist, default blur to 0. */ 13577 } else { 13578 extracted = 0; 13579 } 13580 } 13581 13582 return extracted; 13583 /* Blur needs to be re-wrapped during injection. */ 13584 case "inject": 13585 /* For the blur effect to be fully de-applied, it needs to be set to "none" instead of 0. */ 13586 if (!parseFloat(propertyValue)) { 13587 return "none"; 13588 } else { 13589 return "blur(" + propertyValue + ")"; 13590 } 13591 } 13592 }, 13593 /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ 13594 opacity: function(type, element, propertyValue) { 13595 if (IE <= 8) { 13596 switch (type) { 13597 case "name": 13598 return "filter"; 13599 case "extract": 13600 /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". 13601 Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ 13602 var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); 13603 13604 if (extracted) { 13605 /* Convert to decimal value. */ 13606 propertyValue = extracted[1] / 100; 13607 } else { 13608 /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */ 13609 propertyValue = 1; 13610 } 13611 13612 return propertyValue; 13613 case "inject": 13614 /* Opacified elements are required to have their zoom property set to a non-zero value. */ 13615 element.style.zoom = 1; 13616 13617 /* Setting the filter property on elements with certain font property combinations can result in a 13618 highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the 13619 value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ 13620 if (parseFloat(propertyValue) >= 1) { 13621 return ""; 13622 } else { 13623 /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ 13624 return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; 13625 } 13626 } 13627 /* With all other browsers, normalization is not required; return the same values that were passed in. */ 13628 } else { 13629 switch (type) { 13630 case "name": 13631 return "opacity"; 13632 case "extract": 13633 return propertyValue; 13634 case "inject": 13635 return propertyValue; 13636 } 13637 } 13638 } 13639 }, 13640 /***************************** 13641 Batched Registrations 13642 *****************************/ 13643 13644 /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ 13645 register: function() { 13646 13647 /***************** 13648 Transforms 13649 *****************/ 13650 13651 /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization 13652 so that they can be referenced in a properties map by their individual names. */ 13653 /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform 13654 setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. 13655 Transform setting is batched in this way to improve performance: the transform style only needs to be updated 13656 once when multiple transform subproperties are being animated simultaneously. */ 13657 /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported 13658 transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values 13659 from being normalized for these browsers so that tweening skips these properties altogether 13660 (since it will ignore them as being unsupported by the browser.) */ 13661 if ((!IE || IE > 9) && !Velocity.State.isGingerbread) { 13662 /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty 13663 share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ 13664 CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D); 13665 } 13666 13667 for (var i = 0; i < CSS.Lists.transformsBase.length; i++) { 13668 /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is 13669 paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ 13670 (function() { 13671 var transformName = CSS.Lists.transformsBase[i]; 13672 13673 CSS.Normalizations.registered[transformName] = function(type, element, propertyValue) { 13674 switch (type) { 13675 /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ 13676 case "name": 13677 return "transform"; 13678 /* Transform values are cached onto a per-element transformCache object. */ 13679 case "extract": 13680 /* If this transform has yet to be assigned a value, return its null value. */ 13681 if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) { 13682 /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */ 13683 return /^scale/i.test(transformName) ? 1 : 0; 13684 /* When transform values are set, they are wrapped in parentheses as per the CSS spec. 13685 Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ 13686 } 13687 return Data(element).transformCache[transformName].replace(/[()]/g, ""); 13688 case "inject": 13689 var invalid = false; 13690 13691 /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. 13692 Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ 13693 /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ 13694 switch (transformName.substr(0, transformName.length - 1)) { 13695 /* Whitelist unit types for each transform. */ 13696 case "translate": 13697 invalid = !/(%|px|em|rem|vw|vh|\d)$/i.test(propertyValue); 13698 break; 13699 /* 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. */ 13700 case "scal": 13701 case "scale": 13702 /* Chrome on Android has a bug in which scaled elements blur if their initial scale 13703 value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property 13704 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 */ 13705 if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) { 13706 propertyValue = 1; 13707 } 13708 13709 invalid = !/(\d)$/i.test(propertyValue); 13710 break; 13711 case "skew": 13712 invalid = !/(deg|\d)$/i.test(propertyValue); 13713 break; 13714 case "rotate": 13715 invalid = !/(deg|\d)$/i.test(propertyValue); 13716 break; 13717 } 13718 13719 if (!invalid) { 13720 /* As per the CSS spec, wrap the value in parentheses. */ 13721 Data(element).transformCache[transformName] = "(" + propertyValue + ")"; 13722 } 13723 13724 /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ 13725 return Data(element).transformCache[transformName]; 13726 } 13727 }; 13728 })(); 13729 } 13730 13731 /************* 13732 Colors 13733 *************/ 13734 13735 /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. 13736 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. */ 13737 for (var j = 0; j < CSS.Lists.colors.length; j++) { 13738 /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. 13739 (Otherwise, all functions would take the final for loop's colorName.) */ 13740 (function() { 13741 var colorName = CSS.Lists.colors[j]; 13742 13743 /* Note: In IE<=8, which support rgb but not rgba, color properties are reverted to rgb by stripping off the alpha component. */ 13744 CSS.Normalizations.registered[colorName] = function(type, element, propertyValue) { 13745 switch (type) { 13746 case "name": 13747 return colorName; 13748 /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ 13749 case "extract": 13750 var extracted; 13751 13752 /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ 13753 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 13754 extracted = propertyValue; 13755 } else { 13756 var converted, 13757 colorNames = { 13758 black: "rgb(0, 0, 0)", 13759 blue: "rgb(0, 0, 255)", 13760 gray: "rgb(128, 128, 128)", 13761 green: "rgb(0, 128, 0)", 13762 red: "rgb(255, 0, 0)", 13763 white: "rgb(255, 255, 255)" 13764 }; 13765 13766 /* Convert color names to rgb. */ 13767 if (/^[A-z]+$/i.test(propertyValue)) { 13768 if (colorNames[propertyValue] !== undefined) { 13769 converted = colorNames[propertyValue]; 13770 } else { 13771 /* If an unmatched color name is provided, default to black. */ 13772 converted = colorNames.black; 13773 } 13774 /* Convert hex values to rgb. */ 13775 } else if (CSS.RegEx.isHex.test(propertyValue)) { 13776 converted = "rgb(" + CSS.Values.hexToRgb(propertyValue).join(" ") + ")"; 13777 /* If the provided color doesn't match any of the accepted color formats, default to black. */ 13778 } else if (!(/^rgba?\(/i.test(propertyValue))) { 13779 converted = colorNames.black; 13780 } 13781 13782 /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip 13783 repeated spaces (in case the value included spaces to begin with). */ 13784 extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); 13785 } 13786 13787 /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 13788 if ((!IE || IE > 8) && extracted.split(" ").length === 3) { 13789 extracted += " 1"; 13790 } 13791 13792 return extracted; 13793 case "inject": 13794 /* If we have a pattern then it might already have the right values */ 13795 if (/^rgb/.test(propertyValue)) { 13796 return propertyValue; 13797 } 13798 13799 /* If this is IE<=8 and an alpha component exists, strip it off. */ 13800 if (IE <= 8) { 13801 if (propertyValue.split(" ").length === 4) { 13802 propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); 13803 } 13804 /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 13805 } else if (propertyValue.split(" ").length === 3) { 13806 propertyValue += " 1"; 13807 } 13808 13809 /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units 13810 on all values but the fourth (R, G, and B only accept whole numbers). */ 13811 return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; 13812 } 13813 }; 13814 })(); 13815 } 13816 13817 /************** 13818 Dimensions 13819 **************/ 13820 function augmentDimension(name, element, wantInner) { 13821 var isBorderBox = CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() === "border-box"; 13822 13823 if (isBorderBox === (wantInner || false)) { 13824 /* in box-sizing mode, the CSS width / height accessors already give the outerWidth / outerHeight. */ 13825 var i, 13826 value, 13827 augment = 0, 13828 sides = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"], 13829 fields = ["padding" + sides[0], "padding" + sides[1], "border" + sides[0] + "Width", "border" + sides[1] + "Width"]; 13830 13831 for (i = 0; i < fields.length; i++) { 13832 value = parseFloat(CSS.getPropertyValue(element, fields[i])); 13833 if (!isNaN(value)) { 13834 augment += value; 13835 } 13836 } 13837 return wantInner ? -augment : augment; 13838 } 13839 return 0; 13840 } 13841 function getDimension(name, wantInner) { 13842 return function(type, element, propertyValue) { 13843 switch (type) { 13844 case "name": 13845 return name; 13846 case "extract": 13847 return parseFloat(propertyValue) + augmentDimension(name, element, wantInner); 13848 case "inject": 13849 return (parseFloat(propertyValue) - augmentDimension(name, element, wantInner)) + "px"; 13850 } 13851 }; 13852 } 13853 CSS.Normalizations.registered.innerWidth = getDimension("width", true); 13854 CSS.Normalizations.registered.innerHeight = getDimension("height", true); 13855 CSS.Normalizations.registered.outerWidth = getDimension("width"); 13856 CSS.Normalizations.registered.outerHeight = getDimension("height"); 13857 } 13858 }, 13859 /************************ 13860 CSS Property Names 13861 ************************/ 13862 13863 Names: { 13864 /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). 13865 Camelcasing is used to normalize property names between and across calls. */ 13866 camelCase: function(property) { 13867 return property.replace(/-(\w)/g, function(match, subMatch) { 13868 return subMatch.toUpperCase(); 13869 }); 13870 }, 13871 /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */ 13872 SVGAttribute: function(property) { 13873 var SVGAttributes = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; 13874 13875 /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */ 13876 if (IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) { 13877 SVGAttributes += "|transform"; 13878 } 13879 13880 return new RegExp("^(" + SVGAttributes + ")$", "i").test(property); 13881 }, 13882 /* Determine whether a property should be set with a vendor prefix. */ 13883 /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. 13884 If the property is not at all supported by the browser, return a false flag. */ 13885 prefixCheck: function(property) { 13886 /* If this property has already been checked, return the cached value. */ 13887 if (Velocity.State.prefixMatches[property]) { 13888 return [Velocity.State.prefixMatches[property], true]; 13889 } else { 13890 var vendors = ["", "Webkit", "Moz", "ms", "O"]; 13891 13892 for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { 13893 var propertyPrefixed; 13894 13895 if (i === 0) { 13896 propertyPrefixed = property; 13897 } else { 13898 /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ 13899 propertyPrefixed = vendors[i] + property.replace(/^\w/, function(match) { 13900 return match.toUpperCase(); 13901 }); 13902 } 13903 13904 /* Check if the browser supports this property as prefixed. */ 13905 if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) { 13906 /* Cache the match. */ 13907 Velocity.State.prefixMatches[property] = propertyPrefixed; 13908 13909 return [propertyPrefixed, true]; 13910 } 13911 } 13912 13913 /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ 13914 return [property, false]; 13915 } 13916 } 13917 }, 13918 /************************ 13919 CSS Property Values 13920 ************************/ 13921 13922 Values: { 13923 /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ 13924 hexToRgb: function(hex) { 13925 var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, 13926 longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, 13927 rgbParts; 13928 13929 hex = hex.replace(shortformRegex, function(m, r, g, b) { 13930 return r + r + g + g + b + b; 13931 }); 13932 13933 rgbParts = longformRegex.exec(hex); 13934 13935 return rgbParts ? [parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16)] : [0, 0, 0]; 13936 }, 13937 isCSSNullValue: function(value) { 13938 /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. 13939 Thus, we check for both falsiness and these special strings. */ 13940 /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook 13941 templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ 13942 /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ 13943 return (!value || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value)); 13944 }, 13945 /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ 13946 getUnitType: function(property) { 13947 if (/^(rotate|skew)/i.test(property)) { 13948 return "deg"; 13949 } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) { 13950 /* The above properties are unitless. */ 13951 return ""; 13952 } else { 13953 /* Default to px for all other properties. */ 13954 return "px"; 13955 } 13956 }, 13957 /* HTML elements default to an associated display type when they're not set to display:none. */ 13958 /* Note: This function is used for correctly setting the non-"none" display value in certain Velocity redirects, such as fadeIn/Out. */ 13959 getDisplayType: function(element) { 13960 var tagName = element && element.tagName.toString().toLowerCase(); 13961 13962 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)) { 13963 return "inline"; 13964 } else if (/^(li)$/i.test(tagName)) { 13965 return "list-item"; 13966 } else if (/^(tr)$/i.test(tagName)) { 13967 return "table-row"; 13968 } else if (/^(table)$/i.test(tagName)) { 13969 return "table"; 13970 } else if (/^(tbody)$/i.test(tagName)) { 13971 return "table-row-group"; 13972 /* Default to "block" when no match is found. */ 13973 } else { 13974 return "block"; 13975 } 13976 }, 13977 /* The class add/remove functions are used to temporarily apply a "velocity-animating" class to elements while they're animating. */ 13978 addClass: function(element, className) { 13979 if (element) { 13980 if (element.classList) { 13981 element.classList.add(className); 13982 } else if (Type.isString(element.className)) { 13983 // Element.className is around 15% faster then set/getAttribute 13984 element.className += (element.className.length ? " " : "") + className; 13985 } else { 13986 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 13987 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 13988 13989 element.setAttribute("class", currentClass + (currentClass ? " " : "") + className); 13990 } 13991 } 13992 }, 13993 removeClass: function(element, className) { 13994 if (element) { 13995 if (element.classList) { 13996 element.classList.remove(className); 13997 } else if (Type.isString(element.className)) { 13998 // Element.className is around 15% faster then set/getAttribute 13999 // TODO: Need some jsperf tests on performance - can we get rid of the regex and maybe use split / array manipulation? 14000 element.className = element.className.toString().replace(new RegExp("(^|\\s)" + className.split(" ").join("|") + "(\\s|$)", "gi"), " "); 14001 } else { 14002 // Work around for IE strict mode animating SVG - and anything else that doesn't behave correctly - the same way jQuery does it 14003 var currentClass = element.getAttribute(IE <= 7 ? "className" : "class") || ""; 14004 14005 element.setAttribute("class", currentClass.replace(new RegExp("(^|\s)" + className.split(" ").join("|") + "(\s|$)", "gi"), " ")); 14006 } 14007 } 14008 } 14009 }, 14010 /**************************** 14011 Style Getting & Setting 14012 ****************************/ 14013 14014 /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 14015 getPropertyValue: function(element, property, rootPropertyValue, forceStyleLookup) { 14016 /* Get an element's computed property value. */ 14017 /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's 14018 style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's 14019 *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 14020 function computePropertyValue(element, property) { 14021 /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an 14022 element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate 14023 offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. 14024 We subtract border and padding to get the sum of interior + scrollbar. */ 14025 var computedValue = 0; 14026 14027 /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array 14028 of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the 14029 codebase for a dying browser. The performance repercussions of using jQuery here are minimal since 14030 Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ 14031 if (IE <= 8) { 14032 computedValue = $.css(element, property); /* GET */ 14033 /* All other browsers support getComputedStyle. The returned live object reference is cached onto its 14034 associated element so that it does not need to be refetched upon every GET. */ 14035 } else { 14036 /* Browsers do not return height and width values for elements that are set to display:"none". Thus, we temporarily 14037 toggle display to the element type's default value. */ 14038 var toggleDisplay = false; 14039 14040 if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, "display") === 0) { 14041 toggleDisplay = true; 14042 CSS.setPropertyValue(element, "display", CSS.Values.getDisplayType(element)); 14043 } 14044 14045 var revertDisplay = function() { 14046 if (toggleDisplay) { 14047 CSS.setPropertyValue(element, "display", "none"); 14048 } 14049 }; 14050 14051 if (!forceStyleLookup) { 14052 if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 14053 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); 14054 revertDisplay(); 14055 14056 return contentBoxHeight; 14057 } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 14058 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); 14059 revertDisplay(); 14060 14061 return contentBoxWidth; 14062 } 14063 } 14064 14065 var computedStyle; 14066 14067 /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf 14068 of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ 14069 if (Data(element) === undefined) { 14070 computedStyle = window.getComputedStyle(element, null); /* GET */ 14071 /* If the computedStyle object has yet to be cached, do so now. */ 14072 } else if (!Data(element).computedStyle) { 14073 computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null); /* GET */ 14074 /* If computedStyle is cached, use it. */ 14075 } else { 14076 computedStyle = Data(element).computedStyle; 14077 } 14078 14079 /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. 14080 Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse. 14081 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. */ 14082 if (property === "borderColor") { 14083 property = "borderTopColor"; 14084 } 14085 14086 /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method 14087 instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ 14088 if (IE === 9 && property === "filter") { 14089 computedValue = computedStyle.getPropertyValue(property); /* GET */ 14090 } else { 14091 computedValue = computedStyle[property]; 14092 } 14093 14094 /* Fall back to the property's style value (if defined) when computedValue returns nothing, 14095 which can happen when the element hasn't been painted. */ 14096 if (computedValue === "" || computedValue === null) { 14097 computedValue = element.style[property]; 14098 } 14099 14100 revertDisplay(); 14101 } 14102 14103 /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, 14104 defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same 14105 effect as being set to 0, so no conversion is necessary.) */ 14106 /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" 14107 property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative 14108 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"). */ 14109 if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { 14110 var position = computePropertyValue(element, "position"); /* GET */ 14111 14112 /* For absolute positioning, jQuery's $.position() only returns values for top and left; 14113 right and bottom will have their "auto" value reverted to 0. */ 14114 /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). 14115 Not a big deal since we're currently in a GET batch anyway. */ 14116 if (position === "fixed" || (position === "absolute" && /top|left/i.test(property))) { 14117 /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ 14118 computedValue = $(element).position()[property] + "px"; /* GET */ 14119 } 14120 } 14121 14122 return computedValue; 14123 } 14124 14125 var propertyValue; 14126 14127 /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), 14128 extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ 14129 if (CSS.Hooks.registered[property]) { 14130 var hook = property, 14131 hookRoot = CSS.Hooks.getRoot(hook); 14132 14133 /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), 14134 query the DOM for the root property's value. */ 14135 if (rootPropertyValue === undefined) { 14136 /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ 14137 rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ 14138 } 14139 14140 /* If this root has a normalization registered, peform the associated normalization extraction. */ 14141 if (CSS.Normalizations.registered[hookRoot]) { 14142 rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); 14143 } 14144 14145 /* Extract the hook's value. */ 14146 propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); 14147 14148 /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), 14149 normalize the property's name and value, and handle the special case of transforms. */ 14150 /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly 14151 numerical and therefore do not require normalization extraction. */ 14152 } else if (CSS.Normalizations.registered[property]) { 14153 var normalizedPropertyName, 14154 normalizedPropertyValue; 14155 14156 normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); 14157 14158 /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. 14159 At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. 14160 This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; 14161 thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ 14162 if (normalizedPropertyName !== "transform") { 14163 normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ 14164 14165 /* 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. */ 14166 if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { 14167 normalizedPropertyValue = CSS.Hooks.templates[property][1]; 14168 } 14169 } 14170 14171 propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); 14172 } 14173 14174 /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */ 14175 if (!/^[\d-]/.test(propertyValue)) { 14176 /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via 14177 their HTML attribute values instead of their CSS style values. */ 14178 var data = Data(element); 14179 14180 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 14181 /* Since the height/width attribute values must be set manually, they don't reflect computed values. 14182 Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */ 14183 if (/^(height|width)$/i.test(property)) { 14184 /* Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. */ 14185 try { 14186 propertyValue = element.getBBox()[property]; 14187 } catch (error) { 14188 propertyValue = 0; 14189 } 14190 /* Otherwise, access the attribute value directly. */ 14191 } else { 14192 propertyValue = element.getAttribute(property); 14193 } 14194 } else { 14195 propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ 14196 } 14197 } 14198 14199 /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), 14200 convert CSS null-values to an integer of value 0. */ 14201 if (CSS.Values.isCSSNullValue(propertyValue)) { 14202 propertyValue = 0; 14203 } 14204 14205 if (Velocity.debug >= 2) { 14206 console.log("Get " + property + ": " + propertyValue); 14207 } 14208 14209 return propertyValue; 14210 }, 14211 /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 14212 setPropertyValue: function(element, property, propertyValue, rootPropertyValue, scrollData) { 14213 var propertyName = property; 14214 14215 /* 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. */ 14216 if (property === "scroll") { 14217 /* If a container option is present, scroll the container instead of the browser window. */ 14218 if (scrollData.container) { 14219 scrollData.container["scroll" + scrollData.direction] = propertyValue; 14220 /* Otherwise, Velocity defaults to scrolling the browser window. */ 14221 } else { 14222 if (scrollData.direction === "Left") { 14223 window.scrollTo(propertyValue, scrollData.alternateValue); 14224 } else { 14225 window.scrollTo(scrollData.alternateValue, propertyValue); 14226 } 14227 } 14228 } else { 14229 /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). 14230 Thus, for now, we merely cache transforms being SET. */ 14231 if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { 14232 /* Perform a normalization injection. */ 14233 /* Note: The normalization logic handles the transformCache updating. */ 14234 CSS.Normalizations.registered[property]("inject", element, propertyValue); 14235 14236 propertyName = "transform"; 14237 propertyValue = Data(element).transformCache[property]; 14238 } else { 14239 /* Inject hooks. */ 14240 if (CSS.Hooks.registered[property]) { 14241 var hookName = property, 14242 hookRoot = CSS.Hooks.getRoot(property); 14243 14244 /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ 14245 rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ 14246 14247 propertyValue = CSS.Hooks.injectValue(hookName, propertyValue, rootPropertyValue); 14248 property = hookRoot; 14249 } 14250 14251 /* Normalize names and values. */ 14252 if (CSS.Normalizations.registered[property]) { 14253 propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); 14254 property = CSS.Normalizations.registered[property]("name", element); 14255 } 14256 14257 /* Assign the appropriate vendor prefix before performing an official style update. */ 14258 propertyName = CSS.Names.prefixCheck(property)[0]; 14259 14260 /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. 14261 Try/catch is avoided for other browsers since it incurs a performance overhead. */ 14262 if (IE <= 8) { 14263 try { 14264 element.style[propertyName] = propertyValue; 14265 } catch (error) { 14266 if (Velocity.debug) { 14267 console.log("Browser does not support [" + propertyValue + "] for [" + propertyName + "]"); 14268 } 14269 } 14270 /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */ 14271 /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */ 14272 } else { 14273 var data = Data(element); 14274 14275 if (data && data.isSVG && CSS.Names.SVGAttribute(property)) { 14276 /* Note: For SVG attributes, vendor-prefixed property names are never used. */ 14277 /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */ 14278 element.setAttribute(property, propertyValue); 14279 } else { 14280 element.style[propertyName] = propertyValue; 14281 } 14282 } 14283 14284 if (Velocity.debug >= 2) { 14285 console.log("Set " + property + " (" + propertyName + "): " + propertyValue); 14286 } 14287 } 14288 } 14289 14290 /* 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. */ 14291 return [propertyName, propertyValue]; 14292 }, 14293 /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ 14294 /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */ 14295 flushTransformCache: function(element) { 14296 var transformString = "", 14297 data = Data(element); 14298 14299 /* 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 14300 (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). */ 14301 if ((IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) && data && data.isSVG) { 14302 /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values. 14303 Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */ 14304 var getTransformFloat = function(transformProperty) { 14305 return parseFloat(CSS.getPropertyValue(element, transformProperty)); 14306 }; 14307 14308 /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple, 14309 we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */ 14310 var SVGTransforms = { 14311 translate: [getTransformFloat("translateX"), getTransformFloat("translateY")], 14312 skewX: [getTransformFloat("skewX")], skewY: [getTransformFloat("skewY")], 14313 /* If the scale property is set (non-1), use that value for the scaleX and scaleY values 14314 (this behavior mimics the result of animating all these properties at once on HTML elements). */ 14315 scale: getTransformFloat("scale") !== 1 ? [getTransformFloat("scale"), getTransformFloat("scale")] : [getTransformFloat("scaleX"), getTransformFloat("scaleY")], 14316 /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values 14317 defining the rotation's origin point. We ignore the origin values (default them to 0). */ 14318 rotate: [getTransformFloat("rotateZ"), 0, 0] 14319 }; 14320 14321 /* Iterate through the transform properties in the user-defined property map order. 14322 (This mimics the behavior of non-SVG transform animation.) */ 14323 $.each(Data(element).transformCache, function(transformName) { 14324 /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master 14325 properties so that they match up with SVG's accepted transform properties. */ 14326 if (/^translate/i.test(transformName)) { 14327 transformName = "translate"; 14328 } else if (/^scale/i.test(transformName)) { 14329 transformName = "scale"; 14330 } else if (/^rotate/i.test(transformName)) { 14331 transformName = "rotate"; 14332 } 14333 14334 /* Check that we haven't yet deleted the property from the SVGTransforms container. */ 14335 if (SVGTransforms[transformName]) { 14336 /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */ 14337 transformString += transformName + "(" + SVGTransforms[transformName].join(" ") + ")" + " "; 14338 14339 /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't 14340 re-insert the same master property if we encounter another one of its axis-specific properties. */ 14341 delete SVGTransforms[transformName]; 14342 } 14343 }); 14344 } else { 14345 var transformValue, 14346 perspective; 14347 14348 /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ 14349 $.each(Data(element).transformCache, function(transformName) { 14350 transformValue = Data(element).transformCache[transformName]; 14351 14352 /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */ 14353 if (transformName === "transformPerspective") { 14354 perspective = transformValue; 14355 return true; 14356 } 14357 14358 /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ 14359 if (IE === 9 && transformName === "rotateZ") { 14360 transformName = "rotate"; 14361 } 14362 14363 transformString += transformName + transformValue + " "; 14364 }); 14365 14366 /* If present, set the perspective subproperty first. */ 14367 if (perspective) { 14368 transformString = "perspective" + perspective + " " + transformString; 14369 } 14370 } 14371 14372 CSS.setPropertyValue(element, "transform", transformString); 14373 } 14374 }; 14375 14376 /* Register hooks and normalizations. */ 14377 CSS.Hooks.register(); 14378 CSS.Normalizations.register(); 14379 14380 /* Allow hook setting in the same fashion as jQuery's $.css(). */ 14381 Velocity.hook = function(elements, arg2, arg3) { 14382 var value; 14383 14384 elements = sanitizeElements(elements); 14385 14386 $.each(elements, function(i, element) { 14387 /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ 14388 if (Data(element) === undefined) { 14389 Velocity.init(element); 14390 } 14391 14392 /* Get property value. If an element set was passed in, only return the value for the first element. */ 14393 if (arg3 === undefined) { 14394 if (value === undefined) { 14395 value = CSS.getPropertyValue(element, arg2); 14396 } 14397 /* Set property value. */ 14398 } else { 14399 /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ 14400 var adjustedSet = CSS.setPropertyValue(element, arg2, arg3); 14401 14402 /* Transform properties don't automatically set. They have to be flushed to the DOM. */ 14403 if (adjustedSet[0] === "transform") { 14404 Velocity.CSS.flushTransformCache(element); 14405 } 14406 14407 value = adjustedSet; 14408 } 14409 }); 14410 14411 return value; 14412 }; 14413 14414 /***************** 14415 Animation 14416 *****************/ 14417 14418 var animate = function() { 14419 var opts; 14420 14421 /****************** 14422 Call Chain 14423 ******************/ 14424 14425 /* Logic for determining what to return to the call stack when exiting out of Velocity. */ 14426 function getChain() { 14427 /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected, 14428 default to null instead of returning the targeted elements so that utility function's return value is standardized. */ 14429 if (isUtility) { 14430 return promiseData.promise || null; 14431 /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */ 14432 } else { 14433 return elementsWrapped; 14434 } 14435 } 14436 14437 /************************* 14438 Arguments Assignment 14439 *************************/ 14440 14441 /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "elements" (or "e"), "properties" (or "p"), and "options" (or "o") 14442 objects are defined on a container object that's passed in as Velocity's sole argument. */ 14443 /* Note: Some browsers automatically populate arguments with a "properties" object. We detect it by checking for its default "names" property. */ 14444 var syntacticSugar = (arguments[0] && (arguments[0].p || (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties)))), 14445 /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ 14446 isUtility, 14447 /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly 14448 passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ 14449 elementsWrapped, 14450 argumentIndex; 14451 14452 var elements, 14453 propertiesMap, 14454 options; 14455 14456 /* Detect jQuery/Zepto elements being animated via the $.fn method. */ 14457 if (Type.isWrapped(this)) { 14458 isUtility = false; 14459 14460 argumentIndex = 0; 14461 elements = this; 14462 elementsWrapped = this; 14463 /* Otherwise, raw elements are being animated via the utility function. */ 14464 } else { 14465 isUtility = true; 14466 14467 argumentIndex = 1; 14468 elements = syntacticSugar ? (arguments[0].elements || arguments[0].e) : arguments[0]; 14469 } 14470 14471 /*************** 14472 Promises 14473 ***************/ 14474 14475 var promiseData = { 14476 promise: null, 14477 resolver: null, 14478 rejecter: null 14479 }; 14480 14481 /* 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 14482 promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve 14483 method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated 14484 call cleanup and promise resolving logic. The reject method is used when an invalid set of arguments is passed into a Velocity call. */ 14485 /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that 14486 triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are 14487 grouped together for the purposes of resolving and rejecting a promise. */ 14488 if (isUtility && Velocity.Promise) { 14489 promiseData.promise = new Velocity.Promise(function(resolve, reject) { 14490 promiseData.resolver = resolve; 14491 promiseData.rejecter = reject; 14492 }); 14493 } 14494 14495 if (syntacticSugar) { 14496 propertiesMap = arguments[0].properties || arguments[0].p; 14497 options = arguments[0].options || arguments[0].o; 14498 } else { 14499 propertiesMap = arguments[argumentIndex]; 14500 options = arguments[argumentIndex + 1]; 14501 } 14502 14503 elements = sanitizeElements(elements); 14504 14505 if (!elements) { 14506 if (promiseData.promise) { 14507 if (!propertiesMap || !options || options.promiseRejectEmpty !== false) { 14508 promiseData.rejecter(); 14509 } else { 14510 promiseData.resolver(); 14511 } 14512 } 14513 return; 14514 } 14515 14516 /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a 14517 single raw DOM element is passed in (which doesn't contain a length property). */ 14518 var elementsLength = elements.length, 14519 elementsIndex = 0; 14520 14521 /*************************** 14522 Argument Overloading 14523 ***************************/ 14524 14525 /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). 14526 Overloading is detected by checking for the absence of an object being passed into options. */ 14527 /* Note: The stop/finish/pause/resume actions do not accept animation options, and are therefore excluded from this check. */ 14528 if (!/^(stop|finish|finishAll|pause|resume)$/i.test(propertiesMap) && !$.isPlainObject(options)) { 14529 /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ 14530 var startingArgumentPosition = argumentIndex + 1; 14531 14532 options = {}; 14533 14534 /* Iterate through all options arguments */ 14535 for (var i = startingArgumentPosition; i < arguments.length; i++) { 14536 /* Treat a number as a duration. Parse it out. */ 14537 /* Note: The following RegEx will return true if passed an array with a number as its first item. 14538 Thus, arrays are skipped from this check. */ 14539 if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\d/.test(arguments[i]))) { 14540 options.duration = arguments[i]; 14541 /* Treat strings and arrays as easings. */ 14542 } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) { 14543 options.easing = arguments[i]; 14544 /* Treat a function as a complete callback. */ 14545 } else if (Type.isFunction(arguments[i])) { 14546 options.complete = arguments[i]; 14547 } 14548 } 14549 } 14550 14551 /********************* 14552 Action Detection 14553 *********************/ 14554 14555 /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, 14556 or they can be started, stopped, paused, resumed, or reversed . If a literal or referenced properties map is passed in as Velocity's 14557 first argument, the associated action is "start". Alternatively, "scroll", "reverse", "pause", "resume" or "stop" can be passed in 14558 instead of a properties map. */ 14559 var action; 14560 14561 switch (propertiesMap) { 14562 case "scroll": 14563 action = "scroll"; 14564 break; 14565 14566 case "reverse": 14567 action = "reverse"; 14568 break; 14569 14570 case "pause": 14571 14572 /******************* 14573 Action: Pause 14574 *******************/ 14575 14576 var currentTime = (new Date()).getTime(); 14577 14578 /* Handle delay timers */ 14579 $.each(elements, function(i, element) { 14580 pauseDelayOnElement(element, currentTime); 14581 }); 14582 14583 /* Pause and Resume are call-wide (not on a per element basis). Thus, calling pause or resume on a 14584 single element will cause any calls that containt tweens for that element to be paused/resumed 14585 as well. */ 14586 14587 /* Iterate through all calls and pause any that contain any of our elements */ 14588 $.each(Velocity.State.calls, function(i, activeCall) { 14589 14590 var found = false; 14591 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 14592 if (activeCall) { 14593 /* Iterate through the active call's targeted elements. */ 14594 $.each(activeCall[1], function(k, activeElement) { 14595 var queueName = (options === undefined) ? "" : options; 14596 14597 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 14598 return true; 14599 } 14600 14601 /* Iterate through the calls targeted by the stop command. */ 14602 $.each(elements, function(l, element) { 14603 /* Check that this call was applied to the target element. */ 14604 if (element === activeElement) { 14605 14606 /* Set call to paused */ 14607 activeCall[5] = { 14608 resume: false 14609 }; 14610 14611 /* Once we match an element, we can bounce out to the next call entirely */ 14612 found = true; 14613 return false; 14614 } 14615 }); 14616 14617 /* Proceed to check next call if we have already matched */ 14618 if (found) { 14619 return false; 14620 } 14621 }); 14622 } 14623 14624 }); 14625 14626 /* Since pause creates no new tweens, exit out of Velocity. */ 14627 return getChain(); 14628 14629 case "resume": 14630 14631 /******************* 14632 Action: Resume 14633 *******************/ 14634 14635 /* Handle delay timers */ 14636 $.each(elements, function(i, element) { 14637 resumeDelayOnElement(element, currentTime); 14638 }); 14639 14640 /* Pause and Resume are call-wide (not on a per elemnt basis). Thus, calling pause or resume on a 14641 single element will cause any calls that containt tweens for that element to be paused/resumed 14642 as well. */ 14643 14644 /* Iterate through all calls and pause any that contain any of our elements */ 14645 $.each(Velocity.State.calls, function(i, activeCall) { 14646 var found = false; 14647 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 14648 if (activeCall) { 14649 /* Iterate through the active call's targeted elements. */ 14650 $.each(activeCall[1], function(k, activeElement) { 14651 var queueName = (options === undefined) ? "" : options; 14652 14653 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 14654 return true; 14655 } 14656 14657 /* Skip any calls that have never been paused */ 14658 if (!activeCall[5]) { 14659 return true; 14660 } 14661 14662 /* Iterate through the calls targeted by the stop command. */ 14663 $.each(elements, function(l, element) { 14664 /* Check that this call was applied to the target element. */ 14665 if (element === activeElement) { 14666 14667 /* Flag a pause object to be resumed, which will occur during the next tick. In 14668 addition, the pause object will at that time be deleted */ 14669 activeCall[5].resume = true; 14670 14671 /* Once we match an element, we can bounce out to the next call entirely */ 14672 found = true; 14673 return false; 14674 } 14675 }); 14676 14677 /* Proceed to check next call if we have already matched */ 14678 if (found) { 14679 return false; 14680 } 14681 }); 14682 } 14683 14684 }); 14685 14686 /* Since resume creates no new tweens, exit out of Velocity. */ 14687 return getChain(); 14688 14689 case "finish": 14690 case "finishAll": 14691 case "stop": 14692 /******************* 14693 Action: Stop 14694 *******************/ 14695 14696 /* Clear the currently-active delay on each targeted element. */ 14697 $.each(elements, function(i, element) { 14698 if (Data(element) && Data(element).delayTimer) { 14699 /* Stop the timer from triggering its cached next() function. */ 14700 clearTimeout(Data(element).delayTimer.setTimeout); 14701 14702 /* Manually call the next() function so that the subsequent queue items can progress. */ 14703 if (Data(element).delayTimer.next) { 14704 Data(element).delayTimer.next(); 14705 } 14706 14707 delete Data(element).delayTimer; 14708 } 14709 14710 /* If we want to finish everything in the queue, we have to iterate through it 14711 and call each function. This will make them active calls below, which will 14712 cause them to be applied via the duration setting. */ 14713 if (propertiesMap === "finishAll" && (options === true || Type.isString(options))) { 14714 /* Iterate through the items in the element's queue. */ 14715 $.each($.queue(element, Type.isString(options) ? options : ""), function(_, item) { 14716 /* The queue array can contain an "inprogress" string, which we skip. */ 14717 if (Type.isFunction(item)) { 14718 item(); 14719 } 14720 }); 14721 14722 /* Clearing the $.queue() array is achieved by resetting it to []. */ 14723 $.queue(element, Type.isString(options) ? options : "", []); 14724 } 14725 }); 14726 14727 var callsToStop = []; 14728 14729 /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have 14730 been applied to multiple elements, in which case all of the call's elements will be stopped. When an element 14731 is stopped, the next item in its animation queue is immediately triggered. */ 14732 /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) 14733 or a custom queue string can be passed in. */ 14734 /* Note: The stop command runs prior to Velocity's Queueing phase since its behavior is intended to take effect *immediately*, 14735 regardless of the element's current queue state. */ 14736 14737 /* Iterate through every active call. */ 14738 $.each(Velocity.State.calls, function(i, activeCall) { 14739 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 14740 if (activeCall) { 14741 /* Iterate through the active call's targeted elements. */ 14742 $.each(activeCall[1], function(k, activeElement) { 14743 /* If true was passed in as a secondary argument, clear absolutely all calls on this element. Otherwise, only 14744 clear calls associated with the relevant queue. */ 14745 /* Call stopping logic works as follows: 14746 - options === true --> stop current default queue calls (and queue:false calls), including remaining queued ones. 14747 - options === undefined --> stop current queue:"" call and all queue:false calls. 14748 - options === false --> stop only queue:false calls. 14749 - options === "custom" --> stop current queue:"custom" call, including remaining queued ones (there is no functionality to only clear the currently-running queue:"custom" call). */ 14750 var queueName = (options === undefined) ? "" : options; 14751 14752 if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) { 14753 return true; 14754 } 14755 14756 /* Iterate through the calls targeted by the stop command. */ 14757 $.each(elements, function(l, element) { 14758 /* Check that this call was applied to the target element. */ 14759 if (element === activeElement) { 14760 /* Optionally clear the remaining queued calls. If we're doing "finishAll" this won't find anything, 14761 due to the queue-clearing above. */ 14762 if (options === true || Type.isString(options)) { 14763 /* Iterate through the items in the element's queue. */ 14764 $.each($.queue(element, Type.isString(options) ? options : ""), function(_, item) { 14765 /* The queue array can contain an "inprogress" string, which we skip. */ 14766 if (Type.isFunction(item)) { 14767 /* Pass the item's callback a flag indicating that we want to abort from the queue call. 14768 (Specifically, the queue will resolve the call's associated promise then abort.) */ 14769 item(null, true); 14770 } 14771 }); 14772 14773 /* Clearing the $.queue() array is achieved by resetting it to []. */ 14774 $.queue(element, Type.isString(options) ? options : "", []); 14775 } 14776 14777 if (propertiesMap === "stop") { 14778 /* Since "reverse" uses cached start values (the previous call's endValues), these values must be 14779 changed to reflect the final value that the elements were actually tweened to. */ 14780 /* Note: If only queue:false/queue:"custom" animations are currently running on an element, it won't have a tweensContainer 14781 object. Also, queue:false/queue:"custom" animations can't be reversed. */ 14782 var data = Data(element); 14783 if (data && data.tweensContainer && (queueName === true || queueName === "")) { 14784 $.each(data.tweensContainer, function(m, activeTween) { 14785 activeTween.endValue = activeTween.currentValue; 14786 }); 14787 } 14788 14789 callsToStop.push(i); 14790 } else if (propertiesMap === "finish" || propertiesMap === "finishAll") { 14791 /* To get active tweens to finish immediately, we forcefully shorten their durations to 1ms so that 14792 they finish upon the next rAf tick then proceed with normal call completion logic. */ 14793 activeCall[2].duration = 1; 14794 } 14795 } 14796 }); 14797 }); 14798 } 14799 }); 14800 14801 /* Prematurely call completeCall() on each matched active call. Pass an additional flag for "stop" to indicate 14802 that the complete callback and display:none setting should be skipped since we're completing prematurely. */ 14803 if (propertiesMap === "stop") { 14804 $.each(callsToStop, function(i, j) { 14805 completeCall(j, true); 14806 }); 14807 14808 if (promiseData.promise) { 14809 /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */ 14810 promiseData.resolver(elements); 14811 } 14812 } 14813 14814 /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */ 14815 return getChain(); 14816 14817 default: 14818 /* Treat a non-empty plain object as a literal properties map. */ 14819 if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) { 14820 action = "start"; 14821 14822 /**************** 14823 Redirects 14824 ****************/ 14825 14826 /* Check if a string matches a registered redirect (see Redirects above). */ 14827 } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) { 14828 opts = $.extend({}, options); 14829 14830 var durationOriginal = opts.duration, 14831 delayOriginal = opts.delay || 0; 14832 14833 /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */ 14834 if (opts.backwards === true) { 14835 elements = $.extend(true, [], elements).reverse(); 14836 } 14837 14838 /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */ 14839 $.each(elements, function(elementIndex, element) { 14840 /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */ 14841 if (parseFloat(opts.stagger)) { 14842 opts.delay = delayOriginal + (parseFloat(opts.stagger) * elementIndex); 14843 } else if (Type.isFunction(opts.stagger)) { 14844 opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength); 14845 } 14846 14847 /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards) 14848 the duration of each element's animation, using floors to prevent producing very short durations. */ 14849 if (opts.drag) { 14850 /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ 14851 opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); 14852 14853 /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, 14854 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). 14855 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. */ 14856 opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex / elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200); 14857 } 14858 14859 /* 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 14860 reduce the opts checking logic required inside the redirect. */ 14861 Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined); 14862 }); 14863 14864 /* Since the animation logic resides within the redirect's own code, abort the remainder of this call. 14865 (The performance overhead up to this point is virtually non-existant.) */ 14866 /* Note: The jQuery call chain is kept intact by returning the complete element set. */ 14867 return getChain(); 14868 } else { 14869 var abortError = "Velocity: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."; 14870 14871 if (promiseData.promise) { 14872 promiseData.rejecter(new Error(abortError)); 14873 } else if (window.console) { 14874 console.log(abortError); 14875 } 14876 14877 return getChain(); 14878 } 14879 } 14880 14881 /************************** 14882 Call-Wide Variables 14883 **************************/ 14884 14885 /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements 14886 being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore 14887 avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale 14888 conversion metrics across Velocity animations that are not immediately consecutively chained. */ 14889 var callUnitConversionData = { 14890 lastParent: null, 14891 lastPosition: null, 14892 lastFontSize: null, 14893 lastPercentToPxWidth: null, 14894 lastPercentToPxHeight: null, 14895 lastEmToPx: null, 14896 remToPx: null, 14897 vwToPx: null, 14898 vhToPx: null 14899 }; 14900 14901 /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide 14902 Velocity.State.calls array that is processed during animation ticking. */ 14903 var call = []; 14904 14905 /************************ 14906 Element Processing 14907 ************************/ 14908 14909 /* 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): 14910 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. 14911 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. 14912 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 14913 `elementArrayIndex` allows passing index of the element in the original array to value functions. 14914 If `elementsIndex` were used instead the index would be determined by the elements' per-element queue. 14915 */ 14916 function processElement(element, elementArrayIndex) { 14917 14918 /************************* 14919 Part I: Pre-Queueing 14920 *************************/ 14921 14922 /*************************** 14923 Element-Wide Variables 14924 ***************************/ 14925 14926 var /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ 14927 opts = $.extend({}, Velocity.defaults, options), 14928 /* A container for the processed data associated with each property in the propertyMap. 14929 (Each property in the map produces its own "tween".) */ 14930 tweensContainer = {}, 14931 elementUnitConversionData; 14932 14933 /****************** 14934 Element Init 14935 ******************/ 14936 14937 if (Data(element) === undefined) { 14938 Velocity.init(element); 14939 } 14940 14941 /****************** 14942 Option: Delay 14943 ******************/ 14944 14945 /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ 14946 /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() 14947 (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ 14948 if (parseFloat(opts.delay) && opts.queue !== false) { 14949 $.queue(element, opts.queue, function(next, clearQueue) { 14950 if (clearQueue === true) { 14951 /* Do not continue with animation queueing. */ 14952 return true; 14953 } 14954 14955 /* 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. */ 14956 Velocity.velocityQueueEntryFlag = true; 14957 14958 /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. 14959 The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's "stop" command, and 14960 delayBegin/delayTime is used to ensure we can "pause" and "resume" a tween that is still mid-delay. */ 14961 14962 /* Temporarily store delayed elements to facilite access for global pause/resume */ 14963 var callIndex = Velocity.State.delayedElements.count++; 14964 Velocity.State.delayedElements[callIndex] = element; 14965 14966 var delayComplete = (function(index) { 14967 return function() { 14968 /* Clear the temporary element */ 14969 Velocity.State.delayedElements[index] = false; 14970 14971 /* Finally, issue the call */ 14972 next(); 14973 }; 14974 })(callIndex); 14975 14976 14977 Data(element).delayBegin = (new Date()).getTime(); 14978 Data(element).delay = parseFloat(opts.delay); 14979 Data(element).delayTimer = { 14980 setTimeout: setTimeout(next, parseFloat(opts.delay)), 14981 next: delayComplete 14982 }; 14983 }); 14984 } 14985 14986 /********************* 14987 Option: Duration 14988 *********************/ 14989 14990 /* Support for jQuery's named durations. */ 14991 switch (opts.duration.toString().toLowerCase()) { 14992 case "fast": 14993 opts.duration = 200; 14994 break; 14995 14996 case "normal": 14997 opts.duration = DURATION_DEFAULT; 14998 break; 14999 15000 case "slow": 15001 opts.duration = 600; 15002 break; 15003 15004 default: 15005 /* 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). */ 15006 opts.duration = parseFloat(opts.duration) || 1; 15007 } 15008 15009 /************************ 15010 Global Option: Mock 15011 ************************/ 15012 15013 if (Velocity.mock !== false) { 15014 /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick. 15015 Alternatively, a multiplier can be passed in to time remap all delays and durations. */ 15016 if (Velocity.mock === true) { 15017 opts.duration = opts.delay = 1; 15018 } else { 15019 opts.duration *= parseFloat(Velocity.mock) || 1; 15020 opts.delay *= parseFloat(Velocity.mock) || 1; 15021 } 15022 } 15023 15024 /******************* 15025 Option: Easing 15026 *******************/ 15027 15028 opts.easing = getEasing(opts.easing, opts.duration); 15029 15030 /********************** 15031 Option: Callbacks 15032 **********************/ 15033 15034 /* Callbacks must functions. Otherwise, default to null. */ 15035 if (opts.begin && !Type.isFunction(opts.begin)) { 15036 opts.begin = null; 15037 } 15038 15039 if (opts.progress && !Type.isFunction(opts.progress)) { 15040 opts.progress = null; 15041 } 15042 15043 if (opts.complete && !Type.isFunction(opts.complete)) { 15044 opts.complete = null; 15045 } 15046 15047 /********************************* 15048 Option: Display & Visibility 15049 *********************************/ 15050 15051 /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ 15052 /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ 15053 if (opts.display !== undefined && opts.display !== null) { 15054 opts.display = opts.display.toString().toLowerCase(); 15055 15056 /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ 15057 if (opts.display === "auto") { 15058 opts.display = Velocity.CSS.Values.getDisplayType(element); 15059 } 15060 } 15061 15062 if (opts.visibility !== undefined && opts.visibility !== null) { 15063 opts.visibility = opts.visibility.toString().toLowerCase(); 15064 } 15065 15066 /********************** 15067 Option: mobileHA 15068 **********************/ 15069 15070 /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) 15071 on animating elements. HA is removed from the element at the completion of its animation. */ 15072 /* 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. */ 15073 /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ 15074 opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread); 15075 15076 /*********************** 15077 Part II: Queueing 15078 ***********************/ 15079 15080 /* 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. 15081 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. */ 15082 /* 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, 15083 the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ 15084 function buildQueue(next) { 15085 var data, lastTweensContainer; 15086 15087 /******************* 15088 Option: Begin 15089 *******************/ 15090 15091 /* 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. */ 15092 if (opts.begin && elementsIndex === 0) { 15093 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 15094 try { 15095 opts.begin.call(elements, elements); 15096 } catch (error) { 15097 setTimeout(function() { 15098 throw error; 15099 }, 1); 15100 } 15101 } 15102 15103 /***************************************** 15104 Tween Data Construction (for Scroll) 15105 *****************************************/ 15106 15107 /* 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. */ 15108 if (action === "scroll") { 15109 /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ 15110 var scrollDirection = (/^x$/i.test(opts.axis) ? "Left" : "Top"), 15111 scrollOffset = parseFloat(opts.offset) || 0, 15112 scrollPositionCurrent, 15113 scrollPositionCurrentAlternate, 15114 scrollPositionEnd; 15115 15116 /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- 15117 as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ 15118 if (opts.container) { 15119 /* Ensure that either a jQuery object or a raw DOM element was passed in. */ 15120 if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) { 15121 /* Extract the raw DOM element from the jQuery wrapper. */ 15122 opts.container = opts.container[0] || opts.container; 15123 /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes 15124 (due to the user's natural interaction with the page). */ 15125 scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ 15126 15127 /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions 15128 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* 15129 the scroll container's current scroll position. */ 15130 scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset; /* GET */ 15131 /* 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. */ 15132 } else { 15133 opts.container = null; 15134 } 15135 } else { 15136 /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using 15137 the appropriate cached property names (which differ based on browser type). */ 15138 scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ 15139 /* 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. */ 15140 scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ 15141 15142 /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- 15143 and therefore end values do not need to be compounded onto current values. */ 15144 scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 15145 } 15146 15147 /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ 15148 tweensContainer = { 15149 scroll: { 15150 rootPropertyValue: false, 15151 startValue: scrollPositionCurrent, 15152 currentValue: scrollPositionCurrent, 15153 endValue: scrollPositionEnd, 15154 unitType: "", 15155 easing: opts.easing, 15156 scrollData: { 15157 container: opts.container, 15158 direction: scrollDirection, 15159 alternateValue: scrollPositionCurrentAlternate 15160 } 15161 }, 15162 element: element 15163 }; 15164 15165 if (Velocity.debug) { 15166 console.log("tweensContainer (scroll): ", tweensContainer.scroll, element); 15167 } 15168 15169 /****************************************** 15170 Tween Data Construction (for Reverse) 15171 ******************************************/ 15172 15173 /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is 15174 that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate 15175 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. */ 15176 /* 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.) */ 15177 /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; 15178 there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined 15179 as reverting to the element's values as they were prior to the previous *Velocity* call. */ 15180 } else if (action === "reverse") { 15181 data = Data(element); 15182 15183 /* Abort if there is no prior animation data to reverse to. */ 15184 if (!data) { 15185 return; 15186 } 15187 15188 if (!data.tweensContainer) { 15189 /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ 15190 $.dequeue(element, opts.queue); 15191 15192 return; 15193 } else { 15194 /********************* 15195 Options Parsing 15196 *********************/ 15197 15198 /* If the element was hidden via the display option in the previous call, 15199 revert display to "auto" prior to reversal so that the element is visible again. */ 15200 if (data.opts.display === "none") { 15201 data.opts.display = "auto"; 15202 } 15203 15204 if (data.opts.visibility === "hidden") { 15205 data.opts.visibility = "visible"; 15206 } 15207 15208 /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. 15209 Further, remove the previous call's callback options; typically, users do not want these to be refired. */ 15210 data.opts.loop = false; 15211 data.opts.begin = null; 15212 data.opts.complete = null; 15213 15214 /* Since we're extending an opts object that has already been extended with the defaults options object, 15215 we remove non-explicitly-defined properties that are auto-assigned values. */ 15216 if (!options.easing) { 15217 delete opts.easing; 15218 } 15219 15220 if (!options.duration) { 15221 delete opts.duration; 15222 } 15223 15224 /* The opts object used for reversal is an extension of the options object optionally passed into this 15225 reverse call plus the options used in the previous Velocity call. */ 15226 opts = $.extend({}, data.opts, opts); 15227 15228 /************************************* 15229 Tweens Container Reconstruction 15230 *************************************/ 15231 15232 /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ 15233 lastTweensContainer = $.extend(true, {}, data ? data.tweensContainer : null); 15234 15235 /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ 15236 for (var lastTween in lastTweensContainer) { 15237 /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ 15238 if (lastTweensContainer.hasOwnProperty(lastTween) && lastTween !== "element") { 15239 var lastStartValue = lastTweensContainer[lastTween].startValue; 15240 15241 lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; 15242 lastTweensContainer[lastTween].endValue = lastStartValue; 15243 15244 /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). 15245 Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. 15246 The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ 15247 if (!Type.isEmptyObject(options)) { 15248 lastTweensContainer[lastTween].easing = opts.easing; 15249 } 15250 15251 if (Velocity.debug) { 15252 console.log("reverse tweensContainer (" + lastTween + "): " + JSON.stringify(lastTweensContainer[lastTween]), element); 15253 } 15254 } 15255 } 15256 15257 tweensContainer = lastTweensContainer; 15258 } 15259 15260 /***************************************** 15261 Tween Data Construction (for Start) 15262 *****************************************/ 15263 15264 } else if (action === "start") { 15265 15266 /************************* 15267 Value Transferring 15268 *************************/ 15269 15270 /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created 15271 while the element was in the process of being animated by Velocity, then this current call is safe to use 15272 the end values from the prior call as its start values. Velocity attempts to perform this value transfer 15273 process whenever possible in order to avoid requerying the DOM. */ 15274 /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), 15275 then the DOM is queried for the element's current values as a last resort. */ 15276 /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ 15277 15278 data = Data(element); 15279 15280 /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) 15281 to transfer over end values to use as start values. If it's set to true and there is a previous 15282 Velocity call to pull values from, do so. */ 15283 if (data && data.tweensContainer && data.isAnimating === true) { 15284 lastTweensContainer = data.tweensContainer; 15285 } 15286 15287 /*************************** 15288 Tween Data Calculation 15289 ***************************/ 15290 15291 /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ 15292 /* Property map values can either take the form of 1) a single value representing the end value, 15293 or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. 15294 The optional third parameter is a forcefed startValue to be used instead of querying the DOM for 15295 the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ 15296 var parsePropertyValue = function(valueData, skipResolvingEasing) { 15297 var endValue, easing, startValue; 15298 15299 /* If we have a function as the main argument then resolve it first, in case it returns an array that needs to be split */ 15300 if (Type.isFunction(valueData)) { 15301 valueData = valueData.call(element, elementArrayIndex, elementsLength); 15302 } 15303 15304 /* Handle the array format, which can be structured as one of three potential overloads: 15305 A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ 15306 if (Type.isArray(valueData)) { 15307 /* endValue is always the first item in the array. Don't bother validating endValue's value now 15308 since the ensuing property cycling logic does that. */ 15309 endValue = valueData[0]; 15310 15311 /* Two-item array format: If the second item is a number, function, or hex string, treat it as a 15312 start value since easings can only be non-hex strings or arrays. */ 15313 if ((!Type.isArray(valueData[1]) && /^[\d-]/.test(valueData[1])) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) { 15314 startValue = valueData[1]; 15315 /* Two or three-item array: If the second item is a non-hex string easing name or an array, treat it as an easing. */ 15316 } else if ((Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1]) && Velocity.Easings[valueData[1]]) || Type.isArray(valueData[1])) { 15317 easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration); 15318 15319 /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ 15320 startValue = valueData[2]; 15321 } else { 15322 startValue = valueData[1] || valueData[2]; 15323 } 15324 /* Handle the single-value format. */ 15325 } else { 15326 endValue = valueData; 15327 } 15328 15329 /* Default to the call's easing if a per-property easing type was not defined. */ 15330 if (!skipResolvingEasing) { 15331 easing = easing || opts.easing; 15332 } 15333 15334 /* If functions were passed in as values, pass the function the current element as its context, 15335 plus the element's index and the element set's size as arguments. Then, assign the returned value. */ 15336 if (Type.isFunction(endValue)) { 15337 endValue = endValue.call(element, elementArrayIndex, elementsLength); 15338 } 15339 15340 if (Type.isFunction(startValue)) { 15341 startValue = startValue.call(element, elementArrayIndex, elementsLength); 15342 } 15343 15344 /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ 15345 return [endValue || 0, easing, startValue]; 15346 }; 15347 15348 var fixPropertyValue = function(property, valueData) { 15349 /* 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. */ 15350 var rootProperty = CSS.Hooks.getRoot(property), 15351 rootPropertyValue = false, 15352 /* Parse out endValue, easing, and startValue from the property's data. */ 15353 endValue = valueData[0], 15354 easing = valueData[1], 15355 startValue = valueData[2], 15356 pattern; 15357 15358 /************************** 15359 Start Value Sourcing 15360 **************************/ 15361 15362 /* Other than for the dummy tween property, properties that are not supported by the browser (and do not have an associated normalization) will 15363 inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. 15364 Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ 15365 /* Note: Since SVG elements have some of their properties directly applied as HTML attributes, 15366 there is no way to check for their explicit browser support, and so we skip skip this check for them. */ 15367 if ((!data || !data.isSVG) && rootProperty !== "tween" && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { 15368 if (Velocity.debug) { 15369 console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); 15370 } 15371 return; 15372 } 15373 15374 /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being 15375 animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity 15376 a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ 15377 if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility !== undefined && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { 15378 startValue = 0; 15379 } 15380 15381 /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue 15382 for all of the current call's properties that were *also* animated in the previous call. */ 15383 /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ 15384 if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { 15385 if (startValue === undefined) { 15386 startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; 15387 } 15388 15389 /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the 15390 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue 15391 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ 15392 rootPropertyValue = data.rootPropertyValueCache[rootProperty]; 15393 /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ 15394 } else { 15395 /* Handle hooked properties. */ 15396 if (CSS.Hooks.registered[property]) { 15397 if (startValue === undefined) { 15398 rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ 15399 /* Note: The following getPropertyValue() call does not actually trigger a DOM query; 15400 getPropertyValue() will extract the hook from rootPropertyValue. */ 15401 startValue = CSS.getPropertyValue(element, property, rootPropertyValue); 15402 /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; 15403 just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual 15404 root property value (if one is set), but this is acceptable since the primary reason users forcefeed is 15405 to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ 15406 } else { 15407 /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ 15408 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 15409 } 15410 /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ 15411 } else if (startValue === undefined) { 15412 startValue = CSS.getPropertyValue(element, property); /* GET */ 15413 } 15414 } 15415 15416 /************************** 15417 Value Data Extraction 15418 **************************/ 15419 15420 var separatedValue, 15421 endValueUnitType, 15422 startValueUnitType, 15423 operator = false; 15424 15425 /* Separates a property value into its numeric value and its unit type. */ 15426 var separateValue = function(property, value) { 15427 var unitType, 15428 numericValue; 15429 15430 numericValue = (value || "0") 15431 .toString() 15432 .toLowerCase() 15433 /* Match the unit type at the end of the value. */ 15434 .replace(/[%A-z]+$/, function(match) { 15435 /* Grab the unit type. */ 15436 unitType = match; 15437 15438 /* Strip the unit type off of value. */ 15439 return ""; 15440 }); 15441 15442 /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ 15443 if (!unitType) { 15444 unitType = CSS.Values.getUnitType(property); 15445 } 15446 15447 return [numericValue, unitType]; 15448 }; 15449 15450 if (startValue !== endValue && Type.isString(startValue) && Type.isString(endValue)) { 15451 pattern = ""; 15452 var iStart = 0, // index in startValue 15453 iEnd = 0, // index in endValue 15454 aStart = [], // array of startValue numbers 15455 aEnd = [], // array of endValue numbers 15456 inCalc = 0, // Keep track of being inside a "calc()" so we don't duplicate it 15457 inRGB = 0, // Keep track of being inside an RGB as we can't use fractional values 15458 inRGBA = 0; // Keep track of being inside an RGBA as we must pass fractional for the alpha channel 15459 15460 startValue = CSS.Hooks.fixColors(startValue); 15461 endValue = CSS.Hooks.fixColors(endValue); 15462 while (iStart < startValue.length && iEnd < endValue.length) { 15463 var cStart = startValue[iStart], 15464 cEnd = endValue[iEnd]; 15465 15466 if (/[\d\.-]/.test(cStart) && /[\d\.-]/.test(cEnd)) { 15467 var tStart = cStart, // temporary character buffer 15468 tEnd = cEnd, // temporary character buffer 15469 dotStart = ".", // Make sure we can only ever match a single dot in a decimal 15470 dotEnd = "."; // Make sure we can only ever match a single dot in a decimal 15471 15472 while (++iStart < startValue.length) { 15473 cStart = startValue[iStart]; 15474 if (cStart === dotStart) { 15475 dotStart = ".."; // Can never match two characters 15476 } else if (!/\d/.test(cStart)) { 15477 break; 15478 } 15479 tStart += cStart; 15480 } 15481 while (++iEnd < endValue.length) { 15482 cEnd = endValue[iEnd]; 15483 if (cEnd === dotEnd) { 15484 dotEnd = ".."; // Can never match two characters 15485 } else if (!/\d/.test(cEnd)) { 15486 break; 15487 } 15488 tEnd += cEnd; 15489 } 15490 var uStart = CSS.Hooks.getUnit(startValue, iStart), // temporary unit type 15491 uEnd = CSS.Hooks.getUnit(endValue, iEnd); // temporary unit type 15492 15493 iStart += uStart.length; 15494 iEnd += uEnd.length; 15495 if (uStart === uEnd) { 15496 // Same units 15497 if (tStart === tEnd) { 15498 // Same numbers, so just copy over 15499 pattern += tStart + uStart; 15500 } else { 15501 // Different numbers, so store them 15502 pattern += "{" + aStart.length + (inRGB ? "!" : "") + "}" + uStart; 15503 aStart.push(parseFloat(tStart)); 15504 aEnd.push(parseFloat(tEnd)); 15505 } 15506 } else { 15507 // Different units, so put into a "calc(from + to)" and animate each side to/from zero 15508 var nStart = parseFloat(tStart), 15509 nEnd = parseFloat(tEnd); 15510 15511 pattern += (inCalc < 5 ? "calc" : "") + "(" 15512 + (nStart ? "{" + aStart.length + (inRGB ? "!" : "") + "}" : "0") + uStart 15513 + " + " 15514 + (nEnd ? "{" + (aStart.length + (nStart ? 1 : 0)) + (inRGB ? "!" : "") + "}" : "0") + uEnd 15515 + ")"; 15516 if (nStart) { 15517 aStart.push(nStart); 15518 aEnd.push(0); 15519 } 15520 if (nEnd) { 15521 aStart.push(0); 15522 aEnd.push(nEnd); 15523 } 15524 } 15525 } else if (cStart === cEnd) { 15526 pattern += cStart; 15527 iStart++; 15528 iEnd++; 15529 // Keep track of being inside a calc() 15530 if (inCalc === 0 && cStart === "c" 15531 || inCalc === 1 && cStart === "a" 15532 || inCalc === 2 && cStart === "l" 15533 || inCalc === 3 && cStart === "c" 15534 || inCalc >= 4 && cStart === "(" 15535 ) { 15536 inCalc++; 15537 } else if ((inCalc && inCalc < 5) 15538 || inCalc >= 4 && cStart === ")" && --inCalc < 5) { 15539 inCalc = 0; 15540 } 15541 // Keep track of being inside an rgb() / rgba() 15542 if (inRGB === 0 && cStart === "r" 15543 || inRGB === 1 && cStart === "g" 15544 || inRGB === 2 && cStart === "b" 15545 || inRGB === 3 && cStart === "a" 15546 || inRGB >= 3 && cStart === "(" 15547 ) { 15548 if (inRGB === 3 && cStart === "a") { 15549 inRGBA = 1; 15550 } 15551 inRGB++; 15552 } else if (inRGBA && cStart === ",") { 15553 if (++inRGBA > 3) { 15554 inRGB = inRGBA = 0; 15555 } 15556 } else if ((inRGBA && inRGB < (inRGBA ? 5 : 4)) 15557 || inRGB >= (inRGBA ? 4 : 3) && cStart === ")" && --inRGB < (inRGBA ? 5 : 4)) { 15558 inRGB = inRGBA = 0; 15559 } 15560 } else { 15561 inCalc = 0; 15562 // TODO: changing units, fixing colours 15563 break; 15564 } 15565 } 15566 if (iStart !== startValue.length || iEnd !== endValue.length) { 15567 if (Velocity.debug) { 15568 console.error("Trying to pattern match mis-matched strings [\"" + endValue + "\", \"" + startValue + "\"]"); 15569 } 15570 pattern = undefined; 15571 } 15572 if (pattern) { 15573 if (aStart.length) { 15574 if (Velocity.debug) { 15575 console.log("Pattern found \"" + pattern + "\" -> ", aStart, aEnd, "[" + startValue + "," + endValue + "]"); 15576 } 15577 startValue = aStart; 15578 endValue = aEnd; 15579 endValueUnitType = startValueUnitType = ""; 15580 } else { 15581 pattern = undefined; 15582 } 15583 } 15584 } 15585 15586 if (!pattern) { 15587 /* Separate startValue. */ 15588 separatedValue = separateValue(property, startValue); 15589 startValue = separatedValue[0]; 15590 startValueUnitType = separatedValue[1]; 15591 15592 /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ 15593 separatedValue = separateValue(property, endValue); 15594 endValue = separatedValue[0].replace(/^([+-\/*])=/, function(match, subMatch) { 15595 operator = subMatch; 15596 15597 /* Strip the operator off of the value. */ 15598 return ""; 15599 }); 15600 endValueUnitType = separatedValue[1]; 15601 15602 /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ 15603 startValue = parseFloat(startValue) || 0; 15604 endValue = parseFloat(endValue) || 0; 15605 15606 /*************************************** 15607 Property-Specific Value Conversion 15608 ***************************************/ 15609 15610 /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ 15611 if (endValueUnitType === "%") { 15612 /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), 15613 which is identical to the em unit's behavior, so we piggyback off of that. */ 15614 if (/^(fontSize|lineHeight)$/.test(property)) { 15615 /* Convert % into an em decimal value. */ 15616 endValue = endValue / 100; 15617 endValueUnitType = "em"; 15618 /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ 15619 } else if (/^scale/.test(property)) { 15620 endValue = endValue / 100; 15621 endValueUnitType = ""; 15622 /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ 15623 } else if (/(Red|Green|Blue)$/i.test(property)) { 15624 endValue = (endValue / 100) * 255; 15625 endValueUnitType = ""; 15626 } 15627 } 15628 } 15629 15630 /*************************** 15631 Unit Ratio Calculation 15632 ***************************/ 15633 15634 /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of 15635 %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order 15636 for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred 15637 from a previous call, startValue may also not be in pixels. Unit conversion logic therefore consists of two steps: 15638 1) Calculating the ratio of %/em/rem/vh/vw relative to pixels 15639 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ 15640 /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property, 15641 setting values with the target unit type then comparing the returned pixel value. */ 15642 /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead 15643 of batching the SETs and GETs together upfront outweights the potential overhead 15644 of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ 15645 /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ 15646 var calculateUnitRatios = function() { 15647 15648 /************************ 15649 Same Ratio Checks 15650 ************************/ 15651 15652 /* The properties below are used to determine whether the element differs sufficiently from this call's 15653 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those 15654 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, 15655 this is done to minimize DOM querying. */ 15656 var sameRatioIndicators = { 15657 myParent: element.parentNode || document.body, /* GET */ 15658 position: CSS.getPropertyValue(element, "position"), /* GET */ 15659 fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ 15660 }, 15661 /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */ 15662 samePercentRatio = ((sameRatioIndicators.position === callUnitConversionData.lastPosition) && (sameRatioIndicators.myParent === callUnitConversionData.lastParent)), 15663 /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */ 15664 sameEmRatio = (sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize); 15665 15666 /* Store these ratio indicators call-wide for the next element to compare against. */ 15667 callUnitConversionData.lastParent = sameRatioIndicators.myParent; 15668 callUnitConversionData.lastPosition = sameRatioIndicators.position; 15669 callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize; 15670 15671 /*************************** 15672 Element-Specific Units 15673 ***************************/ 15674 15675 /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement 15676 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */ 15677 var measurement = 100, 15678 unitRatios = {}; 15679 15680 if (!sameEmRatio || !samePercentRatio) { 15681 var dummy = data && data.isSVG ? document.createElementNS("http://www.w3.org/2000/svg", "rect") : document.createElement("div"); 15682 15683 Velocity.init(dummy); 15684 sameRatioIndicators.myParent.appendChild(dummy); 15685 15686 /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped. 15687 Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */ 15688 /* Note: Overflow must be also be controlled for per-axis since the overflow property overwrites its per-axis values. */ 15689 $.each(["overflow", "overflowX", "overflowY"], function(i, property) { 15690 Velocity.CSS.setPropertyValue(dummy, property, "hidden"); 15691 }); 15692 Velocity.CSS.setPropertyValue(dummy, "position", sameRatioIndicators.position); 15693 Velocity.CSS.setPropertyValue(dummy, "fontSize", sameRatioIndicators.fontSize); 15694 Velocity.CSS.setPropertyValue(dummy, "boxSizing", "content-box"); 15695 15696 /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ 15697 $.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function(i, property) { 15698 Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); 15699 }); 15700 /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ 15701 Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); 15702 15703 /* 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. */ 15704 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ 15705 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, "height", null, true)) || 1) / measurement; /* GET */ 15706 unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, "paddingLeft")) || 1) / measurement; /* GET */ 15707 15708 sameRatioIndicators.myParent.removeChild(dummy); 15709 } else { 15710 unitRatios.emToPx = callUnitConversionData.lastEmToPx; 15711 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth; 15712 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight; 15713 } 15714 15715 /*************************** 15716 Element-Agnostic Units 15717 ***************************/ 15718 15719 /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked 15720 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time 15721 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null, 15722 so we calculate it now. */ 15723 if (callUnitConversionData.remToPx === null) { 15724 /* Default to browsers' default fontSize of 16px in the case of 0. */ 15725 callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ 15726 } 15727 15728 /* Similarly, viewport units are %-relative to the window's inner dimensions. */ 15729 if (callUnitConversionData.vwToPx === null) { 15730 callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100; /* GET */ 15731 callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100; /* GET */ 15732 } 15733 15734 unitRatios.remToPx = callUnitConversionData.remToPx; 15735 unitRatios.vwToPx = callUnitConversionData.vwToPx; 15736 unitRatios.vhToPx = callUnitConversionData.vhToPx; 15737 15738 if (Velocity.debug >= 1) { 15739 console.log("Unit ratios: " + JSON.stringify(unitRatios), element); 15740 } 15741 return unitRatios; 15742 }; 15743 15744 /******************** 15745 Unit Conversion 15746 ********************/ 15747 15748 /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ 15749 if (/[\/*]/.test(operator)) { 15750 endValueUnitType = startValueUnitType; 15751 /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType 15752 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depend 15753 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 15754 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ 15755 /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ 15756 } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) { 15757 /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */ 15758 /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively 15759 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility, 15760 which remains past the point of the animation's completion. */ 15761 if (endValue === 0) { 15762 endValueUnitType = startValueUnitType; 15763 } else { 15764 /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). 15765 If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ 15766 elementUnitConversionData = elementUnitConversionData || calculateUnitRatios(); 15767 15768 /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ 15769 /* 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. */ 15770 var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === "x") ? "x" : "y"; 15771 15772 /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 15773 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ 15774 switch (startValueUnitType) { 15775 case "%": 15776 /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. 15777 Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value 15778 to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ 15779 startValue *= (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 15780 break; 15781 15782 case "px": 15783 /* px acts as our midpoint in the unit conversion process; do nothing. */ 15784 break; 15785 15786 default: 15787 startValue *= elementUnitConversionData[startValueUnitType + "ToPx"]; 15788 } 15789 15790 /* Invert the px ratios to convert into to the target unit. */ 15791 switch (endValueUnitType) { 15792 case "%": 15793 startValue *= 1 / (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 15794 break; 15795 15796 case "px": 15797 /* startValue is already in px, do nothing; we're done. */ 15798 break; 15799 15800 default: 15801 startValue *= 1 / elementUnitConversionData[endValueUnitType + "ToPx"]; 15802 } 15803 } 15804 } 15805 15806 /********************* 15807 Relative Values 15808 *********************/ 15809 15810 /* Operator logic must be performed last since it requires unit-normalized start and end values. */ 15811 /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" 15812 to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 15813 50 points is added on top of the current % value. */ 15814 switch (operator) { 15815 case "+": 15816 endValue = startValue + endValue; 15817 break; 15818 15819 case "-": 15820 endValue = startValue - endValue; 15821 break; 15822 15823 case "*": 15824 endValue = startValue * endValue; 15825 break; 15826 15827 case "/": 15828 endValue = startValue / endValue; 15829 break; 15830 } 15831 15832 /************************** 15833 tweensContainer Push 15834 **************************/ 15835 15836 /* Construct the per-property tween object, and push it to the element's tweensContainer. */ 15837 tweensContainer[property] = { 15838 rootPropertyValue: rootPropertyValue, 15839 startValue: startValue, 15840 currentValue: startValue, 15841 endValue: endValue, 15842 unitType: endValueUnitType, 15843 easing: easing 15844 }; 15845 if (pattern) { 15846 tweensContainer[property].pattern = pattern; 15847 } 15848 15849 if (Velocity.debug) { 15850 console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); 15851 } 15852 }; 15853 15854 /* Create a tween out of each property, and append its associated data to tweensContainer. */ 15855 for (var property in propertiesMap) { 15856 15857 if (!propertiesMap.hasOwnProperty(property)) { 15858 continue; 15859 } 15860 /* The original property name's format must be used for the parsePropertyValue() lookup, 15861 but we then use its camelCase styling to normalize it for manipulation. */ 15862 var propertyName = CSS.Names.camelCase(property), 15863 valueData = parsePropertyValue(propertiesMap[property]); 15864 15865 /* Find shorthand color properties that have been passed a hex string. */ 15866 /* Would be quicker to use CSS.Lists.colors.includes() if possible */ 15867 if (_inArray(CSS.Lists.colors, propertyName)) { 15868 /* Parse the value data for each shorthand. */ 15869 var endValue = valueData[0], 15870 easing = valueData[1], 15871 startValue = valueData[2]; 15872 15873 if (CSS.RegEx.isHex.test(endValue)) { 15874 /* Convert the hex strings into their RGB component arrays. */ 15875 var colorComponents = ["Red", "Green", "Blue"], 15876 endValueRGB = CSS.Values.hexToRgb(endValue), 15877 startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined; 15878 15879 /* Inject the RGB component tweens into propertiesMap. */ 15880 for (var i = 0; i < colorComponents.length; i++) { 15881 var dataArray = [endValueRGB[i]]; 15882 15883 if (easing) { 15884 dataArray.push(easing); 15885 } 15886 15887 if (startValueRGB !== undefined) { 15888 dataArray.push(startValueRGB[i]); 15889 } 15890 15891 fixPropertyValue(propertyName + colorComponents[i], dataArray); 15892 } 15893 /* If we have replaced a shortcut color value then don't update the standard property name */ 15894 continue; 15895 } 15896 } 15897 fixPropertyValue(propertyName, valueData); 15898 } 15899 15900 /* Along with its property data, store a reference to the element itself onto tweensContainer. */ 15901 tweensContainer.element = element; 15902 } 15903 15904 /***************** 15905 Call Push 15906 *****************/ 15907 15908 /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not 15909 being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */ 15910 if (tweensContainer.element) { 15911 /* Apply the "velocity-animating" indicator class. */ 15912 CSS.Values.addClass(element, "velocity-animating"); 15913 15914 /* The call array houses the tweensContainers for each element being animated in the current call. */ 15915 call.push(tweensContainer); 15916 15917 data = Data(element); 15918 15919 if (data) { 15920 /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */ 15921 if (opts.queue === "") { 15922 15923 data.tweensContainer = tweensContainer; 15924 data.opts = opts; 15925 } 15926 15927 /* Switch on the element's animating flag. */ 15928 data.isAnimating = true; 15929 } 15930 15931 /* Once the final element in this call's element set has been processed, push the call array onto 15932 Velocity.State.calls for the animation tick to immediately begin processing. */ 15933 if (elementsIndex === elementsLength - 1) { 15934 /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container. 15935 Anything on this call container is subjected to tick() processing. */ 15936 Velocity.State.calls.push([call, elements, opts, null, promiseData.resolver, null, 0]); 15937 15938 /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */ 15939 if (Velocity.State.isTicking === false) { 15940 Velocity.State.isTicking = true; 15941 15942 /* Start the tick loop. */ 15943 tick(); 15944 } 15945 } else { 15946 elementsIndex++; 15947 } 15948 } 15949 } 15950 15951 /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ 15952 if (opts.queue === false) { 15953 /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), 15954 we manually inject the delay property here with an explicit setTimeout. */ 15955 if (opts.delay) { 15956 15957 /* Temporarily store delayed elements to facilitate access for global pause/resume */ 15958 var callIndex = Velocity.State.delayedElements.count++; 15959 Velocity.State.delayedElements[callIndex] = element; 15960 15961 var delayComplete = (function(index) { 15962 return function() { 15963 /* Clear the temporary element */ 15964 Velocity.State.delayedElements[index] = false; 15965 15966 /* Finally, issue the call */ 15967 buildQueue(); 15968 }; 15969 })(callIndex); 15970 15971 Data(element).delayBegin = (new Date()).getTime(); 15972 Data(element).delay = parseFloat(opts.delay); 15973 Data(element).delayTimer = { 15974 setTimeout: setTimeout(buildQueue, parseFloat(opts.delay)), 15975 next: delayComplete 15976 }; 15977 } else { 15978 buildQueue(); 15979 } 15980 /* Otherwise, the call undergoes element queueing as normal. */ 15981 /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ 15982 } else { 15983 $.queue(element, opts.queue, function(next, clearQueue) { 15984 /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once, 15985 so it's fine if this is repeatedly triggered for each element in the associated call.) */ 15986 if (clearQueue === true) { 15987 if (promiseData.promise) { 15988 promiseData.resolver(elements); 15989 } 15990 15991 /* Do not continue with animation queueing. */ 15992 return true; 15993 } 15994 15995 /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity. 15996 See completeCall() for further details. */ 15997 Velocity.velocityQueueEntryFlag = true; 15998 15999 buildQueue(next); 16000 }); 16001 } 16002 16003 /********************* 16004 Auto-Dequeuing 16005 *********************/ 16006 16007 /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element 16008 must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking 16009 for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's 16010 queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's 16011 first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ 16012 /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until 16013 each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ 16014 /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. 16015 Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ 16016 if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { 16017 $.dequeue(element); 16018 } 16019 } 16020 16021 /************************** 16022 Element Set Iteration 16023 **************************/ 16024 16025 /* If the "nodeType" property exists on the elements variable, we're animating a single element. 16026 Place it in an array so that $.each() can iterate over it. */ 16027 $.each(elements, function(i, element) { 16028 /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */ 16029 if (Type.isNode(element)) { 16030 processElement(element, i); 16031 } 16032 }); 16033 16034 /****************** 16035 Option: Loop 16036 ******************/ 16037 16038 /* The loop option accepts an integer indicating how many times the element should loop between the values in the 16039 current call's properties map and the element's property values prior to this call. */ 16040 /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs 16041 to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, 16042 which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ 16043 opts = $.extend({}, Velocity.defaults, options); 16044 opts.loop = parseInt(opts.loop, 10); 16045 var reverseCallsCount = (opts.loop * 2) - 1; 16046 16047 if (opts.loop) { 16048 /* Double the loop count to convert it into its appropriate number of "reverse" calls. 16049 Subtract 1 from the resulting value since the current call is included in the total alternation count. */ 16050 for (var x = 0; x < reverseCallsCount; x++) { 16051 /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object 16052 isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse 16053 call so that the delay logic that occurs inside *Pre-Queueing* can process it. */ 16054 var reverseOptions = { 16055 delay: opts.delay, 16056 progress: opts.progress 16057 }; 16058 16059 /* If a complete callback was passed into this call, transfer it to the loop redirect's final "reverse" call 16060 so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */ 16061 if (x === reverseCallsCount - 1) { 16062 reverseOptions.display = opts.display; 16063 reverseOptions.visibility = opts.visibility; 16064 reverseOptions.complete = opts.complete; 16065 } 16066 16067 animate(elements, "reverse", reverseOptions); 16068 } 16069 } 16070 16071 /*************** 16072 Chaining 16073 ***************/ 16074 16075 /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ 16076 return getChain(); 16077 }; 16078 16079 /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ 16080 Velocity = $.extend(animate, Velocity); 16081 /* For legacy support, also expose the literal animate method. */ 16082 Velocity.animate = animate; 16083 16084 /************** 16085 Timing 16086 **************/ 16087 16088 /* Ticker function. */ 16089 var ticker = window.requestAnimationFrame || rAFShim; 16090 16091 /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses. 16092 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 16093 devices to avoid wasting battery power on inactive tabs. */ 16094 /* 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. */ 16095 if (!Velocity.State.isMobile && document.hidden !== undefined) { 16096 var updateTicker = function() { 16097 /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */ 16098 if (document.hidden) { 16099 ticker = function(callback) { 16100 /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */ 16101 return setTimeout(function() { 16102 callback(true); 16103 }, 16); 16104 }; 16105 16106 /* The rAF loop has been paused by the browser, so we manually restart the tick. */ 16107 tick(); 16108 } else { 16109 ticker = window.requestAnimationFrame || rAFShim; 16110 } 16111 }; 16112 16113 /* 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 */ 16114 updateTicker(); 16115 16116 /* And then run check again every time visibility changes */ 16117 document.addEventListener("visibilitychange", updateTicker); 16118 } 16119 16120 /************ 16121 Tick 16122 ************/ 16123 16124 /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ 16125 function tick(timestamp) { 16126 /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. 16127 We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever 16128 the browser's next tick sync time occurs, which results in the first elements subjected to Velocity 16129 calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore 16130 the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated 16131 by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ 16132 if (timestamp) { 16133 /* We normally use RAF's high resolution timestamp but as it can be significantly offset when the browser is 16134 under high stress we give the option for choppiness over allowing the browser to drop huge chunks of frames. 16135 We use performance.now() and shim it if it doesn't exist for when the tab is hidden. */ 16136 var timeCurrent = Velocity.timestamp && timestamp !== true ? timestamp : performance.now(); 16137 16138 /******************** 16139 Call Iteration 16140 ********************/ 16141 16142 var callsLength = Velocity.State.calls.length; 16143 16144 /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) 16145 when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation 16146 has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ 16147 if (callsLength > 10000) { 16148 Velocity.State.calls = compactSparseArray(Velocity.State.calls); 16149 callsLength = Velocity.State.calls.length; 16150 } 16151 16152 /* Iterate through each active call. */ 16153 for (var i = 0; i < callsLength; i++) { 16154 /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */ 16155 if (!Velocity.State.calls[i]) { 16156 continue; 16157 } 16158 16159 /************************ 16160 Call-Wide Variables 16161 ************************/ 16162 16163 var callContainer = Velocity.State.calls[i], 16164 call = callContainer[0], 16165 opts = callContainer[2], 16166 timeStart = callContainer[3], 16167 firstTick = !timeStart, 16168 tweenDummyValue = null, 16169 pauseObject = callContainer[5], 16170 millisecondsEllapsed = callContainer[6]; 16171 16172 16173 16174 /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). 16175 We assign timeStart now so that its value is as close to the real animation start time as possible. 16176 (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay 16177 between that time and now would cause the first few frames of the tween to be skipped since 16178 percentComplete is calculated relative to timeStart.) */ 16179 /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the 16180 first tick iteration isn't wasted by animating at 0% tween completion, which would produce the 16181 same style value as the element's current value. */ 16182 if (!timeStart) { 16183 timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; 16184 } 16185 16186 /* If a pause object is present, skip processing unless it has been set to resume */ 16187 if (pauseObject) { 16188 if (pauseObject.resume === true) { 16189 /* Update the time start to accomodate the paused completion amount */ 16190 timeStart = callContainer[3] = Math.round(timeCurrent - millisecondsEllapsed - 16); 16191 16192 /* Remove pause object after processing */ 16193 callContainer[5] = null; 16194 } else { 16195 continue; 16196 } 16197 } 16198 16199 millisecondsEllapsed = callContainer[6] = timeCurrent - timeStart; 16200 16201 /* The tween's completion percentage is relative to the tween's start time, not the tween's start value 16202 (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). 16203 Accordingly, we ensure that percentComplete does not exceed 1. */ 16204 var percentComplete = Math.min((millisecondsEllapsed) / opts.duration, 1); 16205 16206 /********************** 16207 Element Iteration 16208 **********************/ 16209 16210 /* For every call, iterate through each of the elements in its set. */ 16211 for (var j = 0, callLength = call.length; j < callLength; j++) { 16212 var tweensContainer = call[j], 16213 element = tweensContainer.element; 16214 16215 /* Check to see if this element has been deleted midway through the animation by checking for the 16216 continued existence of its data cache. If it's gone, or the element is currently paused, skip animating this element. */ 16217 if (!Data(element)) { 16218 continue; 16219 } 16220 16221 var transformPropertyExists = false; 16222 16223 /********************************** 16224 Display & Visibility Toggling 16225 **********************************/ 16226 16227 /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. 16228 (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ 16229 if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { 16230 if (opts.display === "flex") { 16231 var flexValues = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"]; 16232 16233 $.each(flexValues, function(i, flexValue) { 16234 CSS.setPropertyValue(element, "display", flexValue); 16235 }); 16236 } 16237 16238 CSS.setPropertyValue(element, "display", opts.display); 16239 } 16240 16241 /* Same goes with the visibility option, but its "none" equivalent is "hidden". */ 16242 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 16243 CSS.setPropertyValue(element, "visibility", opts.visibility); 16244 } 16245 16246 /************************ 16247 Property Iteration 16248 ************************/ 16249 16250 /* For every element, iterate through each property. */ 16251 for (var property in tweensContainer) { 16252 /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ 16253 if (tweensContainer.hasOwnProperty(property) && property !== "element") { 16254 var tween = tweensContainer[property], 16255 currentValue, 16256 /* Easing can either be a pre-genereated function or a string that references a pre-registered easing 16257 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */ 16258 easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing; 16259 16260 /****************************** 16261 Current Value Calculation 16262 ******************************/ 16263 16264 if (Type.isString(tween.pattern)) { 16265 var patternReplace = percentComplete === 1 ? 16266 function($0, index, round) { 16267 var result = tween.endValue[index]; 16268 16269 return round ? Math.round(result) : result; 16270 } : 16271 function($0, index, round) { 16272 var startValue = tween.startValue[index], 16273 tweenDelta = tween.endValue[index] - startValue, 16274 result = startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta)); 16275 16276 return round ? Math.round(result) : result; 16277 }; 16278 16279 currentValue = tween.pattern.replace(/{(\d+)(!)?}/g, patternReplace); 16280 } else if (percentComplete === 1) { 16281 /* If this is the last tick pass (if we've reached 100% completion for this tween), 16282 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ 16283 currentValue = tween.endValue; 16284 } else { 16285 /* Otherwise, calculate currentValue based on the current delta from startValue. */ 16286 var tweenDelta = tween.endValue - tween.startValue; 16287 16288 currentValue = tween.startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta)); 16289 /* If no value change is occurring, don't proceed with DOM updating. */ 16290 } 16291 if (!firstTick && (currentValue === tween.currentValue)) { 16292 continue; 16293 } 16294 16295 tween.currentValue = currentValue; 16296 16297 /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that 16298 it can be passed into the progress callback. */ 16299 if (property === "tween") { 16300 tweenDummyValue = currentValue; 16301 } else { 16302 /****************** 16303 Hooks: Part I 16304 ******************/ 16305 var hookRoot; 16306 16307 /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used 16308 for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated 16309 rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's 16310 updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that 16311 subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ 16312 if (CSS.Hooks.registered[property]) { 16313 hookRoot = CSS.Hooks.getRoot(property); 16314 16315 var rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot]; 16316 16317 if (rootPropertyValueCache) { 16318 tween.rootPropertyValue = rootPropertyValueCache; 16319 } 16320 } 16321 16322 /***************** 16323 DOM Update 16324 *****************/ 16325 16326 /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ 16327 /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ 16328 var adjustedSetData = CSS.setPropertyValue(element, /* SET */ 16329 property, 16330 tween.currentValue + (IE < 9 && parseFloat(currentValue) === 0 ? "" : tween.unitType), 16331 tween.rootPropertyValue, 16332 tween.scrollData); 16333 16334 /******************* 16335 Hooks: Part II 16336 *******************/ 16337 16338 /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */ 16339 if (CSS.Hooks.registered[property]) { 16340 /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */ 16341 if (CSS.Normalizations.registered[hookRoot]) { 16342 Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); 16343 } else { 16344 Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; 16345 } 16346 } 16347 16348 /*************** 16349 Transforms 16350 ***************/ 16351 16352 /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ 16353 if (adjustedSetData[0] === "transform") { 16354 transformPropertyExists = true; 16355 } 16356 16357 } 16358 } 16359 } 16360 16361 /**************** 16362 mobileHA 16363 ****************/ 16364 16365 /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. 16366 It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ 16367 if (opts.mobileHA) { 16368 /* Don't set the null transform hack if we've already done so. */ 16369 if (Data(element).transformCache.translate3d === undefined) { 16370 /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */ 16371 Data(element).transformCache.translate3d = "(0px, 0px, 0px)"; 16372 16373 transformPropertyExists = true; 16374 } 16375 } 16376 16377 if (transformPropertyExists) { 16378 CSS.flushTransformCache(element); 16379 } 16380 } 16381 16382 /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. 16383 Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ 16384 if (opts.display !== undefined && opts.display !== "none") { 16385 Velocity.State.calls[i][2].display = false; 16386 } 16387 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 16388 Velocity.State.calls[i][2].visibility = false; 16389 } 16390 16391 /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */ 16392 if (opts.progress) { 16393 opts.progress.call(callContainer[1], 16394 callContainer[1], 16395 percentComplete, 16396 Math.max(0, (timeStart + opts.duration) - timeCurrent), 16397 timeStart, 16398 tweenDummyValue); 16399 } 16400 16401 /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ 16402 if (percentComplete === 1) { 16403 completeCall(i); 16404 } 16405 } 16406 } 16407 16408 /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ 16409 if (Velocity.State.isTicking) { 16410 ticker(tick); 16411 } 16412 } 16413 16414 /********************** 16415 Call Completion 16416 **********************/ 16417 16418 /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ 16419 function completeCall(callIndex, isStopped) { 16420 /* Ensure the call exists. */ 16421 if (!Velocity.State.calls[callIndex]) { 16422 return false; 16423 } 16424 16425 /* Pull the metadata from the call. */ 16426 var call = Velocity.State.calls[callIndex][0], 16427 elements = Velocity.State.calls[callIndex][1], 16428 opts = Velocity.State.calls[callIndex][2], 16429 resolver = Velocity.State.calls[callIndex][4]; 16430 16431 var remainingCallsExist = false; 16432 16433 /************************* 16434 Element Finalization 16435 *************************/ 16436 16437 for (var i = 0, callLength = call.length; i < callLength; i++) { 16438 var element = call[i].element; 16439 16440 /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ 16441 /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ 16442 /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ 16443 if (!isStopped && !opts.loop) { 16444 if (opts.display === "none") { 16445 CSS.setPropertyValue(element, "display", opts.display); 16446 } 16447 16448 if (opts.visibility === "hidden") { 16449 CSS.setPropertyValue(element, "visibility", opts.visibility); 16450 } 16451 } 16452 16453 /* 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 16454 a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter 16455 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, 16456 we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag 16457 is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ 16458 var data = Data(element); 16459 16460 if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) { 16461 /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ 16462 if (data) { 16463 data.isAnimating = false; 16464 /* Clear the element's rootPropertyValueCache, which will become stale. */ 16465 data.rootPropertyValueCache = {}; 16466 16467 var transformHAPropertyExists = false; 16468 /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */ 16469 $.each(CSS.Lists.transforms3D, function(i, transformName) { 16470 var defaultValue = /^scale/.test(transformName) ? 1 : 0, 16471 currentValue = data.transformCache[transformName]; 16472 16473 if (data.transformCache[transformName] !== undefined && new RegExp("^\\(" + defaultValue + "[^.]").test(currentValue)) { 16474 transformHAPropertyExists = true; 16475 16476 delete data.transformCache[transformName]; 16477 } 16478 }); 16479 16480 /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */ 16481 if (opts.mobileHA) { 16482 transformHAPropertyExists = true; 16483 delete data.transformCache.translate3d; 16484 } 16485 16486 /* Flush the subproperty removals to the DOM. */ 16487 if (transformHAPropertyExists) { 16488 CSS.flushTransformCache(element); 16489 } 16490 16491 /* Remove the "velocity-animating" indicator class. */ 16492 CSS.Values.removeClass(element, "velocity-animating"); 16493 } 16494 } 16495 16496 /********************* 16497 Option: Complete 16498 *********************/ 16499 16500 /* 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. */ 16501 /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ 16502 if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) { 16503 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 16504 try { 16505 opts.complete.call(elements, elements); 16506 } catch (error) { 16507 setTimeout(function() { 16508 throw error; 16509 }, 1); 16510 } 16511 } 16512 16513 /********************** 16514 Promise Resolving 16515 **********************/ 16516 16517 /* Note: Infinite loops don't return promises. */ 16518 if (resolver && opts.loop !== true) { 16519 resolver(elements); 16520 } 16521 16522 /**************************** 16523 Option: Loop (Infinite) 16524 ****************************/ 16525 16526 if (data && opts.loop === true && !isStopped) { 16527 /* If a rotateX/Y/Z property is being animated by 360 deg with loop:true, swap tween start/end values to enable 16528 continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */ 16529 $.each(data.tweensContainer, function(propertyName, tweenContainer) { 16530 if (/^rotate/.test(propertyName) && ((parseFloat(tweenContainer.startValue) - parseFloat(tweenContainer.endValue)) % 360 === 0)) { 16531 var oldStartValue = tweenContainer.startValue; 16532 16533 tweenContainer.startValue = tweenContainer.endValue; 16534 tweenContainer.endValue = oldStartValue; 16535 } 16536 16537 if (/^backgroundPosition/.test(propertyName) && parseFloat(tweenContainer.endValue) === 100 && tweenContainer.unitType === "%") { 16538 tweenContainer.endValue = 0; 16539 tweenContainer.startValue = 100; 16540 } 16541 }); 16542 16543 Velocity(element, "reverse", {loop: true, delay: opts.delay}); 16544 } 16545 16546 /*************** 16547 Dequeueing 16548 ***************/ 16549 16550 /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), 16551 which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached, 16552 $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ 16553 if (opts.queue !== false) { 16554 $.dequeue(element, opts.queue); 16555 } 16556 } 16557 16558 /************************ 16559 Calls Array Cleanup 16560 ************************/ 16561 16562 /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray(). 16563 (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */ 16564 Velocity.State.calls[callIndex] = false; 16565 16566 /* Iterate through the calls array to determine if this was the final in-progress animation. 16567 If so, set a flag to end ticking and clear the calls array. */ 16568 for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { 16569 if (Velocity.State.calls[j] !== false) { 16570 remainingCallsExist = true; 16571 16572 break; 16573 } 16574 } 16575 16576 if (remainingCallsExist === false) { 16577 /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ 16578 Velocity.State.isTicking = false; 16579 16580 /* Clear the calls array so that its length is reset. */ 16581 delete Velocity.State.calls; 16582 Velocity.State.calls = []; 16583 } 16584 } 16585 16586 /****************** 16587 Frameworks 16588 ******************/ 16589 16590 /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. 16591 If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. Velocity 16592 also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are 16593 accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn 16594 (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ 16595 global.Velocity = Velocity; 16596 16597 if (global !== window) { 16598 /* Assign the element function to Velocity's core animate() method. */ 16599 global.fn.velocity = animate; 16600 /* Assign the object function's defaults to Velocity's global defaults object. */ 16601 global.fn.velocity.defaults = Velocity.defaults; 16602 } 16603 16604 /*********************** 16605 Packaged Redirects 16606 ***********************/ 16607 16608 /* slideUp, slideDown */ 16609 $.each(["Down", "Up"], function(i, direction) { 16610 Velocity.Redirects["slide" + direction] = function(element, options, elementsIndex, elementsSize, elements, promiseData) { 16611 var opts = $.extend({}, options), 16612 begin = opts.begin, 16613 complete = opts.complete, 16614 inlineValues = {}, 16615 computedValues = {height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: ""}; 16616 16617 if (opts.display === undefined) { 16618 /* Show the element before slideDown begins and hide the element after slideUp completes. */ 16619 /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ 16620 opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); 16621 } 16622 16623 opts.begin = function() { 16624 /* If the user passed in a begin callback, fire it now. */ 16625 if (elementsIndex === 0 && begin) { 16626 begin.call(elements, elements); 16627 } 16628 16629 /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ 16630 for (var property in computedValues) { 16631 if (!computedValues.hasOwnProperty(property)) { 16632 continue; 16633 } 16634 inlineValues[property] = element.style[property]; 16635 16636 /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, 16637 use forcefeeding to start from computed values and animate down to 0. */ 16638 var propertyValue = CSS.getPropertyValue(element, property); 16639 computedValues[property] = (direction === "Down") ? [propertyValue, 0] : [0, propertyValue]; 16640 } 16641 16642 /* Force vertical overflow content to clip so that sliding works as expected. */ 16643 inlineValues.overflow = element.style.overflow; 16644 element.style.overflow = "hidden"; 16645 }; 16646 16647 opts.complete = function() { 16648 /* Reset element to its pre-slide inline values once its slide animation is complete. */ 16649 for (var property in inlineValues) { 16650 if (inlineValues.hasOwnProperty(property)) { 16651 element.style[property] = inlineValues[property]; 16652 } 16653 } 16654 16655 /* If the user passed in a complete callback, fire it now. */ 16656 if (elementsIndex === elementsSize - 1) { 16657 if (complete) { 16658 complete.call(elements, elements); 16659 } 16660 if (promiseData) { 16661 promiseData.resolver(elements); 16662 } 16663 } 16664 }; 16665 16666 Velocity(element, computedValues, opts); 16667 }; 16668 }); 16669 16670 /* fadeIn, fadeOut */ 16671 $.each(["In", "Out"], function(i, direction) { 16672 Velocity.Redirects["fade" + direction] = function(element, options, elementsIndex, elementsSize, elements, promiseData) { 16673 var opts = $.extend({}, options), 16674 complete = opts.complete, 16675 propertiesMap = {opacity: (direction === "In") ? 1 : 0}; 16676 16677 /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering 16678 callbacks by firing them only when the final element has been reached. */ 16679 if (elementsIndex !== 0) { 16680 opts.begin = null; 16681 } 16682 if (elementsIndex !== elementsSize - 1) { 16683 opts.complete = null; 16684 } else { 16685 opts.complete = function() { 16686 if (complete) { 16687 complete.call(elements, elements); 16688 } 16689 if (promiseData) { 16690 promiseData.resolver(elements); 16691 } 16692 }; 16693 } 16694 16695 /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ 16696 /* Note: We allow users to pass in "null" to skip display setting altogether. */ 16697 if (opts.display === undefined) { 16698 opts.display = (direction === "In" ? "auto" : "none"); 16699 } 16700 16701 Velocity(this, propertiesMap, opts); 16702 }; 16703 }); 16704 16705 return Velocity; 16706 }((window.jQuery || window.Zepto || window), window, (window ? window.document : undefined)); 16707 })); 16708 16709 /****************** 16710 Known Issues 16711 ******************/ 16712 16713 /* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. 16714 Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties 16715 will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ 16716 16717 16718/***/ }), 16719/* 347 */
16720/***/ (function(module, exports) { 16721 16722 // éåæã«èªã¿è¾¼ããã¡ã¤ã« 16723 16724 "use strict"; 16725 16726 Object.defineProperty(exports, "__esModule", { 16727 value: true 16728 }); 16729 16730 exports["default"] = function (string) { 16731 return string + "!"; 16732 }; 16733 16734 module.exports = exports["default"]; 16735 16736/***/ }), 16737/* 348 */, 16738/* 349 */ 16739/***/ (function(module, exports, __webpack_require__) { 16740 16741 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 16742 // Must use "const" or "var" 16743 'use strict'; 16744 16745 Object.defineProperty(exports, '__esModule', { 16746 value: true 16747 }); 16748 16749 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; }; })(); 16750 16751 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 16752 16753 var imagesLoaded = __webpack_require__(344); 16754 var velocity = __webpack_require__(346); 16755 16756 var Index = (function () { 16757 function Index(id) { 16758 var _this = this; 16759 16760 _classCallCheck(this, Index); 16761 16762 this.id = id; 16763 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 16764 _this.initialize(); 16765 }); 16766 } 16767 16768 _createClass(Index, [{ 16769 key: 'initialize', 16770 value: function initialize() { 16771 this.sample_imagesloaded(); 16772 this.sample_message(); 16773 this.sample_velocity(); 16774 } 16775 16776 // methods 16777 }, { 16778 key: 'sample_imagesloaded', 16779 value: function sample_imagesloaded() { 16780 imagesLoaded('#main', function () { 16781 console.log('loaded'); 16782 }); 16783 } 16784 }, { 16785 key: 'sample_message', 16786 value: function sample_message() { 16787 var message = __webpack_require__(347); 16788 console.log(message(this.id + '.js loaded')); 16789 } 16790 }, { 16791 key: 'sample_velocity', 16792 value: function sample_velocity() { 16793 var $article = $('.m-list-article'); 16794 $article.on('mouseenter', function (e) { 16795 var $el = $(e.currentTarget).find('img'); 16796 $el.velocity({ 16797 // 'scale': 1.1 16798 }, { 16799 easing: 'easeOutQuart', 16800 duration: 500 16801 }); 16802 }); 16803 $article.on('mouseleave', function (e) { 16804 var $el = $(e.currentTarget).find('img'); 16805 $el.velocity({ 16806 'scale': 1 16807 }, { 16808 easing: 'easeOutQuart', 16809 duration: 500 16810 }); 16811 }); 16812 } 16813 }]); 16814 16815 return Index; 16816 })(); 16817 16818 exports['default'] = Index; 16819 module.exports = exports['default']; 16820 16821/***/ }), 16822/* 350 */ 16823/***/ (function(module, exports, __webpack_require__) { 16824 16825 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 16826 // Must use "const" or "var" 16827 'use strict'; 16828 16829 Object.defineProperty(exports, '__esModule', { 16830 value: true 16831 }); 16832 16833 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; }; })(); 16834 16835 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 16836 16837 var imagesLoaded = __webpack_require__(344); 16838 var velocity = __webpack_require__(346); 16839 16840 var Index = (function () { 16841 function Index(id) { 16842 var _this = this; 16843 16844 _classCallCheck(this, Index); 16845 16846 this.id = id; 16847 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 16848 _this.initialize(); 16849 }); 16850 } 16851 16852 _createClass(Index, [{ 16853 key: 'initialize', 16854 value: function initialize() { 16855 this.sample_imagesloaded(); 16856 this.sample_message(); 16857 this.sample_velocity(); 16858 } 16859 16860 // methods 16861 }, { 16862 key: 'sample_imagesloaded', 16863 value: function sample_imagesloaded() { 16864 imagesLoaded('#main', function () { 16865 console.log('loaded'); 16866 }); 16867 } 16868 }, { 16869 key: 'sample_message', 16870 value: function sample_message() { 16871 var message = __webpack_require__(347); 16872 console.log(message(this.id + '.js loaded')); 16873 } 16874 }, { 16875 key: 'sample_velocity', 16876 value: function sample_velocity() { 16877 var $article = $('.m-list-article'); 16878 $article.on('mouseenter', function (e) { 16879 var $el = $(e.currentTarget).find('img'); 16880 $el.velocity({ 16881 // 'scale': 1.1 16882 }, { 16883 easing: 'easeOutQuart', 16884 duration: 500 16885 }); 16886 }); 16887 $article.on('mouseleave', function (e) { 16888 var $el = $(e.currentTarget).find('img'); 16889 $el.velocity({ 16890 'scale': 1 16891 }, { 16892 easing: 'easeOutQuart', 16893 duration: 500 16894 }); 16895 }); 16896 } 16897 }]); 16898 16899 return Index; 16900 })(); 16901 16902 exports['default'] = Index; 16903 module.exports = exports['default']; 16904 16905/***/ }), 16906/* 351 */ 16907/***/ (function(module, exports, __webpack_require__) { 16908 16909 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 16910 // Must use "const" or "var" 16911 'use strict'; 16912 16913 Object.defineProperty(exports, '__esModule', { 16914 value: true 16915 }); 16916 16917 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; }; })(); 16918 16919 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 16920 16921 var imagesLoaded = __webpack_require__(344); 16922 var velocity = __webpack_require__(346); 16923 16924 var Index = (function () { 16925 function Index(id) { 16926 var _this = this; 16927 16928 _classCallCheck(this, Index); 16929 16930 this.id = id; 16931 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 16932 _this.initialize(); 16933 }); 16934 } 16935 16936 _createClass(Index, [{ 16937 key: 'initialize', 16938 value: function initialize() { 16939 this.sample_imagesloaded(); 16940 this.sample_message(); 16941 this.sample_velocity(); 16942 } 16943 16944 // methods 16945 }, { 16946 key: 'sample_imagesloaded', 16947 value: function sample_imagesloaded() { 16948 imagesLoaded('#main', function () { 16949 console.log('loaded'); 16950 }); 16951 } 16952 }, { 16953 key: 'sample_message', 16954 value: function sample_message() { 16955 var message = __webpack_require__(347); 16956 console.log(message(this.id + '.js loaded')); 16957 } 16958 }, { 16959 key: 'sample_velocity', 16960 value: function sample_velocity() { 16961 var $article = $('.m-list-article'); 16962 $article.on('mouseenter', function (e) { 16963 var $el = $(e.currentTarget).find('img'); 16964 $el.velocity({ 16965 // 'scale': 1.1 16966 }, { 16967 easing: 'easeOutQuart', 16968 duration: 500 16969 }); 16970 }); 16971 $article.on('mouseleave', function (e) { 16972 var $el = $(e.currentTarget).find('img'); 16973 $el.velocity({ 16974 'scale': 1 16975 }, { 16976 easing: 'easeOutQuart', 16977 duration: 500 16978 }); 16979 }); 16980 } 16981 }]); 16982 16983 return Index; 16984 })(); 16985 16986 exports['default'] = Index; 16987 module.exports = exports['default']; 16988 16989/***/ }), 16990/* 352 */ 16991/***/ (function(module, exports, __webpack_require__) { 16992 16993 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 16994 // Must use "const" or "var" 16995 'use strict'; 16996 16997 Object.defineProperty(exports, '__esModule', { 16998 value: true 16999 }); 17000 17001 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; }; })(); 17002 17003 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17004 17005 var imagesLoaded = __webpack_require__(344); 17006 var velocity = __webpack_require__(346); 17007 17008 var Index = (function () { 17009 function Index(id) { 17010 var _this = this; 17011 17012 _classCallCheck(this, Index); 17013 17014 this.id = id; 17015 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 17016 _this.initialize(); 17017 }); 17018 } 17019 17020 _createClass(Index, [{ 17021 key: 'initialize', 17022 value: function initialize() { 17023 this.sample_imagesloaded(); 17024 this.sample_message(); 17025 this.sample_velocity(); 17026 } 17027 17028 // methods 17029 }, { 17030 key: 'sample_imagesloaded', 17031 value: function sample_imagesloaded() { 17032 imagesLoaded('#main', function () { 17033 console.log('loaded'); 17034 }); 17035 } 17036 }, { 17037 key: 'sample_message', 17038 value: function sample_message() { 17039 var message = __webpack_require__(347); 17040 console.log(message(this.id + '.js loaded')); 17041 } 17042 }, { 17043 key: 'sample_velocity', 17044 value: function sample_velocity() { 17045 var $article = $('.m-list-article'); 17046 $article.on('mouseenter', function (e) { 17047 var $el = $(e.currentTarget).find('img'); 17048 $el.velocity({ 17049 // 'scale': 1.1 17050 }, { 17051 easing: 'easeOutQuart', 17052 duration: 500 17053 }); 17054 }); 17055 $article.on('mouseleave', function (e) { 17056 var $el = $(e.currentTarget).find('img'); 17057 $el.velocity({ 17058 'scale': 1 17059 }, { 17060 easing: 'easeOutQuart', 17061 duration: 500 17062 }); 17063 }); 17064 } 17065 }]); 17066 17067 return Index; 17068 })(); 17069 17070 exports['default'] = Index; 17071 module.exports = exports['default']; 17072 17073/***/ }), 17074/* 353 */ 17075/***/ (function(module, exports, __webpack_require__) { 17076 17077 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 17078 // Must use "const" or "var" 17079 'use strict'; 17080 17081 Object.defineProperty(exports, '__esModule', { 17082 value: true 17083 }); 17084 17085 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; }; })(); 17086 17087 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17088 17089 var imagesLoaded = __webpack_require__(344); 17090 var velocity = __webpack_require__(346); 17091 17092 var Index = (function () { 17093 function Index(id) { 17094 var _this = this; 17095 17096 _classCallCheck(this, Index); 17097 17098 this.id = id; 17099 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 17100 _this.initialize(); 17101 }); 17102 } 17103 17104 _createClass(Index, [{ 17105 key: 'initialize', 17106 value: function initialize() { 17107 this.sample_imagesloaded(); 17108 this.sample_message(); 17109 this.sample_velocity(); 17110 } 17111 17112 // methods 17113 }, { 17114 key: 'sample_imagesloaded', 17115 value: function sample_imagesloaded() { 17116 imagesLoaded('#main', function () { 17117 console.log('loaded'); 17118 }); 17119 } 17120 }, { 17121 key: 'sample_message', 17122 value: function sample_message() { 17123 var message = __webpack_require__(347); 17124 console.log(message(this.id + '.js loaded')); 17125 } 17126 }, { 17127 key: 'sample_velocity', 17128 value: function sample_velocity() { 17129 var $article = $('.m-list-article'); 17130 $article.on('mouseenter', function (e) { 17131 var $el = $(e.currentTarget).find('img'); 17132 $el.velocity({ 17133 // 'scale': 1.1 17134 }, { 17135 easing: 'easeOutQuart', 17136 duration: 500 17137 }); 17138 }); 17139 $article.on('mouseleave', function (e) { 17140 var $el = $(e.currentTarget).find('img'); 17141 $el.velocity({ 17142 'scale': 1 17143 }, { 17144 easing: 'easeOutQuart', 17145 duration: 500 17146 }); 17147 }); 17148 } 17149 }]); 17150 17151 return Index; 17152 })(); 17153 17154 exports['default'] = Index; 17155 module.exports = exports['default']; 17156 17157/***/ }), 17158/* 354 */ 17159/***/ (function(module, exports, __webpack_require__) { 17160 17161 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 17162 // Must use "const" or "var" 17163 'use strict'; 17164 17165 Object.defineProperty(exports, '__esModule', { 17166 value: true 17167 }); 17168 17169 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; }; })(); 17170 17171 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17172 17173 var imagesLoaded = __webpack_require__(344); 17174 var velocity = __webpack_require__(346); 17175 17176 var Index = (function () { 17177 function Index(id) { 17178 var _this = this; 17179 17180 _classCallCheck(this, Index); 17181 17182 this.id = id; 17183 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 17184 _this.initialize(); 17185 }); 17186 } 17187 17188 _createClass(Index, [{ 17189 key: 'initialize', 17190 value: function initialize() { 17191 this.sample_imagesloaded(); 17192 this.sample_message(); 17193 this.sample_velocity(); 17194 } 17195 17196 // methods 17197 }, { 17198 key: 'sample_imagesloaded', 17199 value: function sample_imagesloaded() { 17200 imagesLoaded('#main', function () { 17201 console.log('loaded'); 17202 }); 17203 } 17204 }, { 17205 key: 'sample_message', 17206 value: function sample_message() { 17207 var message = __webpack_require__(347); 17208 console.log(message(this.id + '.js loaded')); 17209 } 17210 }, { 17211 key: 'sample_velocity', 17212 value: function sample_velocity() { 17213 var $article = $('.m-list-article'); 17214 $article.on('mouseenter', function (e) { 17215 var $el = $(e.currentTarget).find('img'); 17216 $el.velocity({ 17217 // 'scale': 1.1 17218 }, { 17219 easing: 'easeOutQuart', 17220 duration: 500 17221 }); 17222 }); 17223 $article.on('mouseleave', function (e) { 17224 var $el = $(e.currentTarget).find('img'); 17225 $el.velocity({ 17226 'scale': 1 17227 }, { 17228 easing: 'easeOutQuart', 17229 duration: 500 17230 }); 17231 }); 17232 } 17233 }]); 17234 17235 return Index; 17236 })(); 17237 17238 exports['default'] = Index; 17239 module.exports = exports['default']; 17240 17241/***/ }), 17242/* 355 */ 17243/***/ (function(module, exports, __webpack_require__) { 17244 17245 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 17246 // Must use "const" or "var" 17247 'use strict'; 17248 17249 Object.defineProperty(exports, '__esModule', { 17250 value: true 17251 }); 17252 17253 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 = tru
17253e; 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; }; })(); 17254 17255 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17256 17257 var imagesLoaded = __webpack_require__(344); 17258 var velocity = __webpack_require__(346); 17259 17260 var Index = (function () { 17261 function Index(id) { 17262 var _this = this; 17263 17264 _classCallCheck(this, Index); 17265 17266 this.id = id; 17267 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 17268 _this.initialize(); 17269 }); 17270 } 17271 17272 _createClass(Index, [{ 17273 key: 'initialize', 17274 value: function initialize() { 17275 this.sample_imagesloaded(); 17276 this.sample_message(); 17277 this.sample_velocity(); 17278 } 17279 17280 // methods 17281 }, { 17282 key: 'sample_imagesloaded', 17283 value: function sample_imagesloaded() { 17284 imagesLoaded('#main', function () { 17285 console.log('loaded'); 17286 }); 17287 } 17288 }, { 17289 key: 'sample_message', 17290 value: function sample_message() { 17291 var message = __webpack_require__(347); 17292 console.log(message(this.id + '.js loaded')); 17293 } 17294 }, { 17295 key: 'sample_velocity', 17296 value: function sample_velocity() { 17297 var $article = $('.m-list-article'); 17298 $article.on('mouseenter', function (e) { 17299 var $el = $(e.currentTarget).find('img'); 17300 $el.velocity({ 17301 // 'scale': 1.1 17302 }, { 17303 easing: 'easeOutQuart', 17304 duration: 500 17305 }); 17306 }); 17307 $article.on('mouseleave', function (e) { 17308 var $el = $(e.currentTarget).find('img'); 17309 $el.velocity({ 17310 'scale': 1 17311 }, { 17312 easing: 'easeOutQuart', 17313 duration: 500 17314 }); 17315 }); 17316 } 17317 }]); 17318 17319 return Index; 17320 })(); 17321 17322 exports['default'] = Index; 17323 module.exports = exports['default']; 17324 17325/***/ }), 17326/* 356 */ 17327/***/ (function(module, exports) { 17328 17329 'use strict'; 17330 17331 Object.defineProperty(exports, '__esModule', { 17332 value: true 17333 }); 17334 17335 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17336 17337 var Followers = function Followers(args) { 17338 _classCallCheck(this, Followers); 17339 17340 console.log('followers.js loaded'); 17341 var button_menu = document.getElementById('show_follow_menu'), 17342 target = document.getElementById(button_menu.getAttribute('data-toggle')); 17343 17344 button_menu.onclick = function () { 17345 target.classList.toggle("is-open"); 17346 }; 17347 } 17348 17349 // methods 17350 ; 17351 17352 exports['default'] = Followers; 17353 module.exports = exports['default']; 17354 17355/***/ }), 17356/* 357 */ 17357/***/ (function(module, exports) { 17358 17359 'use strict'; 17360 17361 Object.defineProperty(exports, '__esModule', { 17362 value: true 17363 }); 17364 17365 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17366 17367 var Follows = function Follows(args) { 17368 _classCallCheck(this, Follows); 17369 17370 console.log('follows.js loaded'); 17371 var button_menu = document.getElementById('show_follow_menu'), 17372 target = document.getElementById(button_menu.getAttribute('data-toggle')); 17373 17374 button_menu.onclick = function () { 17375 target.classList.toggle("is-open"); 17376 }; 17377 } 17378 17379 // methods 17380 ; 17381 17382 exports['default'] = Follows; 17383 module.exports = exports['default']; 17384 17385/***/ }), 17386/* 358 */ 17387/***/ (function(module, exports) { 17388 17389 'use strict'; 17390 17391 Object.defineProperty(exports, '__esModule', { 17392 value: true 17393 }); 17394 17395 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17396 17397 var FollowSearch = function FollowSearch(args) { 17398 _classCallCheck(this, FollowSearch); 17399 17400 console.log('follows_search.js loaded'); 17401 var button_menu = document.getElementById('show_follow_menu'), 17402 target = document.getElementById(button_menu.getAttribute('data-toggle')); 17403 17404 button_menu.onclick = function () { 17405 target.classList.toggle("is-open"); 17406 }; 17407 } 17408 17409 // methods 17410 ; 17411 17412 exports['default'] = FollowSearch; 17413 module.exports = exports['default']; 17414 17415/***/ }), 17416/* 359 */ 17417/***/ (function(module, exports, __webpack_require__) { 17418 17419 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 17420 // Must use "const" or "var" 17421 'use strict'; 17422 17423 Object.defineProperty(exports, '__esModule', { 17424 value: true 17425 }); 17426 17427 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; }; })(); 17428 17429 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 17430 17431 var imagesLoaded = __webpack_require__(344); 17432 var velocity = __webpack_require__(346); 17433 var flipclock = __webpack_require__(360); 17434 var YouTubePlayer = __webpack_require__(361); 17435 17436 var Index = (function () { 17437 function Index(id) { 17438 var _this = this; 17439 17440 _classCallCheck(this, Index); 17441 17442 this.id = id; 17443 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 17444 _this.initialize(); 17445 }); 17446 } 17447 17448 _createClass(Index, [{ 17449 key: 'initialize', 17450 value: function initialize() { 17451 var self = this; 17452 this.setPlayer(); 17453 this.setCountdown(); 17454 17455 this.sample_imagesloaded(); 17456 this.sample_message(); 17457 this.sample_velocity(); 17458 17459 // init 17460 $(window).resize(function () { 17461 if ($('#cover').length) { 17462 self.setPlayer(); 17463 } 17464 }); 17465 } 17466 17467 // methods 17468 }, { 17469 key: 'sample_imagesloaded', 17470 value: function sample_imagesloaded() { 17471 imagesLoaded('#main', function () { 17472 console.log('loaded'); 17473 }); 17474 } 17475 }, { 17476 key: 'sample_message', 17477 value: function sample_message() { 17478 var message = __webpack_require__(347); 17479 console.log(message(this.id + '.js loaded')); 17480 } 17481 }, { 17482 key: 'sample_velocity', 17483 value: function sample_velocity() { 17484 var $article = $('.m-list-article'); 17485 $article.on('mouseenter', function (e) { 17486 var $el = $(e.currentTarget).find('img'); 17487 $el.velocity({ 17488 // 'scale': 1.1 17489 }, { 17490 easing: 'easeOutQuart', 17491 duration: 500 17492 }); 17493 }); 17494 $article.on('mouseleave', function (e) { 17495 var $el = $(e.currentTarget).find('img'); 17496 $el.velocity({ 17497 'scale': 1 17498 }, { 17499 easing: 'easeOutQuart', 17500 duration: 500 17501 }); 17502 }); 17503 } 17504 }, { 17505 key: 'setCountdown', 17506 value: function setCountdown() { 17507 var countdown; 17508 var clocks = new Array(); 17509 $('.countdown').each(function () {
17510 var time = $(this).data("countdown"); 17511 time = (new Date(time) - new Date().getTime()) / 1000; 17512 var clock = $(this).FlipClock(time, { 17513 countdown: true, 17514 clockFace: 'DailyCounter' 17515 }); 17516 clocks.push(clock); 17517 }); 17518 } 17519 }, { 17520 key: 'setPlayer', 17521 value: function setPlayer() { 17522 var playerCover = document.getElementById('player_cover'); 17523 if (playerCover === null) return; 17524 17525 if (window.getComputedStyle(playerCover).display === 'none') { 17526 var imagePath = $('#cover .image').attr("data-image"); 17527 $('#cover .image').css('background-image', 'url(' + imagePath + ')'); 17528 } else { 17529 var videoId = playerCover.getAttribute("data-movie").split('/')[4]; 17530 17531 var player = YouTubePlayer('cover-background-movie', { 17532 playerVars: { 17533 'autoplay': 1, 17534 'controls': 0, 17535 'autohide': 1, 17536 'wmode': 'opaque', 17537 'showinfo': 0, 17538 'loop': 1, 17539 'playlist': videoId, 17540 'rel': 0, 17541 'mute': 1, 17542 'start': 0, 17543 'end': 96 17544 }, 17545 videoId: videoId 17546 }); 17547 17548 player.playVideo().then(function () { 17549 var width = $(document).width(); 17550 var height = width / 16 * 9; 17551 $('#cover-background-movie').css({ 'height': height + 'px' }); 17552 }); 17553 } 17554 } 17555 }]); 17556 17557 return Index; 17558 })(); 17559 17560 exports['default'] = Index; 17561 module.exports = exports['default']; 17562 17563/***/ }), 17564/* 360 */ 17565/***/ (function(module, exports) { 17566 17567 /*! flipclock 2014-10-21 */ 17568 "use strict"; 17569 17570 var Base = function Base() {};Base.extend = function (a, b) { 17571 "use strict";var c = Base.prototype.extend;Base._prototyping = !0;var d = new this();c.call(d, a), d.base = function () {}, delete Base._prototyping;var e = d.constructor, 17572 f = d.constructor = function () { 17573 if (!Base._prototyping) if (this._constructing || this.constructor == f) this._constructing = !0, e.apply(this, arguments), delete this._constructing;else if (null !== arguments[0]) return (arguments[0].extend || c).call(arguments[0], d); 17574 };return f.ancestor = this, f.extend = this.extend, f.forEach = this.forEach, f.implement = this.implement, f.prototype = d, f.toString = this.toString, f.valueOf = function (a) { 17575 return "object" == a ? f : e.valueOf(); 17576 }, c.call(f, b), "function" == typeof f.init && f.init(), f; 17577 }, Base.prototype = { extend: function extend(a, b) { 17578 if (arguments.length > 1) { 17579 var c = this[a];if (c && "function" == typeof b && (!c.valueOf || c.valueOf() != b.valueOf()) && /\bbase\b/.test(b)) { 17580 var d = b.valueOf();b = function () { 17581 var a = this.base || Base.prototype.base;this.base = c;var b = d.apply(this, arguments);return this.base = a, b; 17582 }, b.valueOf = function (a) { 17583 return "object" == a ? b : d; 17584 }, b.toString = Base.toString; 17585 }this[a] = b; 17586 } else if (a) { 17587 var e = Base.prototype.extend;Base._prototyping || "function" == typeof this || (e = this.extend || e);for (var f = { toSource: null }, g = ["constructor", "toString", "valueOf"], h = Base._prototyping ? 0 : 1; i = g[h++];) a[i] != f[i] && e.call(this, i, a[i]);for (var i in a) f[i] || e.call(this, i, a[i]); 17588 }return this; 17589 } }, Base = Base.extend({ constructor: function constructor() { 17590 this.extend(arguments[0]); 17591 } }, { ancestor: Object, version: "1.1", forEach: function forEach(a, b, c) { 17592 for (var d in a) void 0 === this.prototype[d] && b.call(c, a[d], d, a); 17593 }, implement: function implement() { 17594 for (var a = 0; a < arguments.length; a++) "function" == typeof arguments[a] ? arguments[a](this.prototype) : this.prototype.extend(arguments[a]);return this; 17595 }, toString: function toString() { 17596 return String(this.valueOf()); 17597 } });var FlipClock;!(function (a) { 17598 "use strict";FlipClock = function (a, b, c) { 17599 return b instanceof Object && b instanceof Date == !1 && (c = b, b = 0), new FlipClock.Factory(a, b, c); 17600 }, FlipClock.Lang = {}, FlipClock.Base = Base.extend({ buildDate: "2014-10-06", version: "0.7.5", constructor: function constructor(b, c) { 17601 "object" != typeof b && (b = {}), "object" != typeof c && (c = {}), this.setOptions(a.extend(!0, {}, b, c)); 17602 }, callback: function callback(a) { 17603 if ("function" == typeof a) { 17604 for (var b = [], c = 1; c <= arguments.length; c++) arguments[c] && b.push(arguments[c]);a.apply(this, b); 17605 } 17606 }, log: function log(a) { 17607 window.console && console.log && console.log(a); 17608 }, getOption: function getOption(a) { 17609 return this[a] ? this[a] : !1; 17610 }, getOptions: function getOptions() { 17611 return this; 17612 }, setOption: function setOption(a, b) { 17613 this[a] = b; 17614 }, setOptions: function setOptions(a) { 17615 for (var b in a) "undefined" != typeof a[b] && this.setOption(b, a[b]); 17616 } }); 17617 })(jQuery), (function (a) { 17618 "use strict";FlipClock.Face = FlipClock.Base.extend({ autoStart: !0, dividers: [], factory: !1, lists: [], constructor: function constructor(a, b) { 17619 this.dividers = [], this.lists = [], this.base(b), this.factory = a; 17620 }, build: function build() { 17621 this.autoStart && this.start(); 17622 }, createDivider: function createDivider(b, c, d) { 17623 "boolean" != typeof c && c || (d = c, c = b);var e = ['<span class="' + this.factory.classes.dot + ' top"></span>', '<span class="' + this.factory.classes.dot + ' bottom"></span>'].join("");d && (e = ""), b = this.factory.localize(b);var f = ['<span class="' + this.factory.classes.divider + " " + (c ? c : "").toLowerCase() + '">', '<span class="' + this.factory.classes.label + '">' + (b ? b : "") + "</span>
17623", e, "</span>"], 17624 g = a(f.join(""));return this.dividers.push(g), g; 17625 }, createList: function createList(a, b) { 17626 "object" == typeof a && (b = a, a = 0);var c = new FlipClock.List(this.factory, a, b);return this.lists.push(c), c; 17627 }, reset: function reset() { 17628 this.factory.time = new FlipClock.Time(this.factor, this.factory.original ? Math.round(this.factory.original) : 0, { minimumDigits: this.factory.minimumDigits }), this.flip(this.factory.original, !1); 17629 }, appendDigitToClock: function appendDigitToClock(a) { 17630 a.$el.append(!1); 17631 }, addDigit: function addDigit(a) { 17632 var b = this.createList(a, { classes: { active: this.factory.classes.active, before: this.factory.classes.before, flip: this.factory.classes.flip } });this.appendDigitToClock(b); 17633 }, start: function start() {}, stop: function stop() {}, autoIncrement: function autoIncrement() { 17634 this.factory.countdown ? this.decrement() : this.increment(); 17635 }, increment: function increment() { 17636 this.factory.time.addSecond(); 17637 }, decrement: function decrement() { 17638 0 == this.factory.time.getTimeSeconds() ? this.factory.stop() : this.factory.time.subSecond(); 17639 }, flip: function flip(b, c) { 17640 var d = this;a.each(b, function (a, b) { 17641 var e = d.lists[a];e ? (c || b == e.digit || e.play(), e.select(b)) : d.addDigit(b); 17642 }); 17643 } }); 17644 })(jQuery), (function (a) { 17645 "use strict";FlipClock.Factory = FlipClock.Base.extend({ animationRate: 1e3, autoStart: !0, callbacks: { destroy: !1, create: !1, init: !1, interval: !1, start: !1, stop: !1, reset: !1 }, classes: { active: "flip-clock-active", before: "flip-clock-before", divider: "flip-clock-div
17645ider", dot: "flip-clock-dot", label: "flip-clock-label", flip: "flip", play: "play", wrapper: "flip-clock-wrapper" }, clockFace: "HourlyCounter", countdown: !1, defaultClockFace: "HourlyCounter", defaultLanguage: "english", $el: !1, face: !0, lang: !1, language: "english", minimumDigits: 0, original: !1, running: !1, time: !1, timer: !1, $wrapper: !1, constructor: function constructor(b, c, d) { 17646 d || (d = {}), this.lists = [], this.running = !1, this.base(d), this.$el = a(b).addClass(this.classes.wrapper), this.$wrapper = this.$el, this.original = c instanceof Date ? c : c ? Math.round(c) : 0, this.time = new FlipClock.Time(this, this.original, { minimumDigits: this.minimumDigits, animationRate: this.animationRate }), this.timer = new FlipClock.Timer(this, d), this.loadLanguage(this.language), this.loadClockFace(this.clockFace, d), this.autoStart && this.start(); 17647 }, loadClockFace: function loadClockFace(a, b) { 17648 var c, 17649 d = "Face", 17650 e = !1;return a = a.ucfirst() + d, this.face.stop && (this.stop(), e = !0), this.$el.html(""), this.time.minimumDigits = this.minimumDigits, c = FlipClock[a] ? new FlipClock[a](this, b) : new FlipClock[this.defaultClockFace + d](this, b), c.build(), this.face = c, e && this.start(), this.face; 17651 }, loadLanguage: function loadLanguage(a) { 17652 var b;return b = FlipClock.Lang[a.ucfirst()] ? FlipClock.Lang[a.ucfirst()] : FlipClock.Lang[a] ? FlipClock.Lang[a] : FlipClock.Lang[this.defaultLanguage], this.lang = b; 17653 }, localize: function localize(a, b) { 17654 var c = this.lang;if (!a) return null;var d = a.toLowerCase();return "object" == typeof b && (c = b), c && c[d] ? c[d] : a; 17655 }, start: function start(a) { 17656 var b = this;b.running || b.countdown && !(b.countdown && b.time.time > 0) ? b.log("Trying to start timer when countdown already at 0") : (b.face.start(b.time), b.timer.start(function () { 17657 b.flip(), "function" == typeof a && a(); 17658 })); 17659 }, stop: function stop(a) { 17660 this.face.stop(), this.timer.stop(a);for (var b in this.lists) this.lists.hasOwnProperty(b) && this.lists[b].stop(); 17661 }, reset: function reset(a) { 17662 this.timer.reset(a), this.face.reset(); 17663 }, setTime: function setTime(a) { 17664 this.time.time = a, this.flip(!0); 17665 }, getTime: function getTime() { 17666 return this.time; 17667 }, setCountdown: function setCountdown(a) { 17668 var b = this.running;this.countdown = a ? !0 : !1, b && (this.stop(), this.start()); 17669 }, flip: function flip(a) { 17670 this.face.flip(!1, a); 17671 } }); 17672 })(jQuery), (function (a) { 17673 "use strict";FlipClock.List = FlipClock.Base.extend({ digit: 0, classes: { active: "flip-clock-active", before: "flip-clock-before", flip: "flip" }, factory: !1, $el: !1, $obj: !1, items: [], lastDigit: 0, constructor: function constructor(a, b) { 17674 this.factory = a, this.digit = b, this.lastDigit = b, this.$el = this.createList(
17674), this.$obj = this.$el, b > 0 && this.select(b), this.factory.$el.append(this.$el); 17675 }, select: function select(a) { 17676 if (("undefined" == typeof a ? a = this.digit : this.digit = a, this.digit != this.lastDigit)) { 17677 var b = this.$el.find("." + this.classes.before).removeClass(this.classes.before);this.$el.find("." + this.classes.active).removeClass(this.classes.active).addClass(this.classes.before), this.appendListItem(this.classes.active, this.digit), b.remove(), this.lastDigit = this.digit; 17678 } 17679 }, play: function play() { 17680 this.$el.addClass(this.factory.classes.play); 17681 }, stop: function stop() { 17682 var a = this;setTimeout(function () { 17683 a.$el.removeClass(a.factory.classes.play); 17684 }, this.factory.timer.interval); 17685 }, createListItem: function createListItem(a, b) { 17686 return ['<li class="' + (a ? a : "") + '">', '<a href="#">', '<div class="up">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", '<div class="down">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", "</a>", "</li>"].join(""); 17687 }, appendListItem: function appendListItem(a, b) { 17688 var c = this.createListItem(a, b);this.$el.append(c); 17689 }, createList: function createList() { 17690 var b = this.getPrevDigit() ? this.getPrevDigit() : this.digit, 17691 c = a(['<ul class="' + this.classes.flip + " " + (this.factory.running ? this.factory.classes.play : "") + '">', this.createListItem(this.classes.before, b), this.createListItem(this.classes.active, this.digit), "</ul>"].join(""));return c; 17692 }, getNextDigit: function getNextDigit() { 17693 return 9 == this.digit ? 0 : this.digit + 1; 17694 }, getPrevDigit: function getPrevDigit() { 17695 return 0 == this.digit ? 9 : this.digit - 1; 17696 } }); 17697 })(jQuery), (function (a) { 17698 "use strict";String.prototype.ucfirst = function () { 17699 return this.substr(0, 1).toUpperCase() + this.substr(1); 17700 }, a.fn.FlipClock = function (b, c) { 17701 return new FlipClock(a(this), b, c); 17702 }, a.fn.flipClock = function (b, c) { 17703 return a.fn.FlipClock(b, c); 17704 }; 17705 })(jQuery), (function (a) { 17706 "use strict";FlipClock.Time = FlipClock.Base.extend({ time: 0, factory: !1, minimumDigits: 0, constructor: function constructor(a, b, c) { 17707 "object" != typeof c && (c = {}), c.minimumDigits || (c.minimumDigits = a.minimumDigits), this.base(c), this.factory = a, b && (this.time = b); 17708 }, convertDigitsToArray: function convertDigitsToArray(a) { 17709 var b = [];a = a.toString();for (var c = 0; c < a.length; c++) a[c].match(/^\d*$/g) && b.push(a[c]);return b; 17710 }, digit: function digit(a) { 17711 var b = this.toString(), 17712 c = b.length;return b[c - a] ? b[c - a] : !1; 17713 }, digitize: function digitize(b) { 17714 var c = [];if ((a.each(b, function (a, b) { 17715 b = b.toString(), 1 == b.length && (b = "0" + b);for (var d = 0; d < b.length; d++) c.push(b.charAt(d)); 17716 }), c.length > this.minimumDigits && (this.minimumDigits = c.length), this.minimumDigits > c.length)) for (var d = c.length; d < this.minimumDigits; d++) c.unshift("0");return c; 17717 }, getDateObject: function getDateObject() { 17718 return this.time instanceof Date ? this.time : new Date(new Date().getTime() + 1e3 * this.getTimeSeconds()); 17719 }, getDayCounter: function getDayCounter(a) { 17720 var b = [this.getDays(), this.getHours(!0), this.getMinutes(!0)];return a && b.push(this.getSeconds(!0)), this.digitize(b); 17721 }, getDays: function getDays(a) { 17722 var b = this.getTimeSeconds() / 60 / 60 / 24;return a && (b %= 7), Math.floor(b); 17723 }, getHourCounter: function getHourCounter() { 17724 var a = this.digitize([this.getHours(), this.getMinutes(!0), this.get
17724Seconds(!0)]);return a; 17725 }, getHourly: function getHourly() { 17726 return this.getHourCounter(); 17727 }, getHours: function getHours(a) { 17728 var b = this.getTimeSeconds() / 60 / 60;return a && (b %= 24), Math.floor(b); 17729 }, getMilitaryTime: function getMilitaryTime(a, b) { 17730 "undefined" == typeof b && (b = !0), a || (a = this.getDateObject());var c = [a.getHours(), a.getMinutes()];return b === !0 && c.push(a.getSeconds()), this.digitize(c); 17731 }, getMinutes: function getMinutes(a) { 17732 var b = this.getTimeSeconds() / 60;return a && (b %= 60), Math.floor(b); 17733 }, getMinuteCounter: function getMinuteCounter() { 17734 var a = this.digitize([this.getMinutes(), this.getSeconds(!0)]);return a; 17735 }, getTimeSeconds: function getTimeSeconds(a) { 17736 return a || (a = new Date()), this.time instanceof Date ? this.factory.countdown ? Math.max(this.time.getTime() / 1e3 - a.getTime() / 1e3, 0) : a.getTime() / 1e3 - this.time.getTime() / 1e3 : this.time; 17737 }, getTime: function getTime(a, b) { 17738 "undefined" == typeof b && (b = !0), a || (a = this.getDateObject()), console.log(a);var c = a.getHours(), 17739 d = [c > 12 ? c - 12 : 0 === c ? 12 : c, a.getMinutes()];return b === !0 && d.push(a.getSeconds()), this.digitize(d); 17740 }, getSeconds: function getSeconds(a) { 17741 var b = this.getTimeSeconds();return a && (60 == b ? b = 0 : b %= 60), Math.ceil(b); 17742 }, getWeeks: function getWeeks(a) { 17743 var b = this.getTimeSeconds() / 60 / 60 / 24 / 7;return a && (b %= 52), Math.floor(b); 17744 }, removeLeadingZeros: function removeLeadingZeros(b, c) { 17745 var d = 0, 17746 e = [];return a.each(c, function (a) { 17747 b > a ? d += parseInt(c[a], 10) : e.push(c[a]); 17748 }), 0 === d ? e : c; 17749 }, addSeconds: function addSeconds(a) { 17750 this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() + a) : this.time += a; 17751 }, addSecond: function addSecond() { 17752 this.addSeconds(1); 17753 }, subSeconds: function subSeconds(a) { 17754 this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() - a) : this.time -= a; 17755 }, subSecond: function subSecond() { 17756 this.subSeconds(1); 17757 }, toString: function toString() { 17758 return this.getTimeSeconds().toString(); 17759 } }); 17760 })(jQuery), (function () { 17761 "use strict";FlipClock.Timer = FlipClock.Base.extend({ callbacks: { destroy: !1, create: !1, init: !1, interval: !1, start: !1, stop: !1, reset: !1 }, count: 0, factory: !1, interval: 1e3, animationRate: 1e3, constructor: function constructor(a, b) { 17762 this.base(b), this.factory = a, this.callback(this.callbacks.init), this.callback(this.callbacks.create); 17763 }, getElapsed: function getElapsed() { 17764 return this.count * this.interval; 17765 }, getElapsedTime: function getElapsedTime() { 17766 return new Date(this.time + this.getElapsed()); 17767 }, reset: function reset(a) { 17768 clearInterval(this.timer), this.count = 0, this._setInterval(a), this.callback(this.callbacks.reset); 17769 }, start: function start(a) { 17770 this.factory.running = !0, this._createTimer(a), this.callback(this.callbacks.start); 17771 }, stop: function stop(a) { 17772 this.factory.running = !1, this._clearInterval(a), this.callback(this.callbacks.stop), this.callback(a); 17773 }, _clearInterval: function _clearInterval() { 17774 clearInterval(this.timer); 17775 }, _createTimer: function _createTimer(a) { 17776 this._setInterval(a); 17777 }, _destroyTimer: function _destroyTimer(a) { 17778 this._clearInterval(), this.timer = !1, this.callback(a), this.callback(this.callbacks.destroy); 17779 }, _interval: function _interval(a) { 17780 this.callback(this.callbacks.interval), this.callback(a), this.count++; 17781 }, _setInterval: function _setInterval(a) { 17782 var b = this;b._interval(a), b.timer = setInterval(function () { 17783 b._interval(a); 17784 }, this.interval); 17785 } }); 17786 })(jQuery), (function (a) { 17787 FlipClock.TwentyFourHourClockFace = FlipClock.Face.extend({ constructor: function constructor(a, b) { 17788 this.base(a, b); 17789 }, build: function build(b) { 17790 var c = this, 17791 d = this.factory.$el.find("ul");this.factory.time.time || (this.factory.original = new Date(), this.factory.time = new FlipClock.Time(this.factory, this.factory.original));var b = b ? b : this.factory.time.getMilitaryTime(!1, this.showSeconds);b.length > d.length && a.each(b, function (a, b) { 17792 c.createList(b); 17793 }), this.createDivider(), this.createDivider(), a(this.dividers[0]).insertBefore(this.lists[this.lists.length - 2].$el), a(this.dividers[1]).insertBefore(this.lists[this.lists.length - 4].$el), this.base(); 17794 }, flip: function flip(a, b) { 17795 this.autoIncrement(), a = a ? a : this.factory.time.getMilitaryTime(!1, this.showSeconds), this.base(a, b); 17796 } }); 17797 })(jQuery), (function (a) { 17798 FlipClock.CounterFace = FlipClock.Face.extend({ shouldAutoIncrement: !1, constructor: function constructor(a, b) { 17799 "object" != typeof b && (b = {}), a.autoStart = b.autoStart ? !0 : !1, b.autoStart && (this.shouldAutoIncrement = !0), a.increment = function () { 17800 a.countdown = !1, a.setTime(a.getTime().getTimeSeconds() + 1); 17801 }, a.decrement = function () { 17802 a.countdown = !0;var b = a.getTime().getTimeSeconds();b > 0 && a.setTime(b - 1); 17803 }, a.setValue = function (b) { 17804 a.setTime(b); 17805 }, a.setCounter = function (b) { 17806 a.setTime(b); 17807 }, this.base(a, b); 17808 }, build: function build() { 17809 var b = this, 17810 c = this.factory.$el.find("ul"), 17811 d = this.factory.getTime().digitize([this.factory.getTime().time]);d.length > c.length && a.each(d, function (a, c) { 17812 var d = b.createList(c);d.select(c); 17813 }), a.each(this.lists, function (a, b) { 17814 b.play(); 17815 }), this.base(); 17816 }, flip: function flip(a, b) { 17817 this.shouldAutoIncrement && this.autoIncrement(), a || (a = this.factory.getTime().digitize([this.factory.getTime().time])), this.base(a, b); 17818 }, reset: function reset() { 17819 this.factory.time = new FlipClock.Time(this.factory, this.factory.original ? Math.round(this.factory.original) : 0), this.flip(); 17820 } }); 17821 })(jQuery), (function (a) { 17822 FlipClock.DailyCounterFace = FlipClock.Face.extend({ showSeconds: !0, constructor: function constructor(a, b) { 17823 this.base(a, b); 17824 }, build: function build(b) { 17825 var c = this, 17826 d = this.factory.$el.find("ul"), 17827 e = 0;b = b ? b : this.factory.time.getDayCounter(this.showSeconds), b.length > d.length && a.each(b, function (a, b) { 17828 c.createList(b); 17829 }), this.showSeconds ? a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length - 2].$el) : e = 2, a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length - 4 + e].$el), a(this.createDivider("Hours")).insertBefore(this.lists[this.lists.length - 6 + e].$el), a(this.createDivider("Days", !0)).insertBefore(this.lists[0].$el), this.base(); 17830 }, flip: function flip(a, b) { 17831 a || (a = this.factory.time.getDayCounter(this.showSeconds)), this.autoIncrement(), this.base(a, b); 17832 } }); 17833 })(jQuery), (function (a) { 17834 FlipClock.HourlyCounterFace = FlipClock.Face.extend({ constructor: function constructor(a, b) { 17835 this.base(a, b); 17836 }, build: function build(b, c) { 17837 var d = this, 17838 e = this.factory.$el.find("ul");c = c ? c : this.factory.time.getHourCounter(), c.length > e.length && a.each(c, function (a, b) { 17839 d.createList(b); 17840 }), a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length - 2].$el), a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length - 4].$el), b || a(this.createDivider("Hours", !0)).insertBefore(this.lists[0].$el), this.base(); 17841 }, flip: function flip(a, b) { 17842 a || (a = this.factory.time.getHourCounter()), this.autoIncrement(), this.base(a, b); 17843 }, appendDigitToClock: function appendDigitToClock(a) { 17844 this.base(a), this.dividers[0].insertAfter(this.dividers[0].next()); 17845 } }); 17846 })(jQuery), (function () {
17847 FlipClock.MinuteCounterFace = FlipClock.HourlyCounterFace.extend({ clearExcessDigits: !1, constructor: function constructor(a, b) { 17848 this.base(a, b); 17849 }, build: function build() { 17850 this.base(!0, this.factory.time.getMinuteCounter()); 17851 }, flip: function flip(a, b) { 17852 a || (a = this.factory.time.getMinuteCounter()), this.base(a, b); 17853 } }); 17854 })(jQuery), (function (a) { 17855 FlipClock.TwelveHourClockFace = FlipClock.TwentyFourHourClockFace.extend({ meridium: !1, meridiumText: "AM", build: function build() { 17856 var b = this.factory.time.getTime(!1, this.showSeconds);this.base(b), this.meridiumText = this.getMeridium(), this.meridium = a(['<ul class="flip-clock-meridium">', "<li>", '<a href="#">' + this.meridiumText + "</a>", "</li>", "</ul>"].join("")), this.meridium.insertAfter(this.lists[this.lists.length - 1].$el); 17857 }, flip: function flip(a, b) { 17858 this.meridiumText != this.getMeridium() && (this.meridiumText = this.getMeridium(), this.meridium.find("a").html(this.meridiumText)), this.base(this.factory.time.getTime(!1, this.showSeconds), b); 17859 }, getMeridium: function getMeridium() { 17860 return new Date().getHours() >= 12 ? "PM" : "AM"; 17861 }, isPM: function isPM() { 17862 return "PM" == this.getMeridium() ? !0 : !1; 17863 }, isAM: function isAM() { 17864 return "AM" == this.getMeridium() ? !0 : !1; 17865 } }); 17866 })(jQuery), (function () { 17867 FlipClock.Lang.Arabic = { years: "سÙÙØ§Øª", months: "Ø´ÙÙØ±", days: "Ø£ÙØ§Ù ", hours: "ساعات", minutes: "Ø¯ÙØ§Ø¦Ù", seconds: "Ø«ÙØ§ÙÙ" }, FlipClock.Lang.ar = FlipClock.Lang.Arabic, FlipClock.Lang["ar-ar"] = FlipClock.Lang.Arabic, FlipClock.Lang.arabic = FlipClock.Lang.Arabic; 17868 })(jQuery), (function () { 17869 FlipClock.Lang.Danish = { years: "à r", months: "MÃ¥neder", days: "Dage", hours: "Timer", minutes: "Minutter", seconds: "Sekunder" }, FlipClock.Lang.da = FlipClock.Lang.Danish, FlipClock.Lang["da-dk"] = FlipClock.Lang.Danish, FlipClock.Lang.danish = FlipClock.Lang.Danish; 17870 })(jQuery), (function () { 17871 FlipClock.Lang.German = { years: "Jahre", months: "Monate", days: "Tage", hours: "Stunden", minutes: "Minuten", seconds: "Sekunden" }, FlipClock.Lang.de = FlipClock.Lang.German, FlipClock.Lang["de-de"] = FlipClock.Lang.German, FlipClock.Lang.german = FlipClock.Lang.German; 17872 })(jQuery), (function () { 17873 FlipClock.Lang.English = { years: "Years", months: "Months", days: "Days", hours: "Hours", minutes: "Minutes", seconds: "Seconds" }, FlipClock.Lang.en = FlipClock.Lang.English, FlipClock.Lang["en-us"] = FlipClock.Lang.English, FlipClock.Lang.english = FlipClock.Lang.English; 17874 })(jQuery), (function () { 17875 FlipClock.Lang.Spanish = { years: "Años", months: "Meses", days: "DÍas", hours: "Horas", minutes: "Minutos", seconds: "Segundo" }, FlipClock.Lang.es = FlipClock.Lang.Spanish, FlipClock.Lang["es-es"] = FlipClock.Lang.Spanish, FlipClock.Lang.spanish = FlipClock.Lang.Spanish; 17876 })(jQuery), (function () { 17877 FlipClock.Lang.Finnish = { years: "Vuotta", months: "Kuukautta", days: "Päivää", hours: "Tuntia", minutes: "Minuuttia", seconds: "Sekuntia" }, FlipClock.Lang.fi = FlipClock.Lang.Finnish, FlipClock.Lang["fi-fi"] = FlipClock.Lang.Finnish, FlipClock.Lang.finnish = FlipClock.Lang.Finnish; 17878 })(jQuery), (function () { 17879 FlipClock.Lang.French = { years: "Ans", months: "Mois", days: "Jours", hours: "Heures", minutes: "Minutes", seconds: "Secondes" }, FlipClock.Lang.fr = FlipClock.Lang.French, FlipClock.Lang["fr-ca"] = FlipClock.Lang.French, FlipClock.Lang.french = FlipClock.Lang.French; 17880 })(jQuery), (function () { 17881 FlipClock.Lang.Italian = { years: "Anni", months: "Mesi", days: "Giorni", hours: "Ore", minutes: "Minuti", seconds: "Secondi" }, FlipClock.Lang.it = FlipClock.Lang.Italian, FlipClock.Lang["it-it"] = FlipClock.Lang.Italian, FlipClock.Lang.italian = FlipClock.Lang.Italian; 17882 })(jQuery), (function () { 17883 FlipClock.Lang.Latvian = { years: "Gadi", months: "MÄneÅ¡i", days: "Dienas", hours: "Stundas", minutes: "MinÅ«tes", seconds: "Sekundes" }, FlipClock.Lang.lv = FlipClock.Lang.Latvian, FlipClock.Lang["lv-lv"] = FlipClock.Lang.Latvian, FlipClock.Lang.latvian = FlipClock.Lang.Latvian; 17884 })(jQuery), (function () { 17885 FlipClock.Lang.Dutch = { years: "Jaren", months: "Maanden", days: "Dagen", hours: "Uren", minutes: "Minuten", seconds: "Seconden" }, FlipClock.Lang.nl = FlipClock.Lang.Dutch, FlipClock.Lang["nl-be"] = FlipClock.Lang.Dutch, FlipClock.Lang.dutch = FlipClock.Lang.Dutch; 17886 })(jQuery), (function () {
17887 FlipClock.Lang.Norwegian = { years: "à r", months: "MÃ¥neder", days: "Dager", hours: "Timer", minutes: "Minutter", seconds: "Sekunder" }, FlipClock.Lang.no = FlipClock.Lang.Norwegian, FlipClock.Lang.nb = FlipClock.Lang.Norwegian, FlipClock.Lang["no-nb"] = FlipClock.Lang.Norwegian, FlipClock.Lang.norwegian = FlipClock.Lang.Norwegian; 17888 })(jQuery), (function () { 17889 FlipClock.Lang.Portuguese = { years: "Anos", months: "Meses", days: "Dias", hours: "Horas", minutes: "Minutos", seconds: "Segundos" }, FlipClock.Lang.pt = FlipClock.Lang.Portuguese, FlipClock.Lang["pt-br"] = FlipClock.Lang.Portuguese, FlipClock.Lang.portuguese = FlipClock.Lang.Portuguese; 17890 })(jQuery), (function () { 17891 FlipClock.Lang.Russian = { years: "леÑ", months: "меÑÑÑев", days: "дней", hours: "ÑаÑов", minutes: "минÑÑ", seconds: "ÑекÑнд" }, FlipClock.Lang.ru = FlipClock.Lang.Russian, FlipClock.Lang["ru-ru"] = FlipClock.Lang.Russian, FlipClock.Lang.russian = FlipClock.Lang.Russian; 17892 })(jQuery), (function () { 17893 FlipClock.Lang.Swedish = { years: "à r", months: "MÃ¥nader", days: "Dagar", hours: "Timmar", minutes: "Minuter", seconds: "Sekunder" }, FlipClock.Lang.sv = FlipClock.Lang.Swedish, FlipClock.Lang["sv-se"] = FlipClock.Lang.Swedish, FlipClock.Lang.swedish = FlipClock.Lang.Swedish; 17894 })(jQuery); 17895 17896/***/ }), 17897/* 361 */ 17898/***/ (function(module, exports, __webpack_require__) { 17899 17900 'use strict'; 17901 17902 Object.defineProperty(exports, "__esModule", { 17903 value: true 17904 }); 17905 17906 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 17907 17908 var _sister = __webpack_require__(362); 17909 17910 var _sister2 = _interopRequireDefault(_sister); 17911 17912 var _loadYouTubeIframeApi = __webpack_require__(363); 17913 17914 var _loadYouTubeIframeApi2 = _interopRequireDefault(_loadYouTubeIframeApi); 17915 17916 var _YouTubePlayer = __webpack_require__(365); 17917 17918 var _YouTubePlayer2 = _interopRequireDefault(_YouTubePlayer); 17919 17920 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 17921 17922 /** 17923 * @typedef YT.Player 17924 * @see https://developers.google.com/youtube/iframe_api_reference 17925 * */ 17926 17927 /** 17928 * @see https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player 17929 */ 17930 var youtubeIframeAPI = void 0; 17931 17932 /** 17933 * A factory function used to produce an instance of YT.Player and queue function calls and proxy events of the resulting object. 17934 * 17935 * @param maybeElementId Either An existing YT.Player instance, 17936 * the DOM element or the id of the HTML element where the API will insert an <iframe>. 17937 * @param options See `options` (Ignored when using an existing YT.Player instance). 17938 * @param strictState A flag designating whether or not to wait for 17939 * an acceptable state when calling supported functions. Default: `false`. 17940 * See `FunctionStateMap.js` for supported functions and acceptable states. 17941 */ 17942 17943 exports.default = function (maybeElementId) { 17944 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 17945 var strictState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 17946 17947 var emitter = (0, _sister2.default)(); 17948 17949 if (!youtubeIframeAPI) { 17950 youtubeIframeAPI = (0, _loadYouTubeIframeApi2.default)(emitter); 17951 } 17952 17953 if (options.events) { 17954 throw new Error('Event handlers cannot be overwritten.'); 17955 } 17956 17957 if (typeof maybeElementId === 'string' && !document.getElementById(maybeElementId)) { 17958 throw new Error('Element "' + maybeElementId + '" does not exist.'); 17959 } 17960 17961 options.events = _YouTubePlayer2.default.proxyEvents(emitter); 17962 17963 var playerAPIReady = new Promise(function (resolve) { 17964 if ((typeof maybeElementId === 'undefined' ? 'undefined' : _typeof(maybeElementId)) === 'object' && maybeElementId.playVideo instanceof Function) { 17965 var player = maybeElementId; 17966 17967 resolve(player); 17968 } else { 17969 // asume maybeElementId can be rendered inside 17970 // eslint-disable-next-line promise/catch-or-return 17971 youtubeIframeAPI.then(function (YT) { 17972 // eslint-disable-line promise/prefer-await-to-then 17973 var player = new YT.Player(maybeElementId, options); 17974 17975 emitter.on('ready', function () { 17976 resolve(player); 17977 }); 17978 17979 return null; 17980 }); 17981 } 17982 }); 17983 17984 var playerApi = _YouTubePlayer2.default.promisifyPlayer(playerAPIReady, strictState); 17985 17986 playerApi.on = emitter.on; 17987 playerApi.off = emitter.off; 17988 17989 return playerApi; 17990 }; 17991 17992 module.exports = exports['default']; 17993 17994/***/ }), 17995/* 362 */
17996/***/ (function(module, exports) { 17997 17998 'use strict'; 17999 18000 var Sister; 18001 18002 /** 18003 * @link https://github.com/gajus/sister for the canonical source repository 18004 * @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause 18005 */ 18006 Sister = function () { 18007 var sister = {}, 18008 events = {}; 18009 18010 /** 18011 * @name handler 18012 * @function 18013 * @param {Object} data Event data. 18014 */ 18015 18016 /** 18017 * @param {String} name Event name. 18018 * @param {handler} handler 18019 * @return {listener} 18020 */ 18021 sister.on = function (name, handler) { 18022 var listener = {name: name, handler: handler}; 18023 events[name] = events[name] || []; 18024 events[name].unshift(listener); 18025 return listener; 18026 }; 18027 18028 /** 18029 * @param {listener} 18030 */ 18031 sister.off = function (listener) { 18032 var index = events[listener.name].indexOf(listener); 18033 18034 if (index !== -1) { 18035 events[listener.name].splice(index, 1); 18036 } 18037 }; 18038 18039 /** 18040 * @param {String} name Event name. 18041 * @param {Object} data Event data. 18042 */ 18043 sister.trigger = function (name, data) { 18044 var listeners = events[name], 18045 i; 18046 18047 if (listeners) { 18048 i = listeners.length; 18049 while (i--) { 18050 listeners[i].handler(data); 18051 } 18052 } 18053 }; 18054 18055 return sister; 18056 }; 18057 18058 module.exports = Sister; 18059 18060 18061/***/ }), 18062/* 363 */ 18063/***/ (function(module, exports, __webpack_require__) { 18064 18065 'use strict'; 18066 18067 Object.defineProperty(exports, "__esModule", { 18068 value: true 18069 }); 18070 18071 var _loadScript = __webpack_require__(364); 18072 18073 var _loadScript2 = _interopRequireDefault(_loadScript); 18074 18075 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 18076 18077 exports.default = function (emitter) { 18078 /** 18079 * A promise that is resolved when window.onYouTubeIframeAPIReady is called. 18080 * The promise is resolved with a reference to window.YT object. 18081 */ 18082 var iframeAPIReady = new Promise(function (resolve) { 18083 if (window.YT && window.YT.Player && window.YT.Player instanceof Function) { 18084 resolve(window.YT); 18085 18086 return; 18087 } else { 18088 var protocol = window.location.protocol === 'http:' ? 'http:' : 'https:'; 18089 18090 (0, _loadScript2.default)(protocol + '//www.youtube.com/iframe_api', function (error) { 18091 if (error) { 18092 emitter.trigger('error', error); 18093 } 18094 }); 18095 } 18096 18097 var previous = window.onYouTubeIframeAPIReady; 18098 18099 // The API will call this function when page has finished downloading 18100 // the JavaScript for the player API. 18101 window.onYouTubeIframeAPIReady = function () { 18102 if (previous) { 18103 previous(); 18104 } 18105 18106 resolve(window.YT); 18107 }; 18108 }); 18109 18110 return iframeAPIReady; 18111 }; 18112 18113 module.exports = exports['default']; 18114 18115/***/ }), 18116/* 364 */ 18117/***/ (function(module, exports) { 18118 18119 18120 module.exports = function load (src, opts, cb) { 18121 var head = document.head || document.getElementsByTagName('head')[0] 18122 var script = document.createElement('script') 18123 18124 if (typeof opts === 'function') { 18125 cb = opts 18126 opts = {} 18127 } 18128 18129 opts = opts || {} 18130 cb = cb || function() {} 18131 18132 script.type = opts.type || 'text/javascript' 18133 script.charset = opts.charset || 'utf8'; 18134 script.async = 'async' in opts ? !!opts.async : true 18135 script.src = src 18136 18137 if (opts.attrs) { 18138 setAttributes(script, opts.attrs) 18139 } 18140 18141 if (opts.text) { 18142 script.text = '' + opts.text 18143 } 18144 18145 var onend = 'onload' in script ? stdOnEnd : ieOnEnd 18146 onend(script, cb) 18147 18148 // some good legacy browsers (firefox) fail the 'in' detection above 18149 // so as a fallback we always set onload 18150 // old IE will ignore this and new IE will set onload 18151 if (!script.onload) { 18152 stdOnEnd(script, cb); 18153 } 18154 18155 head.appendChild(script) 18156 } 18157 18158 function setAttributes(script, attrs) { 18159 for (var attr in attrs) { 18160 script.setAttribute(attr, attrs[attr]); 18161 } 18162 } 18163 18164 function stdOnEnd (script, cb) { 18165 script.onload = function () { 18166 this.onerror = this.onload = null 18167 cb(null, script) 18168 } 18169 script.onerror = function () { 18170 // this.onload = null here is necessary 18171 // because even IE9 works not like others 18172 this.onerror = this.onload = null
18173 cb(new Error('Failed to load ' + this.src), script) 18174 } 18175 } 18176 18177 function ieOnEnd (script, cb) { 18178 script.onreadystatechange = function () { 18179 if (this.readyState != 'complete' && this.readyState != 'loaded') return 18180 this.onreadystatechange = null 18181 cb(null, script) // there is no way to catch loading errors in IE8 18182 } 18183 } 18184 18185 18186/***/ }), 18187/* 365 */ 18188/***/ (function(module, exports, __webpack_require__) { 18189 18190 'use strict'; 18191 18192 Object.defineProperty(exports, "__esModule", { 18193 value: true 18194 }); 18195 18196 var _debug = __webpack_require__(366); 18197 18198 var _debug2 = _interopRequireDefault(_debug); 18199 18200 var _functionNames = __webpack_require__(370); 18201 18202 var _functionNames2 = _interopRequireDefault(_functionNames); 18203 18204 var _eventNames = __webpack_require__(371); 18205 18206 var _eventNames2 = _interopRequireDefault(_eventNames); 18207 18208 var _FunctionStateMap = __webpack_require__(372); 18209 18210 var _FunctionStateMap2 = _interopRequireDefault(_FunctionStateMap); 18211 18212 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 18213 18214 /* eslint-disable promise/prefer-await-to-then */ 18215 18216 var debug = (0, _debug2.default)('youtube-player'); 18217 18218 var YouTubePlayer = {}; 18219 18220 /** 18221 * Construct an object that defines an event handler for all of the YouTube 18222 * player events. Proxy captured events through an event emitter. 18223 * 18224 * @todo Capture event parameters. 18225 * @see https://developers.google.com/youtube/iframe_api_reference#Events 18226 */ 18227 YouTubePlayer.proxyEvents = function (emitter) { 18228 var events = {}; 18229 18230 var _loop = function _loop(eventName) { 18231 var onEventName = 'on' + eventName.slice(0, 1).toUpperCase() + eventName.slice(1); 18232 18233 events[onEventName] = function (event) { 18234 debug('event "%s"', onEventName, event); 18235 18236 emitter.trigger(eventName, event); 18237 }; 18238 }; 18239 18240 var _iteratorNormalCompletion = true; 18241 var _didIteratorError = false; 18242 var _iteratorError = undefined; 18243 18244 try { 18245 for (var _iterator = _eventNames2.default[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { 18246 var eventName = _step.value; 18247 18248 _loop(eventName); 18249 } 18250 } catch (err) { 18251 _didIteratorError = true; 18252 _iteratorError = err; 18253 } finally { 18254 try { 18255 if (!_iteratorNormalCompletion && _iterator.return) { 18256 _iterator.return(); 18257 } 18258 } finally { 18259 if (_didIteratorError) { 18260 throw _iteratorError; 18261 } 18262 } 18263 } 18264 18265 return events; 18266 }; 18267 18268 /** 18269 * Delays player API method execution until player state is ready. 18270 * 18271 * @todo Proxy all of the methods using Object.keys. 18272 * @todo See TRICKY below. 18273 * @param playerAPIReady Promise that resolves when player is ready. 18274 * @param strictState A flag designating whether or not to wait for 18275 * an acceptable state when calling supported functions. 18276 * @returns {Object} 18277 */ 18278 YouTubePlayer.promisifyPlayer = function (playerAPIReady) { 18279 var strictState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 18280 18281 var functions = {}; 18282 18283 var _loop2 = function _loop2(functionName) { 18284 if (strictState && _FunctionStateMap2.default[functionName]) { 18285 functions[functionName] = function () { 18286 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 18287 args[_key] = arguments[_key]; 18288 } 18289 18290 return playerAPIReady.then(function (player) { 18291 var stateInfo = _FunctionStateMap2.default[functionName]; 18292 var playerState = player.getPlayerState(); 18293 18294 // eslint-disable-next-line no-warning-comments 18295 // TODO: Just spread the args into the function once Babel is fixed: 18296 // https://github.com/babel/babel/issues/4270 18297 // 18298 // eslint-disable-next-line prefer-spread 18299 var value = player[functionName].apply(player, args); 18300 18301 // TRICKY: For functions like `seekTo`, a change in state must be 18302 // triggered given that the resulting state could match the initial 18303 // state. 18304 if (stateInfo.stateChangeRequired || 18305 18306 // eslint-disable-next-line no-extra-parens 18307 Array.isArray(stateInfo.acceptableStates) && stateInfo.acceptableStates.indexOf(playerState) === -1) { 18308 return new Promise(function (resolve) { 18309 var onPlayerStateChange = function onPlayerStateChange() { 18310 var playerStateAfterChange = player.getPlayerState(); 18311 18312 var timeout = void 0; 18313 18314 if (typeof stateInfo.timeout === 'number') { 18315 timeout = setTimeout(function () { 18316 player.removeEventListener('onStateChange', onPlayerStateChange); 18317 18318 resolve(); 18319 }, stateInfo.timeout); 18320 } 18321 18322 if (Array.isArray(stateInfo.acceptableStates) && stateInfo.acceptableStates.indexOf(playerStateAfterChange) !== -1) { 18323 player.removeEventListener('onStateChange', onPlayerStateChange); 18324 18325 clearTimeout(timeout); 18326 18327 resolve(); 18328 } 18329 }; 18330 18331 player.addEventListener('onStateChange', onPlayerStateChange); 18332 }).then(function () { 18333 return value; 18334 }); 18335 } 18336 18337 return value; 18338 }); 18339 }; 18340 } else { 18341 functions[functionName] = function () { 18342 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 18343 args[_key2] = arguments[_key2]; 18344 } 18345 18346 return playerAPIReady.then(function (player) { 18347 // eslint-disable-next-line no-warning-comments 18348 // TODO: Just spread the args into the function once Babel is fixed: 18349 // https://github.com/babel/babel/issues/4270 18350 // 18351 // eslint-disable-next-line prefer-spread 18352 return player[functionName].apply(player, args); 18353 }); 18354 }; 18355 } 18356 }; 18357 18358 var _iteratorNormalCompletion2 = true; 18359 var _didIteratorError2 = false;
vendor: 5,859 bytes, lines 18360-18582
18360 var _iteratorError2 = undefined; 18361 18362 try { 18363 for (var _iterator2 = _functionNames2.default[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { 18364 var functionName = _step2.value; 18365 18366 _loop2(functionName); 18367 } 18368 } catch (err) { 18369 _didIteratorError2 = true; 18370 _iteratorError2 = err; 18371 } finally { 18372 try { 18373 if (!_iteratorNormalCompletion2 && _iterator2.return) { 18374 _iterator2.return(); 18375 } 18376 } finally { 18377 if (_didIteratorError2) { 18378 throw _iteratorError2; 18379 } 18380 } 18381 } 18382 18383 return functions; 18384 }; 18385 18386 exports.default = YouTubePlayer; 18387 module.exports = exports['default']; 18388 18389/***/ }), 18390/* 366 */ 18391/***/ (function(module, exports, __webpack_require__) { 18392 18393 /* WEBPACK VAR INJECTION */(function(process) {/** 18394 * This is the web browser implementation of `debug()`. 18395 * 18396 * Expose `debug()` as the module. 18397 */ 18398 18399 exports = module.exports = __webpack_require__(368); 18400 exports.log = log; 18401 exports.formatArgs = formatArgs; 18402 exports.save = save; 18403 exports.load = load; 18404 exports.useColors = useColors; 18405 exports.storage = 'undefined' != typeof chrome 18406 && 'undefined' != typeof chrome.storage 18407 ? chrome.storage.local 18408 : localstorage(); 18409 18410 /** 18411 * Colors. 18412 */ 18413 18414 exports.colors = [ 18415 'lightseagreen', 18416 'forestgreen', 18417 'goldenrod', 18418 'dodgerblue', 18419 'darkorchid', 18420 'crimson' 18421 ]; 18422 18423 /** 18424 * Currently only WebKit-based Web Inspectors, Firefox >= v31, 18425 * and the Firebug extension (any Firefox version) are known 18426 * to support "%c" CSS customizations. 18427 * 18428 * TODO: add a `localStorage` variable to explicitly enable/disable colors 18429 */ 18430 18431 function useColors() { 18432 // NB: In an Electron preload script, document will be defined but not fully 18433 // initialized. Since we know we're in Chrome, we'll just detect this case 18434 // explicitly 18435 if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { 18436 return true; 18437 } 18438 18439 // is webkit? http://stackoverflow.com/a/16459606/376773 18440 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 18441 return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || 18442 // is firebug? http://stackoverflow.com/a/398120/376773 18443 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || 18444 // is firefox >= v31? 18445 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages 18446 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || 18447 // double check webkit in userAgent just in case we are in a worker 18448 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); 18449 } 18450 18451 /** 18452 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. 18453 */ 18454 18455 exports.formatters.j = function(v) { 18456 try { 18457 return JSON.stringify(v); 18458 } catch (err) { 18459 return '[UnexpectedJSONParseError]: ' + err.message; 18460 } 18461 }; 18462 18463 18464 /** 18465 * Colorize log arguments if enabled. 18466 * 18467 * @api public 18468 */ 18469 18470 function formatArgs(args) { 18471 var useColors = this.useColors; 18472 18473 args[0] = (useColors ? '%c' : '') 18474 + this.namespace 18475 + (useColors ? ' %c' : ' ') 18476 + args[0] 18477 + (useColors ? '%c ' : ' ') 18478 + '+' + exports.humanize(this.diff); 18479 18480 if (!useColors) return; 18481 18482 var c = 'color: ' + this.color; 18483 args.splice(1, 0, c, 'color: inherit') 18484 18485 // the final "%c" is somewhat tricky, because there could be other 18486 // arguments passed either before or after the %c, so we need to 18487 // figure out the correct index to insert the CSS into 18488 var index = 0; 18489 var lastC = 0; 18490 args[0].replace(/%[a-zA-Z%]/g, function(match) { 18491 if ('%%' === match) return; 18492 index++; 18493 if ('%c' === match) { 18494 // we only are interested in the *last* %c 18495 // (the user may have provided their own) 18496 lastC = index; 18497 } 18498 }); 18499 18500 args.splice(lastC, 0, c); 18501 } 18502 18503 /** 18504 * Invokes `console.log()` when available. 18505 * No-op when `console.log` is not a "function". 18506 * 18507 * @api public 18508 */ 18509 18510 function log() { 18511 // this hackery is required for IE8/9, where 18512 // the `console.log` function doesn't have 'apply' 18513 return 'object' === typeof console 18514 && console.log 18515 && Function.prototype.apply.call(console.log, console, arguments); 18516 } 18517 18518 /** 18519 * Save `namespaces`. 18520 * 18521 * @param {String} namespaces 18522 * @api private 18523 */ 18524 18525 function save(namespaces) { 18526 try { 18527 if (null == namespaces) { 18528 exports.storage.removeItem('debug'); 18529 } else { 18530 exports.storage.debug = namespaces; 18531 } 18532 } catch(e) {} 18533 } 18534 18535 /** 18536 * Load `namespaces`. 18537 * 18538 * @return {String} returns the previously persisted debug modes 18539 * @api private 18540 */ 18541 18542 function load() { 18543 var r; 18544 try { 18545 r = exports.storage.debug; 18546 } catch(e) {} 18547 18548 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG 18549 if (!r && typeof process !== 'undefined' && 'env' in process) { 18550 r = process.env.DEBUG; 18551 } 18552 18553 return r; 18554 } 18555 18556 /** 18557 * Enable namespaces listed in `localStorage.debug` initially. 18558 */ 18559 18560 exports.enable(load()); 18561 18562 /** 18563 * Localstorage attempts to return the localstorage. 18564 * 18565 * This is necessary because safari throws 18566 * when a user disables cookies/localstorage 18567 * and you attempt to access it. 18568 * 18569 * @return {LocalStorage} 18570 * @api private 18571 */ 18572 18573 function localstorage() { 18574 try { 18575 return window.localStorage; 18576 } catch (e) {} 18577 } 18578 18579 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(367))) 18580 18581/***/ }), 18582/* 367
vendor: 5,657 bytes, lines 18582-18772
18582 */ 18583/***/ (function(module, exports) { 18584 18585 // shim for using process in browser 18586 var process = module.exports = {}; 18587 18588 // cached from whatever global is present so that test runners that stub it 18589 // don't break things. But we need to wrap it in a try catch in case it is 18590 // wrapped in strict mode code which doesn't define any globals. It's inside a 18591 // function because try/catches deoptimize in certain engines. 18592 18593 var cachedSetTimeout; 18594 var cachedClearTimeout; 18595 18596 function defaultSetTimout() { 18597 throw new Error('setTimeout has not been defined'); 18598 } 18599 function defaultClearTimeout () { 18600 throw new Error('clearTimeout has not been defined'); 18601 } 18602 (function () { 18603 try { 18604 if (typeof setTimeout === 'function') { 18605 cachedSetTimeout = setTimeout; 18606 } else { 18607 cachedSetTimeout = defaultSetTimout; 18608 } 18609 } catch (e) { 18610 cachedSetTimeout = defaultSetTimout; 18611 } 18612 try { 18613 if (typeof clearTimeout === 'function') { 18614 cachedClearTimeout = clearTimeout; 18615 } else { 18616 cachedClearTimeout = defaultClearTimeout; 18617 } 18618 } catch (e) { 18619 cachedClearTimeout = defaultClearTimeout; 18620 } 18621 } ()) 18622 function runTimeout(fun) { 18623 if (cachedSetTimeout === setTimeout) { 18624 //normal enviroments in sane situations 18625 return setTimeout(fun, 0); 18626 } 18627 // if setTimeout wasn't available but was latter defined 18628 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 18629 cachedSetTimeout = setTimeout; 18630 return setTimeout(fun, 0); 18631 } 18632 try { 18633 // when when somebody has screwed with setTimeout but no I.E. maddness 18634 return cachedSetTimeout(fun, 0); 18635 } catch(e){ 18636 try { 18637 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 18638 return cachedSetTimeout.call(null, fun, 0); 18639 } catch(e){ 18640 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 18641 return cachedSetTimeout.call(this, fun, 0); 18642 } 18643 } 18644 18645 18646 } 18647 function runClearTimeout(marker) { 18648 if (cachedClearTimeout === clearTimeout) { 18649 //normal enviroments in sane situations 18650 return clearTimeout(marker); 18651 } 18652 // if clearTimeout wasn't available but was latter defined 18653 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 18654 cachedClearTimeout = clearTimeout; 18655 return clearTimeout(marker); 18656 } 18657 try { 18658 // when when somebody has screwed with setTimeout but no I.E. maddness 18659 return cachedClearTimeout(marker); 18660 } catch (e){ 18661 try { 18662 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 18663 return cachedClearTimeout.call(null, marker); 18664 } catch (e){ 18665 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 18666 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 18667 return cachedClearTimeout.call(this, marker); 18668 } 18669 } 18670 18671 18672 18673 } 18674 var queue = []; 18675 var draining = false; 18676 var currentQueue; 18677 var queueIndex = -1; 18678 18679 function cleanUpNextTick() { 18680 if (!draining || !currentQueue) { 18681 return; 18682 } 18683 draining = false; 18684 if (currentQueue.length) { 18685 queue = currentQueue.concat(queue); 18686 } else { 18687 queueIndex = -1; 18688 } 18689 if (queue.length) { 18690 drainQueue(); 18691 } 18692 } 18693 18694 function drainQueue() { 18695 if (draining) { 18696 return; 18697 } 18698 var timeout = runTimeout(cleanUpNextTick); 18699 draining = true; 18700 18701 var len = queue.length; 18702 while(len) { 18703 currentQueue = queue; 18704 queue = []; 18705 while (++queueIndex < len) { 18706 if (currentQueue) { 18707 currentQueue[queueIndex].run(); 18708 } 18709 } 18710 queueIndex = -1; 18711 len = queue.length; 18712 } 18713 currentQueue = null; 18714 draining = false; 18715 runClearTimeout(timeout); 18716 } 18717 18718 process.nextTick = function (fun) { 18719 var args = new Array(arguments.length - 1); 18720 if (arguments.length > 1) { 18721 for (var i = 1; i < arguments.length; i++) { 18722 args[i - 1] = arguments[i]; 18723 } 18724 } 18725 queue.push(new Item(fun, args)); 18726 if (queue.length === 1 && !draining) { 18727 runTimeout(drainQueue); 18728 } 18729 }; 18730 18731 // v8 likes predictible objects 18732 function Item(fun, array) { 18733 this.fun = fun; 18734 this.array = array; 18735 } 18736 Item.prototype.run = function () { 18737 this.fun.apply(null, this.array); 18738 }; 18739 process.title = 'browser'; 18740 process.browser = true; 18741 process.env = {}; 18742 process.argv = []; 18743 process.version = ''; // empty string to avoid regexp issues 18744 process.versions = {}; 18745 18746 function noop() {} 18747 18748 process.on = noop; 18749 process.addListener = noop; 18750 process.once = noop; 18751 process.off = noop; 18752 process.removeListener = noop; 18753 process.removeAllListeners = noop; 18754 process.emit = noop; 18755 process.prependListener = noop; 18756 process.prependOnceListener = noop; 18757 18758 process.listeners = function (name) { return [] } 18759 18760 process.binding = function (name) { 18761 throw new Error('process.binding is not supported'); 18762 }; 18763 18764 process.cwd = function () { return '/' }; 18765 process.chdir = function (dir) { 18766 throw new Error('process.chdir is not supported'); 18767 }; 18768 process.umask = function() { return 0; }; 18769 18770 18771/***/ }), 18772/*
18772368 */ 18773/***/ (function(module, exports, __webpack_require__) { 18774 18775 18776 /** 18777 * This is the common logic for both the Node.js and web browser 18778 * implementations of `debug()`. 18779 * 18780 * Expose `debug()` as the module. 18781 */ 18782 18783 exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; 18784 exports.coerce = coerce;
vendor: 8,310 bytes, lines 18785-19155
18785 exports.disable = disable; 18786 exports.enable = enable; 18787 exports.enabled = enabled; 18788 exports.humanize = __webpack_require__(369); 18789 18790 /** 18791 * The currently active debug mode names, and names to skip. 18792 */ 18793 18794 exports.names = []; 18795 exports.skips = []; 18796 18797 /** 18798 * Map of special "%n" handling functions, for the debug "format" argument. 18799 * 18800 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". 18801 */ 18802 18803 exports.formatters = {}; 18804 18805 /** 18806 * Previous log timestamp. 18807 */ 18808 18809 var prevTime; 18810 18811 /** 18812 * Select a color. 18813 * @param {String} namespace 18814 * @return {Number} 18815 * @api private 18816 */ 18817 18818 function selectColor(namespace) { 18819 var hash = 0, i; 18820 18821 for (i in namespace) { 18822 hash = ((hash << 5) - hash) + namespace.charCodeAt(i); 18823 hash |= 0; // Convert to 32bit integer 18824 } 18825 18826 return exports.colors[Math.abs(hash) % exports.colors.length]; 18827 } 18828 18829 /** 18830 * Create a debugger with the given `namespace`. 18831 * 18832 * @param {String} namespace 18833 * @return {Function} 18834 * @api public 18835 */ 18836 18837 function createDebug(namespace) { 18838 18839 function debug() { 18840 // disabled? 18841 if (!debug.enabled) return; 18842 18843 var self = debug; 18844 18845 // set `diff` timestamp 18846 var curr = +new Date(); 18847 var ms = curr - (prevTime || curr); 18848 self.diff = ms; 18849 self.prev = prevTime; 18850 self.curr = curr; 18851 prevTime = curr; 18852 18853 // turn the `arguments` into a proper Array 18854 var args = new Array(arguments.length); 18855 for (var i = 0; i < args.length; i++) { 18856 args[i] = arguments[i]; 18857 } 18858 18859 args[0] = exports.coerce(args[0]); 18860 18861 if ('string' !== typeof args[0]) { 18862 // anything else let's inspect with %O 18863 args.unshift('%O'); 18864 } 18865 18866 // apply any `formatters` transformations 18867 var index = 0; 18868 args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { 18869 // if we encounter an escaped % then don't increase the array index 18870 if (match === '%%') return match; 18871 index++; 18872 var formatter = exports.formatters[format]; 18873 if ('function' === typeof formatter) { 18874 var val = args[index]; 18875 match = formatter.call(self, val); 18876 18877 // now we need to remove `args[index]` since it's inlined in the `format` 18878 args.splice(index, 1); 18879 index--; 18880 } 18881 return match; 18882 }); 18883 18884 // apply env-specific formatting (colors, etc.) 18885 exports.formatArgs.call(self, args); 18886 18887 var logFn = debug.log || exports.log || console.log.bind(console); 18888 logFn.apply(self, args); 18889 } 18890 18891 debug.namespace = namespace; 18892 debug.enabled = exports.enabled(namespace); 18893 debug.useColors = exports.useColors(); 18894 debug.color = selectColor(namespace); 18895 18896 // env-specific initialization logic for debug instances 18897 if ('function' === typeof exports.init) { 18898 exports.init(debug); 18899 } 18900 18901 return debug; 18902 } 18903 18904 /** 18905 * Enables a debug mode by namespaces. This can include modes 18906 * separated by a colon and wildcards. 18907 * 18908 * @param {String} namespaces 18909 * @api public 18910 */ 18911 18912 function enable(namespaces) { 18913 exports.save(namespaces); 18914 18915 exports.names = []; 18916 exports.skips = []; 18917 18918 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); 18919 var len = split.length; 18920 18921 for (var i = 0; i < len; i++) { 18922 if (!split[i]) continue; // ignore empty strings 18923 namespaces = split[i].replace(/\*/g, '.*?'); 18924 if (namespaces[0] === '-') { 18925 exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); 18926 } else { 18927 exports.names.push(new RegExp('^' + namespaces + '$')); 18928 } 18929 } 18930 } 18931 18932 /** 18933 * Disable debug output. 18934 * 18935 * @api public 18936 */ 18937 18938 function disable() { 18939 exports.enable(''); 18940 } 18941 18942 /** 18943 * Returns true if the given mode name is enabled, false otherwise. 18944 * 18945 * @param {String} name 18946 * @return {Boolean} 18947 * @api public 18948 */ 18949 18950 function enabled(name) { 18951 var i, len; 18952 for (i = 0, len = exports.skips.length; i < len; i++) { 18953 if (exports.skips[i].test(name)) { 18954 return false; 18955 } 18956 } 18957 for (i = 0, len = exports.names.length; i < len; i++) { 18958 if (exports.names[i].test(name)) { 18959 return true; 18960 } 18961 } 18962 return false; 18963 } 18964 18965 /** 18966 * Coerce `val`. 18967 * 18968 * @param {Mixed} val 18969 * @return {Mixed} 18970 * @api private 18971 */ 18972 18973 function coerce(val) { 18974 if (val instanceof Error) return val.stack || val.message; 18975 return val; 18976 } 18977 18978 18979/***/ }), 18980/* 369 */ 18981/***/ (function(module, exports) { 18982 18983 /** 18984 * Helpers. 18985 */ 18986 18987 var s = 1000; 18988 var m = s * 60; 18989 var h = m * 60; 18990 var d = h * 24; 18991 var y = d * 365.25; 18992 18993 /** 18994 * Parse or format the given `val`. 18995 * 18996 * Options: 18997 * 18998 * - `long` verbose formatting [false] 18999 * 19000 * @param {String|Number} val 19001 * @param {Object} [options] 19002 * @throws {Error} throw an error if val is not a non-empty string or a number 19003 * @return {String|Number} 19004 * @api public 19005 */ 19006 19007 module.exports = function(val, options) { 19008 options = options || {}; 19009 var type = typeof val; 19010 if (type === 'string' && val.length > 0) { 19011 return parse(val); 19012 } else if (type === 'number' && isNaN(val) === false) { 19013 return options.long ? fmtLong(val) : fmtShort(val); 19014 } 19015 throw new Error( 19016 'val is not a non-empty string or a valid number. val=' + 19017 JSON.stringify(val) 19018 ); 19019 }; 19020 19021 /** 19022 * Parse the given `str` and return milliseconds. 19023 * 19024 * @param {String} str 19025 * @return {Number} 19026 * @api private 19027 */ 19028 19029 function parse(str) { 19030 str = String(str); 19031 if (str.length > 100) { 19032 return; 19033 } 19034 var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( 19035 str 19036 ); 19037 if (!match) { 19038 return; 19039 } 19040 var n = parseFloat(match[1]); 19041 var type = (match[2] || 'ms').toLowerCase(); 19042 switch (type) { 19043 case 'years': 19044 case 'year': 19045 case 'yrs': 19046 case 'yr': 19047 case 'y': 19048 return n * y; 19049 case 'days': 19050 case 'day': 19051 case 'd': 19052 return n * d; 19053 case 'hours': 19054 case 'hour': 19055 case 'hrs': 19056 case 'hr': 19057 case 'h': 19058 return n * h; 19059 case 'minutes': 19060 case 'minute': 19061 case 'mins': 19062 case 'min': 19063 case 'm': 19064 return n * m; 19065 case 'seconds': 19066 case 'second': 19067 case 'secs': 19068 case 'sec': 19069 case 's': 19070 return n * s; 19071 case 'milliseconds': 19072 case 'millisecond': 19073 case 'msecs': 19074 case 'msec': 19075 case 'ms': 19076 return n; 19077 default: 19078 return undefined; 19079 } 19080 } 19081 19082 /** 19083 * Short format for `ms`. 19084 * 19085 * @param {Number} ms 19086 * @return {String} 19087 * @api private 19088 */ 19089 19090 function fmtShort(ms) { 19091 if (ms >= d) { 19092 return Math.round(ms / d) + 'd'; 19093 } 19094 if (ms >= h) { 19095 return Math.round(ms / h) + 'h'; 19096 } 19097 if (ms >= m) { 19098 return Math.round(ms / m) + 'm'; 19099 } 19100 if (ms >= s) { 19101 return Math.round(ms / s) + 's'; 19102 } 19103 return ms + 'ms'; 19104 } 19105 19106 /** 19107 * Long format for `ms`. 19108 * 19109 * @param {Number} ms 19110 * @return {String} 19111 * @api private 19112 */ 19113 19114 function fmtLong(ms) { 19115 return plural(ms, d, 'day') || 19116 plural(ms, h, 'hour') || 19117 plural(ms, m, 'minute') || 19118 plural(ms, s, 'second') || 19119 ms + ' ms'; 19120 } 19121 19122 /** 19123 * Pluralization helper. 19124 */ 19125 19126 function plural(ms, n, name) { 19127 if (ms < n) { 19128 return; 19129 } 19130 if (ms < n * 1.5) { 19131 return Math.floor(ms / n) + ' ' + name; 19132 } 19133 return Math.ceil(ms / n) + ' ' + name + 's'; 19134 } 19135 19136 19137/***/ }), 19138/* 370 */ 19139/***/ (function(module, exports) { 19140 19141 'use strict'; 19142 19143 Object.defineProperty(exports, "__esModule", { 19144 value: true 19145 }); 19146 19147 19148 /** 19149 * @see https://developers.google.com/youtube/iframe_api_reference#Functions 19150 */ 19151 exports.default = ['cueVideoById', 'loadVideoById', 'cueVideoByUrl', 'loadVideoByUrl', 'playVideo', 'pauseVideo', 'stopVideo', 'getVideoLoadedFraction', 'cuePlaylist', 'loadPlaylist', 'nextVideo', 'previousVideo', 'playVideoAt', 'setShuffle', 'setLoop', 'getPlaylist', 'getPlaylistIndex', 'setOption', 'mute', 'unMute', 'isMuted', 'setVolume', 'getVolume', 'seekTo', 'getPlayerState', 'getPlaybackRate', 'setPlaybackRate', 'getAvailablePlaybackRates', 'getPlaybackQuality', 'setPlaybackQuality', 'getAvailableQualityLevels', 'getCurrentTime', 'getDuration', 'removeEventListener', 'getVideoUrl', 'getVideoEmbedCode', 'getOptions', 'getOption', 'addEventListener', 'destroy', 'setSize', 'getIframe']; 19152 module.exports = exports['default']; 19153 19154/***/ }), 19155/* 371 */
19156/***/ (function(module, exports) { 19157 19158 'use strict'; 19159 19160 Object.defineProperty(exports, "__esModule", { 19161 value: true 19162 }); 19163 19164 19165 /** 19166 * @see https://developers.google.com/youtube/iframe_api_reference#Events 19167 * `volumeChange` is not officially supported but seems to work 19168 * it emits an object: `{volume: 82.6923076923077, muted: false}` 19169 */ 19170 exports.default = ['ready', 'stateChange', 'playbackQualityChange', 'playbackRateChange', 'error', 'apiChange', 'volumeChange']; 19171 module.exports = exports['default']; 19172 19173/***/ }), 19174/* 372 */ 19175/***/ (function(module, exports, __webpack_require__) { 19176 19177 'use strict'; 19178 19179 Object.defineProperty(exports, "__esModule", { 19180 value: true 19181 }); 19182 19183 var _PlayerStates = __webpack_require__(373); 19184 19185 var _PlayerStates2 = _interopRequireDefault(_PlayerStates); 19186 19187 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 19188 19189 exports.default = { 19190 pauseVideo: { 19191 acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PAUSED], 19192 stateChangeRequired: false 19193 }, 19194 playVideo: { 19195 acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING], 19196 stateChangeRequired: false 19197 }, 19198 seekTo: { 19199 acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING, _PlayerStates2.default.PAUSED], 19200 stateChangeRequired: true, 19201 19202 // TRICKY: `seekTo` may not cause a state change if no buffering is 19203 // required. 19204 timeout: 3000 19205 } 19206 }; 19207 module.exports = exports['default']; 19208 19209/***/ }), 19210/* 373 */ 19211/***/ (function(module, exports) { 19212 19213 "use strict"; 19214 19215 Object.defineProperty(exports, "__esModule", { 19216 value: true 19217 }); 19218 exports.default = { 19219 BUFFERING: 3, 19220 ENDED: 0, 19221 PAUSED: 2, 19222 PLAYING: 1, 19223 UNSTARTED: -1, 19224 VIDEO_CUED: 5 19225 }; 19226 module.exports = exports["default"]; 19227 19228/***/ }), 19229/* 374 */ 19230/***/ (function(module, exports) { 19231 19232 'use strict'; 19233 19234 Object.defineProperty(exports, '__esModule', { 19235 value: true 19236 }); 19237 19238 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19239 19240 var Mails = function Mails(args) { 19241 _classCallCheck(this, Mails); 19242 19243 console.log('mails_received.js loaded'); 19244 19245 // let mailList = document.getElementById("js_mailList"); 19246 // mailList.onclick = function (elem) { 19247 // location.href = "/mails/"+elem.data("id"); 19248 // } 19249 // 19250 // $('.mailList').find('tbody').find('tr').click(function() { 19251 // location.href = "/mails/"+$(this).data("id"); 19252 // }); 19253 } 19254 19255 // methods 19256 ; 19257 19258 exports['default'] = Mails; 19259 module.exports = exports['default']; 19260 19261/***/ }), 19262/* 375 */ 19263/***/ (function(module, exports) { 19264 19265 'use strict'; 19266 19267 Object.defineProperty(exports, '__esModule', { 19268 value: true 19269 }); 19270 19271 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19272 19273 var Mails = function Mails(args) { 19274 _classCallCheck(this, Mails); 19275 19276 console.log('mails_sent.js loaded'); 19277 19278 // let mailList = document.getElementById("js_mailList"); 19279 // mailList.onclick = function (elem) { 19280 // location.href = "/mails/"+elem.data("id"); 19281 // } 19282 // 19283 // $('.mailList').find('tbody').find('tr').click(function() { 19284 // location.href = "/mails/"+$(this).data("id"); 19285 // }); 19286 } 19287 19288 // methods 19289 ; 19290 19291 exports['default'] = Mails; 19292 module.exports = exports['default']; 19293 19294/***/ }), 19295/* 376 */ 19296/***/ (function(module, exports) { 19297 19298 'use strict'; 19299 19300 Object.defineProperty(exports, '__esModule', { 19301 value: true 19302 }); 19303 19304 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19305 19306 var Mails = function Mails(args) { 19307 _classCallCheck(this, Mails); 19308 19309 console.log('message.js loaded'); 19310 19311 // let mailList = document.getElementById("js_mailList"); 19312 // mailList.onclick = function (elem) { 19313 // location.href = "/mails/"+elem.data("id"); 19314 // } 19315 // 19316 // $('.mailList').find('tbody').find('tr').click(function() { 19317 // location.href = "/mails/"+$(this).data("id"); 19318 // }); 19319 } 19320 19321 // methods 19322 ; 19323 19324 exports['default'] = Mails; 19325 module.exports = exports['default']; 19326 19327/***/ }), 19328/* 377 */ 19329/***/ (function(module, exports, __webpack_require__) { 19330 19331 'use strict'; 19332 19333 Object.defineProperty(exports, '__esModule', { 19334 value: true 19335 }); 19336 19337 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19338 19339 var validate = __webpack_require__(338); 19340 19341 var NewProject = function NewProject(args) { 19342 _classCallCheck(this, NewProject); 19343 19344 console.log('new_project.js loaded'); 19345 19346 document.getElementById('start_project_description').onkeyup = function () { 19347 document.getElementById('start_project_description_count').innerHTML = 1000 - this.value.length + "/1000"; 19348 }; 19349 19350 document.getElementById('start_project_name').onkeyup = function () { 19351 document.getElementById('start_project_name_count').innerHTML = 60 - this.value.length + "/60"; 19352 }; 19353 19354 // Form validation 19355 var constraints = { 19356 'start_project[email]': { 19357 email: { 19358 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 19359 }, 19360 presence: { 19361 message: "å ¥åãã¦ãã ãã" 19362 } 19363 }, 19364 'start_project[applicant]': { 19365 presence: { 19366 message: "å ¥åãã¦ãã ãã" 19367 } 19368 }, 19369 'start_project[name]': { 19370 length: { 19371 maximum: 60, 19372 message: '60æå以å ã§å ¥åãã ãã' 19373 }, 19374 presence: { 19375 message: "å ¥åãã¦ãã ãã" 19376 } 19377 }, 19378 'start_project[category_id]': { 19379 presence: { 19380 message: "å ¥åãã¦ãã ãã" 19381 } 19382 }, 19383 'start_project[goal_amount]': { 19384 numericality: { 19385 onlyInteger: true, 19386 greaterThan: 0, 19387 message: '1以ä¸ã®æ°å¤ãå ¥åãã ãã' 19388 }, 19389 presence: { 19390 message: "å ¥åãã¦ãã ãã" 19391 } 19392 }, 19393 'start_project[description]': { 19394 length: { 19395 maximum: 1000, 19396 message: '1000æå以å ã§å ¥åãã ãã' 19397 }, 19398 presence: { 19399 message: "å ¥åãã¦ãã ãã" 19400 } 19401 }, 19402 'start_project[ticket_description]': { 19403 presence: { 19404 message: "å ¥åãã¦ãã ãã" 19405 } 19406 } 19407 }; 19408 19409 // Hook up the form so we can prevent it from being posted 19410 var form = document.getElementById("start_project_form"); 19411 form.onsubmit = function (ev) { 19412 ev.preventDefault(); 19413 handleFormSubmit(form); 19414 }; 19415 19416 // Hook up the inputs to validate on the fly 19417 var inputs = document.querySelectorAll("input, textarea, select");
19418 inputs.forEach(function (element) { 19419 element.onchange = function (elem) { 19420 var errors = validate(form, constraints, { fullMessages: false }) || {}; 19421 showErrorsForInput(this, errors[this.name]); 19422 }; 19423 }); 19424 19425 function handleFormSubmit(form, input) { 19426 // validate the form against the constraints 19427 var errors = validate(form, constraints, { fullMessages: false }); 19428 // then we update the form to reflect the results 19429 // showErrors(form, errors || {}); 19430 if (!errors) { 19431 showSuccess(); 19432 } else { 19433 showErrors(form, errors || {}); 19434 } 19435 } 19436 19437 // Updates the inputs with the validation errors 19438 function showErrors(form, errors) { 19439 // We loop through all the inputs and show the errors for that input 19440 form.querySelectorAll(".input_validate").forEach(function (input) { 19441 // Since the errors can be null if no errors were found we need to handle that 19442 if (input.type !== 'hidden') { 19443 showErrorsForInput(input, errors && errors[input.name]); 19444 } 19445 }); 19446 } 19447 19448 // Shows the errors for a specific input 19449 function showErrorsForInput(input, errors) { 19450 // This is the root of the input 19451 var formGroup = closestParent(input.parentNode, "form-group"); 19452 // Find where the error messages will be insert into 19453 var messages = formGroup.querySelector(".error-messages"); 19454 // First we remove any old messages and resets the classes 19455 resetFormGroup(formGroup, messages); 19456 // If we have errors 19457 if (errors) { 19458 // we first mark the group has having errors 19459 formGroup.classList.add("has-error"); 19460 // then we append all the errors 19461 errors.forEach(function (error) { 19462 addError(messages, error); 19463 }); 19464 } else { 19465 // otherwise we simply mark it as success 19466 formGroup.classList.add("has-success"); 19467 } 19468 } 19469 19470 // Recusively finds the closest parent that has the specified class 19471 function closestParent(_x, _x2) { 19472 var _again = true; 19473 19474 _function: while (_again) { 19475 var child = _x, 19476 className = _x2; 19477 _again = false; 19478 19479 if (!child || child == document) { 19480 return null; 19481 } 19482 if (child.classList.contains(className)) { 19483 return child; 19484 } else { 19485 _x = child.parentNode; 19486 _x2 = className; 19487 _again = true; 19488 continue _function; 19489 } 19490 } 19491 } 19492 19493 function resetFormGroup(formGroup, messages) { 19494 // Remove the success and error classes 19495 formGroup.classList.remove("has-error"); 19496 formGroup.classList.remove("has-success"); 19497 messages.classList.remove("show"); 19498 // and remove any old messages 19499 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 19500 // el.parentNode.removeChild(el); 19501 // }); 19502 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 19503 element.parentNode.removeChild(element); 19504 }); 19505 } 19506 19507 // Adds the specified error with the following markup 19508 // <p class="help-block error">[message]</p> 19509 function addError(messages, error) { 19510 var block = document.createElement("p"); 19511 block.classList.add("help-block"); 19512 block.classList.add("error"); 19513 block.innerText = error; 19514 messages.appendChild(block); 19515 messages.classList.add("show"); 19516 } 19517 19518 function showSuccess() { 19519 form.submit(); 19520 } 19521 } 19522 19523 // methods 19524 ; 19525 19526 exports['default'] = NewProject; 19527 module.exports = exports['default']; 19528 19529/***/ }), 19530/* 378 */ 19531/***/ (function(module, exports, __webpack_require__) { 19532 19533 'use strict'; 19534 19535 Object.defineProperty(exports, '__esModule', { 19536 value: true 19537 }); 19538 19539 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19540 19541 var validate = __webpack_require__(338); 19542 19543 var NewPassword = function NewPassword(args) { 19544 _classCallCheck(this, NewPassword); 19545 19546 console.log('comfirmation_new.js loaded'); 19547 19548 // Form validation 19549 var constraints = { 19550 'user[email]': { 19551 email: { 19552 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 19553 }, 19554 presence: { 19555 message: "å ¥åãã¦ãã ãã" 19556 } 19557 } 19558 }; 19559 19560 // Hook up the form so we can prevent it from being posted 19561 var form = document.getElementById("password_form"); 19562 form.onsubmit = function (ev) { 19563 ev.preventDefault(); 19564 handleFormSubmit(form); 19565 }; 19566 19567 // Hook up the inputs to validate on the fly 19568 var inputs = document.querySelectorAll("input, textarea, select");
19569 inputs.forEach(function (element) { 19570 element.onchange = function (elem) { 19571 var errors = validate(form, constraints, { fullMessages: false }) || {}; 19572 showErrorsForInput(this, errors[this.name]); 19573 }; 19574 }); 19575 19576 function handleFormSubmit(form, input) { 19577 // validate the form against the constraints 19578 var errors = validate(form, constraints, { fullMessages: false }); 19579 // then we update the form to reflect the results 19580 showErrors(form, errors || {}); 19581 if (!errors) { 19582 showSuccess(); 19583 } 19584 } 19585 19586 // Updates the inputs with the validation errors 19587 function showErrors(form, errors) { 19588 // We loop through all the inputs and show the errors for that input 19589 form.querySelectorAll(".input_validate").forEach(function (input) { 19590 // Since the errors can be null if no errors were found we need to handle that 19591 showErrorsForInput(input, errors && errors[input.name]); 19592 }); 19593 } 19594 19595 // Shows the errors for a specific input 19596 function showErrorsForInput(input, errors) { 19597 // This is the root of the input 19598 var formGroup = closestParent(input.parentNode, "form-group"); 19599 // Find where the error messages will be insert into 19600 var messages = formGroup.querySelector(".error-messages"); 19601 // First we remove any old messages and resets the classes 19602 resetFormGroup(formGroup, messages); 19603 // If we have errors 19604 if (errors) { 19605 // we first mark the group has having errors 19606 formGroup.classList.add("has-error"); 19607 // then we append all the errors 19608 errors.forEach(function (error) { 19609 addError(messages, error); 19610 }); 19611 } else { 19612 // otherwise we simply mark it as success 19613 formGroup.classList.add("has-success"); 19614 } 19615 } 19616 19617 // Recusively finds the closest parent that has the specified class 19618 function closestParent(_x, _x2) { 19619 var _again = true; 19620 19621 _function: while (_again) { 19622 var child = _x, 19623 className = _x2; 19624 _again = false; 19625 19626 if (!child || child == document) { 19627 return null; 19628 } 19629 if (child.classList.contains(className)) { 19630 return child; 19631 } else { 19632 _x = child.parentNode; 19633 _x2 = className; 19634 _again = true; 19635 continue _function; 19636 } 19637 } 19638 } 19639 19640 function resetFormGroup(formGroup, messages) { 19641 // Remove the success and error classes 19642 formGroup.classList.remove("has-error"); 19643 formGroup.classList.remove("has-success"); 19644 messages.classList.remove("show"); 19645 // and remove any old messages 19646 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 19647 // el.parentNode.removeChild(el); 19648 // }); 19649 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 19650 element.parentNode.removeChild(element); 19651 }); 19652 } 19653 19654 // Adds the specified error with the following markup 19655 // <p class="help-block error">[message]</p> 19656 function addError(messages, error) { 19657 var block = document.createElement("p"); 19658 block.classList.add("help-block"); 19659 block.classList.add("error"); 19660 block.innerText = error; 19661 messages.appendChild(block); 19662 messages.classList.add("show"); 19663 } 19664 19665 function showSuccess() { 19666 form.submit(); 19667 } 19668 } 19669 19670 // methods 19671 ; 19672 19673 exports['default'] = NewPassword; 19674 module.exports = exports['default']; 19675 19676/***/ }), 19677/* 379 */ 19678/***/ (function(module, exports) { 19679 19680 // payment_new 19681 "use strict"; 19682 19683 Object.defineProperty(exports, "__esModule", { 19684 value: true 19685 }); 19686 19687 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 19688 19689 var PaymentInfo = function PaymentInfo(args) { 19690 _classCallCheck(this, PaymentInfo); 19691 19692 var form = document.getElementById("payment_form"); 19693 var submitButton = document.getElementById("submitButton"); 19694 19695 form.addEventListener('submit', function (e) { 19696 e.preventDefault(); 19697 submitButton.classList.add('disabled'); 19698 submitButton.disabled = true; 19699 submitForm().then(function () { 19700 console.log('done'); 19701 submitButton.disabled = false;
19702 submitButton.classList.remove('disabled'); 19703 })["catch"](function (e) { 19704 console.log(e); 19705 }); 19706 }, true); 19707 19708 function submitForm() { 19709 return regeneratorRuntime.async(function submitForm$(context$2$0) { 19710 while (1) switch (context$2$0.prev = context$2$0.next) { 19711 case 0: 19712 return context$2$0.abrupt("return", new Promise(function (resolve) { 19713 form.submit(); 19714 resolve(); 19715 })); 19716 19717 case 1: 19718 case "end": 19719 return context$2$0.stop(); 19720 } 19721 }, null, this); 19722 } 19723 }; 19724 19725 exports["default"] = PaymentInfo; 19726 module.exports = exports["default"]; 19727 19728/***/ }), 19729/* 380 */ 19730/***/ (function(module, exports) { 19731 19732 // payment_new 19733 19734 'use strict'; 19735 19736 Object.defineProperty(exports, '__esModule', { 19737 value: true 19738 }); 19739 19740 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19741 19742 var PaymentInfo = function PaymentInfo(args) { 19743 _classCallCheck(this, PaymentInfo); 19744 19745 console.log('payment_information.js loaded'); 19746 } 19747 19748 // methods 19749 ; 19750 19751 exports['default'] = PaymentInfo; 19752 module.exports = exports['default']; 19753 19754/***/ }), 19755/* 381 */ 19756/***/ (function(module, exports, __webpack_require__) { 19757 19758 'use strict'; 19759 19760 Object.defineProperty(exports, '__esModule', { 19761 value: true 19762 }); 19763 19764 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19765 19766 var validate = __webpack_require__(338); 19767 19768 var PaymentInfoBank = function PaymentInfoBank(args) { 19769 _classCallCheck(this, PaymentInfoBank); 19770 19771 console.log('payment_information_bank.js loaded'); 19772 19773 // Form validation 19774 var constraints = { 19775 'user_address[family_name]': { 19776 presence: { 19777 message: "å ¥åãã¦ãã ãã" 19778 } 19779 }, 19780 'user_address[first_name]': { 19781 presence: { 19782 message: "å ¥åãã¦ãã ãã" 19783 } 19784 }, 19785 'user_address[family_name_kana]': { 19786 presence: { 19787 message: "å ¥åãã¦ãã ãã" 19788 } 19789 }, 19790 'user_address[first_name_kana]': { 19791 presence: { 19792 message: "å ¥åãã¦ãã ãã" 19793 } 19794 }, 19795 'user_address[postal_code]': { 19796 presence: { 19797 message: "å ¥åãã¦ãã ãã" 19798 } 19799 }, 19800 'user_address[prefecture_id]': { 19801 presence: { 19802 message: "å ¥åãã¦ãã ãã" 19803 } 19804 }, 19805 'user_address[address1]': { 19806 presence: { 19807 message: "å ¥åãã¦ãã ãã" 19808 } 19809 }, 19810 'user_address[address2]': { 19811 presence: false 19812 }, 19813 'user_address[phone_number]': { 19814 presence: { 19815 message: "å ¥åãã¦ãã ãã" 19816 } 19817 } 19818 }; 19819 19820 // Hook up the form so we can prevent it from being posted 19821 var form = document.getElementById("information_bank"); 19822 form.onsubmit = function (ev) { 19823 ev.preventDefault(); 19824 handleFormSubmit(form); 19825 }; 19826 19827 // Hook up the inputs to validate on the fly 19828 var inputs = document.querySelectorAll("input, textarea, select"); 19829 inputs.forEach(function (element) { 19830 element.onchange = function (elem) { 19831 var errors = validate(form, constraints, { fullMessages: false }) || {}; 19832 showErrorsForInput(this, errors[this.name]); 19833 }; 19834 }); 19835 19836 function handleFormSubmit(form, input) { 19837 // validate the form against the constraints 19838 var errors = validate(form, constraints, { fullMessages: false }); 19839 // then we update the form to reflect the results 19840 showErrors(form, errors || {}); 19841 if (!errors) { 19842 showSuccess(); 19843 } 19844 } 19845 19846 // Updates the inputs with the validation errors 19847 function showErrors(form, errors) { 19848 // We loop through all the inputs and show the errors for that input 19849 form.querySelectorAll(".input_validate").forEach(function (input) { 19850 // Since the errors can be null if no errors were found we need to handle that 19851 showErrorsForInput(input, errors && errors[input.name]); 19852 }); 19853 } 19854 19855 // Shows the errors for a specific input 19856 function showErrorsForInput(input, errors) { 19857 // This is the root of the input 19858 var formGroup = closestParent(input.parentNode, "form-group"); 19859 // Find where the error messages will be insert into 19860 var messages = formGroup.querySelector(".error-messages"); 19861 // First we remove any old messages and resets the classes 19862 resetFormGroup(formGroup, messages); 19863 // If we have errors 19864 if (errors) { 19865 // we first mark the group has having errors 19866 formGroup.classList.add("has-error"); 19867 // then we append all the errors
19868 errors.forEach(function (error) { 19869 addError(messages, error); 19870 }); 19871 } else { 19872 // otherwise we simply mark it as success 19873 formGroup.classList.add("has-success"); 19874 } 19875 } 19876 19877 // Recusively finds the closest parent that has the specified class 19878 function closestParent(_x, _x2) { 19879 var _again = true; 19880 19881 _function: while (_again) { 19882 var child = _x, 19883 className = _x2; 19884 _again = false; 19885 19886 if (!child || child == document) { 19887 return null; 19888 } 19889 if (child.classList.contains(className)) { 19890 return child; 19891 } else { 19892 _x = child.parentNode; 19893 _x2 = className; 19894 _again = true; 19895 continue _function; 19896 } 19897 } 19898 } 19899 19900 function resetFormGroup(formGroup, messages) { 19901 // Remove the success and error classes 19902 formGroup.classList.remove("has-error"); 19903 formGroup.classList.remove("has-success"); 19904 messages.classList.remove("show"); 19905 // and remove any old messages 19906 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 19907 // el.parentNode.removeChild(el); 19908 // }); 19909 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 19910 element.parentNode.removeChild(element); 19911 }); 19912 } 19913 19914 // Adds the specified error with the following markup 19915 // <p class="help-block error">[message]</p> 19916 function addError(messages, error) { 19917 var block = document.createElement("p"); 19918 block.classList.add("help-block"); 19919 block.classList.add("error"); 19920 block.innerText = error; 19921 messages.appendChild(block); 19922 messages.classList.add("show"); 19923 } 19924 19925 function showSuccess() { 19926 form.submit(); 19927 } 19928 } 19929 19930 // methods 19931 ; 19932 19933 exports['default'] = PaymentInfoBank; 19934 module.exports = exports['default']; 19935 19936/***/ }), 19937/* 382 */ 19938/***/ (function(module, exports, __webpack_require__) { 19939 19940 'use strict'; 19941 19942 Object.defineProperty(exports, '__esModule', { 19943 value: true 19944 }); 19945 19946 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 19947 19948 var validate = __webpack_require__(338); 19949 19950 var PaymentInfoCard = function PaymentInfoCard(args) { 19951 _classCallCheck(this, PaymentInfoCard); 19952 19953 console.log('payment_information_card.js loaded'); 19954 19955 // Form validation 19956 var constraints = { 19957 'card_info': { 19958 'card_info[cc_number]': { 19959 presence: { 19960 message: "å ¥åãã¦ãã ãã" 19961 }, 19962 numericality: { 19963 onlyInteger: true, 19964 greaterThan: 0, 19965 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 19966 } 19967 }, 19968 'card_info[cc_expiration_month]': { 19969 presence: { 19970 message: "å ¥åãã¦ãã ãã" 19971 }, 19972 numericality: { 19973 onlyInteger: true, 19974 greaterThan: 0, 19975 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 19976 } 19977 }, 19978 'card_info[cc_expiration_year]': { 19979 presence: { 19980 message: "å ¥åãã¦ãã ãã" 19981 }, 19982 numericality: { 19983 onlyInteger: true, 19984 greaterThan: 0, 19985 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 19986 } 19987 }, 19988 'card_info[cc_name]': { 19989 presence: { 19990 message: "å ¥åãã¦ãã ãã" 19991 } 19992 }, 19993 'card_info[security_code]': { 19994 presence: { 19995 message: "å ¥åãã¦ãã ãã" 19996 } 19997 }, 19998 'card_info[registration]': { 19999 presence: false 20000 } 20001 }, 20002 'user_address': { 20003 'user_address[family_name]': { 20004 presence: { 20005 message: "å ¥åãã¦ãã ãã" 20006 } 20007 }, 20008 'user_address[first_name]': { 20009 presence: { 20010 message: "å ¥åãã¦ãã ãã" 20011 } 20012 }, 20013 'user_address[family_name_kana]': { 20014 presence: { 20015 message: "å ¥åãã¦ãã ãã" 20016 } 20017 }, 20018 'user_address[first_name_kana]': { 20019 presence: { 20020 message: "å ¥åãã¦ãã ãã" 20021 } 20022 }, 20023 'user_address[postal_code]': { 20024 presence: { 20025 message: "å ¥åãã¦ãã ãã" 20026 } 20027 }, 20028 'user_address[prefecture_id]': { 20029 presence: { 20030 message: "å ¥åãã¦ãã ãã" 20031 } 20032 }, 20033 'user_address[address1]': { 20034 presence: { 20035 message: "å ¥åãã¦ãã ãã" 20036 } 20037 }, 20038 'user_address[address2]': { 20039 presence: false 20040 }, 20041 'user_address[phone_number]': { 20042 presence: { 20043 message: "å ¥åãã¦ãã ãã" 20044 } 20045 } 20046 } 20047 }; 20048 20049 var hasAddress = document.getElementById('form_registration') !== null; 20050 var hasCard = document.getElementById('form_registration_card') !== null; 20051 // Hook up the form so we can prevent it from being posted 20052 var form = document.getElementById("information_card"); 20053 form.onsubmit = function (ev) { 20054 ev.preventDefault(); 20055 handleFormSubmit(form); 20056 }; 20057 20058 // Hook up the inputs to validate on the fly 20059 var inputs = document.querySelectorAll("input, textarea, select");
20060 inputs.forEach(function (element) { 20061 element.onchange = function (elem) { 20062 var errors = fetchErrors(); 20063 showErrorsForInput(this, errors[this.name]); 20064 }; 20065 }); 20066 20067 var fetchErrors = function fetchErrors() { 20068 var cardErrors = validate(form, constraints.card_info, { fullMessages: false }) || {}; 20069 var addressErrors = validate(form, constraints.user_address, { fullMessages: false }) || {}; 20070 if (hasAddress && hasCard) { 20071 return Object.assign(cardErrors, addressErrors); 20072 } else if (hasAddress && !hasCard) { 20073 return Object.assign(addressErrors); 20074 } else if (!hasAddress && hasCard) { 20075 return Object.assign(cardErrors); 20076 } 20077 }; 20078 20079 var isEmpty = function isEmpty(obj) { 20080 return !Object.keys(obj).length; 20081 }; 20082 20083 function handleFormSubmit(form, input) { 20084 // validate the form against the constraints 20085 var errors = fetchErrors(); 20086 // then we update the form to reflect the results 20087 showErrors(form, errors || {}); 20088 if (isEmpty(errors)) { 20089 showSuccess(); 20090 } 20091 } 20092 20093 // Updates the inputs with the validation errors 20094 function showErrors(form, errors) { 20095 // We loop through all the inputs and show the errors for that input 20096 form.querySelectorAll(".input_validate").forEach(function (input) { 20097 // Since the errors can be null if no errors were found we need to handle that 20098 showErrorsForInput(input, errors && errors[input.name]); 20099 }); 20100 } 20101 20102 // Shows the errors for a specific input 20103 function showErrorsForInput(input, errors) { 20104 // This is the root of the input 20105 var formGroup = closestParent(input.parentNode, "form-group"); 20106 // Find where the error messages will be insert into 20107 var messages = formGroup.querySelector(".error-messages"); 20108 // First we remove any old messages and resets the classes 20109 resetFormGroup(formGroup, messages); 20110 // If we have errors 20111 if (errors) { 20112 // we first mark the group has having errors 20113 formGroup.classList.add("has-error"); 20114 // then we append all the errors 20115 errors.forEach(function (error) { 20116 addError(messages, error); 20117 }); 20118 } else { 20119 // otherwise we simply mark it as success 20120 formGroup.classList.add("has-success"); 20121 } 20122 } 20123 20124 // Recusively finds the closest parent that has the specified class 20125 function closestParent(_x, _x2) { 20126 var _again = true; 20127 20128 _function: while (_again) { 20129 var child = _x, 20130 className = _x2; 20131 _again = false; 20132 20133 if (!child || child == document) { 20134 return null; 20135 } 20136 if (child.classList.contains(className)) { 20137 return child; 20138 } else { 20139 _x = child.parentNode; 20140 _x2 = className; 20141 _again = true; 20142 continue _function; 20143 } 20144 } 20145 } 20146 20147 function resetFormGroup(formGroup, messages) { 20148 // Remove the success and error classes 20149 formGroup.classList.remove("has-error"); 20150 formGroup.classList.remove("has-success"); 20151 messages.classList.remove("show"); 20152 // and remove any old messages 20153 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 20154 // el.parentNode.removeChild(el); 20155 // }); 20156 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 20157 element.parentNode.removeChild(element); 20158 }); 20159 } 20160 20161 // Adds the specified error with the following markup 20162 // <p class="help-block error">[message]</p> 20163 function addError(messages, error) { 20164 var block = document.createElement("p"); 20165 block.classList.add("help-block"); 20166 block.classList.add("error"); 20167 block.innerText = error; 20168 messages.appendChild(block); 20169 messages.classList.add("show"); 20170 } 20171 20172 function showSuccess() { 20173 _submit(); // defined in html. 20174 } 20175 } 20176 20177 // methods 20178 ; 20179 20180 exports['default'] = PaymentInfoCard; 20181 module.exports = exports['default']; 20182 20183/***/ }), 20184/* 383 */ 20185/***/ (function(module, exports, __webpack_require__) { 20186 20187 'use strict'; 20188 20189 Object.defineProperty(exports, '__esModule', { 20190 value: true 20191 }); 20192 20193 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20194 20195 var validate = __webpack_require__(338); 20196 20197 var PaymentInfoCardEdit = function PaymentInfoCardEdit(args) { 20198 _classCallCheck(this, PaymentInfoCardEdit); 20199 20200 console.log('payment_information_card_edit.js loaded'); 20201 20202 // Form validation 20203 var constraints = { 20204 'card_info[cc_number]': { 20205 presence: { 20206 message: "å ¥åãã¦ãã ãã" 20207 }, 20208 numericality: { 20209 onlyInteger: true, 20210 greaterThan: 0, 20211 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 20212 } 20213 }, 20214 'card_info[cc_expiration_month]': { 20215 presence: { 20216 message: "å ¥åãã¦ãã ãã" 20217 }, 20218 numericality: { 20219 onlyInteger: true, 20220 greaterThan: 0, 20221 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 20222 } 20223 }, 20224 'card_info[cc_expiration_year]': { 20225 presence: { 20226 message: "å ¥åãã¦ãã ãã" 20227 }, 20228 numericality: { 20229 onlyInteger: true, 20230 greaterThan: 0, 20231 message: '0以ä¸ã®æ°å¤ãå ¥åãã ãã' 20232 } 20233 }, 20234 'card_info[cc_name]': { 20235 presence: { 20236 message: "å ¥åãã¦ãã ãã" 20237 } 20238 }, 20239 'card_info[security_code]': { 20240 presence: { 20241 message: "å ¥åãã¦ãã ãã" 20242 } 20243 }, 20244 'card_info[registration]': { 20245 presence: false 20246 } 20247 }; 20248 20249 // Hook up the form so we can prevent it from being posted 20250 var form = document.getElementById("information_card"); 20251 form.onsubmit = function (ev) { 20252 ev.preventDefault(); 20253 handleFormSubmit(form); 20254 }; 20255 20256 // Hook up the inputs to validate on the fly 20257 var inputs = document.querySelectorAll("input, textarea, select");
20258 inputs.forEach(function (element) { 20259 element.onchange = function (elem) { 20260 var errors = validate(form, constraints, { fullMessages: false }) || {}; 20261 showErrorsForInput(this, errors[this.name]); 20262 }; 20263 }); 20264 20265 function handleFormSubmit(form, input) { 20266 // validate the form against the constraints 20267 var errors = validate(form, constraints, { fullMessages: false }); 20268 // then we update the form to reflect the results 20269 showErrors(form, errors || {}); 20270 if (!errors) { 20271 showSuccess(); 20272 } 20273 } 20274 20275 // Updates the inputs with the validation errors 20276 function showErrors(form, errors) { 20277 // We loop through all the inputs and show the errors for that input 20278 form.querySelectorAll(".input_validate").forEach(function (input) { 20279 // Since the errors can be null if no errors were found we need to handle that 20280 showErrorsForInput(input, errors && errors[input.name]); 20281 }); 20282 } 20283 20284 // Shows the errors for a specific input 20285 function showErrorsForInput(input, errors) { 20286 // This is the root of the input 20287 var formGroup = closestParent(input.parentNode, "form-group"); 20288 // Find where the error messages will be insert into 20289 var messages = formGroup.querySelector(".error-messages"); 20290 // First we remove any old messages and resets the classes 20291 resetFormGroup(formGroup, messages); 20292 // If we have errors 20293 if (errors) { 20294 // we first mark the group has having errors 20295 formGroup.classList.add("has-error"); 20296 // then we append all the errors 20297 errors.forEach(function (error) { 20298 addError(messages, error); 20299 }); 20300 } else { 20301 // otherwise we simply mark it as success 20302 formGroup.classList.add("has-success"); 20303 } 20304 } 20305 20306 // Recusively finds the closest parent that has the specified class 20307 function closestParent(_x, _x2) { 20308 var _again = true; 20309 20310 _function: while (_again) { 20311 var child = _x, 20312 className = _x2; 20313 _again = false; 20314 20315 if (!child || child == document) { 20316 return null; 20317 } 20318 if (child.classList.contains(className)) { 20319 return child; 20320 } else { 20321 _x = child.parentNode; 20322 _x2 = className; 20323 _again = true; 20324 continue _function; 20325 } 20326 } 20327 } 20328 20329 function resetFormGroup(formGroup, messages) { 20330 // Remove the success and error classes 20331 formGroup.classList.remove("has-error"); 20332 formGroup.classList.remove("has-success"); 20333 messages.classList.remove("show"); 20334 // and remove any old messages 20335 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 20336 // el.parentNode.removeChild(el); 20337 // }); 20338 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 20339 element.parentNode.removeChild(element); 20340 }); 20341 } 20342 20343 // Adds the specified error with the following markup 20344 // <p class="help-block error">[message]</p> 20345 function addError(messages, error) { 20346 var block = document.createElement("p"); 20347 block.classList.add("help-block"); 20348 block.classList.add("error"); 20349 block.innerText = error; 20350 messages.appendChild(block); 20351 messages.classList.add("show"); 20352 } 20353 20354 function showSuccess() { 20355 _submit(); // defined in html. 20356 } 20357 } 20358 20359 // methods 20360 ; 20361 20362 exports['default'] = PaymentInfoCardEdit; 20363 module.exports = exports['default']; 20364 20365/***/ }), 20366/* 384 */ 20367/***/ (function(module, exports, __webpack_require__) { 20368 20369 'use strict'; 20370 20371 Object.defineProperty(exports, '__esModule', { 20372 value: true 20373 }); 20374 20375 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20376 20377 var validate = __webpack_require__(338); 20378 20379 var PaymentInfoStore = function PaymentInfoStore(args) { 20380 _classCallCheck(this, PaymentInfoStore); 20381 20382 console.log('payment_information_store.js loaded'); 20383 20384 // Form validation 20385 var constraints = { 20386 'store_info': { 20387 'webcvstype': { presence: false } 20388 }, 20389 'user_address': { 20390 'user_address[family_name]': { 20391 presence: { 20392 message: "å ¥åãã¦ãã ãã" 20393 } 20394 }, 20395 'user_address[first_name]': { 20396 presence: { 20397 message: "å ¥åãã¦ãã ãã" 20398 } 20399 }, 20400 'user_address[family_name_kana]': { 20401 presence: { 20402 message: "å ¥åãã¦ãã ãã" 20403 } 20404 }, 20405 'user_address[first_name_kana]': { 20406 presence: { 20407 message: "å ¥åãã¦ãã ãã" 20408 } 20409 }, 20410 'user_address[postal_code]': { 20411 presence: { 20412 message: "å ¥åãã¦ãã ãã" 20413 } 20414 }, 20415 'user_address[prefecture_id]': { 20416 presence: { 20417 message: "å ¥åãã¦ãã ãã" 20418 } 20419 }, 20420 'user_address[address1]': { 20421 presence: { 20422 message: "å ¥åãã¦ãã ãã" 20423 } 20424 }, 20425 'user_address[address2]': { 20426 presence: false 20427 }, 20428 'user_address[phone_number]': { 20429 presence: { 20430 message: "å ¥åãã¦ãã ãã" 20431 } 20432 } 20433 } 20434 }; 20435 20436 var hasAddress = document.getElementById('form_registration') !== null; 20437 // Hook up the form so we can prevent it from being posted 20438 var form = document.getElementById("information_store"); 20439 form.onsubmit = function (ev) { 20440 ev.preventDefault(); 20441 handleFormSubmit(form); 20442 }; 20443 20444 // Hook up the inputs to validate on the fly 20445 var inputs = document.querySelectorAll("input[name], textarea, select");
20446 inputs.forEach(function (element) { 20447 element.onchange = function (elem) { 20448 var errors = fetchErrors(); 20449 showErrorsForInput(this, errors[this.name]); 20450 }; 20451 }); 20452 20453 var fetchErrors = function fetchErrors() { 20454 var storeErrors = validate(form, constraints.store_info, { fullMessages: false }) || {}; 20455 var addressErrors = validate(form, constraints.user_address, { fullMessages: false }) || {}; 20456 return hasAddress ? Object.assign(storeErrors, addressErrors) : storeErrors; 20457 }; 20458 20459 var isEmpty = function isEmpty(obj) { 20460 return !Object.keys(obj).length; 20461 }; 20462 20463 function handleFormSubmit(form, input) { 20464 // validate the form against the constraints 20465 var errors = fetchErrors(); 20466 // then we update the form to reflect the results 20467 showErrors(form, errors || {}); 20468 if (isEmpty(errors)) { 20469 showSuccess(); 20470 } 20471 } 20472 20473 // Updates the inputs with the validation errors 20474 function showErrors(form, errors) { 20475 // We loop through all the inputs and show the errors for that input 20476 form.querySelectorAll(".input_validate").forEach(function (input) { 20477 // Since the errors can be null if no errors were found we need to handle that 20478 showErrorsForInput(input, errors && errors[input.name]); 20479 }); 20480 } 20481 20482 // Shows the errors for a specific input 20483 function showErrorsForInput(input, errors) { 20484 // This is the root of the input 20485 var formGroup = closestParent(input.parentNode, "form-group"); 20486 // Find where the error messages will be insert into 20487 var messages = formGroup.querySelector(".error-messages"); 20488 // First we remove any old messages and resets the classes 20489 resetFormGroup(formGroup, messages); 20490 // If we have errors 20491 if (errors) { 20492 // we first mark the group has having errors 20493 formGroup.classList.add("has-error"); 20494 // then we append all the errors 20495 errors.forEach(function (error) { 20496 addError(messages, error); 20497 }); 20498 } else { 20499 // otherwise we simply mark it as success 20500 formGroup.classList.add("has-success"); 20501 } 20502 } 20503 20504 // Recusively finds the closest parent that has the specified class 20505 function closestParent(_x, _x2) { 20506 var _again = true; 20507 20508 _function: while (_again) { 20509 var child = _x, 20510 className = _x2; 20511 _again = false; 20512 20513 if (!child || child == document) { 20514 return null; 20515 } 20516 if (child.classList.contains(className)) { 20517 return child; 20518 } else { 20519 _x = child.parentNode; 20520 _x2 = className; 20521 _again = true; 20522 continue _function; 20523 } 20524 } 20525 } 20526 20527 function resetFormGroup(formGroup, messages) { 20528 // Remove the success and error classes 20529 formGroup.classList.remove("has-error"); 20530 formGroup.classList.remove("has-success"); 20531 messages.classList.remove("show"); 20532 // and remove any old messages 20533 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 20534 // el.parentNode.removeChild(el); 20535 // }); 20536 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 20537 element.parentNode.removeChild(element); 20538 }); 20539 } 20540 20541 // Adds the specified error with the following markup 20542 // <p class="help-block error">[message]</p> 20543 function addError(messages, error) { 20544 var block = document.createElement("p"); 20545 block.classList.add("help-block"); 20546 block.classList.add("error"); 20547 block.innerText = error; 20548 messages.appendChild(block); 20549 messages.classList.add("show"); 20550 } 20551 20552 function showSuccess() { 20553 form.submit(); 20554 } 20555 } 20556 20557 // methods 20558 ; 20559 20560 exports['default'] = PaymentInfoStore; 20561 module.exports = exports['default']; 20562 20563/***/ }), 20564/* 385 */ 20565/***/ (function(module, exports, __webpack_require__) { 20566 20567 'use strict'; 20568 20569 Object.defineProperty(exports, '__esModule', { 20570 value: true 20571 }); 20572 20573 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; }; })(); 20574 20575 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20576 20577 var smoothScroll = __webpack_require__(386); 20578 20579 var PaymentNew = function PaymentNew(args) { 20580 _classCallCheck(this, PaymentNew); 20581 20582 console.log('payment_new.js loaded'); 20583 20584 // select section 20585 var payementHeaders = document.querySelectorAll('.payment--main--header'); 20586 20587 var _loop = function (i) { 20588 var elem = payementHeaders[i]; 20589 var elemParent = elem.parentElement; 20590 var id = elem.getAttribute('id'); 20591 20592 if (!elemParent.classList.contains('is-disabled')) { 20593 elem.onclick = function () { 20594 for (var _i = 0; _i < payementHeaders.length; _i++) { 20595 var _elem = payementHeaders[_i]; 20596 var _id = _elem.getAttribute('id'); 20597 _elem.parentElement.classList.remove('is-selected'); 20598 document.getElementById(_id + '_content').classList.remove('is-active'); 20599 } 20600 20601 elemParent.classList.toggle('is-selected'); 20602 document.getElementById(id + '_content').classList.toggle('is-active'); 20603 20604 setTimeout(function () { 20605 smoothScroll(elem); 20606 }, 200); 20607 }; 20608 } 20609 }; 20610 20611 for (var i = 0; i < payementHeaders.length; i++) { 20612 _loop(i); 20613 } 20614 20615 // select payment method 20616 var paymentMethods = document.querySelectorAll('.button_radio'); 20617 20618 var _loop2 = function (i) { 20619 var button = paymentMethods[i]; 20620 var id = button.getAttribute('id'); 20621 20622 button.onchange = function () { 20623 var content = document.getElementById(id + '_content'); 20624 var siblings = content.parentElement.children; 20625 20626 for (var _i2 = 0; _i2 < siblings.length; _i2++) { 20627 var sibling = siblings[_i2]; 20628 sibling.classList.remove('is-active'); 20629 } 20630 content.classList.toggle('is-active'); 20631 }; 20632 }; 20633 20634 for (var i = 0; i < paymentMethods.length; i++) { 20635 _loop2(i); 20636 } 20637 20638 // div ã³ã³ããã¼ã®åæ°ã®æ°ã ãã¤ã³ã¹ã¿ã³ã¹ãçæãã 20639 Array.from(Array.from(document.querySelectorAll('.furtherSupport')).keys()).forEac
20639h(function (id) { 20640 return new FurtherSupport(id); 20641 }); 20642 } 20643 20644 /** 20645 * @class ãã¿ã³ã§æ¯æ´é¡ã墿¸ãã UI ã®ãã¸ã㯠20646 */ 20647 ; 20648 20649 exports['default'] = PaymentNew; 20650 20651 var FurtherSupport = (function () { 20652 /** 20653 * ã³ã³ã¹ãã©ã¯ã¿ 20654 * 20655 * @param {number} id ã¿ãã® idãè¤æ°ã®ãªã¯ã¼ããããã®ã§ id ãä»ä¸ãã¦ããå¿ è¦ããã 20656 */ 20657 20658 function FurtherSupport(id) { 20659 var _this = this; 20660 20661 _classCallCheck(this, FurtherSupport); 20662 20663 /** @var {string} ã¿ãã® id */ 20664 this.id = String(id); 20665 20666 /** @var {string} æå¾ã«ããªãã¼ã¿ã¼ãééã§ããå¤ */ 20667 this.latestValidValue = 0; 20668 20669 this.calculate(); 20670 20671 this.plusAmountElement.addEventListener('input', function () { 20672 _this.validate(); 20673 _this.calculate(); 20674 }); 20675 } 20676 20677 /** 20678 * åºæ¬ä¾¡æ ¼ 20679 * 20680 * @returns {number} 20681 */ 20682 20683 _createClass(FurtherSupport, [{ 20684 key: 'validate', 20685 20686 /** 20687 * å ¥åãããªãã¼ã 20688 * 20689 * @returns {boolean} æ£ãããã° true, 䏿£ãªã false 20690 */ 20691 value: function validate() { 20692 if (this.plusAmountElement.checkValidity()) this.latestValidValue = this.plusAmountElement.value === '' ? '0' : this.plusAmountElement.value;else this.plusAmountElement.value = this.latestValidValue; 20693 } 20694 20695 /** 20696 * è¨ç® 20697 * 20698 * @returns {void} 20699 */ 20700 }, { 20701 key: 'calculate', 20702 value: function calculate() { 20703 this.supportPrice = this.basePrice + this.plusAmount; 20704 } 20705 }, { 20706 key: 'basePrice', 20707 get: function get() { 20708 return Number(document.getElementById('further_base_amount-' + this.id).textContent); 20709 } 20710 20711 /** 20712 * ç¾å¨ã®ä¾¡æ ¼ã®ã¨ã¬ã¡ã³ã 20713 * 20714 * @returns {HTMLInputElement} 20715 */ 20716 }, { 20717 key: 'plusAmountElement', 20718 get: function get() { 20719 return document.getElementById('further_plus_amount-' + this.id); 20720 } 20721 20722 /** 20723 * è¿½å æ¯æ´é¡ 20724 * 20725 * @returns {number} 20726 */ 20727 }, { 20728 key: 'plusAmount', 20729 get: function get() { 20730 return Number(this.plusAmountElement.value); 20731 } 20732 20733 /** 20734 * ç¾å¨ã®ä¾¡æ ¼ 20735 * 20736 * @returns {number} 20737 */ 20738 }, { 20739 key: 'supportPrice', 20740 get: function get() { 20741 return Number(document.getElementById('further_support_price-' + this.id).textContent); 20742 }, 20743 20744 /** 20745 * ç¾å¨ã®ä¾¡æ ¼ 20746 * 20747 * @param {number} price è¨å®ããä¾¡æ ¼ 20748 */ 20749 set: function set(price) { 20750 document.getElementById('further_support_price-' + this.id).textContent = String(price); 20751 } 20752 }]); 20753 20754 return FurtherSupport; 20755 })(); 20756 20757 module.exports = exports['default']; 20758 20759/***/ }), 20760/* 386 */ 20761/***/ (function(module, exports, __webpack_require__) { 20762 20763 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, smoothScroll) { 20764 'use strict'; 20765 20766 // Support RequireJS and CommonJS/NodeJS module formats. 20767 // Attach smoothScroll to the `window` when executed as a <script>. 20768 20769 // RequireJS 20770 if (true) { 20771 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (smoothScroll), __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__)); 20772 20773 // CommonJS 20774 } else if (typeof exports === 'object' && typeof module === 'object') { 20775 module.exports = smoothScroll(); 20776 20777 } else { 20778 root.smoothScroll = smoothScroll(); 20779 } 20780 20781 })(this, function(){ 20782 'use strict'; 20783 20784 // Do not initialize smoothScroll when running server side, handle it in client: 20785 if (typeof window !== 'object') return; 20786 20787 // We do not want this script to be applied in browsers that do not support those 20788 // That means no smoothscroll on IE9 and below. 20789 if(document.querySelectorAll === void 0 || window.pageYOffset === void 0 || history.pushState === void 0) { return; } 20790 20791 // Get the top position of an element in the document 20792 var getTop = function(element, start) { 20793 // return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset 20794 if(element.nodeName === 'HTML') return -start 20795 return element.getBoundingClientRect().top + start 20796 } 20797 // ease in out function thanks to: 20798 // http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/ 20799 var easeInOutCubic = function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 } 20800 20801 // calculate the scroll position we should be in 20802 // given the start and end point of the scroll 20803 // the time elapsed from the beginning of the scroll 20804 // and the total duration of the scroll (default 500ms) 20805 var position = function(start, end, elapsed, duration) { 20806 if (elapsed > duration) return end; 20807 return start + (end - start) * easeInOutCubic(elapsed / duration); // <-- you can change the easing funtion there 20808 // return start + (end - start) * (elapsed / duration); // <-- this would give a linear scroll 20809 } 20810 20811 // we use requestAnimationFrame to be called by the browser before every repaint 20812 // if the first argument is an element then scroll to the top of this element 20813 // if the first argument is numeric then scroll to this location 20814 // if the callback exist, it is called when the scrolling is finished 20815 // if context is set then scroll that element, else scroll window 20816 var smoothScroll = function(el, duration, callback, context){ 20817 duration = duration || 500; 20818 context = context || window; 20819 var start = context.scrollTop || window.pageYOffset; 20820 20821 if (typeof el === 'number') { 20822 var end = parseInt(el); 20823 } else { 20824 var end = getTop(el, start); 20825 } 20826 20827 var clock = Date.now(); 20828 var requestAnimationFrame = window.requestAnimationFrame || 20829 window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || 20830 function(fn){window.setTimeout(fn, 15);}; 20831 20832 var step = function(){
20833 var elapsed = Date.now() - clock; 20834 if (context !== window) { 20835 context.scrollTop = position(start, end, elapsed, duration); 20836 } 20837 else { 20838 window.scroll(0, position(start, end, elapsed, duration)); 20839 } 20840 20841 if (elapsed > duration) { 20842 if (typeof callback === 'function') { 20843 callback(el); 20844 } 20845 } else { 20846 requestAnimationFrame(step); 20847 } 20848 } 20849 step(); 20850 } 20851 20852 var linkHandler = function(ev) { 20853 if (!ev.defaultPrevented) { 20854 ev.preventDefault(); 20855 20856 if (location.hash !== this.hash) window.history.pushState(null, null, this.hash) 20857 // using the history api to solve issue #1 - back doesn't work 20858 // most browser don't update :target when the history api is used: 20859 // THIS IS A BUG FROM THE BROWSERS. 20860 // change the scrolling duration in this call 20861 var node = document.getElementById(this.hash.substring(1)) 20862 if (!node) return; // Do not scroll to non-existing node 20863 20864 smoothScroll(node, 500, function (el) { 20865 location.replace('#' + el.id) 20866 // this will cause the :target to be activated. 20867 }); 20868 } 20869 } 20870 20871 // We look for all the internal links in the documents and attach the smoothscroll function 20872 document.addEventListener("DOMContentLoaded", function () { 20873 var internal = document.querySelectorAll('a[href^="#"]:not([href="#"])'), a; 20874 for(var i=internal.length; a=internal[--i];){ 20875 a.addEventListener("click", linkHandler, false); 20876 } 20877 }); 20878 20879 // return smoothscroll API 20880 return smoothScroll; 20881 20882 }); 20883 20884 20885/***/ }), 20886/* 387 */ 20887/***/ (function(module, exports, __webpack_require__) { 20888 20889 'use strict'; 20890 20891 Object.defineProperty(exports, '__esModule', { 20892 value: true 20893 }); 20894 20895 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20896 20897 var smoothScroll = __webpack_require__(386); 20898 20899 var PaymentNewConcept = function PaymentNewConcept(args) { 20900 _classCallCheck(this, PaymentNewConcept); 20901 20902 console.log('payment_new_concept.js loaded'); 20903 20904 // select section 20905 var payementHeaders = document.querySelectorAll('.payment--main--header'); 20906 20907 var _loop = function (i) { 20908 var elem = payementHeaders[i]; 20909 var elemParent = elem.parentElement; 20910 var id = elem.getAttribute('id'); 20911 20912 if (!elemParent.classList.contains('is-disabled')) { 20913 elem.onclick = function () { 20914 for (var _i = 0; _i < payementHeaders.length; _i++) { 20915 var _elem = payementHeaders[_i]; 20916 var _id = _elem.getAttribute('id'); 20917 _elem.parentElement.classList.remove('is-selected'); 20918 document.getElementById(_id + '_content').classList.remove('is-active'); 20919 } 20920 20921 elemParent.classList.toggle('is-selected'); 20922 document.getElementById(id + '_content').classList.toggle('is-active'); 20923 20924 setTimeout(function () { 20925 smoothScroll(elem); 20926 }, 200); 20927 }; 20928 } 20929 }; 20930 20931 for (var i = 0; i < payementHeaders.length; i++) { 20932 _loop(i); 20933 } 20934 }; 20935 20936 exports['default'] = PaymentNewConcept; 20937 module.exports = exports['default']; 20938 20939/***/ }), 20940/* 388 */ 20941/***/ (function(module, exports) { 20942 20943 'use strict'; 20944 20945 Object.defineProperty(exports, '__esModule', { 20946 value: true 20947 }); 20948 20949 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20950 20951 var Profile = function Profile(args) { 20952 _classCallCheck(this, Profile); 20953 20954 console.log('profile.js loaded'); 20955 var button_menu = document.getElementById('show_profile_menu'), 20956 target = document.getElementById(button_menu.getAttribute('data-toggle')); 20957 20958 button_menu.onclick = function () { 20959 target.classList.toggle("is-open"); 20960 }; 20961 } 20962 20963 // methods 20964 ; 20965 20966 exports['default'] = Profile; 20967 module.exports = exports['default']; 20968 20969/***/ }), 20970/* 389 */ 20971/***/ (function(module, exports, __webpack_require__) { 20972 20973 'use strict'; 20974 20975 Object.defineProperty(exports, '__esModule', { 20976 value: true 20977 }); 20978 20979 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; }; })(); 20980 20981 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20982 20983 var validate = __webpack_require__(338); 20984 20985 var ProfileEdit = (function () { 20986 function ProfileEdit(args) { 20987 _classCallCheck(this, ProfileEdit); 20988 20989 console.log('profile_confirmation.js loaded'); 20990 20991 // Form validation 20992 var values = [true, '1', 1]; 20993 20994 var self = this; 20995 20996 // Hook up the form so we can prevent it from being posted 20997 var form = document.getElementById("profile_edit_form"); 20998 form.onsubmit = function (ev) { 20999 ev.preventDefault(); 21000 handleFormSubmit(form, self.getConstraints()); 21001 }; 21002 21003 // Hook up the inputs to validate on the fly 21004 var inputs = document.querySelectorAll("input, textarea, select");
21005 inputs.forEach(function (element) { 21006 element.onchange = function (elem) { 21007 var errors = validate(form, self.getConstraints(), { fullMessages: false }) || {}; 21008 showErrorsForInput(this, errors[this.name]); 21009 }; 21010 }); 21011 21012 function handleFormSubmit(form, constraints) { 21013 // validate the form against the constraints 21014 var errors = validate(form, constraints, { fullMessages: false }); 21015 // then we update the form to reflect the results 21016 showErrors(form, errors || {}); 21017 if (!errors) { 21018 showSuccess(); 21019 } 21020 } 21021 21022 // Updates the inputs with the validation errors 21023 function showErrors(form, errors) { 21024 // We loop through all the inputs and show the errors for that input 21025 form.querySelectorAll(".input_validate").forEach(function (input) { 21026 // Since the errors can be null if no errors were found we need to handle that 21027 showErrorsForInput(input, errors && errors[input.name]); 21028 }); 21029 } 21030 21031 // Shows the errors for a specific input 21032 function showErrorsForInput(input, errors) { 21033 // This is the root of the input 21034 var formGroup = closestParent(input.parentNode, "form-group"); 21035 // Find where the error messages will be insert into 21036 var messages = formGroup.querySelector(".error-messages"); 21037 // First we remove any old messages and resets the classes 21038 resetFormGroup(formGroup, messages); 21039 // If we have errors 21040 if (errors) { 21041 // we first mark the group has having errors 21042 formGroup.classList.add("has-error"); 21043 // then we append all the errors 21044 errors.forEach(function (error) { 21045 addError(messages, error); 21046 }); 21047 } else { 21048 // otherwise we simply mark it as success 21049 formGroup.classList.add("has-success"); 21050 } 21051 } 21052 21053 // Recusively finds the closest parent that has the specified class 21054 function closestParent(_x, _x2) { 21055 var _again = true; 21056 21057 _function: while (_again) { 21058 var child = _x, 21059 className = _x2; 21060 _again = false; 21061 21062 if (!child || child == document) { 21063 return null; 21064 } 21065 if (child.classList.contains(className)) { 21066 return child; 21067 } else { 21068 _x = child.parentNode; 21069 _x2 = className; 21070 _again = true; 21071 continue _function; 21072 } 21073 } 21074 } 21075 21076 function resetFormGroup(formGroup, messages) { 21077 // Remove the success and error classes 21078 formGroup.classList.remove("has-error"); 21079 formGroup.classList.remove("has-success"); 21080 messages.classList.remove("show"); 21081 // and remove any old messages 21082 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 21083 // el.parentNode.removeChild(el); 21084 // }); 21085 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 21086 element.parentNode.removeChild(element); 21087 }); 21088 } 21089 21090 // Adds the specified error with the following markup 21091 // <p class="help-block error">[message]</p> 21092 function addError(messages, error) { 21093 var block = document.createElement("p"); 21094 block.classList.add("help-block"); 21095 block.classList.add("error"); 21096 block.innerText = error; 21097 messages.appendChild(block); 21098 messages.classList.add("show"); 21099 } 21100 21101 function showSuccess() { 21102 form.submit(); 21103 } 21104 } 21105 21106 // methods 21107 21108 _createClass(ProfileEdit, [{ 21109 key: 'getConstraints', 21110 value: function getConstraints() { 21111 var constraints = { 21112 'user[family_name]': { 21113 presence: { 21114 message: "å ¥åãã¦ãã ãã" 21115 } 21116 }, 21117 'user[first_name]': { 21118 presence: { 21119 message: "å ¥åãã¦ãã ãã" 21120 } 21121 }, 21122 'user[password]': { 21123 presence: { 21124 message: "å ¥åãã¦ãã ãã" 21125 }, 21126 length: { 21127 minimum: 8, 21128 message: "8æå以ä¸å ¥åãã¦ãã ãã" 21129 } 21130 }, 21131 'user[password_confirmation]': { 21132 presence: { 21133 message: "å ¥åãã¦ãã ãã" 21134 }, 21135 length: { 21136 minimum: 8, 21137 message: "8æå以ä¸å ¥åãã¦ãã ãã" 21138 }, 21139 equality: { 21140 attribute: "user[password]", 21141 message: "ãã¹ã¯ã¼ããä¸è´ãã¾ãã" 21142 } 21143 }, 21144 'user[agreement]': { 21145 presence: { 21146 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 21147 }, 21148 inclusion: { 21149 within: [true, '1'], 21150 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 21151 } 21152 } 21153 }; 21154 21155 if ($("#user_display_as_name").prop('checked')) { 21156 constraints['user[nickname]'] = { 21157 presence: { 21158 message: "å ¥åãã¦ãã ãã" 21159 } 21160 }; 21161 } 21162 21163 return constraints; 21164 } 21165 }]); 21166 21167 return ProfileEdit; 21168 })(); 21169 21170 exports['default'] = ProfileEdit; 21171 module.exports = exports['default']; 21172 21173/***/ }), 21174/* 390 */ 21175/***/ (function(module, exports, __webpack_require__) { 21176 21177 'use strict'; 21178 21179 Object.defineProperty(exports, '__esModule', { 21180 value: true 21181 }); 21182 21183 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 21184 21185 var validate = __webpack_require__(338); 21186 21187 var ProfileEdit = function ProfileEdit(args) { 21188 _classCallCheck(this, ProfileEdit); 21189 21190 console.log('profile_edit.js loaded'); 21191 21192 document.getElementById('user_description').onkeyup = function () { 21193 document.getElementById('user_description_count').innerHTML = 300 - this.value.length + "/300"; 21194 }; 21195 21196 // Form validation 21197 var constraints = { 21198 'user[family_name]': { 21199 presence: { 21200 message: "å ¥åãã¦ãã ãã" 21201 } 21202 }, 21203 'user[first_name]': { 21204 presence: { 21205 message: "å ¥åãã¦ãã ãã" 21206 } 21207 }, 21208 'user[web_site_url]': { 21209 url: true 21210 },
21211 'user[description]': { 21212 length: { 21213 maximum: 300, 21214 message: '300æå以å ã§å ¥åãã ãã' 21215 } 21216 }, 21217 'user[nickname]': { 21218 length: { 21219 maximum: 255, 21220 message: '255æå以å ã§å ¥åãã ãã' 21221 } 21222 } 21223 }; 21224 21225 // Hook up the form so we can prevent it from being posted 21226 var form = document.getElementById("profile_edit_form"); 21227 form.onsubmit = function (ev) { 21228 ev.preventDefault(); 21229 handleFormSubmit(form); 21230 }; 21231 21232 // Hook up the inputs to validate on the fly 21233 var inputs = document.querySelectorAll("input, textarea, select"); 21234 inputs.forEach(function (element) { 21235 element.onchange = function (elem) { 21236 var errors = validate(form, constraints, { fullMessages: false }) || {}; 21237 showErrorsForInput(this, errors[this.name]); 21238 }; 21239 }); 21240 21241 function handleFormSubmit(form, input) { 21242 // validate the form against the constraints 21243 var errors = validate(form, constraints, { fullMessages: false }); 21244 // then we update the form to reflect the results 21245 showErrors(form, errors || {}); 21246 if (!errors) { 21247 showSuccess(); 21248 } 21249 } 21250 21251 // Updates the inputs with the validation errors 21252 function showErrors(form, errors) { 21253 // We loop through all the inputs and show the errors for that input 21254 form.querySelectorAll(".input_validate").forEach(function (input) { 21255 // Since the errors can be null if no errors were found we need to handle that 21256 showErrorsForInput(input, errors && errors[input.name]); 21257 }); 21258 } 21259 21260 // Shows the errors for a specific input 21261 function showErrorsForInput(input, errors) { 21262 // This is the root of the input 21263 var formGroup = closestParent(input.parentNode, "form-group"); 21264 // Find where the error messages will be insert into 21265 var messages = formGroup.querySelector(".error-messages"); 21266 // First we remove any old messages and resets the classes 21267 resetFormGroup(formGroup, messages); 21268 // If we have errors 21269 if (errors) { 21270 // we first mark the group has having errors 21271 formGroup.classList.add("has-error"); 21272 // then we append all the errors 21273 errors.forEach(function (error) { 21274 addError(messages, error); 21275 }); 21276 } else { 21277 // otherwise we simply mark it as success 21278 formGroup.classList.add("has-success"); 21279 } 21280 } 21281 21282 // Recusively finds the closest parent that has the specified class 21283 function closestParent(_x, _x2) { 21284 var _again = true; 21285 21286 _function: while (_again) { 21287 var child = _x, 21288 className = _x2; 21289 _again = false; 21290 21291 if (!child || child == document) { 21292 return null; 21293 } 21294 if (child.classList.contains(className)) { 21295 return child; 21296 } else { 21297 _x = child.parentNode; 21298 _x2 = className; 21299 _again = true; 21300 continue _function; 21301 } 21302 } 21303 } 21304 21305 function resetFormGroup(formGroup, messages) { 21306 // Remove the success and error classes 21307 formGroup.classList.remove("has-error"); 21308 formGroup.classList.remove("has-success"); 21309 messages.classList.remove("show"); 21310 // and remove any old messages 21311 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 21312 // el.parentNode.removeChild(el); 21313 // }); 21314 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 21315 element.parentNode.removeChild(element); 21316 }); 21317 } 21318 21319 // Adds the specified error with the following markup 21320 // <p class="help-block error">[message]</p> 21321 function addError(messages, error) { 21322 var block = document.createElement("p"); 21323 block.classList.add("help-block"); 21324 block.classList.add("error"); 21325 block.innerText = error; 21326 messages.appendChild(block); 21327 messages.classList.add("show"); 21328 } 21329 21330 function showSuccess() { 21331 form.submit(); 21332 } 21333 } 21334 21335 // methods 21336 ; 21337 21338 exports['default'] = ProfileEdit; 21339 module.exports = exports['default']; 21340 21341/***/ }), 21342/* 391 */ 21343/***/ (function(module, exports, __webpack_require__) { 21344 21345 'use strict'; 21346 21347 Object.defineProperty(exports, '__esModule', { 21348 value: true 21349 }); 21350 21351 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 21352 21353 var validate = __webpack_require__(338); 21354 21355 var ProfileEditEmail = function ProfileEditEmail(args) { 21356 _classCallCheck(this, ProfileEditEmail); 21357 21358 console.log('profile_edit_email.js loaded'); 21359 21360 // Form validation 21361 var constraints = { 21362 'user[email]': { 21363 email: { 21364 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 21365 }, 21366 presence: { 21367 message: "å ¥åãã¦ãã ãã" 21368 } 21369 }, 21370 'user[password]': { 21371 presence: { 21372 message: "å ¥åãã¦ãã ãã" 21373 } 21374 } 21375 }; 21376 21377 // Hook up the form so we can prevent it from being posted 21378 var form = document.getElementById("profile_edit_form"); 21379 form.onsubmit = function (ev) { 21380 ev.preventDefault(); 21381 handleFormSubmit(form); 21382 }; 21383 21384 // Hook up the inputs to validate on the fly 21385 var inputs = document.querySelectorAll("input, textarea, select");
21386 inputs.forEach(function (element) { 21387 element.onchange = function (elem) { 21388 var errors = validate(form, constraints, { fullMessages: false }) || {}; 21389 showErrorsForInput(this, errors[this.name]); 21390 }; 21391 }); 21392 21393 function handleFormSubmit(form, input) { 21394 // validate the form against the constraints 21395 var errors = validate(form, constraints, { fullMessages: false }); 21396 // then we update the form to reflect the results 21397 showErrors(form, errors || {}); 21398 if (!errors) { 21399 showSuccess(); 21400 } 21401 } 21402 21403 // Updates the inputs with the validation errors 21404 function showErrors(form, errors) { 21405 // We loop through all the inputs and show the errors for that input 21406 form.querySelectorAll(".input_validate").forEach(function (input) { 21407 // Since the errors can be null if no errors were found we need to handle that 21408 showErrorsForInput(input, errors && errors[input.name]); 21409 }); 21410 } 21411 21412 // Shows the errors for a specific input 21413 function showErrorsForInput(input, errors) { 21414 // This is the root of the input 21415 var formGroup = closestParent(input.parentNode, "form-group"); 21416 // Find where the error messages will be insert into 21417 var messages = formGroup.querySelector(".error-messages"); 21418 // First we remove any old messages and resets the classes 21419 resetFormGroup(formGroup, messages); 21420 // If we have errors 21421 if (errors) { 21422 // we first mark the group has having errors 21423 formGroup.classList.add("has-error"); 21424 // then we append all the errors 21425 errors.forEach(function (error) { 21426 addError(messages, error); 21427 }); 21428 } else { 21429 // otherwise we simply mark it as success 21430 formGroup.classList.add("has-success"); 21431 } 21432 } 21433 21434 // Recusively finds the closest parent that has the specified class 21435 function closestParent(_x, _x2) { 21436 var _again = true; 21437 21438 _function: while (_again) { 21439 var child = _x, 21440 className = _x2; 21441 _again = false; 21442 21443 if (!child || child == document) { 21444 return null; 21445 } 21446 if (child.classList.contains(className)) { 21447 return child; 21448 } else { 21449 _x = child.parentNode; 21450 _x2 = className; 21451 _again = true; 21452 continue _function; 21453 } 21454 } 21455 } 21456 21457 function resetFormGroup(formGroup, messages) { 21458 // Remove the success and error classes 21459 formGroup.classList.remove("has-error"); 21460 formGroup.classList.remove("has-success"); 21461 messages.classList.remove("show"); 21462 // and remove any old messages 21463 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 21464 // el.parentNode.removeChild(el); 21465 // }); 21466 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 21467 element.parentNode.removeChild(element); 21468 }); 21469 } 21470 21471 // Adds the specified error with the following markup 21472 // <p class="help-block error">[message]</p> 21473 function addError(messages, error) { 21474 var block = document.createElement("p"); 21475 block.classList.add("help-block"); 21476 block.classList.add("error"); 21477 block.innerText = error; 21478 messages.appendChild(block); 21479 messages.classList.add("show"); 21480 } 21481 21482 function showSuccess() { 21483 form.submit(); 21484 } 21485 } 21486 21487 // methods 21488 ; 21489 21490 exports['default'] = ProfileEditEmail; 21491 module.exports = exports['default']; 21492 21493/***/ }), 21494/* 392 */ 21495/***/ (function(module, exports, __webpack_require__) { 21496 21497 'use strict'; 21498 21499 Object.defineProperty(exports, '__esModule', { 21500 value: true 21501 }); 21502 21503 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 21504 21505 var validate = __webpack_require__(338); 21506 var Cropper = __webpack_require__(393); 21507 var axios = __webpack_require__(394); 21508 21509 var ProfileImage = function ProfileImage(args) { 21510 _classCallCheck(this, ProfileImage); 21511 21512 console.log('profile_edit_image.js loaded'); 21513 21514 // Form validation 21515 var constraints = { 21516 'uploaded_file[photo]': { 21517 presence: { 21518 message: "ç»åã鏿ãã¦ãã ãã" 21519 } 21520 } 21521 }; 21522 21523 var cropper = false;
21524 var inputFile = document.getElementById("uploaded_file_photo"); 21525 21526 // Hook up the form so we can prevent it from being posted 21527 var form = document.getElementById("profile_image_form"); 21528 form.onsubmit = function (ev) { 21529 ev.preventDefault(); 21530 handleFormSubmit(form); 21531 }; 21532 21533 inputFile.onchange = function (elem) { 21534 var input = elem.target; 21535 21536 if (cropper !== false) { 21537 cropper.destroy(); 21538 } 21539 if (input.files[0].size <= 700000) { 21540 (function () { 21541 document.getElementById('image_error').classList.remove('show'); 21542 document.getElementById('image_error_inner').innerHTML = ""; 21543 21544 var fileName = input.files[0].name; 21545 if (input.files && input.files[0]) { 21546 var reader = new FileReader(); 21547 21548 reader.onload = function (e) { 21549 document.getElementById('image_crop').setAttribute('src', e.target.result); 21550 document.getElementById('image_name').innerHTML = fileName; 21551 21552 var image_crop = document.getElementById('image_crop'); 21553 cropper = new Cropper(image_crop, { 21554 autoCrop: true, 21555 rotatable: false, 21556 zoomOnWheel: false, 21557 aspectRatio: 1 / 1, 21558 // background: false, 21559 preview: '#image_preview', 21560 crop: function crop(e) { 21561 var cropedForm = document.forms.profile_image_form; 21562 cropedForm.x1.value = e.detail.x; 21563 cropedForm.y1.value = e.detail.y; 21564 cropedForm.w.value = e.detail.width; 21565 cropedForm.h.value = e.detail.height; 21566 cropedForm.x2.value = e.detail.scaleX; 21567 cropedForm.y2.value = e.detail.scaleY; 21568 // console.log('x1', e.detail.x); 21569 // console.log('y1', e.detail.y); 21570 // console.log('w', e.detail.width); 21571 // console.log('h', e.detail.height); 21572 // console.log('x2',e.detail.scaleX); 21573 // console.log('y2',e.detail.scaleY); 21574 } 21575 }); 21576 document.getElementById('image_preview').classList.add('show'); 21577 }; 21578 21579 // console.log(reader.readAsDataURL(input.files[0])); 21580 reader.readAsDataURL(input.files[0]); 21581 } 21582 })(); 21583 } else { 21584 document.getElementById('image_error').classList.add('show'); 21585 document.getElementById('image_error_inner').innerHTML = "ç»åã¯700kb以ä¸ã®jpgãpngãã¡ã¤ã«ã鏿ãã¦ãã ããã"; 21586 } 21587 }; 21588 21589 function handleFormSubmit(form, input) { 21590 // validate the form against the constraints 21591 var errors = validate(form, constraints, { fullMessages: false }); 21592 // then we update the form to reflect the results 21593 showErrors(form, errors || {}); 21594 if (!errors) { 21595 showSuccess(); 21596 } 21597 } 21598 21599 // Updates the inputs with the validation errors 21600 function showErrors(form, errors) { 21601 // We loop through all the inputs and show the errors for that input 21602 form.querySelectorAll(".input_validate").forEach(function (input) { 21603 // Since the errors can be null if no errors were found we need to handle that 21604 showErrorsForInput(input, errors && errors[input.name]); 21605 }); 21606 } 21607 21608 // Shows the errors for a specific input 21609 function showErrorsForInput(input, errors) { 21610 // This is the root of the input 21611 var formGroup = closestParent(input.parentNode, "form-group"); 21612 // Find where the error messages will be insert into 21613 var messages = formGroup.querySelector(".error-messages"); 21614 // First we remove any old messages and resets the classes 21615 resetFormGroup(formGroup, messages); 21616 // If we have errors 21617 if (errors) { 21618 // we first mark the group has having errors 21619 formGroup.classList.add("has-error"); 21620 // then we append all the errors 21621 errors.forEach(function (error) { 21622 addError(messages, error); 21623 }); 21624 } else { 21625 // otherwise we simply mark it as success 21626 formGroup.classList.add("has-success"); 21627 } 21628 } 21629 21630 // Recusively finds the closest parent that has the specified class 21631 function closestParent(_x, _x2) { 21632 var _again = true; 21633 21634 _function: while (_again) { 21635 var child = _x, 21636 className = _x2; 21637 _again = false;
21638 21639 if (!child || child == document) { 21640 return null; 21641 } 21642 if (child.classList.contains(className)) { 21643 return child; 21644 } else { 21645 _x = child.parentNode; 21646 _x2 = className; 21647 _again = true; 21648 continue _function; 21649 } 21650 } 21651 } 21652 21653 function resetFormGroup(formGroup, messages) { 21654 // Remove the success and error classes 21655 formGroup.classList.remove("has-error"); 21656 formGroup.classList.remove("has-success"); 21657 messages.classList.remove("show"); 21658 // and remove any old messages 21659 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 21660 // el.parentNode.removeChild(el); 21661 // }); 21662 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 21663 element.parentNode.removeChild(element); 21664 }); 21665 } 21666 21667 // Adds the specified error with the following markup 21668 // <p class="help-block error">[message]</p> 21669 function addError(messages, error) { 21670 var block = document.createElement("p"); 21671 block.classList.add("help-block"); 21672 block.classList.add("error"); 21673 block.innerText = error; 21674 messages.appendChild(block); 21675 messages.classList.add("show"); 21676 } 21677 21678 function showSuccess() { 21679 var croppedOption = cropper.canvasData; 21680 croppedOption.maxWidth = 4096; 21681 croppedOption.maxHeight = 4096; 21682 croppedOption.imageSmoothingEnabled = false; 21683 croppedOption.imageSmoothingQuality = 'high'; 21684 21685 var croppedCanvas = cropper.getCroppedCanvas(croppedOption); 21686 if (croppedCanvas.toBlob) { 21687 croppedCanvas.toBlob(function (blob) { 21688 uploadTmpImage(blob); 21689 }); 21690 } else if (croppedCanvas.msToBlob) { 21691 var blob = croppedCanvas.msToBlob(); 21692 uploadTmpImage(blob); 21693 } 21694 } 21695 21696 function uploadTmpImage(blob) { 21697 // console.log(blob); 21698 var formData = new FormData(); 21699 formData.append('croppedImage', blob); 21700 formData.append('authenticity_token', document.querySelector('meta[name="csrf-token"]').getAttribute('content')); 21701 axios.post('/profile/upload_tmp_face_image', formData, { headers: { 'content-type': 'multipart/form-data' } }).then(function (response) { 21702 location.href = "/profile"; 21703 })['catch'](function (error) {}); 21704 } 21705 } 21706 21707 // methods 21708 ; 21709 21710 exports['default'] = ProfileImage; 21711 module.exports = exports['default']; 21712 21713/***/ }), 21714/* 393 */ 21715/***/ (function(module, exports, __webpack_require__) { 21716 21717 /*! 21718 * Cropper.js v1.5.12 21719 * https://fengyuanchen.github.io/cropperjs 21720 * 21721 * Copyright 2015-present Chen Fengyuan 21722 * Released under the MIT license 21723 * 21724 * Date: 2021-06-12T08:00:17.411Z 21725 */ 21726 21727 (function (global, factory) { 21728 true ? module.exports = factory() : 21729 typeof define === 'function' && define.amd ? define(factory) : 21730 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Cropper = factory()); 21731 }(this, (function () { 'use strict'; 21732 21733 function ownKeys(object, enumerableOnly) { 21734 var keys = Object.keys(object); 21735 21736 if (Object.getOwnPropertySymbols) { 21737 var symbols = Object.getOwnPropertySymbols(object); 21738 21739 if (enumerableOnly) { 21740 symbols = symbols.filter(function (sym) { 21741 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 21742 }); 21743 } 21744 21745 keys.push.apply(keys, symbols); 21746 } 21747 21748 return keys; 21749 } 21750 21751 function _objectSpread2(target) { 21752 for (var i = 1; i < arguments.length; i++) { 21753 var source = arguments[i] != null ? arguments[i] : {}; 21754 21755 if (i % 2) { 21756 ownKeys(Object(source), true).forEach(function (key) { 21757 _defineProperty(target, key, source[key]); 21758 }); 21759 } else if (Object.getOwnPropertyDescriptors) { 21760 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 21761 } else { 21762 ownKeys(Object(source)).forEach(function (key) { 21763 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 21764 }); 21765 } 21766 } 21767 21768 return target; 21769 } 21770 21771 function _typeof(obj) { 21772 "@babel/helpers - typeof"; 21773 21774 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 21775 _typeof = function (obj) { 21776 return typeof obj; 21777 }; 21778 } else { 21779 _typeof = function (obj) { 21780 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 21781 }; 21782 } 21783 21784 return _typeof(obj); 21785 } 21786 21787 function _classCallCheck(instance, Constructor) { 21788 if (!(instance instanceof Constructor)) { 21789 throw new TypeError("Cannot call a class as a function"); 21790 } 21791 } 21792 21793 function _defineProperties(target, props) { 21794 for (var i = 0; i < props.length; i++) { 21795 var descriptor = props[i]; 21796 descriptor.enumerable = descriptor.enumerable || false; 21797 descriptor.configurable = true; 21798 if ("value" in descriptor) descriptor.writable = true; 21799 Object.defineProperty(target, descriptor.key, descriptor); 21800 } 21801 } 21802 21803 function _createClass(Constructor, protoProps, staticProps) { 21804 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 21805 if (staticProps) _defineProperties(Constructor, staticProps); 21806 return Constructor; 21807 } 21808 21809 function _defineProperty(obj, key, value) { 21810 if (key in obj) { 21811 Object.defineProperty(obj, key, { 21812 value: value, 21813 enumerable: true, 21814 configurable: true, 21815 writable: true 21816 }); 21817 } else { 21818 obj[key] = value; 21819 } 21820 21821 return obj; 21822 } 21823 21824 function _toConsumableArray(arr) { 21825 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); 21826 } 21827 21828 function _arrayWithoutHoles(arr) { 21829 if (Array.isArray(arr)) return _arrayLikeToArray(arr); 21830 } 21831 21832 function _iterableToArray(iter) { 21833 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 21834 } 21835 21836 function _unsupportedIterableToArray(o, minLen) { 21837 if (!o) return; 21838 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 21839 var n = Object.prototype.toString.call(o).slice(8, -1); 21840 if (n === "Object" && o.constructor) n = o.constructor.name; 21841 if (n === "Map" || n === "Set") return Array.from(o); 21842 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 21843 } 21844 21845 function _arrayLikeToArray(arr, len) { 21846 if (len == null || len > arr.length) len = arr.length; 21847 21848 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 21849 21850 return arr2; 21851 } 21852 21853 function _nonIterableSpread() { 21854 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 21855 } 21856
vendor: 89,639 bytes, lines 21857-24608
21857 var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; 21858 var WINDOW = IS_BROWSER ? window : {}; 21859 var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false; 21860 var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; 21861 var NAMESPACE = 'cropper'; // Actions 21862 21863 var ACTION_ALL = 'all'; 21864 var ACTION_CROP = 'crop'; 21865 var ACTION_MOVE = 'move'; 21866 var ACTION_ZOOM = 'zoom'; 21867 var ACTION_EAST = 'e'; 21868 var ACTION_WEST = 'w'; 21869 var ACTION_SOUTH = 's'; 21870 var ACTION_NORTH = 'n'; 21871 var ACTION_NORTH_EAST = 'ne'; 21872 var ACTION_NORTH_WEST = 'nw'; 21873 var ACTION_SOUTH_EAST = 'se'; 21874 var ACTION_SOUTH_WEST = 'sw'; // Classes 21875 21876 var CLASS_CROP = "".concat(NAMESPACE, "-crop"); 21877 var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled"); 21878 var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden"); 21879 var CLASS_HIDE = "".concat(NAMESPACE, "-hide"); 21880 var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible"); 21881 var CLASS_MODAL = "".concat(NAMESPACE, "-modal"); 21882 var CLASS_MOVE = "".concat(NAMESPACE, "-move"); // Data keys 21883 21884 var DATA_ACTION = "".concat(NAMESPACE, "Action"); 21885 var DATA_PREVIEW = "".concat(NAMESPACE, "Preview"); // Drag modes 21886 21887 var DRAG_MODE_CROP = 'crop'; 21888 var DRAG_MODE_MOVE = 'move'; 21889 var DRAG_MODE_NONE = 'none'; // Events 21890 21891 var EVENT_CROP = 'crop'; 21892 var EVENT_CROP_END = 'cropend'; 21893 var EVENT_CROP_MOVE = 'cropmove'; 21894 var EVENT_CROP_START = 'cropstart'; 21895 var EVENT_DBLCLICK = 'dblclick'; 21896 var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown'; 21897 var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove'; 21898 var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup'; 21899 var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START; 21900 var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE; 21901 var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END; 21902 var EVENT_READY = 'ready'; 21903 var EVENT_RESIZE = 'resize'; 21904 var EVENT_WHEEL = 'wheel'; 21905 var EVENT_ZOOM = 'zoom'; // Mime types 21906 21907 var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps 21908 21909 var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; 21910 var REGEXP_DATA_URL = /^data:/; 21911 var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; 21912 var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc 21913 // Inspired by the default width and height of a canvas element. 21914 21915 var MIN_CONTAINER_WIDTH = 200; 21916 var MIN_CONTAINER_HEIGHT = 100; 21917 21918 var DEFAULTS = { 21919 // Define the view mode of the cropper 21920 viewMode: 0, 21921 // 0, 1, 2, 3 21922 // Define the dragging mode of the cropper 21923 dragMode: DRAG_MODE_CROP, 21924 // 'crop', 'move' or 'none' 21925 // Define the initial aspect ratio of the crop box 21926 initialAspectRatio: NaN, 21927 // Define the aspect ratio of the crop box 21928 aspectRatio: NaN, 21929 // An object with the previous cropping result data 21930 data: null, 21931 // A selector for adding extra containers to preview 21932 preview: '', 21933 // Re-render the cropper when resize the window 21934 responsive: true, 21935 // Restore the cropped area after resize the window 21936 restore: true, 21937 // Check if the current image is a cross-origin image 21938 checkCrossOrigin: true, 21939 // Check the current image's Exif Orientation information 21940 checkOrientation: true, 21941 // Show the black modal 21942 modal: true, 21943 // Show the dashed lines for guiding 21944 guides: true, 21945 // Show the center indicator for guiding 21946 center: true, 21947 // Show the white modal to highlight the crop box 21948 highlight: true, 21949 // Show the grid background 21950 background: true, 21951 // Enable to crop the image automatically when initialize 21952 autoCrop: true, 21953 // Define the percentage of automatic cropping area when initializes 21954 autoCropArea: 0.8, 21955 // Enable to move the image 21956 movable: true, 21957 // Enable to rotate the image 21958 rotatable: true, 21959 // Enable to scale the image 21960 scalable: true, 21961 // Enable to zoom the image 21962 zoomable: true, 21963 // Enable to zoom the image by dragging touch 21964 zoomOnTouch: true, 21965 // Enable to zoom the image by wheeling mouse 21966 zoomOnWheel: true, 21967 // Define zoom ratio when zoom the image by wheeling mouse 21968 wheelZoomRatio: 0.1, 21969 // Enable to move the crop box 21970 cropBoxMovable: true, 21971 // Enable to resize the crop box 21972 cropBoxResizable: true, 21973 // Toggle drag mode between "crop" and "move" when click twice on the cropper 21974 toggleDragModeOnDblclick: true, 21975 // Size limitation 21976 minCanvasWidth: 0, 21977 minCanvasHeight: 0, 21978 minCropBoxWidth: 0, 21979 minCropBoxHeight: 0, 21980 minContainerWidth: MIN_CONTAINER_WIDTH, 21981 minContainerHeight: MIN_CONTAINER_HEIGHT, 21982 // Shortcuts of events 21983 ready: null, 21984 cropstart: null, 21985 cropmove: null, 21986 cropend: null, 21987 crop: null, 21988 zoom: null 21989 }; 21990 21991 var TEMPLATE = '<div class="cropper-container" touch-action="none">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-cropper-action="e"></span>' + '<span class="cropper-line line-n" data-cropper-action="n"></span>' + '<span class="cropper-line line-w" data-cropper-action="w"></span>' + '<span class="cropper-line line-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-e" data-cropper-action="e"></span>' + '<span class="cropper-point point-n" data-cropper-action="n"></span>' + '<span class="cropper-point point-w" data-cropper-action="w"></span>' + '<span class="cropper-point point-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-ne" data-cropper-action="ne"></span>' + '<span class="cropper-point point-nw" data-cropper-action="nw"></span>' + '<span class="cropper-point point-sw" data-cropper-action="sw"></span>' + '<span class="cropper-point point-se" data-cropper-action="se"></span>' + '</div>' + '</div>'; 21992 21993 /** 21994 * Check if the given value is not a number. 21995 */ 21996 21997 var isNaN = Number.isNaN || WINDOW.isNaN; 21998 /** 21999 * Check if the given value is a number. 22000 * @param {*} value - The value to check. 22001 * @returns {boolean} Returns `true` if the given value is a number, else `false`. 22002 */ 22003 22004 function isNumber(value) { 22005 return typeof value === 'number' && !isNaN(value); 22006 } 22007 /** 22008 * Check if the given value is a positive number. 22009 * @param {*} value - The value to check. 22010 * @returns {boolean} Returns `true` if the given value is a positive number, else `false`. 22011 */ 22012 22013 var isPositiveNumber = function isPositiveNumber(value) { 22014 return value > 0 && value < Infinity; 22015 }; 22016 /** 22017 * Check if the given value is undefined. 22018 * @param {*} value - The value to check. 22019 * @returns {boolean} Returns `true` if the given value is undefined, else `false`. 22020 */ 22021 22022 function isUndefined(value) { 22023 return typeof value === 'undefined'; 22024 } 22025 /** 22026 * Check if the given value is an object. 22027 * @param {*} value - The value to check. 22028 * @returns {boolean} Returns `true` if the given value is an object, else `false`. 22029 */ 22030 22031 function isObject(value) { 22032 return _typeof(value) === 'object' && value !== null; 22033 } 22034 var hasOwnProperty = Object.prototype.hasOwnProperty; 22035 /** 22036 * Check if the given value is a plain object. 22037 * @param {*} value - The value to check. 22038 * @returns {boolean} Returns `true` if the given value is a plain object, else `false`. 22039 */ 22040 22041 function isPlainObject(value) { 22042 if (!isObject(value)) { 22043 return false; 22044 } 22045 22046 try { 22047 var _constructor = value.constructor; 22048 var prototype = _constructor.prototype; 22049 return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf'); 22050 } catch (error) { 22051 return false; 22052 } 22053 } 22054 /** 22055 * Check if the given value is a function. 22056 * @param {*} value - The value to check. 22057 * @returns {boolean} Returns `true` if the given value is a function, else `false`. 22058 */ 22059 22060 function isFunction(value) { 22061 return typeof value === 'function'; 22062 } 22063 var slice = Array.prototype.slice; 22064 /** 22065 * Convert array-like or iterable object to an array. 22066 * @param {*} value - The value to convert. 22067 * @returns {Array} Returns a new array. 22068 */ 22069 22070 function toArray(value) { 22071 return Array.from ? Array.from(value) : slice.call(value); 22072 } 22073 /** 22074 * Iterate the given data. 22075 * @param {*} data - The data to iterate. 22076 * @param {Function} callback - The process function for each element. 22077 * @returns {*} The original data. 22078 */ 22079 22080 function forEach(data, callback) { 22081 if (data && isFunction(callback)) { 22082 if (Array.isArray(data) || isNumber(data.length) 22083 /* array-like */ 22084 ) { 22085 toArray(data).forEach(function (value, key) { 22086 callback.call(data, value, key, data); 22087 }); 22088 } else if (isObject(data)) { 22089 Object.keys(data).forEach(function (key) { 22090 callback.call(data, data[key], key, data); 22091 }); 22092 } 22093 } 22094 22095 return data; 22096 } 22097 /** 22098 * Extend the given object. 22099 * @param {*} target - The target object to extend. 22100 * @param {*} args - The rest objects for merging to the target object. 22101 * @returns {Object} The extended object. 22102 */ 22103 22104 var assign = Object.assign || function assign(target) { 22105 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 22106 args[_key - 1] = arguments[_key]; 22107 } 22108 22109 if (isObject(target) && args.length > 0) { 22110 args.forEach(function (arg) { 22111 if (isObject(arg)) { 22112 Object.keys(arg).forEach(function (key) { 22113 target[key] = arg[key]; 22114 }); 22115 } 22116 }); 22117 } 22118 22119 return target; 22120 }; 22121 var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; 22122 /** 22123 * Normalize decimal number. 22124 * Check out {@link https://0.30000000000000004.com/} 22125 * @param {number} value - The value to normalize. 22126 * @param {number} [times=100000000000] - The times for normalizing. 22127 * @returns {number} Returns the normalized number. 22128 */ 22129 22130 function normalizeDecimalNumber(value) { 22131 var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000; 22132 return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value; 22133 } 22134 var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/; 22135 /** 22136 * Apply styles to the given element. 22137 * @param {Element} element - The target element. 22138 * @param {Object} styles - The styles for applying. 22139 */ 22140 22141 function setStyle(element, styles) { 22142 var style = element.style; 22143 forEach(styles, function (value, property) { 22144 if (REGEXP_SUFFIX.test(property) && isNumber(value)) { 22145 value = "".concat(value, "px"); 22146 } 22147 22148 style[property] = value; 22149 }); 22150 } 22151 /** 22152 * Check if the given element has a special class. 22153 * @param {Element} element - The element to check. 22154 * @param {string} value - The class to search. 22155 * @returns {boolean} Returns `true` if the special class was found. 22156 */ 22157 22158 function hasClass(element, value) { 22159 return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1; 22160 } 22161 /** 22162 * Add classes to the given element. 22163 * @param {Element} element - The target element. 22164 * @param {string} value - The classes to be added. 22165 */ 22166 22167 function addClass(element, value) { 22168 if (!value) { 22169 return; 22170 } 22171 22172 if (isNumber(element.length)) { 22173 forEach(element, function (elem) { 22174 addClass(elem, value); 22175 }); 22176 return; 22177 } 22178 22179 if (element.classList) { 22180 element.classList.add(value); 22181 return; 22182 } 22183 22184 var className = element.className.trim(); 22185 22186 if (!className) { 22187 element.className = value; 22188 } else if (className.indexOf(value) < 0) { 22189 element.className = "".concat(className, " ").concat(value); 22190 } 22191 } 22192 /** 22193 * Remove classes from the given element. 22194 * @param {Element} element - The target element. 22195 * @param {string} value - The classes to be removed. 22196 */ 22197 22198 function removeClass(element, value) { 22199 if (!value) { 22200 return; 22201 } 22202 22203 if (isNumber(element.length)) { 22204 forEach(element, function (elem) { 22205 removeClass(elem, value); 22206 }); 22207 return; 22208 } 22209 22210 if (element.classList) { 22211 element.classList.remove(value); 22212 return; 22213 } 22214 22215 if (element.className.indexOf(value) >= 0) { 22216 element.className = element.className.replace(value, ''); 22217 } 22218 } 22219 /** 22220 * Add or remove classes from the given element. 22221 * @param {Element} element - The target element. 22222 * @param {string} value - The classes to be toggled. 22223 * @param {boolean} added - Add only. 22224 */ 22225 22226 function toggleClass(element, value, added) { 22227 if (!value) { 22228 return; 22229 } 22230 22231 if (isNumber(element.length)) { 22232 forEach(element, function (elem) { 22233 toggleClass(elem, value, added); 22234 }); 22235 return; 22236 } // IE10-11 doesn't support the second parameter of `classList.toggle` 22237 22238 22239 if (added) { 22240 addClass(element, value); 22241 } else { 22242 removeClass(element, value); 22243 } 22244 } 22245 var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g; 22246 /** 22247 * Transform the given string from camelCase to kebab-case 22248 * @param {string} value - The value to transform. 22249 * @returns {string} The transformed value. 22250 */ 22251 22252 function toParamCase(value) { 22253 return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase(); 22254 } 22255 /** 22256 * Get data from the given element. 22257 * @param {Element} element - The target element. 22258 * @param {string} name - The data key to get. 22259 * @returns {string} The data value. 22260 */ 22261 22262 function getData(element, name) { 22263 if (isObject(element[name])) { 22264 return element[name]; 22265 } 22266 22267 if (element.dataset) { 22268 return element.dataset[name]; 22269 } 22270 22271 return element.getAttribute("data-".concat(toParamCase(name))); 22272 } 22273 /** 22274 * Set data to the given element. 22275 * @param {Element} element - The target element. 22276 * @param {string} name - The data key to set. 22277 * @param {string} data - The data value. 22278 */ 22279 22280 function setData(element, name, data) { 22281 if (isObject(data)) { 22282 element[name] = data; 22283 } else if (element.dataset) { 22284 element.dataset[name] = data; 22285 } else { 22286 element.setAttribute("data-".concat(toParamCase(name)), data); 22287 } 22288 } 22289 /** 22290 * Remove data from the given element. 22291 * @param {Element} element - The target element. 22292 * @param {string} name - The data key to remove. 22293 */ 22294 22295 function removeData(element, name) { 22296 if (isObject(element[name])) { 22297 try { 22298 delete element[name]; 22299 } catch (error) { 22300 element[name] = undefined; 22301 } 22302 } else if (element.dataset) { 22303 // #128 Safari not allows to delete dataset property 22304 try { 22305 delete element.dataset[name]; 22306 } catch (error) { 22307 element.dataset[name] = undefined; 22308 } 22309 } else { 22310 element.removeAttribute("data-".concat(toParamCase(name))); 22311 } 22312 } 22313 var REGEXP_SPACES = /\s\s*/; 22314 22315 var onceSupported = function () { 22316 var supported = false; 22317 22318 if (IS_BROWSER) { 22319 var once = false; 22320 22321 var listener = function listener() {}; 22322 22323 var options = Object.defineProperty({}, 'once', { 22324 get: function get() { 22325 supported = true; 22326 return once; 22327 }, 22328 22329 /** 22330 * This setter can fix a `TypeError` in strict mode 22331 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only} 22332 * @param {boolean} value - The value to set 22333 */ 22334 set: function set(value) { 22335 once = value; 22336 } 22337 }); 22338 WINDOW.addEventListener('test', listener, options); 22339 WINDOW.removeEventListener('test', listener, options); 22340 } 22341 22342 return supported; 22343 }(); 22344 /** 22345 * Remove event listener from the target element. 22346 * @param {Element} element - The event target. 22347 * @param {string} type - The event type(s). 22348 * @param {Function} listener - The event listener. 22349 * @param {Object} options - The event options. 22350 */ 22351 22352 22353 function removeListener(element, type, listener) { 22354 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; 22355 var handler = listener; 22356 type.trim().split(REGEXP_SPACES).forEach(function (event) { 22357 if (!onceSupported) { 22358 var listeners = element.listeners; 22359 22360 if (listeners && listeners[event] && listeners[event][listener]) { 22361 handler = listeners[event][listener]; 22362 delete listeners[event][listener]; 22363 22364 if (Object.keys(listeners[event]).length === 0) { 22365 delete listeners[event]; 22366 } 22367 22368 if (Object.keys(listeners).length === 0) { 22369 delete element.listeners; 22370 } 22371 } 22372 } 22373 22374 element.removeEventListener(event, handler, options); 22375 }); 22376 } 22377 /** 22378 * Add event listener to the target element. 22379 * @param {Element} element - The event target. 22380 * @param {string} type - The event type(s). 22381 * @param {Function} listener - The event listener. 22382 * @param {Object} options - The event options. 22383 */ 22384 22385 function addListener(element, type, listener) { 22386 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; 22387 var _handler = listener; 22388 type.trim().split(REGEXP_SPACES).forEach(function (event) { 22389 if (options.once && !onceSupported) { 22390 var _element$listeners = element.listeners, 22391 listeners = _element$listeners === void 0 ? {} : _element$listeners; 22392 22393 _handler = function handler() { 22394 delete listeners[event][listener]; 22395 element.removeEventListener(event, _handler, options); 22396 22397 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 22398 args[_key2] = arguments[_key2]; 22399 } 22400 22401 listener.apply(element, args); 22402 }; 22403 22404 if (!listeners[event]) { 22405 listeners[event] = {}; 22406 } 22407 22408 if (listeners[event][listener]) { 22409 element.removeEventListener(event, listeners[event][listener], options); 22410 } 22411 22412 listeners[event][listener] = _handler; 22413 element.listeners = listeners; 22414 } 22415 22416 element.addEventListener(event, _handler, options); 22417 }); 22418 } 22419 /** 22420 * Dispatch event on the target element. 22421 * @param {Element} element - The event target. 22422 * @param {string} type - The event type(s). 22423 * @param {Object} data - The additional event data. 22424 * @returns {boolean} Indicate if the event is default prevented or not. 22425 */ 22426 22427 function dispatchEvent(element, type, data) { 22428 var event; // Event and CustomEvent on IE9-11 are global objects, not constructors 22429 22430 if (isFunction(Event) && isFunction(CustomEvent)) { 22431 event = new CustomEvent(type, { 22432 detail: data, 22433 bubbles: true, 22434 cancelable: true 22435 }); 22436 } else { 22437 event = document.createEvent('CustomEvent'); 22438 event.initCustomEvent(type, true, true, data); 22439 } 22440 22441 return element.dispatchEvent(event); 22442 } 22443 /** 22444 * Get the offset base on the document. 22445 * @param {Element} element - The target element. 22446 * @returns {Object} The offset data. 22447 */ 22448 22449 function getOffset(element) { 22450 var box = element.getBoundingClientRect(); 22451 return { 22452 left: box.left + (window.pageXOffset - document.documentElement.clientLeft), 22453 top: box.top + (window.pageYOffset - document.documentElement.clientTop) 22454 }; 22455 } 22456 var location = WINDOW.location; 22457 var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i; 22458 /** 22459 * Check if the given URL is a cross origin URL. 22460 * @param {string} url - The target URL. 22461 * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`. 22462 */ 22463 22464 function isCrossOriginURL(url) { 22465 var parts = url.match(REGEXP_ORIGINS); 22466 return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port); 22467 } 22468 /** 22469 * Add timestamp to the given URL. 22470 * @param {string} url - The target URL. 22471 * @returns {string} The result URL. 22472 */ 22473 22474 function addTimestamp(url) { 22475 var timestamp = "timestamp=".concat(new Date().getTime()); 22476 return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp; 22477 } 22478 /** 22479 * Get transforms base on the given object. 22480 * @param {Object} obj - The target object. 22481 * @returns {string} A string contains transform values. 22482 */ 22483 22484 function getTransforms(_ref) { 22485 var rotate = _ref.rotate, 22486 scaleX = _ref.scaleX, 22487 scaleY = _ref.scaleY, 22488 translateX = _ref.translateX, 22489 translateY = _ref.translateY; 22490 var values = []; 22491 22492 if (isNumber(translateX) && translateX !== 0) { 22493 values.push("translateX(".concat(translateX, "px)")); 22494 } 22495 22496 if (isNumber(translateY) && translateY !== 0) { 22497 values.push("translateY(".concat(translateY, "px)")); 22498 } // Rotate should come first before scale to match orientation transform 22499 22500 22501 if (isNumber(rotate) && rotate !== 0) { 22502 values.push("rotate(".concat(rotate, "deg)")); 22503 } 22504 22505 if (isNumber(scaleX) && scaleX !== 1) { 22506 values.push("scaleX(".concat(scaleX, ")")); 22507 } 22508 22509 if (isNumber(scaleY) && scaleY !== 1) { 22510 values.push("scaleY(".concat(scaleY, ")")); 22511 } 22512 22513 var transform = values.length ? values.join(' ') : 'none'; 22514 return { 22515 WebkitTransform: transform, 22516 msTransform: transform, 22517 transform: transform 22518 }; 22519 } 22520 /** 22521 * Get the max ratio of a group of pointers. 22522 * @param {string} pointers - The target pointers. 22523 * @returns {number} The result ratio. 22524 */ 22525 22526 function getMaxZoomRatio(pointers) { 22527 var pointers2 = _objectSpread2({}, pointers); 22528 22529 var maxRatio = 0; 22530 forEach(pointers, function (pointer, pointerId) { 22531 delete pointers2[pointerId]; 22532 forEach(pointers2, function (pointer2) { 22533 var x1 = Math.abs(pointer.startX - pointer2.startX); 22534 var y1 = Math.abs(pointer.startY - pointer2.startY); 22535 var x2 = Math.abs(pointer.endX - pointer2.endX); 22536 var y2 = Math.abs(pointer.endY - pointer2.endY); 22537 var z1 = Math.sqrt(x1 * x1 + y1 * y1); 22538 var z2 = Math.sqrt(x2 * x2 + y2 * y2); 22539 var ratio = (z2 - z1) / z1; 22540 22541 if (Math.abs(ratio) > Math.abs(maxRatio)) { 22542 maxRatio = ratio; 22543 } 22544 }); 22545 }); 22546 return maxRatio; 22547 } 22548 /** 22549 * Get a pointer from an event object. 22550 * @param {Object} event - The target event object. 22551 * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not. 22552 * @returns {Object} The result pointer contains start and/or end point coordinates. 22553 */ 22554 22555 function getPointer(_ref2, endOnly) { 22556 var pageX = _ref2.pageX, 22557 pageY = _ref2.pageY; 22558 var end = { 22559 endX: pageX, 22560 endY: pageY 22561 }; 22562 return endOnly ? end : _objectSpread2({ 22563 startX: pageX, 22564 startY: pageY 22565 }, end); 22566 } 22567 /** 22568 * Get the center point coordinate of a group of pointers. 22569 * @param {Object} pointers - The target pointers. 22570 * @returns {Object} The center point coordinate. 22571 */ 22572 22573 function getPointersCenter(pointers) { 22574 var pageX = 0; 22575 var pageY = 0; 22576 var count = 0; 22577 forEach(pointers, function (_ref3) { 22578 var startX = _ref3.startX, 22579 startY = _ref3.startY; 22580 pageX += startX; 22581 pageY += startY; 22582 count += 1; 22583 }); 22584 pageX /= count; 22585 pageY /= count; 22586 return { 22587 pageX: pageX, 22588 pageY: pageY 22589 }; 22590 } 22591 /** 22592 * Get the max sizes in a rectangle under the given aspect ratio. 22593 * @param {Object} data - The original sizes. 22594 * @param {string} [type='contain'] - The adjust type. 22595 * @returns {Object} The result sizes. 22596 */ 22597 22598 function getAdjustedSizes(_ref4) // or 'cover' 22599 { 22600 var aspectRatio = _ref4.aspectRatio, 22601 height = _ref4.height, 22602 width = _ref4.width; 22603 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain'; 22604 var isValidWidth = isPositiveNumber(width); 22605 var isValidHeight = isPositiveNumber(height); 22606 22607 if (isValidWidth && isValidHeight) { 22608 var adjustedWidth = height * aspectRatio; 22609 22610 if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) { 22611 height = width / aspectRatio; 22612 } else { 22613 width = height * aspectRatio; 22614 } 22615 } else if (isValidWidth) { 22616 height = width / aspectRatio; 22617 } else if (isValidHeight) { 22618 width = height * aspectRatio; 22619 } 22620 22621 return { 22622 width: width, 22623 height: height 22624 }; 22625 } 22626 /** 22627 * Get the new sizes of a rectangle after rotated. 22628 * @param {Object} data - The original sizes. 22629 * @returns {Object} The result sizes. 22630 */ 22631 22632 function getRotatedSizes(_ref5) { 22633 var width = _ref5.width, 22634 height = _ref5.height, 22635 degree = _ref5.degree; 22636 degree = Math.abs(degree) % 180; 22637 22638 if (degree === 90) { 22639 return { 22640 width: height, 22641 height: width 22642 }; 22643 } 22644 22645 var arc = degree % 90 * Math.PI / 180; 22646 var sinArc = Math.sin(arc); 22647 var cosArc = Math.cos(arc); 22648 var newWidth = width * cosArc + height * sinArc; 22649 var newHeight = width * sinArc + height * cosArc; 22650 return degree > 90 ? { 22651 width: newHeight, 22652 height: newWidth 22653 } : { 22654 width: newWidth, 22655 height: newHeight 22656 }; 22657 } 22658 /** 22659 * Get a canvas which drew the given image. 22660 * @param {HTMLImageElement} image - The image for drawing. 22661 * @param {Object} imageData - The image data. 22662 * @param {Object} canvasData - The canvas data. 22663 * @param {Object} options - The options. 22664 * @returns {HTMLCanvasElement} The result canvas. 22665 */ 22666 22667 function getSourceCanvas(image, _ref6, _ref7, _ref8) { 22668 var imageAspectRatio = _ref6.aspectRatio, 22669 imageNaturalWidth = _ref6.naturalWidth, 22670 imageNaturalHeight = _ref6.naturalHeight, 22671 _ref6$rotate = _ref6.rotate, 22672 rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate, 22673 _ref6$scaleX = _ref6.scaleX, 22674 scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX, 22675 _ref6$scaleY = _ref6.scaleY, 22676 scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY; 22677 var aspectRatio = _ref7.aspectRatio, 22678 naturalWidth = _ref7.naturalWidth, 22679 naturalHeight = _ref7.naturalHeight; 22680 var _ref8$fillColor = _ref8.fillColor, 22681 fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor, 22682 _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled, 22683 imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE, 22684 _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality, 22685 imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ, 22686 _ref8$maxWidth = _ref8.maxWidth, 22687 maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth, 22688 _ref8$maxHeight = _ref8.maxHeight, 22689 maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight, 22690 _ref8$minWidth = _ref8.minWidth, 22691 minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth, 22692 _ref8$minHeight = _ref8.minHeight, 22693 minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight; 22694 var canvas = document.createElement('canvas'); 22695 var context = canvas.getContext('2d'); 22696 var maxSizes = getAdjustedSizes({ 22697 aspectRatio: aspectRatio, 22698 width: maxWidth, 22699 height: maxHeight 22700 }); 22701 var minSizes = getAdjustedSizes({ 22702 aspectRatio: aspectRatio, 22703 width: minWidth, 22704 height: minHeight 22705 }, 'cover'); 22706 var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth)); 22707 var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as 22708 // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90 22709 22710 var destMaxSizes = getAdjustedSizes({ 22711 aspectRatio: imageAspectRatio, 22712 width: maxWidth, 22713 height: maxHeight 22714 }); 22715 var destMinSizes = getAdjustedSizes({ 22716 aspectRatio: imageAspectRatio, 22717 width: minWidth, 22718 height: minHeight 22719 }, 'cover'); 22720 var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth)); 22721 var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight)); 22722 var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight]; 22723 canvas.width = normalizeDecimalNumber(width); 22724 canvas.height = normalizeDecimalNumber(height); 22725 context.fillStyle = fillColor; 22726 context.fillRect(0, 0, width, height); 22727 context.save(); 22728 context.translate(width / 2, height / 2); 22729 context.rotate(rotate * Math.PI / 180); 22730 context.scale(scaleX, scaleY); 22731 context.imageSmoothingEnabled = imageSmoothingEnabled; 22732 context.imageSmoothingQuality = imageSmoothingQuality; 22733 context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) { 22734 return Math.floor(normalizeDecimalNumber(param)); 22735 })))); 22736 context.restore(); 22737 return canvas; 22738 } 22739 var fromCharCode = String.fromCharCode; 22740 /** 22741 * Get string from char code in data view. 22742 * @param {DataView} dataView - The data view for read. 22743 * @param {number} start - The start index. 22744 * @param {number} length - The read length. 22745 * @returns {string} The read result. 22746 */ 22747 22748 function getStringFromCharCode(dataView, start, length) { 22749 var str = ''; 22750 length += start; 22751 22752 for (var i = start; i < length; i += 1) { 22753 str += fromCharCode(dataView.getUint8(i)); 22754 } 22755 22756 return str; 22757 } 22758 var REGEXP_DATA_URL_HEAD = /^data:.*,/; 22759 /** 22760 * Transform Data URL to array buffer. 22761 * @param {string} dataURL - The Data URL to transform. 22762 * @returns {ArrayBuffer} The result array buffer. 22763 */ 22764 22765 function dataURLToArrayBuffer(dataURL) { 22766 var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, ''); 22767 var binary = atob(base64); 22768 var arrayBuffer = new ArrayBuffer(binary.length); 22769 var uint8 = new Uint8Array(arrayBuffer); 22770 forEach(uint8, function (value, i) { 22771 uint8[i] = binary.charCodeAt(i); 22772 }); 22773 return arrayBuffer; 22774 } 22775 /** 22776 * Transform array buffer to Data URL. 22777 * @param {ArrayBuffer} arrayBuffer - The array buffer to transform. 22778 * @param {string} mimeType - The mime type of the Data URL. 22779 * @returns {string} The result Data URL. 22780 */ 22781 22782 function arrayBufferToDataURL(arrayBuffer, mimeType) { 22783 var chunks = []; // Chunk Typed Array for better performance (#435) 22784 22785 var chunkSize = 8192; 22786 var uint8 = new Uint8Array(arrayBuffer); 22787 22788 while (uint8.length > 0) { 22789 // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9 22790 // eslint-disable-next-line prefer-spread 22791 chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize)))); 22792 uint8 = uint8.subarray(chunkSize); 22793 } 22794 22795 return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join(''))); 22796 } 22797 /** 22798 * Get orientation value from given array buffer. 22799 * @param {ArrayBuffer} arrayBuffer - The array buffer to read. 22800 * @returns {number} The read orientation value. 22801 */ 22802 22803 function resetAndGetOrientation(arrayBuffer) { 22804 var dataView = new DataView(arrayBuffer); 22805 var orientation; // Ignores range error when the image does not have correct Exif information 22806 22807 try { 22808 var littleEndian; 22809 var app1Start; 22810 var ifdStart; // Only handle JPEG image (start by 0xFFD8) 22811 22812 if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) { 22813 var length = dataView.byteLength; 22814 var offset = 2; 22815 22816 while (offset + 1 < length) { 22817 if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) { 22818 app1Start = offset; 22819 break; 22820 } 22821 22822 offset += 1; 22823 } 22824 } 22825 22826 if (app1Start) { 22827 var exifIDCode = app1Start + 4; 22828 var tiffOffset = app1Start + 10; 22829 22830 if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') { 22831 var endianness = dataView.getUint16(tiffOffset); 22832 littleEndian = endianness === 0x4949; 22833 22834 if (littleEndian || endianness === 0x4D4D 22835 /* bigEndian */ 22836 ) { 22837 if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) { 22838 var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian); 22839 22840 if (firstIFDOffset >= 0x00000008) { 22841 ifdStart = tiffOffset + firstIFDOffset; 22842 } 22843 } 22844 } 22845 } 22846 } 22847 22848 if (ifdStart) { 22849 var _length = dataView.getUint16(ifdStart, littleEndian); 22850 22851 var _offset; 22852 22853 var i; 22854 22855 for (i = 0; i < _length; i += 1) { 22856 _offset = ifdStart + i * 12 + 2; 22857 22858 if (dataView.getUint16(_offset, littleEndian) === 0x0112 22859 /* Orientation */ 22860 ) { 22861 // 8 is the offset of the current tag's value 22862 _offset += 8; // Get the original orientation value 22863 22864 orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value 22865 22866 dataView.setUint16(_offset, 1, littleEndian); 22867 break; 22868 } 22869 } 22870 } 22871 } catch (error) { 22872 orientation = 1; 22873 } 22874 22875 return orientation; 22876 } 22877 /** 22878 * Parse Exif Orientation value. 22879 * @param {number} orientation - The orientation to parse. 22880 * @returns {Object} The parsed result. 22881 */ 22882 22883 function parseOrientation(orientation) { 22884 var rotate = 0; 22885 var scaleX = 1; 22886 var scaleY = 1; 22887 22888 switch (orientation) { 22889 // Flip horizontal 22890 case 2: 22891 scaleX = -1; 22892 break; 22893 // Rotate left 180° 22894 22895 case 3: 22896 rotate = -180; 22897 break; 22898 // Flip vertical 22899 22900 case 4: 22901 scaleY = -1; 22902 break; 22903 // Flip vertical and rotate right 90° 22904 22905 case 5: 22906 rotate = 90; 22907 scaleY = -1; 22908 break; 22909 // Rotate right 90° 22910 22911 case 6: 22912 rotate = 90; 22913 break; 22914 // Flip horizontal and rotate right 90° 22915 22916 case 7: 22917 rotate = 90; 22918 scaleX = -1; 22919 break; 22920 // Rotate left 90° 22921 22922 case 8: 22923 rotate = -90; 22924 break; 22925 } 22926 22927 return { 22928 rotate: rotate, 22929 scaleX: scaleX, 22930 scaleY: scaleY 22931 }; 22932 } 22933 22934 var render = { 22935 render: function render() { 22936 this.initContainer(); 22937 this.initCanvas(); 22938 this.initCropBox(); 22939 this.renderCanvas(); 22940 22941 if (this.cropped) { 22942 this.renderCropBox(); 22943 } 22944 }, 22945 initContainer: function initContainer() { 22946 var element = this.element, 22947 options = this.options, 22948 container = this.container, 22949 cropper = this.cropper; 22950 var minWidth = Number(options.minContainerWidth); 22951 var minHeight = Number(options.minContainerHeight); 22952 addClass(cropper, CLASS_HIDDEN); 22953 removeClass(element, CLASS_HIDDEN); 22954 var containerData = { 22955 width: Math.max(container.offsetWidth, minWidth >= 0 ? minWidth : MIN_CONTAINER_WIDTH), 22956 height: Math.max(container.offsetHeight, minHeight >= 0 ? minHeight : MIN_CONTAINER_HEIGHT) 22957 }; 22958 this.containerData = containerData; 22959 setStyle(cropper, { 22960 width: containerData.width, 22961 height: containerData.height 22962 }); 22963 addClass(element, CLASS_HIDDEN); 22964 removeClass(cropper, CLASS_HIDDEN); 22965 }, 22966 // Canvas (image wrapper) 22967 initCanvas: function initCanvas() { 22968 var containerData = this.containerData, 22969 imageData = this.imageData; 22970 var viewMode = this.options.viewMode; 22971 var rotated = Math.abs(imageData.rotate) % 180 === 90; 22972 var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth; 22973 var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight; 22974 var aspectRatio = naturalWidth / naturalHeight; 22975 var canvasWidth = containerData.width; 22976 var canvasHeight = containerData.height; 22977 22978 if (containerData.height * aspectRatio > containerData.width) { 22979 if (viewMode === 3) { 22980 canvasWidth = containerData.height * aspectRatio; 22981 } else { 22982 canvasHeight = containerData.width / aspectRatio; 22983 } 22984 } else if (viewMode === 3) { 22985 canvasHeight = containerData.width / aspectRatio; 22986 } else { 22987 canvasWidth = containerData.height * aspectRatio; 22988 } 22989 22990 var canvasData = { 22991 aspectRatio: aspectRatio, 22992 naturalWidth: naturalWidth, 22993 naturalHeight: naturalHeight, 22994 width: canvasWidth, 22995 height: canvasHeight 22996 }; 22997 this.canvasData = canvasData; 22998 this.limited = viewMode === 1 || viewMode === 2; 22999 this.limitCanvas(true, true); 23000 canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth); 23001 canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight); 23002 canvasData.left = (containerData.width - canvasData.width) / 2; 23003 canvasData.top = (containerData.height - canvasData.height) / 2; 23004 canvasData.oldLeft = canvasData.left; 23005 canvasData.oldTop = canvasData.top; 23006 this.initialCanvasData = assign({}, canvasData); 23007 }, 23008 limitCanvas: function limitCanvas(sizeLimited, positionLimited) { 23009 var options = this.options, 23010 containerData = this.containerData, 23011 canvasData = this.canvasData, 23012 cropBoxData = this.cropBoxData; 23013 var viewMode = options.viewMode; 23014 var aspectRatio = canvasData.aspectRatio; 23015 var cropped = this.cropped && cropBoxData; 23016 23017 if (sizeLimited) { 23018 var minCanvasWidth = Number(options.minCanvasWidth) || 0; 23019 var minCanvasHeight = Number(options.minCanvasHeight) || 0; 23020 23021 if (viewMode > 1) { 23022 minCanvasWidth = Math.max(minCanvasWidth, containerData.width); 23023 minCanvasHeight = Math.max(minCanvasHeight, containerData.height); 23024 23025 if (viewMode === 3) { 23026 if (minCanvasHeight * aspectRatio > minCanvasWidth) { 23027 minCanvasWidth = minCanvasHeight * aspectRatio; 23028 } else { 23029 minCanvasHeight = minCanvasWidth / aspectRatio; 23030 } 23031 } 23032 } else if (viewMode > 0) { 23033 if (minCanvasWidth) { 23034 minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0); 23035 } else if (minCanvasHeight) { 23036 minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0); 23037 } else if (cropped) { 23038 minCanvasWidth = cropBoxData.width; 23039 minCanvasHeight = cropBoxData.height; 23040 23041 if (minCanvasHeight * aspectRatio > minCanvasWidth) { 23042 minCanvasWidth = minCanvasHeight * aspectRatio; 23043 } else { 23044 minCanvasHeight = minCanvasWidth / aspectRatio; 23045 } 23046 } 23047 } 23048 23049 var _getAdjustedSizes = getAdjustedSizes({ 23050 aspectRatio: aspectRatio, 23051 width: minCanvasWidth, 23052 height: minCanvasHeight 23053 }); 23054 23055 minCanvasWidth = _getAdjustedSizes.width; 23056 minCanvasHeight = _getAdjustedSizes.height; 23057 canvasData.minWidth = minCanvasWidth; 23058 canvasData.minHeight = minCanvasHeight; 23059 canvasData.maxWidth = Infinity; 23060 canvasData.maxHeight = Infinity; 23061 } 23062 23063 if (positionLimited) { 23064 if (viewMode > (cropped ? 0 : 1)) { 23065 var newCanvasLeft = containerData.width - canvasData.width; 23066 var newCanvasTop = containerData.height - canvasData.height; 23067 canvasData.minLeft = Math.min(0, newCanvasLeft); 23068 canvasData.minTop = Math.min(0, newCanvasTop); 23069 canvasData.maxLeft = Math.max(0, newCanvasLeft); 23070 canvasData.maxTop = Math.max(0, newCanvasTop); 23071 23072 if (cropped && this.limited) { 23073 canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width)); 23074 canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height)); 23075 canvasData.maxLeft = cropBoxData.left; 23076 canvasData.maxTop = cropBoxData.top; 23077 23078 if (viewMode === 2) { 23079 if (canvasData.width >= containerData.width) { 23080 canvasData.minLeft = Math.min(0, newCanvasLeft); 23081 canvasData.maxLeft = Math.max(0, newCanvasLeft); 23082 } 23083 23084 if (canvasData.height >= containerData.height) { 23085 canvasData.minTop = Math.min(0, newCanvasTop); 23086 canvasData.maxTop = Math.max(0, newCanvasTop); 23087 } 23088 } 23089 } 23090 } else { 23091 canvasData.minLeft = -canvasData.width; 23092 canvasData.minTop = -canvasData.height; 23093 canvasData.maxLeft = containerData.width; 23094 canvasData.maxTop = containerData.height; 23095 } 23096 } 23097 }, 23098 renderCanvas: function renderCanvas(changed, transformed) { 23099 var canvasData = this.canvasData, 23100 imageData = this.imageData; 23101 23102 if (transformed) { 23103 var _getRotatedSizes = getRotatedSizes({ 23104 width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1), 23105 height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1), 23106 degree: imageData.rotate || 0 23107 }), 23108 naturalWidth = _getRotatedSizes.width, 23109 naturalHeight = _getRotatedSizes.height; 23110 23111 var width = canvasData.width * (naturalWidth / canvasData.naturalWidth); 23112 var height = canvasData.height * (naturalHeight / canvasData.naturalHeight); 23113 canvasData.left -= (width - canvasData.width) / 2; 23114 canvasData.top -= (height - canvasData.height) / 2; 23115 canvasData.width = width; 23116 canvasData.height = height; 23117 canvasData.aspectRatio = naturalWidth / naturalHeight; 23118 canvasData.naturalWidth = naturalWidth; 23119 canvasData.naturalHeight = naturalHeight; 23120 this.limitCanvas(true, false); 23121 } 23122 23123 if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) { 23124 canvasData.left = canvasData.oldLeft; 23125 } 23126 23127 if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) { 23128 canvasData.top = canvasData.oldTop; 23129 } 23130 23131 canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth); 23132 canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight); 23133 this.limitCanvas(false, true); 23134 canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft); 23135 canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop); 23136 canvasData.oldLeft = canvasData.left; 23137 canvasData.oldTop = canvasData.top; 23138 setStyle(this.canvas, assign({ 23139 width: canvasData.width, 23140 height: canvasData.height 23141 }, getTransforms({ 23142 translateX: canvasData.left, 23143 translateY: canvasData.top 23144 }))); 23145 this.renderImage(changed); 23146 23147 if (this.cropped && this.limited) { 23148 this.limitCropBox(true, true); 23149 } 23150 }, 23151 renderImage: function renderImage(changed) { 23152 var canvasData = this.canvasData, 23153 imageData = this.imageData; 23154 var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth); 23155 var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight); 23156 assign(imageData, { 23157 width: width, 23158 height: height, 23159 left: (canvasData.width - width) / 2, 23160 top: (canvasData.height - height) / 2 23161 }); 23162 setStyle(this.image, assign({ 23163 width: imageData.width, 23164 height: imageData.height 23165 }, getTransforms(assign({ 23166 translateX: imageData.left, 23167 translateY: imageData.top 23168 }, imageData)))); 23169 23170 if (changed) { 23171 this.output(); 23172 } 23173 }, 23174 initCropBox: function initCropBox() { 23175 var options = this.options, 23176 canvasData = this.canvasData; 23177 var aspectRatio = options.aspectRatio || options.initialAspectRatio; 23178 var autoCropArea = Number(options.autoCropArea) || 0.8; 23179 var cropBoxData = { 23180 width: canvasData.width, 23181 height: canvasData.height 23182 }; 23183 23184 if (aspectRatio) { 23185 if (canvasData.height * aspectRatio > canvasData.width) { 23186 cropBoxData.height = cropBoxData.width / aspectRatio; 23187 } else { 23188 cropBoxData.width = cropBoxData.height * aspectRatio; 23189 } 23190 } 23191 23192 this.cropBoxData = cropBoxData; 23193 this.limitCropBox(true, true); // Initialize auto crop area 23194 23195 cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); 23196 cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than "minWidth/Height" 23197 23198 cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea); 23199 cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea); 23200 cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2; 23201 cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2; 23202 cropBoxData.oldLeft = cropBoxData.left; 23203 cropBoxData.oldTop = cropBoxData.top; 23204 this.initialCropBoxData = assign({}, cropBoxData); 23205 }, 23206 limitCropBox: function limitCropBox(sizeLimited, positionLimited) { 23207 var options = this.options, 23208 containerData = this.containerData, 23209 canvasData = this.canvasData, 23210 cropBoxData = this.cropBoxData, 23211 limited = this.limited; 23212 var aspectRatio = options.aspectRatio; 23213 23214 if (sizeLimited) { 23215 var minCropBoxWidth = Number(options.minCropBoxWidth) || 0; 23216 var minCropBoxHeight = Number(options.minCropBoxHeight) || 0; 23217 var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width; 23218 var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height 23219 23220 minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width); 23221 minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height); 23222 23223 if (aspectRatio) { 23224 if (minCropBoxWidth && minCropBoxHeight) { 23225 if (minCropBoxHeight * aspectRatio > minCropBoxWidth) { 23226 minCropBoxHeight = minCropBoxWidth / aspectRatio; 23227 } else { 23228 minCropBoxWidth = minCropBoxHeight * aspectRatio; 23229 } 23230 } else if (minCropBoxWidth) { 23231 minCropBoxHeight = minCropBoxWidth / aspectRatio; 23232 } else if (minCropBoxHeight) { 23233 minCropBoxWidth = minCropBoxHeight * aspectRatio; 23234 } 23235 23236 if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) { 23237 maxCropBoxHeight = maxCropBoxWidth / aspectRatio; 23238 } else { 23239 maxCropBoxWidth = maxCropBoxHeight * aspectRatio; 23240 } 23241 } // The minWidth/Height must be less than maxWidth/Height 23242 23243 23244 cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth); 23245 cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight); 23246 cropBoxData.maxWidth = maxCropBoxWidth; 23247 cropBoxData.maxHeight = maxCropBoxHeight; 23248 } 23249 23250 if (positionLimited) { 23251 if (limited) { 23252 cropBoxData.minLeft = Math.max(0, canvasData.left); 23253 cropBoxData.minTop = Math.max(0, canvasData.top); 23254 cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width; 23255 cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height; 23256 } else { 23257 cropBoxData.minLeft = 0; 23258 cropBoxData.minTop = 0; 23259 cropBoxData.maxLeft = containerData.width - cropBoxData.width; 23260 cropBoxData.maxTop = containerData.height - cropBoxData.height; 23261 } 23262 } 23263 }, 23264 renderCropBox: function renderCropBox() { 23265 var options = this.options, 23266 containerData = this.containerData, 23267 cropBoxData = this.cropBoxData; 23268 23269 if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) { 23270 cropBoxData.left = cropBoxData.oldLeft; 23271 } 23272 23273 if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) { 23274 cropBoxData.top = cropBoxData.oldTop; 23275 } 23276 23277 cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); 23278 cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); 23279 this.limitCropBox(false, true); 23280 cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft); 23281 cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop); 23282 cropBoxData.oldLeft = cropBoxData.left; 23283 cropBoxData.oldTop = cropBoxData.top; 23284 23285 if (options.movable && options.cropBoxMovable) { 23286 // Turn to move the canvas when the crop box is equal to the container 23287 setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL); 23288 } 23289 23290 setStyle(this.cropBox, assign({ 23291 width: cropBoxData.width, 23292 height: cropBoxData.height 23293 }, getTransforms({ 23294 translateX: cropBoxData.left, 23295 translateY: cropBoxData.top 23296 }))); 23297 23298 if (this.cropped && this.limited) { 23299 this.limitCanvas(true, true); 23300 } 23301 23302 if (!this.disabled) { 23303 this.output(); 23304 } 23305 }, 23306 output: function output() { 23307 this.preview(); 23308 dispatchEvent(this.element, EVENT_CROP, this.getData()); 23309 } 23310 }; 23311 23312 var preview = { 23313 initPreview: function initPreview() { 23314 var element = this.element, 23315 crossOrigin = this.crossOrigin; 23316 var preview = this.options.preview; 23317 var url = crossOrigin ? this.crossOriginUrl : this.url; 23318 var alt = element.alt || 'The image to preview'; 23319 var image = document.createElement('img'); 23320 23321 if (crossOrigin) { 23322 image.crossOrigin = crossOrigin; 23323 } 23324 23325 image.src = url; 23326 image.alt = alt; 23327 this.viewBox.appendChild(image); 23328 this.viewBoxImage = image; 23329 23330 if (!preview) { 23331 return; 23332 } 23333 23334 var previews = preview; 23335 23336 if (typeof preview === 'string') { 23337 previews = element.ownerDocument.querySelectorAll(preview); 23338 } else if (preview.querySelector) { 23339 previews = [preview]; 23340 } 23341 23342 this.previews = previews; 23343 forEach(previews, function (el) { 23344 var img = document.createElement('img'); // Save the original size for recover 23345 23346 setData(el, DATA_PREVIEW, { 23347 width: el.offsetWidth, 23348 height: el.offsetHeight, 23349 html: el.innerHTML 23350 }); 23351 23352 if (crossOrigin) { 23353 img.crossOrigin = crossOrigin; 23354 } 23355 23356 img.src = url; 23357 img.alt = alt; 23358 /** 23359 * Override img element styles 23360 * Add `display:block` to avoid margin top issue 23361 * Add `height:auto` to override `height` attribute on IE8 23362 * (Occur only when margin-top <= -height) 23363 */ 23364 23365 img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"'; 23366 el.innerHTML = ''; 23367 el.appendChild(img); 23368 }); 23369 }, 23370 resetPreview: function resetPreview() { 23371 forEach(this.previews, function (element) { 23372 var data = getData(element, DATA_PREVIEW); 23373 setStyle(element, { 23374 width: data.width, 23375 height: data.height 23376 }); 23377 element.innerHTML = data.html; 23378 removeData(element, DATA_PREVIEW); 23379 }); 23380 }, 23381 preview: function preview() { 23382 var imageData = this.imageData, 23383 canvasData = this.canvasData, 23384 cropBoxData = this.cropBoxData; 23385 var cropBoxWidth = cropBoxData.width, 23386 cropBoxHeight = cropBoxData.height; 23387 var width = imageData.width, 23388 height = imageData.height; 23389 var left = cropBoxData.left - canvasData.left - imageData.left; 23390 var top = cropBoxData.top - canvasData.top - imageData.top; 23391 23392 if (!this.cropped || this.disabled) { 23393 return; 23394 } 23395 23396 setStyle(this.viewBoxImage, assign({ 23397 width: width, 23398 height: height 23399 }, getTransforms(assign({ 23400 translateX: -left, 23401 translateY: -top 23402 }, imageData)))); 23403 forEach(this.previews, function (element) { 23404 var data = getData(element, DATA_PREVIEW); 23405 var originalWidth = data.width; 23406 var originalHeight = data.height; 23407 var newWidth = originalWidth; 23408 var newHeight = originalHeight; 23409 var ratio = 1; 23410 23411 if (cropBoxWidth) { 23412 ratio = originalWidth / cropBoxWidth; 23413 newHeight = cropBoxHeight * ratio; 23414 } 23415 23416 if (cropBoxHeight && newHeight > originalHeight) { 23417 ratio = originalHeight / cropBoxHeight; 23418 newWidth = cropBoxWidth * ratio; 23419 newHeight = originalHeight; 23420 } 23421 23422 setStyle(element, { 23423 width: newWidth, 23424 height: newHeight 23425 }); 23426 setStyle(element.getElementsByTagName('img')[0], assign({ 23427 width: width * ratio, 23428 height: height * ratio 23429 }, getTransforms(assign({ 23430 translateX: -left * ratio, 23431 translateY: -top * ratio 23432 }, imageData)))); 23433 }); 23434 } 23435 }; 23436 23437 var events = { 23438 bind: function bind() { 23439 var element = this.element, 23440 options = this.options, 23441 cropper = this.cropper; 23442 23443 if (isFunction(options.cropstart)) { 23444 addListener(element, EVENT_CROP_START, options.cropstart); 23445 } 23446 23447 if (isFunction(options.cropmove)) { 23448 addListener(element, EVENT_CROP_MOVE, options.cropmove); 23449 } 23450 23451 if (isFunction(options.cropend)) { 23452 addListener(element, EVENT_CROP_END, options.cropend); 23453 } 23454 23455 if (isFunction(options.crop)) { 23456 addListener(element, EVENT_CROP, options.crop); 23457 } 23458 23459 if (isFunction(options.zoom)) { 23460 addListener(element, EVENT_ZOOM, options.zoom); 23461 } 23462 23463 addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this)); 23464 23465 if (options.zoomable && options.zoomOnWheel) { 23466 addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), { 23467 passive: false, 23468 capture: true 23469 }); 23470 } 23471 23472 if (options.toggleDragModeOnDblclick) { 23473 addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this)); 23474 } 23475 23476 addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this)); 23477 addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this)); 23478 23479 if (options.responsive) { 23480 addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this)); 23481 } 23482 }, 23483 unbind: function unbind() { 23484 var element = this.element, 23485 options = this.options, 23486 cropper = this.cropper; 23487 23488 if (isFunction(options.cropstart)) { 23489 removeListener(element, EVENT_CROP_START, options.cropstart); 23490 } 23491 23492 if (isFunction(options.cropmove)) { 23493 removeListener(element, EVENT_CROP_MOVE, options.cropmove); 23494 } 23495 23496 if (isFunction(options.cropend)) { 23497 removeListener(element, EVENT_CROP_END, options.cropend); 23498 } 23499 23500 if (isFunction(options.crop)) { 23501 removeListener(element, EVENT_CROP, options.crop); 23502 } 23503 23504 if (isFunction(options.zoom)) { 23505 removeListener(element, EVENT_ZOOM, options.zoom); 23506 } 23507 23508 removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart); 23509 23510 if (options.zoomable && options.zoomOnWheel) { 23511 removeListener(cropper, EVENT_WHEEL, this.onWheel, { 23512 passive: false, 23513 capture: true 23514 }); 23515 } 23516 23517 if (options.toggleDragModeOnDblclick) { 23518 removeListener(cropper, EVENT_DBLCLICK, this.onDblclick); 23519 } 23520 23521 removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove); 23522 removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd); 23523 23524 if (options.responsive) { 23525 removeListener(window, EVENT_RESIZE, this.onResize); 23526 } 23527 } 23528 }; 23529 23530 var handlers = { 23531 resize: function resize() { 23532 if (this.disabled) { 23533 return; 23534 } 23535 23536 var options = this.options, 23537 container = this.container, 23538 containerData = this.containerData; 23539 var ratioX = container.offsetWidth / containerData.width; 23540 var ratioY = container.offsetHeight / containerData.height; 23541 var ratio = Math.abs(ratioX - 1) > Math.abs(ratioY - 1) ? ratioX : ratioY; // Resize when width changed or height changed 23542 23543 if (ratio !== 1) { 23544 var canvasData; 23545 var cropBoxData; 23546 23547 if (options.restore) { 23548 canvasData = this.getCanvasData(); 23549 cropBoxData = this.getCropBoxData(); 23550 } 23551 23552 this.render(); 23553 23554 if (options.restore) { 23555 this.setCanvasData(forEach(canvasData, function (n, i) { 23556 canvasData[i] = n * ratio; 23557 })); 23558 this.setCropBoxData(forEach(cropBoxData, function (n, i) { 23559 cropBoxData[i] = n * ratio; 23560 })); 23561 } 23562 } 23563 }, 23564 dblclick: function dblclick() { 23565 if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) { 23566 return; 23567 } 23568 23569 this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP); 23570 }, 23571 wheel: function wheel(event) { 23572 var _this = this; 23573 23574 var ratio = Number(this.options.wheelZoomRatio) || 0.1; 23575 var delta = 1; 23576 23577 if (this.disabled) { 23578 return; 23579 } 23580 23581 event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21) 23582 23583 if (this.wheeling) { 23584 return; 23585 } 23586 23587 this.wheeling = true; 23588 setTimeout(function () { 23589 _this.wheeling = false; 23590 }, 50); 23591 23592 if (event.deltaY) { 23593 delta = event.deltaY > 0 ? 1 : -1; 23594 } else if (event.wheelDelta) { 23595 delta = -event.wheelDelta / 120; 23596 } else if (event.detail) { 23597 delta = event.detail > 0 ? 1 : -1; 23598 } 23599 23600 this.zoom(-delta * ratio, event); 23601 }, 23602 cropStart: function cropStart(event) { 23603 var buttons = event.buttons, 23604 button = event.button; 23605 23606 if (this.disabled // Handle mouse event and pointer event and ignore touch event 23607 || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button) 23608 isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu 23609 || event.ctrlKey)) { 23610 return; 23611 } 23612 23613 var options = this.options, 23614 pointers = this.pointers; 23615 var action; 23616 23617 if (event.changedTouches) { 23618 // Handle touch event 23619 forEach(event.changedTouches, function (touch) { 23620 pointers[touch.identifier] = getPointer(touch); 23621 }); 23622 } else { 23623 // Handle mouse event and pointer event 23624 pointers[event.pointerId || 0] = getPointer(event); 23625 } 23626 23627 if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) { 23628 action = ACTION_ZOOM; 23629 } else { 23630 action = getData(event.target, DATA_ACTION); 23631 } 23632 23633 if (!REGEXP_ACTIONS.test(action)) { 23634 return; 23635 } 23636 23637 if (dispatchEvent(this.element, EVENT_CROP_START, { 23638 originalEvent: event, 23639 action: action 23640 }) === false) { 23641 return; 23642 } // This line is required for preventing page zooming in iOS browsers 23643 23644 23645 event.preventDefault(); 23646 this.action = action; 23647 this.cropping = false; 23648 23649 if (action === ACTION_CROP) { 23650 this.cropping = true; 23651 addClass(this.dragBox, CLASS_MODAL); 23652 } 23653 }, 23654 cropMove: function cropMove(event) { 23655 var action = this.action; 23656 23657 if (this.disabled || !action) { 23658 return; 23659 } 23660 23661 var pointers = this.pointers; 23662 event.preventDefault(); 23663 23664 if (dispatchEvent(this.element, EVENT_CROP_MOVE, { 23665 originalEvent: event, 23666 action: action 23667 }) === false) { 23668 return; 23669 } 23670 23671 if (event.changedTouches) { 23672 forEach(event.changedTouches, function (touch) { 23673 // The first parameter should not be undefined (#432) 23674 assign(pointers[touch.identifier] || {}, getPointer(touch, true)); 23675 }); 23676 } else { 23677 assign(pointers[event.pointerId || 0] || {}, getPointer(event, true)); 23678 } 23679 23680 this.change(event); 23681 }, 23682 cropEnd: function cropEnd(event) { 23683 if (this.disabled) { 23684 return; 23685 } 23686 23687 var action = this.action, 23688 pointers = this.pointers; 23689 23690 if (event.changedTouches) { 23691 forEach(event.changedTouches, function (touch) { 23692 delete pointers[touch.identifier]; 23693 }); 23694 } else { 23695 delete pointers[event.pointerId || 0]; 23696 } 23697 23698 if (!action) { 23699 return; 23700 } 23701 23702 event.preventDefault(); 23703 23704 if (!Object.keys(pointers).length) { 23705 this.action = ''; 23706 } 23707 23708 if (this.cropping) { 23709 this.cropping = false; 23710 toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal); 23711 } 23712 23713 dispatchEvent(this.element, EVENT_CROP_END, { 23714 originalEvent: event, 23715 action: action 23716 }); 23717 } 23718 }; 23719 23720 var change = { 23721 change: function change(event) { 23722 var options = this.options, 23723 canvasData = this.canvasData, 23724 containerData = this.containerData, 23725 cropBoxData = this.cropBoxData, 23726 pointers = this.pointers; 23727 var action = this.action; 23728 var aspectRatio = options.aspectRatio; 23729 var left = cropBoxData.left, 23730 top = cropBoxData.top, 23731 width = cropBoxData.width, 23732 height = cropBoxData.height; 23733 var right = left + width; 23734 var bottom = top + height; 23735 var minLeft = 0; 23736 var minTop = 0; 23737 var maxWidth = containerData.width; 23738 var maxHeight = containerData.height; 23739 var renderable = true; 23740 var offset; // Locking aspect ratio in "free mode" by holding shift key 23741 23742 if (!aspectRatio && event.shiftKey) { 23743 aspectRatio = width && height ? width / height : 1; 23744 } 23745 23746 if (this.limited) { 23747 minLeft = cropBoxData.minLeft; 23748 minTop = cropBoxData.minTop; 23749 maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width); 23750 maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height); 23751 } 23752 23753 var pointer = pointers[Object.keys(pointers)[0]]; 23754 var range = { 23755 x: pointer.endX - pointer.startX, 23756 y: pointer.endY - pointer.startY 23757 }; 23758 23759 var check = function check(side) { 23760 switch (side) { 23761 case ACTION_EAST: 23762 if (right + range.x > maxWidth) { 23763 range.x = maxWidth - right; 23764 } 23765 23766 break; 23767 23768 case ACTION_WEST: 23769 if (left + range.x < minLeft) { 23770 range.x = minLeft - left; 23771 } 23772 23773 break; 23774 23775 case ACTION_NORTH: 23776 if (top + range.y < minTop) { 23777 range.y = minTop - top; 23778 } 23779 23780 break; 23781 23782 case ACTION_SOUTH: 23783 if (bottom + range.y > maxHeight) { 23784 range.y = maxHeight - bottom; 23785 } 23786 23787 break; 23788 } 23789 }; 23790 23791 switch (action) { 23792 // Move crop box 23793 case ACTION_ALL: 23794 left += range.x; 23795 top += range.y; 23796 break; 23797 // Resize crop box 23798 23799 case ACTION_EAST: 23800 if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) { 23801 renderable = false; 23802 break; 23803 } 23804 23805 check(ACTION_EAST); 23806 width += range.x; 23807 23808 if (width < 0) { 23809 action = ACTION_WEST; 23810 width = -width; 23811 left -= width; 23812 } 23813 23814 if (aspectRatio) { 23815 height = width / aspectRatio; 23816 top += (cropBoxData.height - height) / 2; 23817 } 23818 23819 break; 23820 23821 case ACTION_NORTH: 23822 if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) { 23823 renderable = false; 23824 break; 23825 } 23826 23827 check(ACTION_NORTH); 23828 height -= range.y; 23829 top += range.y; 23830 23831 if (height < 0) { 23832 action = ACTION_SOUTH; 23833 height = -height; 23834 top -= height; 23835 } 23836 23837 if (aspectRatio) { 23838 width = height * aspectRatio; 23839 left += (cropBoxData.width - width) / 2; 23840 } 23841 23842 break; 23843 23844 case ACTION_WEST: 23845 if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) { 23846 renderable = false; 23847 break; 23848 } 23849 23850 check(ACTION_WEST); 23851 width -= range.x; 23852 left += range.x; 23853 23854 if (width < 0) { 23855 action = ACTION_EAST; 23856 width = -width; 23857 left -= width; 23858 } 23859 23860 if (aspectRatio) { 23861 height = width / aspectRatio; 23862 top += (cropBoxData.height - height) / 2; 23863 } 23864 23865 break; 23866 23867 case ACTION_SOUTH: 23868 if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) { 23869 renderable = false; 23870 break; 23871 } 23872 23873 check(ACTION_SOUTH); 23874 height += range.y; 23875 23876 if (height < 0) { 23877 action = ACTION_NORTH; 23878 height = -height; 23879 top -= height; 23880 } 23881 23882 if (aspectRatio) { 23883 width = height * aspectRatio; 23884 left += (cropBoxData.width - width) / 2; 23885 } 23886 23887 break; 23888 23889 case ACTION_NORTH_EAST: 23890 if (aspectRatio) { 23891 if (range.y <= 0 && (top <= minTop || right >= maxWidth)) { 23892 renderable = false; 23893 break; 23894 } 23895 23896 check(ACTION_NORTH); 23897 height -= range.y; 23898 top += range.y; 23899 width = height * aspectRatio; 23900 } else { 23901 check(ACTION_NORTH); 23902 check(ACTION_EAST); 23903 23904 if (range.x >= 0) { 23905 if (right < maxWidth) { 23906 width += range.x; 23907 } else if (range.y <= 0 && top <= minTop) { 23908 renderable = false; 23909 } 23910 } else { 23911 width += range.x; 23912 } 23913 23914 if (range.y <= 0) { 23915 if (top > minTop) { 23916 height -= range.y; 23917 top += range.y; 23918 } 23919 } else { 23920 height -= range.y; 23921 top += range.y; 23922 } 23923 } 23924 23925 if (width < 0 && height < 0) { 23926 action = ACTION_SOUTH_WEST; 23927 height = -height; 23928 width = -width; 23929 top -= height; 23930 left -= width; 23931 } else if (width < 0) { 23932 action = ACTION_NORTH_WEST; 23933 width = -width; 23934 left -= width; 23935 } else if (height < 0) { 23936 action = ACTION_SOUTH_EAST; 23937 height = -height; 23938 top -= height; 23939 } 23940 23941 break; 23942 23943 case ACTION_NORTH_WEST: 23944 if (aspectRatio) { 23945 if (range.y <= 0 && (top <= minTop || left <= minLeft)) { 23946 renderable = false; 23947 break; 23948 } 23949 23950 check(ACTION_NORTH); 23951 height -= range.y; 23952 top += range.y; 23953 width = height * aspectRatio; 23954 left += cropBoxData.width - width; 23955 } else { 23956 check(ACTION_NORTH); 23957 check(ACTION_WEST); 23958 23959 if (range.x <= 0) { 23960 if (left > minLeft) { 23961 width -= range.x; 23962 left += range.x; 23963 } else if (range.y <= 0 && top <= minTop) { 23964 renderable = false; 23965 } 23966 } else { 23967 width -= range.x; 23968 left += range.x; 23969 } 23970 23971 if (range.y <= 0) { 23972 if (top > minTop) { 23973 height -= range.y; 23974 top += range.y; 23975 } 23976 } else { 23977 height -= range.y; 23978 top += range.y; 23979 } 23980 } 23981 23982 if (width < 0 && height < 0) { 23983 action = ACTION_SOUTH_EAST; 23984 height = -height; 23985 width = -width; 23986 top -= height; 23987 left -= width; 23988 } else if (width < 0) { 23989 action = ACTION_NORTH_EAST; 23990 width = -width; 23991 left -= width; 23992 } else if (height < 0) { 23993 action = ACTION_SOUTH_WEST; 23994 height = -height; 23995 top -= height; 23996 } 23997 23998 break; 23999 24000 case ACTION_SOUTH_WEST: 24001 if (aspectRatio) { 24002 if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) { 24003 renderable = false; 24004 break; 24005 } 24006 24007 check(ACTION_WEST); 24008 width -= range.x; 24009 left += range.x; 24010 height = width / aspectRatio; 24011 } else { 24012 check(ACTION_SOUTH); 24013 check(ACTION_WEST); 24014 24015 if (range.x <= 0) { 24016 if (left > minLeft) { 24017 width -= range.x; 24018 left += range.x; 24019 } else if (range.y >= 0 && bottom >= maxHeight) { 24020 renderable = false; 24021 } 24022 } else { 24023 width -= range.x; 24024 left += range.x; 24025 } 24026 24027 if (range.y >= 0) { 24028 if (bottom < maxHeight) { 24029 height += range.y; 24030 } 24031 } else { 24032 height += range.y; 24033 } 24034 } 24035 24036 if (width < 0 && height < 0) { 24037 action = ACTION_NORTH_EAST; 24038 height = -height; 24039 width = -width; 24040 top -= height; 24041 left -= width; 24042 } else if (width < 0) { 24043 action = ACTION_SOUTH_EAST; 24044 width = -width; 24045 left -= width; 24046 } else if (height < 0) { 24047 action = ACTION_NORTH_WEST; 24048 height = -height; 24049 top -= height; 24050 } 24051 24052 break; 24053 24054 case ACTION_SOUTH_EAST: 24055 if (aspectRatio) { 24056 if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) { 24057 renderable = false; 24058 break; 24059 } 24060 24061 check(ACTION_EAST); 24062 width += range.x; 24063 height = width / aspectRatio; 24064 } else { 24065 check(ACTION_SOUTH); 24066 check(ACTION_EAST); 24067 24068 if (range.x >= 0) { 24069 if (right < maxWidth) { 24070 width += range.x; 24071 } else if (range.y >= 0 && bottom >= maxHeight) { 24072 renderable = false; 24073 } 24074 } else { 24075 width += range.x; 24076 } 24077 24078 if (range.y >= 0) { 24079 if (bottom < maxHeight) { 24080 height += range.y; 24081 } 24082 } else { 24083 height += range.y; 24084 } 24085 } 24086 24087 if (width < 0 && height < 0) { 24088 action = ACTION_NORTH_WEST; 24089 height = -height; 24090 width = -width; 24091 top -= height; 24092 left -= width; 24093 } else if (width < 0) { 24094 action = ACTION_SOUTH_WEST; 24095 width = -width; 24096 left -= width; 24097 } else if (height < 0) { 24098 action = ACTION_NORTH_EAST; 24099 height = -height; 24100 top -= height; 24101 } 24102 24103 break; 24104 // Move canvas 24105 24106 case ACTION_MOVE: 24107 this.move(range.x, range.y); 24108 renderable = false; 24109 break; 24110 // Zoom canvas 24111 24112 case ACTION_ZOOM: 24113 this.zoom(getMaxZoomRatio(pointers), event); 24114 renderable = false; 24115 break; 24116 // Create crop box 24117 24118 case ACTION_CROP: 24119 if (!range.x || !range.y) { 24120 renderable = false; 24121 break; 24122 } 24123 24124 offset = getOffset(this.cropper); 24125 left = pointer.startX - offset.left; 24126 top = pointer.startY - offset.top; 24127 width = cropBoxData.minWidth; 24128 height = cropBoxData.minHeight; 24129 24130 if (range.x > 0) { 24131 action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST; 24132 } else if (range.x < 0) { 24133 left -= width; 24134 action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST; 24135 } 24136 24137 if (range.y < 0) { 24138 top -= height; 24139 } // Show the crop box if is hidden 24140 24141 24142 if (!this.cropped) { 24143 removeClass(this.cropBox, CLASS_HIDDEN); 24144 this.cropped = true; 24145 24146 if (this.limited) { 24147 this.limitCropBox(true, true); 24148 } 24149 } 24150 24151 break; 24152 } 24153 24154 if (renderable) { 24155 cropBoxData.width = width; 24156 cropBoxData.height = height; 24157 cropBoxData.left = left; 24158 cropBoxData.top = top; 24159 this.action = action; 24160 this.renderCropBox(); 24161 } // Override 24162 24163 24164 forEach(pointers, function (p) { 24165 p.startX = p.endX; 24166 p.startY = p.endY; 24167 }); 24168 } 24169 }; 24170 24171 var methods = { 24172 // Show the crop box manually 24173 crop: function crop() { 24174 if (this.ready && !this.cropped && !this.disabled) { 24175 this.cropped = true; 24176 this.limitCropBox(true, true); 24177 24178 if (this.options.modal) { 24179 addClass(this.dragBox, CLASS_MODAL); 24180 } 24181 24182 removeClass(this.cropBox, CLASS_HIDDEN); 24183 this.setCropBoxData(this.initialCropBoxData); 24184 } 24185 24186 return this; 24187 }, 24188 // Reset the image and crop box to their initial states 24189 reset: function reset() { 24190 if (this.ready && !this.disabled) { 24191 this.imageData = assign({}, this.initialImageData); 24192 this.canvasData = assign({}, this.initialCanvasData); 24193 this.cropBoxData = assign({}, this.initialCropBoxData); 24194 this.renderCanvas(); 24195 24196 if (this.cropped) { 24197 this.renderCropBox(); 24198 } 24199 } 24200 24201 return this; 24202 }, 24203 // Clear the crop box 24204 clear: function clear() { 24205 if (this.cropped && !this.disabled) { 24206 assign(this.cropBoxData, { 24207 left: 0, 24208 top: 0, 24209 width: 0, 24210 height: 0 24211 }); 24212 this.cropped = false; 24213 this.renderCropBox(); 24214 this.limitCanvas(true, true); // Render canvas after crop box rendered 24215 24216 this.renderCanvas(); 24217 removeClass(this.dragBox, CLASS_MODAL); 24218 addClass(this.cropBox, CLASS_HIDDEN); 24219 } 24220 24221 return this; 24222 }, 24223 24224 /** 24225 * Replace the image's src and rebuild the cropper 24226 * @param {string} url - The new URL. 24227 * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one. 24228 * @returns {Cropper} this 24229 */ 24230 replace: function replace(url) { 24231 var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 24232 24233 if (!this.disabled && url) { 24234 if (this.isImg) { 24235 this.element.src = url; 24236 } 24237 24238 if (hasSameSize) { 24239 this.url = url; 24240 this.image.src = url; 24241 24242 if (this.ready) { 24243 this.viewBoxImage.src = url; 24244 forEach(this.previews, function (element) { 24245 element.getElementsByTagName('img')[0].src = url; 24246 }); 24247 } 24248 } else { 24249 if (this.isImg) { 24250 this.replaced = true; 24251 } 24252 24253 this.options.data = null; 24254 this.uncreate(); 24255 this.load(url); 24256 } 24257 } 24258 24259 return this; 24260 }, 24261 // Enable (unfreeze) the cropper 24262 enable: function enable() { 24263 if (this.ready && this.disabled) { 24264 this.disabled = false; 24265 removeClass(this.cropper, CLASS_DISABLED); 24266 } 24267 24268 return this; 24269 }, 24270 // Disable (freeze) the cropper 24271 disable: function disable() { 24272 if (this.ready && !this.disabled) { 24273 this.disabled = true; 24274 addClass(this.cropper, CLASS_DISABLED); 24275 } 24276 24277 return this; 24278 }, 24279 24280 /** 24281 * Destroy the cropper and remove the instance from the image 24282 * @returns {Cropper} this 24283 */ 24284 destroy: function destroy() { 24285 var element = this.element; 24286 24287 if (!element[NAMESPACE]) { 24288 return this; 24289 } 24290 24291 element[NAMESPACE] = undefined; 24292 24293 if (this.isImg && this.replaced) { 24294 element.src = this.originalUrl; 24295 } 24296 24297 this.uncreate(); 24298 return this; 24299 }, 24300 24301 /** 24302 * Move the canvas with relative offsets 24303 * @param {number} offsetX - The relative offset distance on the x-axis. 24304 * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis. 24305 * @returns {Cropper} this 24306 */ 24307 move: function move(offsetX) { 24308 var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX; 24309 var _this$canvasData = this.canvasData, 24310 left = _this$canvasData.left, 24311 top = _this$canvasData.top; 24312 return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY)); 24313 }, 24314 24315 /** 24316 * Move the canvas to an absolute point 24317 * @param {number} x - The x-axis coordinate. 24318 * @param {number} [y=x] - The y-axis coordinate. 24319 * @returns {Cropper} this 24320 */ 24321 moveTo: function moveTo(x) { 24322 var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; 24323 var canvasData = this.canvasData; 24324 var changed = false; 24325 x = Number(x); 24326 y = Number(y); 24327 24328 if (this.ready && !this.disabled && this.options.movable) { 24329 if (isNumber(x)) { 24330 canvasData.left = x; 24331 changed = true; 24332 } 24333 24334 if (isNumber(y)) { 24335 canvasData.top = y; 24336 changed = true; 24337 } 24338 24339 if (changed) { 24340 this.renderCanvas(true); 24341 } 24342 } 24343 24344 return this; 24345 }, 24346 24347 /** 24348 * Zoom the canvas with a relative ratio 24349 * @param {number} ratio - The target ratio. 24350 * @param {Event} _originalEvent - The original event if any. 24351 * @returns {Cropper} this 24352 */ 24353 zoom: function zoom(ratio, _originalEvent) { 24354 var canvasData = this.canvasData; 24355 ratio = Number(ratio); 24356 24357 if (ratio < 0) { 24358 ratio = 1 / (1 - ratio); 24359 } else { 24360 ratio = 1 + ratio; 24361 } 24362 24363 return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent); 24364 }, 24365 24366 /** 24367 * Zoom the canvas to an absolute ratio 24368 * @param {number} ratio - The target ratio. 24369 * @param {Object} pivot - The zoom pivot point coordinate. 24370 * @param {Event} _originalEvent - The original event if any. 24371 * @returns {Cropper} this 24372 */ 24373 zoomTo: function zoomTo(ratio, pivot, _originalEvent) { 24374 var options = this.options, 24375 canvasData = this.canvasData; 24376 var width = canvasData.width, 24377 height = canvasData.height, 24378 naturalWidth = canvasData.naturalWidth, 24379 naturalHeight = canvasData.naturalHeight; 24380 ratio = Number(ratio); 24381 24382 if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) { 24383 var newWidth = naturalWidth * ratio; 24384 var newHeight = naturalHeight * ratio; 24385 24386 if (dispatchEvent(this.element, EVENT_ZOOM, { 24387 ratio: ratio, 24388 oldRatio: width / naturalWidth, 24389 originalEvent: _originalEvent 24390 }) === false) { 24391 return this; 24392 } 24393 24394 if (_originalEvent) { 24395 var pointers = this.pointers; 24396 var offset = getOffset(this.cropper); 24397 var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : { 24398 pageX: _originalEvent.pageX, 24399 pageY: _originalEvent.pageY 24400 }; // Zoom from the triggering point of the event 24401 24402 canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width); 24403 canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height); 24404 } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) { 24405 canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width); 24406 canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height); 24407 } else { 24408 // Zoom from the center of the canvas 24409 canvasData.left -= (newWidth - width) / 2; 24410 canvasData.top -= (newHeight - height) / 2; 24411 } 24412 24413 canvasData.width = newWidth; 24414 canvasData.height = newHeight; 24415 this.renderCanvas(true); 24416 } 24417 24418 return this; 24419 }, 24420 24421 /** 24422 * Rotate the canvas with a relative degree 24423 * @param {number} degree - The rotate degree. 24424 * @returns {Cropper} this 24425 */ 24426 rotate: function rotate(degree) { 24427 return this.rotateTo((this.imageData.rotate || 0) + Number(degree)); 24428 }, 24429 24430 /** 24431 * Rotate the canvas to an absolute degree 24432 * @param {number} degree - The rotate degree. 24433 * @returns {Cropper} this 24434 */ 24435 rotateTo: function rotateTo(degree) { 24436 degree = Number(degree); 24437 24438 if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) { 24439 this.imageData.rotate = degree % 360; 24440 this.renderCanvas(true, true); 24441 } 24442 24443 return this; 24444 }, 24445 24446 /** 24447 * Scale the image on the x-axis. 24448 * @param {number} scaleX - The scale ratio on the x-axis. 24449 * @returns {Cropper} this 24450 */ 24451 scaleX: function scaleX(_scaleX) { 24452 var scaleY = this.imageData.scaleY; 24453 return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1); 24454 }, 24455 24456 /** 24457 * Scale the image on the y-axis. 24458 * @param {number} scaleY - The scale ratio on the y-axis. 24459 * @returns {Cropper} this 24460 */ 24461 scaleY: function scaleY(_scaleY) { 24462 var scaleX = this.imageData.scaleX; 24463 return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY); 24464 }, 24465 24466 /** 24467 * Scale the image 24468 * @param {number} scaleX - The scale ratio on the x-axis. 24469 * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis. 24470 * @returns {Cropper} this 24471 */ 24472 scale: function scale(scaleX) { 24473 var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; 24474 var imageData = this.imageData; 24475 var transformed = false; 24476 scaleX = Number(scaleX); 24477 scaleY = Number(scaleY); 24478 24479 if (this.ready && !this.disabled && this.options.scalable) { 24480 if (isNumber(scaleX)) { 24481 imageData.scaleX = scaleX; 24482 transformed = true; 24483 } 24484 24485 if (isNumber(scaleY)) { 24486 imageData.scaleY = scaleY; 24487 transformed = true; 24488 } 24489 24490 if (transformed) { 24491 this.renderCanvas(true, true); 24492 } 24493 } 24494 24495 return this; 24496 }, 24497 24498 /** 24499 * Get the cropped area position and size data (base on the original image) 24500 * @param {boolean} [rounded=false] - Indicate if round the data values or not. 24501 * @returns {Object} The result cropped data. 24502 */ 24503 getData: function getData() { 24504 var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 24505 var options = this.options, 24506 imageData = this.imageData, 24507 canvasData = this.canvasData, 24508 cropBoxData = this.cropBoxData; 24509 var data; 24510 24511 if (this.ready && this.cropped) { 24512 data = { 24513 x: cropBoxData.left - canvasData.left, 24514 y: cropBoxData.top - canvasData.top, 24515 width: cropBoxData.width, 24516 height: cropBoxData.height 24517 }; 24518 var ratio = imageData.width / imageData.naturalWidth; 24519 forEach(data, function (n, i) { 24520 data[i] = n / ratio; 24521 }); 24522 24523 if (rounded) { 24524 // In case rounding off leads to extra 1px in right or bottom border 24525 // we should round the top-left corner and the dimension (#343). 24526 var bottom = Math.round(data.y + data.height); 24527 var right = Math.round(data.x + data.width); 24528 data.x = Math.round(data.x); 24529 data.y = Math.round(data.y); 24530 data.width = right - data.x; 24531 data.height = bottom - data.y; 24532 } 24533 } else { 24534 data = { 24535 x: 0, 24536 y: 0, 24537 width: 0, 24538 height: 0 24539 }; 24540 } 24541 24542 if (options.rotatable) { 24543 data.rotate = imageData.rotate || 0; 24544 } 24545 24546 if (options.scalable) { 24547 data.scaleX = imageData.scaleX || 1; 24548 data.scaleY = imageData.scaleY || 1; 24549 } 24550 24551 return data; 24552 }, 24553 24554 /** 24555 * Set the cropped area position and size with new data 24556 * @param {Object} data - The new data. 24557 * @returns {Cropper} this 24558 */ 24559 setData: function setData(data) { 24560 var options = this.options, 24561 imageData = this.imageData, 24562 canvasData = this.canvasData; 24563 var cropBoxData = {}; 24564 24565 if (this.ready && !this.disabled && isPlainObject(data)) { 24566 var transformed = false; 24567 24568 if (options.rotatable) { 24569 if (isNumber(data.rotate) && data.rotate !== imageData.rotate) { 24570 imageData.rotate = data.rotate; 24571 transformed = true; 24572 } 24573 } 24574 24575 if (options.scalable) { 24576 if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) { 24577 imageData.scaleX = data.scaleX; 24578 transformed = true; 24579 } 24580 24581 if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) { 24582 imageData.scaleY = data.scaleY; 24583 transformed = true; 24584 } 24585 } 24586 24587 if (transformed) { 24588 this.renderCanvas(true, true); 24589 } 24590 24591 var ratio = imageData.width / imageData.naturalWidth; 24592 24593 if (isNumber(data.x)) { 24594 cropBoxData.left = data.x * ratio + canvasData.left; 24595 } 24596 24597 if (isNumber(data.y)) { 24598 cropBoxData.top = data.y * ratio + canvasData.top; 24599 } 24600 24601 if (isNumber(data.width)) { 24602 cropBoxData.width = data.width * ratio; 24603 } 24604 24605 if (isNumber(data.height)) { 24606 cropBoxData.height = data.height * ratio; 24607 } 24608
vendor: 4,616 bytes, lines 24609-24769
24609 this.setCropBoxData(cropBoxData); 24610 } 24611 24612 return this; 24613 }, 24614 24615 /** 24616 * Get the container size data. 24617 * @returns {Object} The result container data. 24618 */ 24619 getContainerData: function getContainerData() { 24620 return this.ready ? assign({}, this.containerData) : {}; 24621 }, 24622 24623 /** 24624 * Get the image position and size data. 24625 * @returns {Object} The result image data. 24626 */ 24627 getImageData: function getImageData() { 24628 return this.sized ? assign({}, this.imageData) : {}; 24629 }, 24630 24631 /** 24632 * Get the canvas position and size data. 24633 * @returns {Object} The result canvas data. 24634 */ 24635 getCanvasData: function getCanvasData() { 24636 var canvasData = this.canvasData; 24637 var data = {}; 24638 24639 if (this.ready) { 24640 forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) { 24641 data[n] = canvasData[n]; 24642 }); 24643 } 24644 24645 return data; 24646 }, 24647 24648 /** 24649 * Set the canvas position and size with new data. 24650 * @param {Object} data - The new canvas data. 24651 * @returns {Cropper} this 24652 */ 24653 setCanvasData: function setCanvasData(data) { 24654 var canvasData = this.canvasData; 24655 var aspectRatio = canvasData.aspectRatio; 24656 24657 if (this.ready && !this.disabled && isPlainObject(data)) { 24658 if (isNumber(data.left)) { 24659 canvasData.left = data.left; 24660 } 24661 24662 if (isNumber(data.top)) { 24663 canvasData.top = data.top; 24664 } 24665 24666 if (isNumber(data.width)) { 24667 canvasData.width = data.width; 24668 canvasData.height = data.width / aspectRatio; 24669 } else if (isNumber(data.height)) { 24670 canvasData.height = data.height; 24671 canvasData.width = data.height * aspectRatio; 24672 } 24673 24674 this.renderCanvas(true); 24675 } 24676 24677 return this; 24678 }, 24679 24680 /** 24681 * Get the crop box position and size data. 24682 * @returns {Object} The result crop box data. 24683 */ 24684 getCropBoxData: function getCropBoxData() { 24685 var cropBoxData = this.cropBoxData; 24686 var data; 24687 24688 if (this.ready && this.cropped) { 24689 data = { 24690 left: cropBoxData.left, 24691 top: cropBoxData.top, 24692 width: cropBoxData.width, 24693 height: cropBoxData.height 24694 }; 24695 } 24696 24697 return data || {}; 24698 }, 24699 24700 /** 24701 * Set the crop box position and size with new data. 24702 * @param {Object} data - The new crop box data. 24703 * @returns {Cropper} this 24704 */ 24705 setCropBoxData: function setCropBoxData(data) { 24706 var cropBoxData = this.cropBoxData; 24707 var aspectRatio = this.options.aspectRatio; 24708 var widthChanged; 24709 var heightChanged; 24710 24711 if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) { 24712 if (isNumber(data.left)) { 24713 cropBoxData.left = data.left; 24714 } 24715 24716 if (isNumber(data.top)) { 24717 cropBoxData.top = data.top; 24718 } 24719 24720 if (isNumber(data.width) && data.width !== cropBoxData.width) { 24721 widthChanged = true; 24722 cropBoxData.width = data.width; 24723 } 24724 24725 if (isNumber(data.height) && data.height !== cropBoxData.height) { 24726 heightChanged = true; 24727 cropBoxData.height = data.height; 24728 } 24729 24730 if (aspectRatio) { 24731 if (widthChanged) { 24732 cropBoxData.height = cropBoxData.width / aspectRatio; 24733 } else if (heightChanged) { 24734 cropBoxData.width = cropBoxData.height * aspectRatio; 24735 } 24736 } 24737 24738 this.renderCropBox(); 24739 } 24740 24741 return this; 24742 }, 24743 24744 /** 24745 * Get a canvas drawn the cropped image. 24746 * @param {Object} [options={}] - The config options. 24747 * @returns {HTMLCanvasElement} - The result canvas. 24748 */ 24749 getCroppedCanvas: function getCroppedCanvas() { 24750 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 24751 24752 if (!this.ready || !window.HTMLCanvasElement) { 24753 return null; 24754 } 24755 24756 var canvasData = this.canvasData; 24757 var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped. 24758 24759 if (!this.cropped) { 24760 return source; 24761 } 24762 24763 var _this$getData = this.getData(), 24764 initialX = _this$getData.x, 24765 initialY = _this$getData.y, 24766 initialWidth = _this$getData.width, 24767 initialHeight = _this$getData.height; 24768 24769 var ratio = source.width / Math.floor(canvasData.naturalWi
vendor: 17,434 bytes, lines 24769-25293
24769dth); 24770 24771 if (ratio !== 1) { 24772 initialX *= ratio; 24773 initialY *= ratio; 24774 initialWidth *= ratio; 24775 initialHeight *= ratio; 24776 } 24777 24778 var aspectRatio = initialWidth / initialHeight; 24779 var maxSizes = getAdjustedSizes({ 24780 aspectRatio: aspectRatio, 24781 width: options.maxWidth || Infinity, 24782 height: options.maxHeight || Infinity 24783 }); 24784 var minSizes = getAdjustedSizes({ 24785 aspectRatio: aspectRatio, 24786 width: options.minWidth || 0, 24787 height: options.minHeight || 0 24788 }, 'cover'); 24789 24790 var _getAdjustedSizes = getAdjustedSizes({ 24791 aspectRatio: aspectRatio, 24792 width: options.width || (ratio !== 1 ? source.width : initialWidth), 24793 height: options.height || (ratio !== 1 ? source.height : initialHeight) 24794 }), 24795 width = _getAdjustedSizes.width, 24796 height = _getAdjustedSizes.height; 24797 24798 width = Math.min(maxSizes.width, Math.max(minSizes.width, width)); 24799 height = Math.min(maxSizes.height, Math.max(minSizes.height, height)); 24800 var canvas = document.createElement('canvas'); 24801 var context = canvas.getContext('2d'); 24802 canvas.width = normalizeDecimalNumber(width); 24803 canvas.height = normalizeDecimalNumber(height); 24804 context.fillStyle = options.fillColor || 'transparent'; 24805 context.fillRect(0, 0, width, height); 24806 var _options$imageSmoothi = options.imageSmoothingEnabled, 24807 imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi, 24808 imageSmoothingQuality = options.imageSmoothingQuality; 24809 context.imageSmoothingEnabled = imageSmoothingEnabled; 24810 24811 if (imageSmoothingQuality) { 24812 context.imageSmoothingQuality = imageSmoothingQuality; 24813 } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage 24814 24815 24816 var sourceWidth = source.width; 24817 var sourceHeight = source.height; // Source canvas parameters 24818 24819 var srcX = initialX; 24820 var srcY = initialY; 24821 var srcWidth; 24822 var srcHeight; // Destination canvas parameters 24823 24824 var dstX; 24825 var dstY; 24826 var dstWidth; 24827 var dstHeight; 24828 24829 if (srcX <= -initialWidth || srcX > sourceWidth) { 24830 srcX = 0; 24831 srcWidth = 0; 24832 dstX = 0; 24833 dstWidth = 0; 24834 } else if (srcX <= 0) { 24835 dstX = -srcX; 24836 srcX = 0; 24837 srcWidth = Math.min(sourceWidth, initialWidth + srcX); 24838 dstWidth = srcWidth; 24839 } else if (srcX <= sourceWidth) { 24840 dstX = 0; 24841 srcWidth = Math.min(initialWidth, sourceWidth - srcX); 24842 dstWidth = srcWidth; 24843 } 24844 24845 if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) { 24846 srcY = 0; 24847 srcHeight = 0; 24848 dstY = 0; 24849 dstHeight = 0; 24850 } else if (srcY <= 0) { 24851 dstY = -srcY; 24852 srcY = 0; 24853 srcHeight = Math.min(sourceHeight, initialHeight + srcY); 24854 dstHeight = srcHeight; 24855 } else if (srcY <= sourceHeight) { 24856 dstY = 0; 24857 srcHeight = Math.min(initialHeight, sourceHeight - srcY); 24858 dstHeight = srcHeight; 24859 } 24860 24861 var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError" 24862 24863 if (dstWidth > 0 && dstHeight > 0) { 24864 var scale = width / initialWidth; 24865 params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale); 24866 } // All the numerical parameters should be integer for `drawImage` 24867 // https://github.com/fengyuanchen/cropper/issues/476 24868 24869 24870 context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) { 24871 return Math.floor(normalizeDecimalNumber(param)); 24872 })))); 24873 return canvas; 24874 }, 24875 24876 /** 24877 * Change the aspect ratio of the crop box. 24878 * @param {number} aspectRatio - The new aspect ratio. 24879 * @returns {Cropper} this 24880 */ 24881 setAspectRatio: function setAspectRatio(aspectRatio) { 24882 var options = this.options; 24883 24884 if (!this.disabled && !isUndefined(aspectRatio)) { 24885 // 0 -> NaN 24886 options.aspectRatio = Math.max(0, aspectRatio) || NaN; 24887 24888 if (this.ready) { 24889 this.initCropBox(); 24890 24891 if (this.cropped) { 24892 this.renderCropBox(); 24893 } 24894 } 24895 } 24896 24897 return this; 24898 }, 24899 24900 /** 24901 * Change the drag mode. 24902 * @param {string} mode - The new drag mode. 24903 * @returns {Cropper} this 24904 */ 24905 setDragMode: function setDragMode(mode) { 24906 var options = this.options, 24907 dragBox = this.dragBox, 24908 face = this.face; 24909 24910 if (this.ready && !this.disabled) { 24911 var croppable = mode === DRAG_MODE_CROP; 24912 var movable = options.movable && mode === DRAG_MODE_MOVE; 24913 mode = croppable || movable ? mode : DRAG_MODE_NONE; 24914 options.dragMode = mode; 24915 setData(dragBox, DATA_ACTION, mode); 24916 toggleClass(dragBox, CLASS_CROP, croppable); 24917 toggleClass(dragBox, CLASS_MOVE, movable); 24918 24919 if (!options.cropBoxMovable) { 24920 // Sync drag mode to crop box when it is not movable 24921 setData(face, DATA_ACTION, mode); 24922 toggleClass(face, CLASS_CROP, croppable); 24923 toggleClass(face, CLASS_MOVE, movable); 24924 } 24925 } 24926 24927 return this; 24928 } 24929 }; 24930 24931 var AnotherCropper = WINDOW.Cropper; 24932 24933 var Cropper = /*#__PURE__*/function () { 24934 /** 24935 * Create a new Cropper. 24936 * @param {Element} element - The target element for cropping. 24937 * @param {Object} [options={}] - The configuration options. 24938 */ 24939 function Cropper(element) { 24940 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 24941 24942 _classCallCheck(this, Cropper); 24943 24944 if (!element || !REGEXP_TAG_NAME.test(element.tagName)) { 24945 throw new Error('The first argument is required and must be an <img> or <canvas> element.'); 24946 } 24947 24948 this.element = element; 24949 this.options = assign({}, DEFAULTS, isPlainObject(options) && options); 24950 this.cropped = false; 24951 this.disabled = false; 24952 this.pointers = {}; 24953 this.ready = false; 24954 this.reloading = false; 24955 this.replaced = false; 24956 this.sized = false; 24957 this.sizing = false; 24958 this.init(); 24959 } 24960 24961 _createClass(Cropper, [{ 24962 key: "init", 24963 value: function init() { 24964 var element = this.element; 24965 var tagName = element.tagName.toLowerCase(); 24966 var url; 24967 24968 if (element[NAMESPACE]) { 24969 return; 24970 } 24971 24972 element[NAMESPACE] = this; 24973 24974 if (tagName === 'img') { 24975 this.isImg = true; // e.g.: "img/picture.jpg" 24976 24977 url = element.getAttribute('src') || ''; 24978 this.originalUrl = url; // Stop when it's a blank image 24979 24980 if (!url) { 24981 return; 24982 } // e.g.: "https://example.com/img/picture.jpg" 24983 24984 24985 url = element.src; 24986 } else if (tagName === 'canvas' && window.HTMLCanvasElement) { 24987 url = element.toDataURL(); 24988 } 24989 24990 this.load(url); 24991 } 24992 }, { 24993 key: "load", 24994 value: function load(url) { 24995 var _this = this; 24996 24997 if (!url) { 24998 return; 24999 } 25000 25001 this.url = url; 25002 this.imageData = {}; 25003 var element = this.element, 25004 options = this.options; 25005 25006 if (!options.rotatable && !options.scalable) { 25007 options.checkOrientation = false; 25008 } // Only IE10+ supports Typed Arrays 25009 25010 25011 if (!options.checkOrientation || !window.ArrayBuffer) { 25012 this.clone(); 25013 return; 25014 } // Detect the mime type of the image directly if it is a Data URL 25015 25016 25017 if (REGEXP_DATA_URL.test(url)) { 25018 // Read ArrayBuffer from Data URL of JPEG images directly for better performance 25019 if (REGEXP_DATA_URL_JPEG.test(url)) { 25020 this.read(dataURLToArrayBuffer(url)); 25021 } else { 25022 // Only a JPEG image may contains Exif Orientation information, 25023 // the rest types of Data URLs are not necessary to check orientation at all. 25024 this.clone(); 25025 } 25026 25027 return; 25028 } // 1. Detect the mime type of the image by a XMLHttpRequest. 25029 // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image. 25030 25031 25032 var xhr = new XMLHttpRequest(); 25033 var clone = this.clone.bind(this); 25034 this.reloading = true; 25035 this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes: 25036 // http, https, data, chrome, chrome-extension. 25037 // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy 25038 // in some browsers as IE11 and Safari. 25039 25040 xhr.onabort = clone; 25041 xhr.onerror = clone; 25042 xhr.ontimeout = clone; 25043 25044 xhr.onprogress = function () { 25045 // Abort the request directly if it not a JPEG image for better performance 25046 if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) { 25047 xhr.abort(); 25048 } 25049 }; 25050 25051 xhr.onload = function () { 25052 _this.read(xhr.response); 25053 }; 25054 25055 xhr.onloadend = function () { 25056 _this.reloading = false; 25057 _this.xhr = null; 25058 }; // Bust cache when there is a "crossOrigin" property to avoid browser cache error 25059 25060 25061 if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) { 25062 url = addTimestamp(url); 25063 } // The third parameter is required for avoiding side-effect (#682) 25064 25065 25066 xhr.open('GET', url, true); 25067 xhr.responseType = 'arraybuffer'; 25068 xhr.withCredentials = element.crossOrigin === 'use-credentials'; 25069 xhr.send(); 25070 } 25071 }, { 25072 key: "read", 25073 value: function read(arrayBuffer) { 25074 var options = this.options, 25075 imageData = this.imageData; // Reset the orientation value to its default value 1 25076 // as some iOS browsers will render image with its orientation 25077 25078 var orientation = resetAndGetOrientation(arrayBuffer); 25079 var rotate = 0; 25080 var scaleX = 1; 25081 var scaleY = 1; 25082 25083 if (orientation > 1) { 25084 // Generate a new URL which has the default orientation value 25085 this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG); 25086 25087 var _parseOrientation = parseOrientation(orientation); 25088 25089 rotate = _parseOrientation.rotate; 25090 scaleX = _parseOrientation.scaleX; 25091 scaleY = _parseOrientation.scaleY; 25092 } 25093 25094 if (options.rotatable) { 25095 imageData.rotate = rotate; 25096 } 25097 25098 if (options.scalable) { 25099 imageData.scaleX = scaleX; 25100 imageData.scaleY = scaleY; 25101 } 25102 25103 this.clone(); 25104 } 25105 }, { 25106 key: "clone", 25107 value: function clone() { 25108 var element = this.element, 25109 url = this.url; 25110 var crossOrigin = element.crossOrigin; 25111 var crossOriginUrl = url; 25112 25113 if (this.options.checkCrossOrigin && isCrossOriginURL(url)) { 25114 if (!crossOrigin) { 25115 crossOrigin = 'anonymous'; 25116 } // Bust cache when there is not a "crossOrigin" property (#519) 25117 25118 25119 crossOriginUrl = addTimestamp(url); 25120 } 25121 25122 this.crossOrigin = crossOrigin; 25123 this.crossOriginUrl = crossOriginUrl; 25124 var image = document.createElement('img'); 25125 25126 if (crossOrigin) { 25127 image.crossOrigin = crossOrigin; 25128 } 25129 25130 image.src = crossOriginUrl || url; 25131 image.alt = element.alt || 'The image to crop'; 25132 this.image = image; 25133 image.onload = this.start.bind(this); 25134 image.onerror = this.stop.bind(this); 25135 addClass(image, CLASS_HIDE); 25136 element.parentNode.insertBefore(image, element.nextSibling); 25137 } 25138 }, { 25139 key: "start", 25140 value: function start() { 25141 var _this2 = this; 25142 25143 var image = this.image; 25144 image.onload = null; 25145 image.onerror = null; 25146 this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices, 25147 // such as Safari for iOS, Chrome for iOS, and in-app browsers. 25148 25149 var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent); 25150 25151 var done = function done(naturalWidth, naturalHeight) { 25152 assign(_this2.imageData, { 25153 naturalWidth: naturalWidth, 25154 naturalHeight: naturalHeight, 25155 aspectRatio: naturalWidth / naturalHeight 25156 }); 25157 _this2.initialImageData = assign({}, _this2.imageData); 25158 _this2.sizing = false; 25159 _this2.sized = true; 25160 25161 _this2.build(); 25162 }; // Most modern browsers (excepts iOS WebKit) 25163 25164 25165 if (image.naturalWidth && !isIOSWebKit) { 25166 done(image.naturalWidth, image.naturalHeight); 25167 return; 25168 } 25169 25170 var sizingImage = document.createElement('img'); 25171 var body = document.body || document.documentElement; 25172 this.sizingImage = sizingImage; 25173 25174 sizingImage.onload = function () { 25175 done(sizingImage.width, sizingImage.height); 25176 25177 if (!isIOSWebKit) { 25178 body.removeChild(sizingImage); 25179 } 25180 }; 25181 25182 sizingImage.src = image.src; // iOS WebKit will convert the image automatically 25183 // with its orientation once append it into DOM (#279) 25184 25185 if (!isIOSWebKit) { 25186 sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;'; 25187 body.appendChild(sizingImage); 25188 } 25189 } 25190 }, { 25191 key: "stop", 25192 value: function stop() { 25193 var image = this.image; 25194 image.onload = null; 25195 image.onerror = null; 25196 image.parentNode.removeChild(image); 25197 this.image = null; 25198 } 25199 }, { 25200 key: "build", 25201 value: function build() { 25202 if (!this.sized || this.ready) { 25203 return; 25204 } 25205 25206 var element = this.element, 25207 options = this.options, 25208 image = this.image; // Create cropper elements 25209 25210 var container = element.parentNode; 25211 var template = document.createElement('div'); 25212 template.innerHTML = TEMPLATE; 25213 var cropper = template.querySelector(".".concat(NAMESPACE, "-container")); 25214 var canvas = cropper.querySelector(".".concat(NAMESPACE, "-canvas")); 25215 var dragBox = cropper.querySelector(".".concat(NAMESPACE, "-drag-box")); 25216 var cropBox = cropper.querySelector(".".concat(NAMESPACE, "-crop-box")); 25217 var face = cropBox.querySelector(".".concat(NAMESPACE, "-face")); 25218 this.container = container; 25219 this.cropper = cropper; 25220 this.canvas = canvas; 25221 this.dragBox = dragBox; 25222 this.cropBox = cropBox; 25223 this.viewBox = cropper.querySelector(".".concat(NAMESPACE, "-view-box")); 25224 this.face = face; 25225 canvas.appendChild(image); // Hide the original image 25226 25227 addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image 25228 25229 container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden 25230 25231 if (!this.isImg) { 25232 removeClass(image, CLASS_HIDE); 25233 } 25234 25235 this.initPreview(); 25236 this.bind(); 25237 options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN; 25238 options.aspectRatio = Math.max(0, options.aspectRatio) || NaN; 25239 options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0; 25240 addClass(cropBox, CLASS_HIDDEN); 25241 25242 if (!options.guides) { 25243 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-dashed")), CLASS_HIDDEN); 25244 } 25245 25246 if (!options.center) { 25247 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-center")), CLASS_HIDDEN); 25248 } 25249 25250 if (options.background) { 25251 addClass(cropper, "".concat(NAMESPACE, "-bg")); 25252 } 25253 25254 if (!options.highlight) { 25255 addClass(face, CLASS_INVISIBLE); 25256 } 25257 25258 if (options.cropBoxMovable) { 25259 addClass(face, CLASS_MOVE); 25260 setData(face, DATA_ACTION, ACTION_ALL); 25261 } 25262 25263 if (!options.cropBoxResizable) { 25264 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-line")), CLASS_HIDDEN); 25265 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-point")), CLASS_HIDDEN); 25266 } 25267 25268 this.render(); 25269 this.ready = true; 25270 this.setDragMode(options.dragMode); 25271 25272 if (options.autoCrop) { 25273 this.crop(); 25274 } 25275 25276 this.setData(options.data); 25277 25278 if (isFunction(options.ready)) { 25279 addListener(element, EVENT_READY, options.ready, { 25280 once: true 25281 }); 25282 } 25283 25284 dispatchEvent(element, EVENT_READY); 25285 } 25286 }, { 25287 key: "unbuild", 25288 value: function unbuild() { 25289 if (!this.ready) { 25290 return; 25291 } 25292 25293 this.ready = false;
25294 this.unbind(); 25295 this.resetPreview(); 25296 this.cropper.parentNode.removeChild(this.cropper); 25297 removeClass(this.element, CLASS_HIDDEN); 25298 } 25299 }, { 25300 key: "uncreate", 25301 value: function uncreate() { 25302 if (this.ready) { 25303 this.unbuild(); 25304 this.ready = false; 25305 this.cropped = false; 25306 } else if (this.sizing) { 25307 this.sizingImage.onload = null; 25308 this.sizing = false; 25309 this.sized = false; 25310 } else if (this.reloading) { 25311 this.xhr.onabort = null; 25312 this.xhr.abort(); 25313 } else if (this.image) { 25314 this.stop(); 25315 } 25316 } 25317 /** 25318 * Get the no conflict cropper class. 25319 * @returns {Cropper} The cropper class. 25320 */ 25321 25322 }], [{ 25323 key: "noConflict", 25324 value: function noConflict() { 25325 window.Cropper = AnotherCropper; 25326 return Cropper; 25327 } 25328 /** 25329 * Change the default options. 25330 * @param {Object} options - The new default options. 25331 */ 25332 25333 }, { 25334 key: "setDefaults", 25335 value: function setDefaults(options) { 25336 assign(DEFAULTS, isPlainObject(options) && options); 25337 } 25338 }]); 25339 25340 return Cropper; 25341 }(); 25342 25343 assign(Cropper.prototype, render, preview, events, handlers, change, methods); 25344 25345 return Cropper; 25346 25347 }))); 25348 25349 25350/***/ }), 25351/* 394 */ 25352/***/ (function(module, exports, __webpack_require__) { 25353 25354 module.exports = __webpack_require__(395); 25355 25356/***/ }), 25357/* 395 */ 25358/***/ (function(module, exports, __webpack_require__) { 25359 25360 'use strict'; 25361 25362 var utils = __webpack_require__(396); 25363 var bind = __webpack_require__(397); 25364 var Axios = __webpack_require__(399); 25365 var defaults = __webpack_require__(400); 25366 25367 /** 25368 * Create an instance of Axios 25369 * 25370 * @param {Object} defaultConfig The default config for the instance 25371 * @return {Axios} A new instance of Axios 25372 */ 25373 function createInstance(defaultConfig) { 25374 var context = new Axios(defaultConfig); 25375 var instance = bind(Axios.prototype.request, context); 25376 25377 // Copy axios.prototype to instance 25378 utils.extend(instance, Axios.prototype, context); 25379 25380 // Copy context to instance 25381 utils.extend(instance, context); 25382 25383 return instance; 25384 } 25385 25386 // Create the default instance to be exported 25387 var axios = createInstance(defaults); 25388 25389 // Expose Axios class to allow class inheritance 25390 axios.Axios = Axios; 25391 25392 // Factory for creating new instances 25393 axios.create = function create(instanceConfig) { 25394 return createInstance(utils.merge(defaults, instanceConfig)); 25395 }; 25396 25397 // Expose Cancel & CancelToken 25398 axios.Cancel = __webpack_require__(417); 25399 axios.CancelToken = __webpack_require__(418); 25400 axios.isCancel = __webpack_require__(414); 25401 25402 // Expose all/spread 25403 axios.all = function all(promises) { 25404 return Promise.all(promises); 25405 }; 25406 axios.spread = __webpack_require__(419); 25407 25408 module.exports = axios; 25409 25410 // Allow use of default import syntax in TypeScript 25411 module.exports.default = axios; 25412 25413 25414/***/ }), 25415/* 396 */ 25416/***/ (function(module, exports, __webpack_require__) { 25417 25418 'use strict'; 25419 25420 var bind = __webpack_require__(397); 25421 var isBuffer = __webpack_require__(398
vendor: 7,769 bytes, lines 25421-25724
25421); 25422 25423 /*global toString:true*/ 25424 25425 // utils is a library of generic helper functions non-specific to axios 25426 25427 var toString = Object.prototype.toString; 25428 25429 /** 25430 * Determine if a value is an Array 25431 * 25432 * @param {Object} val The value to test 25433 * @returns {boolean} True if value is an Array, otherwise false 25434 */ 25435 function isArray(val) { 25436 return toString.call(val) === '[object Array]'; 25437 } 25438 25439 /** 25440 * Determine if a value is an ArrayBuffer 25441 * 25442 * @param {Object} val The value to test 25443 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 25444 */ 25445 function isArrayBuffer(val) { 25446 return toString.call(val) === '[object ArrayBuffer]'; 25447 } 25448 25449 /** 25450 * Determine if a value is a FormData 25451 * 25452 * @param {Object} val The value to test 25453 * @returns {boolean} True if value is an FormData, otherwise false 25454 */ 25455 function isFormData(val) { 25456 return (typeof FormData !== 'undefined') && (val instanceof FormData); 25457 } 25458 25459 /** 25460 * Determine if a value is a view on an ArrayBuffer 25461 * 25462 * @param {Object} val The value to test 25463 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 25464 */ 25465 function isArrayBufferView(val) { 25466 var result; 25467 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 25468 result = ArrayBuffer.isView(val); 25469 } else { 25470 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 25471 } 25472 return result; 25473 } 25474 25475 /** 25476 * Determine if a value is a String 25477 * 25478 * @param {Object} val The value to test 25479 * @returns {boolean} True if value is a String, otherwise false 25480 */ 25481 function isString(val) { 25482 return typeof val === 'string'; 25483 } 25484 25485 /** 25486 * Determine if a value is a Number 25487 * 25488 * @param {Object} val The value to test 25489 * @returns {boolean} True if value is a Number, otherwise false 25490 */ 25491 function isNumber(val) { 25492 return typeof val === 'number'; 25493 } 25494 25495 /** 25496 * Determine if a value is undefined 25497 * 25498 * @param {Object} val The value to test 25499 * @returns {boolean} True if the value is undefined, otherwise false 25500 */ 25501 function isUndefined(val) { 25502 return typeof val === 'undefined'; 25503 } 25504 25505 /** 25506 * Determine if a value is an Object 25507 * 25508 * @param {Object} val The value to test 25509 * @returns {boolean} True if value is an Object, otherwise false 25510 */ 25511 function isObject(val) { 25512 return val !== null && typeof val === 'object'; 25513 } 25514 25515 /** 25516 * Determine if a value is a Date 25517 * 25518 * @param {Object} val The value to test 25519 * @returns {boolean} True if value is a Date, otherwise false 25520 */ 25521 function isDate(val) { 25522 return toString.call(val) === '[object Date]'; 25523 } 25524 25525 /** 25526 * Determine if a value is a File 25527 * 25528 * @param {Object} val The value to test 25529 * @returns {boolean} True if value is a File, otherwise false 25530 */ 25531 function isFile(val) { 25532 return toString.call(val) === '[object File]'; 25533 } 25534 25535 /** 25536 * Determine if a value is a Blob 25537 * 25538 * @param {Object} val The value to test 25539 * @returns {boolean} True if value is a Blob, otherwise false 25540 */ 25541 function isBlob(val) { 25542 return toString.call(val) === '[object Blob]'; 25543 } 25544 25545 /** 25546 * Determine if a value is a Function 25547 * 25548 * @param {Object} val The value to test 25549 * @returns {boolean} True if value is a Function, otherwise false 25550 */ 25551 function isFunction(val) { 25552 return toString.call(val) === '[object Function]'; 25553 } 25554 25555 /** 25556 * Determine if a value is a Stream 25557 * 25558 * @param {Object} val The value to test 25559 * @returns {boolean} True if value is a Stream, otherwise false 25560 */ 25561 function isStream(val) { 25562 return isObject(val) && isFunction(val.pipe); 25563 } 25564 25565 /** 25566 * Determine if a value is a URLSearchParams object 25567 * 25568 * @param {Object} val The value to test 25569 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 25570 */ 25571 function isURLSearchParams(val) { 25572 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 25573 } 25574 25575 /** 25576 * Trim excess whitespace off the beginning and end of a string 25577 * 25578 * @param {String} str The String to trim 25579 * @returns {String} The String freed of excess whitespace 25580 */ 25581 function trim(str) { 25582 return str.replace(/^\s*/, '').replace(/\s*$/, ''); 25583 } 25584 25585 /** 25586 * Determine if we're running in a standard browser environment 25587 * 25588 * This allows axios to run in a web worker, and react-native. 25589 * Both environments support XMLHttpRequest, but not fully standard globals. 25590 * 25591 * web workers: 25592 * typeof window -> undefined 25593 * typeof document -> undefined 25594 * 25595 * react-native: 25596 * navigator.product -> 'ReactNative' 25597 */ 25598 function isStandardBrowserEnv() { 25599 if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { 25600 return false; 25601 } 25602 return ( 25603 typeof window !== 'undefined' && 25604 typeof document !== 'undefined' 25605 ); 25606 } 25607 25608 /** 25609 * Iterate over an Array or an Object invoking a function for each item. 25610 * 25611 * If `obj` is an Array callback will be called passing 25612 * the value, index, and complete array for each item. 25613 * 25614 * If 'obj' is an Object callback will be called passing 25615 * the value, key, and complete object for each property. 25616 * 25617 * @param {Object|Array} obj The object to iterate 25618 * @param {Function} fn The callback to invoke for each item 25619 */ 25620 function forEach(obj, fn) { 25621 // Don't bother if no value provided 25622 if (obj === null || typeof obj === 'undefined') { 25623 return; 25624 } 25625 25626 // Force an array if not already something iterable 25627 if (typeof obj !== 'object') { 25628 /*eslint no-param-reassign:0*/ 25629 obj = [obj]; 25630 } 25631 25632 if (isArray(obj)) { 25633 // Iterate over array values 25634 for (var i = 0, l = obj.length; i < l; i++) { 25635 fn.call(null, obj[i], i, obj); 25636 } 25637 } else { 25638 // Iterate over object keys 25639 for (var key in obj) { 25640 if (Object.prototype.hasOwnProperty.call(obj, key)) { 25641 fn.call(null, obj[key], key, obj); 25642 } 25643 } 25644 } 25645 } 25646 25647 /** 25648 * Accepts varargs expecting each argument to be an object, then 25649 * immutably merges the properties of each object and returns result. 25650 * 25651 * When multiple objects contain the same key the later object in 25652 * the arguments list will take precedence. 25653 * 25654 * Example: 25655 * 25656 * ```js 25657 * var result = merge({foo: 123}, {foo: 456}); 25658 * console.log(result.foo); // outputs 456 25659 * ``` 25660 * 25661 * @param {Object} obj1 Object to merge 25662 * @returns {Object} Result of all merge properties 25663 */ 25664 function merge(/* obj1, obj2, obj3, ... */) { 25665 var result = {}; 25666 function assignValue(val, key) { 25667 if (typeof result[key] === 'object' && typeof val === 'object') { 25668 result[key] = merge(result[key], val); 25669 } else { 25670 result[key] = val; 25671 } 25672 } 25673 25674 for (var i = 0, l = arguments.length; i < l; i++) { 25675 forEach(arguments[i], assignValue); 25676 } 25677 return result; 25678 } 25679 25680 /** 25681 * Extends object a by mutably adding to it the properties of object b. 25682 * 25683 * @param {Object} a The object to be extended 25684 * @param {Object} b The object to copy properties from 25685 * @param {Object} thisArg The object to bind function to 25686 * @return {Object} The resulting value of object a 25687 */ 25688 function extend(a, b, thisArg) { 25689 forEach(b, function assignValue(val, key) { 25690 if (thisArg && typeof val === 'function') { 25691 a[key] = bind(val, thisArg); 25692 } else { 25693 a[key] = val; 25694 } 25695 }); 25696 return a; 25697 } 25698 25699 module.exports = { 25700 isArray: isArray, 25701 isArrayBuffer: isArrayBuffer, 25702 isBuffer: isBuffer, 25703 isFormData: isFormData, 25704 isArrayBufferView: isArrayBufferView, 25705 isString: isString, 25706 isNumber: isNumber, 25707 isObject: isObject, 25708 isUndefined: isUndefined, 25709 isDate: isDate, 25710 isFile: isFile, 25711 isBlob: isBlob, 25712 isFunction: isFunction, 25713 isStream: isStream, 25714 isURLSearchParams: isURLSearchParams, 25715 isStandardBrowserEnv: isStandardBrowserEnv, 25716 forEach: forEach, 25717 merge: merge, 25718 extend: extend, 25719 trim: trim 25720 }; 25721 25722 25723/***/ }), 25724/* 3
vendor: 18,029 bytes, lines 25724-26352
2572497 */ 25725/***/ (function(module, exports) { 25726 25727 'use strict'; 25728 25729 module.exports = function bind(fn, thisArg) { 25730 return function wrap() { 25731 var args = new Array(arguments.length); 25732 for (var i = 0; i < args.length; i++) { 25733 args[i] = arguments[i]; 25734 } 25735 return fn.apply(thisArg, args); 25736 }; 25737 }; 25738 25739 25740/***/ }), 25741/* 398 */ 25742/***/ (function(module, exports) { 25743 25744 /*! 25745 * Determine if an object is a Buffer 25746 * 25747 * @author Feross Aboukhadijeh <https://feross.org> 25748 * @license MIT 25749 */ 25750 25751 // The _isBuffer check is for Safari 5-7 support, because it's missing 25752 // Object.prototype.constructor. Remove this eventually 25753 module.exports = function (obj) { 25754 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) 25755 } 25756 25757 function isBuffer (obj) { 25758 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) 25759 } 25760 25761 // For Node v0.10 support. Remove this eventually. 25762 function isSlowBuffer (obj) { 25763 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) 25764 } 25765 25766 25767/***/ }), 25768/* 399 */ 25769/***/ (function(module, exports, __webpack_require__) { 25770 25771 'use strict'; 25772 25773 var defaults = __webpack_require__(400); 25774 var utils = __webpack_require__(396); 25775 var InterceptorManager = __webpack_require__(411); 25776 var dispatchRequest = __webpack_require__(412); 25777 25778 /** 25779 * Create a new instance of Axios 25780 * 25781 * @param {Object} instanceConfig The default config for the instance 25782 */ 25783 function Axios(instanceConfig) { 25784 this.defaults = instanceConfig; 25785 this.interceptors = { 25786 request: new InterceptorManager(), 25787 response: new InterceptorManager() 25788 }; 25789 } 25790 25791 /** 25792 * Dispatch a request 25793 * 25794 * @param {Object} config The config specific for this request (merged with this.defaults) 25795 */ 25796 Axios.prototype.request = function request(config) { 25797 /*eslint no-param-reassign:0*/ 25798 // Allow for axios('example/url'[, config]) a la fetch API 25799 if (typeof config === 'string') { 25800 config = utils.merge({ 25801 url: arguments[0] 25802 }, arguments[1]); 25803 } 25804 25805 config = utils.merge(defaults, this.defaults, { method: 'get' }, config); 25806 config.method = config.method.toLowerCase(); 25807 25808 // Hook up interceptors middleware 25809 var chain = [dispatchRequest, undefined]; 25810 var promise = Promise.resolve(config); 25811 25812 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 25813 chain.unshift(interceptor.fulfilled, interceptor.rejected); 25814 }); 25815 25816 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 25817 chain.push(interceptor.fulfilled, interceptor.rejected); 25818 }); 25819 25820 while (chain.length) { 25821 promise = promise.then(chain.shift(), chain.shift()); 25822 } 25823 25824 return promise; 25825 }; 25826 25827 // Provide aliases for supported request methods 25828 utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 25829 /*eslint func-names:0*/ 25830 Axios.prototype[method] = function(url, config) { 25831 return this.request(utils.merge(config || {}, { 25832 method: method, 25833 url: url 25834 })); 25835 }; 25836 }); 25837 25838 utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 25839 /*eslint func-names:0*/ 25840 Axios.prototype[method] = function(url, data, config) { 25841 return this.request(utils.merge(config || {}, { 25842 method: method, 25843 url: url, 25844 data: data 25845 })); 25846 }; 25847 }); 25848 25849 module.exports = Axios; 25850 25851 25852/***/ }), 25853/* 400 */ 25854/***/ (function(module, exports, __webpack_require__) { 25855 25856 /* WEBPACK VAR INJECTION */(function(process) {'use strict'; 25857 25858 var utils = __webpack_require__(396); 25859 var normalizeHeaderName = __webpack_require__(401); 25860 25861 var DEFAULT_CONTENT_TYPE = { 25862 'Content-Type': 'application/x-www-form-urlencoded' 25863 }; 25864 25865 function setContentTypeIfUnset(headers, value) { 25866 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 25867 headers['Content-Type'] = value; 25868 } 25869 } 25870 25871 function getDefaultAdapter() { 25872 var adapter; 25873 if (typeof XMLHttpRequest !== 'undefined') { 25874 // For browsers use XHR adapter 25875 adapter = __webpack_require__(402); 25876 } else if (typeof process !== 'undefined') { 25877 // For node use HTTP adapter 25878 adapter = __webpack_require__(402); 25879 } 25880 return adapter; 25881 } 25882 25883 var defaults = { 25884 adapter: getDefaultAdapter(), 25885 25886 transformRequest: [function transformRequest(data, headers) { 25887 normalizeHeaderName(headers, 'Content-Type'); 25888 if (utils.isFormData(data) || 25889 utils.isArrayBuffer(data) || 25890 utils.isBuffer(data) || 25891 utils.isStream(data) || 25892 utils.isFile(data) || 25893 utils.isBlob(data) 25894 ) { 25895 return data; 25896 } 25897 if (utils.isArrayBufferView(data)) { 25898 return data.buffer; 25899 } 25900 if (utils.isURLSearchParams(data)) { 25901 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 25902 return data.toString(); 25903 } 25904 if (utils.isObject(data)) { 25905 setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 25906 return JSON.stringify(data); 25907 } 25908 return data; 25909 }], 25910 25911 transformResponse: [function transformResponse(data) { 25912 /*eslint no-param-reassign:0*/ 25913 if (typeof data === 'string') { 25914 try { 25915 data = JSON.parse(data); 25916 } catch (e) { /* Ignore */ } 25917 } 25918 return data; 25919 }], 25920 25921 timeout: 0, 25922 25923 xsrfCookieName: 'XSRF-TOKEN', 25924 xsrfHeaderName: 'X-XSRF-TOKEN', 25925 25926 maxContentLength: -1, 25927 25928 validateStatus: function validateStatus(status) { 25929 return status >= 200 && status < 300; 25930 } 25931 }; 25932 25933 defaults.headers = { 25934 common: { 25935 'Accept': 'application/json, text/plain, */*' 25936 } 25937 }; 25938 25939 utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 25940 defaults.headers[method] = {}; 25941 }); 25942 25943 utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 25944 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 25945 }); 25946 25947 module.exports = defaults; 25948 25949 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(367))) 25950 25951/***/ }), 25952/* 401 */ 25953/***/ (function(module, exports, __webpack_require__) { 25954 25955 'use strict'; 25956 25957 var utils = __webpack_require__(396); 25958 25959 module.exports = function normalizeHeaderName(headers, normalizedName) { 25960 utils.forEach(headers, function processHeader(value, name) { 25961 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 25962 headers[normalizedName] = value; 25963 delete headers[name]; 25964 } 25965 }); 25966 }; 25967 25968 25969/***/ }), 25970/* 402 */ 25971/***/ (function(module, exports, __webpack_require__) { 25972 25973 /* WEBPACK VAR INJECTION */(function(process) {'use strict'; 25974 25975 var utils = __webpack_require__(396); 25976 var settle = __webpack_require__(403); 25977 var buildURL = __webpack_require__(406); 25978 var parseHeaders = __webpack_require__(407); 25979 var isURLSameOrigin = __webpack_require__(408); 25980 var createError = __webpack_require__(404); 25981 var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(409); 25982 25983 module.exports = function xhrAdapter(config) { 25984 return new Promise(function dispatchXhrRequest(resolve, reject) { 25985 var requestData = config.data; 25986 var requestHeaders = config.headers; 25987 25988 if (utils.isFormData(requestData)) { 25989 delete requestHeaders['Content-Type']; // Let the browser set it 25990 } 25991 25992 var request = new XMLHttpRequest(); 25993 var loadEvent = 'onreadystatechange'; 25994 var xDomain = false; 25995 25996 // For IE 8/9 CORS support 25997 // Only supports POST and GET calls and doesn't returns the response headers. 25998 // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest. 25999 if (process.env.NODE_ENV !== 'test' && 26000 typeof window !== 'undefined' && 26001 window.XDomainRequest && !('withCredentials' in request) && 26002 !isURLSameOrigin(config.url)) { 26003 request = new window.XDomainRequest(); 26004 loadEvent = 'onload'; 26005 xDomain = true; 26006 request.onprogress = function handleProgress() {}; 26007 request.ontimeout = function handleTimeout() {}; 26008 } 26009 26010 // HTTP basic authentication 26011 if (config.auth) { 26012 var username = config.auth.username || ''; 26013 var password = config.auth.password || ''; 26014 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 26015 } 26016 26017 request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); 26018 26019 // Set the request timeout in MS 26020 request.timeout = config.timeout; 26021 26022 // Listen for ready state 26023 request[loadEvent] = function handleLoad() { 26024 if (!request || (request.readyState !== 4 && !xDomain)) { 26025 return; 26026 } 26027 26028 // The request errored out and we didn't get a response, this will be 26029 // handled by onerror instead 26030 // With one exception: request that using file: protocol, most browsers 26031 // will return status as 0 even though it's a successful request 26032 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 26033 return; 26034 } 26035 26036 // Prepare the response 26037 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 26038 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 26039 var response = { 26040 data: responseData, 26041 // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201) 26042 status: request.status === 1223 ? 204 : request.status, 26043 statusText: request.status === 1223 ? 'No Content' : request.statusText, 26044 headers: responseHeaders, 26045 config: config, 26046 request: request 26047 }; 26048 26049 settle(resolve, reject, response); 26050 26051 // Clean up request 26052 request = null; 26053 }; 26054 26055 // Handle low level network errors 26056 request.onerror = function handleError() { 26057 // Real errors are hidden from us by the browser 26058 // onerror should only fire if it's a network error 26059 reject(createError('Network Error', config, null, request)); 26060 26061 // Clean up request 26062 request = null; 26063 }; 26064 26065 // Handle timeout 26066 request.ontimeout = function handleTimeout() { 26067 reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', 26068 request)); 26069 26070 // Clean up request 26071 request = null; 26072 }; 26073 26074 // Add xsrf header 26075 // This is only done if running in a standard browser environment. 26076 // Specifically not if we're in a web worker, or react-native. 26077 if (utils.isStandardBrowserEnv()) { 26078 var cookies = __webpack_require__(410); 26079 26080 // Add xsrf header 26081 var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? 26082 cookies.read(config.xsrfCookieName) : 26083 undefined; 26084 26085 if (xsrfValue) { 26086 requestHeaders[config.xsrfHeaderName] = xsrfValue; 26087 } 26088 } 26089 26090 // Add headers to the request 26091 if ('setRequestHeader' in request) { 26092 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 26093 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 26094 // Remove Content-Type if data is undefined 26095 delete requestHeaders[key]; 26096 } else { 26097 // Otherwise add header to the request 26098 request.setRequestHeader(key, val); 26099 } 26100 }); 26101 } 26102 26103 // Add withCredentials to request if needed 26104 if (config.withCredentials) { 26105 request.withCredentials = true; 26106 } 26107 26108 // Add responseType to request if needed 26109 if (config.responseType) { 26110 try { 26111 request.responseType = config.responseType; 26112 } catch (e) { 26113 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 26114 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 26115 if (config.responseType !== 'json') { 26116 throw e; 26117 } 26118 } 26119 } 26120 26121 // Handle progress if needed 26122 if (typeof config.onDownloadProgress === 'function') { 26123 request.addEventListener('progress', config.onDownloadProgress); 26124 } 26125 26126 // Not all browsers support upload events 26127 if (typeof config.onUploadProgress === 'function' && request.upload) { 26128 request.upload.addEventListener('progress', config.onUploadProgress); 26129 } 26130 26131 if (config.cancelToken) { 26132 // Handle cancellation 26133 config.cancelToken.promise.then(function onCanceled(cancel) { 26134 if (!request) { 26135 return; 26136 } 26137 26138 request.abort(); 26139 reject(cancel); 26140 // Clean up request 26141 request = null; 26142 }); 26143 } 26144 26145 if (requestData === undefined) { 26146 requestData = null; 26147 } 26148 26149 // Send the request 26150 request.send(requestData); 26151 }); 26152 }; 26153 26154 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(367))) 26155 26156/***/ }), 26157/* 403 */ 26158/***/ (function(module, exports, __webpack_require__) { 26159 26160 'use strict'; 26161 26162 var createError = __webpack_require__(404); 26163 26164 /** 26165 * Resolve or reject a Promise based on response status. 26166 * 26167 * @param {Function} resolve A function that resolves the promise. 26168 * @param {Function} reject A function that rejects the promise. 26169 * @param {object} response The response. 26170 */ 26171 module.exports = function settle(resolve, reject, response) { 26172 var validateStatus = response.config.validateStatus; 26173 // Note: status is not exposed by XDomainRequest 26174 if (!response.status || !validateStatus || validateStatus(response.status)) { 26175 resolve(response); 26176 } else { 26177 reject(createError( 26178 'Request failed with status code ' + response.status, 26179 response.config, 26180 null, 26181 response.request, 26182 response 26183 )); 26184 } 26185 }; 26186 26187 26188/***/ }), 26189/* 404 */ 26190/***/ (function(module, exports, __webpack_require__) { 26191 26192 'use strict'; 26193 26194 var enhanceError = __webpack_require__(405); 26195 26196 /** 26197 * Create an Error with the specified message, config, error code, request and response. 26198 * 26199 * @param {string} message The error message. 26200 * @param {Object} config The config. 26201 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 26202 * @param {Object} [request] The request. 26203 * @param {Object} [response] The response. 26204 * @returns {Error} The created error. 26205 */ 26206 module.exports = function createError(message, config, code, request, response) { 26207 var error = new Error(message); 26208 return enhanceError(error, config, code, request, response); 26209 }; 26210 26211 26212/***/ }), 26213/* 405 */ 26214/***/ (function(module, exports) { 26215 26216 'use strict'; 26217 26218 /** 26219 * Update an Error with the specified config, error code, and response. 26220 * 26221 * @param {Error} error The error to update. 26222 * @param {Object} config The config. 26223 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 26224 * @param {Object} [request] The request. 26225 * @param {Object} [response] The response. 26226 * @returns {Error} The error. 26227 */ 26228 module.exports = function enhanceError(error, config, code, request, response) { 26229 error.config = config; 26230 if (code) { 26231 error.code = code; 26232 } 26233 error.request = request; 26234 error.response = response; 26235 return error; 26236 }; 26237 26238 26239/***/ }), 26240/* 406 */ 26241/***/ (function(module, exports, __webpack_require__) { 26242 26243 'use strict'; 26244 26245 var utils = __webpack_require__(396); 26246 26247 function encode(val) { 26248 return encodeURIComponent(val). 26249 replace(/%40/gi, '@'). 26250 replace(/%3A/gi, ':'). 26251 replace(/%24/g, '$'). 26252 replace(/%2C/gi, ','). 26253 replace(/%20/g, '+'). 26254 replace(/%5B/gi, '['). 26255 replace(/%5D/gi, ']'); 26256 } 26257 26258 /** 26259 * Build a URL by appending params to the end 26260 * 26261 * @param {string} url The base of the url (e.g., http://www.google.com) 26262 * @param {object} [params] The params to be appended 26263 * @returns {string} The formatted url 26264 */ 26265 module.exports = function buildURL(url, params, paramsSerializer) { 26266 /*eslint no-param-reassign:0*/ 26267 if (!params) { 26268 return url; 26269 } 26270 26271 var serializedParams; 26272 if (paramsSerializer) { 26273 serializedParams = paramsSerializer(params); 26274 } else if (utils.isURLSearchParams(params)) { 26275 serializedParams = params.toString(); 26276 } else { 26277 var parts = []; 26278 26279 utils.forEach(params, function serialize(val, key) { 26280 if (val === null || typeof val === 'undefined') { 26281 return; 26282 } 26283 26284 if (utils.isArray(val)) { 26285 key = key + '[]'; 26286 } 26287 26288 if (!utils.isArray(val)) { 26289 val = [val]; 26290 } 26291 26292 utils.forEach(val, function parseValue(v) { 26293 if (utils.isDate(v)) { 26294 v = v.toISOString(); 26295 } else if (utils.isObject(v)) { 26296 v = JSON.stringify(v); 26297 } 26298 parts.push(encode(key) + '=' + encode(v)); 26299 }); 26300 }); 26301 26302 serializedParams = parts.join('&'); 26303 } 26304 26305 if (serializedParams) { 26306 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 26307 } 26308 26309 return url; 26310 }; 26311 26312 26313/***/ }), 26314/* 407 */ 26315/***/ (function(module, exports, __webpack_require__) { 26316 26317 'use strict'; 26318 26319 var utils = __webpack_require__(396); 26320 26321 // Headers whose duplicates are ignored by node 26322 // c.f. https://nodejs.org/api/http.html#http_message_headers 26323 var ignoreDuplicateOf = [ 26324 'age', 'authorization', 'content-length', 'content-type', 'etag', 26325 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 26326 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 26327 'referer', 'retry-after', 'user-agent' 26328 ]; 26329 26330 /** 26331 * Parse headers into an object 26332 * 26333 * ``` 26334 * Date: Wed, 27 Aug 2014 08:58:49 GMT 26335 * Content-Type: application/json 26336 * Connection: keep-alive 26337 * Transfer-Encoding: chunked 26338 * ``` 26339 * 26340 * @param {String} headers Headers needing to be parsed 26341 * @returns {Object} Headers parsed into an object 26342 */ 26343 module.exports = function parseHeaders(headers) { 26344 var parsed = {}; 26345 var key; 26346 var val; 26347 var i; 26348 26349 if (!headers) { return parsed; } 26350 26351 utils.forEach(headers.split('\n'), function parser(line) { 26352 i = line.indexOf(':');
vendor: 8,190 bytes, lines 26353-26657
26353 key = utils.trim(line.substr(0, i)).toLowerCase(); 26354 val = utils.trim(line.substr(i + 1)); 26355 26356 if (key) { 26357 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 26358 return; 26359 } 26360 if (key === 'set-cookie') { 26361 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 26362 } else { 26363 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 26364 } 26365 } 26366 }); 26367 26368 return parsed; 26369 }; 26370 26371 26372/***/ }), 26373/* 408 */ 26374/***/ (function(module, exports, __webpack_require__) { 26375 26376 'use strict'; 26377 26378 var utils = __webpack_require__(396); 26379 26380 module.exports = ( 26381 utils.isStandardBrowserEnv() ? 26382 26383 // Standard browser envs have full support of the APIs needed to test 26384 // whether the request URL is of the same origin as current location. 26385 (function standardBrowserEnv() { 26386 var msie = /(msie|trident)/i.test(navigator.userAgent); 26387 var urlParsingNode = document.createElement('a'); 26388 var originURL; 26389 26390 /** 26391 * Parse a URL to discover it's components 26392 * 26393 * @param {String} url The URL to be parsed 26394 * @returns {Object} 26395 */ 26396 function resolveURL(url) { 26397 var href = url; 26398 26399 if (msie) { 26400 // IE needs attribute set twice to normalize properties 26401 urlParsingNode.setAttribute('href', href); 26402 href = urlParsingNode.href; 26403 } 26404 26405 urlParsingNode.setAttribute('href', href); 26406 26407 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 26408 return { 26409 href: urlParsingNode.href, 26410 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 26411 host: urlParsingNode.host, 26412 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 26413 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 26414 hostname: urlParsingNode.hostname, 26415 port: urlParsingNode.port, 26416 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 26417 urlParsingNode.pathname : 26418 '/' + urlParsingNode.pathname 26419 }; 26420 } 26421 26422 originURL = resolveURL(window.location.href); 26423 26424 /** 26425 * Determine if a URL shares the same origin as the current location 26426 * 26427 * @param {String} requestURL The URL to test 26428 * @returns {boolean} True if URL shares the same origin, otherwise false 26429 */ 26430 return function isURLSameOrigin(requestURL) { 26431 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 26432 return (parsed.protocol === originURL.protocol && 26433 parsed.host === originURL.host); 26434 }; 26435 })() : 26436 26437 // Non standard browser envs (web workers, react-native) lack needed support. 26438 (function nonStandardBrowserEnv() { 26439 return function isURLSameOrigin() { 26440 return true; 26441 }; 26442 })() 26443 ); 26444 26445 26446/***/ }), 26447/* 409 */ 26448/***/ (function(module, exports) { 26449 26450 'use strict'; 26451 26452 // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js 26453 26454 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 26455 26456 function E() { 26457 this.message = 'String contains an invalid character'; 26458 } 26459 E.prototype = new Error; 26460 E.prototype.code = 5; 26461 E.prototype.name = 'InvalidCharacterError'; 26462 26463 function btoa(input) { 26464 var str = String(input); 26465 var output = ''; 26466 for ( 26467 // initialize result and counter 26468 var block, charCode, idx = 0, map = chars; 26469 // if the next str index does not exist: 26470 // change the mapping table to "=" 26471 // check if d has no fractional digits 26472 str.charAt(idx | 0) || (map = '=', idx % 1); 26473 // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 26474 output += map.charAt(63 & block >> 8 - idx % 1 * 8) 26475 ) { 26476 charCode = str.charCodeAt(idx += 3 / 4); 26477 if (charCode > 0xFF) { 26478 throw new E(); 26479 } 26480 block = block << 8 | charCode; 26481 } 26482 return output; 26483 } 26484 26485 module.exports = btoa; 26486 26487 26488/***/ }), 26489/* 410 */ 26490/***/ (function(module, exports, __webpack_require__) { 26491 26492 'use strict'; 26493 26494 var utils = __webpack_require__(396); 26495 26496 module.exports = ( 26497 utils.isStandardBrowserEnv() ? 26498 26499 // Standard browser envs support document.cookie 26500 (function standardBrowserEnv() { 26501 return { 26502 write: function write(name, value, expires, path, domain, secure) { 26503 var cookie = []; 26504 cookie.push(name + '=' + encodeURIComponent(value)); 26505 26506 if (utils.isNumber(expires)) { 26507 cookie.push('expires=' + new Date(expires).toGMTString()); 26508 } 26509 26510 if (utils.isString(path)) { 26511 cookie.push('path=' + path); 26512 } 26513 26514 if (utils.isString(domain)) { 26515 cookie.push('domain=' + domain); 26516 } 26517 26518 if (secure === true) { 26519 cookie.push('secure'); 26520 } 26521 26522 document.cookie = cookie.join('; '); 26523 }, 26524 26525 read: function read(name) { 26526 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 26527 return (match ? decodeURIComponent(match[3]) : null); 26528 }, 26529 26530 remove: function remove(name) { 26531 this.write(name, '', Date.now() - 86400000); 26532 } 26533 }; 26534 })() : 26535 26536 // Non standard browser env (web workers, react-native) lack needed support. 26537 (function nonStandardBrowserEnv() { 26538 return { 26539 write: function write() {}, 26540 read: function read() { return null; }, 26541 remove: function remove() {} 26542 }; 26543 })() 26544 ); 26545 26546 26547/***/ }), 26548/* 411 */ 26549/***/ (function(module, exports, __webpack_require__) { 26550 26551 'use strict'; 26552 26553 var utils = __webpack_require__(396); 26554 26555 function InterceptorManager() { 26556 this.handlers = []; 26557 } 26558 26559 /** 26560 * Add a new interceptor to the stack 26561 * 26562 * @param {Function} fulfilled The function to handle `then` for a `Promise` 26563 * @param {Function} rejected The function to handle `reject` for a `Promise` 26564 * 26565 * @return {Number} An ID used to remove interceptor later 26566 */ 26567 InterceptorManager.prototype.use = function use(fulfilled, rejected) { 26568 this.handlers.push({ 26569 fulfilled: fulfilled, 26570 rejected: rejected 26571 }); 26572 return this.handlers.length - 1; 26573 }; 26574 26575 /** 26576 * Remove an interceptor from the stack 26577 * 26578 * @param {Number} id The ID that was returned by `use` 26579 */ 26580 InterceptorManager.prototype.eject = function eject(id) { 26581 if (this.handlers[id]) { 26582 this.handlers[id] = null; 26583 } 26584 }; 26585 26586 /** 26587 * Iterate over all the registered interceptors 26588 * 26589 * This method is particularly useful for skipping over any 26590 * interceptors that may have become `null` calling `eject`. 26591 * 26592 * @param {Function} fn The function to call for each interceptor 26593 */ 26594 InterceptorManager.prototype.forEach = function forEach(fn) { 26595 utils.forEach(this.handlers, function forEachHandler(h) { 26596 if (h !== null) { 26597 fn(h); 26598 } 26599 }); 26600 }; 26601 26602 module.exports = InterceptorManager; 26603 26604 26605/***/ }), 26606/* 412 */ 26607/***/ (function(module, exports, __webpack_require__) { 26608 26609 'use strict'; 26610 26611 var utils = __webpack_require__(396); 26612 var transformData = __webpack_require__(413); 26613 var isCancel = __webpack_require__(414); 26614 var defaults = __webpack_require__(400); 26615 var isAbsoluteURL = __webpack_require__(415); 26616 var combineURLs = __webpack_require__(416); 26617 26618 /** 26619 * Throws a `Cancel` if cancellation has been requested. 26620 */ 26621 function throwIfCancellationRequested(config) { 26622 if (config.cancelToken) { 26623 config.cancelToken.throwIfRequested(); 26624 } 26625 } 26626 26627 /** 26628 * Dispatch a request to the server using the configured adapter. 26629 * 26630 * @param {object} config The config that is to be used for the request 26631 * @returns {Promise} The Promise to be fulfilled 26632 */ 26633 module.exports = function dispatchRequest(config) { 26634 throwIfCancellationRequested(config); 26635 26636 // Support baseURL config 26637 if (config.baseURL && !isAbsoluteURL(config.url)) { 26638 config.url = combineURLs(config.baseURL, config.url); 26639 } 26640 26641 // Ensure headers exist 26642 config.headers = config.headers || {}; 26643 26644 // Transform request data 26645 config.data = transformData( 26646 config.data, 26647 config.headers, 26648 config.transformRequest 26649 ); 26650 26651 // Flatten headers 26652 config.headers = utils.merge( 26653 config.headers.common || {}, 26654 config.headers[config.method] || {}, 26655 config.headers || {} 26656 ); 26657
vendor: 4,583 bytes, lines 26658-26850
26658 utils.forEach( 26659 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 26660 function cleanHeaderConfig(method) { 26661 delete config.headers[method]; 26662 } 26663 ); 26664 26665 var adapter = config.adapter || defaults.adapter; 26666 26667 return adapter(config).then(function onAdapterResolution(response) { 26668 throwIfCancellationRequested(config); 26669 26670 // Transform response data 26671 response.data = transformData( 26672 response.data, 26673 response.headers, 26674 config.transformResponse 26675 ); 26676 26677 return response; 26678 }, function onAdapterRejection(reason) { 26679 if (!isCancel(reason)) { 26680 throwIfCancellationRequested(config); 26681 26682 // Transform response data 26683 if (reason && reason.response) { 26684 reason.response.data = transformData( 26685 reason.response.data, 26686 reason.response.headers, 26687 config.transformResponse 26688 ); 26689 } 26690 } 26691 26692 return Promise.reject(reason); 26693 }); 26694 }; 26695 26696 26697/***/ }), 26698/* 413 */ 26699/***/ (function(module, exports, __webpack_require__) { 26700 26701 'use strict'; 26702 26703 var utils = __webpack_require__(396); 26704 26705 /** 26706 * Transform the data for a request or a response 26707 * 26708 * @param {Object|String} data The data to be transformed 26709 * @param {Array} headers The headers for the request or response 26710 * @param {Array|Function} fns A single function or Array of functions 26711 * @returns {*} The resulting transformed data 26712 */ 26713 module.exports = function transformData(data, headers, fns) { 26714 /*eslint no-param-reassign:0*/ 26715 utils.forEach(fns, function transform(fn) { 26716 data = fn(data, headers); 26717 }); 26718 26719 return data; 26720 }; 26721 26722 26723/***/ }), 26724/* 414 */ 26725/***/ (function(module, exports) { 26726 26727 'use strict'; 26728 26729 module.exports = function isCancel(value) { 26730 return !!(value && value.__CANCEL__); 26731 }; 26732 26733 26734/***/ }), 26735/* 415 */ 26736/***/ (function(module, exports) { 26737 26738 'use strict'; 26739 26740 /** 26741 * Determines whether the specified URL is absolute 26742 * 26743 * @param {string} url The URL to test 26744 * @returns {boolean} True if the specified URL is absolute, otherwise false 26745 */ 26746 module.exports = function isAbsoluteURL(url) { 26747 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 26748 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 26749 // by any combination of letters, digits, plus, period, or hyphen. 26750 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 26751 }; 26752 26753 26754/***/ }), 26755/* 416 */ 26756/***/ (function(module, exports) { 26757 26758 'use strict'; 26759 26760 /** 26761 * Creates a new URL by combining the specified URLs 26762 * 26763 * @param {string} baseURL The base URL 26764 * @param {string} relativeURL The relative URL 26765 * @returns {string} The combined URL 26766 */ 26767 module.exports = function combineURLs(baseURL, relativeURL) { 26768 return relativeURL 26769 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 26770 : baseURL; 26771 }; 26772 26773 26774/***/ }), 26775/* 417 */ 26776/***/ (function(module, exports) { 26777 26778 'use strict'; 26779 26780 /** 26781 * A `Cancel` is an object that is thrown when an operation is canceled. 26782 * 26783 * @class 26784 * @param {string=} message The message. 26785 */ 26786 function Cancel(message) { 26787 this.message = message; 26788 } 26789 26790 Cancel.prototype.toString = function toString() { 26791 return 'Cancel' + (this.message ? ': ' + this.message : ''); 26792 }; 26793 26794 Cancel.prototype.__CANCEL__ = true; 26795 26796 module.exports = Cancel; 26797 26798 26799/***/ }), 26800/* 418 */ 26801/***/ (function(module, exports, __webpack_require__) { 26802 26803 'use strict'; 26804 26805 var Cancel = __webpack_require__(417); 26806 26807 /** 26808 * A `CancelToken` is an object that can be used to request cancellation of an operation. 26809 * 26810 * @class 26811 * @param {Function} executor The executor function. 26812 */ 26813 function CancelToken(executor) { 26814 if (typeof executor !== 'function') { 26815 throw new TypeError('executor must be a function.'); 26816 } 26817 26818 var resolvePromise; 26819 this.promise = new Promise(function promiseExecutor(resolve) { 26820 resolvePromise = resolve; 26821 }); 26822 26823 var token = this; 26824 executor(function cancel(message) { 26825 if (token.reason) { 26826 // Cancellation has already been requested 26827 return; 26828 } 26829 26830 token.reason = new Cancel(message); 26831 resolvePromise(token.reason); 26832 }); 26833 } 26834 26835 /** 26836 * Throws a `Cancel` if cancellation has been requested. 26837 */ 26838 CancelToken.prototype.throwIfRequested = function throwIfRequested() { 26839 if (this.reason) { 26840 throw this.reason; 26841 } 26842 }; 26843 26844 /** 26845 * Returns an object that contains a new `CancelToken` and a function that, when called, 26846 * cancels the `CancelToken`. 26847 */ 26848 CancelToken.source = function source() { 26849 var cancel; 26850 var token = new CancelToken(function executor(c) {
26851 cancel = c; 26852 }); 26853 return { 26854 token: token, 26855 cancel: cancel 26856 }; 26857 }; 26858 26859 module.exports = CancelToken; 26860 26861 26862/***/ }), 26863/* 419 */ 26864/***/ (function(module, exports) { 26865 26866 'use strict'; 26867 26868 /** 26869 * Syntactic sugar for invoking a function and expanding an array for arguments. 26870 * 26871 * Common use case would be to use `Function.prototype.apply`. 26872 * 26873 * ```js 26874 * function f(x, y, z) {} 26875 * var args = [1, 2, 3]; 26876 * f.apply(null, args); 26877 * ``` 26878 * 26879 * With `spread` this example can be re-written. 26880 * 26881 * ```js 26882 * spread(function(x, y, z) {})([1, 2, 3]); 26883 * ``` 26884 * 26885 * @param {Function} callback 26886 * @returns {Function} 26887 */ 26888 module.exports = function spread(callback) { 26889 return function wrap(arr) { 26890 return callback.apply(null, arr); 26891 }; 26892 }; 26893 26894 26895/***/ }), 26896/* 420 */ 26897/***/ (function(module, exports, __webpack_require__) { 26898 26899 'use strict'; 26900 26901 Object.defineProperty(exports, '__esModule', { 26902 value: true 26903 }); 26904 26905 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 26906 26907 var validate = __webpack_require__(338); 26908 26909 var ProfileEditPassword = function ProfileEditPassword(args) { 26910 _classCallCheck(this, ProfileEditPassword); 26911 26912 console.log('profile_edit_password.js loaded'); 26913 26914 // Form validation 26915 var constraints = { 26916 'user[current_password]': { 26917 presence: { 26918 message: "å ¥åãã¦ãã ãã" 26919 } 26920 }, 26921 'user[password]': { 26922 presence: { 26923 message: "å ¥åãã¦ãã ãã" 26924 }, 26925 length: { 26926 minimum: 8, 26927 message: "8æå以ä¸å ¥åãã¦ãã ãã" 26928 } 26929 }, 26930 'user[password_confirmation]': { 26931 presence: { 26932 message: "å ¥åãã¦ãã ãã" 26933 }, 26934 length: { 26935 minimum: 8, 26936 message: "8æå以ä¸å ¥åãã¦ãã ãã" 26937 }, 26938 equality: { 26939 attribute: "user[password]", 26940 message: "ãã¹ã¯ã¼ããä¸è´ãã¾ãã" 26941 } 26942 } 26943 }; 26944 26945 // Hook up the form so we can prevent it from being posted 26946 var form = document.getElementById("profile_edit_form"); 26947 form.onsubmit = function (ev) { 26948 ev.preventDefault(); 26949 handleFormSubmit(form); 26950 }; 26951 26952 // Hook up the inputs to validate on the fly 26953 var inputs = document.querySelectorAll("input, textarea, select"); 26954 inputs.forEach(function (element) { 26955 element.onchange = function (elem) { 26956 var errors = validate(form, constraints, { fullMessages: false }) || {}; 26957 showErrorsForInput(this, errors[this.name]); 26958 }; 26959 }); 26960 26961 function handleFormSubmit(form, input) { 26962 // validate the form against the constraints 26963 var errors = validate(form, constraints, { fullMessages: false }); 26964 // then we update the form to reflect the results 26965 showErrors(form, errors || {}); 26966 if (!errors) { 26967 showSuccess(); 26968 } 26969 } 26970 26971 // Updates the inputs with the validation errors 26972 function showErrors(form, errors) { 26973 // We loop through all the inputs and show the errors for that input 26974 form.querySelectorAll(".input_validate").forEach(function (input) { 26975 // Since the errors can be null if no errors were found we need to handle that 26976 showErrorsForInput(input, errors && errors[input.name]); 26977 }); 26978 } 26979 26980 // Shows the errors for a specific input 26981 function showErrorsForInput(input, errors) { 26982 // This is the root of the input 26983 var formGroup = closestParent(input.parentNode, "form-group"); 26984 // Find where the error messages will be insert into 26985 var messages = formGroup.querySelector(".error-messages"); 26986 // First we remove any old messages and resets the classes 26987 resetFormGroup(formGroup, messages); 26988 // If we have errors 26989 if (errors) { 26990 // we first mark the group has having errors 26991 formGroup.classList.add("has-error"); 26992 // then we append all the errors 26993 errors.forEach(function (error) { 26994 addError(messages, error); 26995 }); 26996 } else { 26997 // otherwise we simply mark it as success 26998 formGroup.classList.add("has-success"); 26999 } 27000 } 27001 27002 // Recusively finds the closest parent that has the specified class 27003 function closestParent(_x, _x2) { 27004 var _again = true; 27005 27006 _function: while (_again) { 27007 var child = _x, 27008 className = _x2; 27009 _again = false;
27010 27011 if (!child || child == document) { 27012 return null; 27013 } 27014 if (child.classList.contains(className)) { 27015 return child; 27016 } else { 27017 _x = child.parentNode; 27018 _x2 = className; 27019 _again = true; 27020 continue _function; 27021 } 27022 } 27023 } 27024 27025 function resetFormGroup(formGroup, messages) { 27026 // Remove the success and error classes 27027 formGroup.classList.remove("has-error"); 27028 formGroup.classList.remove("has-success"); 27029 messages.classList.remove("show"); 27030 // and remove any old messages 27031 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 27032 // el.parentNode.removeChild(el); 27033 // }); 27034 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 27035 element.parentNode.removeChild(element); 27036 }); 27037 } 27038 27039 // Adds the specified error with the following markup 27040 // <p class="help-block error">[message]</p> 27041 function addError(messages, error) { 27042 var block = document.createElement("p"); 27043 block.classList.add("help-block"); 27044 block.classList.add("error"); 27045 block.innerText = error; 27046 messages.appendChild(block); 27047 messages.classList.add("show"); 27048 } 27049 27050 function showSuccess() { 27051 form.submit(); 27052 } 27053 } 27054 27055 // methods 27056 ; 27057 27058 exports['default'] = ProfileEditPassword; 27059 module.exports = exports['default']; 27060 27061/***/ }), 27062/* 421 */ 27063/***/ (function(module, exports) { 27064 27065 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 27066 27067 'use strict'; 27068 27069 Object.defineProperty(exports, '__esModule', { 27070 value: true 27071 }); 27072 27073 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; }; })(); 27074 27075 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27076 27077 var ProfileMailSubscriptions = (function () { 27078 function ProfileMailSubscriptions(args) { 27079 _classCallCheck(this, ProfileMailSubscriptions); 27080 27081 // code 27082 console.log('profile_mail_subscriptions.js loaded'); 27083 27084 this.init(); 27085 } 27086 27087 // methods 27088 27089 _createClass(ProfileMailSubscriptions, [{ 27090 key: 'init', 27091 value: function init() { 27092 var _this = this; 27093 27094 this.mail_project_button = document.getElementById('mail_project_button'); 27095 this.mail_project_holder = document.getElementById('mail_project_holder'); 27096 27097 this.mail_project_button.addEventListener('click', function (e) { 27098 _this.onShowMailProject(); 27099 }, false); 27100 } 27101 }, { 27102 key: 'onShowMailProject', 27103 value: function onShowMailProject() { 27104 this.mail_project_holder.classList.toggle('is-active'); 27105 this.mail_project_button.classList.add('is-hidden'); 27106 } 27107 }]); 27108 27109 return ProfileMailSubscriptions; 27110 })(); 27111 27112 exports['default'] = ProfileMailSubscriptions; 27113 module.exports = exports['default']; 27114 27115/***/ }), 27116/* 422 */ 27117/***/ (function(module, exports, __webpack_require__) { 27118 27119 'use strict'; 27120 27121 Object.defineProperty(exports, '__esModule', { 27122 value: true 27123 }); 27124 27125 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27126 27127 var validate = __webpack_require__(338); 27128 27129 var ProfileTwitterEdit = function ProfileTwitterEdit(args) { 27130 _classCallCheck(this, ProfileTwitterEdit); 27131 27132 console.log('profile_twitter.js loaded'); 27133 27134 // Form validation 27135 var constraints = { 27136 'user[family_name]': { 27137 presence: { 27138 message: "å ¥åãã¦ãã ãã" 27139 } 27140 }, 27141 'user[first_name]': { 27142 presence: { 27143 message: "å ¥åãã¦ãã ãã" 27144 } 27145 }, 27146 'user[email]': { 27147 email: { 27148 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 27149 }, 27150 presence: { 27151 message: "å ¥åãã¦ãã ãã" 27152 } 27153 }, 27154 'user[agreement]': { 27155 presence: { 27156 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 27157 }, 27158 inclusion: { 27159 within: [true, '1'], 27160 message: "å©ç¨è¦ç´ã確èªãã¦ãã ãã" 27161 } 27162 } 27163 }; 27164 27165 // Hook up the form so we can prevent it from being posted 27166 var form = document.getElementById("profile_edit_form"); 27167 form.onsubmit = function (ev) { 27168 ev.preventDefault(); 27169 handleFormSubmit(form); 27170 }; 27171 27172 // Hook up the inputs to validate on the fly 27173 var inputs = document.querySelectorAll("input, textarea, select");
27174 inputs.forEach(function (element) { 27175 element.onchange = function (elem) { 27176 var errors = validate(form, constraints, { fullMessages: false }) || {}; 27177 showErrorsForInput(this, errors[this.name]); 27178 }; 27179 }); 27180 27181 function handleFormSubmit(form, input) { 27182 // validate the form against the constraints 27183 var errors = validate(form, constraints, { fullMessages: false }); 27184 // then we update the form to reflect the results 27185 showErrors(form, errors || {}); 27186 if (!errors) { 27187 showSuccess(); 27188 } 27189 } 27190 27191 // Updates the inputs with the validation errors 27192 function showErrors(form, errors) { 27193 // We loop through all the inputs and show the errors for that input 27194 form.querySelectorAll(".input_validate").forEach(function (input) { 27195 // Since the errors can be null if no errors were found we need to handle that 27196 showErrorsForInput(input, errors && errors[input.name]); 27197 }); 27198 } 27199 27200 // Shows the errors for a specific input 27201 function showErrorsForInput(input, errors) { 27202 // This is the root of the input 27203 var formGroup = closestParent(input.parentNode, "form-group"); 27204 // Find where the error messages will be insert into 27205 var messages = formGroup.querySelector(".error-messages"); 27206 // First we remove any old messages and resets the classes 27207 resetFormGroup(formGroup, messages); 27208 // If we have errors 27209 if (errors) { 27210 // we first mark the group has having errors 27211 formGroup.classList.add("has-error"); 27212 // then we append all the errors 27213 errors.forEach(function (error) { 27214 addError(messages, error); 27215 }); 27216 } else { 27217 // otherwise we simply mark it as success 27218 formGroup.classList.add("has-success"); 27219 } 27220 } 27221 27222 // Recusively finds the closest parent that has the specified class 27223 function closestParent(_x, _x2) { 27224 var _again = true; 27225 27226 _function: while (_again) { 27227 var child = _x, 27228 className = _x2; 27229 _again = false; 27230 27231 if (!child || child == document) { 27232 return null; 27233 } 27234 if (child.classList.contains(className)) { 27235 return child; 27236 } else { 27237 _x = child.parentNode; 27238 _x2 = className; 27239 _again = true; 27240 continue _function; 27241 } 27242 } 27243 } 27244 27245 function resetFormGroup(formGroup, messages) { 27246 // Remove the success and error classes 27247 formGroup.classList.remove("has-error"); 27248 formGroup.classList.remove("has-success"); 27249 messages.classList.remove("show"); 27250 // and remove any old messages 27251 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 27252 // el.parentNode.removeChild(el); 27253 // }); 27254 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 27255 element.parentNode.removeChild(element); 27256 }); 27257 } 27258 27259 // Adds the specified error with the following markup 27260 // <p class="help-block error">[message]</p> 27261 function addError(messages, error) { 27262 var block = document.createElement("p"); 27263 block.classList.add("help-block"); 27264 block.classList.add("error"); 27265 block.innerText = error; 27266 messages.appendChild(block); 27267 messages.classList.add("show"); 27268 } 27269 27270 function showSuccess() { 27271 form.submit(); 27272 } 27273 } 27274 27275 // methods 27276 ; 27277 27278 exports['default'] = ProfileTwitterEdit; 27279 module.exports = exports['default']; 27280 27281/***/ }), 27282/* 423 */ 27283/***/ (function(module, exports, __webpack_require__) { 27284 27285 'use strict'; 27286 27287 Object.defineProperty(exports, '__esModule', { 27288 value: true 27289 }); 27290 27291 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27292 27293 var validate = __webpack_require__(338); 27294 27295 var ProfileAddress = function ProfileAddress(args) { 27296 _classCallCheck(this, ProfileAddress); 27297 27298 console.log('profile_user_address.js loaded'); 27299 27300 // Form validation 27301 var constraints = { 27302 'user_address[family_name]': { 27303 presence: { 27304 message: "å ¥åãã¦ãã ãã" 27305 } 27306 }, 27307 'user_address[first_name]': { 27308 presence: { 27309 message: "å ¥åãã¦ãã ãã" 27310 } 27311 }, 27312 'user_address[family_name_kana]': { 27313 presence: { 27314 message: "å ¥åãã¦ãã ãã" 27315 } 27316 }, 27317 'user_address[first_name_kana]': { 27318 presence: { 27319 message: "å ¥åãã¦ãã ãã" 27320 } 27321 }, 27322 'user_address[postal_code]': { 27323 presence: { 27324 message: "å ¥åãã¦ãã ãã" 27325 } 27326 }, 27327 'user_address[prefecture_id]': { 27328 presence: { 27329 message: "å ¥åãã¦ãã ãã" 27330 } 27331 }, 27332 'user_address[address1]': { 27333 presence: { 27334 message: "å ¥åãã¦ãã ãã" 27335 } 27336 }, 27337 'user_address[phone_number]': { 27338 presence: { 27339 message: "å ¥åãã¦ãã ãã" 27340 } 27341 } 27342 }; 27343 27344 // Hook up the form so we can prevent it from being posted 27345 var form = document.getElementById("profile_address_form"); 27346 form.onsubmit = function (ev) { 27347 ev.preventDefault(); 27348 handleFormSubmit(form); 27349 }; 27350 27351 // Hook up the inputs to validate on the fly 27352 var inputs = document.querySelectorAll("input, textarea, select");
27353 inputs.forEach(function (element) { 27354 element.onchange = function (elem) { 27355 var errors = validate(form, constraints, { fullMessages: false }) || {}; 27356 showErrorsForInput(this, errors[this.name]); 27357 }; 27358 }); 27359 27360 function handleFormSubmit(form, input) { 27361 // validate the form against the constraints 27362 var errors = validate(form, constraints, { fullMessages: false }); 27363 // then we update the form to reflect the results 27364 showErrors(form, errors || {}); 27365 if (!errors) { 27366 showSuccess(); 27367 } 27368 } 27369 27370 // Updates the inputs with the validation errors 27371 function showErrors(form, errors) { 27372 // We loop through all the inputs and show the errors for that input 27373 form.querySelectorAll(".input_validate").forEach(function (input) { 27374 // Since the errors can be null if no errors were found we need to handle that 27375 showErrorsForInput(input, errors && errors[input.name]); 27376 }); 27377 } 27378 27379 // Shows the errors for a specific input 27380 function showErrorsForInput(input, errors) { 27381 // This is the root of the input 27382 var formGroup = closestParent(input.parentNode, "form-group"); 27383 // Find where the error messages will be insert into 27384 var messages = formGroup.querySelector(".error-messages"); 27385 // First we remove any old messages and resets the classes 27386 resetFormGroup(formGroup, messages); 27387 // If we have errors 27388 if (errors) { 27389 // we first mark the group has having errors 27390 formGroup.classList.add("has-error"); 27391 // then we append all the errors 27392 errors.forEach(function (error) { 27393 addError(messages, error); 27394 }); 27395 } else { 27396 // otherwise we simply mark it as success 27397 formGroup.classList.add("has-success"); 27398 } 27399 } 27400 27401 // Recusively finds the closest parent that has the specified class 27402 function closestParent(_x, _x2) { 27403 var _again = true; 27404 27405 _function: while (_again) { 27406 var child = _x, 27407 className = _x2; 27408 _again = false; 27409 27410 if (!child || child == document) { 27411 return null; 27412 } 27413 if (child.classList.contains(className)) { 27414 return child; 27415 } else { 27416 _x = child.parentNode; 27417 _x2 = className; 27418 _again = true; 27419 continue _function; 27420 } 27421 } 27422 } 27423 27424 function resetFormGroup(formGroup, messages) { 27425 // Remove the success and error classes 27426 formGroup.classList.remove("has-error"); 27427 formGroup.classList.remove("has-success"); 27428 messages.classList.remove("show"); 27429 // and remove any old messages 27430 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 27431 // el.parentNode.removeChild(el); 27432 // }); 27433 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 27434 element.parentNode.removeChild(element); 27435 }); 27436 } 27437 27438 // Adds the specified error with the following markup 27439 // <p class="help-block error">[message]</p> 27440 function addError(messages, error) { 27441 var block = document.createElement("p"); 27442 block.classList.add("help-block"); 27443 block.classList.add("error"); 27444 block.innerText = error; 27445 messages.appendChild(block); 27446 messages.classList.add("show"); 27447 } 27448 27449 function showSuccess() { 27450 form.submit(); 27451 } 27452 } 27453 27454 // methods 27455 ; 27456 27457 exports['default'] = ProfileAddress; 27458 module.exports = exports['default']; 27459 27460/***/ }), 27461/* 424 */ 27462/***/ (function(module, exports) { 27463 27464 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 27465 'use strict'; 27466 27467 Object.defineProperty(exports, '__esModule', { 27468 value: true 27469 }); 27470 27471 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; }; })(); 27472 27473 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27474 27475 var Project = (function () { 27476 function Project(args) { 27477 _classCallCheck(this, Project); 27478 27479 // code 27480 console.log('project.js loaded'); 27481 this.initialize(); 27482 } 27483 27484 _createClass(Project, [{ 27485 key: 'initialize', 27486 value: function initialize() {} 27487 27488 // methods 27489 27490 }]); 27491 27492 return Project; 27493 })(); 27494 27495 exports['default'] = Project; 27496 module.exports = exports['default']; 27497 27498/***/ }), 27499/* 425 */ 27500/***/ (function(module, exports, __webpack_require__) { 27501 27502 'use strict'; 27503 27504 Object.defineProperty(exports, '__esModule', { 27505 value: true 27506 }); 27507 27508 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27509 27510 var validate = __webpack_require__(338); 27511 27512 var SignIn = function SignIn(args) { 27513 _classCallCheck(this, SignIn); 27514 27515 console.log('sign_in.js loaded'); 27516 27517 // Form validation 27518 var constraints = { 27519 'user[email]': { 27520 email: { 27521 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 27522 }, 27523 presence: { 27524 message: "å ¥åãã¦ãã ãã" 27525 } 27526 }, 27527 'user[password]': { 27528 presence: { 27529 message: "å ¥åãã¦ãã ãã" 27530 } 27531 } 27532 }; 27533 27534 // Hook up the form so we can prevent it from being posted 27535 var form = document.getElementById("signin_form"); 27536 form.onsubmit = function (ev) { 27537 ev.preventDefault(); 27538 handleFormSubmit(form); 27539 }; 27540 27541 // Hook up the inputs to validate on the fly 27542 var inputs = document.querySelectorAll("input");
27543 inputs.forEach(function (element) { 27544 element.onchange = function (elem) { 27545 var errors = validate(form, constraints, { fullMessages: false }) || {}; 27546 showErrorsForInput(this, errors[this.name]); 27547 }; 27548 }); 27549 27550 function handleFormSubmit(form, input) { 27551 // validate the form against the constraints 27552 var errors = validate(form, constraints, { fullMessages: false }); 27553 // then we update the form to reflect the results 27554 showErrors(form, errors || {}); 27555 if (!errors) { 27556 showSuccess(); 27557 } 27558 } 27559 27560 // Updates the inputs with the validation errors 27561 function showErrors(form, errors) { 27562 // We loop through all the inputs and show the errors for that input 27563 form.querySelectorAll(".input_validate").forEach(function (input) { 27564 // Since the errors can be null if no errors were found we need to handle that 27565 showErrorsForInput(input, errors && errors[input.name]); 27566 }); 27567 } 27568 27569 // Shows the errors for a specific input 27570 function showErrorsForInput(input, errors) { 27571 // This is the root of the input 27572 var formGroup = closestParent(input.parentNode, "form-group"); 27573 // Find where the error messages will be insert into 27574 var messages = formGroup.querySelector(".error-messages"); 27575 // First we remove any old messages and resets the classes 27576 resetFormGroup(formGroup, messages); 27577 // If we have errors 27578 if (errors) { 27579 // we first mark the group has having errors 27580 formGroup.classList.add("has-error"); 27581 // then we append all the errors 27582 errors.forEach(function (error) { 27583 addError(messages, error); 27584 }); 27585 } else { 27586 // otherwise we simply mark it as success 27587 formGroup.classList.add("has-success"); 27588 } 27589 } 27590 27591 // Recusively finds the closest parent that has the specified class 27592 function closestParent(_x, _x2) { 27593 var _again = true; 27594 27595 _function: while (_again) { 27596 var child = _x, 27597 className = _x2; 27598 _again = false; 27599 27600 if (!child || child == document) { 27601 return null; 27602 } 27603 if (child.classList.contains(className)) { 27604 return child; 27605 } else { 27606 _x = child.parentNode; 27607 _x2 = className; 27608 _again = true; 27609 continue _function; 27610 } 27611 } 27612 } 27613 27614 function resetFormGroup(formGroup, messages) { 27615 // Remove the success and error classes 27616 formGroup.classList.remove("has-error"); 27617 formGroup.classList.remove("has-success"); 27618 messages.classList.remove("show"); 27619 // and remove any old messages 27620 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 27621 // el.parentNode.removeChild(el); 27622 // }); 27623 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 27624 element.parentNode.removeChild(element); 27625 }); 27626 } 27627 27628 // Adds the specified error with the following markup 27629 // <p class="help-block error">[message]</p> 27630 function addError(messages, error) { 27631 var block = document.createElement("p"); 27632 block.classList.add("help-block"); 27633 block.classList.add("error"); 27634 block.innerText = error; 27635 messages.appendChild(block); 27636 messages.classList.add("show"); 27637 } 27638 27639 function showSuccess() { 27640 form.submit(); 27641 } 27642 } 27643 27644 // methods 27645 ; 27646 27647 exports['default'] = SignIn; 27648 module.exports = exports['default']; 27649 27650/***/ }), 27651/* 426 */ 27652/***/ (function(module, exports, __webpack_require__) { 27653 27654 'use strict'; 27655 27656 Object.defineProperty(exports, '__esModule', { 27657 value: true 27658 }); 27659 27660 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27661 27662 var validate = __webpack_require__(338); 27663 27664 var SignUp = function SignUp(args) { 27665 _classCallCheck(this, SignUp); 27666 27667 console.log('sign_up.js loaded'); 27668 27669 // Form validation 27670 var constraints = { 27671 'user[email]': { 27672 email: { 27673 message: "æ£ããã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã ãã" 27674 }, 27675 presence: { 27676 message: "å ¥åãã¦ãã ãã" 27677 } 27678 }, 27679 utf8: { 27680 presence: false 27681 }, 27682 authenticity_token: { 27683 presence: false 27684 } 27685 }; 27686 27687 // Hook up the form so we can prevent it from being posted 27688 var form = document.getElementById("signup_form"); 27689 form.onsubmit = function (ev) { 27690 ev.preventDefault(); 27691 handleFormSubmit(form); 27692 }; 27693 27694 // Hook up the inputs to validate on the fly 27695 var inputs = document.querySelectorAll("input");
27696 inputs.forEach(function (element) { 27697 element.onchange = function (elem) { 27698 var errors = validate(form, constraints, { fullMessages: false }) || {}; 27699 showErrorsForInput(this, errors[this.name]); 27700 }; 27701 }); 27702 27703 function handleFormSubmit(form, input) { 27704 // validate the form against the constraints 27705 var errors = validate(form, constraints, { fullMessages: false }); 27706 // then we update the form to reflect the results 27707 showErrors(form, errors || {}); 27708 if (!errors) { 27709 showSuccess(); 27710 } 27711 } 27712 27713 // Updates the inputs with the validation errors 27714 function showErrors(form, errors) { 27715 // We loop through all the inputs and show the errors for that input 27716 form.querySelectorAll("#user_email").forEach(function (input) { 27717 // Since the errors can be null if no errors were found we need to handle that 27718 showErrorsForInput(input, errors && errors[input.name]); 27719 }); 27720 } 27721 27722 // Shows the errors for a specific input 27723 function showErrorsForInput(input, errors) { 27724 // This is the root of the input 27725 var formGroup = closestParent(input.parentNode, "form-group"); 27726 // Find where the error messages will be insert into 27727 var messages = formGroup.querySelector(".error-messages"); 27728 // First we remove any old messages and resets the classes 27729 resetFormGroup(formGroup, messages); 27730 // If we have errors 27731 if (errors) { 27732 // we first mark the group has having errors 27733 formGroup.classList.add("has-error"); 27734 // then we append all the errors 27735 errors.forEach(function (error) { 27736 addError(messages, error); 27737 }); 27738 } else { 27739 // otherwise we simply mark it as success 27740 formGroup.classList.add("has-success"); 27741 } 27742 } 27743 27744 // Recusively finds the closest parent that has the specified class 27745 function closestParent(_x, _x2) { 27746 var _again = true; 27747 27748 _function: while (_again) { 27749 var child = _x, 27750 className = _x2; 27751 _again = false; 27752 27753 if (!child || child == document) { 27754 return null; 27755 } 27756 if (child.classList.contains(className)) { 27757 return child; 27758 } else { 27759 _x = child.parentNode; 27760 _x2 = className; 27761 _again = true; 27762 continue _function; 27763 } 27764 } 27765 } 27766 27767 function resetFormGroup(formGroup, messages) { 27768 // Remove the success and error classes 27769 formGroup.classList.remove("has-error"); 27770 formGroup.classList.remove("has-success"); 27771 messages.classList.remove("show"); 27772 // and remove any old messages 27773 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 27774 // el.parentNode.removeChild(el); 27775 // }); 27776 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 27777 element.parentNode.removeChild(element); 27778 }); 27779 } 27780 27781 // Adds the specified error with the following markup 27782 // <p class="help-block error">[message]</p> 27783 function addError(messages, error) { 27784 var block = document.createElement("p"); 27785 block.classList.add("help-block"); 27786 block.classList.add("error"); 27787 block.innerText = error; 27788 messages.appendChild(block); 27789 messages.classList.add("show"); 27790 } 27791 27792 function showSuccess() { 27793 form.submit(); 27794 } 27795 } 27796 27797 // methods 27798 ; 27799 27800 exports['default'] = SignUp; 27801 module.exports = exports['default']; 27802 27803/***/ }), 27804/* 427 */ 27805/***/ (function(module, exports, __webpack_require__) { 27806 27807 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 27808 // Must use "const" or "var" 27809 'use strict'; 27810 27811 Object.defineProperty(exports, '__esModule', { 27812 value: true 27813 }); 27814 27815 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; }; })(); 27816 27817 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27818 27819 var imagesLoaded = __webpack_require__(344); 27820 var velocity = __webpack_require__(346); 27821 27822 var Index = (function () { 27823 function Index(id) { 27824 var _this = this; 27825 27826 _classCallCheck(this, Index); 27827 27828 this.id = id; 27829 __webpack_require__.e/* nsure */(1/* duplicate */, function () { 27830 _this.initialize(); 27831 }); 27832 } 27833 27834 _createClass(Index, [{ 27835 key: 'initialize', 27836 value: function initialize() { 27837 this.sample_imagesloaded(); 27838 this.sample_message(); 27839 this.sample_velocity(); 27840 } 27841 27842 // methods 27843 }, { 27844 key: 'sample_imagesloaded', 27845 value: function sample_imagesloaded() { 27846 imagesLoaded('#main', function () { 27847 console.log('loaded'); 27848 }); 27849 } 27850 }, { 27851 key: 'sample_message', 27852 value: function sample_message() { 27853 var message = __webpack_require__(347); 27854 console.log(message(this.id + '.js loaded')); 27855 } 27856 }, { 27857 key: 'sample_velocity', 27858 value: function sample_velocity() { 27859 var $article = $('.m-list-article'); 27860 $article.on('mouseenter', function (e) { 27861 var $el = $(e.currentTarget).find('img'); 27862 $el.velocity({ 27863 // 'scale': 1.1 27864 }, { 27865 easing: 'easeOutQuart', 27866 duration: 500 27867 }); 27868 }); 27869 $article.on('mouseleave', function (e) { 27870 var $el = $(e.currentTarget).find('img'); 27871 $el.velocity({ 27872 'scale': 1 27873 }, { 27874 easing: 'easeOutQuart', 27875 duration: 500 27876 }); 27877 }); 27878 } 27879 }]); 27880 27881 return Index; 27882 })(); 27883 27884 exports['default'] = Index; 27885 module.exports = exports['default']; 27886 27887/***/ }), 27888/* 428 */
27889/***/ (function(module, exports) { 27890 27891 'use strict'; 27892 27893 Object.defineProperty(exports, '__esModule', { 27894 value: true 27895 }); 27896 27897 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27898 27899 var Trust = function Trust(args) { 27900 _classCallCheck(this, Trust); 27901 27902 // code 27903 console.log('trust.js loaded'); 27904 } 27905 27906 // methods 27907 ; 27908 27909 exports['default'] = Trust; 27910 module.exports = exports['default']; 27911 27912/***/ }), 27913/* 429 */ 27914/***/ (function(module, exports) { 27915 27916 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 27917 27918 'use strict'; 27919 27920 Object.defineProperty(exports, '__esModule', { 27921 value: true 27922 }); 27923 27924 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27925 27926 var Withdrawal1 = function Withdrawal1(args) { 27927 _classCallCheck(this, Withdrawal1); 27928 27929 // code 27930 console.log('withdrawal_first.js loaded'); 27931 } 27932 27933 // methods 27934 ; 27935 27936 exports['default'] = Withdrawal1; 27937 module.exports = exports['default']; 27938 27939/***/ }), 27940/* 430 */ 27941/***/ (function(module, exports) { 27942 27943 // ãã¼ã¸ãã¨ã«èªã¿è¾¼ã¾ãããã¡ã¤ã« 27944 27945 'use strict'; 27946 27947 Object.defineProperty(exports, '__esModule', { 27948 value: true 27949 }); 27950 27951 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27952 27953 var Withdrawal2 = function Withdrawal2(args) { 27954 _classCallCheck(this, Withdrawal2); 27955 27956 // code 27957 console.log('withdrawal_second.js loaded'); 27958 } 27959 27960 // methods 27961 ; 27962 27963 exports['default'] = Withdrawal2; 27964 module.exports = exports['default']; 27965 27966/***/ }), 27967/* 431 */ 27968/***/ (function(module, exports, __webpack_require__) { 27969 27970 'use strict'; 27971 27972 Object.defineProperty(exports, '__esModule', { 27973 value: true 27974 }); 27975 27976 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 27977 27978 var validate = __webpack_require__(338); 27979 27980 var Withdrawal3 = function Withdrawal3(args) { 27981 _classCallCheck(this, Withdrawal3); 27982 27983 console.log('withdrawal_validation.js loaded'); 27984 27985 document.getElementById('withdrawal_reason').onkeyup = function () { 27986 document.getElementById('withdrawal_reason_count').innerHTML = 200 - this.value.length + "/200"; 27987 }; 27988 27989 // Form validation 27990 var constraints = { 27991 'withdrawal[comment]': { 27992 length: { 27993 maximum: 200, 27994 message: '200æå以å ã§å ¥åãã ãã' 27995 }, 27996 presence: { 27997 message: "å ¥åãã¦ãã ãã" 27998 } 27999 }, 28000 'withdrawal[agree]': { 28001 presence: { 28002 message: "å ¥åãã¦ãã ãã" 28003 } 28004 } 28005 }; 28006 28007 // Hook up the form so we can prevent it from being posted 28008 var form = document.getElementById("withrawal_form"); 28009 form.onsubmit = function (ev) { 28010 ev.preventDefault(); 28011 handleFormSubmit(form); 28012 }; 28013 28014 var acceptConditions = document.getElementById("accept_condition"); 28015 28016 // Hook up the inputs to validate on the fly 28017 var inputs = document.querySelectorAll("input, textarea, select"); 28018 inputs.forEach(function (element) { 28019 element.onchange = function (elem) { 28020 if (acceptConditions.checked) { 28021 acceptConditions.value = true; 28022 } else { 28023 acceptConditions.value = false; 28024 } 28025 var errors = validate(form, constraints, { fullMessages: false }) || {}; 28026 showErrorsForInput(this, errors[this.name]); 28027 }; 28028 }); 28029 28030 function handleFormSubmit(form, input) { 28031 // validate the form against the constraints 28032 var errors = validate(form, constraints, { fullMessages: false }); 28033 28034 // then we update the form to reflect the results 28035 showErrors(form, errors || {}); 28036 if (!errors) { 28037 showSuccess(); 28038 } 28039 } 28040 28041 // Updates the inputs with the validation errors 28042 function showErrors(form, errors) { 28043 // We loop through all the inputs and show the errors for that input 28044 form.querySelectorAll(".input_validate").forEach(function (input) { 28045 // Since the errors can be null if no errors were found we need to handle that 28046 showErrorsForInput(input, errors && errors[input.name]); 28047 }); 28048 } 28049 28050 // Shows the errors for a specific input 28051 function showErrorsForInput(input, errors) { 28052 // This is the root of the input 28053 var formGroup = closestParent(input.parentNode, "form-group"); 28054 // Find where the error messages will be insert into 28055 var messages = formGroup.querySelector(".error-messages"); 28056 // First we remove any old messages and resets the classes 28057 resetFormGroup(formGroup, messages); 28058 // If we have errors 28059 if (errors) { 28060 // we first mark the group has having errors 28061 formGroup.classList.add("has-error"); 28062 // then we append all the errors
28063 errors.forEach(function (error) { 28064 addError(messages, error); 28065 }); 28066 } else { 28067 // otherwise we simply mark it as success 28068 formGroup.classList.add("has-success"); 28069 } 28070 } 28071 28072 // Recusively finds the closest parent that has the specified class 28073 function closestParent(_x, _x2) { 28074 var _again = true; 28075 28076 _function: while (_again) { 28077 var child = _x, 28078 className = _x2; 28079 _again = false; 28080 28081 if (!child || child == document) { 28082 return null; 28083 } 28084 if (child.classList.contains(className)) { 28085 return child; 28086 } else { 28087 _x = child.parentNode; 28088 _x2 = className; 28089 _again = true; 28090 continue _function; 28091 } 28092 } 28093 } 28094 28095 function resetFormGroup(formGroup, messages) { 28096 // Remove the success and error classes 28097 formGroup.classList.remove("has-error"); 28098 formGroup.classList.remove("has-success"); 28099 messages.classList.remove("show"); 28100 // and remove any old messages 28101 // _.each(formGroup.querySelectorAll(".help-block.error"), function(el) { 28102 // el.parentNode.removeChild(el); 28103 // }); 28104 formGroup.querySelectorAll(".help-block.error").forEach(function (element) { 28105 element.parentNode.removeChild(element); 28106 }); 28107 } 28108 28109 // Adds the specified error with the following markup 28110 // <p class="help-block error">[message]</p> 28111 function addError(messages, error) { 28112 var block = document.createElement("p"); 28113 block.classList.add("help-block"); 28114 block.classList.add("error"); 28115 block.innerText = error; 28116 messages.appendChild(block); 28117 messages.classList.add("show"); 28118 } 28119 28120 function showSuccess() { 28121 form.submit(); 28122 } 28123 } 28124 28125 // methods 28126 ; 28127 28128 exports['default'] = Withdrawal3; 28129 module.exports = exports['default']; 28130 28131/***/ }), 28132/* 432 */ 28133/***/ (function(module, exports, __webpack_require__) { 28134 28135 var __WEBPACK_AMD_DEFINE_RESULT__;// Device.js 28136 // (c) 2014 Matthew Hudson 28137 // Device.js is freely distributable under the MIT license. 28138 // For all details and documentation: 28139 // http://matthewhudson.me/projects/device.js/ 28140 28141 (function() { 28142 28143 var device, 28144 previousDevice, 28145 addClass, 28146 documentElement, 28147 find, 28148 handleOrientation, 28149 hasClass, 28150 orientationEvent, 28151 removeClass, 28152 userAgent; 28153 28154 // Save the previous value of the device variable. 28155 previousDevice = window.device; 28156 28157 device = {}; 28158 28159 // Add device as a global object. 28160 window.device = device; 28161 28162 // The <html> element. 28163 documentElement = window.document.documentElement; 28164 28165 // The client user agent string. 28166 // Lowercase, so we can use the more efficient indexOf(), instead of Regex 28167 userAgent = window.navigator.userAgent.toLowerCase(); 28168 28169 // Main functions 28170 // -------------- 28171 28172 device.ios = function () { 28173 return device.iphone() || device.ipod() || device.ipad(); 28174 }; 28175 28176 device.iphone = function () { 28177 return !device.windows() && find('iphone'); 28178 }; 28179 28180 device.ipod = function () { 28181 return find('ipod'); 28182 }; 28183 28184 device.ipad = function () { 28185 return find('ipad'); 28186 }; 28187 28188 device.android = function () { 28189 return !device.windows() && find('android'); 28190 }; 28191 28192 device.androidPhone = function () { 28193 return device.android() && find('mobile'); 28194 }; 28195 28196 device.androidTablet = function () { 28197 return device.android() && !find('mobile'); 28198 }; 28199 28200 device.blackberry = function () { 28201 return find('blackberry') || find('bb10') || find('rim'); 28202 }; 28203 28204 device.blackberryPhone = function () { 28205 return device.blackberry() && !find('tablet'); 28206 }; 28207 28208 device.blackberryTablet = function () { 28209 return device.blackberry() && find('tablet'); 28210 }; 28211 28212 device.windows = function () { 28213 return find('windows'); 28214 }; 28215 28216 device.windowsPhone = function () { 28217 return device.windows() && find('phone'); 28218 }; 28219 28220 device.windowsTablet = function () { 28221 return device.windows() && (find('touch') && !device.windowsPhone()); 28222 }; 28223 28224 device.fxos = function () { 28225 return (find('(mobile;') || find('(tablet;')) && find('; rv:'); 28226 }; 28227 28228 device.fxosPhone = function () { 28229 return device.fxos() && find('mobile'); 28230 }; 28231 28232 device.fxosTablet = function () { 28233 return device.fxos() && find('tablet'); 28234 }; 28235 28236 device.meego = function () { 28237 return find('meego'); 28238 }; 28239 28240 device.cordova = function () { 28241 return window.cordova && location.protocol === 'file:'; 28242 }; 28243 28244 device.nodeWebkit = function () { 28245 return typeof window.process === 'object'; 28246 }; 28247 28248 device.mobile = function () { 28249 return device.androidPhone() || device.iphone() || device.ipod() || device.windowsPhone() || device.blackberryPhone() || device.fxosPhone() || device.meego(); 28250 }; 28251 28252 device.tablet = function () { 28253 return device.ipad() || device.androidTablet() || device.blackberryTablet() || device.windowsTablet() || device.fxosTablet(); 28254 }; 28255 28256 device.desktop = function () { 28257 return !device.tablet() && !device.mobile(); 28258 }; 28259 28260 device.television = function() { 28261 var i, tvString; 28262 28263 television = [ 28264 "googletv", 28265 "viera", 28266 "smarttv", 28267 "internet.tv", 28268 "netcast", 28269 "nettv", 28270 "appletv", 28271 "boxee", 28272 "kylo", 28273 "roku", 28274 "dlnadoc", 28275 "roku", 28276 "pov_tv", 28277 "hbbtv", 28278 "ce-html" 28279 ]; 28280 28281 i = 0; 28282 while (i < television.length) { 28283 if (find(television[i])) { 28284 return true; 28285 } 28286 i++; 28287 } 28288 return false;
28289 }; 28290 28291 device.portrait = function () { 28292 return (window.innerHeight / window.innerWidth) > 1; 28293 }; 28294 28295 device.landscape = function () { 28296 return (window.innerHeight / window.innerWidth) < 1; 28297 }; 28298 28299 // Public Utility Functions 28300 // ------------------------ 28301 28302 // Run device.js in noConflict mode, 28303 // returning the device variable to its previous owner. 28304 device.noConflict = function () { 28305 window.device = previousDevice; 28306 return this; 28307 }; 28308 28309 // Private Utility Functions 28310 // ------------------------- 28311 28312 // Simple UA string search 28313 find = function (needle) { 28314 return userAgent.indexOf(needle) !== -1; 28315 }; 28316 28317 // Check if documentElement already has a given class. 28318 hasClass = function (className) { 28319 var regex; 28320 regex = new RegExp(className, 'i'); 28321 return documentElement.className.match(regex); 28322 }; 28323 28324 // Add one or more CSS classes to the <html> element. 28325 addClass = function (className) { 28326 var currentClassNames = null; 28327 if (!hasClass(className)) { 28328 currentClassNames = documentElement.className.replace(/^\s+|\s+$/g, ''); 28329 documentElement.className = currentClassNames + " " + className; 28330 } 28331 }; 28332 28333 // Remove single CSS class from the <html> element. 28334 removeClass = function (className) { 28335 if (hasClass(className)) { 28336 documentElement.className = documentElement.className.replace(" " + className, ""); 28337 } 28338 }; 28339 28340 // HTML Element Handling 28341 // --------------------- 28342 28343 // Insert the appropriate CSS class based on the _user_agent. 28344 28345 if (device.ios()) { 28346 if (device.ipad()) { 28347 addClass("ios ipad tablet"); 28348 } else if (device.iphone()) { 28349 addClass("ios iphone mobile"); 28350 } else if (device.ipod()) { 28351 addClass("ios ipod mobile"); 28352 } 28353 } else if (device.android()) { 28354 if (device.androidTablet()) { 28355 addClass("android tablet"); 28356 } else { 28357 addClass("android mobile"); 28358 } 28359 } else if (device.blackberry()) { 28360 if (device.blackberryTablet()) { 28361 addClass("blackberry tablet"); 28362 } else { 28363 addClass("blackberry mobile"); 28364 } 28365 } else if (device.windows()) { 28366 if (device.windowsTablet()) { 28367 addClass("windows tablet"); 28368 } else if (device.windowsPhone()) { 28369 addClass("windows mobile"); 28370 } else { 28371 addClass("desktop"); 28372 } 28373 } else if (device.fxos()) { 28374 if (device.fxosTablet()) { 28375 addClass("fxos tablet"); 28376 } else { 28377 addClass("fxos mobile"); 28378 } 28379 } else if (device.meego()) { 28380 addClass("meego mobile"); 28381 } else if (device.nodeWebkit()) { 28382 addClass("node-webkit"); 28383 } else if (device.television()) { 28384 addClass("television"); 28385 } else if (device.desktop()) { 28386 addClass("desktop"); 28387 } 28388 28389 if (device.cordova()) { 28390 addClass("cordova"); 28391 } 28392 28393 // Orientation Handling 28394 // -------------------- 28395 28396 // Handle device orientation changes. 28397 handleOrientation = function () { 28398 if (device.landscape()) { 28399 removeClass("portrait"); 28400 addClass("landscape"); 28401 } else { 28402 removeClass("landscape"); 28403 addClass("portrait"); 28404 } 28405 return; 28406 }; 28407 28408 // Detect whether device supports orientationchange event, 28409 // otherwise fall back to the resize event. 28410 if (Object.prototype.hasOwnProperty.call(window, "onorientationchange")) { 28411 orientationEvent = "orientationchange"; 28412 } else { 28413 orientationEvent = "resize"; 28414 } 28415 28416 // Listen for changes in orientation. 28417 if (window.addEventListener) { 28418 window.addEventListener(orientationEvent, handleOrientation, false); 28419 } else if (window.attachEvent) { 28420 window.attachEvent(orientationEvent, handleOrientation); 28421 } else { 28422 window[orientationEvent] = handleOrientation; 28423 } 28424 28425 handleOrientation(); 28426 28427 if (true) { 28428 !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { 28429 return device; 28430 }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 28431 } else if (typeof module !== 'undefined' && module.exports) { 28432 module.exports = device; 28433 } else { 28434 window.device = device; 28435 } 28436 28437 }).call(this); 28438 28439 28440/***/ }), 28441/* 433 */
vendor: 92,752 bytes, lines 28442-31862
28442/***/ (function(module, exports) { 28443 28444 /** 28445 * Owl Carousel v2.3.4 28446 * Copyright 2013-2018 David Deutsch 28447 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE 28448 */ 28449 /** 28450 * Owl carousel 28451 * @version 2.3.4 28452 * @author Bartosz Wojciechowski 28453 * @author David Deutsch 28454 * @license The MIT License (MIT) 28455 * @todo Lazy Load Icon 28456 * @todo prevent animationend bubling 28457 * @todo itemsScaleUp 28458 * @todo Test Zepto 28459 * @todo stagePadding calculate wrong active classes 28460 */ 28461 ;(function($, window, document, undefined) { 28462 28463 /** 28464 * Creates a carousel. 28465 * @class The Owl Carousel. 28466 * @public 28467 * @param {HTMLElement|jQuery} element - The element to create the carousel for. 28468 * @param {Object} [options] - The options 28469 */ 28470 function Owl(element, options) { 28471 28472 /** 28473 * Current settings for the carousel. 28474 * @public 28475 */ 28476 this.settings = null; 28477 28478 /** 28479 * Current options set by the caller including defaults. 28480 * @public 28481 */ 28482 this.options = $.extend({}, Owl.Defaults, options); 28483 28484 /** 28485 * Plugin element. 28486 * @public 28487 */ 28488 this.$element = $(element); 28489 28490 /** 28491 * Proxied event handlers. 28492 * @protected 28493 */ 28494 this._handlers = {}; 28495 28496 /** 28497 * References to the running plugins of this carousel. 28498 * @protected 28499 */ 28500 this._plugins = {}; 28501 28502 /** 28503 * Currently suppressed events to prevent them from being retriggered. 28504 * @protected 28505 */ 28506 this._supress = {}; 28507 28508 /** 28509 * Absolute current position. 28510 * @protected 28511 */ 28512 this._current = null; 28513 28514 /** 28515 * Animation speed in milliseconds. 28516 * @protected 28517 */ 28518 this._speed = null; 28519 28520 /** 28521 * Coordinates of all items in pixel. 28522 * @todo The name of this member is missleading. 28523 * @protected 28524 */ 28525 this._coordinates = []; 28526 28527 /** 28528 * Current breakpoint. 28529 * @todo Real media queries would be nice. 28530 * @protected 28531 */ 28532 this._breakpoint = null; 28533 28534 /** 28535 * Current width of the plugin element. 28536 */ 28537 this._width = null; 28538 28539 /** 28540 * All real items. 28541 * @protected 28542 */ 28543 this._items = []; 28544 28545 /** 28546 * All cloned items. 28547 * @protected 28548 */ 28549 this._clones = []; 28550 28551 /** 28552 * Merge values of all items. 28553 * @todo Maybe this could be part of a plugin. 28554 * @protected 28555 */ 28556 this._mergers = []; 28557 28558 /** 28559 * Widths of all items. 28560 */ 28561 this._widths = []; 28562 28563 /** 28564 * Invalidated parts within the update process. 28565 * @protected 28566 */ 28567 this._invalidated = {}; 28568 28569 /** 28570 * Ordered list of workers for the update process. 28571 * @protected 28572 */ 28573 this._pipe = []; 28574 28575 /** 28576 * Current state information for the drag operation. 28577 * @todo #261 28578 * @protected 28579 */ 28580 this._drag = { 28581 time: null, 28582 target: null, 28583 pointer: null, 28584 stage: { 28585 start: null, 28586 current: null 28587 }, 28588 direction: null 28589 }; 28590 28591 /** 28592 * Current state information and their tags. 28593 * @type {Object} 28594 * @protected 28595 */ 28596 this._states = { 28597 current: {}, 28598 tags: { 28599 'initializing': [ 'busy' ], 28600 'animating': [ 'busy' ], 28601 'dragging': [ 'interacting' ] 28602 } 28603 }; 28604 28605 $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) { 28606 this._handlers[handler] = $.proxy(this[handler], this); 28607 }, this)); 28608 28609 $.each(Owl.Plugins, $.proxy(function(key, plugin) { 28610 this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] 28611 = new plugin(this); 28612 }, this)); 28613 28614 $.each(Owl.Workers, $.proxy(function(priority, worker) { 28615 this._pipe.push({ 28616 'filter': worker.filter, 28617 'run': $.proxy(worker.run, this) 28618 }); 28619 }, this)); 28620 28621 this.setup(); 28622 this.initialize(); 28623 } 28624 28625 /** 28626 * Default options for the carousel. 28627 * @public 28628 */ 28629 Owl.Defaults = { 28630 items: 3, 28631 loop: false, 28632 center: false, 28633 rewind: false, 28634 checkVisibility: true, 28635 28636 mouseDrag: true, 28637 touchDrag: true, 28638 pullDrag: true, 28639 freeDrag: false, 28640 28641 margin: 0, 28642 stagePadding: 0, 28643 28644 merge: false, 28645 mergeFit: true, 28646 autoWidth: false, 28647 28648 startPosition: 0, 28649 rtl: false, 28650 28651 smartSpeed: 250, 28652 fluidSpeed: false, 28653 dragEndSpeed: false, 28654 28655 responsive: {}, 28656 responsiveRefreshRate: 200, 28657 responsiveBaseElement: window, 28658 28659 fallbackEasing: 'swing', 28660 slideTransition: '', 28661 28662 info: false, 28663 28664 nestedItemSelector: false, 28665 itemElement: 'div', 28666 stageElement: 'div', 28667 28668 refreshClass: 'owl-refresh', 28669 loadedClass: 'owl-loaded', 28670 loadingClass: 'owl-loading', 28671 rtlClass: 'owl-rtl', 28672 responsiveClass: 'owl-responsive', 28673 dragClass: 'owl-drag', 28674 itemClass: 'owl-item', 28675 stageClass: 'owl-stage', 28676 stageOuterClass: 'owl-stage-outer', 28677 grabClass: 'owl-grab' 28678 }; 28679 28680 /** 28681 * Enumeration for width. 28682 * @public 28683 * @readonly 28684 * @enum {String} 28685 */ 28686 Owl.Width = { 28687 Default: 'default', 28688 Inner: 'inner', 28689 Outer: 'outer' 28690 }; 28691 28692 /** 28693 * Enumeration for types. 28694 * @public 28695 * @readonly 28696 * @enum {String} 28697 */ 28698 Owl.Type = { 28699 Event: 'event', 28700 State: 'state' 28701 }; 28702 28703 /** 28704 * Contains all registered plugins. 28705 * @public 28706 */ 28707 Owl.Plugins = {}; 28708 28709 /** 28710 * List of workers involved in the update process. 28711 */ 28712 Owl.Workers = [ { 28713 filter: [ 'width', 'settings' ], 28714 run: function() { 28715 this._width = this.$element.width(); 28716 } 28717 }, { 28718 filter: [ 'width', 'items', 'settings' ], 28719 run: function(cache) { 28720 cache.current = this._items && this._items[this.relative(this._current)]; 28721 } 28722 }, { 28723 filter: [ 'items', 'settings' ], 28724 run: function() { 28725 this.$stage.children('.cloned').remove(); 28726 } 28727 }, { 28728 filter: [ 'width', 'items', 'settings' ], 28729 run: function(cache) { 28730 var margin = this.settings.margin || '', 28731 grid = !this.settings.autoWidth, 28732 rtl = this.settings.rtl, 28733 css = { 28734 'width': 'auto', 28735 'margin-left': rtl ? margin : '', 28736 'margin-right': rtl ? '' : margin 28737 }; 28738 28739 !grid && this.$stage.children().css(css); 28740 28741 cache.css = css; 28742 } 28743 }, { 28744 filter: [ 'width', 'items', 'settings' ], 28745 run: function(cache) { 28746 var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, 28747 merge = null, 28748 iterator = this._items.length, 28749 grid = !this.settings.autoWidth, 28750 widths = []; 28751 28752 cache.items = { 28753 merge: false, 28754 width: width 28755 }; 28756 28757 while (iterator--) { 28758 merge = this._mergers[iterator]; 28759 merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; 28760 28761 cache.items.merge = merge > 1 || cache.items.merge; 28762 28763 widths[iterator] = !grid ? this._items[iterator].width() : width * merge; 28764 } 28765 28766 this._widths = widths; 28767 } 28768 }, { 28769 filter: [ 'items', 'settings' ], 28770 run: function() { 28771 var clones = [], 28772 items = this._items, 28773 settings = this.settings, 28774 // TODO: Should be computed from number of min width items in stage 28775 view = Math.max(settings.items * 2, 4), 28776 size = Math.ceil(items.length / 2) * 2, 28777 repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0, 28778 append = '', 28779 prepend = ''; 28780 28781 repeat /= 2; 28782 28783 while (repeat > 0) { 28784 // Switch to only using appended clones 28785 clones.push(this.normalize(clones.length / 2, true)); 28786 append = append + items[clones[clones.length - 1]][0].outerHTML; 28787 clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); 28788 prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; 28789 repeat -= 1; 28790 } 28791 28792 this._clones = clones; 28793 28794 $(append).addClass('cloned').appendTo(this.$stage); 28795 $(prepend).addClass('cloned').prependTo(this.$stage); 28796 } 28797 }, { 28798 filter: [ 'width', 'items', 'settings' ], 28799 run: function() { 28800 var rtl = this.settings.rtl ? 1 : -1, 28801 size = this._clones.length + this._items.length, 28802 iterator = -1, 28803 previous = 0, 28804 current = 0, 28805 coordinates = []; 28806 28807 while (++iterator < size) { 28808 previous = coordinates[iterator - 1] || 0; 28809 current = this._widths[this.relative(iterator)] + this.settings.margin; 28810 coordinates.push(previous + current * rtl); 28811 } 28812 28813 this._coordinates = coordinates; 28814 } 28815 }, { 28816 filter: [ 'width', 'items', 'settings' ], 28817 run: function() { 28818 var padding = this.settings.stagePadding, 28819 coordinates = this._coordinates, 28820 css = { 28821 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 28822 'padding-left': padding || '', 28823 'padding-right': padding || '' 28824 }; 28825 28826 this.$stage.css(css); 28827 } 28828 }, { 28829 filter: [ 'width', 'items', 'settings' ], 28830 run: function(cache) { 28831 var iterator = this._coordinates.length, 28832 grid = !this.settings.autoWidth, 28833 items = this.$stage.children(); 28834 28835 if (grid && cache.items.merge) { 28836 while (iterator--) { 28837 cache.css.width = this._widths[this.relative(iterator)]; 28838 items.eq(iterator).css(cache.css); 28839 } 28840 } else if (grid) { 28841 cache.css.width = cache.items.width; 28842 items.css(cache.css); 28843 } 28844 } 28845 }, { 28846 filter: [ 'items' ], 28847 run: function() { 28848 this._coordinates.length < 1 && this.$stage.removeAttr('style'); 28849 } 28850 }, { 28851 filter: [ 'width', 'items', 'settings' ], 28852 run: function(cache) { 28853 cache.current = cache.current ? this.$stage.children().index(cache.current) : 0; 28854 cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current)); 28855 this.reset(cache.current); 28856 } 28857 }, { 28858 filter: [ 'position' ], 28859 run: function() { 28860 this.animate(this.coordinates(this._current)); 28861 } 28862 }, { 28863 filter: [ 'width', 'position', 'items', 'settings' ], 28864 run: function() { 28865 var rtl = this.settings.rtl ? 1 : -1, 28866 padding = this.settings.stagePadding * 2, 28867 begin = this.coordinates(this.current()) + padding, 28868 end = begin + this.width() * rtl, 28869 inner, outer, matches = [], i, n; 28870 28871 for (i = 0, n = this._coordinates.length; i < n; i++) { 28872 inner = this._coordinates[i - 1] || 0; 28873 outer = Math.abs(this._coordinates[i]) + padding * rtl; 28874 28875 if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) 28876 || (this.op(outer, '<', begin) && this.op(outer, '>', end))) { 28877 matches.push(i); 28878 } 28879 } 28880 28881 this.$stage.children('.active').removeClass('active'); 28882 this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active'); 28883 28884 this.$stage.children('.center').removeClass('center'); 28885 if (this.settings.center) { 28886 this.$stage.children().eq(this.current()).addClass('center'); 28887 } 28888 } 28889 } ]; 28890 28891 /** 28892 * Create the stage DOM element 28893 */ 28894 Owl.prototype.initializeStage = function() { 28895 this.$stage = this.$element.find('.' + this.settings.stageClass); 28896 28897 // if the stage is already in the DOM, grab it and skip stage initialization 28898 if (this.$stage.length) { 28899 return; 28900 } 28901 28902 this.$element.addClass(this.options.loadingClass); 28903 28904 // create stage 28905 this.$stage = $('<' + this.settings.stageElement + '>', { 28906 "class": this.settings.stageClass 28907 }).wrap( $( '<div/>', { 28908 "class": this.settings.stageOuterClass 28909 })); 28910 28911 // append stage 28912 this.$element.append(this.$stage.parent()); 28913 }; 28914 28915 /** 28916 * Create item DOM elements 28917 */ 28918 Owl.prototype.initializeItems = function() { 28919 var $items = this.$element.find('.owl-item'); 28920 28921 // if the items are already in the DOM, grab them and skip item initialization 28922 if ($items.length) { 28923 this._items = $items.get().map(function(item) { 28924 return $(item); 28925 }); 28926 28927 this._mergers = this._items.map(function() { 28928 return 1; 28929 }); 28930 28931 this.refresh(); 28932 28933 return; 28934 } 28935 28936 // append content 28937 this.replace(this.$element.children().not(this.$stage.parent())); 28938 28939 // check visibility 28940 if (this.isVisible()) { 28941 // update view 28942 this.refresh(); 28943 } else { 28944 // invalidate width 28945 this.invalidate('width'); 28946 } 28947 28948 this.$element 28949 .removeClass(this.options.loadingClass) 28950 .addClass(this.options.loadedClass); 28951 }; 28952 28953 /** 28954 * Initializes the carousel. 28955 * @protected 28956 */ 28957 Owl.prototype.initialize = function() { 28958 this.enter('initializing'); 28959 this.trigger('initialize'); 28960 28961 this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); 28962 28963 if (this.settings.autoWidth && !this.is('pre-loading')) { 28964 var imgs, nestedSelector, width; 28965 imgs = this.$element.find('img'); 28966 nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined; 28967 width = this.$element.children(nestedSelector).width(); 28968 28969 if (imgs.length && width <= 0) { 28970 this.preloadAutoWidthImages(imgs); 28971 } 28972 } 28973 28974 this.initializeStage(); 28975 this.initializeItems(); 28976 28977 // register event handlers 28978 this.registerEventHandlers(); 28979 28980 this.leave('initializing'); 28981 this.trigger('initialized'); 28982 }; 28983 28984 /** 28985 * @returns {Boolean} visibility of $element 28986 * if you know the carousel will always be visible you can set `checkVisibility` to `false` to 28987 * prevent the expensive browser layout forced reflow the $element.is(':visible') does 28988 */ 28989 Owl.prototype.isVisible = function() { 28990 return this.settings.checkVisibility 28991 ? this.$element.is(':visible') 28992 : true; 28993 }; 28994 28995 /** 28996 * Setups the current settings. 28997 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8? 28998 * @todo Support for media queries by using `matchMedia` would be nice. 28999 * @public 29000 */ 29001 Owl.prototype.setup = function() { 29002 var viewport = this.viewport(), 29003 overwrites = this.options.responsive, 29004 match = -1, 29005 settings = null; 29006 29007 if (!overwrites) { 29008 settings = $.extend({}, this.options); 29009 } else { 29010 $.each(overwrites, function(breakpoint) { 29011 if (breakpoint <= viewport && breakpoint > match) { 29012 match = Number(breakpoint); 29013 } 29014 }); 29015 29016 settings = $.extend({}, this.options, overwrites[match]); 29017 if (typeof settings.stagePadding === 'function') { 29018 settings.stagePadding = settings.stagePadding(); 29019 } 29020 delete settings.responsive; 29021 29022 // responsive class 29023 if (settings.responsiveClass) { 29024 this.$element.attr('class', 29025 this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match) 29026 ); 29027 } 29028 } 29029 29030 this.trigger('change', { property: { name: 'settings', value: settings } }); 29031 this._breakpoint = match; 29032 this.settings = settings; 29033 this.invalidate('settings'); 29034 this.trigger('changed', { property: { name: 'settings', value: this.settings } }); 29035 }; 29036 29037 /** 29038 * Updates option logic if necessery. 29039 * @protected 29040 */ 29041 Owl.prototype.optionsLogic = function() { 29042 if (this.settings.autoWidth) { 29043 this.settings.stagePadding = false; 29044 this.settings.merge = false; 29045 } 29046 }; 29047 29048 /** 29049 * Prepares an item before add. 29050 * @todo Rename event parameter `content` to `item`. 29051 * @protected 29052 * @returns {jQuery|HTMLElement} - The item container. 29053 */ 29054 Owl.prototype.prepare = function(item) { 29055 var event = this.trigger('prepare', { content: item }); 29056 29057 if (!event.data) { 29058 event.data = $('<' + this.settings.itemElement + '/>') 29059 .addClass(this.options.itemClass).append(item) 29060 } 29061 29062 this.trigger('prepared', { content: event.data }); 29063 29064 return event.data; 29065 }; 29066 29067 /** 29068 * Updates the view. 29069 * @public 29070 */ 29071 Owl.prototype.update = function() { 29072 var i = 0, 29073 n = this._pipe.length, 29074 filter = $.proxy(function(p) { return this[p] }, this._invalidated), 29075 cache = {}; 29076 29077 while (i < n) { 29078 if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { 29079 this._pipe[i].run(cache); 29080 } 29081 i++; 29082 } 29083 29084 this._invalidated = {}; 29085 29086 !this.is('valid') && this.enter('valid'); 29087 }; 29088 29089 /** 29090 * Gets the width of the view. 29091 * @public 29092 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return. 29093 * @returns {Number} - The width of the view in pixel. 29094 */ 29095 Owl.prototype.width = function(dimension) { 29096 dimension = dimension || Owl.Width.Default; 29097 switch (dimension) { 29098 case Owl.Width.Inner: 29099 case Owl.Width.Outer: 29100 return this._width; 29101 default: 29102 return this._width - this.settings.stagePadding * 2 + this.settings.margin; 29103 } 29104 }; 29105 29106 /** 29107 * Refreshes the carousel primarily for adaptive purposes. 29108 * @public 29109 */ 29110 Owl.prototype.refresh = function() { 29111 this.enter('refreshing'); 29112 this.trigger('refresh'); 29113 29114 this.setup(); 29115 29116 this.optionsLogic(); 29117 29118 this.$element.addClass(this.options.refreshClass); 29119 29120 this.update(); 29121 29122 this.$element.removeClass(this.options.refreshClass); 29123 29124 this.leave('refreshing'); 29125 this.trigger('refreshed'); 29126 }; 29127 29128 /** 29129 * Checks window `resize` event. 29130 * @protected 29131 */ 29132 Owl.prototype.onThrottledResize = function() { 29133 window.clearTimeout(this.resizeTimer); 29134 this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); 29135 }; 29136 29137 /** 29138 * Checks window `resize` event. 29139 * @protected 29140 */ 29141 Owl.prototype.onResize = function() { 29142 if (!this._items.length) { 29143 return false; 29144 } 29145 29146 if (this._width === this.$element.width()) { 29147 return false; 29148 } 29149 29150 if (!this.isVisible()) { 29151 return false; 29152 } 29153 29154 this.enter('resizing'); 29155 29156 if (this.trigger('resize').isDefaultPrevented()) { 29157 this.leave('resizing'); 29158 return false; 29159 } 29160 29161 this.invalidate('width'); 29162 29163 this.refresh(); 29164 29165 this.leave('resizing'); 29166 this.trigger('resized'); 29167 }; 29168 29169 /** 29170 * Registers event handlers. 29171 * @todo Check `msPointerEnabled` 29172 * @todo #261 29173 * @protected 29174 */ 29175 Owl.prototype.registerEventHandlers = function() { 29176 if ($.support.transition) { 29177 this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this)); 29178 } 29179 29180 if (this.settings.responsive !== false) { 29181 this.on(window, 'resize', this._handlers.onThrottledResize); 29182 } 29183 29184 if (this.settings.mouseDrag) { 29185 this.$element.addClass(this.options.dragClass); 29186 this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this)); 29187 this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false }); 29188 } 29189 29190 if (this.settings.touchDrag){ 29191 this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this)); 29192 this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this)); 29193 } 29194 }; 29195 29196 /** 29197 * Handles `touchstart` and `mousedown` events. 29198 * @todo Horizontal swipe threshold as option 29199 * @todo #261 29200 * @protected 29201 * @param {Event} event - The event arguments. 29202 */ 29203 Owl.prototype.onDragStart = function(event) { 29204 var stage = null; 29205 29206 if (event.which === 3) { 29207 return; 29208 } 29209 29210 if ($.support.transform) { 29211 stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(','); 29212 stage = { 29213 x: stage[stage.length === 16 ? 12 : 4], 29214 y: stage[stage.length === 16 ? 13 : 5] 29215 }; 29216 } else { 29217 stage = this.$stage.position(); 29218 stage = { 29219 x: this.settings.rtl ? 29220 stage.left + this.$stage.width() - this.width() + this.settings.margin : 29221 stage.left, 29222 y: stage.top 29223 }; 29224 } 29225 29226 if (this.is('animating')) { 29227 $.support.transform ? this.animate(stage.x) : this.$stage.stop() 29228 this.invalidate('position'); 29229 } 29230 29231 this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown'); 29232 29233 this.speed(0); 29234 29235 this._drag.time = new Date().getTime(); 29236 this._drag.target = $(event.target); 29237 this._drag.stage.start = stage; 29238 this._drag.stage.current = stage; 29239 this._drag.pointer = this.pointer(event); 29240 29241 $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this)); 29242 29243 $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) { 29244 var delta = this.difference(this._drag.pointer, this.pointer(event)); 29245 29246 $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this)); 29247 29248 if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) { 29249 return; 29250 } 29251 29252 event.preventDefault(); 29253 29254 this.enter('dragging'); 29255 this.trigger('drag'); 29256 }, this)); 29257 }; 29258 29259 /** 29260 * Handles the `touchmove` and `mousemove` events. 29261 * @todo #261 29262 * @protected 29263 * @param {Event} event - The event arguments. 29264 */ 29265 Owl.prototype.onDragMove = function(event) { 29266 var minimum = null, 29267 maximum = null, 29268 pull = null, 29269 delta = this.difference(this._drag.pointer, this.pointer(event)), 29270 stage = this.difference(this._drag.stage.start, delta); 29271 29272 if (!this.is('dragging')) { 29273 return; 29274 } 29275 29276 event.preventDefault(); 29277 29278 if (this.settings.loop) { 29279 minimum = this.coordinates(this.minimum()); 29280 maximum = this.coordinates(this.maximum() + 1) - minimum; 29281 stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum; 29282 } else { 29283 minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); 29284 maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); 29285 pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0; 29286 stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); 29287 } 29288 29289 this._drag.stage.current = stage; 29290 29291 this.animate(stage.x); 29292 }; 29293 29294 /** 29295 * Handles the `touchend` and `mouseup` events. 29296 * @todo #261 29297 * @todo Threshold for click event 29298 * @protected 29299 * @param {Event} event - The event arguments. 29300 */ 29301 Owl.prototype.onDragEnd = function(event) { 29302 var delta = this.difference(this._drag.pointer, this.pointer(event)), 29303 stage = this._drag.stage.current, 29304 direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right'; 29305 29306 $(document).off('.owl.core'); 29307 29308 this.$element.removeClass(this.options.grabClass); 29309 29310 if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) { 29311 this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); 29312 this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction)); 29313 this.invalidate('position'); 29314 this.update(); 29315 29316 this._drag.direction = direction; 29317 29318 if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) { 29319 this._drag.target.one('click.owl.core', function() { return false; }); 29320 } 29321 } 29322 29323 if (!this.is('dragging')) { 29324 return; 29325 } 29326 29327 this.leave('dragging'); 29328 this.trigger('dragged'); 29329 }; 29330 29331 /** 29332 * Gets absolute position of the closest item for a coordinate. 29333 * @todo Setting `freeDrag` makes `closest` not reusable. See #165. 29334 * @protected 29335 * @param {Number} coordinate - The coordinate in pixel. 29336 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`. 29337 * @return {Number} - The absolute position of the closest item. 29338 */ 29339 Owl.prototype.closest = function(coordinate, direction) { 29340 var position = -1, 29341 pull = 30, 29342 width = this.width(), 29343 coordinates = this.coordinates(); 29344 29345 if (!this.settings.freeDrag) { 29346 // check closest item 29347 $.each(coordinates, $.proxy(function(index, value) { 29348 // on a left pull, check on current index 29349 if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) { 29350 position = index; 29351 // on a right pull, check on previous index 29352 // to do so, subtract width from value and set position = index + 1 29353 } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) { 29354 position = index + 1; 29355 } else if (this.op(coordinate, '<', value) 29356 && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) { 29357 position = direction === 'left' ? index + 1 : index; 29358 } 29359 return position === -1; 29360 }, this)); 29361 } 29362 29363 if (!this.settings.loop) { 29364 // non loop boundries 29365 if (this.op(coordinate, '>', coordinates[this.minimum()])) { 29366 position = coordinate = this.minimum(); 29367 } else if (this.op(coordinate, '<', coordinates[this.maximum()])) { 29368 position = coordinate = this.maximum(); 29369 } 29370 } 29371 29372 return position; 29373 }; 29374 29375 /** 29376 * Animates the stage. 29377 * @todo #270 29378 * @public 29379 * @param {Number} coordinate - The coordinate in pixels. 29380 */ 29381 Owl.prototype.animate = function(coordinate) { 29382 var animate = this.speed() > 0; 29383 29384 this.is('animating') && this.onTransitionEnd(); 29385 29386 if (animate) { 29387 this.enter('animating'); 29388 this.trigger('translate'); 29389 } 29390 29391 if ($.support.transform3d && $.support.transition) { 29392 this.$stage.css({ 29393 transform: 'translate3d(' + coordinate + 'px,0px,0px)', 29394 transition: (this.speed() / 1000) + 's' + ( 29395 this.settings.slideTransition ? ' ' + this.settings.slideTransition : '' 29396 ) 29397 }); 29398 } else if (animate) { 29399 this.$stage.animate({ 29400 left: coordinate + 'px' 29401 }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); 29402 } else { 29403 this.$stage.css({ 29404 left: coordinate + 'px' 29405 }); 29406 } 29407 }; 29408 29409 /** 29410 * Checks whether the carousel is in a specific state or not. 29411 * @param {String} state - The state to check. 29412 * @returns {Boolean} - The flag which indicates if the carousel is busy. 29413 */ 29414 Owl.prototype.is = function(state) { 29415 return this._states.current[state] && this._states.current[state] > 0; 29416 }; 29417 29418 /** 29419 * Sets the absolute position of the current item. 29420 * @public 29421 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged. 29422 * @returns {Number} - The absolute position of the current item. 29423 */ 29424 Owl.prototype.current = function(position) { 29425 if (position === undefined) { 29426 return this._current; 29427 } 29428 29429 if (this._items.length === 0) { 29430 return undefined; 29431 } 29432 29433 position = this.normalize(position); 29434 29435 if (this._current !== position) { 29436 var event = this.trigger('change', { property: { name: 'position', value: position } }); 29437 29438 if (event.data !== undefined) { 29439 position = this.normalize(event.data); 29440 } 29441 29442 this._current = position; 29443 29444 this.invalidate('position'); 29445 29446 this.trigger('changed', { property: { name: 'position', value: this._current } }); 29447 } 29448 29449 return this._current; 29450 }; 29451 29452 /** 29453 * Invalidates the given part of the update routine. 29454 * @param {String} [part] - The part to invalidate. 29455 * @returns {Array.<String>} - The invalidated parts. 29456 */ 29457 Owl.prototype.invalidate = function(part) { 29458 if ($.type(part) === 'string') { 29459 this._invalidated[part] = true; 29460 this.is('valid') && this.leave('valid'); 29461 } 29462 return $.map(this._invalidated, function(v, i) { return i }); 29463 }; 29464 29465 /** 29466 * Resets the absolute position of the current item. 29467 * @public 29468 * @param {Number} position - The absolute position of the new item. 29469 */ 29470 Owl.prototype.reset = function(position) { 29471 position = this.normalize(position); 29472 29473 if (position === undefined) { 29474 return; 29475 } 29476 29477 this._speed = 0; 29478 this._current = position; 29479 29480 this.suppress([ 'translate', 'translated' ]); 29481 29482 this.animate(this.coordinates(position)); 29483 29484 this.release([ 'translate', 'translated' ]); 29485 }; 29486 29487 /** 29488 * Normalizes an absolute or a relative position of an item. 29489 * @public 29490 * @param {Number} position - The absolute or relative position to normalize. 29491 * @param {Boolean} [relative=false] - Whether the given position is relative or not. 29492 * @returns {Number} - The normalized position. 29493 */ 29494 Owl.prototype.normalize = function(position, relative) { 29495 var n = this._items.length, 29496 m = relative ? 0 : this._clones.length; 29497 29498 if (!this.isNumeric(position) || n < 1) { 29499 position = undefined; 29500 } else if (position < 0 || position >= n + m) { 29501 position = ((position - m / 2) % n + n) % n + m / 2; 29502 } 29503 29504 return position; 29505 }; 29506 29507 /** 29508 * Converts an absolute position of an item into a relative one. 29509 * @public 29510 * @param {Number} position - The absolute position to convert. 29511 * @returns {Number} - The converted position. 29512 */ 29513 Owl.prototype.relative = function(position) { 29514 position -= this._clones.length / 2; 29515 return this.normalize(position, true); 29516 }; 29517 29518 /** 29519 * Gets the maximum position for the current item. 29520 * @public 29521 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 29522 * @returns {Number} 29523 */ 29524 Owl.prototype.maximum = function(relative) { 29525 var settings = this.settings, 29526 maximum = this._coordinates.length, 29527 iterator, 29528 reciprocalItemsWidth, 29529 elementWidth; 29530 29531 if (settings.loop) { 29532 maximum = this._clones.length / 2 + this._items.length - 1; 29533 } else if (settings.autoWidth || settings.merge) { 29534 iterator = this._items.length; 29535 if (iterator) { 29536 reciprocalItemsWidth = this._items[--iterator].width(); 29537 elementWidth = this.$element.width(); 29538 while (iterator--) { 29539 reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; 29540 if (reciprocalItemsWidth > elementWidth) { 29541 break; 29542 } 29543 } 29544 } 29545 maximum = iterator + 1; 29546 } else if (settings.center) { 29547 maximum = this._items.length - 1; 29548 } else { 29549 maximum = this._items.length - settings.items; 29550 } 29551 29552 if (relative) { 29553 maximum -= this._clones.length / 2; 29554 } 29555 29556 return Math.max(maximum, 0); 29557 }; 29558 29559 /** 29560 * Gets the minimum position for the current item. 29561 * @public 29562 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 29563 * @returns {Number} 29564 */ 29565 Owl.prototype.minimum = function(relative) { 29566 return relative ? 0 : this._clones.length / 2; 29567 }; 29568 29569 /** 29570 * Gets an item at the specified relative position. 29571 * @public 29572 * @param {Number} [position] - The relative position of the item. 29573 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 29574 */ 29575 Owl.prototype.items = function(position) { 29576 if (position === undefined) { 29577 return this._items.slice(); 29578 } 29579 29580 position = this.normalize(position, true); 29581 return this._items[position]; 29582 }; 29583 29584 /** 29585 * Gets an item at the specified relative position. 29586 * @public 29587 * @param {Number} [position] - The relative position of the item. 29588 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 29589 */ 29590 Owl.prototype.mergers = function(position) { 29591 if (position === undefined) { 29592 return this._mergers.slice(); 29593 } 29594 29595 position = this.normalize(position, true); 29596 return this._mergers[position]; 29597 }; 29598 29599 /** 29600 * Gets the absolute positions of clones for an item. 29601 * @public 29602 * @param {Number} [position] - The relative position of the item. 29603 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given. 29604 */ 29605 Owl.prototype.clones = function(position) { 29606 var odd = this._clones.length / 2, 29607 even = odd + this._items.length, 29608 map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 }; 29609 29610 if (position === undefined) { 29611 return $.map(this._clones, function(v, i) { return map(i) }); 29612 } 29613 29614 return $.map(this._clones, function(v, i) { return v === position ? map(i) : null }); 29615 }; 29616 29617 /** 29618 * Sets the current animation speed. 29619 * @public 29620 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged. 29621 * @returns {Number} - The current animation speed in milliseconds. 29622 */ 29623 Owl.prototype.speed = function(speed) { 29624 if (speed !== undefined) { 29625 this._speed = speed; 29626 } 29627 29628 return this._speed; 29629 }; 29630 29631 /** 29632 * Gets the coordinate of an item. 29633 * @todo The name of this method is missleanding. 29634 * @public 29635 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`. 29636 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates. 29637 */ 29638 Owl.prototype.coordinates = function(position) { 29639 var multiplier = 1, 29640 newPosition = position - 1, 29641 coordinate; 29642 29643 if (position === undefined) { 29644 return $.map(this._coordinates, $.proxy(function(coordinate, index) { 29645 return this.coordinates(index); 29646 }, this)); 29647 } 29648 29649 if (this.settings.center) { 29650 if (this.settings.rtl) { 29651 multiplier = -1; 29652 newPosition = position + 1; 29653 } 29654 29655 coordinate = this._coordinates[position]; 29656 coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; 29657 } else { 29658 coordinate = this._coordinates[newPosition] || 0; 29659 } 29660 29661 coordinate = Math.ceil(coordinate); 29662 29663 return coordinate; 29664 }; 29665 29666 /** 29667 * Calculates the speed for a translation. 29668 * @protected 29669 * @param {Number} from - The absolute position of the start item. 29670 * @param {Number} to - The absolute position of the target item. 29671 * @param {Number} [factor=undefined] - The time factor in milliseconds. 29672 * @returns {Number} - The time in milliseconds for the translation. 29673 */ 29674 Owl.prototype.duration = function(from, to, factor) { 29675 if (factor === 0) { 29676 return 0; 29677 } 29678 29679 return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); 29680 }; 29681 29682 /** 29683 * Slides to the specified item. 29684 * @public 29685 * @param {Number} position - The position of the item. 29686 * @param {Number} [speed] - The time in milliseconds for the transition. 29687 */ 29688 Owl.prototype.to = function(position, speed) { 29689 var current = this.current(), 29690 revert = null, 29691 distance = position - this.relative(current), 29692 direction = (distance > 0) - (distance < 0), 29693 items = this._items.length, 29694 minimum = this.minimum(), 29695 maximum = this.maximum(); 29696 29697 if (this.settings.loop) { 29698 if (!this.settings.rewind && Math.abs(distance) > items / 2) { 29699 distance += direction * -1 * items; 29700 } 29701 29702 position = current + distance; 29703 revert = ((position - minimum) % items + items) % items + minimum; 29704 29705 if (revert !== position && revert - distance <= maximum && revert - distance > 0) { 29706 current = revert - distance; 29707 position = revert; 29708 this.reset(current); 29709 } 29710 } else if (this.settings.rewind) { 29711 maximum += 1; 29712 position = (position % maximum + maximum) % maximum; 29713 } else { 29714 position = Math.max(minimum, Math.min(maximum, position)); 29715 } 29716 29717 this.speed(this.duration(current, position, speed)); 29718 this.current(position); 29719 29720 if (this.isVisible()) { 29721 this.update(); 29722 } 29723 }; 29724 29725 /** 29726 * Slides to the next item. 29727 * @public 29728 * @param {Number} [speed] - The time in milliseconds for the transition. 29729 */ 29730 Owl.prototype.next = function(speed) { 29731 speed = speed || false; 29732 this.to(this.relative(this.current()) + 1, speed); 29733 }; 29734 29735 /** 29736 * Slides to the previous item. 29737 * @public 29738 * @param {Number} [speed] - The time in milliseconds for the transition. 29739 */ 29740 Owl.prototype.prev = function(speed) { 29741 speed = speed || false; 29742 this.to(this.relative(this.current()) - 1, speed); 29743 }; 29744 29745 /** 29746 * Handles the end of an animation. 29747 * @protected 29748 * @param {Event} event - The event arguments. 29749 */ 29750 Owl.prototype.onTransitionEnd = function(event) { 29751 29752 // if css2 animation then event object is undefined 29753 if (event !== undefined) { 29754 event.stopPropagation(); 29755 29756 // Catch only owl-stage transitionEnd event 29757 if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { 29758 return false; 29759 } 29760 } 29761 29762 this.leave('animating'); 29763 this.trigger('translated'); 29764 }; 29765 29766 /** 29767 * Gets viewport width. 29768 * @protected 29769 * @return {Number} - The width in pixel. 29770 */ 29771 Owl.prototype.viewport = function() { 29772 var width; 29773 if (this.options.responsiveBaseElement !== window) { 29774 width = $(this.options.responsiveBaseElement).width(); 29775 } else if (window.innerWidth) { 29776 width = window.innerWidth; 29777 } else if (document.documentElement && document.documentElement.clientWidth) { 29778 width = document.documentElement.clientWidth; 29779 } else { 29780 console.warn('Can not detect viewport width.'); 29781 } 29782 return width; 29783 }; 29784 29785 /** 29786 * Replaces the current content. 29787 * @public 29788 * @param {HTMLElement|jQuery|String} content - The new content. 29789 */ 29790 Owl.prototype.replace = function(content) { 29791 this.$stage.empty(); 29792 this._items = []; 29793 29794 if (content) { 29795 content = (content instanceof jQuery) ? content : $(content); 29796 } 29797 29798 if (this.settings.nestedItemSelector) { 29799 content = content.find('.' + this.settings.nestedItemSelector); 29800 } 29801 29802 content.filter(function() { 29803 return this.nodeType === 1; 29804 }).each($.proxy(function(index, item) { 29805 item = this.prepare(item); 29806 this.$stage.append(item); 29807 this._items.push(item); 29808 this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 29809 }, this)); 29810 29811 this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); 29812 29813 this.invalidate('items'); 29814 }; 29815 29816 /** 29817 * Adds an item. 29818 * @todo Use `item` instead of `content` for the event arguments. 29819 * @public 29820 * @param {HTMLElement|jQuery|String} content - The item content to add. 29821 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end. 29822 */ 29823 Owl.prototype.add = function(content, position) { 29824 var current = this.relative(this._current); 29825 29826 position = position === undefined ? this._items.length : this.normalize(position, true); 29827 content = content instanceof jQuery ? content : $(content); 29828 29829 this.trigger('add', { content: content, position: position }); 29830 29831 content = this.prepare(content); 29832 29833 if (this._items.length === 0 || position === this._items.length) { 29834 this._items.length === 0 && this.$stage.append(content); 29835 this._items.length !== 0 && this._items[position - 1].after(content); 29836 this._items.push(content); 29837 this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 29838 } else { 29839 this._items[position].before(content); 29840 this._items.splice(position, 0, content); 29841 this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 29842 } 29843 29844 this._items[current] && this.reset(this._items[current].index()); 29845 29846 this.invalidate('items'); 29847 29848 this.trigger('added', { content: content, position: position }); 29849 }; 29850 29851 /** 29852 * Removes an item by its position. 29853 * @todo Use `item` instead of `content` for the event arguments. 29854 * @public 29855 * @param {Number} position - The relative position of the item to remove. 29856 */ 29857 Owl.prototype.remove = function(position) { 29858 position = this.normalize(position, true); 29859 29860 if (position === undefined) { 29861 return; 29862 } 29863 29864 this.trigger('remove', { content: this._items[position], position: position }); 29865 29866 this._items[position].remove(); 29867 this._items.splice(position, 1); 29868 this._mergers.splice(position, 1); 29869 29870 this.invalidate('items'); 29871 29872 this.trigger('removed', { content: null, position: position }); 29873 }; 29874 29875 /** 29876 * Preloads images with auto width. 29877 * @todo Replace by a more generic approach 29878 * @protected 29879 */ 29880 Owl.prototype.preloadAutoWidthImages = function(images) { 29881 images.each($.proxy(function(i, element) { 29882 this.enter('pre-loading'); 29883 element = $(element); 29884 $(new Image()).one('load', $.proxy(function(e) { 29885 element.attr('src', e.target.src); 29886 element.css('opacity', 1); 29887 this.leave('pre-loading'); 29888 !this.is('pre-loading') && !this.is('initializing') && this.refresh(); 29889 }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina')); 29890 }, this)); 29891 }; 29892 29893 /** 29894 * Destroys the carousel. 29895 * @public 29896 */ 29897 Owl.prototype.destroy = function() { 29898 29899 this.$element.off('.owl.core'); 29900 this.$stage.off('.owl.core'); 29901 $(document).off('.owl.core'); 29902 29903 if (this.settings.responsive !== false) { 29904 window.clearTimeout(this.resizeTimer); 29905 this.off(window, 'resize', this._handlers.onThrottledResize); 29906 } 29907 29908 for (var i in this._plugins) { 29909 this._plugins[i].destroy(); 29910 } 29911 29912 this.$stage.children('.cloned').remove(); 29913 29914 this.$stage.unwrap(); 29915 this.$stage.children().contents().unwrap(); 29916 this.$stage.children().unwrap(); 29917 this.$stage.remove(); 29918 this.$element 29919 .removeClass(this.options.refreshClass) 29920 .removeClass(this.options.loadingClass) 29921 .removeClass(this.options.loadedClass) 29922 .removeClass(this.options.rtlClass) 29923 .removeClass(this.options.dragClass) 29924 .removeClass(this.options.grabClass) 29925 .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), '')) 29926 .removeData('owl.carousel'); 29927 }; 29928 29929 /** 29930 * Operators to calculate right-to-left and left-to-right. 29931 * @protected 29932 * @param {Number} [a] - The left side operand. 29933 * @param {String} [o] - The operator. 29934 * @param {Number} [b] - The right side operand. 29935 */ 29936 Owl.prototype.op = function(a, o, b) { 29937 var rtl = this.settings.rtl; 29938 switch (o) { 29939 case '<': 29940 return rtl ? a > b : a < b; 29941 case '>': 29942 return rtl ? a < b : a > b; 29943 case '>=': 29944 return rtl ? a <= b : a >= b; 29945 case '<=': 29946 return rtl ? a >= b : a <= b; 29947 default: 29948 break; 29949 } 29950 }; 29951 29952 /** 29953 * Attaches to an internal event. 29954 * @protected 29955 * @param {HTMLElement} element - The event source. 29956 * @param {String} event - The event name. 29957 * @param {Function} listener - The event handler to attach. 29958 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not. 29959 */ 29960 Owl.prototype.on = function(element, event, listener, capture) { 29961 if (element.addEventListener) { 29962 element.addEventListener(event, listener, capture); 29963 } else if (element.attachEvent) { 29964 element.attachEvent('on' + event, listener); 29965 } 29966 }; 29967 29968 /** 29969 * Detaches from an internal event. 29970 * @protected 29971 * @param {HTMLElement} element - The event source. 29972 * @param {String} event - The event name. 29973 * @param {Function} listener - The attached event handler to detach. 29974 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not. 29975 */ 29976 Owl.prototype.off = function(element, event, listener, capture) { 29977 if (element.removeEventListener) { 29978 element.removeEventListener(event, listener, capture); 29979 } else if (element.detachEvent) { 29980 element.detachEvent('on' + event, listener); 29981 } 29982 }; 29983 29984 /** 29985 * Triggers a public event. 29986 * @todo Remove `status`, `relatedTarget` should be used instead. 29987 * @protected 29988 * @param {String} name - The event name. 29989 * @param {*} [data=null] - The event data. 29990 * @param {String} [namespace=carousel] - The event namespace. 29991 * @param {String} [state] - The state which is associated with the event. 29992 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not. 29993 * @returns {Event} - The event arguments. 29994 */ 29995 Owl.prototype.trigger = function(name, data, namespace, state, enter) { 29996 var status = { 29997 item: { count: this._items.length, index: this.current() } 29998 }, handler = $.camelCase( 29999 $.grep([ 'on', name, namespace ], function(v) { return v }) 30000 .join('-').toLowerCase() 30001 ), event = $.Event( 30002 [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), 30003 $.extend({ relatedTarget: this }, status, data) 30004 ); 30005 30006 if (!this._supress[name]) { 30007 $.each(this._plugins, function(name, plugin) { 30008 if (plugin.onTrigger) { 30009 plugin.onTrigger(event); 30010 } 30011 }); 30012 30013 this.register({ type: Owl.Type.Event, name: name }); 30014 this.$element.trigger(event); 30015 30016 if (this.settings && typeof this.settings[handler] === 'function') { 30017 this.settings[handler].call(this, event); 30018 } 30019 } 30020 30021 return event; 30022 }; 30023 30024 /** 30025 * Enters a state. 30026 * @param name - The state name. 30027 */ 30028 Owl.prototype.enter = function(name) { 30029 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 30030 if (this._states.current[name] === undefined) { 30031 this._states.current[name] = 0; 30032 } 30033 30034 this._states.current[name]++; 30035 }, this)); 30036 }; 30037 30038 /** 30039 * Leaves a state. 30040 * @param name - The state name. 30041 */ 30042 Owl.prototype.leave = function(name) { 30043 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 30044 this._states.current[name]--; 30045 }, this)); 30046 }; 30047 30048 /** 30049 * Registers an event or state. 30050 * @public 30051 * @param {Object} object - The event or state to register. 30052 */ 30053 Owl.prototype.register = function(object) { 30054 if (object.type === Owl.Type.Event) { 30055 if (!$.event.special[object.name]) { 30056 $.event.special[object.name] = {}; 30057 } 30058 30059 if (!$.event.special[object.name].owl) { 30060 var _default = $.event.special[object.name]._default; 30061 $.event.special[object.name]._default = function(e) { 30062 if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) { 30063 return _default.apply(this, arguments); 30064 } 30065 return e.namespace && e.namespace.indexOf('owl') > -1; 30066 }; 30067 $.event.special[object.name].owl = true; 30068 } 30069 } else if (object.type === Owl.Type.State) { 30070 if (!this._states.tags[object.name]) { 30071 this._states.tags[object.name] = object.tags; 30072 } else { 30073 this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); 30074 } 30075 30076 this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) { 30077 return $.inArray(tag, this._states.tags[object.name]) === i; 30078 }, this)); 30079 } 30080 }; 30081 30082 /** 30083 * Suppresses events. 30084 * @protected 30085 * @param {Array.<String>} events - The events to suppress. 30086 */ 30087 Owl.prototype.suppress = function(events) { 30088 $.each(events, $.proxy(function(index, event) { 30089 this._supress[event] = true; 30090 }, this)); 30091 }; 30092 30093 /** 30094 * Releases suppressed events. 30095 * @protected 30096 * @param {Array.<String>} events - The events to release. 30097 */ 30098 Owl.prototype.release = function(events) { 30099 $.each(events, $.proxy(function(index, event) { 30100 delete this._supress[event]; 30101 }, this)); 30102 }; 30103 30104 /** 30105 * Gets unified pointer coordinates from event. 30106 * @todo #261 30107 * @protected 30108 * @param {Event} - The `mousedown` or `touchstart` event. 30109 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position. 30110 */ 30111 Owl.prototype.pointer = function(event) { 30112 var result = { x: null, y: null }; 30113 30114 event = event.originalEvent || event || window.event; 30115 30116 event = event.touches && event.touches.length ? 30117 event.touches[0] : event.changedTouches && event.changedTouches.length ? 30118 event.changedTouches[0] : event; 30119 30120 if (event.pageX) { 30121 result.x = event.pageX; 30122 result.y = event.pageY; 30123 } else { 30124 result.x = event.clientX; 30125 result.y = event.clientY; 30126 } 30127 30128 return result; 30129 }; 30130 30131 /** 30132 * Determines if the input is a Number or something that can be coerced to a Number 30133 * @protected 30134 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested 30135 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number 30136 */ 30137 Owl.prototype.isNumeric = function(number) { 30138 return !isNaN(parseFloat(number)); 30139 }; 30140 30141 /** 30142 * Gets the difference of two vectors. 30143 * @todo #261 30144 * @protected 30145 * @param {Object} - The first vector. 30146 * @param {Object} - The second vector. 30147 * @returns {Object} - The difference. 30148 */ 30149 Owl.prototype.difference = function(first, second) { 30150 return { 30151 x: first.x - second.x, 30152 y: first.y - second.y 30153 }; 30154 }; 30155 30156 /** 30157 * The jQuery Plugin for the Owl Carousel 30158 * @todo Navigation plugin `next` and `prev` 30159 * @public 30160 */ 30161 $.fn.owlCarousel = function(option) { 30162 var args = Array.prototype.slice.call(arguments, 1); 30163 30164 return this.each(function() { 30165 var $this = $(this), 30166 data = $this.data('owl.carousel'); 30167 30168 if (!data) { 30169 data = new Owl(this, typeof option == 'object' && option); 30170 $this.data('owl.carousel', data); 30171 30172 $.each([ 30173 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' 30174 ], function(i, event) { 30175 data.register({ type: Owl.Type.Event, name: event }); 30176 data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) { 30177 if (e.namespace && e.relatedTarget !== this) { 30178 this.suppress([ event ]); 30179 data[event].apply(this, [].slice.call(arguments, 1)); 30180 this.release([ event ]); 30181 } 30182 }, data)); 30183 }); 30184 } 30185 30186 if (typeof option == 'string' && option.charAt(0) !== '_') { 30187 data[option].apply(data, args); 30188 } 30189 }); 30190 }; 30191 30192 /** 30193 * The constructor for the jQuery Plugin 30194 * @public 30195 */ 30196 $.fn.owlCarousel.Constructor = Owl; 30197 30198 })(window.Zepto || window.jQuery, window, document); 30199 30200 /** 30201 * AutoRefresh Plugin 30202 * @version 2.3.4 30203 * @author Artus Kolanowski 30204 * @author David Deutsch 30205 * @license The MIT License (MIT) 30206 */ 30207 ;(function($, window, document, undefined) { 30208 30209 /** 30210 * Creates the auto refresh plugin. 30211 * @class The Auto Refresh Plugin 30212 * @param {Owl} carousel - The Owl Carousel 30213 */ 30214 var AutoRefresh = function(carousel) { 30215 /** 30216 * Reference to the core. 30217 * @protected 30218 * @type {Owl} 30219 */ 30220 this._core = carousel; 30221 30222 /** 30223 * Refresh interval. 30224 * @protected 30225 * @type {number} 30226 */ 30227 this._interval = null; 30228 30229 /** 30230 * Whether the element is currently visible or not. 30231 * @protected 30232 * @type {Boolean} 30233 */ 30234 this._visible = null; 30235 30236 /** 30237 * All event handlers. 30238 * @protected 30239 * @type {Object} 30240 */ 30241 this._handlers = { 30242 'initialized.owl.carousel': $.proxy(function(e) { 30243 if (e.namespace && this._core.settings.autoRefresh) { 30244 this.watch(); 30245 } 30246 }, this) 30247 }; 30248 30249 // set default options 30250 this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); 30251 30252 // register event handlers 30253 this._core.$element.on(this._handlers); 30254 }; 30255 30256 /** 30257 * Default options. 30258 * @public 30259 */ 30260 AutoRefresh.Defaults = { 30261 autoRefresh: true, 30262 autoRefreshInterval: 500 30263 }; 30264 30265 /** 30266 * Watches the element. 30267 */ 30268 AutoRefresh.prototype.watch = function() { 30269 if (this._interval) { 30270 return; 30271 } 30272 30273 this._visible = this._core.isVisible(); 30274 this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); 30275 }; 30276 30277 /** 30278 * Refreshes the element. 30279 */ 30280 AutoRefresh.prototype.refresh = function() { 30281 if (this._core.isVisible() === this._visible) { 30282 return; 30283 } 30284 30285 this._visible = !this._visible; 30286 30287 this._core.$element.toggleClass('owl-hidden', !this._visible); 30288 30289 this._visible && (this._core.invalidate('width') && this._core.refresh()); 30290 }; 30291 30292 /** 30293 * Destroys the plugin. 30294 */ 30295 AutoRefresh.prototype.destroy = function() { 30296 var handler, property; 30297 30298 window.clearInterval(this._interval); 30299 30300 for (handler in this._handlers) { 30301 this._core.$element.off(handler, this._handlers[handler]); 30302 } 30303 for (property in Object.getOwnPropertyNames(this)) { 30304 typeof this[property] != 'function' && (this[property] = null); 30305 } 30306 }; 30307 30308 $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh; 30309 30310 })(window.Zepto || window.jQuery, window, document); 30311 30312 /** 30313 * Lazy Plugin 30314 * @version 2.3.4 30315 * @author Bartosz Wojciechowski 30316 * @author David Deutsch 30317 * @license The MIT License (MIT) 30318 */ 30319 ;(function($, window, document, undefined) { 30320 30321 /** 30322 * Creates the lazy plugin. 30323 * @class The Lazy Plugin 30324 * @param {Owl} carousel - The Owl Carousel 30325 */ 30326 var Lazy = function(carousel) { 30327 30328 /** 30329 * Reference to the core. 30330 * @protected 30331 * @type {Owl} 30332 */ 30333 this._core = carousel; 30334 30335 /** 30336 * Already loaded items. 30337 * @protected 30338 * @type {Array.<jQuery>} 30339 */ 30340 this._loaded = []; 30341 30342 /** 30343 * Event handlers. 30344 * @protected 30345 * @type {Object} 30346 */ 30347 this._handlers = { 30348 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) { 30349 if (!e.namespace) { 30350 return; 30351 } 30352 30353 if (!this._core.settings || !this._core.settings.lazyLoad) { 30354 return; 30355 } 30356 30357 if ((e.property && e.property.name == 'position') || e.type == 'initialized') { 30358 var settings = this._core.settings, 30359 n = (settings.center && Math.ceil(settings.items / 2) || settings.items), 30360 i = ((settings.center && n * -1) || 0), 30361 position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i, 30362 clones = this._core.clones().length, 30363 load = $.proxy(function(i, v) { this.load(v) }, this); 30364 //TODO: Need documentation for this new option 30365 if (settings.lazyLoadEager > 0) { 30366 n += settings.lazyLoadEager; 30367 // If the carousel is looping also preload images that are to the "left" 30368 if (settings.loop) { 30369 position -= settings.lazyLoadEager; 30370 n++; 30371 } 30372 } 30373 30374 while (i++ < n) { 30375 this.load(clones / 2 + this._core.relative(position)); 30376 clones && $.each(this._core.clones(this._core.relative(position)), load); 30377 position++; 30378 } 30379 } 30380 }, this) 30381 }; 30382 30383 // set the default options 30384 this._core.options = $.extend({}, Lazy.Defaults, this._core.options); 30385 30386 // register event handler 30387 this._core.$element.on(this._handlers); 30388 }; 30389 30390 /** 30391 * Default options. 30392 * @public 30393 */ 30394 Lazy.Defaults = { 30395 lazyLoad: false, 30396 lazyLoadEager: 0 30397 }; 30398 30399 /** 30400 * Loads all resources of an item at the specified position. 30401 * @param {Number} position - The absolute position of the item. 30402 * @protected 30403 */ 30404 Lazy.prototype.load = function(position) { 30405 var $item = this._core.$stage.children().eq(position), 30406 $elements = $item && $item.find('.owl-lazy'); 30407 30408 if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { 30409 return; 30410 } 30411 30412 $elements.each($.proxy(function(index, element) { 30413 var $element = $(element), image, 30414 url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset'); 30415 30416 this._core.trigger('load', { element: $element, url: url }, 'lazy'); 30417 30418 if ($element.is('img')) { 30419 $element.one('load.owl.lazy', $.proxy(function() { 30420 $element.css('opacity', 1); 30421 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 30422 }, this)).attr('src', url); 30423 } else if ($element.is('source')) { 30424 $element.one('load.owl.lazy', $.proxy(function() { 30425 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 30426 }, this)).attr('srcset', url); 30427 } else { 30428 image = new Image(); 30429 image.onload = $.proxy(function() { 30430 $element.css({ 30431 'background-image': 'url("' + url + '")', 30432 'opacity': '1' 30433 }); 30434 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 30435 }, this); 30436 image.src = url; 30437 } 30438 }, this)); 30439 30440 this._loaded.push($item.get(0)); 30441 }; 30442 30443 /** 30444 * Destroys the plugin. 30445 * @public 30446 */ 30447 Lazy.prototype.destroy = function() { 30448 var handler, property; 30449 30450 for (handler in this.handlers) { 30451 this._core.$element.off(handler, this.handlers[handler]); 30452 } 30453 for (property in Object.getOwnPropertyNames(this)) { 30454 typeof this[property] != 'function' && (this[property] = null); 30455 } 30456 }; 30457 30458 $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; 30459 30460 })(window.Zepto || window.jQuery, window, document); 30461 30462 /** 30463 * AutoHeight Plugin 30464 * @version 2.3.4 30465 * @author Bartosz Wojciechowski 30466 * @author David Deutsch 30467 * @license The MIT License (MIT) 30468 */ 30469 ;(function($, window, document, undefined) { 30470 30471 /** 30472 * Creates the auto height plugin. 30473 * @class The Auto Height Plugin 30474 * @param {Owl} carousel - The Owl Carousel 30475 */ 30476 var AutoHeight = function(carousel) { 30477 /** 30478 * Reference to the core. 30479 * @protected 30480 * @type {Owl} 30481 */ 30482 this._core = carousel; 30483 30484 this._previousHeight = null; 30485 30486 /** 30487 * All event handlers. 30488 * @protected 30489 * @type {Object} 30490 */ 30491 this._handlers = { 30492 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) { 30493 if (e.namespace && this._core.settings.autoHeight) { 30494 this.update(); 30495 } 30496 }, this), 30497 'changed.owl.carousel': $.proxy(function(e) { 30498 if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){ 30499 this.update(); 30500 } 30501 }, this), 30502 'loaded.owl.lazy': $.proxy(function(e) { 30503 if (e.namespace && this._core.settings.autoHeight 30504 && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) { 30505 this.update(); 30506 } 30507 }, this) 30508 }; 30509 30510 // set default options 30511 this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); 30512 30513 // register event handlers 30514 this._core.$element.on(this._handlers); 30515 this._intervalId = null; 30516 var refThis = this; 30517 30518 // These changes have been taken from a PR by gavrochelegnou proposed in #1575 30519 // and have been made compatible with the latest jQuery version 30520 $(window).on('load', function() { 30521 if (refThis._core.settings.autoHeight) { 30522 refThis.update(); 30523 } 30524 }); 30525 30526 // Autoresize the height of the carousel when window is resized 30527 // When carousel has images, the height is dependent on the width 30528 // and should also change on resize 30529 $(window).resize(function() { 30530 if (refThis._core.settings.autoHeight) { 30531 if (refThis._intervalId != null) { 30532 clearTimeout(refThis._intervalId); 30533 } 30534 30535 refThis._intervalId = setTimeout(function() { 30536 refThis.update(); 30537 }, 250); 30538 } 30539 }); 30540 30541 }; 30542 30543 /** 30544 * Default options. 30545 * @public 30546 */ 30547 AutoHeight.Defaults = { 30548 autoHeight: false, 30549 autoHeightClass: 'owl-height' 30550 }; 30551 30552 /** 30553 * Updates the view. 30554 */ 30555 AutoHeight.prototype.update = function() { 30556 var start = this._core._current, 30557 end = start + this._core.settings.items, 30558 lazyLoadEnabled = this._core.settings.lazyLoad, 30559 visible = this._core.$stage.children().toArray().slice(start, end), 30560 heights = [], 30561 maxheight = 0; 30562 30563 $.each(visible, function(index, item) { 30564 heights.push($(item).height()); 30565 }); 30566 30567 maxheight = Math.max.apply(null, heights); 30568 30569 if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) { 30570 maxheight = this._previousHeight; 30571 } 30572 30573 this._previousHeight = maxheight; 30574 30575 this._core.$stage.parent() 30576 .height(maxheight) 30577 .addClass(this._core.settings.autoHeightClass); 30578 }; 30579 30580 AutoHeight.prototype.destroy = function() { 30581 var handler, property; 30582 30583 for (handler in this._handlers) { 30584 this._core.$element.off(handler, this._handlers[handler]); 30585 } 30586 for (property in Object.getOwnPropertyNames(this)) { 30587 typeof this[property] !== 'function' && (this[property] = null); 30588 } 30589 }; 30590 30591 $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; 30592 30593 })(window.Zepto || window.jQuery, window, document); 30594 30595 /** 30596 * Video Plugin 30597 * @version 2.3.4 30598 * @author Bartosz Wojciechowski 30599 * @author David Deutsch 30600 * @license The MIT License (MIT) 30601 */ 30602 ;(function($, window, document, undefined) { 30603 30604 /** 30605 * Creates the video plugin. 30606 * @class The Video Plugin 30607 * @param {Owl} carousel - The Owl Carousel 30608 */ 30609 var Video = function(carousel) { 30610 /** 30611 * Reference to the core. 30612 * @protected 30613 * @type {Owl} 30614 */ 30615 this._core = carousel; 30616 30617 /** 30618 * Cache all video URLs. 30619 * @protected 30620 * @type {Object} 30621 */ 30622 this._videos = {}; 30623 30624 /** 30625 * Current playing item. 30626 * @protected 30627 * @type {jQuery} 30628 */ 30629 this._playing = null; 30630 30631 /** 30632 * All event handlers. 30633 * @todo The cloned content removale is too late 30634 * @protected 30635 * @type {Object} 30636 */ 30637 this._handlers = { 30638 'initialized.owl.carousel': $.proxy(function(e) { 30639 if (e.namespace) { 30640 this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] }); 30641 } 30642 }, this), 30643 'resize.owl.carousel': $.proxy(function(e) { 30644 if (e.namespace && this._core.settings.video && this.isInFullScreen()) { 30645 e.preventDefault(); 30646 } 30647 }, this), 30648 'refreshed.owl.carousel': $.proxy(function(e) { 30649 if (e.namespace && this._core.is('resizing')) { 30650 this._core.$stage.find('.cloned .owl-video-frame').remove(); 30651 } 30652 }, this), 30653 'changed.owl.carousel': $.proxy(function(e) { 30654 if (e.namespace && e.property.name === 'position' && this._playing) { 30655 this.stop(); 30656 } 30657 }, this), 30658 'prepared.owl.carousel': $.proxy(function(e) { 30659 if (!e.namespace) { 30660 return; 30661 } 30662 30663 var $element = $(e.content).find('.owl-video'); 30664 30665 if ($element.length) { 30666 $element.css('display', 'none'); 30667 this.fetch($element, $(e.content)); 30668 } 30669 }, this) 30670 }; 30671 30672 // set default options 30673 this._core.options = $.extend({}, Video.Defaults, this._core.options); 30674 30675 // register event handlers 30676 this._core.$element.on(this._handlers); 30677 30678 this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) { 30679 this.play(e); 30680 }, this)); 30681 }; 30682 30683 /** 30684 * Default options. 30685 * @public 30686 */ 30687 Video.Defaults = { 30688 video: false, 30689 videoHeight: false, 30690 videoWidth: false 30691 }; 30692 30693 /** 30694 * Gets the video ID and the type (YouTube/Vimeo/vzaar only). 30695 * @protected 30696 * @param {jQuery} target - The target containing the video data. 30697 * @param {jQuery} item - The item containing the video. 30698 */ 30699 Video.prototype.fetch = function(target, item) { 30700 var type = (function() { 30701 if (target.attr('data-vimeo-id')) { 30702 return 'vimeo'; 30703 } else if (target.attr('data-vzaar-id')) { 30704 return 'vzaar' 30705 } else { 30706 return 'youtube'; 30707 } 30708 })(), 30709 id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'), 30710 width = target.attr('data-width') || this._core.settings.videoWidth, 30711 height = target.attr('data-height') || this._core.settings.videoHeight, 30712 url = target.attr('href'); 30713 30714 if (url) { 30715 30716 /* 30717 Parses the id's out of the following urls (and probably more): 30718 https://www.youtube.com/watch?v=:id 30719 https://youtu.be/:id 30720 https://vimeo.com/:id 30721 https://vimeo.com/channels/:channel/:id 30722 https://vimeo.com/groups/:group/videos/:id 30723 https://app.vzaar.com/videos/:id 30724 30725 Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F 30726 */ 30727 30728 id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 30729 30730 if (id[3].indexOf('youtu') > -1) { 30731 type = 'youtube'; 30732 } else if (id[3].indexOf('vimeo') > -1) { 30733 type = 'vimeo'; 30734 } else if (id[3].indexOf('vzaar') > -1) { 30735 type = 'vzaar'; 30736 } else { 30737 throw new Error('Video URL not supported.'); 30738 } 30739 id = id[6]; 30740 } else { 30741 throw new Error('Missing video URL.'); 30742 } 30743 30744 this._videos[url] = { 30745 type: type, 30746 id: id, 30747 width: width, 30748 height: height 30749 }; 30750 30751 item.attr('data-video', url); 30752 30753 this.thumbnail(target, this._videos[url]); 30754 }; 30755 30756 /** 30757 * Creates video thumbnail. 30758 * @protected 30759 * @param {jQuery} target - The target containing the video data. 30760 * @param {Object} info - The video info object. 30761 * @see `fetch` 30762 */ 30763 Video.prototype.thumbnail = function(target, video) { 30764 var tnLink, 30765 icon, 30766 path, 30767 dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '', 30768 customTn = target.find('img'), 30769 srcType = 'src', 30770 lazyClass = '', 30771 settings = this._core.settings, 30772 create = function(path) { 30773 icon = '<div class="owl-video-play-icon"></div>'; 30774 30775 if (settings.lazyLoad) { 30776 tnLink = $('<div/>',{ 30777 "class": 'owl-video-tn ' + lazyClass, 30778 "srcType": path 30779 }); 30780 } else { 30781 tnLink = $( '<div/>', { 30782 "class": "owl-video-tn", 30783 "style": 'opacity:1;background-image:url(' + path + ')' 30784 }); 30785 } 30786 target.after(tnLink); 30787 target.after(icon); 30788 }; 30789 30790 // wrap video content into owl-video-wrapper div 30791 target.wrap( $( '<div/>', { 30792 "class": "owl-video-wrapper", 30793 "style": dimensions 30794 })); 30795 30796 if (this._core.settings.lazyLoad) { 30797 srcType = 'data-src'; 30798 lazyClass = 'owl-lazy'; 30799 } 30800 30801 // custom thumbnail 30802 if (customTn.length) { 30803 create(customTn.attr(srcType)); 30804 customTn.remove(); 30805 return false; 30806 } 30807 30808 if (video.type === 'youtube') { 30809 path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; 30810 create(path); 30811 } else if (video.type === 'vimeo') { 30812 $.ajax({ 30813 type: 'GET', 30814 url: '//vimeo.com/api/v2/video/' + video.id + '.json', 30815 jsonp: 'callback', 30816 dataType: 'jsonp', 30817 success: function(data) { 30818 path = data[0].thumbnail_large; 30819 create(path); 30820 } 30821 }); 30822 } else if (video.type === 'vzaar') { 30823 $.ajax({ 30824 type: 'GET', 30825 url: '//vzaar.com/api/videos/' + video.id + '.json', 30826 jsonp: 'callback', 30827 dataType: 'jsonp', 30828 success: function(data) { 30829 path = data.framegrab_url; 30830 create(path); 30831 } 30832 }); 30833 } 30834 }; 30835 30836 /** 30837 * Stops the current video. 30838 * @public 30839 */ 30840 Video.prototype.stop = function() { 30841 this._core.trigger('stop', null, 'video'); 30842 this._playing.find('.owl-video-frame').remove(); 30843 this._playing.removeClass('owl-video-playing'); 30844 this._playing = null; 30845 this._core.leave('playing'); 30846 this._core.trigger('stopped', null, 'video'); 30847 }; 30848 30849 /** 30850 * Starts the current video. 30851 * @public 30852 * @param {Event} event - The event arguments. 30853 */ 30854 Video.prototype.play = function(event) { 30855 var target = $(event.target), 30856 item = target.closest('.' + this._core.settings.itemClass), 30857 video = this._videos[item.attr('data-video')], 30858 width = video.width || '100%', 30859 height = video.height || this._core.$stage.height(), 30860 html, 30861 iframe; 30862 30863 if (this._playing) { 30864 return; 30865 } 30866 30867 this._core.enter('playing'); 30868 this._core.trigger('play', null, 'video'); 30869 30870 item = this._core.items(this._core.relative(item.index())); 30871 30872 this._core.reset(item.index()); 30873 30874 html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' ); 30875 html.attr( 'height', height ); 30876 html.attr( 'width', width ); 30877 if (video.type === 'youtube') { 30878 html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id ); 30879 } else if (video.type === 'vimeo') { 30880 html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' ); 30881 } else if (video.type === 'vzaar') { 30882 html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' ); 30883 } 30884 30885 iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video')); 30886 30887 this._playing = item.addClass('owl-video-playing'); 30888 }; 30889 30890 /** 30891 * Checks whether an video is currently in full screen mode or not. 30892 * @todo Bad style because looks like a readonly method but changes members. 30893 * @protected 30894 * @returns {Boolean} 30895 */ 30896 Video.prototype.isInFullScreen = function() { 30897 var element = document.fullscreenElement || document.mozFullScreenElement || 30898 document.webkitFullscreenElement; 30899 30900 return element && $(element).parent().hasClass('owl-video-frame'); 30901 }; 30902 30903 /** 30904 * Destroys the plugin. 30905 */ 30906 Video.prototype.destroy = function() { 30907 var handler, property; 30908 30909 this._core.$element.off('click.owl.video'); 30910 30911 for (handler in this._handlers) { 30912 this._core.$element.off(handler, this._handlers[handler]); 30913 } 30914 for (property in Object.getOwnPropertyNames(this)) { 30915 typeof this[property] != 'function' && (this[property] = null); 30916 } 30917 }; 30918 30919 $.fn.owlCarousel.Constructor.Plugins.Video = Video; 30920 30921 })(window.Zepto || window.jQuery, window, document); 30922 30923 /** 30924 * Animate Plugin 30925 * @version 2.3.4 30926 * @author Bartosz Wojciechowski 30927 * @author David Deutsch 30928 * @license The MIT License (MIT) 30929 */ 30930 ;(function($, window, document, undefined) { 30931 30932 /** 30933 * Creates the animate plugin. 30934 * @class The Navigation Plugin 30935 * @param {Owl} scope - The Owl Carousel 30936 */ 30937 var Animate = function(scope) { 30938 this.core = scope; 30939 this.core.options = $.extend({}, Animate.Defaults, this.core.options); 30940 this.swapping = true; 30941 this.previous = undefined; 30942 this.next = undefined; 30943 30944 this.handlers = { 30945 'change.owl.carousel': $.proxy(function(e) { 30946 if (e.namespace && e.property.name == 'position') { 30947 this.previous = this.core.current(); 30948 this.next = e.property.value; 30949 } 30950 }, this), 30951 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) { 30952 if (e.namespace) { 30953 this.swapping = e.type == 'translated'; 30954 } 30955 }, this), 30956 'translate.owl.carousel': $.proxy(function(e) { 30957 if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { 30958 this.swap(); 30959 } 30960 }, this) 30961 }; 30962 30963 this.core.$element.on(this.handlers); 30964 }; 30965 30966 /** 30967 * Default options. 30968 * @public 30969 */ 30970 Animate.Defaults = { 30971 animateOut: false, 30972 animateIn: false 30973 }; 30974 30975 /** 30976 * Toggles the animation classes whenever an translations starts. 30977 * @protected 30978 * @returns {Boolean|undefined} 30979 */ 30980 Animate.prototype.swap = function() { 30981 30982 if (this.core.settings.items !== 1) { 30983 return; 30984 } 30985 30986 if (!$.support.animation || !$.support.transition) { 30987 return; 30988 } 30989 30990 this.core.speed(0); 30991 30992 var left, 30993 clear = $.proxy(this.clear, this), 30994 previous = this.core.$stage.children().eq(this.previous), 30995 next = this.core.$stage.children().eq(this.next), 30996 incoming = this.core.settings.animateIn, 30997 outgoing = this.core.settings.animateOut; 30998 30999 if (this.core.current() === this.previous) { 31000 return; 31001 } 31002 31003 if (outgoing) { 31004 left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); 31005 previous.one($.support.animation.end, clear) 31006 .css( { 'left': left + 'px' } ) 31007 .addClass('animated owl-animated-out') 31008 .addClass(outgoing); 31009 } 31010 31011 if (incoming) { 31012 next.one($.support.animation.end, clear) 31013 .addClass('animated owl-animated-in') 31014 .addClass(incoming); 31015 } 31016 }; 31017 31018 Animate.prototype.clear = function(e) { 31019 $(e.target).css( { 'left': '' } ) 31020 .removeClass('animated owl-animated-out owl-animated-in') 31021 .removeClass(this.core.settings.animateIn) 31022 .removeClass(this.core.settings.animateOut); 31023 this.core.onTransitionEnd(); 31024 }; 31025 31026 /** 31027 * Destroys the plugin. 31028 * @public 31029 */ 31030 Animate.prototype.destroy = function() { 31031 var handler, property; 31032 31033 for (handler in this.handlers) { 31034 this.core.$element.off(handler, this.handlers[handler]); 31035 } 31036 for (property in Object.getOwnPropertyNames(this)) { 31037 typeof this[property] != 'function' && (this[property] = null); 31038 } 31039 }; 31040 31041 $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; 31042 31043 })(window.Zepto || window.jQuery, window, document); 31044 31045 /** 31046 * Autoplay Plugin 31047 * @version 2.3.4 31048 * @author Bartosz Wojciechowski 31049 * @author Artus Kolanowski 31050 * @author David Deutsch 31051 * @author Tom De Caluwé 31052 * @license The MIT License (MIT) 31053 */ 31054 ;(function($, window, document, undefined) { 31055 31056 /** 31057 * Creates the autoplay plugin. 31058 * @class The Autoplay Plugin 31059 * @param {Owl} scope - The Owl Carousel 31060 */ 31061 var Autoplay = function(carousel) { 31062 /** 31063 * Reference to the core. 31064 * @protected 31065 * @type {Owl} 31066 */ 31067 this._core = carousel; 31068 31069 /** 31070 * The autoplay timeout id. 31071 * @type {Number} 31072 */ 31073 this._call = null; 31074 31075 /** 31076 * Depending on the state of the plugin, this variable contains either 31077 * the start time of the timer or the current timer value if it's 31078 * paused. Since we start in a paused state we initialize the timer 31079 * value. 31080 * @type {Number} 31081 */ 31082 this._time = 0; 31083 31084 /** 31085 * Stores the timeout currently used. 31086 * @type {Number} 31087 */ 31088 this._timeout = 0; 31089 31090 /** 31091 * Indicates whenever the autoplay is paused. 31092 * @type {Boolean} 31093 */ 31094 this._paused = true; 31095 31096 /** 31097 * All event handlers. 31098 * @protected 31099 * @type {Object} 31100 */ 31101 this._handlers = { 31102 'changed.owl.carousel': $.proxy(function(e) { 31103 if (e.namespace && e.property.name === 'settings') { 31104 if (this._core.settings.autoplay) { 31105 this.play(); 31106 } else { 31107 this.stop(); 31108 } 31109 } else if (e.namespace && e.property.name === 'position' && this._paused) { 31110 // Reset the timer. This code is triggered when the position 31111 // of the carousel was changed through user interaction. 31112 this._time = 0; 31113 } 31114 }, this), 31115 'initialized.owl.carousel': $.proxy(function(e) { 31116 if (e.namespace && this._core.settings.autoplay) { 31117 this.play(); 31118 } 31119 }, this), 31120 'play.owl.autoplay': $.proxy(function(e, t, s) { 31121 if (e.namespace) { 31122 this.play(t, s); 31123 } 31124 }, this), 31125 'stop.owl.autoplay': $.proxy(function(e) { 31126 if (e.namespace) { 31127 this.stop(); 31128 } 31129 }, this), 31130 'mouseover.owl.autoplay': $.proxy(function() { 31131 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 31132 this.pause(); 31133 } 31134 }, this), 31135 'mouseleave.owl.autoplay': $.proxy(function() { 31136 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 31137 this.play(); 31138 } 31139 }, this), 31140 'touchstart.owl.core': $.proxy(function() { 31141 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 31142 this.pause(); 31143 } 31144 }, this), 31145 'touchend.owl.core': $.proxy(function() { 31146 if (this._core.settings.autoplayHoverPause) { 31147 this.play(); 31148 } 31149 }, this) 31150 }; 31151 31152 // register event handlers 31153 this._core.$element.on(this._handlers); 31154 31155 // set default options 31156 this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); 31157 }; 31158 31159 /** 31160 * Default options. 31161 * @public 31162 */ 31163 Autoplay.Defaults = { 31164 autoplay: false, 31165 autoplayTimeout: 5000, 31166 autoplayHoverPause: false, 31167 autoplaySpeed: false 31168 }; 31169 31170 /** 31171 * Transition to the next slide and set a timeout for the next transition. 31172 * @private 31173 * @param {Number} [speed] - The animation speed for the animations. 31174 */ 31175 Autoplay.prototype._next = function(speed) { 31176 this._call = window.setTimeout( 31177 $.proxy(this._next, this, speed), 31178 this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read() 31179 ); 31180 31181 if (this._core.is('interacting') || document.hidden) { 31182 return; 31183 } 31184 this._core.next(speed || this._core.settings.autoplaySpeed); 31185 } 31186 31187 /** 31188 * Reads the current timer value when the timer is playing. 31189 * @public 31190 */ 31191 Autoplay.prototype.read = function() { 31192 return new Date().getTime() - this._time; 31193 }; 31194 31195 /** 31196 * Starts the autoplay. 31197 * @public 31198 * @param {Number} [timeout] - The interval before the next animation starts. 31199 * @param {Number} [speed] - The animation speed for the animations. 31200 */ 31201 Autoplay.prototype.play = function(timeout, speed) { 31202 var elapsed; 31203 31204 if (!this._core.is('rotating')) { 31205 this._core.enter('rotating'); 31206 } 31207 31208 timeout = timeout || this._core.settings.autoplayTimeout; 31209 31210 // Calculate the elapsed time since the last transition. If the carousel 31211 // wasn't playing this calculation will yield zero. 31212 elapsed = Math.min(this._time % (this._timeout || timeout), timeout); 31213 31214 if (this._paused) { 31215 // Start the clock. 31216 this._time = this.read(); 31217 this._paused = false; 31218 } else { 31219 // Clear the active timeout to allow replacement. 31220 window.clearTimeout(this._call); 31221 } 31222 31223 // Adjust the origin of the timer to match the new timeout value. 31224 this._time += this.read() % timeout - elapsed; 31225 31226 this._timeout = timeout; 31227 this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed); 31228 }; 31229 31230 /** 31231 * Stops the autoplay. 31232 * @public 31233 */ 31234 Autoplay.prototype.stop = function() { 31235 if (this._core.is('rotating')) { 31236 // Reset the clock. 31237 this._time = 0; 31238 this._paused = true; 31239 31240 window.clearTimeout(this._call); 31241 this._core.leave('rotating'); 31242 } 31243 }; 31244 31245 /** 31246 * Pauses the autoplay. 31247 * @public 31248 */ 31249 Autoplay.prototype.pause = function() { 31250 if (this._core.is('rotating') && !this._paused) { 31251 // Pause the clock. 31252 this._time = this.read(); 31253 this._paused = true; 31254 31255 window.clearTimeout(this._call); 31256 } 31257 }; 31258 31259 /** 31260 * Destroys the plugin. 31261 */ 31262 Autoplay.prototype.destroy = function() { 31263 var handler, property; 31264 31265 this.stop(); 31266 31267 for (handler in this._handlers) { 31268 this._core.$element.off(handler, this._handlers[handler]); 31269 } 31270 for (property in Object.getOwnPropertyNames(this)) { 31271 typeof this[property] != 'function' && (this[property] = null); 31272 } 31273 }; 31274 31275 $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; 31276 31277 })(window.Zepto || window.jQuery, window, document); 31278 31279 /** 31280 * Navigation Plugin 31281 * @version 2.3.4 31282 * @author Artus Kolanowski 31283 * @author David Deutsch 31284 * @license The MIT License (MIT) 31285 */ 31286 ;(function($, window, document, undefined) { 31287 'use strict'; 31288 31289 /** 31290 * Creates the navigation plugin. 31291 * @class The Navigation Plugin 31292 * @param {Owl} carousel - The Owl Carousel. 31293 */ 31294 var Navigation = function(carousel) { 31295 /** 31296 * Reference to the core. 31297 * @protected 31298 * @type {Owl} 31299 */ 31300 this._core = carousel; 31301 31302 /** 31303 * Indicates whether the plugin is initialized or not. 31304 * @protected 31305 * @type {Boolean} 31306 */ 31307 this._initialized = false; 31308 31309 /** 31310 * The current paging indexes. 31311 * @protected 31312 * @type {Array} 31313 */ 31314 this._pages = []; 31315 31316 /** 31317 * All DOM elements of the user interface. 31318 * @protected 31319 * @type {Object} 31320 */ 31321 this._controls = {}; 31322 31323 /** 31324 * Markup for an indicator. 31325 * @protected 31326 * @type {Array.<String>} 31327 */ 31328 this._templates = []; 31329 31330 /** 31331 * The carousel element. 31332 * @type {jQuery} 31333 */ 31334 this.$element = this._core.$element; 31335 31336 /** 31337 * Overridden methods of the carousel. 31338 * @protected 31339 * @type {Object} 31340 */ 31341 this._overrides = { 31342 next: this._core.next, 31343 prev: this._core.prev, 31344 to: this._core.to 31345 }; 31346 31347 /** 31348 * All event handlers. 31349 * @protected 31350 * @type {Object} 31351 */ 31352 this._handlers = { 31353 'prepared.owl.carousel': $.proxy(function(e) { 31354 if (e.namespace && this._core.settings.dotsData) { 31355 this._templates.push('<div class="' + this._core.settings.dotClass + '">' + 31356 $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>'); 31357 } 31358 }, this), 31359 'added.owl.carousel': $.proxy(function(e) { 31360 if (e.namespace && this._core.settings.dotsData) { 31361 this._templates.splice(e.position, 0, this._templates.pop()); 31362 } 31363 }, this), 31364 'remove.owl.carousel': $.proxy(function(e) { 31365 if (e.namespace && this._core.settings.dotsData) { 31366 this._templates.splice(e.position, 1); 31367 } 31368 }, this), 31369 'changed.owl.carousel': $.proxy(function(e) { 31370 if (e.namespace && e.property.name == 'position') { 31371 this.draw(); 31372 } 31373 }, this), 31374 'initialized.owl.carousel': $.proxy(function(e) { 31375 if (e.namespace && !this._initialized) { 31376 this._core.trigger('initialize', null, 'navigation'); 31377 this.initialize(); 31378 this.update(); 31379 this.draw(); 31380 this._initialized = true; 31381 this._core.trigger('initialized', null, 'navigation'); 31382 } 31383 }, this), 31384 'refreshed.owl.carousel': $.proxy(function(e) { 31385 if (e.namespace && this._initialized) { 31386 this._core.trigger('refresh', null, 'navigation'); 31387 this.update(); 31388 this.draw(); 31389 this._core.trigger('refreshed', null, 'navigation'); 31390 } 31391 }, this) 31392 }; 31393 31394 // set default options 31395 this._core.options = $.extend({}, Navigation.Defaults, this._core.options); 31396 31397 // register event handlers 31398 this.$element.on(this._handlers); 31399 }; 31400 31401 /** 31402 * Default options. 31403 * @public 31404 * @todo Rename `slideBy` to `navBy` 31405 */ 31406 Navigation.Defaults = { 31407 nav: false, 31408 navText: [ 31409 '<span aria-label="' + 'Previous' + '">‹</span>', 31410 '<span aria-label="' + 'Next' + '">›</span>' 31411 ], 31412 navSpeed: false, 31413 navElement: 'button type="button" role="presentation"', 31414 navContainer: false, 31415 navContainerClass: 'owl-nav', 31416 navClass: [ 31417 'owl-prev', 31418 'owl-next' 31419 ], 31420 slideBy: 1, 31421 dotClass: 'owl-dot', 31422 dotsClass: 'owl-dots', 31423 dots: true, 31424 dotsEach: false, 31425 dotsData: false, 31426 dotsSpeed: false, 31427 dotsContainer: false 31428 }; 31429 31430 /** 31431 * Initializes the layout of the plugin and extends the carousel. 31432 * @protected 31433 */ 31434 Navigation.prototype.initialize = function() { 31435 var override, 31436 settings = this._core.settings; 31437 31438 // create DOM structure for relative navigation 31439 this._controls.$relative = (settings.navContainer ? $(settings.navContainer) 31440 : $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled'); 31441 31442 this._controls.$previous = $('<' + settings.navElement + '>') 31443 .addClass(settings.navClass[0]) 31444 .html(settings.navText[0]) 31445 .prependTo(this._controls.$relative) 31446 .on('click', $.proxy(function(e) { 31447 this.prev(settings.navSpeed); 31448 }, this)); 31449 this._controls.$next = $('<' + settings.navElement + '>') 31450 .addClass(settings.navClass[1]) 31451 .html(settings.navText[1]) 31452 .appendTo(this._controls.$relative) 31453 .on('click', $.proxy(function(e) { 31454 this.next(settings.navSpeed); 31455 }, this)); 31456 31457 // create DOM structure for absolute navigation 31458 if (!settings.dotsData) { 31459 this._templates = [ $('<button role="button">') 31460 .addClass(settings.dotClass) 31461 .append($('<span>')) 31462 .prop('outerHTML') ]; 31463 } 31464 31465 this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer) 31466 : $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled'); 31467 31468 this._controls.$absolute.on('click', 'button', $.proxy(function(e) { 31469 var index = $(e.target).parent().is(this._controls.$absolute) 31470 ? $(e.target).index() : $(e.target).parent().index(); 31471 31472 e.preventDefault(); 31473 31474 this.to(index, settings.dotsSpeed); 31475 }, this)); 31476 31477 /*$el.on('focusin', function() { 31478 $(document).off(".carousel"); 31479 31480 $(document).on('keydown.carousel', function(e) { 31481 if(e.keyCode == 37) { 31482 $el.trigger('prev.owl') 31483 } 31484 if(e.keyCode == 39) { 31485 $el.trigger('next.owl') 31486 } 31487 }); 31488 });*/ 31489 31490 // override public methods of the carousel 31491 for (override in this._overrides) { 31492 this._core[override] = $.proxy(this[override], this); 31493 } 31494 }; 31495 31496 /** 31497 * Destroys the plugin. 31498 * @protected 31499 */ 31500 Navigation.prototype.destroy = function() { 31501 var handler, control, property, override, settings; 31502 settings = this._core.settings; 31503 31504 for (handler in this._handlers) { 31505 this.$element.off(handler, this._handlers[handler]); 31506 } 31507 for (control in this._controls) { 31508 if (control === '$relative' && settings.navContainer) { 31509 this._controls[control].html(''); 31510 } else { 31511 this._controls[control].remove(); 31512 } 31513 } 31514 for (override in this.overides) { 31515 this._core[override] = this._overrides[override]; 31516 } 31517 for (property in Object.getOwnPropertyNames(this)) { 31518 typeof this[property] != 'function' && (this[property] = null); 31519 } 31520 }; 31521 31522 /** 31523 * Updates the internal state. 31524 * @protected 31525 */ 31526 Navigation.prototype.update = function() { 31527 var i, j, k, 31528 lower = this._core.clones().length / 2, 31529 upper = lower + this._core.items().length, 31530 maximum = this._core.maximum(true), 31531 settings = this._core.settings, 31532 size = settings.center || settings.autoWidth || settings.dotsData 31533 ? 1 : settings.dotsEach || settings.items; 31534 31535 if (settings.slideBy !== 'page') { 31536 settings.slideBy = Math.min(settings.slideBy, settings.items); 31537 } 31538 31539 if (settings.dots || settings.slideBy == 'page') { 31540 this._pages = []; 31541 31542 for (i = lower, j = 0, k = 0; i < upper; i++) { 31543 if (j >= size || j === 0) { 31544 this._pages.push({ 31545 start: Math.min(maximum, i - lower), 31546 end: i - lower + size - 1 31547 }); 31548 if (Math.min(maximum, i - lower) === maximum) { 31549 break; 31550 } 31551 j = 0, ++k; 31552 } 31553 j += this._core.mergers(this._core.relative(i)); 31554 } 31555 } 31556 }; 31557 31558 /** 31559 * Draws the user interface. 31560 * @todo The option `dotsData` wont work. 31561 * @protected 31562 */ 31563 Navigation.prototype.draw = function() { 31564 var difference, 31565 settings = this._core.settings, 31566 disabled = this._core.items().length <= settings.items, 31567 index = this._core.relative(this._core.current()), 31568 loop = settings.loop || settings.rewind; 31569 31570 this._controls.$relative.toggleClass('disabled', !settings.nav || disabled); 31571 31572 if (settings.nav) { 31573 this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true)); 31574 this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true)); 31575 } 31576 31577 this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled); 31578 31579 if (settings.dots) { 31580 difference = this._pages.length - this._controls.$absolute.children().length; 31581 31582 if (settings.dotsData && difference !== 0) { 31583 this._controls.$absolute.html(this._templates.join('')); 31584 } else if (difference > 0) { 31585 this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0])); 31586 } else if (difference < 0) { 31587 this._controls.$absolute.children().slice(difference).remove(); 31588 } 31589 31590 this._controls.$absolute.find('.active').removeClass('active'); 31591 this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active'); 31592 } 31593 }; 31594 31595 /** 31596 * Extends event data. 31597 * @protected 31598 * @param {Event} event - The event object which gets thrown. 31599 */ 31600 Navigation.prototype.onTrigger = function(event) { 31601 var settings = this._core.settings; 31602 31603 event.page = { 31604 index: $.inArray(this.current(), this._pages), 31605 count: this._pages.length, 31606 size: settings && (settings.center || settings.autoWidth || settings.dotsData 31607 ? 1 : settings.dotsEach || settings.items) 31608 }; 31609 }; 31610 31611 /** 31612 * Gets the current page position of the carousel. 31613 * @protected 31614 * @returns {Number} 31615 */ 31616 Navigation.prototype.current = function() { 31617 var current = this._core.relative(this._core.current()); 31618 return $.grep(this._pages, $.proxy(function(page, index) { 31619 return page.start <= current && page.end >= current; 31620 }, this)).pop(); 31621 }; 31622 31623 /** 31624 * Gets the current succesor/predecessor position. 31625 * @protected 31626 * @returns {Number} 31627 */ 31628 Navigation.prototype.getPosition = function(successor) { 31629 var position, length, 31630 settings = this._core.settings; 31631 31632 if (settings.slideBy == 'page') { 31633 position = $.inArray(this.current(), this._pages); 31634 length = this._pages.length; 31635 successor ? ++position : --position; 31636 position = this._pages[((position % length) + length) % length].start; 31637 } else { 31638 position = this._core.relative(this._core.current()); 31639 length = this._core.items().length; 31640 successor ? position += settings.slideBy : position -= settings.slideBy; 31641 } 31642 31643 return position; 31644 }; 31645 31646 /** 31647 * Slides to the next item or page. 31648 * @public 31649 * @param {Number} [speed=false] - The time in milliseconds for the transition. 31650 */ 31651 Navigation.prototype.next = function(speed) { 31652 $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed); 31653 }; 31654 31655 /** 31656 * Slides to the previous item or page. 31657 * @public 31658 * @param {Number} [speed=false] - The time in milliseconds for the transition. 31659 */ 31660 Navigation.prototype.prev = function(speed) { 31661 $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed); 31662 }; 31663 31664 /** 31665 * Slides to the specified item or page. 31666 * @public 31667 * @param {Number} position - The position of the item or page. 31668 * @param {Number} [speed] - The time in milliseconds for the transition. 31669 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not. 31670 */ 31671 Navigation.prototype.to = function(position, speed, standard) { 31672 var length; 31673 31674 if (!standard && this._pages.length) { 31675 length = this._pages.length; 31676 $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed); 31677 } else { 31678 $.proxy(this._overrides.to, this._core)(position, speed); 31679 } 31680 }; 31681 31682 $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation; 31683 31684 })(window.Zepto || window.jQuery, window, document); 31685 31686 /** 31687 * Hash Plugin 31688 * @version 2.3.4 31689 * @author Artus Kolanowski 31690 * @author David Deutsch 31691 * @license The MIT License (MIT) 31692 */ 31693 ;(function($, window, document, undefined) { 31694 'use strict'; 31695 31696 /** 31697 * Creates the hash plugin. 31698 * @class The Hash Plugin 31699 * @param {Owl} carousel - The Owl Carousel 31700 */ 31701 var Hash = function(carousel) { 31702 /** 31703 * Reference to the core. 31704 * @protected 31705 * @type {Owl} 31706 */ 31707 this._core = carousel; 31708 31709 /** 31710 * Hash index for the items. 31711 * @protected 31712 * @type {Object} 31713 */ 31714 this._hashes = {}; 31715 31716 /** 31717 * The carousel element. 31718 * @type {jQuery} 31719 */ 31720 this.$element = this._core.$element; 31721 31722 /** 31723 * All event handlers. 31724 * @protected 31725 * @type {Object} 31726 */ 31727 this._handlers = { 31728 'initialized.owl.carousel': $.proxy(function(e) { 31729 if (e.namespace && this._core.settings.startPosition === 'URLHash') { 31730 $(window).trigger('hashchange.owl.navigation'); 31731 } 31732 }, this), 31733 'prepared.owl.carousel': $.proxy(function(e) { 31734 if (e.namespace) { 31735 var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash'); 31736 31737 if (!hash) { 31738 return; 31739 } 31740 31741 this._hashes[hash] = e.content; 31742 } 31743 }, this), 31744 'changed.owl.carousel': $.proxy(function(e) { 31745 if (e.namespace && e.property.name === 'position') { 31746 var current = this._core.items(this._core.relative(this._core.current())), 31747 hash = $.map(this._hashes, function(item, hash) { 31748 return item === current ? hash : null; 31749 }).join(); 31750 31751 if (!hash || window.location.hash.slice(1) === hash) { 31752 return; 31753 } 31754 31755 window.location.hash = hash; 31756 } 31757 }, this) 31758 }; 31759 31760 // set default options 31761 this._core.options = $.extend({}, Hash.Defaults, this._core.options); 31762 31763 // register the event handlers 31764 this.$element.on(this._handlers); 31765 31766 // register event listener for hash navigation 31767 $(window).on('hashchange.owl.navigation', $.proxy(function(e) { 31768 var hash = window.location.hash.substring(1), 31769 items = this._core.$stage.children(), 31770 position = this._hashes[hash] && items.index(this._hashes[hash]); 31771 31772 if (position === undefined || position === this._core.current()) { 31773 return; 31774 } 31775 31776 this._core.to(this._core.relative(position), false, true); 31777 }, this)); 31778 }; 31779 31780 /** 31781 * Default options. 31782 * @public 31783 */ 31784 Hash.Defaults = { 31785 URLhashListener: false 31786 }; 31787 31788 /** 31789 * Destroys the plugin. 31790 * @public 31791 */ 31792 Hash.prototype.destroy = function() { 31793 var handler, property; 31794 31795 $(window).off('hashchange.owl.navigation'); 31796 31797 for (handler in this._handlers) { 31798 this._core.$element.off(handler, this._handlers[handler]); 31799 } 31800 for (property in Object.getOwnPropertyNames(this)) { 31801 typeof this[property] != 'function' && (this[property] = null); 31802 } 31803 }; 31804 31805 $.fn.owlCarousel.Constructor.Plugins.Hash = Hash; 31806 31807 })(window.Zepto || window.jQuery, window, document); 31808 31809 /** 31810 * Support Plugin 31811 * 31812 * @version 2.3.4 31813 * @author Vivid Planet Software GmbH 31814 * @author Artus Kolanowski 31815 * @author David Deutsch 31816 * @license The MIT License (MIT) 31817 */ 31818 ;(function($, window, document, undefined) { 31819 31820 var style = $('<support>').get(0).style, 31821 prefixes = 'Webkit Moz O ms'.split(' '), 31822 events = { 31823 transition: { 31824 end: { 31825 WebkitTransition: 'webkitTransitionEnd', 31826 MozTransition: 'transitionend', 31827 OTransition: 'oTransitionEnd', 31828 transition: 'transitionend' 31829 } 31830 }, 31831 animation: { 31832 end: { 31833 WebkitAnimation: 'webkitAnimationEnd', 31834 MozAnimation: 'animationend', 31835 OAnimation: 'oAnimationEnd', 31836 animation: 'animationend' 31837 } 31838 } 31839 }, 31840 tests = { 31841 csstransforms: function() { 31842 return !!test('transform'); 31843 }, 31844 csstransforms3d: function() { 31845 return !!test('perspective'); 31846 }, 31847 csstransitions: function() { 31848 return !!test('transition'); 31849 }, 31850 cssanimations: function() { 31851 return !!test('animation'); 31852 } 31853 }; 31854 31855 function test(property, prefixed) { 31856 var result = false, 31857 upper = property.charAt(0).toUpperCase() + property.slice(1); 31858 31859 $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) { 31860 if (style[property] !== undefined) { 31861 result = prefixed ? property : true; 31862 return false;
31863 } 31864 }); 31865 31866 return result; 31867 } 31868 31869 function prefixed(property) { 31870 return test(property, true); 31871 } 31872 31873 if (tests.csstransitions()) { 31874 /* jshint -W053 */ 31875 $.support.transition = new String(prefixed('transition')) 31876 $.support.transition.end = events.transition.end[ $.support.transition ]; 31877 } 31878 31879 if (tests.cssanimations()) { 31880 /* jshint -W053 */ 31881 $.support.animation = new String(prefixed('animation')) 31882 $.support.animation.end = events.animation.end[ $.support.animation ]; 31883 } 31884 31885 if (tests.csstransforms()) { 31886 /* jshint -W053 */ 31887 $.support.transform = new String(prefixed('transform')); 31888 $.support.transform3d = tests.csstransforms3d(); 31889 } 31890 31891 })(window.Zepto || window.jQuery, window, document); 31892 31893 31894/***/ }), 31895/* 434 */ 31896/***/ (function(module, exports) { 31897 31898 /* 31899 * Lightcase - jQuery Plugin 31900 * The smart and flexible Lightbox Plugin. 31901 * 31902 * @author Cornel Boppart <[email protected]> 31903 * @copyright Author 31904 * 31905 * @version 2.5.0 (11/03/2018) 31906 */ 31907 31908 ;(function ($) { 31909 31910 'use strict'; 31911 31912 var _self = { 31913 cache: {}, 31914 31915 support: {}, 31916 31917 objects: {}, 31918 31919 /** 31920 * Initializes the plugin 31921 * 31922 * @param {object} options 31923 * @return {object} 31924 */ 31925 init: function (options) { 31926 return this.each(function () { 31927 $(this).unbind('click.lightcase').bind('click.lightcase', function (event) { 31928 event.preventDefault(); 31929 $(this).lightcase('start', options); 31930 }); 31931 }); 31932 }, 31933 31934 /** 31935 * Starts the plugin 31936 * 31937 * @param {object} options 31938 * @return {void} 31939 */ 31940 start: function (options) { 31941 _self.origin = lightcase.origin = this; 31942 31943 _self.settings = lightcase.settings = $.extend(true, { 31944 idPrefix: 'lightcase-', 31945 classPrefix: 'lightcase-', 31946 attrPrefix: 'lc-', 31947 transition: 'elastic', 31948 transitionOpen: null, 31949 transitionClose: null, 31950 transitionIn: null, 31951 transitionOut: null, 31952 cssTransitions: true, 31953 speedIn: 250, 31954 speedOut: 250, 31955 width: null, 31956 height: null, 31957 maxWidth: 800, 31958 maxHeight: 500, 31959 forceWidth: false, 31960 forceHeight: false, 31961 liveResize: true, 31962 fullScreenModeForMobile: true, 31963 mobileMatchExpression: /(iphone|ipod|ipad|android|blackberry|symbian)/, 31964 disableShrink: false, 31965 fixedRatio: true, 31966 shrinkFactor: .75, 31967 overlayOpacity: .9, 31968 slideshow: false, 31969 slideshowAutoStart: true, 31970 breakBeforeShow: false, 31971 timeout: 5000, 31972 swipe: true, 31973 useKeys: true, 31974 useCategories: true, 31975 useAsCollection: false, 31976 navigateEndless: true, 31977 closeOnOverlayClick: true, 31978 title: null, 31979 caption: null, 31980 showTitle: true, 31981 showCaption: true, 31982 showSequenceInfo: true, 31983 inline: { 31984 width: 'auto', 31985 height: 'auto' 31986 }, 31987 ajax: { 31988 width: 'auto', 31989 height: 'auto', 31990 type: 'get', 31991 dataType: 'html', 31992 data: {} 31993 }, 31994 iframe: { 31995 width: 800, 31996 height: 500, 31997 frameborder: 0 31998 }, 31999 flash: { 32000 width: 400, 32001 height: 205, 32002 wmode: 'transparent' 32003 }, 32004 video: { 32005 width: 400, 32006 height: 225, 32007 poster: '', 32008 preload: 'auto', 32009 controls: true, 32010 autobuffer: true, 32011 autoplay: true, 32012 loop: false 32013 }, 32014 attr: 'data-rel', 32015 href: null, 32016 type: null, 32017 typeMapping: { 32018 'image': 'jpg,jpeg,gif,png,bmp', 32019 'flash': 'swf', 32020 'video': 'mp4,mov,ogv,ogg,webm', 32021 'iframe': 'html,php', 32022 'ajax': 'json,txt', 32023 'inline': '#' 32024 }, 32025 errorMessage: function () { 32026 return '<p class="' + _self.settings.classPrefix + 'error">' + _self.settings.labels['errorMessage'] + '</p>'; 32027 }, 32028 labels: { 32029 'errorMessage': 'Source could not be found...', 32030 'sequenceInfo.of': ' of ', 32031 'close': 'Close', 32032 'navigator.prev': 'Prev', 32033 'navigator.next': 'Next', 32034 'navigator.play': 'Play', 32035 'navigator.pause': 'Pause' 32036 }, 32037 markup: function () { 32038 _self.objects.body.append( 32039 _self.objects.overlay = $('<div id="' + _self.settings.idPrefix + 'overlay"></div>'), 32040 _self.objects.loading = $('<div id="' + _self.settings.idPrefix + 'loading" class="' + _self.settings.classPrefix + 'icon-spin"></div>'),
32041 _self.objects.case = $('<div id="' + _self.settings.idPrefix + 'case" aria-hidden="true" role="dialog"></div>') 32042 ); 32043 _self.objects.case.after( 32044 _self.objects.close = $('<a href="#" class="' + _self.settings.classPrefix + 'icon-close"><span>' + _self.settings.labels['close'] + '</span></a>'), 32045 _self.objects.nav = $('<div id="' + _self.settings.idPrefix + 'nav"></div>') 32046 ); 32047 _self.objects.nav.append( 32048 _self.objects.prev = $('<a href="#" class="' + _self.settings.classPrefix + 'icon-prev"><span>' + _self.settings.labels['navigator.prev'] + '</span></a>').hide(), 32049 _self.objects.next = $('<a href="#" class="' + _self.settings.classPrefix + 'icon-next"><span>' + _self.settings.labels['navigator.next'] + '</span></a>').hide(), 32050 _self.objects.play = $('<a href="#" class="' + _self.settings.classPrefix + 'icon-play"><span>' + _self.settings.labels['navigator.play'] + '</span></a>').hide(), 32051 _self.objects.pause = $('<a href="#" class="' + _self.settings.classPrefix + 'icon-pause"><span>' + _self.settings.labels['navigator.pause'] + '</span></a>').hide() 32052 ); 32053 _self.objects.case.append( 32054 _self.objects.content = $('<div id="' + _self.settings.idPrefix + 'content"></div>'), 32055 _self.objects.info = $('<div id="' + _self.settings.idPrefix + 'info"></div>') 32056 ); 32057 _self.objects.content.append(
32058 _self.objects.contentInner = $('<div class="' + _self.settings.classPrefix + 'contentInner"></div>') 32059 ); 32060 _self.objects.info.append( 32061 _self.objects.sequenceInfo = $('<div id="' + _self.settings.idPrefix + 'sequenceInfo"></div>'), 32062 _self.objects.title = $('<h4 id="' + _self.settings.idPrefix + 'title"></h4>'), 32063 _self.objects.caption = $('<p id="' + _self.settings.idPrefix + 'caption"></p>') 32064 ); 32065 }, 32066 onInit: {}, 32067 onStart: {}, 32068 onBeforeCalculateDimensions: {}, 32069 onAfterCalculateDimensions: {}, 32070 onBeforeShow: {}, 32071 onFinish: {}, 32072 onResize: {}, 32073 onClose: {}, 32074 onCleanup: {} 32075 }, 32076 options, 32077 // Load options from data-lc-options attribute 32078 _self.origin.data ? _self.origin.data('lc-options') : {}); 32079 32080 _self.objects.document = $('html'); 32081 _self.objects.body = $('body'); 32082 32083 // Call onInit hook functions 32084 _self._callHooks(_self.settings.onInit); 32085 32086 _self.objectData = _self._setObjectData(this); 32087 32088 _self._addElements(); 32089 _self._open(); 32090 32091 _self.dimensions = _self.getViewportDimensions(); 32092 }, 32093 32094 /** 32095 * Getter method for objects 32096 * 32097 * @param {string} name 32098 * @return {object} 32099 */ 32100 get: function (name) { 32101 return _self.objects[name]; 32102 }, 32103 32104 /** 32105 * Getter method for objectData 32106 * 32107 * @return {object} 32108 */ 32109 getObjectData: function () { 32110 return _self.objectData; 32111 }, 32112 32113 /** 32114 * Sets the object data 32115 * 32116 * @param {object} object 32117 * @return {object} objectData 32118 */ 32119 _setObjectData: function (object) { 32120 var $object = $(object), 32121 objectData = { 32122 this: $(object), 32123 title: _self.settings.title || $object.attr(_self._prefixAttributeName('title')) || $object.attr('title'), 32124 caption: _self.settings.caption || $object.attr(_self._prefixAttributeName('caption')) || $object.children('img').attr('alt'), 32125 url: _self._determineUrl(), 32126 requestType: _self.settings.ajax.type, 32127 requestData: _self.settings.ajax.data, 32128 requestDataType: _self.settings.ajax.dataType, 32129 rel: $object.attr(_self._determineAttributeSelector()), 32130 type: _self.settings.type || _self._verifyDataType(_self._determineUrl()), 32131 isPartOfSequence: _self.settings.useAsCollection || _self._isPartOfSequence($object.attr(_self.settings.attr), ':'), 32132 isPartOfSequenceWithSlideshow: _self._isPartOfSequence($object.attr(_self.settings.attr), ':slideshow'), 32133 currentIndex: $(_self._determineAttributeSelector()).index($object), 32134 sequenceLength: $(_self._determineAttributeSelector()).length 32135 }; 32136 32137 // Add sequence info to objectData 32138 objectData.sequenceInfo = (objectData.currentIndex + 1) + _self.settings.labels['sequenceInfo.of'] + objectData.sequenceLength; 32139 32140 // Add next/prev index 32141 objectData.prevIndex = objectData.currentIndex - 1; 32142 objectData.nextIndex = objectData.currentIndex + 1; 32143 32144 return objectData; 32145 }, 32146 32147 /** 32148 * Prefixes a data attribute name with defined name from 'settings.attrPrefix' 32149 * to ensure more uniqueness for all lightcase related/used attributes. 32150 * 32151 * @param {string} name 32152 * @return {string} 32153 */ 32154 _prefixAttributeName: function (name) { 32155 return 'data-' + _self.settings.attrPrefix + name; 32156 }, 32157 32158 /** 32159 * Determines the link target considering 'settings.href' and data attributes 32160 * but also with a fallback to the default 'href' value. 32161 * 32162 * @return {string} 32163 */ 32164 _determineLinkTarget: function () { 32165 return _self.settings.href || $(_self.origin).attr(_self._prefixAttributeName('href')) || $(_self.origin).attr('href'); 32166 }, 32167 32168 /** 32169 * Determines the attribute selector to use, depending on 32170 * whether categorized collections are beeing used or not. 32171 * 32172 * @return {string} selector 32173 */ 32174 _determineAttributeSelector: function () { 32175 var $origin = $(_self.origin), 32176 selector = ''; 32177 32178 if (typeof _self.cache.selector !== 'undefined') { 32179 selector = _self.cache.selector; 32180 } else if (_self.settings.useCategories === true && $origin.attr(_self._prefixAttributeName('categories'))) { 32181 var categories = $origin.attr(_self._prefixAttributeName('categories')).split(' '); 32182 32183 $.each(categories, function (index, category) { 32184 if (index > 0) { 32185 selector += ','; 32186 } 32187 selector += '[' + _self._prefixAttributeName('categories') + '~="' + category + '"]'; 32188 }); 32189 } else { 32190 selector = '[' + _self.settings.attr + '="' + $origin.attr(_self.settings.attr) + '"]'; 32191 } 32192 32193 _self.cache.selector = selector; 32194 32195 return selector; 32196 }, 32197 32198 /** 32199 * Determines the correct resource according to the 32200 * current viewport and density. 32201 * 32202 * @return {string} url 32203 */ 32204 _determineUrl: function () { 32205 var dataUrl = _self._verifyDataUrl(_self._determineLinkTarget()), 32206 width = 0, 32207 density = 0, 32208 supportLevel = '', 32209 url; 32210 32211 $.each(dataUrl, function (index, src) { 32212 switch (_self._verifyDataType(src.url)) { 32213 case 'video': 32214 var video = document.createElement('video'), 32215 videoType = _self._verifyDataType(src.url) + '/' + _self._getFileUrlSuffix(src.url); 32216 32217 // Check if browser can play this type of video format 32218 if (supportLevel !== 'probably' && supportLevel !== video.canPlayType(videoType) && video.canPlayType(videoType) !== '') { 32219 supportLevel = video.canPlayType(videoType); 32220 url = src.url; 32221 } 32222 break; 32223 default: 32224 if ( 32225 // Check density 32226 _self._devicePixelRatio() >= src.density && 32227 src.density >= density && 32228 // Check viewport width 32229 _self._matchMedia()('screen and (min-width:' + src.width + 'px)').matches && 32230 src.width >= width 32231 ) { 32232 width = src.width; 32233 density = src.density; 32234 url = src.url; 32235 } 32236 break; 32237 } 32238 }); 32239 32240 return url; 32241 }, 32242 32243 /** 32244 * Normalizes an url and returns information about the resource path, 32245 * the viewport width as well as density if defined. 32246 * 32247 * @param {string} url Path to resource in format of an url or srcset 32248 * @return {object} 32249 */ 32250 _normalizeUrl: function (url) { 32251 var srcExp = /^\d+$/; 32252 32253 return url.split(',').map(function (str) { 32254 var src = { 32255 width: 0, 32256 density: 0 32257 }; 32258
32259 str.trim().split(/\s+/).forEach(function (url, i) { 32260 if (i === 0) { 32261 return src.url = url; 32262 } 32263 32264 var value = url.substring(0, url.length - 1), 32265 lastChar = url[url.length - 1], 32266 intVal = parseInt(value, 10), 32267 floatVal = parseFloat(value); 32268 if (lastChar === 'w' && srcExp.test(value)) { 32269 src.width = intVal; 32270 } else if (lastChar === 'h' && srcExp.test(value)) { 32271 src.height = intVal; 32272 } else if (lastChar === 'x' && !isNaN(floatVal)) { 32273 src.density = floatVal; 32274 } 32275 }); 32276 32277 return src; 32278 }); 32279 }, 32280 32281 /** 32282 * Verifies if the link is part of a sequence 32283 * 32284 * @param {string} rel 32285 * @param {string} expression 32286 * @return {boolean} 32287 */ 32288 _isPartOfSequence: function (rel, expression) { 32289 var getSimilarLinks = $('[' + _self.settings.attr + '="' + rel + '"]'), 32290 regexp = new RegExp(expression); 32291 32292 return (regexp.test(rel) && getSimilarLinks.length > 1); 32293 }, 32294 32295 /** 32296 * Verifies if the slideshow should be enabled 32297 * 32298 * @return {boolean} 32299 */ 32300 isSlideshowEnabled: function () { 32301 return (_self.objectData.isPartOfSequence && (_self.settings.slideshow === true || _self.objectData.isPartOfSequenceWithSlideshow === true)); 32302 }, 32303 32304 /** 32305 * Loads the new content to show 32306 * 32307 * @return {void} 32308 */ 32309 _loadContent: function () { 32310 if (_self.cache.originalObject) { 32311 _self._restoreObject(); 32312 } 32313 32314 _self._createObject(); 32315 }, 32316 32317 /** 32318 * Creates a new object 32319 * 32320 * @return {void} 32321 */ 32322 _createObject: function () { 32323 var $object; 32324 32325 // Create object 32326 switch (_self.objectData.type) { 32327 case 'image': 32328 $object = $(new Image()); 32329 $object.attr({ 32330 // The time expression is required to prevent the binding of an image load 32331 'src': _self.objectData.url, 32332 'alt': _self.objectData.title 32333 }); 32334 break; 32335 case 'inline': 32336 $object = $('<div class="' + _self.settings.classPrefix + 'inlineWrap"></div>'); 32337 $object.html(_self._cloneObject($(_self.objectData.url))); 32338 32339 // Add custom attributes from _self.settings 32340 $.each(_self.settings.inline, function (name, value) { 32341 $object.attr(_self._prefixAttributeName(name), value); 32342 }); 32343 break; 32344 case 'ajax': 32345 $object = $('<div class="' + _self.settings.classPrefix + 'inlineWrap"></div>'); 32346 32347 // Add custom attributes from _self.settings 32348 $.each(_self.settings.ajax, function (name, value) { 32349 if (name !== 'data') { 32350 $object.attr(_self._prefixAttributeName(name), value); 32351 } 32352 }); 32353 break; 32354 case 'flash': 32355 $object = $('<embed src="' + _self.objectData.url + '" type="application/x-shockwave-flash"></embed>'); 32356 32357 // Add custom attributes from _self.settings 32358 $.each(_self.settings.flash, function (name, value) { 32359 $object.attr(name, value); 32360 }); 32361 break; 32362 case 'video': 32363 $object = $('<video></video>'); 32364 $object.attr('src', _self.objectData.url); 32365 32366 // Add custom attributes from _self.settings 32367 $.each(_self.settings.video, function (name, value) { 32368 $object.attr(name, value); 32369 }); 32370 break; 32371 default: 32372 $object = $('<iframe></iframe>'); 32373 $object.attr({ 32374 'src': _self.objectData.url 32375 }); 32376 32377 // Add custom attributes from _self.settings 32378 $.each(_self.settings.iframe, function (name, value) { 32379 $object.attr(name, value); 32380 }); 32381 break; 32382 } 32383 32384 _self._addObject($object); 32385 _self._loadObject($object); 32386 }, 32387 32388 /** 32389 * Adds the new object to the markup 32390 * 32391 * @param {object} $object 32392 * @return {void} 32393 */ 32394 _addObject: function ($object) { 32395 // Add object to content holder 32396 _self.objects.contentInner.html($object); 32397 32398 // Start loading 32399 _self._loading('start'); 32400 32401 // Call onStart hook functions 32402 _self._callHooks(_self.settings.onStart); 32403 32404 // Add sequenceInfo to the content holder or hide if its empty 32405 if (_self.settings.showSequenceInfo === true && _self.objectData.isPartOfSequence) { 32406 _self.objects.sequenceInfo.html(_self.objectData.sequenceInfo); 32407 _self.objects.sequenceInfo.show(); 32408 } else { 32409 _self.objects.sequenceInfo.empty(); 32410 _self.objects.sequenceInfo.hide(); 32411 } 32412 // Add title to the content holder or hide if its empty 32413 if (_self.settings.showTitle === true && _self.objectData.title !== undefined && _self.objectData.title !== '') { 32414 _self.objects.title.html(_self.objectData.title); 32415 _self.objects.title.show(); 32416 } else { 32417 _self.objects.title.empty(); 32418 _self.objects.title.hide(); 32419 } 32420 // Add caption to the content holder or hide if its empty 32421 if (_self.settings.showCaption === true && _self.objectData.caption !== undefined && _self.objectData.caption !== '') { 32422 _self.objects.caption.html(_self.objectData.caption); 32423 _self.objects.caption.show(); 32424 } else { 32425 _self.objects.caption.empty(); 32426 _self.objects.caption.hide(); 32427 } 32428 }, 32429 32430 /** 32431 * Loads the new object 32432 * 32433 * @param {object} $object 32434 * @return {void} 32435 */ 32436 _loadObject: function ($object) { 32437 // Load the object 32438 switch (_self.objectData.type) { 32439 case 'inline': 32440 if ($(_self.objectData.url)) { 32441 _self._showContent($object); 32442 } else { 32443 _self.error(); 32444 } 32445 break; 32446 case 'ajax': 32447 $.ajax( 32448 $.extend({}, _self.settings.ajax, { 32449 url: _self.objectData.url, 32450 type: _self.objectData.requestType, 32451 dataType: _self.objectData.requestDataType, 32452 data: _self.objectData.requestData, 32453 success: function (data, textStatus, jqXHR) { 32454 // Check for X-Ajax-Location 32455 if (jqXHR.getResponseHeader('X-Ajax-Location')) { 32456 _self.objectData.url = jqXHR.getResponseHeader('X-Ajax-Location'); 32457 _self._loadObject($object); 32458 } 32459 else { 32460 // Unserialize if data is transferred as json 32461 if (_self.objectData.requestDataType === 'json') { 32462 _self.objectData.data = data; 32463 } else { 32464 $object.html(data); 32465 } 32466 _self._showContent($object); 32467 } 32468 }, 32469 error: function (jqXHR, textStatus, errorThrown) { 32470 _self.error(); 32471 } 32472 }) 32473 ); 32474 break; 32475 case 'flash': 32476 _self._showContent($object); 32477 break; 32478 case 'video': 32479 if (typeof($object.get(0).canPlayType) === 'function' || _self.objects.case.find('video').length === 0) { 32480 _self._showContent($object); 32481 } else { 32482 _self.error(); 32483 } 32484 break; 32485 default: 32486 if (_self.objectData.url) { 32487 $object.on('load', function () { 32488 _self._showContent($object); 32489 }); 32490 $object.on('error', function () { 32491 _self.error(); 32492 }); 32493 } else { 32494 _self.error(); 32495 } 32496 break; 32497 } 32498 }, 32499 32500 /** 32501 * Throws an error message if something went wrong 32502 * 32503 * @return {void} 32504 */ 32505 error: function () { 32506 _self.objectData.type = 'error'; 32507 var $object = $('<div class="' + _self.settings.classPrefix + 'inlineWrap"></div>'); 32508 32509 $object.html(_self.settings.errorMessage); 32510 _self.objects.contentInner.html($object); 32511 32512 _self._showContent(_self.objects.contentInner); 32513 }, 32514 32515 /** 32516 * Calculates the dimensions to fit content 32517 * 32518 * @param {object} $object 32519 * @return {void} 32520 */ 32521 _calculateDimensions: function ($object) { 32522 _self._cleanupDimensions(); 32523 32524 if (!$object) return; 32525 32526 // Set default dimensions 32527 var dimensions = { 32528 ratio: 1, 32529 objectWidth: $object.attr('width') ? $object.attr('width') : $object.attr(_self._prefixAttributeName('width')), 32530 objectHeight: $object.attr('height') ? $object.attr('height') : $object.attr(_self._prefixAttributeName('height')) 32531 }; 32532 32533 if (!_self.settings.disableShrink) { 32534 // Add calculated maximum width/height to dimensions 32535 dimensions.maxWidth = parseInt(_self.dimensions.windowWidth * _self.settings.shrinkFactor); 32536 dimensions.maxHeight = parseInt(_self.dimensions.windowHeight * _self.settings.shrinkFactor); 32537 32538 // If the auto calculated maxWidth/maxHeight greather than the user-defined one, use that. 32539 if (dimensions.maxWidth > _self.settings.maxWidth) { 32540 dimensions.maxWidth = _self.settings.maxWidth; 32541 } 32542 if (dimensions.maxHeight > _self.settings.maxHeight) { 32543 dimensions.maxHeight = _self.settings.maxHeight; 32544 } 32545 32546 // Calculate the difference between screen width/height and image width/height 32547 dimensions.differenceWidthAsPercent = parseInt(100 / dimensions.maxWidth * dimensions.objectWidth); 32548 dimensions.differenceHeightAsPercent = parseInt(100 / dimensions.maxHeight * dimensions.objectHeight); 32549 32550 switch (_self.objectData.type) { 32551 case 'image': 32552 case 'flash': 32553 case 'video': 32554 case 'iframe': 32555 case 'ajax': 32556 case 'inline': 32557 if (_self.objectData.type === 'image' || _self.settings.fixedRatio === true) { 32558 if (dimensions.differenceWidthAsPercent > 100 && dimensions.differenceWidthAsPercent > dimensions.differenceHeightAsPercent) { 32559 dimensions.objectWidth = dimensions.maxWidth; 32560 dimensions.objectHeight = parseInt(dimensions.objectHeight / dimensions.differenceWidthAsPercent * 100); 32561 } 32562 if (dimensions.differenceHeightAsPercent > 100 && dimensions.differenceHeightAsPercent > dimensions.differenceWidthAsPercent) { 32563 dimensions.objectWidth = parseInt(dimensions.objectWidth / dimensions.differenceHeightAsPercent * 100); 32564 dimensions.objectHeight = dimensions.maxHeight; 32565 } 32566 if (dimensions.differenceHeightAsPercent > 100 && dimensions.differenceWidthAsPercent < dimensions.differenceHeightAsPercent) { 32567 dimensions.objectWidth = parseInt(dimensions.maxWidth / dimensions.differenceHeightAsPercent * dimensions.differenceWidthAsPercent); 32568 dimensions.objectHeight = dimensions.maxHeight; 32569 } 32570 break; 32571 } 32572 case 'error': 32573 if (!isNaN(dimensions.objectWidth) && dimensions.objectWidth > dimensions.maxWidth) { 32574 dimensions.objectWidth = dimensions.maxWidth; 32575 } 32576 break; 32577 default: 32578 if ((isNaN(dimensions.objectWidth) || dimensions.objectWidth > dimensions.maxWidth) && !_self.settings.forceWidth) { 32579 dimensions.objectWidth = dimensions.maxWidth; 32580 } 32581 if (((isNaN(dimensions.objectHeight) && dimensions.objectHeight !== 'auto') || dimensions.objectHeight > dimensions.maxHeight) && !_self.settings.forceHeight) { 32582 dimensions.objectHeight = dimensions.maxHeight; 32583 } 32584 break; 32585 } 32586 } 32587 32588 if (_self.settings.forceWidth) { 32589 try { 32590 dimensions.objectWidth = _self.settings[_self.objectData.type].width; 32591 } catch (e) { 32592 dimensions.objectWidth = _self.settings.width || dimensions.objectWidth; 32593 } 32594 32595 dimensions.maxWidth = null; 32596 } 32597 if ($object.attr(_self._prefixAttributeName('max-width'))) { 32598 dimensions.maxWidth = $object.attr(_self._prefixAttributeName('max-width')); 32599 } 32600 32601 if (_self.settings.forceHeight) { 32602 try { 32603 dimensions.objectHeight = _self.settings[_self.objectData.type].height; 32604 } catch (e) { 32605 dimensions.objectHeight = _self.settings.height || dimensions.objectHeight; 32606 } 32607 32608 dimensions.maxHeight = null; 32609 } 32610 if ($object.attr(_self._prefixAttributeName('max-height'))) { 32611 dimensions.maxHeight = $object.attr(_self._prefixAttributeName('max-height')); 32612 } 32613 _self._adjustDimensions($object, dimensions); 32614 }, 32615 32616 /** 32617 * Adjusts the dimensions 32618 * 32619 * @param {object} $object 32620 * @param {object} dimensions 32621 * @return {void} 32622 */ 32623 _adjustDimensions: function ($object, dimensions) { 32624 // Adjust width and height 32625 $object.css({ 32626 'width': dimensions.objectWidth, 32627 'height': dimensions.objectHeight, 32628 'max-width': dimensions.maxWidth, 32629 'max-height': dimensions.maxHeight 32630 }); 32631 32632 _self.objects.contentInner.css({ 32633 'width': $object.outerWidth(), 32634 'height': $object.outerHeight(), 32635 'max-width': '100%' 32636 }); 32637 32638 _self.objects.case.css({ 32639 'width': _self.objects.contentInner.outerWidth(), 32640 'max-width': '100%' 32641 }); 32642 32643 // Adjust margin 32644 _self.objects.case.css({ 32645 'margin-top': parseInt(-(_self.objects.case.outerHeight() / 2)), 32646 'margin-left': parseInt(-(_self.objects.case.outerWidth() / 2)) 32647 }); 32648 }, 32649 32650 /** 32651 * Handles the _loading 32652 * 32653 * @param {string} process 32654 * @return {void} 32655 */ 32656 _loading: function (process) { 32657 if (process === 'start') { 32658 _self.objects.case.addClass(_self.settings.classPrefix + 'loading'); 32659 _self.objects.loading.show(); 32660 } else if (process === 'end') { 32661 _self.objects.case.removeClass(_self.settings.classPrefix + 'loading'); 32662 _self.objects.loading.hide(); 32663 } 32664 }, 32665 32666 32667 /** 32668 * Gets the client screen dimensions 32669 * 32670 * @return {object} dimensions 32671 */ 32672 getViewportDimensions: function () { 32673 return { 32674 windowWidth: $(window).innerWidth(), 32675 windowHeight: $(window).innerHeight() 32676 }; 32677 }, 32678 32679 /** 32680 * Verifies the url 32681 * 32682 * @param {string} dataUrl 32683 * @return {object} dataUrl Clean url for processing content 32684 */ 32685 _verifyDataUrl: function (dataUrl) { 32686 if (!dataUrl || dataUrl === undefined || dataUrl === '') { 32687 return false;
32688 } 32689 32690 if (dataUrl.indexOf('#') > -1) { 32691 dataUrl = dataUrl.split('#'); 32692 dataUrl = '#' + dataUrl[dataUrl.length - 1]; 32693 } 32694 32695 return _self._normalizeUrl(dataUrl.toString()); 32696 }, 32697 32698 // 32699 /** 32700 * Tries to get the (file) suffix of an url 32701 * 32702 * @param {string} url 32703 * @return {string} 32704 */ 32705 _getFileUrlSuffix: function (url) { 32706 var re = /(?:\.([^.]+))?$/; 32707 return re.exec(url.toLowerCase())[1]; 32708 }, 32709 32710 /** 32711 * Verifies the data type of the content to load 32712 * 32713 * @param {string} url 32714 * @return {string|boolean} Array key if expression matched, else false 32715 */ 32716 _verifyDataType: function (url) { 32717 var typeMapping = _self.settings.typeMapping; 32718 32719 // Early abort if dataUrl couldn't be verified 32720 if (!url) { 32721 return false; 32722 } 32723 32724 // Verify the dataType of url according to typeMapping which 32725 // has been defined in settings. 32726 for (var key in typeMapping) { 32727 if (typeMapping.hasOwnProperty(key)) { 32728 var suffixArr = typeMapping[key].split(','); 32729 32730 for (var i = 0; i < suffixArr.length; i++) { 32731 var suffix = suffixArr[i].toLowerCase(), 32732 regexp = new RegExp('\.(' + suffix + ')$', 'i'), 32733 str = url.toLowerCase().split('?')[0].substr(-5); 32734 32735 if (regexp.test(str) === true || (key === 'inline' && (url.indexOf(suffix) > -1))) { 32736 return key; 32737 } 32738 } 32739 } 32740 } 32741 32742 // If no expression matched, return 'iframe'. 32743 return 'iframe'; 32744 }, 32745 32746 /** 32747 * Extends html markup with the essential tags 32748 * 32749 * @return {void} 32750 */ 32751 _addElements: function () { 32752 if (typeof _self.objects.case !== 'undefined' && $('#' + _self.objects.case.attr('id')).length) { 32753 return; 32754 } 32755 32756 _self.settings.markup(); 32757 }, 32758 32759 /** 32760 * Shows the loaded content 32761 * 32762 * @param {object} $object 32763 * @return {void} 32764 */ 32765 _showContent: function ($object) { 32766 // Add data attribute with the object type 32767 _self.objects.document.attr(_self._prefixAttributeName('type'), _self.objectData.type); 32768 32769 _self.cache.object = $object; 32770 32771 // Call onBeforeShow hook functions 32772 _self._callHooks(_self.settings.onBeforeShow); 32773 32774 if (_self.settings.breakBeforeShow) return; 32775 _self.show(); 32776 }, 32777 32778 /** 32779 * Starts the 'inTransition' 32780 * @return {void} 32781 */ 32782 _startInTransition: function () { 32783 switch (_self.transition.in()) { 32784 case 'scrollTop': 32785 case 'scrollRight': 32786 case 'scrollBottom': 32787 case 'scrollLeft': 32788 case 'scrollHorizontal': 32789 case 'scrollVertical': 32790 _self.transition.scroll(_self.objects.case, 'in', _self.settings.speedIn); 32791 _self.transition.fade(_self.objects.contentInner, 'in', _self.settings.speedIn); 32792 break; 32793 case 'elastic': 32794 if (_self.objects.case.css('opacity') < 1) { 32795 _self.transition.zoom(_self.objects.case, 'in', _self.settings.speedIn); 32796 _self.transition.fade(_self.objects.contentInner, 'in', _self.settings.speedIn); 32797 } 32798 case 'fade': 32799 case 'fadeInline': 32800 _self.transition.fade(_self.objects.case, 'in', _self.settings.speedIn); 32801 _self.transition.fade(_self.objects.contentInner, 'in', _self.settings.speedIn); 32802 break; 32803 default: 32804 _self.transition.fade(_self.objects.case, 'in', 0); 32805 break; 32806 } 32807 32808 // End loading. 32809 _self._loading('end'); 32810 _self.isBusy = false; 32811 32812 // Set index of the first item opened 32813 if (!_self.cache.firstOpened) { 32814 _self.cache.firstOpened = _self.objectData.this; 32815 } 32816 32817 // Fade in the info with delay 32818 _self.objects.info.hide(); 32819 setTimeout(function () { 32820 _self.transition.fade(_self.objects.info, 'in', _self.settings.speedIn); 32821 }, _self.settings.speedIn); 32822 32823 // Call onFinish hook functions 32824 _self._callHooks(_self.settings.onFinish); 32825 }, 32826 32827 /** 32828 * Processes the content to show 32829 * 32830 * @return {void} 32831 */ 32832 _processContent: function () { 32833 _self.isBusy = true; 32834 32835 // Fade out the info at first 32836 _self.transition.fade(_self.objects.info, 'out', 0); 32837 32838 switch (_self.settings.transitionOut) { 32839 case 'scrollTop': 32840 case 'scrollRight': 32841 case 'scrollBottom': 32842 case 'scrollLeft': 32843 case 'scrollVertical': 32844 case 'scrollHorizontal': 32845 if (_self.objects.case.is(':hidden')) { 32846 _self.transition.fade(_self.objects.contentInner, 'out', 0); 32847 _self.transition.fade(_self.objects.case, 'out', 0, 0, function () { 32848 _self._loadContent(); 32849 }); 32850 } else { 32851 _self.transition.scroll(_self.objects.case, 'out', _self.settings.speedOut, function () { 32852 _self._loadContent(); 32853 }); 32854 } 32855 break; 32856 case 'fade': 32857 if (_self.objects.case.is(':hidden')) { 32858 _self.transition.fade(_self.objects.case, 'out', 0, 0, function () { 32859 _self._loadContent(); 32860 }); 32861 } else { 32862 _self.transition.fade(_self.objects.case, 'out', _self.settings.speedOut, 0, function () { 32863 _self._loadContent(); 32864 }); 32865 } 32866 break; 32867 case 'fadeInline': 32868 case 'elastic': 32869 if (_self.objects.case.is(':hidden')) { 32870 _self.transition.fade(_self.objects.case, 'out', 0, 0, function () { 32871 _self._loadContent(); 32872 }); 32873 } else { 32874 _self.transition.fade(_self.objects.contentInner, 'out', _self.settings.speedOut, 0, function () { 32875 _self._loadContent(); 32876 }); 32877 } 32878 break; 32879 default: 32880 _self.transition.fade(_self.objects.case, 'out', 0, 0, function () { 32881 _self._loadContent(); 32882 }); 32883 break; 32884 } 32885 }, 32886 32887 /** 32888 * Handles events for gallery buttons 32889 * 32890 * @return {void} 32891 */ 32892 _handleEvents: function () { 32893 _self._unbindEvents(); 32894 32895 _self.objects.nav.children().not(_self.objects.close).hide(); 32896 32897 // If slideshow is enabled, show play/pause and start timeout. 32898 if (_self.isSlideshowEnabled()) { 32899 // Only start the timeout if slideshow autostart is enabled and slideshow is not pausing 32900 if ( 32901 (_self.settings.slideshowAutoStart === true || _self.isSlideshowStarted) && 32902 !_self.objects.nav.hasClass(_self.settings.classPrefix + 'paused') 32903 ) { 32904 _self._startTimeout(); 32905 } else { 32906 _self._stopTimeout(); 32907 } 32908 } 32909 32910 if (_self.settings.liveResize) { 32911 _self._watchResizeInteraction(); 32912 } 32913 32914 _self.objects.close.click(function (event) { 32915 event.preventDefault(); 32916 _self.close(); 32917 }); 32918 32919 if (_self.settings.closeOnOverlayClick === true) { 32920 _self.objects.overlay.css('cursor', 'pointer').click(function (event) { 32921 event.preventDefault(); 32922 32923 _self.close(); 32924 }); 32925 } 32926 32927 if (_self.settings.useKeys === true) { 32928 _self._addKeyEvents(); 32929 } 32930 32931 if (_self.objectData.isPartOfSequence) { 32932 _self.objects.nav.attr(_self._prefixAttributeName('ispartofsequence'), true); 32933 _self.objects.nav.data('items', _self._setNavigation()); 32934 32935 _self.objects.prev.click(function (event) { 32936 event.preventDefault(); 32937 32938 if (_self.settings.navigateEndless === true || !_self.item.isFirst()) { 32939 _self.objects.prev.unbind('click'); 32940 _self.cache.action = 'prev'; 32941 _self.objects.nav.data('items').prev.click(); 32942 32943 if (_self.isSlideshowEnabled()) { 32944 _self._stopTimeout(); 32945 } 32946 } 32947 }); 32948 32949 _self.objects.next.click(function (event) { 32950 event.preventDefault(); 32951 32952 if (_self.settings.navigateEndless === true || !_self.item.isLast()) { 32953 _self.objects.next.unbind('click');
32954 _self.cache.action = 'next'; 32955 _self.objects.nav.data('items').next.click(); 32956 32957 if (_self.isSlideshowEnabled()) { 32958 _self._stopTimeout(); 32959 } 32960 } 32961 }); 32962 32963 if (_self.isSlideshowEnabled()) { 32964 _self.objects.play.click(function (event) { 32965 event.preventDefault(); 32966 _self._startTimeout(); 32967 }); 32968 _self.objects.pause.click(function (event) { 32969 event.preventDefault(); 32970 _self._stopTimeout(); 32971 }); 32972 } 32973 32974 // Enable swiping if activated 32975 if (_self.settings.swipe === true) { 32976 if ($.isPlainObject($.event.special.swipeleft)) { 32977 _self.objects.case.on('swipeleft', function (event) { 32978 event.preventDefault(); 32979 _self.objects.next.click(); 32980 if (_self.isSlideshowEnabled()) { 32981 _self._stopTimeout(); 32982 } 32983 }); 32984 } 32985 if ($.isPlainObject($.event.special.swiperight)) { 32986 _self.objects.case.on('swiperight', function (event) { 32987 event.preventDefault(); 32988 _self.objects.prev.click(); 32989 if (_self.isSlideshowEnabled()) { 32990 _self._stopTimeout(); 32991 } 32992 }); 32993 } 32994 } 32995 } 32996 }, 32997 32998 /** 32999 * Adds the key events 33000 * 33001 * @return {void} 33002 */ 33003 _addKeyEvents: function () { 33004 $(document).bind('keyup.lightcase', function (event) { 33005 // Do nothing if lightcase is in process 33006 if (_self.isBusy) { 33007 return; 33008 } 33009 33010 switch (event.keyCode) { 33011 // Escape key 33012 case 27: 33013 _self.objects.close.click(); 33014 break; 33015 // Backward key 33016 case 37: 33017 if (_self.objectData.isPartOfSequence) { 33018 _self.objects.prev.click(); 33019 } 33020 break; 33021 // Forward key 33022 case 39: 33023 if (_self.objectData.isPartOfSequence) { 33024 _self.objects.next.click(); 33025 } 33026 break; 33027 } 33028 }); 33029 }, 33030 33031 /** 33032 * Starts the slideshow timeout 33033 * 33034 * @return {void} 33035 */ 33036 _startTimeout: function () { 33037 _self.isSlideshowStarted = true; 33038 33039 _self.objects.play.hide(); 33040 _self.objects.pause.show(); 33041 33042 _self.cache.action = 'next'; 33043 _self.objects.nav.removeClass(_self.settings.classPrefix + 'paused'); 33044 33045 _self.timeout = setTimeout(function () { 33046 _self.objects.nav.data('items').next.click(); 33047 }, _self.settings.timeout); 33048 }, 33049 33050 /** 33051 * Stops the slideshow timeout 33052 * 33053 * @return {void} 33054 */ 33055 _stopTimeout: function () { 33056 _self.objects.play.show(); 33057 _self.objects.pause.hide(); 33058 33059 _self.objects.nav.addClass(_self.settings.classPrefix + 'paused'); 33060 33061 clearTimeout(_self.timeout); 33062 }, 33063 33064 /** 33065 * Sets the navigator buttons (prev/next) 33066 * 33067 * @return {object} items 33068 */ 33069 _setNavigation: function () { 33070 var $links = $((_self.cache.selector || _self.settings.attr)), 33071 sequenceLength = _self.objectData.sequenceLength - 1, 33072 items = { 33073 prev: $links.eq(_self.objectData.prevIndex), 33074 next: $links.eq(_self.objectData.nextIndex) 33075 }; 33076 33077 if (_self.objectData.currentIndex > 0) { 33078 _self.objects.prev.show(); 33079 } else { 33080 items.prevItem = $links.eq(sequenceLength); 33081 } 33082 if (_self.objectData.nextIndex <= sequenceLength) { 33083 _self.objects.next.show(); 33084 } else { 33085 items.next = $links.eq(0); 33086 } 33087 33088 if (_self.settings.navigateEndless === true) { 33089 _self.objects.prev.show(); 33090 _self.objects.next.show(); 33091 } 33092 33093 return items; 33094 }, 33095 33096 /** 33097 * Item information/status 33098 * 33099 */ 33100 item: { 33101 /** 33102 * Verifies if the current item is first item. 33103 * 33104 * @return {boolean} 33105 */ 33106 isFirst: function () { 33107 return (_self.objectData.currentIndex === 0); 33108 }, 33109 33110 /** 33111 * Verifies if the current item is first item opened. 33112 * 33113 * @return {boolean} 33114 */ 33115 isFirstOpened: function () { 33116 return _self.objectData.this.is(_self.cache.firstOpened); 33117 }, 33118 33119 /** 33120 * Verifies if the current item is last item. 33121 * 33122 * @return {boolean} 33123 */ 33124 isLast: function () { 33125 return (_self.objectData.currentIndex === (_self.objectData.sequenceLength - 1)); 33126 } 33127 }, 33128 33129 /** 33130 * Clones the object for inline elements 33131 * 33132 * @param {object} $object 33133 * @return {object} $clone 33134 */ 33135 _cloneObject: function ($object) { 33136 var $clone = $object.clone(), 33137 objectId = $object.attr('id'); 33138 33139 // If element is hidden, cache the object and remove 33140 if ($object.is(':hidden')) { 33141 _self._cacheObjectData($object); 33142 $object.attr('id', _self.settings.idPrefix + 'temp-' + objectId).empty(); 33143 } else { 33144 // Prevent duplicated id's 33145 $clone.removeAttr('id'); 33146 } 33147 33148 return $clone.show(); 33149 }, 33150 33151 /** 33152 * Verifies if it is a mobile device 33153 * 33154 * @return {boolean} 33155 */ 33156 isMobileDevice: function () { 33157 var deviceAgent = navigator.userAgent.toLowerCase(), 33158 agentId = deviceAgent.match(_self.settings.mobileMatchExpression); 33159 33160 return agentId ? true : false;
33161 }, 33162 33163 /** 33164 * Verifies if css transitions are supported 33165 * 33166 * @return {string|boolean} The transition prefix if supported, else false. 33167 */ 33168 isTransitionSupported: function () { 33169 var body = _self.objects.body.get(0), 33170 isTransitionSupported = false, 33171 transitionMapping = { 33172 'transition': '', 33173 'WebkitTransition': '-webkit-', 33174 'MozTransition': '-moz-', 33175 'OTransition': '-o-', 33176 'MsTransition': '-ms-' 33177 }; 33178 33179 for (var key in transitionMapping) { 33180 if (transitionMapping.hasOwnProperty(key) && key in body.style) { 33181 _self.support.transition = transitionMapping[key]; 33182 isTransitionSupported = true; 33183 } 33184 } 33185 33186 return isTransitionSupported; 33187 }, 33188 33189 /** 33190 * Transition types 33191 * 33192 */ 33193 transition: { 33194 /** 33195 * Returns the correct transition type according to the status of interaction. 33196 * 33197 * @return {string} Transition type 33198 */ 33199 in: function () { 33200 if (_self.settings.transitionOpen && !_self.cache.firstOpened) { 33201 return _self.settings.transitionOpen; 33202 } 33203 return _self.settings.transitionIn; 33204 }, 33205 33206 /** 33207 * Fades in/out the object 33208 * 33209 * @param {object} $object 33210 * @param {string} type 33211 * @param {number} speed 33212 * @param {number} opacity 33213 * @param {function} callback 33214 * @return {void} Animates an object 33215 */ 33216 fade: function ($object, type, speed, opacity, callback) { 33217 var isInTransition = type === 'in', 33218 startTransition = {}, 33219 startOpacity = $object.css('opacity'), 33220 endTransition = {}, 33221 endOpacity = opacity ? opacity: isInTransition ? 1 : 0; 33222 33223 if (!_self.isOpen && isInTransition) return; 33224 33225 startTransition['opacity'] = startOpacity; 33226 endTransition['opacity'] = endOpacity; 33227 33228 $object.css(_self.support.transition + 'transition', 'none'); 33229 $object.css(startTransition).show(); 33230 33231 // Css transition 33232 if (_self.support.transitions) { 33233 endTransition[_self.support.transition + 'transition'] = speed + 'ms ease'; 33234 33235 setTimeout(function () { 33236 $object.css(endTransition); 33237 33238 setTimeout(function () { 33239 $object.css(_self.support.transition + 'transition', ''); 33240 33241 if (callback && (_self.isOpen || !isInTransition)) { 33242 callback(); 33243 } 33244 }, speed); 33245 }, 15); 33246 } else { 33247 // Fallback to js transition 33248 $object.stop(); 33249 $object.animate(endTransition, speed, callback); 33250 } 33251 }, 33252 33253 /** 33254 * Scrolls in/out the object 33255 * 33256 * @param {object} $object 33257 * @param {string} type 33258 * @param {number} speed 33259 * @param {function} callback 33260 * @return {void} Animates an object 33261 */ 33262 scroll: function ($object, type, speed, callback) { 33263 var isInTransition = type === 'in', 33264 transition = isInTransition ? _self.settings.transitionIn : _self.settings.transitionOut, 33265 direction = 'left', 33266 startTransition = {}, 33267 startOpacity = isInTransition ? 0 : 1, 33268 startOffset = isInTransition ? '-50%' : '50%', 33269 endTransition = {}, 33270 endOpacity = isInTransition ? 1 : 0, 33271 endOffset = isInTransition ? '50%' : '-50%'; 33272 33273 if (!_self.isOpen && isInTransition) return; 33274 33275 switch (transition) { 33276 case 'scrollTop': 33277 direction = 'top'; 33278 break; 33279 case 'scrollRight': 33280 startOffset = isInTransition ? '150%' : '50%'; 33281 endOffset = isInTransition ? '50%' : '150%'; 33282 break; 33283 case 'scrollBottom': 33284 direction = 'top'; 33285 startOffset = isInTransition ? '150%' : '50%'; 33286 endOffset = isInTransition ? '50%' : '150%'; 33287 break; 33288 case 'scrollHorizontal': 33289 startOffset = isInTransition ? '150%' : '50%'; 33290 endOffset = isInTransition ? '50%' : '-50%'; 33291 break; 33292 case 'scrollVertical': 33293 direction = 'top'; 33294 startOffset = isInTransition ? '-50%' : '50%'; 33295 endOffset = isInTransition ? '50%' : '150%'; 33296 break; 33297 } 33298 33299 if (_self.cache.action === 'prev') { 33300 switch (transition) { 33301 case 'scrollHorizontal': 33302 startOffset = isInTransition ? '-50%' : '50%'; 33303 endOffset = isInTransition ? '50%' : '150%'; 33304 break; 33305 case 'scrollVertical': 33306 startOffset = isInTransition ? '150%' : '50%'; 33307 endOffset = isInTransition ? '50%' : '-50%'; 33308 break; 33309 } 33310 } 33311 33312 startTransition['opacity'] = startOpacity; 33313 startTransition[direction] = startOffset; 33314 33315 endTransition['opacity'] = endOpacity; 33316 endTransition[direction] = endOffset; 33317 33318 $object.css(_self.support.transition + 'transition', 'none'); 33319 $object.css(startTransition).show(); 33320 33321 // Css transition 33322 if (_self.support.transitions) { 33323 endTransition[_self.support.transition + 'transition'] = speed + 'ms ease'; 33324 33325 setTimeout(function () { 33326 $object.css(endTransition); 33327 33328 setTimeout(function () { 33329 $object.css(_self.support.transition + 'transition', ''); 33330 33331 if (callback && (_self.isOpen || !isInTransition)) { 33332 callback(); 33333 } 33334 }, speed); 33335 }, 15); 33336 } else { 33337 // Fallback to js transition 33338 $object.stop(); 33339 $object.animate(endTransition, speed, callback); 33340 } 33341 }, 33342 33343 /** 33344 * Zooms in/out the object 33345 * 33346 * @param {object} $object 33347 * @param {string} type 33348 * @param {number} speed 33349 * @param {function} callback 33350 * @return {void} Animates an object 33351 */ 33352 zoom: function ($object, type, speed, callback) { 33353 var isInTransition = type === 'in', 33354 startTransition = {}, 33355 startOpacity = $object.css('opacity'), 33356 startScale = isInTransition ? 'scale(0.75)' : 'scale(1)', 33357 endTransition = {}, 33358 endOpacity = isInTransition ? 1 : 0, 33359 endScale = isInTransition ? 'scale(1)' : 'scale(0.75)'; 33360 33361 if (!_self.isOpen && isInTransition) return; 33362 33363 startTransition['opacity'] = startOpacity; 33364 startTransition[_self.support.transition + 'transform'] = startScale; 33365 33366 endTransition['opacity'] = endOpacity; 33367 33368 $object.css(_self.support.transition + 'transition', 'none'); 33369 $object.css(startTransition).show(); 33370 33371 // Css transition 33372 if (_self.support.transitions) { 33373 endTransition[_self.support.transition + 'transform'] = endScale; 33374 endTransition[_self.support.transition + 'transition'] = speed + 'ms ease'; 33375 33376 setTimeout(function () { 33377 $object.css(endTransition); 33378 33379 setTimeout(function () { 33380 $object.css(_self.support.transition + 'transform', ''); 33381 $object.css(_self.support.transition + 'transition', ''); 33382 33383 if (callback && (_self.isOpen || !isInTransition)) { 33384 callback(); 33385 } 33386 }, speed); 33387 }, 15); 33388 } else { 33389 // Fallback to js transition 33390 $object.stop(); 33391 $object.animate(endTransition, speed, callback); 33392 } 33393 } 33394 }, 33395 33396 /** 33397 * Calls all the registered functions of a specific hook 33398 * 33399 * @param {object} hooks 33400 * @return {void} 33401 */ 33402 _callHooks: function (hooks) { 33403 if (typeof(hooks) === 'object') { 33404 $.each(hooks, function(index, hook) { 33405 if (typeof(hook) === 'function') { 33406 hook.call(_self.origin); 33407 } 33408 }); 33409 } 33410 }, 33411 33412 /** 33413 * Caches the object data 33414 * 33415 * @param {object} $object 33416 * @return {void} 33417 */ 33418 _cacheObjectData: function ($object) { 33419 $.data($object, 'cache', { 33420 id: $object.attr('id'), 33421 content: $object.html() 33422 }); 33423 33424 _self.cache.originalObject = $object; 33425 }, 33426 33427 /** 33428 * Restores the object from cache 33429 * 33430 * @return void 33431 */ 33432 _restoreObject: function () { 33433 var $object = $('[id^="' + _self.settings.idPrefix + 'temp-"]'); 33434 33435 $object.attr('id', $.data(_self.cache.originalObject, 'cache').id); 33436 $object.html($.data(_self.cache.originalObject, 'cache').content); 33437 }, 33438 33439 /** 33440 * Executes functions for a window resize. 33441 * It stops an eventual timeout and recalculates dimensions. 33442 * 33443 * @param {object} dimensions 33444 * @return {void} 33445 */ 33446 resize: function (event, dimensions) { 33447 if (!_self.isOpen) return; 33448 33449 if (_self.isSlideshowEnabled()) { 33450 _self._stopTimeout(); 33451 } 33452 33453 if (typeof dimensions === 'object' && dimensions !== null) { 33454 if (dimensions.width) { 33455 _self.cache.object.attr( 33456 _self._prefixAttributeName('width'), 33457 dimensions.width 33458 ); 33459 } 33460 if (dimensions.maxWidth) { 33461 _self.cache.object.attr( 33462 _self._prefixAttributeName('max-width'), 33463 dimensions.maxWidth 33464 ); 33465 } 33466 if (dimensions.height) { 33467 _self.cache.object.attr( 33468 _self._prefixAttributeName('height'), 33469 dimensions.height 33470 ); 33471 } 33472 if (dimensions.maxHeight) { 33473 _self.cache.object.attr( 33474 _self._prefixAttributeName('max-height'), 33475 dimensions.maxHeight 33476 ); 33477 } 33478 } 33479 33480 _self.dimensions = _self.getViewportDimensions(); 33481 _self._calculateDimensions(_self.cache.object); 33482 33483 // Call onResize hook functions 33484 _self._callHooks(_self.settings.onResize); 33485 }, 33486 33487 /** 33488 * Watches for any resize interaction and caches the new sizes. 33489 * 33490 * @return {void} 33491 */ 33492 _watchResizeInteraction: function () { 33493 $(window).resize(_self.resize); 33494 }, 33495 33496 /** 33497 * Stop watching any resize interaction related to _self. 33498 * 33499 * @return {void} 33500 */ 33501 _unwatchResizeInteraction: function () { 33502 $(window).off('resize', _self.resize); 33503 }, 33504 33505 /** 33506 * Switches to the fullscreen mode 33507 * 33508 * @return {void} 33509 */ 33510 _switchToFullScreenMode: function () { 33511 _self.settings.shrinkFactor = 1; 33512 _self.settings.overlayOpacity = 1; 33513 33514 $('html').addClass(_self.settings.classPrefix + 'fullScreenMode'); 33515 }, 33516 33517 /** 33518 * Enters into the lightcase view 33519 * 33520 * @return {void} 33521 */ 33522 _open: function () { 33523 _self.isOpen = true; 33524 33525 _self.support.transitions = _self.settings.cssTransitions ? _self.isTransitionSupported() : false;
33526 _self.support.mobileDevice = _self.isMobileDevice(); 33527 33528 if (_self.support.mobileDevice) { 33529 $('html').addClass(_self.settings.classPrefix + 'isMobileDevice'); 33530 33531 if (_self.settings.fullScreenModeForMobile) { 33532 _self._switchToFullScreenMode(); 33533 } 33534 } 33535 33536 if (!_self.settings.transitionIn) { 33537 _self.settings.transitionIn = _self.settings.transition; 33538 } 33539 if (!_self.settings.transitionOut) { 33540 _self.settings.transitionOut = _self.settings.transition; 33541 } 33542 33543 switch (_self.transition.in()) { 33544 case 'fade': 33545 case 'fadeInline': 33546 case 'elastic': 33547 case 'scrollTop': 33548 case 'scrollRight': 33549 case 'scrollBottom': 33550 case 'scrollLeft': 33551 case 'scrollVertical': 33552 case 'scrollHorizontal': 33553 if (_self.objects.case.is(':hidden')) { 33554 _self.objects.close.css('opacity', 0); 33555 _self.objects.overlay.css('opacity', 0); 33556 _self.objects.case.css('opacity', 0); 33557 _self.objects.contentInner.css('opacity', 0); 33558 } 33559 _self.transition.fade(_self.objects.overlay, 'in', _self.settings.speedIn, _self.settings.overlayOpacity, function () { 33560 _self.transition.fade(_self.objects.close, 'in', _self.settings.speedIn); 33561 _self._handleEvents(); 33562 _self._processContent(); 33563 }); 33564 break; 33565 default: 33566 _self.transition.fade(_self.objects.overlay, 'in', 0, _self.settings.overlayOpacity, function () { 33567 _self.transition.fade(_self.objects.close, 'in', 0); 33568 _self._handleEvents(); 33569 _self._processContent(); 33570 }); 33571 break; 33572 } 33573 33574 _self.objects.document.addClass(_self.settings.classPrefix + 'open'); 33575 _self.objects.case.attr('aria-hidden', 'false'); 33576 }, 33577 33578 /** 33579 * Shows the lightcase by starting the transition 33580 */ 33581 show: function () { 33582 // Call onCalculateDimensions hook functions 33583 _self._callHooks(_self.settings.onBeforeCalculateDimensions); 33584 33585 _self._calculateDimensions(_self.cache.object); 33586 33587 // Call onAfterCalculateDimensions hook functions 33588 _self._callHooks(_self.settings.onAfterCalculateDimensions); 33589 33590 _self._startInTransition(); 33591 }, 33592 33593 /** 33594 * Escapes from the lightcase view 33595 * 33596 * @return {void} 33597 */ 33598 close: function () { 33599 _self.isOpen = false; 33600 33601 if (_self.isSlideshowEnabled()) { 33602 _self._stopTimeout(); 33603 _self.isSlideshowStarted = false; 33604 _self.objects.nav.removeClass(_self.settings.classPrefix + 'paused'); 33605 } 33606 33607 _self.objects.loading.hide(); 33608 33609 _self._unbindEvents(); 33610 33611 _self._unwatchResizeInteraction(); 33612 33613 $('html').removeClass(_self.settings.classPrefix + 'open'); 33614 _self.objects.case.attr('aria-hidden', 'true'); 33615 33616 _self.objects.nav.children().hide(); 33617 _self.objects.close.hide(); 33618 33619 // Call onClose hook functions 33620 _self._callHooks(_self.settings.onClose); 33621 33622 // Fade out the info at first 33623 _self.transition.fade(_self.objects.info, 'out', 0); 33624 33625 switch (_self.settings.transitionClose || _self.settings.transitionOut) { 33626 case 'fade': 33627 case 'fadeInline': 33628 case 'scrollTop': 33629 case 'scrollRight': 33630 case 'scrollBottom': 33631 case 'scrollLeft': 33632 case 'scrollHorizontal': 33633 case 'scrollVertical': 33634 _self.transition.fade(_self.objects.case, 'out', _self.settings.speedOut, 0, function () { 33635 _self.transition.fade(_self.objects.overlay, 'out', _self.settings.speedOut, 0, function () { 33636 _self.cleanup(); 33637 }); 33638 }); 33639 break; 33640 case 'elastic': 33641 _self.transition.zoom(_self.objects.case, 'out', _self.settings.speedOut, function () { 33642 _self.transition.fade(_self.objects.overlay, 'out', _self.settings.speedOut, 0, function () { 33643 _self.cleanup(); 33644 }); 33645 }); 33646 break; 33647 default: 33648 _self.cleanup(); 33649 break; 33650 } 33651 }, 33652 33653 /** 33654 * Unbinds all given events 33655 * 33656 * @return {void} 33657 */ 33658 _unbindEvents: function () { 33659 // Unbind overlay event 33660 _self.objects.overlay.unbind('click'); 33661 33662 // Unbind key events 33663 $(document).unbind('keyup.lightcase'); 33664 33665 // Unbind swipe events 33666 _self.objects.case.unbind('swipeleft').unbind('swiperight'); 33667 33668 // Unbind navigator events 33669 _self.objects.prev.unbind('click'); 33670 _self.objects.next.unbind('click'); 33671 _self.objects.play.unbind('click'); 33672 _self.objects.pause.unbind('click'); 33673 33674 // Unbind close event 33675 _self.objects.close.unbind('click'); 33676 }, 33677 33678 /** 33679 * Cleans up the dimensions 33680 * 33681 * @return {void} 33682 */ 33683 _cleanupDimensions: function () { 33684 var opacity = _self.objects.contentInner.css('opacity'); 33685 33686 _self.objects.case.css({ 33687 'width': '', 33688 'height': '', 33689 'top': '', 33690 'left': '', 33691 'margin-top': '', 33692 'margin-left': '' 33693 }); 33694 33695 _self.objects.contentInner.removeAttr('style').css('opacity', opacity); 33696 _self.objects.contentInner.children().removeAttr('style'); 33697 }, 33698 33699 /** 33700 * Cleanup after aborting lightcase 33701 * 33702 * @return {void} 33703 */ 33704 cleanup: function () { 33705 _self._cleanupDimensions(); 33706 33707 _self.objects.loading.hide(); 33708 _self.objects.overlay.hide(); 33709 _self.objects.case.hide(); 33710 _self.objects.prev.hide(); 33711 _self.objects.next.hide(); 33712 _self.objects.play.hide(); 33713 _self.objects.pause.hide(); 33714 33715 _self.objects.document.removeAttr(_self._prefixAttributeName('type')); 33716 _self.objects.nav.removeAttr(_self._prefixAttributeName('ispartofsequence')); 33717 33718 _self.objects.contentInner.empty().hide(); 33719 _self.objects.info.children().empty(); 33720 33721 if (_self.cache.originalObject) { 33722 _self._restoreObject(); 33723 } 33724 33725 // Call onCleanup hook functions 33726 _self._callHooks(_self.settings.onCleanup); 33727 33728 // Restore cache 33729 _self.cache = {}; 33730 }, 33731 33732 /** 33733 * Returns the supported match media or undefined if the browser 33734 * doesn't support match media. 33735 * 33736 * @return {mixed} 33737 */ 33738 _matchMedia: function () { 33739 return window.matchMedia || window.msMatchMedia; 33740 }, 33741 33742 /** 33743 * Returns the devicePixelRatio if supported. Else, it simply returns 33744 * 1 as the default. 33745 * 33746 * @return {number} 33747 */ 33748 _devicePixelRatio: function () { 33749 return window.devicePixelRatio || 1; 33750 }, 33751 33752 /** 33753 * Checks if method is public 33754 * 33755 * @return {boolean} 33756 */ 33757 _isPublicMethod: function (method) { 33758 return (typeof _self[method] === 'function' && method.charAt(0) !== '_'); 33759 }, 33760 33761 /** 33762 * Exports all public methods to be accessible, callable 33763 * from global scope. 33764 * 33765 * @return {void} 33766 */ 33767 _export: function () { 33768 window.lightcase = {}; 33769 33770 $.each(_self, function (property) { 33771 if (_self._isPublicMethod(property)) { 33772 lightcase[property] = _self[property]; 33773 } 33774 }); 33775 } 33776 }; 33777 33778 _self._export(); 33779 33780 $.fn.lightcase = function (method) { 33781 // Method calling logic (only public methods are applied)
33782 if (_self._isPublicMethod(method)) { 33783 return _self[method].apply(this, Array.prototype.slice.call(arguments, 1)); 33784 } else if (typeof method === 'object' || !method) { 33785 return _self.init.apply(this, arguments); 33786 } else { 33787 $.error('Method ' + method + ' does not exist on jQuery.lightcase'); 33788 } 33789 }; 33790 })(jQuery); 33791 33792 33793/***/ }), 33794/* 435 */ 33795/***/ (function(module, exports) { 33796 33797 /* 33798 * simplyScroll 2 - a scroll-tastic jQuery plugin 33799 * 33800 * http://logicbox.net/jquery/simplyscroll/ 33801 * 33802 * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net 33803 * 33804 * Dual licensed under the MIT and GPL licenses. 33805 * 33806 * Version: 2.0.5 Last revised: 10/05/2012 33807 * 33808 */ 33809 "use strict"; 33810 33811 (function (c, j, i) { 33812 c.fn.simplyScroll = function (a) { 33813 return this.each(function () { 33814 new c.simplyScroll(this, a); 33815 }); 33816 };var h = { customClass: "simply-scroll", frameRate: 24, speed: 1, orientation: "horizontal", auto: !0, autoMode: "loop", manualMode: "end", direction: "forwards", pauseOnHover: !0, pauseOnTouch: !0, pauseButton: !1, startOnLoad: !1 };c.simplyScroll = function (a, b) { 33817 var g = this;this.o = c.extend({}, h, b || {});this.isAuto = !1 !== this.o.auto && null !== this.o.autoMode.match(/^loop|bounce$/);this.isRTL = (this.isHorizontal = null !== this.o.orientation.match(/^horizontal|vertical$/) && this.o.orientation == h.orientation) && "rtl" == c("html").attr("dir");this.isForwards = !this.isAuto || this.isAuto && null !== this.o.direction.match(/^forwards|backwards$/) && this.o.direction == h.direction && !this.isRTL;this.isLoop = this.isAuto && "loop" == this.o.autoMode || !this.isAuto && "loop" == this.o.manualMode;this.events = (this.supportsTouch = "createTouch" in document) ? { start: "touchstart MozTouchDown", move: "touchmove MozTouchMove", end: "touchend touchcancel MozTouchRelease" } : { start: "mouseenter", end: "mouseleave" }; 33818 this.$list = c(a);var d = this.$list.children();this.$list.addClass("simply-scroll-list").wrap('<div class="simply-scroll-clip"></div>').parent().wrap('<div class="' + this.o.customClass + ' simply-scroll-container"></div>');this.isAuto ? this.o.pauseButton && (this.$list.parent().parent().prepend('<div class="simply-scroll-btn simply-scroll-btn-pause"></div>'), this.o.pauseOnHover = !1) : this.$list.parent().parent().prepend('<div class="simply-scroll-forward"></div>').prepend('<div class="simply-scroll-back"></div>'); 33819 if (1 < d.length) { 33820 var f = !1, 33821 e = 0;this.isHorizontal ? (d.each(function () { 33822 e = e + c(this).outerWidth(true); 33823 }), f = d.eq(0).outerWidth(!0) * d.length !== e) : (d.each(function () { 33824 e = e + c(this).outerHeight(true); 33825 }), f = d.eq(0).outerHeight(!0) * d.length !== e);f && (this.$list = this.$list.wrap("<div></div>").parent().addClass("simply-scroll-list"), this.isHorizontal ? this.$list.children().css({ "float": "left", width: e + "px" }) : this.$list.children().css({ height: e + "px" })); 33826 }this.o.startOnLoad ? c(j).load(function () { 33827 g.init(); 33828 }) : this.init(); 33829 };c.simplyScroll.fn = c.simplyScroll.prototype = {};c.simplyScroll.fn.extend = c.simplyScroll.extend = c.extend;c.simplyScroll.fn.extend({ init: function init() { 33830 this.$items = this.$list.children();this.$clip = this.$list.parent();this.$container = this.$clip.parent();this.$btnBack = c(".simply-scroll-back", this.$container);this.$btnForward = c(".simply-scroll-forward", this.$container);this.isHorizontal ? (this.itemMax = this.$items.eq(0).outerWidth(!0), this.clipMax = this.$clip.width(), this.dimension = "width", this.moveBackClass = "simply-scroll-btn-left", this.moveForwardClass = "simply-scroll-btn-right", this.scrollPos = "Left") : (this.itemMax = this.$items.eq(0).outerHeight(!0), this.clipMax = this.$clip.height(), this.dimension = "height", this.moveBackClass = "simply-scroll-btn-up", this.moveForwardClass = "simply-scroll-btn-down", this.scrollPos = "Top");this.posMin = 0;this.posMax = this.$items.length * this.itemMax;var a = Math.ceil(this.clipMax / this.itemMax);if (this.isAuto && "loop" == this.o.autoMode) this.$list.css(this.dimension, this.posMax + this.itemMax * a + "px"), this.posMax += this.clipMax - this.o.speed, this.isForwards ? (this.$items.slice(0, a).clone(!0).appendTo(this.$list), this.resetPosition = 0) : (this.$items.slice(-a).clone(!0).prependTo(this.$list), this.resetPosition = this.$items.length * this.itemMax, this.isRTL && (this.$clip[0].dir = "ltr", this.isHorizontal() && this.$items.css("float", "right")));else if (!this.isAuto && "loop" == this.o.manualMode) { 33831 this.posMax += this.itemMax * a;this.$list.css(this.dimension, this.posMax + this.itemMax * a + "px");this.posMax += this.clipMax - this.o.speed;this.$items.slice(0, a).clone(!0).appendTo(this.$list);this.$items.slice(-a).clone(!0).prependTo(this.$list);this.resetPositionForwards = this.resetPosition = a * this.itemMax;this.resetPositionBackwards = this.$items.length * this.itemMax;var b = this;this.$btnBack.bind(this.events.start, function () { 33832 b.isForwards = false;b.resetPosition = b.resetPositionBackwards; 33833 });this.$btnForward.bind(this.events.start, function () { 33834 b.isForwards = true;b.resetPosition = b.resetPositionForwards; 33835 }); 33836 } else this.$list.css(this.dimension, this.posMax + "px"), this.isForwards ? this.resetPosition = 0 : (this.resetPosition = this.$items.length * this.itemMax, this.isRTL && (this.$clip[0].dir = "ltr"));this.resetPos();this.interval = null;this.intervalDelay = Math.floor(1E3 / this.o.frameRate);if (this.isAuto || "end" != this.o.manualMode) for (; 0 !== this.itemMax % this.o.speed;) if ((this.o.speed--, 0 === this.o.speed)) { 33837 this.o.speed = 1;break; 33838 }b = this;this.trigger = null;this.funcMoveBack = function (a) { 33839 a !== i && a.preventDefault();b.trigger = !b.isAuto && b.o.manualMode == "end" ? this : null;b.isAuto ? b.isForwards ? b.moveBack() : b.moveForward() : b.moveBack(); 33840 };this.funcMoveForward = function (a) { 33841 a !== i && a.preventDefault();b.trigger = !b.isAuto && b.o.manualMode == "end" ? this : null;b.isAuto ? b.isForwards ? b.moveForward() : b.moveBack() : b.moveForward(); 33842 };this.funcMovePause = function () { 33843 b.movePause(); 33844 };this.funcMoveStop = function () { 33845 b.moveStop(); 33846 };this.funcMoveResume = function () { 33847 b.moveResume(); 33848 };if (this.isAuto) { 33849 this.paused = !1;var g = function g() { 33850 if (b.paused === false) { 33851 b.paused = true;b.funcMovePause(); 33852 } else { 33853 b.paused = false;b.funcMoveResume(); 33854 }return b.paused; 33855 }; 33856 this.supportsTouch && this.$items.find("a").length && (this.supportsTouch = !1);if (this.isAuto && this.o.pauseOnHover && !this.supportsTouch) this.$clip.bind(this.events.start, this.funcMovePause).bind(this.events.end, this.funcMoveResume);else if (this.isAuto && this.o.pauseOnTouch && !this.o.pauseButton && this.supportsTouch) { 33857 var d, f;this.$clip.bind(this.events.start, function (a) { 33858 g();var c = a.originalEvent.touches[0];d = b.isHorizontal ? c.pageX : c.pageY;f = b.$clip[0]["scroll" + b.scrollPos];a.stopPropagation();a.preventDefault(); 33859 }).bind(this.events.move, function (a) { 33860 a.stopPropagation();a.preventDefault();a = a.originalEvent.touches[0];a = d - (b.isHorizontal ? a.pageX : a.pageY) + f;if (a < 0) a = 0;else if (a > b.posMax) a = b.posMax;b.$clip[0]["scroll" + b.scrollPos] = a;b.funcMovePause();b.paused = true; 33861 }); 33862 } else this.o.pauseButton && (this.$btnPause = c(".simply-scroll-btn-pause", this.$container).bind("click", function (a) { 33863 a.preventDefault();g() ? c(this).addClass("active") : c(this).removeClass("active"); 33864 }));this.funcMoveForward(); 33865 } else this.$btnBack.addClass("simply-scroll-btn " + this.moveBackClass).bind(this.events.start, this.funcMoveBack).bind(this.events.end, this.funcMoveStop), this.$btnForward.addClass("simply-scroll-btn " + this.moveForwardClass).bind(this.events.start, this.funcMoveForward).bind(this.events.end, this.funcMoveStop), "end" == this.o.manualMode && (!this.isRTL ? this.$btnBack.addClass("disabled") : this.$btnForward.addClass("disabled")); 33866 }, moveForward: function moveForward() { 33867 var a = this;this.movement = "forward";null !== this.trigger && this.$btnBack.removeClass("disabled");a.interval = setInterval(function () { 33868 a.$clip[0]["scroll" + a.scrollPos] < a.posMax - a.clipMax ? a.$clip[0]["scroll" + a.scrollPos] += a.o.speed : a.isLoop ? a.resetPos() : a.moveStop(a.movement); 33869 }, a.intervalDelay); 33870 }, moveBack: function moveBack() { 33871 var a = this;this.movement = "back";null !== this.trigger && this.$btnForward.removeClass("disabled");a.interval = setInterval(function () { 33872 a.$clip[0]["scroll" + a.scrollPos] > a.posMin ? a.$clip[0]["scroll" + a.scrollPos] -= a.o.speed : a.isLoop ? a.resetPos() : a.moveStop(a.movement); 33873 }, a.intervalDelay); 33874 }, movePause: function movePause() { 33875 clearInterval(this.interval); 33876 }, moveStop: function moveStop(a) { 33877 this.movePause(); 33878 null !== this.trigger && ("undefined" !== typeof a && c(this.trigger).addClass("disabled"), this.trigger = null);this.isAuto && "bounce" == this.o.autoMode && ("forward" == a ? this.moveBack() : this.moveForward()); 33879 }, moveResume: function moveResume() { 33880 "forward" == this.movement ? this.moveForward() : this.moveBack(); 33881 }, resetPos: function resetPos() { 33882 this.$clip[0]["scroll" + this.scrollPos] = this.resetPosition; 33883 } }); 33884 })(jQuery, window); 33885 33886/***/ }) 33887]); 33888//# sourceMappingURL=app.js.map
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.