vendor: 4,046 bytes, lines 1-145
1// modules are defined as an array 2// [ module function, map of requires ] 3// 4// map of requires is short require name -> numeric require 5// 6// anything defined in a previous bundle is accessed via the 7// orig method which is the require for previous bundles 8 9(function (modules, entry, mainEntry, parcelRequireName, globalName) { 10 /* eslint-disable no-undef */ 11 var globalObject = 12 typeof globalThis !== 'undefined' 13 ? globalThis 14 : typeof self !== 'undefined' 15 ? self 16 : typeof window !== 'undefined' 17 ? window 18 : typeof global !== 'undefined' 19 ? global 20 : {}; 21 /* eslint-enable no-undef */ 22 23 // Save the require from previous bundle to this closure if any 24 var previousRequire = 25 typeof globalObject[parcelRequireName] === 'function' && 26 globalObject[parcelRequireName]; 27 28 var cache = previousRequire.cache || {}; 29 // Do not use `require` to prevent Webpack from trying to bundle this call 30 var nodeRequire = 31 typeof module !== 'undefined' && 32 typeof module.require === 'function' && 33 module.require.bind(module); 34 35 function newRequire(name, jumped) { 36 if (!cache[name]) { 37 if (!modules[name]) { 38 // if we cannot find the module within our internal map or 39 // cache jump to the current global require ie. the last bundle 40 // that was added to the page. 41 var currentRequire = 42 typeof globalObject[parcelRequireName] === 'function' && 43 globalObject[parcelRequireName]; 44 if (!jumped && currentRequire) { 45 return currentRequire(name, true); 46 } 47 48 // If there are other bundles on this page the require from the 49 // previous one is saved to 'previousRequire'. Repeat this as 50 // many times as there are bundles until the module is found or 51 // we exhaust the require chain. 52 if (previousRequire) { 53 return previousRequire(name, true); 54 } 55 56 // Try the node require function if it exists. 57 if (nodeRequire && typeof name === 'string') { 58 return nodeRequire(name); 59 } 60 61 var err = new Error("Cannot find module '" + name + "'"); 62 err.code = 'MODULE_NOT_FOUND'; 63 throw err; 64 } 65 66 localRequire.resolve = resolve; 67 localRequire.cache = {}; 68 69 var module = (cache[name] = new newRequire.Module(name)); 70 71 modules[name][0].call( 72 module.exports, 73 localRequire, 74 module, 75 module.exports, 76 this 77 ); 78 } 79 80 return cache[name].exports; 81 82 function localRequire(x) { 83 var res = localRequire.resolve(x); 84 return res === false ? {} : newRequire(res); 85 } 86 87 function resolve(x) { 88 var id = modules[name][1][x]; 89 return id != null ? id : x; 90 } 91 } 92 93 function Module(moduleName) { 94 this.id = moduleName; 95 this.bundle = newRequire; 96 this.exports = {}; 97 } 98 99 newRequire.isParcelRequire = true; 100 newRequire.Module = Module; 101 newRequire.modules = modules; 102 newRequire.cache = cache; 103 newRequire.parent = previousRequire; 104 newRequire.register = function (id, exports) { 105 modules[id] = [ 106 function (require, module) { 107 module.exports = exports; 108 }, 109 {}, 110 ]; 111 }; 112 113 Object.defineProperty(newRequire, 'root', { 114 get: function () { 115 return globalObject[parcelRequireName]; 116 }, 117 }); 118 119 globalObject[parcelRequireName] = newRequire; 120 121 for (var i = 0; i < entry.length; i++) { 122 newRequire(entry[i]); 123 } 124 125 if (mainEntry) { 126 // Expose entry point to Node, AMD or browser globals 127 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js 128 var mainExports = newRequire(mainEntry); 129 130 // CommonJS 131 if (typeof exports === 'object' && typeof module !== 'undefined') { 132 module.exports = mainExports; 133 134 // RequireJS 135 } else if (typeof define === 'function' && define.amd) { 136 define(function () { 137 return mainExports; 138 }); 139 140 // <script> 141 } else if (globalName) { 142 this[globalName] = mainExports; 143 } 144 } 145})({"
145c1bPs":[function(require,module,exports) { 146var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 147var _asyncToGeneratorMjs = require("@swc/helpers/src/_async_to_generator.mjs"); 148var _asyncToGeneratorMjsDefault = parcelHelpers.interopDefault(_asyncToGeneratorMjs); 149var _toConsumableArrayMjs = require("@swc/helpers/src/_to_consumable_array.mjs"); 150var _toConsumableArrayMjsDefault = parcelHelpers.interopDefault(_toConsumableArrayMjs); 151var _tsGeneratorMjs = require("@swc/helpers/src/_ts_generator.mjs"); 152var _tsGeneratorMjsDefault = parcelHelpers.interopDefault(_tsGeneratorMjs); 153var global = arguments[3]; 154var HMR_HOST = null; 155var HMR_PORT = 51893; 156var HMR_SECURE = false; 157var HMR_ENV_HASH = "2aa3c0f7022c85bc"; 158module.bundle.HMR_BUNDLE_ID = "f55344070815b48a"; 159"use strict"; 160/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, chrome, browser, globalThis, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*:: 161import type { 162 HMRAsset, 163 HMRMessage, 164} from '@parcel/reporter-dev-server/src/HMRServer.js'; 165interface ParcelRequire { 166 (string): mixed; 167 cache: {|[string]: ParcelModule|}; 168 hotData: {|[string]: mixed|}; 169 Module: any; 170 parent: ?ParcelRequire; 171 isParcelRequire: true; 172 modules: {|[string]: [Function, {|[string]: string|}]|}; 173 HMR_BUNDLE_ID: string; 174 root: ParcelRequire; 175} 176interface ParcelModule { 177 hot: {| 178 data: mixed, 179 accept(cb: (Function) => void): void, 180 dispose(cb: (mixed) => void): void, 181 // accept(deps: Array<string> | string, cb: (Function) => void): void, 182 // decline(): void, 183 _acceptCallbacks: Array<(Function) => void>, 184 _disposeCallbacks: Array<(mixed) => void>, 185 |}; 186} 187interface ExtensionContext { 188 runtime: {| 189 reload(): void, 190 getURL(url: string): string; 191 getManifest(): {manifest_version: number, ...}; 192 |}; 193} 194declare var module: {bundle: ParcelRequire, ...}; 195declare var HMR_HOST: string; 196declare var HMR_PORT: string; 197declare var HMR_ENV_HASH: string; 198declare var HMR_SECURE: boolean; 199declare var chrome: ExtensionContext; 200declare var browser: ExtensionContext; 201declare var __parcel__import__: (string) => Promise<void>; 202declare var __parcel__importScripts__: (string) => Promise<void>; 203declare var globalThis: typeof self; 204declare var ServiceWorkerGlobalScope: Object; 205*/ var OVERLAY_ID = "__parcel__error__overlay__"; 206var OldModule = module.bundle.Module; 207function Module(moduleName) { 208 OldModule.call(this, moduleName); 209 this.hot = { 210 data: module.bundle.hotData[moduleName], 211 _acceptCallbacks: [], 212 _disposeCallbacks: [], 213 accept: function accept(fn) { 214 this._acceptCallbacks.push(fn || function() {}); 215 }, 216 dispose: function dispose(fn) { 217 this._disposeCallbacks.push(fn); 218 } 219 }; 220 module.bundle.hotData[moduleName] = undefined; 221} 222module.bundle.Module = Module; 223module.bundle.hotData = {}; 224var checkedAssets, assetsToDispose, assetsToAccept /*: Array<[ParcelRequire, string]> */ ; 225function getHostname() { 226 return HMR_HOST || (location.protocol.indexOf("http") === 0 ? location.hostname : "localhost"); 227} 228function getPort() { 229 return HMR_PORT || location.port; 230} // eslint-disable-next-line no-redeclare 231var parent = module.bundle.parent; 232if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== "undefined") { 233 var hostname = getHostname(); 234 var port = getPort(); 235 var protocol = HMR_SECURE || location.protocol == "https:" && !/localhost|127.0.0.1|0.0.0.0/.test(hostname) ? "wss" : "ws"; 236 var ws = new WebSocket(protocol + "://" + hostname + (port ? ":" + port : "") + "/"); // Web extension context 237 var extCtx = typeof chrome === "undefined" ? typeof browser === "undefined" ? null : browser : chrome; // Safari doesn't support sourceURL in error stacks. 238 // eval may also be disabled via CSP, so do a quick check. 239 var supportsSourceURL = false; 240 try { 241 (0, eval)('throw new Error("test"); //# sourceURL=test.js'); 242 } catch (err) { 243 supportsSourceURL = err.stack.includes("test.js"); 244 } // $FlowFixMe 245 ws.onmessage = function() { 246 var _ref = (0, _asyncToGeneratorMjsDefault.default)(function(event) { 247 var data, assets, handled, processedAssets, i, id, i1, id1, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, ansiDiagnostic, stack, overlay; 248 return (0, _tsGeneratorMjsDefault.default)(this, function(_state) { 249 switch(_state.label){ 250 case 0: 251 checkedAssets = {} /*: {|[string]: boolean|} */ ; 252 assetsToAccept = []; 253 assetsToDispose = []; 254 data = JSON.parse(event.data); 255 if (!(data.type === "update")) return [ 256 3, 257 3 258 ]; 259 // Remove error overlay if there is one 260 if (typeof document !== "undefined") removeErrorOverlay(); 261 assets = data.assets.filter(function(asset) { 262 return asset.envHash === HMR_ENV_HASH; 263 }); // Handle HMR Update 264 handled = assets.every(function(asset) { 265 return asset.type === "css" || asset.type === "js" && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle); 266 }); 267 if (!handled) return [ 268 3, 269 2 270 ]; 271 console.clear(); // Dispatch custom event so other runtimes (e.g React Refresh) are aware. 272 if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") window.dispatchEvent(new CustomEvent("parcelhmraccept")); 273 return [ 274 4, 275 hmrApplyUpdates(assets) 276 ]; 277 case 1: 278 _state.sent(); // Dispose all old assets. 279 processedAssets = {} /*: {|[string]: boolean|} */ ; 280 for(i = 0; i < assetsToDispose.length; i++){ 281 id = assetsToDispose[i][1]; 282 if (!processedAssets[id]) { 283 hmrDispose(assetsToDispose[i][0], id); 284 processedAssets[id] = true; 285 } 286 } // Run accept callbacks. This will also re-execute other disposed assets in topological order. 287 processedAssets = {}; 288 for(i1 = 0; i1 < assetsToAccept.length; i1++){ 289 id1 = assetsToAccept[i1][1]; 290 if (!processedAssets[id1]) { 291 hmrAccept(assetsToAccept[i1][0], id1); 292 processedAssets[id1] = true; 293 } 294 } 295 return [ 296 3, 297 3 298 ]; 299 case 2: 300 fullReload(); 301 _state.label = 3; 302 case 3: 303 if (data.type === "error") { 304 _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; 305 try { 306 // Log parcel errors to console 307 for(_iterator = data.diagnostics.ansi[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ 308 ansiDiagnostic = _step.value; 309 stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack; 310 console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + "\n" + stack + "\n\n" + ansiDiagnostic.hints.join("\n")); 311 } 312 } catch (err) {
313 _didIteratorError = true; 314 _iteratorError = err; 315 } finally{ 316 try { 317 if (!_iteratorNormalCompletion && _iterator.return != null) { 318 _iterator.return(); 319 } 320 } finally{ 321 if (_didIteratorError) { 322 throw _iteratorError; 323 } 324 } 325 } 326 if (typeof document !== "undefined") { 327 // Render the fancy html overlay 328 removeErrorOverlay(); 329 overlay = createErrorOverlay(data.diagnostics.html); // $FlowFixMe 330 document.body.appendChild(overlay); 331 } 332 } 333 return [ 334 2 335 ]; 336 } 337 }); 338 }); 339 return function(event) { 340 return _ref.apply(this, arguments); 341 }; 342 }(); 343 ws.onerror = function(e) { 344 console.error(e.message); 345 }; 346 ws.onclose = function() { 347 console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost"); 348 }; 349} 350function removeErrorOverlay() { 351 var overlay = document.getElementById(OVERLAY_ID); 352 if (overlay) { 353 overlay.remove(); 354 console.log("[parcel] ⨠Error resolved"); 355 } 356} 357function createErrorOverlay(diagnostics) { 358 var overlay = document.createElement("div"); 359 overlay.id = OVERLAY_ID; 360 var errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">'; 361 var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; 362 try { 363 for(var _iterator = diagnostics[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ 364 var diagnostic = _step.value; 365 var stack = diagnostic.frames.length ? diagnostic.frames.reduce(function(p, frame) { 366 return "".concat(p, '\n<a href="/__parcel_launch_editor?file=').concat(encodeURIComponent(frame.location), '" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">').concat(frame.location, "</a>\n").concat(frame.code); 367 }, "") : diagnostic.stack; 368 errorHTML += '\n <div>\n <div style="font-size: 18px; font-weight: bold; margin-top: 20px;">\n \uD83D\uDEA8 '.concat(diagnostic.message, "\n </div>\n <pre>").concat(stack, "</pre>\n <div>\n ").concat(diagnostic.hints.map(function(hint) { 369 return "<div>\uD83D\uDCA1 " + hint + "</div>"; 370 }).join(""), "\n </div>\n ").concat(diagnostic.documentation ? '<div>\uD83D\uDCDD <a style="color: violet" href="'.concat(diagnostic.documentation, '" target="_blank">Learn more</a></div>') : "", "\n </div>\n "); 371 } 372 } catch (err) { 373 _didIteratorError = true; 374 _iteratorError = err; 375 } finally{ 376 try { 377 if (!_iteratorNormalCompletion && _iterator.return != null) { 378 _iterator.return(); 379 } 380 } finally{ 381 if (_didIteratorError) { 382 throw _iteratorError; 383 } 384 } 385 } 386 errorHTML += "</div>"; 387 overlay.innerHTML = errorHTML; 388 return overlay; 389} 390function fullReload() { 391 if ("reload" in location) location.reload(); 392 else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload(); 393} 394function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ { 395 var modules = bundle.modules; 396 if (!modules) return []; 397 var parents = []; 398 var k, d, dep; 399 for(k in modules)for(d in modules[k][1]){ 400 dep = modules[k][1][d]; 401 if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([ 402 bundle, 403 k 404 ]); 405 } 406 if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id)); 407 return parents; 408} 409function updateLink(link) { 410 var newLink = link.cloneNode(); 411 newLink.onload = function() { 412 if (link.parentNode !== null) // $FlowFixMe 413 link.parentNode.removeChild(link); 414 }; 415 newLink.setAttribute("href", link.getAttribute("href").split("?")[0] + "?" + Date.now()); // $FlowFixMe 416 link.parentNode.insertBefore(newLink, link.nextSibling); 417} 418var cssTimeout = null; 419function reloadCSS() { 420 if (cssTimeout) return; 421 cssTimeout = setTimeout(function() { 422 var links = document.querySelectorAll('link[rel="stylesheet"]'); 423 for(var i = 0; i < links.length; i++){ 424 // $FlowFixMe[incompatible-type] 425 var href = links[i].getAttribute("href"); 426 var hostname = getHostname(); 427 var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort()); 428 var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer; 429 if (!absolute) updateLink(links[i]); 430 } 431 cssTimeout = null; 432 }, 50); 433} 434function hmrDownload(asset) { 435 if (asset.type === "js") { 436 if (typeof document !== "undefined") { 437 var script = document.createElement("script"); 438 script.src = asset.url + "?t=" + Date.now(); 439 if (asset.outputFormat === "esmodule") script.type = "module"; 440 return new Promise(function(resolve, reject) { 441 var _document$head; 442 script.onload = function() { 443 return resolve(script); 444 }; 445 script.onerror = reject; 446 (_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script); 447 }); 448 } else if (typeof importScripts === "function") { 449 // Worker scripts 450 if (asset.outputFormat === "esmodule") return import(asset.url + "?t=" + Date.now()); 451 else return new Promise(function(resolve, reject) { 452 try { 453 importScripts(asset.url + "?t=" + Date.now()); 454 resolve(); 455 } catch (err) { 456 reject(err); 457 } 458 }); 459 } 460 } 461} 462function hmrApplyUpdates(assets) { 463 return _hmrApplyUpdates.apply(this, arguments); 464} 465function _hmrApplyUpdates() { 466 _hmrApplyUpdates = (0, _asyncToGeneratorMjsDefault.default)(function(assets) { 467 var scriptsToRemove, promises; 468 return (0, _tsGeneratorMjsDefault.default)(this, function(_state) { 469 switch(_state.label){ 470 case 0: 471 global.parcelHotUpdate = Object.create(null); 472 _state.label = 1; 473 case 1: 474 _state.trys.push([ 475 1, 476 , 477 4, 478 5 479 ]); 480 if (!!supportsSourceURL) return [ 481 3, 482 3 483 ]; 484 promises = assets.map(function(asset) { 485 var _hmrDownload; 486 return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch(function(err) { 487 // Web extension bugfix for Chromium 488 // https://bugs.chromium.org/p/chromium/issues/detail?id=1255412#c12 489 if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3) { 490 if (typeof ServiceWorkerGlobalScope != "undefined" && global instanceof ServiceWorkerGlobalScope) { 491 extCtx.runtime.reload(); 492 return; 493 } 494 asset.url = extCtx.runtime.getURL("/__parcel_hmr_proxy__?url=" + encodeURIComponent(asset.url + "?t=" + Date.now())); 495 return hmrDownload(asset); 496 } 497 throw err; 498 }); 499 }); 500 return [ 501 4, 502 Promise.all(promises) 503 ]; 504 case 2: 505 scriptsToRemove = _state.sent(); 506 _state.label = 3; 507 case 3:
508 assets.forEach(function(asset) { 509 hmrApply(module.bundle.root, asset); 510 }); 511 return [ 512 3, 513 5 514 ]; 515 case 4: 516 delete global.parcelHotUpdate; 517 if (scriptsToRemove) scriptsToRemove.forEach(function(script) { 518 if (script) { 519 var _document$head2; 520 (_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script); 521 } 522 }); 523 return [ 524 7 525 ]; 526 case 5: 527 return [ 528 2 529 ]; 530 } 531 }); 532 }); 533 return _hmrApplyUpdates.apply(this, arguments); 534} 535function hmrApply(bundle, asset) { 536 var modules = bundle.modules; 537 if (!modules) return; 538 if (asset.type === "css") reloadCSS(); 539 else if (asset.type === "js") { 540 var deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID]; 541 if (deps) { 542 if (modules[asset.id]) { 543 // Remove dependencies that are removed and will become orphaned. 544 // This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload. 545 var oldDeps = modules[asset.id][1]; 546 for(var dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) { 547 var id = oldDeps[dep]; 548 var parents = getParents(module.bundle.root, id); 549 if (parents.length === 1) hmrDelete(module.bundle.root, id); 550 } 551 } 552 if (supportsSourceURL) // Global eval. We would use `new Function` here but browser 553 // support for source maps is better with eval. 554 (0, eval)(asset.output); 555 // $FlowFixMe 556 var fn = global.parcelHotUpdate[asset.id]; 557 modules[asset.id] = [ 558 fn, 559 deps 560 ]; 561 } else if (bundle.parent) hmrApply(bundle.parent, asset); 562 } 563} 564function hmrDelete(bundle, id) { 565 var modules = bundle.modules; 566 if (!modules) return; 567 if (modules[id]) { 568 // Collect dependencies that will become orphaned when this module is deleted. 569 var deps = modules[id][1]; 570 var orphans = []; 571 for(var dep in deps){ 572 var parents = getParents(module.bundle.root, deps[dep]); 573 if (parents.length === 1) orphans.push(deps[dep]); 574 } // Delete the module. This must be done before deleting dependencies in case of circular dependencies. 575 delete modules[id]; 576 delete bundle.cache[id]; // Now delete the orphans. 577 orphans.forEach(function(id) { 578 hmrDelete(module.bundle.root, id); 579 }); 580 } else if (bundle.parent) hmrDelete(bundle.parent, id); 581} 582function hmrAcceptCheck(bundle, id, depsByBundle) { 583 if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true; 584 // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload. 585 var parents = getParents(module.bundle.root, id); 586 var accepted = false; 587 while(parents.length > 0){ 588 var v = parents.shift(); 589 var a = hmrAcceptCheckOne(v[0], v[1], null); 590 if (a) // If this parent accepts, stop traversing upward, but still consider siblings. 591 accepted = true; 592 else { 593 var _parents; 594 // Otherwise, queue the parents in the next level upward. 595 var p = getParents(module.bundle.root, v[1]); 596 if (p.length === 0) { 597 // If there are no parents, then we've reached an entry without accepting. Reload. 598 accepted = false; 599 break; 600 } 601 (_parents = parents).push.apply(_parents, (0, _toConsumableArrayMjsDefault.default)(p)); 602 } 603 } 604 return accepted; 605} 606function hmrAcceptCheckOne(bundle, id, depsByBundle) { 607 var modules = bundle.modules; 608 if (!modules) return; 609 if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) { 610 // If we reached the root bundle without finding where the asset should go, 611 // there's nothing to do. Mark as "accepted" so we don't reload the page. 612 if (!bundle.parent) return true; 613 return hmrAcceptCheck(bundle.parent, id, depsByBundle); 614 } 615 if (checkedAssets[id]) return true; 616 checkedAssets[id] = true; 617 var cached = bundle.cache[id]; 618 assetsToDispose.push([ 619 bundle, 620 id 621 ]); 622 if (!cached || cached.hot && cached.hot._acceptCallbacks.length) { 623 assetsToAccept.push([ 624 bundle, 625 id 626 ]); 627 return true; 628 } 629} 630function hmrDispose(bundle, id) { 631 var cached = bundle.cache[id]; 632 bundle.hotData[id] = {}; 633 if (cached && cached.hot) cached.hot.data = bundle.hotData[id]; 634 if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) { 635 cb(bundle.hotData[id]); 636 }); 637 delete bundle.cache[id]; 638} 639function hmrAccept(bundle, id) { 640 // Execute the module. 641 bundle(id); // Run the accept callbacks in the new version of the module. 642 var cached = bundle.cache[id]; 643 if (cached && cached.hot && cached.hot._acceptCallbacks.length) cached.hot._acceptCallbacks.forEach(function(cb) { 644 var assetsToAlsoAccept = cb(function() { 645 return getParents(module.bundle.root, id); 646 }); 647 if (assetsToAlsoAccept && assetsToAccept.length) { 648 assetsToAlsoAccept.forEach(function(a) { 649 hmrDispose(a[0], a[1]); 650 }); // $FlowFixMe[method-unbinding] 651 assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept); 652 } 653 }); 654} 655 656},{"@swc/helpers/src/_async_to_generator.mjs":"jq00G","@swc/helpers/src/_to_consumable_array.mjs":"34Az7","@swc/helpers/src/_ts_generator.mjs":"9uDKh","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"jq00G":[function(require,module,exports) { 657var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 658parcelHelpers.defineInteropFlag(exports); 659function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 660 try { 661 var info = gen[key](arg); 662 var value = info.value; 663 } catch (error) { 664 reject(error); 665 return; 666 } 667 if (info.done) resolve(value); 668 else Promise.resolve(value).then(_next, _throw); 669} 670function _asyncToGenerator(fn) { 671 return function() { 672 var self = this, args = arguments; 673 return new Promise(function(resolve, reject) { 674 var gen = fn.apply(self, args); 675 function _next(value) { 676 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 677 } 678 function _throw(err) { 679 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 680 } 681 _next(undefined); 682 }); 683 }; 684} 685exports.default = _asyncToGenerator; 686 687},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"3w4z1":[function(require,module,exports) { 688exports.interopDefault = function(a) { 689 return a && a.__esModule ? a : { 690 default: a 691 }; 692}; 693exports.defineInteropFlag = function(a) { 694 Object.defineProperty(a, "__esModule", { 695 value: true 696 }); 697}; 698exports.exportAll = function(source, dest) { 699 Object.keys(source).forEach(function(key) {
700 if (key === "default" || key === "__esModule" || dest.hasOwnProperty(key)) return; 701 Object.defineProperty(dest, key, { 702 enumerable: true, 703 get: function get() { 704 return source[key]; 705 } 706 }); 707 }); 708 return dest; 709}; 710exports.export = function(dest, destName, get) { 711 Object.defineProperty(dest, destName, { 712 enumerable: true, 713 get: get 714 }); 715}; 716 717},{}],"34Az7":[function(require,module,exports) { 718var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 719parcelHelpers.defineInteropFlag(exports); 720var _arrayWithoutHolesMjs = require("./_array_without_holes.mjs"); 721var _arrayWithoutHolesMjsDefault = parcelHelpers.interopDefault(_arrayWithoutHolesMjs); 722var _iterableToArrayMjs = require("./_iterable_to_array.mjs"); 723var _iterableToArrayMjsDefault = parcelHelpers.interopDefault(_iterableToArrayMjs); 724var _nonIterableSpreadMjs = require("./_non_iterable_spread.mjs"); 725var _nonIterableSpreadMjsDefault = parcelHelpers.interopDefault(_nonIterableSpreadMjs); 726var _unsupportedIterableToArrayMjs = require("./_unsupported_iterable_to_array.mjs"); 727var _unsupportedIterableToArrayMjsDefault = parcelHelpers.interopDefault(_unsupportedIterableToArrayMjs); 728function _toConsumableArray(arr) { 729 return (0, _arrayWithoutHolesMjsDefault.default)(arr) || (0, _iterableToArrayMjsDefault.default)(arr) || (0, _unsupportedIterableToArrayMjsDefault.default)(arr) || (0, _nonIterableSpreadMjsDefault.default)(); 730} 731exports.default = _toConsumableArray; 732 733},{"./_array_without_holes.mjs":"c0JBN","./_iterable_to_array.mjs":"iOFtm","./_non_iterable_spread.mjs":"iYHD8","./_unsupported_iterable_to_array.mjs":"5aYTH","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"c0JBN":[function(require,module,exports) { 734var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 735parcelHelpers.defineInteropFlag(exports); 736var _arrayLikeToArrayMjs = require("./_array_like_to_array.mjs"); 737var _arrayLikeToArrayMjsDefault = parcelHelpers.interopDefault(_arrayLikeToArrayMjs); 738function _arrayWithoutHoles(arr) { 739 if (Array.isArray(arr)) return (0, _arrayLikeToArrayMjsDefault.default)(arr); 740} 741exports.default = _arrayWithoutHoles; 742 743},{"./_array_like_to_array.mjs":"kYlz5","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"kYlz5":[function(require,module,exports) { 744var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 745parcelHelpers.defineInteropFlag(exports); 746function _arrayLikeToArray(arr, len) { 747 if (len == null || len > arr.length) len = arr.length; 748 for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; 749 return arr2; 750} 751exports.default = _arrayLikeToArray; 752 753},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"iOFtm":[function(require,module,exports) { 754var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 755parcelHelpers.defineInteropFlag(exports); 756function _iterableToArray(iter) { 757 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 758} 759exports.default = _iterableToArray; 760 761},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"iYHD8":[function(require,module,exports) { 762var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 763parcelHelpers.defineInteropFlag(exports); 764function _nonIterableSpread() { 765 throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 766} 767exports.default = _nonIterableSpread; 768 769},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"5aYTH":[function(require,module,exports) { 770var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 771parcelHelpers.defineInteropFlag(exports); 772var _arrayLikeToArrayMjs = require("./_array_like_to_array.mjs"); 773var _arrayLikeToArrayMjsDefault = parcelHelpers.interopDefault(_arrayLikeToArrayMjs); 774function _unsupportedIterableToArray(o, minLen) { 775 if (!o) return; 776 if (typeof o === "string") return (0, _arrayLikeToArrayMjsDefault.default)(o, minLen); 777 var n = Object.prototype.toString.call(o).slice(8, -1); 778 if (n === "Object" && o.constructor) n = o.constructor.name; 779 if (n === "Map" || n === "Set") return Array.from(n); 780 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return (0, _arrayLikeToArrayMjsDefault.default)(o, minLen); 781} 782exports.default = _unsupportedIterableToArray; 783 784},{"./_array_like_to_array.mjs":"kYlz5","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"9uDKh":[function(require,module,exports) { 785var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 786parcelHelpers.defineInteropFlag(exports); 787parcelHelpers.export(exports, "default", function() { 788 return 0, _tslib.__generator; 789}); 790var _tslib = require("tslib"); 791 792},{"tslib":"gakNV","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"gakNV":[function(require,module,exports) { 793/****************************************************************************** 794Copyright (c) Microsoft Corporation. 795 796Permission to use, copy, modify, and/or distribute this software for any 797purpose with or without fee is hereby granted. 798 799THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 800REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 801AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 802INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 803LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 804OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 805PERFORMANCE OF THIS SOFTWARE. 806***************************************************************************** */ /* global Reflect, Promise */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 807parcelHelpers.defineInteropFlag(exports); 808parcelHelpers.export(exports, "__extends", function() { 809 return __extends; 810}); 811parcelHelpers.export(exports, "__assign", function() { 812 return __assign; 813}); 814parcelHelpers.export(exports, "__rest", function() { 815 return __rest; 816}); 817parcelHelpers.export(exports, "__decorate", function() { 818 return __decorate; 819}); 820parcelHelpers.export(exports, "__param", function() { 821 return __param; 822}); 823parcelHelpers.export(exports, "__esDecorate", function() { 824 return __esDecorate; 825});
826parcelHelpers.export(exports, "__runInitializers", function() { 827 return __runInitializers; 828}); 829parcelHelpers.export(exports, "__propKey", function() { 830 return __propKey; 831}); 832parcelHelpers.export(exports, "__setFunctionName", function() { 833 return __setFunctionName; 834}); 835parcelHelpers.export(exports, "__metadata", function() { 836 return __metadata; 837}); 838parcelHelpers.export(exports, "__awaiter", function() { 839 return __awaiter; 840}); 841parcelHelpers.export(exports, "__generator", function() { 842 return __generator; 843}); 844parcelHelpers.export(exports, "__createBinding", function() { 845 return __createBinding; 846}); 847parcelHelpers.export(exports, "__exportStar", function() { 848 return __exportStar; 849}); 850parcelHelpers.export(exports, "__values", function() { 851 return __values; 852}); 853parcelHelpers.export(exports, "__read", function() { 854 return __read; 855}); 856/** @deprecated */ parcelHelpers.export(exports, "__spread", function() { 857 return __spread; 858}); 859/** @deprecated */ parcelHelpers.export(exports, "__spreadArrays", function() { 860 return __spreadArrays; 861}); 862parcelHelpers.export(exports, "__spreadArray", function() { 863 return __spreadArray; 864}); 865parcelHelpers.export(exports, "__await", function() { 866 return __await; 867}); 868parcelHelpers.export(exports, "__asyncGenerator", function() { 869 return __asyncGenerator; 870}); 871parcelHelpers.export(exports, "__asyncDelegator", function() { 872 return __asyncDelegator; 873}); 874parcelHelpers.export(exports, "__asyncValues", function() { 875 return __asyncValues; 876});
877parcelHelpers.export(exports, "__makeTemplateObject", function() { 878 return __makeTemplateObject; 879}); 880parcelHelpers.export(exports, "__importStar", function() { 881 return __importStar; 882}); 883parcelHelpers.export(exports, "__importDefault", function() { 884 return __importDefault; 885}); 886parcelHelpers.export(exports, "__classPrivateFieldGet", function() { 887 return __classPrivateFieldGet; 888}); 889parcelHelpers.export(exports, "__classPrivateFieldSet", function() { 890 return __classPrivateFieldSet; 891}); 892parcelHelpers.export(exports, "__classPrivateFieldIn", function() { 893 return __classPrivateFieldIn; 894}); 895var _typeOfMjs = require("@swc/helpers/src/_type_of.mjs"); 896var _typeOfMjsDefault = parcelHelpers.interopDefault(_typeOfMjs); 897var extendStatics = function extendStatics1(d, b) { 898 extendStatics = Object.setPrototypeOf || ({ 899 __proto__: [] 900 }) instanceof Array && function(d, b) { 901 d.__proto__ = b; 902 } || function(d, b) { 903 for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 904 }; 905 return extendStatics(d, b); 906}; 907function __extends(d, b) { 908 var __ = function __() { 909 this.constructor = d; 910 }; 911 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 912 extendStatics(d, b); 913 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 914} 915var __assign = function __assign1() { 916 __assign = Object.assign || function __assign(t) { 917 for(var s, i = 1, n = arguments.length; i < n; i++){ 918 s = arguments[i]; 919 for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 920 } 921 return t; 922 }; 923 return __assign.apply(this, arguments); 924}; 925function __rest(s, e) { 926 var t = {}; 927 for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; 928 if (s != null && typeof Object.getOwnPropertySymbols === "function") { 929 for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; 930 } 931 return t; 932} 933function __decorate(decorators, target, key, desc) { 934 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 935 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 936 else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 937 return c > 3 && r && Object.defineProperty(target, key, r), r; 938} 939function __param(paramIndex, decorator) { 940 return function(target, key) { 941 decorator(target, key, paramIndex); 942 }; 943} 944function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 945 var accept = function accept(f) { 946 if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); 947 return f; 948 }; 949 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 950 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 951 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 952 var _, done = false; 953 for(var i = decorators.length - 1; i >= 0; i--){ 954 var context = {}; 955 for(var p in contextIn)context[p] = p === "access" ? {} : contextIn[p]; 956 for(var p in contextIn.access)context.access[p] = contextIn.access[p]; 957 context.addInitializer = function(f) { 958 if (done) throw new TypeError("Cannot add initializers after decoration has completed"); 959 extraInitializers.push(accept(f || null)); 960 }; 961 var result = (0, decorators[i])(kind === "accessor" ? { 962 get: descriptor.get, 963 set: descriptor.set 964 } : descriptor[key], context); 965 if (kind === "accessor") { 966 if (result === void 0) continue; 967 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 968 if (_ = accept(result.get)) descriptor.get = _; 969 if (_ = accept(result.set)) descriptor.set = _;
970 if (_ = accept(result.init)) initializers.push(_); 971 } else if (_ = accept(result)) { 972 if (kind === "field") initializers.push(_); 973 else descriptor[key] = _; 974 } 975 } 976 if (target) Object.defineProperty(target, contextIn.name, descriptor); 977 done = true; 978} 979function __runInitializers(thisArg, initializers, value) { 980 var useValue = arguments.length > 2; 981 for(var i = 0; i < initializers.length; i++)value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 982 return useValue ? value : void 0; 983} 984function __propKey(x) { 985 return (typeof x === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(x)) === "symbol" ? x : "".concat(x); 986} 987function __setFunctionName(f, name, prefix) { 988 if ((typeof name === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(name)) === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 989 return Object.defineProperty(f, "name", { 990 configurable: true, 991 value: prefix ? "".concat(prefix, " ", name) : name 992 }); 993} 994function __metadata(metadataKey, metadataValue) { 995 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 996} 997function __awaiter(thisArg, _arguments, P, generator) { 998 var adopt = function adopt(value) { 999 return value instanceof P ? value : new P(function(resolve) { 1000 resolve(value); 1001 }); 1002 }; 1003 return new (P || (P = Promise))(function(resolve, reject) { 1004 var fulfilled = function fulfilled(value) { 1005 try { 1006 step(generator.next(value)); 1007 } catch (e) { 1008 reject(e); 1009 } 1010 }; 1011 var rejected = function rejected(value) { 1012 try { 1013 step(generator["throw"](value)); 1014 } catch (e) { 1015 reject(e); 1016 } 1017 }; 1018 var step = function step(result) { 1019 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 1020 }; 1021 step((generator = generator.apply(thisArg, _arguments || [])).next()); 1022 }); 1023} 1024function __generator(thisArg, body) { 1025 var verb = function verb(n) { 1026 return function(v) { 1027 return step([ 1028 n, 1029 v 1030 ]); 1031 }; 1032 }; 1033 var step = function step(op) { 1034 if (f) throw new TypeError("Generator is already executing."); 1035 while(g && (g = 0, op[0] && (_ = 0)), _)try { 1036 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 1037 if (y = 0, t) op = [ 1038 op[0] & 2, 1039 t.value 1040 ]; 1041 switch(op[0]){ 1042 case 0: 1043 case 1: 1044 t = op; 1045 break; 1046 case 4: 1047 _.label++; 1048 return { 1049 value: op[1], 1050 done: false 1051 }; 1052 case 5: 1053 _.label++; 1054 y = op[1]; 1055 op = [ 1056 0 1057 ]; 1058 continue; 1059 case 7: 1060 op = _.ops.pop(); 1061 _.trys.pop(); 1062 continue; 1063 default: 1064 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 1065 _ = 0; 1066 continue; 1067 } 1068 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 1069 _.label = op[1]; 1070 break; 1071 } 1072 if (op[0] === 6 && _.label < t[1]) { 1073 _.label = t[1]; 1074 t = op; 1075 break; 1076 } 1077 if (t && _.label < t[2]) { 1078 _.label = t[2];
1079 _.ops.push(op); 1080 break; 1081 } 1082 if (t[2]) _.ops.pop(); 1083 _.trys.pop(); 1084 continue; 1085 } 1086 op = body.call(thisArg, _); 1087 } catch (e) { 1088 op = [ 1089 6, 1090 e 1091 ]; 1092 y = 0; 1093 } finally{ 1094 f = t = 0; 1095 } 1096 if (op[0] & 5) throw op[1]; 1097 return { 1098 value: op[0] ? op[1] : void 0, 1099 done: true 1100 }; 1101 }; 1102 var _ = { 1103 label: 0, 1104 sent: function sent() { 1105 if (t[0] & 1) throw t[1]; 1106 return t[1]; 1107 }, 1108 trys: [], 1109 ops: [] 1110 }, f, y, t, g; 1111 return g = { 1112 next: verb(0), 1113 "throw": verb(1), 1114 "return": verb(2) 1115 }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { 1116 return this; 1117 }), g; 1118} 1119var __createBinding = Object.create ? function __createBinding(o, m, k, k2) { 1120 if (k2 === undefined) k2 = k; 1121 var desc = Object.getOwnPropertyDescriptor(m, k); 1122 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { 1123 enumerable: true, 1124 get: function get() { 1125 return m[k]; 1126 } 1127 }; 1128 Object.defineProperty(o, k2, desc); 1129} : function(o, m, k, k2) { 1130 if (k2 === undefined) k2 = k; 1131 o[k2] = m[k]; 1132}; 1133function __exportStar(m, o) { 1134 for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 1135} 1136function __values(o) { 1137 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 1138 if (m) return m.call(o); 1139 if (o && typeof o.length === "number") return { 1140 next: function next() { 1141 if (o && i >= o.length) o = void 0; 1142 return { 1143 value: o && o[i++], 1144 done: !o 1145 }; 1146 } 1147 }; 1148 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 1149} 1150function __read(o, n) { 1151 var m = typeof Symbol === "function" && o[Symbol.iterator]; 1152 if (!m) return o; 1153 var i = m.call(o), r, ar = [], e; 1154 try { 1155 while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value); 1156 } catch (error) { 1157 e = { 1158 error: error 1159 }; 1160 } finally{ 1161 try { 1162 if (r && !r.done && (m = i["return"])) m.call(i); 1163 } finally{ 1164 if (e) throw e.error; 1165 } 1166 } 1167 return ar; 1168} 1169function __spread() { 1170 for(var ar = [], i = 0; i < arguments.length; i++)ar = ar.concat(__read(arguments[i])); 1171 return ar; 1172} 1173function __spreadArrays() { 1174 for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length; 1175 for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j]; 1176 return r; 1177} 1178function __spreadArray(to, from, pack) { 1179 if (pack || arguments.length === 2) { 1180 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 1181 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 1182 ar[i] = from[i]; 1183 } 1184 } 1185 return to.concat(ar || Array.prototype.slice.call(from)); 1186} 1187function __await(v) { 1188 return this instanceof __await ? (this.v = v, this) : new __await(v); 1189} 1190function __asyncGenerator(thisArg, _arguments, generator) { 1191 var verb = function verb(n) { 1192 if (g[n]) i[n] = function(v) { 1193 return new Promise(function(a, b) { 1194 q.push([ 1195 n, 1196 v, 1197 a, 1198 b 1199 ]) > 1 || resume(n, v); 1200 }); 1201 }; 1202 }; 1203 var resume = function resume(n, v) { 1204 try { 1205 step(g[n](v)); 1206 } catch (e) { 1207 settle(q[0][3], e); 1208 } 1209 }; 1210 var step = function step(r) { 1211 r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); 1212 }; 1213 var fulfill = function fulfill(value) { 1214 resume("next", value); 1215 }; 1216 var reject = function reject(value) { 1217 resume("throw", value); 1218 }; 1219 var settle = function settle(f, v) { 1220 if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); 1221 }; 1222 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 1223 var g = generator.apply(thisArg, _arguments || []), i, q = []; 1224 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { 1225 return this; 1226 }, i; 1227} 1228function __asyncDelegator(o) { 1229 var verb = function verb(n, f) { 1230 i[n] = o[n] ? function(v) { 1231 return (p = !p) ? { 1232 value: __await(o[n](v)), 1233 done: false 1234 } : f ? f(v) : v; 1235 } : f; 1236 }; 1237 var i, p; 1238 return i = {}, verb("next"), verb("throw", function(e) { 1239 throw e; 1240 }), verb("return"), i[Symbol.iterator] = function() { 1241 return this; 1242 }, i; 1243} 1244function __asyncValues(o) { 1245 var verb = function verb(n) { 1246 i[n] = o[n] && function(v) { 1247 return new Promise(function(resolve, reject) { 1248 v = o[n](v), settle(resolve, reject, v.done, v.value); 1249 }); 1250 }; 1251 }; 1252 var settle = function settle(resolve, reject, d, v) { 1253 Promise.resolve(v).then(function(v) { 1254 resolve({ 1255 value: v, 1256 done: d 1257 }); 1258 }, reject); 1259 }; 1260 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 1261 var m = o[Symbol.asyncIterator], i; 1262 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { 1263 return this; 1264 }, i); 1265}
1266function __makeTemplateObject(cooked, raw) { 1267 if (Object.defineProperty) Object.defineProperty(cooked, "raw", { 1268 value: raw 1269 }); 1270 else cooked.raw = raw; 1271 return cooked; 1272} 1273var __setModuleDefault = Object.create ? function __setModuleDefault(o, v) { 1274 Object.defineProperty(o, "default", { 1275 enumerable: true, 1276 value: v 1277 }); 1278} : function(o, v) { 1279 o["default"] = v; 1280}; 1281function __importStar(mod) { 1282 if (mod && mod.__esModule) return mod; 1283 var result = {}; 1284 if (mod != null) { 1285 for(var k in mod)if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1286 } 1287 __setModuleDefault(result, mod); 1288 return result; 1289} 1290function __importDefault(mod) { 1291 return mod && mod.__esModule ? mod : { 1292 default: mod 1293 }; 1294} 1295function __classPrivateFieldGet(receiver, state, kind, f) { 1296 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 1297 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 1298 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 1299} 1300function __classPrivateFieldSet(receiver, state, value, kind, f) { 1301 if (kind === "m") throw new TypeError("Private method is not writable"); 1302 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 1303 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 1304 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; 1305} 1306function __classPrivateFieldIn(state, receiver) { 1307 if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); 1308 return typeof state === "function" ? receiver === state : state.has(receiver); 1309} 1310 1311},{"@swc/helpers/src/_type_of.mjs":"69q0b","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"69q0b":[function(require,module,exports) { 1312var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1313parcelHelpers.defineInteropFlag(exports); 1314function _typeof(obj) { 1315 "@swc/helpers - typeof"; 1316 return obj && obj.constructor === Symbol ? "symbol" : typeof obj; 1317} 1318exports.default = _typeof; 1319 1320},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"jut1O":[function(require,module,exports) { 1321//import '@babel/polyfill'; 1322var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1323var _tinySlider = require("tiny-slider/src/tiny-slider"); 1324var _showScroll = require("./modules/showScroll"); 1325var _showScrollDefault = parcelHelpers.interopDefault(_showScroll); 1326// Import SASS 1327var _styleScss = require("../sass/style.scss"); 1328//import "core-js/es6"; 1329//import "regenerator-runtime/runtime"; 1330// Node_modules 1331var _objectFitImages = require("object-fit-images"); 1332var _objectFitImagesDefault = parcelHelpers.interopDefault(_objectFitImages); 1333var _modalsJs = require("./modules/modals.js"); 1334var _modalsJsDefault = parcelHelpers.interopDefault(_modalsJs); 1335var _menus = require("../partials/navigation/menus/menus"); 1336// Import scripts 1337var _skipLinkFocusFix = require("./modules/skip-link-focus-fix"); 1338var _initAfterYoutubeApi = require("./modules/init-after-youtube-api"); // when videos are loaded on the page 1339var _initAfterYoutubeApiDefault = parcelHelpers.interopDefault(_initAfterYoutubeApi); 1340//import '../partials/navigation/menus/menus'// 1341var _search = require("../partials/search/search"); 1342var _sliders = require("../partials/sliders/sliders"); 1343var _slidersDefault = parcelHelpers.interopDefault(_sliders); 1344// import { initBlockSlider } from '../partials/blocks/block/block-slider' 1345var _gsap = require("gsap"); 1346var _gsapDefault = parcelHelpers.interopDefault(_gsap); 1347var _mixitup = require("mixitup"); 1348var _mixitupDefault = parcelHelpers.interopDefault(_mixitup); 1349var _cookie = require("./modules/cookie"); 1350var _cookieDefault = parcelHelpers.interopDefault(_cookie); 1351function newsFilter() { 1352 if (document.querySelector(".news__wrapper")) var mixer = (0, _mixitupDefault.default)(".news__wrapper"); 1353} 1354window.onYouTubeIframeAPIReady = function() { 1355 (0, _initAfterYoutubeApiDefault.default)(); 1356}; 1357// Object-fit fix 1358(0, _objectFitImagesDefault.default)(); 1359/* 1360
1361function init() { 1362 1363 1364 document.getElementById("slide-down").addEventListener("click",(e)=>{ 1365 e.preventDefault(); 1366 const element = document.getElementById('continue'); 1367 element.scrollIntoView({ block: 'begin', behavior: 'smooth' }); 1368 }); 1369 1370} 1371 1372*/ // tell Barba to use the css plugin 1373function docReady(fn) { 1374 // see if DOM is already available 1375 if (document.readyState === "complete" || document.readyState === "interactive") // call on next available tick 1376 setTimeout(fn, 1); 1377 else document.addEventListener("DOMContentLoaded", fn); 1378} 1379docReady(function() { 1380 var sliders = (0, _slidersDefault.default)(); 1381 (0, _showScrollDefault.default)(".scroll-top"); 1382 console.log(sliders); 1383}); 1384(0, _modalsJsDefault.default).init({ 1385 backspaceClose: false, 1386 callbackOpen: function callbackOpen(toggle, modal) { 1387 var modal = document.querySelector("#" + modal.id); 1388 modal.classList.add("fadeInUp"); 1389 modal.classList.add("animated"); 1390 modal.classList.add("active"); 1391 } 1392}); 1393document.querySelectorAll(".open-contact").forEach(function(element) { 1394 element.addEventListener("click", function() { 1395 (0, _modalsJsDefault.default).openModal(null, "#modal-contact"); 1396 }); 1397}); 1398document.querySelectorAll(".open-download").forEach(function(element) { 1399 element.addEventListener("click", function() { 1400 (0, _modalsJsDefault.default).openModal(null, "#modal-download"); 1401 }); 1402}); 1403if (document.getElementById("field_29_16")) { 1404 var fieldset = document.getElementById("field_29_16"); 1405 var radios = fieldset.querySelectorAll('input[type="radio"]'); 1406 var targetElement = document.getElementById("field_29_17"); 1407 radios.forEach(function(radio) { 1408 radio.addEventListener("click", function() { 1409 targetElement.scrollIntoView({ 1410 behavior: "smooth" 1411 }); 1412 }); 1413 }); 1414} 1415 1416},{"tiny-slider/src/tiny-slider":"cHMyp","./modules/showScroll":"8ePgH","../sass/style.scss":"8wXjG","object-fit-images":"6WNk5","./modules/modals.js":"aVwuS","../partials/navigation/menus/menus":"630mG","./modules/skip-link-focus-fix":"dZzoK","./modules/init-after-youtube-api":"7Qqpu","../partials/search/search":"iiUaO","../partials/sliders/sliders":"5z9kn","gsap":"1zduL","mixitup":"3493k","./modules/cookie":"5tx57","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"cHMyp":[function(require,module,exports) { 1417// Object.keys 1418var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1419parcelHelpers.defineInteropFlag(exports); 1420parcelHelpers.export(exports, "tns", function() { 1421 return tns; 1422}); 1423var _rafJs = require("./helpers/raf.js"); 1424var _cafJs = require("./helpers/caf.js"); 1425var _extendJs = require("./helpers/extend.js"); 1426var _checkStorageValueJs = require("./helpers/checkStorageValue.js"); 1427var _setLocalStorageJs = require("./helpers/setLocalStorage.js"); 1428var _getSlideIdJs = require("./helpers/getSlideId.js"); 1429var _calcJs = require("./helpers/calc.js"); 1430var _percentageLayoutJs = require("./helpers/percentageLayout.js"); 1431var _mediaquerySupportJs = require("./helpers/mediaquerySupport.js"); 1432var _createStyleSheetJs = require("./helpers/createStyleSheet.js"); 1433var _addCSSRuleJs = require("./helpers/addCSSRule.js"); 1434var _removeCSSRuleJs = require("./helpers/removeCSSRule.js"); 1435var _getCssRulesLengthJs = require("./helpers/getCssRulesLength.js"); 1436var _toDegreeJs = require("./helpers/toDegree.js"); 1437var _getTouchDirectionJs = require("./helpers/getTouchDirection.js"); 1438var _forEachJs = require("./helpers/forEach.js"); 1439var _hasClassJs = require("./helpers/hasClass.js"); 1440var _addClassJs = require("./helpers/addClass.js"); 1441var _removeClassJs = require("./helpers/removeClass.js"); 1442var _hasAttrJs = require("./helpers/hasAttr.js"); 1443var _getAttrJs = require("./helpers/getAttr.js"); 1444var _setAttrsJs = require("./helpers/setAttrs.js"); 1445var _removeAttrsJs = require("./helpers/removeAttrs.js"); 1446var _arrayFromNodeListJs = require("./helpers/arrayFromNodeList.js"); 1447var _hideElementJs = require("./helpers/hideElement.js"); 1448var _showElementJs = require("./helpers/showElement.js"); 1449var _isVisibleJs = require("./helpers/isVisible.js"); 1450var _whichPropertyJs = require("./helpers/whichProperty.js"); 1451var _has3DTransformsJs = require("./helpers/has3DTransforms.js"); 1452var _getEndPropertyJs = require("./helpers/getEndProperty.js"); 1453var _addEventsJs = require("./helpers/addEvents.js"); 1454var _removeEventsJs = require("./helpers/removeEvents.js"); 1455var _eventsJs = require("./helpers/events.js"); 1456var _jsTransformJs = require("./helpers/jsTransform.js"); 1457if (!Object.keys) Object.keys = function(object) { 1458 var keys = []; 1459 for(var name in object)if (Object.prototype.hasOwnProperty.call(object, name)) keys.push(name); 1460 return keys; 1461}; 1462// ChildNode.remove 1463if (!("remove" in Element.prototype)) Element.prototype.remove = function() { 1464 if (this.parentNode) this.parentNode.removeChild(this); 1465}; 1466var tns = function tns1(options) { 1467 var resetVariblesWhenDisable = // === COMMON FUNCTIONS === // 1468 function resetVariblesWhenDisable(condition) { 1469 if (condition) controls = nav = touch = mouseDrag = arrowKeys = autoplay = autoplayHoverPause = autoplayResetOnVisibility = false;
1470 }; 1471 var getCurrentSlide = function getCurrentSlide() { 1472 var tem = carousel ? index - cloneCount : index; 1473 while(tem < 0)tem += slideCount; 1474 return tem % slideCount + 1; 1475 }; 1476 var getStartIndex = function getStartIndex(ind) { 1477 ind = ind ? Math.max(0, Math.min(loop ? slideCount - 1 : slideCount - items, ind)) : 0; 1478 return carousel ? ind + cloneCount : ind; 1479 }; 1480 var getAbsIndex = function getAbsIndex(i) { 1481 if (i == null) i = index; 1482 if (carousel) i -= cloneCount; 1483 while(i < 0)i += slideCount; 1484 return Math.floor(i % slideCount); 1485 }; 1486 var getCurrentNavIndex = function getCurrentNavIndex() { 1487 var absIndex = getAbsIndex(), result; 1488 result = navAsThumbnails ? absIndex : fixedWidth || autoWidth ? Math.ceil((absIndex + 1) * pages / slideCount - 1) : Math.floor(absIndex / items); 1489 // set active nav to the last one when reaches the right edge 1490 if (!loop && carousel && index === indexMax) result = pages - 1; 1491 return result; 1492 }; 1493 var getItemsMax = function getItemsMax() { 1494 // fixedWidth or autoWidth while viewportMax is not available 1495 if (autoWidth || fixedWidth && !viewportMax) return slideCount - 1; 1496 else { 1497 var str = fixedWidth ? "fixedWidth" : "items", arr = []; 1498 if (fixedWidth || options[str] < slideCount) arr.push(options[str]); 1499 if (responsive) for(var bp in responsive){ 1500 var tem = responsive[bp][str]; 1501 if (tem && (fixedWidth || tem < slideCount)) arr.push(tem); 1502 } 1503 if (!arr.length) arr.push(0); 1504 return Math.ceil(fixedWidth ? viewportMax / Math.min.apply(null, arr) : Math.max.apply(null, arr)); 1505 } 1506 }; 1507 var getCloneCountForLoop = function getCloneCountForLoop() { 1508 var itemsMax = getItemsMax(), result = carousel ? Math.ceil((itemsMax * 5 - slideCount) / 2) : itemsMax * 4 - slideCount; 1509 result = Math.max(itemsMax, result); 1510 return hasOption("edgePadding") ? result + 1 : result; 1511 }; 1512 var getWindowWidth = function getWindowWidth() { 1513 return win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth; 1514 }; 1515 var getInsertPosition = function getInsertPosition(pos) { 1516 return pos === "top" ? "afterbegin" : "beforeend"; 1517 }; 1518 var getViewportWidth = function getViewportWidth() { 1519 var gap = edgePadding ? edgePadding * 2 - gutter : 0; 1520 return getClientWidth(containerParent) - gap; 1521 }; 1522 var hasOption = function hasOption(item) { 1523 if (options[item]) return true; 1524 else { 1525 if (responsive) for(var bp in responsive){ 1526 if (responsive[bp][item]) return true; 1527 } 1528 return false; 1529 } 1530 }; 1531 var getSlideMarginLeft = function getSlideMarginLeft(i) { 1532 return CALC ? CALC + "(" + i * 100 + "% / " + slideCountNew + ")" : i * 100 / slideCountNew + "%"; 1533 }; 1534 var getInnerWrapperStyles = function getInnerWrapperStyles(edgePaddingTem, gutterTem, fixedWidthTem, speedTem, autoHeightBP) { 1535 var str = ""; 1536 if (edgePaddingTem !== undefined) { 1537 var gap = edgePaddingTem; 1538 if (gutterTem) gap -= gutterTem; 1539 str = horizontal ? "margin: 0 " + gap + "px 0 " + edgePaddingTem + "px;" : "margin: " + edgePaddingTem + "px 0 " + gap + "px 0;"; 1540 } else if (gutterTem && !fixedWidthTem) { 1541 var gutterTemUnit = "-" + gutterTem + "px", dir = horizontal ? gutterTemUnit + " 0 0" : "0 " + gutterTemUnit + " 0"; 1542 str = "margin: 0 " + dir + ";"; 1543 } 1544 if (!carousel && autoHeightBP && TRANSITIONDURATION && speedTem) str += getTransitionDurationStyle(speedTem); 1545 return str; 1546 }; 1547 var getContainerWidth = function getContainerWidth(fixedWidthTem, gutterTem, itemsTem) { 1548 if (fixedWidthTem) return (fixedWidthTem + gutterTem) * slideCountNew + "px"; 1549 else return CALC ? CALC + "(" + slideCountNew * 100 + "% / " + itemsTem + ")" : slideCountNew * 100 / itemsTem + "%"; 1550 }; 1551 var getSlideWidthStyle = function getSlideWidthStyle(fixedWidthTem, gutterTem, itemsTem) { 1552 var width; 1553 if (fixedWidthTem) width = fixedWidthTem + gutterTem + "px"; 1554 else { 1555 if (!carousel) itemsTem = Math.floor(itemsTem); 1556 var dividend = carousel ? slideCountNew : itemsTem; 1557 width = CALC ? CALC + "(100% / " + dividend + ")" : 100 / dividend + "%"; 1558 }
1559 width = "width:" + width; 1560 // inner slider: overwrite outer slider styles 1561 return nested !== "inner" ? width + ";" : width + " !important;"; 1562 }; 1563 var getSlideGutterStyle = function getSlideGutterStyle(gutterTem) { 1564 var str = ""; 1565 // gutter maybe interger || 0 1566 // so can't use 'if (gutter)' 1567 if (gutterTem !== false) { 1568 var prop = horizontal ? "padding-" : "margin-", dir = horizontal ? "right" : "bottom"; 1569 str = prop + dir + ": " + gutterTem + "px;"; 1570 } 1571 return str; 1572 }; 1573 var getCSSPrefix = function getCSSPrefix(name, num) { 1574 var prefix = name.substring(0, name.length - num).toLowerCase(); 1575 if (prefix) prefix = "-" + prefix + "-"; 1576 return prefix; 1577 }; 1578 var getTransitionDurationStyle = function getTransitionDurationStyle(speed) { 1579 return getCSSPrefix(TRANSITIONDURATION, 18) + "transition-duration:" + speed / 1000 + "s;"; 1580 }; 1581 var getAnimationDurationStyle = function getAnimationDurationStyle(speed) { 1582 return getCSSPrefix(ANIMATIONDURATION, 17) + "animation-duration:" + speed / 1000 + "s;"; 1583 }; 1584 var initStructure = function initStructure() { 1585 var classOuter = "tns-outer", classInner = "tns-inner", hasGutter = hasOption("gutter"); 1586 outerWrapper.className = classOuter; 1587 innerWrapper.className = classInner; 1588 outerWrapper.id = slideId + "-ow"; 1589 innerWrapper.id = slideId + "-iw"; 1590 // set container properties 1591 if (container.id === "") container.id = slideId; 1592 newContainerClasses += PERCENTAGELAYOUT || autoWidth ? " tns-subpixel" : " tns-no-subpixel"; 1593 newContainerClasses += CALC ? " tns-calc" : " tns-no-calc"; 1594 if (autoWidth) newContainerClasses += " tns-autowidth"; 1595 newContainerClasses += " tns-" + options.axis; 1596 container.className += newContainerClasses; 1597 // add constrain layer for carousel 1598 if (carousel) { 1599 middleWrapper = doc.createElement("div"); 1600 middleWrapper.id = slideId + "-mw"; 1601 middleWrapper.className = "tns-ovh"; 1602 outerWrapper.appendChild(middleWrapper); 1603 middleWrapper.appendChild(innerWrapper); 1604 } else outerWrapper.appendChild(innerWrapper); 1605 if (autoHeight) { 1606 var wp = middleWrapper ? middleWrapper : innerWrapper; 1607 wp.className += " tns-ah"; 1608 } 1609 containerParent.insertBefore(outerWrapper, container); 1610 innerWrapper.appendChild(container); 1611 // add id, class, aria attributes 1612 // before clone slides 1613 (0, _forEachJs.forEach)(slideItems, function(item, i) { 1614 (0, _addClassJs.addClass)(item, "tns-item"); 1615 if (!item.id) item.id = slideId + "-item" + i; 1616 if (!carousel && animateNormal) (0, _addClassJs.addClass)(item, animateNormal); 1617 (0, _setAttrsJs.setAttrs)(item, { 1618 "aria-hidden": "true", 1619 "tabindex": "-1" 1620 }); 1621 }); 1622 // ## clone slides 1623 // carousel: n + slides + n 1624 // gallery: slides + n 1625 if (cloneCount) { 1626 var fragmentBefore = doc.createDocumentFragment(), fragmentAfter = doc.createDocumentFragment(); 1627 for(var j = cloneCount; j--;){ 1628 var num = j % slideCount, cloneFirst = slideItems[num].cloneNode(true); 1629 (0, _addClassJs.addClass)(cloneFirst, slideClonedClass); 1630 (0, _removeAttrsJs.removeAttrs)(cloneFirst, "id"); 1631 fragmentAfter.insertBefore(cloneFirst, fragmentAfter.firstChild); 1632 if (carousel) { 1633 var cloneLast = slideItems[slideCount - 1 - num].cloneNode(true); 1634 (0, _addClassJs.addClass)(cloneLast, slideClonedClass);
1635 (0, _removeAttrsJs.removeAttrs)(cloneLast, "id"); 1636 fragmentBefore.appendChild(cloneLast); 1637 } 1638 } 1639 container.insertBefore(fragmentBefore, container.firstChild); 1640 container.appendChild(fragmentAfter); 1641 slideItems = container.children; 1642 } 1643 }; 1644 var initSliderTransform = function initSliderTransform() { 1645 // ## images loaded/failed 1646 if (hasOption("autoHeight") || autoWidth || !horizontal) { 1647 var imgs = container.querySelectorAll("img"); 1648 // add img load event listener 1649 (0, _forEachJs.forEach)(imgs, function(img) { 1650 var src = img.src; 1651 if (!lazyload) { 1652 // not data img 1653 if (src && src.indexOf("data:image") < 0) { 1654 img.src = ""; 1655 (0, _addEventsJs.addEvents)(img, imgEvents); 1656 (0, _addClassJs.addClass)(img, "loading"); 1657 img.src = src; 1658 // data img 1659 } else imgLoaded(img); 1660 } 1661 }); 1662 // set imgsComplete 1663 (0, _rafJs.raf)(function() { 1664 imgsLoadedCheck((0, _arrayFromNodeListJs.arrayFromNodeList)(imgs), function() { 1665 imgsComplete = true; 1666 }); 1667 }); 1668 // reset imgs for auto height: check visible imgs only 1669 if (hasOption("autoHeight")) imgs = getImageArray(index, Math.min(index + items - 1, slideCountNew - 1)); 1670 lazyload ? initSliderTransformStyleCheck() : (0, _rafJs.raf)(function() { 1671 imgsLoadedCheck((0, _arrayFromNodeListJs.arrayFromNodeList)(imgs), initSliderTransformStyleCheck); 1672 }); 1673 } else { 1674 // set container transform property 1675 if (carousel) doContainerTransformSilent(); 1676 // update slider tools and events 1677 initTools(); 1678 initEvents(); 1679 } 1680 }; 1681 var initSliderTransformStyleCheck = function initSliderTransformStyleCheck() { 1682 if (autoWidth && slideCount > 1) { 1683 // check styles application 1684 var num = loop ? index : slideCount - 1; 1685 (function stylesApplicationCheck() { 1686 var left = slideItems[num].getBoundingClientRect().left; 1687 var right = slideItems[num - 1].getBoundingClientRect().right; 1688 Math.abs(left - right) <= 1 ? initSliderTransformCore() : setTimeout(function() { 1689 stylesApplicationCheck(); 1690 }, 16); 1691 })(); 1692 } else initSliderTransformCore(); 1693 }; 1694 var initSliderTransformCore = function initSliderTransformCore() { 1695 // run Fn()s which are rely on image loading 1696 if (!horizontal || autoWidth) { 1697 setSlidePositions(); 1698 if (autoWidth) { 1699 rightBoundary = getRightBoundary(); 1700 if (freezable) freeze = getFreeze(); 1701 indexMax = getIndexMax(); // <= slidePositions, rightBoundary <= 1702 resetVariblesWhenDisable(disable || freeze); 1703 } else updateContentWrapperHeight(); 1704 } 1705 // set container transform property 1706 if (carousel) doContainerTransformSilent(); 1707 // update slider tools and events 1708 initTools(); 1709 initEvents(); 1710 }; 1711 var initSheet = function initSheet() { 1712 // gallery: 1713 // set animation classes and left value for gallery slider 1714 if (!carousel) for(var i = index, l = index + Math.min(slideCount, items); i < l; i++){ 1715 var item = slideItems[i]; 1716 item.style.left = (i - index) * 100 / items + "%"; 1717 (0, _addClassJs.addClass)(item, animateIn); 1718 (0, _removeClassJs.removeClass)(item, animateNormal); 1719 } 1720 // #### LAYOUT 1721 // ## INLINE-BLOCK VS FLOAT 1722 // ## PercentageLayout: 1723 // slides: inline-block 1724 // remove blank space between slides by set font-size: 0 1725 // ## Non PercentageLayout: 1726 // slides: float 1727 // margin-right: -100% 1728 // margin-left: ~ 1729 // Resource: https://docs.google.com/spreadsheets/d/147up245wwTXeQYve3BRSAD4oVcvQmuGsFteJOeA5xNQ/edit?usp=sharing 1730 if (horizontal) { 1731 if (PERCENTAGELAYOUT || autoWidth) { 1732 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + " > .tns-item", "font-size:" + win.getComputedStyle(slideItems[0]).fontSize + ";", (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1733 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId, "font-size:0;", (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1734 }
1734 else if (carousel) (0, _forEachJs.forEach)(slideItems, function(slide, i) { 1735 slide.style.marginLeft = getSlideMarginLeft(i); 1736 }); 1737 } 1738 // ## BASIC STYLES 1739 if (CSSMQ) { 1740 // middle wrapper style 1741 if (TRANSITIONDURATION) { 1742 var str = middleWrapper && options.autoHeight ? getTransitionDurationStyle(options.speed) : ""; 1743 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + "-mw", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1744 } 1745 // inner wrapper styles 1746 str = getInnerWrapperStyles(options.edgePadding, options.gutter, options.fixedWidth, options.speed, options.autoHeight); 1747 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + "-iw", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1748 // container styles 1749 if (carousel) { 1750 str = horizontal && !autoWidth ? "width:" + getContainerWidth(options.fixedWidth, options.gutter, options.items) + ";" : ""; 1751 if (TRANSITIONDURATION) str += getTransitionDurationStyle(speed); 1752 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId, str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1753 } 1754 // slide styles 1755 str = horizontal && !autoWidth ? getSlideWidthStyle(options.fixedWidth, options.gutter, options.items) : ""; 1756 if (options.gutter) str += getSlideGutterStyle(options.gutter); 1757 // set gallery items transition-duration 1758 if (!carousel) { 1759 if (TRANSITIONDURATION) str += getTransitionDurationStyle(speed); 1760 if (ANIMATIONDURATION) str += getAnimationDurationStyle(speed); 1761 } 1762 if (str) (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + " > .tns-item", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1763 // non CSS mediaqueries: IE8 1764 // ## update inner wrapper, container, slides if needed 1765 // set inline styles for inner wrapper & container 1766 // insert stylesheet (one line) for slides only (since slides are many) 1767 } else { 1768 // middle wrapper styles 1769 update_carousel_transition_duration(); 1770 // inner wrapper styles 1771 innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, autoHeight); 1772 // container styles 1773 if (carousel && horizontal && !autoWidth) container.style.width = getContainerWidth(fixedWidth, gutter, items); 1774 // slide styles 1775 var str = horizontal && !autoWidth ? getSlideWidthStyle(fixedWidth, gutter, items) : ""; 1776 if (gutter) str += getSlideGutterStyle(gutter); 1777 // append to the last line 1778 if (str) (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + " > .tns-item", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1779 } 1780 // ## MEDIAQUERIES 1781 if (responsive && CSSMQ) for(var bp in responsive){ 1782 // bp: convert string to number 1783 bp = parseInt(bp); 1784 var opts = responsive[bp], str = "", middleWrapperStr = "", innerWrapperStr = "", containerStr = "", slideStr = "", itemsBP = !autoWidth ? getOption("items", bp) : null, fixedWidthBP = getOption("fixedWidth", bp), speedBP = getOption("speed", bp), edgePaddingBP = getOption("edgePadding", bp), autoHeightBP = getOption("autoHeight", bp), gutterBP = getOption("gutter", bp); 1785 // middle wrapper string 1786 if (TRANSITIONDURATION && middleWrapper && getOption("autoHeight", bp) && "speed" in opts) middleWrapperStr = "#" + slideId + "-mw{" + getTransitionDurationStyle(speedBP) + "}"; 1787 // inner wrapper string 1788 if ("edgePadding" in opts || "gutter" in opts) innerWrapperStr = "#" + slideId + "-iw{" + getInnerWrapperStyles(edgePaddingBP, gutterBP, fixedWidthBP, speedBP, autoHeightBP) + "}"; 1789 // container string 1790 if (carousel && horizontal && !autoWidth && ("fixedWidth" in opts || "items" in opts || fixedWidth && "gutter" in opts)) containerStr = "width:"
1790+ getContainerWidth(fixedWidthBP, gutterBP, itemsBP) + ";"; 1791 if (TRANSITIONDURATION && "speed" in opts) containerStr += getTransitionDurationStyle(speedBP); 1792 if (containerStr) containerStr = "#" + slideId + "{" + containerStr + "}"; 1793 // slide string 1794 if ("fixedWidth" in opts || fixedWidth && "gutter" in opts || !carousel && "items" in opts) slideStr += getSlideWidthStyle(fixedWidthBP, gutterBP, itemsBP); 1795 if ("gutter" in opts) slideStr += getSlideGutterStyle(gutterBP); 1796 // set gallery items transition-duration 1797 if (!carousel && "speed" in opts) { 1798 if (TRANSITIONDURATION) slideStr += getTransitionDurationStyle(speedBP); 1799 if (ANIMATIONDURATION) slideStr += getAnimationDurationStyle(speedBP); 1800 } 1801 if (slideStr) slideStr = "#" + slideId + " > .tns-item{" + slideStr + "}"; 1802 // add up 1803 str = middleWrapperStr + innerWrapperStr + containerStr + slideStr; 1804 if (str) sheet.insertRule("@media (min-width: " + bp / 16 + "em) {" + str + "}", sheet.cssRules.length); 1805 } 1806 }; 1807 var initTools = function initTools() { 1808 // == slides == 1809 updateSlideStatus(); 1810 // == live region == 1811 outerWrapper.insertAdjacentHTML("afterbegin", '<div class="tns-liveregion tns-visually-hidden" aria-live="polite" aria-atomic="true">slide <span class="current">' + getLiveRegionStr() + "</span> of " + slideCount + "</div>"); 1812 liveregionCurrent = outerWrapper.querySelector(".tns-liveregion .current"); 1813 // == autoplayInit == 1814 if (hasAutoplay) { 1815 var txt = autoplay ? "stop" : "start"; 1816 if (autoplayButton) (0, _setAttrsJs.setAttrs)(autoplayButton, { 1817 "data-action": txt 1818 }); 1819 else if (options.autoplayButtonOutput) { 1820 outerWrapper.insertAdjacentHTML(getInsertPosition(options.autoplayPosition), '<button type="button" data-action="' + txt + '">' + autoplayHtmlStrings[0] + txt + autoplayHtmlStrings[1] + autoplayText[0] + "</button>"); 1821 autoplayButton = outerWrapper.querySelector("[data-action]"); 1822 } 1823 // add event 1824 if (autoplayButton) (0, _addEventsJs.addEvents)(autoplayButton, { 1825 "click": toggleAutoplay 1826 }); 1827 if (autoplay) { 1828 startAutoplay(); 1829 if (autoplayHoverPause) (0, _addEventsJs.addEvents)(container, hoverEvents); 1830 if (autoplayResetOnVisibility) (0, _addEventsJs.addEvents)(container, visibilityEvent); 1831 } 1832 } 1833 // == navInit == 1834 if (hasNav) { 1835 var initIndex = !carousel ? 0 : cloneCount; 1836 // customized nav 1837 // will not hide the navs in case they're thumbnails 1838 if (navContainer) { 1839 (0, _setAttrsJs.setAttrs)(navContainer, { 1840 "aria-label": "Carousel Pagination" 1841 }); 1842 navItems = navContainer.children; 1843 (0, _forEachJs.forEach)(navItems, function(item, i) { 1844 (0, _setAttrsJs.setAttrs)(item, { 1845 "data-nav": i, 1846 "tabindex": "-1", 1847 "aria-label": navStr + (i + 1), 1848 "aria-controls": slideId 1849 }); 1850 }); 1851 // generated nav 1852 } else { 1853 var navHtml = "", hiddenStr = navAsThumbnails ? "" : 'style="display:none"'; 1854 for(var i = 0; i < slideCount; i++)// hide nav items by default 1855 navHtml += '<button type="button" data-nav="' + i + '" tabindex="-1" aria-controls="' + slideId + '" ' + hiddenStr + ' aria-label="' + navStr + (i + 1) + '"></button>'; 1856 navHtml = '<div class="tns-nav" aria-label="Carousel Pagination">' + navHtml + "</div>"; 1857 outerWrapper.insertAdjacentHTML(getInsertPosition(options.navPosition), navHtml); 1858 navContainer = outerWrapper.querySelector(".tns-nav"); 1859 navItems = navContainer.children; 1860 } 1861 updateNavVisibility(); 1862 // add transition 1863 if (TRANSITIONDURATION) { 1864 var prefix = TRANSITIONDURATION.substring(0, TRANSITIONDURATION.length - 18).toLowerCase(), str = "transition: all " + speed / 1000 + "s"; 1865 if (prefix) str = "-" + prefix + "-" + str; 1866 (0, _addCSSRuleJs.addCSSRule)(sheet, "[aria-controls^=" + slideId + "-item]", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 1867 } 1868 (0, _setAttrsJs.setAttrs)(navItems[navCurrentIndex], { 1869 "aria-label": navStr + (navCurrentIndex + 1) + navStrCurrent 1870 }); 1871 (0, _removeAttrsJs.removeAttrs)(navItems[navCurrentIndex], "tabindex"); 1872 (0, _addClassJs.addClass)(navItems[navCurrentIndex], navActiveClass); 1873 // add events 1874 (0, _addEventsJs.addEvents)(navContainer, navEvents); 1875 } 1876 // == controlsInit == 1877 if (hasControls) { 1878 if (!controlsContainer && (!prevButton || !nextButton)) { 1879 outerWrapper.insertAdjacentHTML(getInsertPosition(options.controlsPosition), '<div class="tns-controls" aria-label="Carousel Navigation" tabindex="0"><button type="button" data-controls="prev" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[0] + '</button><button type="button" data-controls="next" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[1] + "</button></div>"); 1880 controlsContainer = outerWrapper.querySelector(".tns-controls"); 1881 } 1882 if (!prevButton || !nextButton) { 1883 prevButton = controlsContainer.children[0]; 1884 nextButton = controlsContainer.children[1]; 1885 } 1886 if (options.controlsContainer) (0, _setAttrsJs.setAttrs)(controlsContainer, { 1887 "aria-label": "Carousel Navigation", 1888 "tabindex": "0" 1889 }); 1890 if (options.controlsContainer || options.prevButton && options.nextButton) (0, _setAttrsJs.setAttrs)([ 1891 prevButton, 1892 nextButton 1893 ], { 1894 "aria-controls": slideId, 1895 "tabindex": "-1" 1896 }); 1897 if (options.controlsContainer || options.prevButton && options.nextButton) { 1898 (0, _setAttrsJs.setAttrs)(prevButton, { 1899 "data-controls": "prev" 1900 }); 1901 (0, _setAttrsJs.setAttrs)(nextButton, { 1902 "data-controls": "next" 1903 }); 1904 } 1905 prevIsButton = isButton(prevButton); 1906 nextIsButton = isButton(nextButton); 1907 updateControlsStatus(); 1908 // add events
1909 if (controlsContainer) (0, _addEventsJs.addEvents)(controlsContainer, controlsEvents); 1910 else { 1911 (0, _addEventsJs.addEvents)(prevButton, controlsEvents); 1912 (0, _addEventsJs.addEvents)(nextButton, controlsEvents); 1913 } 1914 } 1915 // hide tools if needed 1916 disableUI(); 1917 }; 1918 var initEvents = function initEvents() { 1919 // add events 1920 if (carousel && TRANSITIONEND) { 1921 var eve = {}; 1922 eve[TRANSITIONEND] = onTransitionEnd; 1923 (0, _addEventsJs.addEvents)(container, eve); 1924 } 1925 if (touch) (0, _addEventsJs.addEvents)(container, touchEvents, options.preventScrollOnTouch); 1926 if (mouseDrag) (0, _addEventsJs.addEvents)(container, dragEvents); 1927 if (arrowKeys) (0, _addEventsJs.addEvents)(doc, docmentKeydownEvent); 1928 if (nested === "inner") events.on("outerResized", function() { 1929 resizeTasks(); 1930 events.emit("innerLoaded", info()); 1931 }); 1932 else if (responsive || fixedWidth || autoWidth || autoHeight || !horizontal) (0, _addEventsJs.addEvents)(win, { 1933 "resize": onResize 1934 }); 1935 if (autoHeight) { 1936 if (nested === "outer") events.on("innerLoaded", doAutoHeight); 1937 else if (!disable) doAutoHeight(); 1938 } 1939 doLazyLoad(); 1940 if (disable) disableSlider(); 1941 else if (freeze) freezeSlider(); 1942 events.on("indexChanged", additionalUpdates); 1943 if (nested === "inner") events.emit("innerLoaded", info()); 1944 if (typeof onInit === "function") onInit(info()); 1945 isOn = true; 1946 }; 1947 var destroy = function destroy() { 1948 // sheet 1949 sheet.disabled = true; 1950 if (sheet.ownerNode) sheet.ownerNode.remove(); 1951 // remove win event listeners 1952 (0, _removeEventsJs.removeEvents)(win, { 1953 "resize": onResize 1954 }); 1955 // arrowKeys, controls, nav 1956 if (arrowKeys) (0, _removeEventsJs.removeEvents)(doc, docmentKeydownEvent); 1957 if (controlsContainer) (0, _removeEventsJs.removeEvents)(controlsContainer, controlsEvents); 1958 if (navContainer) (0, _removeEventsJs.removeEvents)(navContainer, navEvents); 1959 // autoplay 1960 (0, _removeEventsJs.removeEvents)(container, hoverEvents); 1961 (0, _removeEventsJs.removeEvents)(container, visibilityEvent); 1962 if (autoplayButton) (0, _removeEventsJs.removeEvents)(autoplayButton, { 1963 "click": toggleAutoplay 1964 }); 1965 if (autoplay) clearInterval(autoplayTimer); 1966 // container 1967 if (carousel && TRANSITIONEND) { 1968 var eve = {}; 1969 eve[TRANSITIONEND] = onTransitionEnd; 1970 (0, _removeEventsJs.removeEvents)(container, eve); 1971 } 1972 if (touch) (0, _removeEventsJs.removeEvents)(container, touchEvents); 1973 if (mouseDrag) (0, _removeEventsJs.removeEvents)(container, dragEvents); 1974 // cache Object values in options && reset HTML 1975 var htmlList = [ 1976 containerHTML, 1977 controlsContainerHTML, 1978 prevButtonHTML, 1979 nextButtonHTML, 1980 navContainerHTML, 1981 autoplayButtonHTML 1982 ]; 1983 tnsList.forEach(function(item, i) { 1984 var el = item === "container" ? outerWrapper : options[item]; 1985 if (typeof el === "object" && el) { 1986 var prevEl = el.previousElementSibling ? el.previousElementSibling : false, parentEl = el.parentNode; 1987 el.outerHTML = htmlList[i]; 1988 options[item] = prevEl ? prevEl.nextElementSibling : parentEl.firstElementChild; 1989 } 1990 }); 1991 // reset variables 1992 tnsList = animateIn = animateOut = animateDelay = animateNormal = horizontal = outerWrapper = innerWrapper = container = containerParent = containerHTML = slideItems = slideCount = breakpointZone = windowWidth = autoWidth = fixedWidth = edgePadding = gutter = viewport = items = slideBy = viewportMax = arrowKeys = speed = rewind = loop = autoHeight = sheet = lazyload = slidePositions = slideItemsOut = cloneCount = slideCountNew = hasRightDeadZone = rightBoundary = updateIndexBeforeTransform = transformAttr = transformPrefix = transformPostfix = getIndexMax = index = indexCached = indexMin = indexMax = resizeTimer = swipeAngle = moveDirectionExpected = running = onInit = events = newContainerClasses = slideId = disable = disabled = freezable = freeze = frozen = controlsEvents = navEvents = hoverEvents = visibilityEvent = docmentKeydownEvent = touchEvents = dragEvents = hasControls = hasNav = navAsThumbnails = hasAutoplay = hasTouch = hasMouseDrag = slideActiveClass = imgCompleteClass = imgEvents = imgsComplete = controls = controlsText = controlsContainer = controlsContainerHTML = prevButton = nextButton = prevIsButton = nextIsButton = nav = navContainer = navContainerHTML = navItems = pages = pagesCached = navClicked = navCurrentIndex = navCurrentIndexCached = navActiveClass = navStr = navStrCurrent = autoplay = autoplayTimeout = autoplayDirection = autoplayText = autoplayHoverPause = autoplayButton = autoplayButtonHTML = autoplayResetOnVisibility = autoplayHtmlStrings = autoplayTimer = animating = autoplayHoverPaused = autoplayUserPaused = autoplayVisibilityPaused = initPosition = lastPosition = translateInit = disX = disY = panStart = rafIndex = getDist = touch = mouseDrag = null; 1993 // check variables 1994 // [animateIn, animateOut, animateDelay, animateNormal, horizontal, outerWrapper, innerWrapper, container, containerParent, containerHTML, slideItems, slideCount, breakpointZone, windowWidth, autoWidth, fixedWidth, edgePadding, gutter, viewport, items, slideBy, viewportMax, arrowKeys, speed, rewind, loop, autoHeight, sheet, lazyload, slidePositions, slideItemsOut, cloneCount, slideCountNew, hasRightDeadZone, rightBoundary, updateIndexBeforeTransform, transformAttr, transformPrefix, transformPostfix, getIndexMax, index, indexCached, indexMin, indexMax, resizeTimer, swipeAngle, moveDirectionExpected, running, onInit, events, newContainerClasses, slideId, disable, disabled, freezable, freeze, frozen, controlsEvents, navEvents, hoverEvents, visibilityEvent, docmentKeydownEvent, touchEvents, dragEvents, hasControls, hasNav, navAsThumbnails, hasAutoplay, hasTouch, hasMouseDrag, slideActiveClass, imgCompleteClass, imgEvents, imgsComplete, controls, controlsText, controlsContainer, controlsContainerHTML, prevButton, nextButton, prevIsButton, nextIsButton, nav, navContainer, navContainerHTML, navItems, pages, pagesCached, navClicked, navCurrentIndex, navCurrentIndexCached, navActiveClass, navStr, navStrCurrent, autoplay, autoplayTimeout, autoplayDirection, autoplayText, autoplayHoverPause, autoplayButton, autoplayButtonHTML, autoplayResetOnVisibility, autoplayHtmlStrings, autoplayTimer, animating, autoplayHoverPaused, autoplayUserPaused, autoplayVisibilityPaused, initPosition, lastPosition, translateInit, disX, disY, panStart, rafIndex, getDist, touch, mouseDrag ].forEach(function(item) { if (item !== null) { console.log(item); } }); 1995 for(var a in this)if (a !== "rebuild") this[a] = null; 1996 isOn = false;
1997 }; 1998 var onResize = // === ON RESIZE === 1999 // responsive || fixedWidth || autoWidth || !horizontal 2000 function onResize(e) { 2001 (0, _rafJs.raf)(function() { 2002 resizeTasks(getEvent(e)); 2003 }); 2004 }; 2005 var resizeTasks = function resizeTasks(e) { 2006 if (!isOn) return; 2007 if (nested === "outer") events.emit("outerResized", info(e)); 2008 windowWidth = getWindowWidth(); 2009 var bpChanged, breakpointZoneTem = breakpointZone, needContainerTransform = false; 2010 if (responsive) { 2011 setBreakpointZone(); 2012 bpChanged = breakpointZoneTem !== breakpointZone; 2013 // if (hasRightDeadZone) { needContainerTransform = true; } // *? 2014 if (bpChanged) events.emit("newBreakpointStart", info(e)); 2015 } 2016 var indChanged, itemsChanged, itemsTem = items, disableTem = disable, freezeTem = freeze, arrowKeysTem = arrowKeys, controlsTem = controls, navTem = nav, touchTem = touch, mouseDragTem = mouseDrag, autoplayTem = autoplay, autoplayHoverPauseTem = autoplayHoverPause, autoplayResetOnVisibilityTem = autoplayResetOnVisibility, indexTem = index; 2017 if (bpChanged) { 2018 var fixedWidthTem = fixedWidth, autoHeightTem = autoHeight, controlsTextTem = controlsText, centerTem = center, autoplayTextTem = autoplayText; 2019 if (!CSSMQ) var gutterTem = gutter, edgePaddingTem = edgePadding; 2020 } 2021 // get option: 2022 // fixed width: viewport, fixedWidth, gutter => items 2023 // others: window width => all variables 2024 // all: items => slideBy 2025 arrowKeys = getOption("arrowKeys"); 2026 controls = getOption("controls"); 2027 nav = getOption("nav"); 2028 touch = getOption("touch"); 2029 center = getOption("center"); 2030 mouseDrag = getOption("mouseDrag"); 2031 autoplay = getOption("autoplay"); 2032 autoplayHoverPause = getOption("autoplayHoverPause"); 2033 autoplayResetOnVisibility = getOption("autoplayResetOnVisibility"); 2034 if (bpChanged) { 2035 disable = getOption("disable"); 2036 fixedWidth = getOption("fixedWidth"); 2037 speed = getOption("speed"); 2038 autoHeight = getOption("autoHeight"); 2039 controlsText = getOption("controlsText"); 2040 autoplayText = getOption("autoplayText"); 2041 autoplayTimeout = getOption("autoplayTimeout"); 2042 if (!CSSMQ) { 2043 edgePadding = getOption("edgePadding"); 2044 gutter = getOption("gutter"); 2045 } 2046 } 2047 // update options 2048 resetVariblesWhenDisable(disable); 2049 viewport = getViewportWidth(); // <= edgePadding, gutter 2050 if ((!horizontal || autoWidth) && !disable) { 2051 setSlidePositions(); 2052 if (!horizontal) { 2053 updateContentWrapperHeight(); // <= setSlidePositions 2054 needContainerTransform = true; 2055 } 2056 } 2057 if (fixedWidth || autoWidth) { 2058 rightBoundary = getRightBoundary(); // autoWidth: <= viewport, slidePositions, gutter 2059 // fixedWidth: <= viewport, fixedWidth, gutter 2060 indexMax = getIndexMax(); // autoWidth: <= rightBoundary, slidePositions 2061 // fixedWidth: <= rightBoundary, fixedWidth, gutter 2062 } 2063 if (bpChanged || fixedWidth) { 2064 items = getOption("items"); 2065 slideBy = getOption("slideBy"); 2066 itemsChanged = items !== itemsTem; 2067 if (itemsChanged) { 2068 if (!fixedWidth && !autoWidth) indexMax = getIndexMax(); 2069 // <= items 2070 // check index before transform in case 2071 // slider reach the right edge then items become bigger 2072 updateIndex(); 2073 } 2074 } 2075 if (bpChanged) { 2076 if (disable !== disableTem) { 2077 if (disable) disableSlider(); 2078 else enableSlider(); // <= slidePositions, rightBoundary, indexMax 2079 } 2080 } 2081 if (freezable && (bpChanged || fixedWidth || autoWidth)) { 2082 freeze = getFreeze(); // <= autoWidth: slidePositions, gutter, viewport, rightBoundary 2083 // <= fixedWidth: fixedWidth, gutter, rightBoundary 2084 // <= others: items 2085 if (freeze !== freezeTem) { 2086 if (freeze) { 2087 doContainerTransform(getContainerTransformValue(getStartIndex(0))); 2088 freezeSlider(); 2089 } else { 2090 unfreezeSlider(); 2091 needContainerTransform = true; 2092 } 2093 } 2094 } 2095 resetVariblesWhenDisable(disable || freeze); // controls, nav, touch, mouseDrag, arrowKeys, autoplay, autoplayHoverPause, autoplayResetOnVisibility 2096 if (!autoplay) autoplayHoverPause = autoplayResetOnVisibility = false;
2097 if (arrowKeys !== arrowKeysTem) arrowKeys ? (0, _addEventsJs.addEvents)(doc, docmentKeydownEvent) : (0, _removeEventsJs.removeEvents)(doc, docmentKeydownEvent); 2098 if (controls !== controlsTem) { 2099 if (controls) { 2100 if (controlsContainer) (0, _showElementJs.showElement)(controlsContainer); 2101 else { 2102 if (prevButton) (0, _showElementJs.showElement)(prevButton); 2103 if (nextButton) (0, _showElementJs.showElement)(nextButton); 2104 } 2105 } else if (controlsContainer) (0, _hideElementJs.hideElement)(controlsContainer); 2106 else { 2107 if (prevButton) (0, _hideElementJs.hideElement)(prevButton); 2108 if (nextButton) (0, _hideElementJs.hideElement)(nextButton); 2109 } 2110 } 2111 if (nav !== navTem) { 2112 if (nav) { 2113 (0, _showElementJs.showElement)(navContainer); 2114 updateNavVisibility(); 2115 } else (0, _hideElementJs.hideElement)(navContainer); 2116 } 2117 if (touch !== touchTem) touch ? (0, _addEventsJs.addEvents)(container, touchEvents, options.preventScrollOnTouch) : (0, _removeEventsJs.removeEvents)(container, touchEvents); 2118 if (mouseDrag !== mouseDragTem) mouseDrag ? (0, _addEventsJs.addEvents)(container, dragEvents) : (0, _removeEventsJs.removeEvents)(container, dragEvents); 2119 if (autoplay !== autoplayTem) { 2120 if (autoplay) { 2121 if (autoplayButton) (0, _showElementJs.showElement)(autoplayButton); 2122 if (!animating && !autoplayUserPaused) startAutoplay(); 2123 } else { 2124 if (autoplayButton) (0, _hideElementJs.hideElement)(autoplayButton); 2125 if (animating) stopAutoplay(); 2126 } 2127 } 2128 if (autoplayHoverPause !== autoplayHoverPauseTem) autoplayHoverPause ? (0, _addEventsJs.addEvents)(container, hoverEvents) : (0, _removeEventsJs.removeEvents)(container, hoverEvents); 2129 if (autoplayResetOnVisibility !== autoplayResetOnVisibilityTem) autoplayResetOnVisibility ? (0, _addEventsJs.addEvents)(doc, visibilityEvent) : (0, _removeEventsJs.removeEvents)(doc, visibilityEvent); 2130 if (bpChanged) { 2131 if (fixedWidth !== fixedWidthTem || center !== centerTem) needContainerTransform = true; 2132 if (autoHeight !== autoHeightTem) { 2133 if (!autoHeight) innerWrapper.style.height = ""; 2134 } 2135 if (controls && controlsText !== controlsTextTem) { 2136 prevButton.innerHTML = controlsText[0]; 2137 nextButton.innerHTML = controlsText[1]; 2138 } 2139 if (autoplayButton && autoplayText !== autoplayTextTem) { 2140 var i = autoplay ? 1 : 0, html = autoplayButton.innerHTML, len = html.length - autoplayTextTem[i].length; 2141 if (html.substring(len) === autoplayTextTem[i]) autoplayButton.innerHTML = html.substring(0, len) + autoplayText[i]; 2142 } 2143 } else if (center && (fixedWidth || autoWidth)) needContainerTransform = true; 2144 if (itemsChanged || fixedWidth && !autoWidth) { 2145 pages = getPages(); 2146 updateNavVisibility(); 2147 } 2148 indChanged = index !== indexTem; 2149 if (indChanged) { 2150 events.emit("indexChanged", info()); 2151 needContainerTransform = true; 2152 } else if (itemsChanged) { 2153 if (!indChanged) additionalUpdates(); 2154 } else if (fixedWidth || autoWidth) { 2155 doLazyLoad(); 2156 updateSlideStatus(); 2157 updateLiveRegion(); 2158 } 2159 if (itemsChanged && !carousel) updateGallerySlidePositions(); 2160 if (!disable && !freeze) { 2161 // non-mediaqueries: IE8 2162 if (bpChanged && !CSSMQ) { 2163 // middle wrapper styles 2164 // inner wrapper styles 2165 if (edgePadding !== edgePaddingTem || gutter !== gutterTem) innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, speed, autoHeight); 2166 if (horizontal) { 2167 // container styles 2168 if (carousel) container.style.width = getContainerWidth(fixedWidth, gutter, items); 2169 // slide styles 2170 var str = getSlideWidthStyle(fixedWidth, gutter, items) + getSlideGutterStyle(gutter); 2171 // remove the last line and 2172 // add new styles 2173 (0, _removeCSSRuleJs.removeCSSRule)(sheet, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet) - 1); 2174 (0, _addCSSRuleJs.addCSSRule)(sheet, "#" + slideId + " > .tns-item", str, (0, _getCssRulesLengthJs.getCssRulesLength)(sheet)); 2175 } 2176 } 2177 // auto height 2178 if (autoHeight) doAutoHeight(); 2179 if (needContainerTransform) { 2180 doContainerTransformSilent(); 2181 indexCached = index; 2182 } 2183 } 2184 if (bpChanged) events.emit("newBreakpointEnd", info(e)); 2185 }; 2186 var getFreeze = // === INITIALIZATION FUNCTIONS === // 2187 function getFreeze() { 2188 if (!fixedWidth && !autoWidth) { 2189 var a = center ? items - (items - 1) / 2 : items; 2190 return slideCount <= a; 2191 } 2192 var width = fixedWidth ? (fixedWidth + gutter) * slideCount : slidePositions[slideCount], vp = edgePadding ? viewport + edgePadding * 2 : viewport + gutter; 2193 if (center) vp -= fixedWidth ? (viewport - fixedWidth) / 2 : (viewport - (slidePositions[index + 1] - slidePositions[index] - gutter)) / 2; 2194 return width <= vp; 2195 }; 2196 var setBreakpointZone = function setBreakpointZone() { 2197 breakpointZone = 0; 2198 for(var bp in responsive){ 2199 bp = parseInt(bp); // convert string to number 2200 if (windowWidth >= bp) breakpointZone = bp; 2201 } 2202 }; 2203 var disableUI = function disableUI() { 2204 if (!autoplay && autoplayButton) (0, _hideElementJs.hideElement)(autoplayButton); 2205 if (!nav && navContainer) (0, _hideElementJs.hideElement)(navContainer); 2206 if (!controls) {
2207 if (controlsContainer) (0, _hideElementJs.hideElement)(controlsContainer); 2208 else { 2209 if (prevButton) (0, _hideElementJs.hideElement)(prevButton); 2210 if (nextButton) (0, _hideElementJs.hideElement)(nextButton); 2211 } 2212 } 2213 }; 2214 var enableUI = function enableUI() { 2215 if (autoplay && autoplayButton) (0, _showElementJs.showElement)(autoplayButton); 2216 if (nav && navContainer) (0, _showElementJs.showElement)(navContainer); 2217 if (controls) { 2218 if (controlsContainer) (0, _showElementJs.showElement)(controlsContainer); 2219 else { 2220 if (prevButton) (0, _showElementJs.showElement)(prevButton); 2221 if (nextButton) (0, _showElementJs.showElement)(nextButton); 2222 } 2223 } 2224 }; 2225 var freezeSlider = function freezeSlider() { 2226 if (frozen) return; 2227 // remove edge padding from inner wrapper 2228 if (edgePadding) innerWrapper.style.margin = "0px"; 2229 // add class tns-transparent to cloned slides 2230 if (cloneCount) { 2231 var str = "tns-transparent"; 2232 for(var i = cloneCount; i--;){ 2233 if (carousel) (0, _addClassJs.addClass)(slideItems[i], str); 2234 (0, _addClassJs.addClass)(slideItems[slideCountNew - i - 1], str); 2235 } 2236 } 2237 // update tools 2238 disableUI(); 2239 frozen = true; 2240 }; 2241 var unfreezeSlider = function unfreezeSlider() { 2242 if (!frozen) return; 2243 // restore edge padding for inner wrapper 2244 // for mordern browsers 2245 if (edgePadding && CSSMQ) innerWrapper.style.margin = ""; 2246 // remove class tns-transparent to cloned slides 2247 if (cloneCount) { 2248 var str = "tns-transparent"; 2249 for(var i = cloneCount; i--;){ 2250 if (carousel) (0, _removeClassJs.removeClass)(slideItems[i], str); 2251 (0, _removeClassJs.removeClass)(slideItems[slideCountNew - i - 1], str); 2252 } 2253 } 2254 // update tools 2255 enableUI(); 2256 frozen = false; 2257 }; 2258 var disableSlider = function disableSlider() { 2259 if (disabled) return; 2260 sheet.disabled = true; 2261 container.className = container.className.replace(newContainerClasses.substring(1), ""); 2262 (0, _removeAttrsJs.removeAttrs)(container, [ 2263 "style" 2264 ]); 2265 if (loop) for(var j = cloneCount; j--;){ 2266 if (carousel) (0, _hideElementJs.hideElement)(slideItems[j]); 2267 (0, _hideElementJs.hideElement)(slideItems[slideCountNew - j - 1]); 2268 } 2269 // vertical slider 2270 if (!horizontal || !carousel) (0, _removeAttrsJs.removeAttrs)(innerWrapper, [ 2271 "style" 2272 ]); 2273 // gallery 2274 if (!carousel) for(var i = index, l = index + slideCount; i < l; i++){ 2275 var item = slideItems[i]; 2276 (0, _removeAttrsJs.removeAttrs)(item, [ 2277 "style" 2278 ]); 2279 (0, _removeClassJs.removeClass)(item, animateIn); 2280 (0, _removeClassJs.removeClass)(item, animateNormal); 2281 } 2282 // update tools 2283 disableUI(); 2284 disabled = true; 2285 }; 2286 var enableSlider = function enableSlider() { 2287 if (!disabled) return; 2288 sheet.disabled = false; 2289 container.className += newContainerClasses; 2290 doContainerTransformSilent(); 2291 if (loop) for(var j = cloneCount; j--;){ 2292 if (carousel) (0, _showElementJs.showElement)(slideItems[j]); 2293 (0, _showElementJs.showElement)(slideItems[slideCountNew - j - 1]); 2294 } 2295 // gallery 2296 if (!carousel) for(var i = index, l = index + slideCount; i < l; i++){ 2297 var item = slideItems[i], classN = i < index + items ? animateIn : animateNormal; 2298 item.style.left = (i - index) * 100 / items + "%"; 2299 (0, _addClassJs.addClass)(item, classN); 2300 } 2301 // update tools 2302 enableUI(); 2303 disabled = false; 2304 }; 2305 var updateLiveRegion = function updateLiveRegion() { 2306 var str = getLiveRegionStr(); 2307 if (liveregionCurrent.innerHTML !== str) liveregionCurrent.innerHTML = str; 2308 }; 2309 var getLiveRegionStr = function getLiveRegionStr() { 2310 var arr = getVisibleSlideRange(), start = arr[0] + 1, end = arr[1] + 1; 2311 return start === end ? start + "" : start + " to " + end; 2312 }; 2313 var getVisibleSlideRange = function getVisibleSlideRange(val) { 2314 if (val == null) val = getContainerTransformValue(); 2315 var start = index, end, rangestart, rangeend; 2316 // get range start, range end for autoWidth and fixedWidth 2317 if (center || edgePadding) { 2318 if (autoWidth || fixedWidth) { 2319 rangestart = -(parseFloat(val) + edgePadding); 2320 rangeend = rangestart + viewport + edgePadding * 2; 2321 } 2322 } else if (autoWidth) { 2323 rangestart = slidePositions[index]; 2324 rangeend = rangestart + viewport; 2325 } 2326 // get start, end 2327 // - check auto width 2328 if (autoWidth) slidePositions.forEach(function(point, i) { 2329 if (i < slideCountNew) { 2330 if ((center || edgePadding) && point <= rangestart + 0.5) start = i; 2331 if (rangeend - point >= 0.5) end = i; 2332 } 2333 }); 2334 else { 2335 if (fixedWidth) { 2336 var cell = fixedWidth + gutter; 2337 if (center || edgePadding) { 2338 start = Math.floor(rangestart / cell); 2339 end = Math.ceil(rangeend / cell - 1); 2340 } else end = start + Math.ceil(viewport / cell) - 1; 2341 } else if (center || edgePadding) { 2342 var a = items - 1; 2343 if (center) { 2344 start -= a / 2; 2345 end = index + a / 2; 2346 } else end = index + a; 2347 if (edgePadding) { 2348 var b = edgePadding * items / viewport; 2349 start -= b; 2350 end += b; 2351 } 2352 start = Math.floor(start); 2353 end = Math.ceil(end); 2354 } else end = start + items - 1; 2355 start = Math.max(start, 0); 2356 end = Math.min(end, slideCountNew - 1); 2357 } 2358 return [ 2359 start, 2360 end 2361 ]; 2362 }; 2363 var doLazyLoad = function doLazyLoad() { 2364 if (lazyload && !disable) { 2365 var arg = getVisibleSlideRange(); 2366 arg.push(lazyloadSelector); 2367 getImageArray.apply(null, arg).forEach(function(img) { 2368 if (!(0, _hasClassJs.hasClass)(img, imgCompleteClass)) { 2369 // stop propagation transitionend event to container 2370 var eve = {}; 2371 eve[TRANSITIONEND] = function(e) { 2372 e.stopPropagation(); 2373 }; 2374 (0, _addEventsJs.addEvents)(img, eve); 2375 (0, _addEventsJs.addEvents)(img, imgEvents); 2376 // update src 2377 img.src = (0, _getAttrJs.getAttr)(img, "data-src"); 2378 // update srcset 2379 var srcset = (0, _getAttrJs.getAttr)(img, "data-srcset"); 2380 if (srcset) img.srcset = srcset; 2381 (0, _addClassJs.addClass)(img, "loading"); 2382 } 2383 }); 2384 } 2385 }; 2386 var onImgLoaded = function onImgLoaded(e) { 2387 imgLoaded(getTarget(e)); 2388 }; 2389 var onImgFailed = function onImgFailed(e) { 2390 imgFailed(getTarget(e)); 2391 }; 2392 var imgLoaded = function imgLoaded(img) { 2393 (0, _addClassJs.addClass)(img, "loaded"); 2394 imgCompleted(img); 2395 }; 2396 var imgFailed = function imgFailed(img) { 2397 (0, _addClassJs.addClass)(img, "failed"); 2398 imgCompleted(img); 2399 }; 2400 var imgCompleted = function imgCompleted(img) { 2401 (0, _addClassJs.addClass)(img, imgCompleteClass); 2402 (0, _removeClassJs.removeClass)(img, "loading"); 2403 (0, _removeEventsJs.removeEvents)(img, imgEvents); 2404 }; 2405 var getImageArray = function getImageArray(start, end, imgSelector) { 2406 var imgs = []; 2407 if (!imgSelector) imgSelector = "img"; 2408 while(start <= end){
2409 (0, _forEachJs.forEach)(slideItems[start].querySelectorAll(imgSelector), function(img) { 2410 imgs.push(img); 2411 }); 2412 start++; 2413 } 2414 return imgs; 2415 }; 2416 var doAutoHeight = // check if all visible images are loaded 2417 // and update container height if it's done 2418 function doAutoHeight() { 2419 var imgs = getImageArray.apply(null, getVisibleSlideRange()); 2420 (0, _rafJs.raf)(function() { 2421 imgsLoadedCheck(imgs, updateInnerWrapperHeight); 2422 }); 2423 }; 2424 var additionalUpdates = function additionalUpdates() { 2425 doLazyLoad(); 2426 updateSlideStatus(); 2427 updateLiveRegion(); 2428 updateControlsStatus(); 2429 updateNavStatus(); 2430 }; 2431 var update_carousel_transition_duration = function update_carousel_transition_duration() { 2432 if (carousel && autoHeight) middleWrapper.style[TRANSITIONDURATION] = speed / 1000 + "s"; 2433 }; 2434 var getMaxSlideHeight = function getMaxSlideHeight(slideStart, slideRange) { 2435 var heights = []; 2436 for(var i = slideStart, l = Math.min(slideStart + slideRange, slideCountNew); i < l; i++)heights.push(slideItems[i].offsetHeight); 2437 return Math.max.apply(null, heights); 2438 }; 2439 var updateInnerWrapperHeight = // update inner wrapper height 2440 // 1. get the max-height of the visible slides 2441 // 2. set transitionDuration to speed 2442 // 3. update inner wrapper height to max-height 2443 // 4. set transitionDuration to 0s after transition done 2444 function updateInnerWrapperHeight() { 2445 var maxHeight = autoHeight ? getMaxSlideHeight(index, items) : getMaxSlideHeight(cloneCount, slideCount), wp = middleWrapper ? middleWrapper : innerWrapper; 2446 if (wp.style.height !== maxHeight) wp.style.height = maxHeight + "px"; 2447 }; 2448 var setSlidePositions = // get the distance from the top edge of the first slide to each slide 2449 // (init) => slidePositions 2450 function setSlidePositions() { 2451 slidePositions = [ 2452 0 2453 ]; 2454 var attr = horizontal ? "left" : "top", attr2 = horizontal ? "right" : "bottom", base = slideItems[0].getBoundingClientRect()[attr]; 2455 (0, _forEachJs.forEach)(slideItems, function(item, i) { 2456 // skip the first slide 2457 if (i) slidePositions.push(item.getBoundingClientRect()[attr] - base); 2458 // add the end edge 2459 if (i === slideCountNew - 1) slidePositions.push(item.getBoundingClientRect()[attr2] - base); 2460 }); 2461 }; 2462 var updateSlideStatus = // update slide 2463 function updateSlideStatus() { 2464 var range = getVisibleSlideRange(), start = range[0], end = range[1]; 2465 (0, _forEachJs.forEach)(slideItems, function(item, i) { 2466 // show slides 2467 if (i >= start && i <= end) { 2468 if ((0, _hasAttrJs.hasAttr)(item, "aria-hidden")) { 2469 (0, _removeAttrsJs.removeAttrs)(item, [ 2470 "aria-hidden", 2471 "tabindex" 2472 ]); 2473 (0, _addClassJs.addClass)(item, slideActiveClass); 2474 } 2475 } else if (!(0, _hasAttrJs.hasAttr)(item, "aria-hidden")) { 2476 (0, _setAttrsJs.setAttrs)(item, { 2477 "aria-hidden": "true", 2478 "tabindex": "-1" 2479 }); 2480 (0, _removeClassJs.removeClass)(item, slideActiveClass); 2481 } 2482 }); 2483 }; 2484 var updateGallerySlidePositions = // gallery: update slide position 2485 function updateGallerySlidePositions() { 2486 var l = index + Math.min(slideCount, items); 2487 for(var i = slideCountNew; i--;){ 2488 var item = slideItems[i]; 2489 if (i >= index && i < l) { 2490 // add transitions to visible slides when adjusting their positions 2491 (0, _addClassJs.addClass)(item, "tns-moving"); 2492 item.style.left = (i - index) * 100 / items + "%"; 2493 (0, _addClassJs.addClass)(item, animateIn); 2494 (0, _removeClassJs.removeClass)(item, animateNormal); 2495 } else if (item.style.left) { 2496 item.style.left = ""; 2497 (0, _addClassJs.addClass)(item, animateNormal); 2498 (0, _removeClassJs.removeClass)(item, animateIn); 2499 } 2500 // remove outlet animation 2501 (0, _removeClassJs.removeClass)(item, animateOut); 2502 } 2503 // removing '.tns-moving' 2504 setTimeout(function() {
2505 (0, _forEachJs.forEach)(slideItems, function(el) { 2506 (0, _removeClassJs.removeClass)(el, "tns-moving"); 2507 }); 2508 }, 300); 2509 }; 2510 var updateNavStatus = // set tabindex on Nav 2511 function updateNavStatus() { 2512 // get current nav 2513 if (nav) { 2514 navCurrentIndex = navClicked >= 0 ? navClicked : getCurrentNavIndex(); 2515 navClicked = -1; 2516 if (navCurrentIndex !== navCurrentIndexCached) { 2517 var navPrev = navItems[navCurrentIndexCached], navCurrent = navItems[navCurrentIndex]; 2518 (0, _setAttrsJs.setAttrs)(navPrev, { 2519 "tabindex": "-1", 2520 "aria-label": navStr + (navCurrentIndexCached + 1) 2521 }); 2522 (0, _removeClassJs.removeClass)(navPrev, navActiveClass); 2523 (0, _setAttrsJs.setAttrs)(navCurrent, { 2524 "aria-label": navStr + (navCurrentIndex + 1) + navStrCurrent 2525 }); 2526 (0, _removeAttrsJs.removeAttrs)(navCurrent, "tabindex"); 2527 (0, _addClassJs.addClass)(navCurrent, navActiveClass); 2528 navCurrentIndexCached = navCurrentIndex; 2529 } 2530 } 2531 }; 2532 var getLowerCaseNodeName = function getLowerCaseNodeName(el) { 2533 return el.nodeName.toLowerCase(); 2534 }; 2535 var isButton = function isButton(el) { 2536 return getLowerCaseNodeName(el) === "button"; 2537 }; 2538 var isAriaDisabled = function isAriaDisabled(el) { 2539 return el.getAttribute("aria-disabled") === "true"; 2540 }; 2541 var disEnableElement = function disEnableElement(isButton, el, val) { 2542 if (isButton) el.disabled = val; 2543 else el.setAttribute("aria-disabled", val.toString()); 2544 }; 2545 var updateControlsStatus = // set 'disabled' to true on controls when reach the edges 2546 function updateControlsStatus() { 2547 if (!controls || rewind || loop) return; 2548 var prevDisabled = prevIsButton ? prevButton.disabled : isAriaDisabled(prevButton), nextDisabled = nextIsButton ? nextButton.disabled : isAriaDisabled(nextButton), disablePrev = index <= indexMin ? true : false, disableNext = !rewind && index >= indexMax ? true : false; 2549 if (disablePrev && !prevDisabled) disEnableElement(prevIsButton, prevButton, true); 2550 if (!disablePrev && prevDisabled) disEnableElement(prevIsButton, prevButton, false); 2551 if (disableNext && !nextDisabled) disEnableElement(nextIsButton, nextButton, true); 2552 if (!disableNext && nextDisabled) disEnableElement(nextIsButton, nextButton, false); 2553 }; 2554 var resetDuration = // set duration 2555 function resetDuration(el, str) { 2556 if (TRANSITIONDURATION) el.style[TRANSITIONDURATION] = str; 2557 }; 2558 var getSliderWidth = function getSliderWidth() { 2559 return fixedWidth ? (fixedWidth + gutter) * slideCountNew : slidePositions[slideCountNew]; 2560 }; 2561 var getCenterGap = function getCenterGap(num) { 2562 if (num == null) num = index; 2563 var gap = edgePadding ? gutter : 0; 2564 return autoWidth ? (viewport - gap - (slidePositions[num + 1] - slidePositions[num] - gutter)) / 2 : fixedWidth ? (viewport - fixedWidth) / 2 : (items - 1) / 2; 2565 }; 2566 var getRightBoundary = function getRightBoundary() { 2567 var gap = edgePadding ? gutter : 0, result = viewport + gap - getSliderWidth(); 2568 if (center && !loop) result = fixedWidth ? -(fixedWidth + gutter) * (slideCountNew - 1) - getCenterGap() : getCenterGap(slideCountNew - 1) - slidePositions[slideCountNew - 1]; 2569 if (result > 0) result = 0; 2570 return result; 2571 }; 2572 var getContainerTransformValue = function getContainerTransformValue(num) { 2573 if (num == null) num = index; 2574 var val; 2575 if (horizontal && !autoWidth) { 2576 if (fixedWidth) { 2577 val = -(fixedWidth + gutter) * num; 2578 if (center) val += getCenterGap(); 2579 } else { 2580 var denominator = TRANSFORM ? slideCountNew : items; 2581 if (center) num -= getCenterGap(); 2582 val = -num * 100 / denominator; 2583 } 2584 } else { 2585 val = -slidePositions[num]; 2586 if (center && autoWidth) val += getCenterGap(); 2587 } 2588 if (hasRightDeadZone) val = Math.max(val, rightBoundary); 2589 val += horizontal && !autoWidth && !fixedWidth ? "%" : "px"; 2590 return val; 2591 }; 2592 var doContainerTransformSilent = function doContainerTransformSilent(val) { 2593 resetDuration(container, "0s"); 2594 doContainerTransform(val); 2595 }; 2596 var doContainerTransform = function doContainerTransform(val) { 2597 if (val == null) val = getContainerTransformValue(); 2598 container.style[transformAttr] = transformPrefix + val + transformPostfix; 2599 }; 2600 var animateSlide = function animateSlide(number, classOut, classIn, isOut) { 2601 var l = number + items; 2602 if (!loop) l = Math.min(l, slideCountNew); 2603 for(var i = number; i < l; i++){ 2604 var item = slideItems[i]; 2605 // set item positions 2606 if (!isOut) item.style.left = (i - index) * 100 / items + "%"; 2607 if (animateDelay && TRANSITIONDELAY) item.style[TRANSITIONDELAY] = item.style[ANIMATIONDELAY] = animateDelay * (i - number) / 1000 + "s"; 2608 (0, _removeClassJs.removeClass)(item, classOut); 2609 (0, _addClassJs.addClass)(item, classIn); 2610 if (isOut) slideItemsOut.push(item); 2611 } 2612 }; 2613 var render = function render(e, sliderMoved) { 2614 if (updateIndexBeforeTransform) updateIndex(); 2615 // render when slider was moved (touch or drag) even though index may not change 2616 if (index !== indexCached || sliderMoved) { 2617 // events 2618 events.emit("indexChanged", info()); 2619 events.emit("transitionStart", info()); 2620 if (autoHeight) doAutoHeight(); 2621 // pause autoplay when click or keydown from user 2622 if (animating && e && [ 2623 "click", 2624 "keydown" 2625 ].indexOf(e.type) >= 0) stopAutoplay(); 2626 running = true; 2627 transformCore(); 2628 } 2629 }; 2630 var strTrans = /* 2631 * Transfer prefixed properties to the same format 2632 * CSS: -Webkit-Transform => webkittransform 2633 * JS: WebkitTransform => webkittransform 2634 * @param {string} str - property 2635 * 2636 */ function strTrans(str) { 2637 return str.toLowerCase().replace(/-/g, ""); 2638 }; 2639 var onTransitionEnd = // AFTER TRANSFORM 2640 // Things need to be done after a transfer: 2641 // 1. check index 2642 // 2. add classes to visible slide 2643 // 3. disable controls buttons when reach the first/last slide in non-loop slider 2644 // 4. update nav status 2645 // 5. lazyload images 2646 // 6. update container height 2647 function onTransitionEnd(event) { 2648 // check running on gallery mode 2649 // make sure trantionend/animationend events run only once 2650 if (carousel || running) { 2651 events.emit("transitionEnd", info(event)); 2652 if (!carousel && slideItemsOut.length > 0) for(var i = 0; i < slideItemsOut.length; i++){ 2653 var item = slideItemsOut[i]; 2654 // set item positions 2655 item.style.left = ""; 2656 if (ANIMATIONDELAY && TRANSITIONDELAY) { 2657 item.style[ANIMATIONDELAY] = ""; 2658 item.style[TRANSITIONDELAY] = ""; 2659 } 2660 (0, _removeClassJs.removeClass)(item, animateOut); 2661 (0, _addClassJs.addClass)(item, animateNormal); 2662 } 2663 /* update slides, nav, controls after checking ... 2664 * => legacy browsers who don't support 'event' 2665 * have to check event first, otherwise event.target will cause an error 2666 * => or 'gallery' mode: 2667 * + event target is slide item 2668 * => or 'carousel' mode: 2669 * + event target is container, 2670 * + event.property is the same with transform attribute 2671 */ if (!event || !carousel && event.target.parentNode === container || event.target === container && strTrans(event.propertyName) === strTrans(transformAttr)) { 2672 if (!updateIndexBeforeTransform) { 2673 var indexTem = index; 2674 updateIndex(); 2675 if (index !== indexTem) { 2676 events.emit("indexChanged", info()); 2677 doContainerTransformSilent(); 2678 } 2679 } 2680 if (nested === "inner") events.emit("innerLoaded", info()); 2681 running = false;
2682 indexCached = index; 2683 } 2684 } 2685 }; 2686 var goTo = // # ACTIONS 2687 function goTo(targetIndex, e) { 2688 if (freeze) return; 2689 // prev slideBy 2690 if (targetIndex === "prev") onControlsClick(e, -1); 2691 else if (targetIndex === "next") onControlsClick(e, 1); 2692 else { 2693 if (running) { 2694 if (preventActionWhenRunning) return; 2695 else onTransitionEnd(); 2696 } 2697 var absIndex = getAbsIndex(), indexGap = 0; 2698 if (targetIndex === "first") indexGap = -absIndex; 2699 else if (targetIndex === "last") indexGap = carousel ? slideCount - items - absIndex : slideCount - 1 - absIndex; 2700 else { 2701 if (typeof targetIndex !== "number") targetIndex = parseInt(targetIndex); 2702 if (!isNaN(targetIndex)) { 2703 // from directly called goTo function 2704 if (!e) targetIndex = Math.max(0, Math.min(slideCount - 1, targetIndex)); 2705 indexGap = targetIndex - absIndex; 2706 } 2707 } 2708 // gallery: make sure new page won't overlap with current page 2709 if (!carousel && indexGap && Math.abs(indexGap) < items) { 2710 var factor = indexGap > 0 ? 1 : -1; 2711 indexGap += index + indexGap - slideCount >= indexMin ? slideCount * factor : slideCount * 2 * factor * -1; 2712 } 2713 index += indexGap; 2714 // make sure index is in range 2715 if (carousel && loop) { 2716 if (index < indexMin) index += slideCount; 2717 if (index > indexMax) index -= slideCount; 2718 } 2719 // if index is changed, start rendering 2720 if (getAbsIndex(index) !== getAbsIndex(indexCached)) render(e); 2721 } 2722 }; 2723 var onControlsClick = // on controls click 2724 function onControlsClick(e, dir) { 2725 if (running) { 2726 if (preventActionWhenRunning) return; 2727 else onTransitionEnd(); 2728 } 2729 var passEventObject; 2730 if (!dir) { 2731 e = getEvent(e); 2732 var target = getTarget(e); 2733 while(target !== controlsContainer && [ 2734 prevButton, 2735 nextButton 2736 ].indexOf(target) < 0)target = target.parentNode; 2737 var targetIn = [ 2738 prevButton, 2739 nextButton 2740 ].indexOf(target); 2741 if (targetIn >= 0) { 2742 passEventObject = true; 2743 dir = targetIn === 0 ? -1 : 1; 2744 } 2745 } 2746 if (rewind) { 2747 if (index === indexMin && dir === -1) { 2748 goTo("last", e); 2749 return; 2750 } else if (index === indexMax && dir === 1) { 2751 goTo("first", e); 2752 return; 2753 } 2754 } 2755 if (dir) { 2756 index += slideBy * dir; 2757 if (autoWidth) index = Math.floor(index); 2758 // pass e when click control buttons or keydown 2759 render(passEventObject || e && e.type === "keydown" ? e : null); 2760 } 2761 }; 2762 var onNavClick = // on nav click 2763 function onNavClick(e) { 2764 if (running) { 2765 if (preventActionWhenRunning) return; 2766 else onTransitionEnd(); 2767 } 2768 e = getEvent(e); 2769 var target = getTarget(e), navIndex; 2770 // find the clicked nav item 2771 while(target !== navContainer && !(0, _hasAttrJs.hasAttr)(target, "data-nav"))target = target.parentNode; 2772 if ((0, _hasAttrJs.hasAttr)(target, "data-nav")) { 2773 var navIndex = navClicked = Number((0, _getAttrJs.getAttr)(target, "data-nav")), targetIndexBase = fixedWidth || autoWidth ? navIndex * slideCount / pages : navIndex * items, targetIndex = navAsThumbnails ? navIndex : Math.min(Math.ceil(targetIndexBase), slideCount - 1); 2774 goTo(targetIndex, e); 2775 if (navCurrentIndex === navIndex) { 2776 if (animating) stopAutoplay(); 2777 navClicked = -1; // reset navClicked 2778 } 2779 } 2780 }; 2781 var setAutoplayTimer = // autoplay functions 2782 function setAutoplayTimer() { 2783 autoplayTimer = setInterval(function() { 2784 onControlsClick(null, autoplayDirection); 2785 }, autoplayTimeout); 2786 animating = true; 2787 }; 2788 var stopAutoplayTimer = function stopAutoplayTimer() { 2789 clearInterval(autoplayTimer); 2790 animating = false;
2791 }; 2792 var updateAutoplayButton = function updateAutoplayButton(action, txt) { 2793 (0, _setAttrsJs.setAttrs)(autoplayButton, { 2794 "data-action": action 2795 }); 2796 autoplayButton.innerHTML = autoplayHtmlStrings[0] + action + autoplayHtmlStrings[1] + txt; 2797 }; 2798 var startAutoplay = function startAutoplay() { 2799 setAutoplayTimer(); 2800 if (autoplayButton) updateAutoplayButton("stop", autoplayText[1]); 2801 }; 2802 var stopAutoplay = function stopAutoplay() { 2803 stopAutoplayTimer(); 2804 if (autoplayButton) updateAutoplayButton("start", autoplayText[0]); 2805 }; 2806 var play = // programaitcally play/pause the slider 2807 function play() { 2808 if (autoplay && !animating) { 2809 startAutoplay(); 2810 autoplayUserPaused = false; 2811 } 2812 }; 2813 var pause = function pause() { 2814 if (animating) { 2815 stopAutoplay(); 2816 autoplayUserPaused = true; 2817 } 2818 }; 2819 var toggleAutoplay = function toggleAutoplay() { 2820 if (animating) { 2821 stopAutoplay(); 2822 autoplayUserPaused = true; 2823 } else { 2824 startAutoplay(); 2825 autoplayUserPaused = false; 2826 } 2827 }; 2828 var onVisibilityChange = function onVisibilityChange() { 2829 if (doc.hidden) { 2830 if (animating) { 2831 stopAutoplayTimer(); 2832 autoplayVisibilityPaused = true; 2833 } 2834 } else if (autoplayVisibilityPaused) { 2835 setAutoplayTimer(); 2836 autoplayVisibilityPaused = false; 2837 } 2838 }; 2839 var mouseoverPause = function mouseoverPause() { 2840 if (animating) { 2841 stopAutoplayTimer(); 2842 autoplayHoverPaused = true; 2843 } 2844 }; 2845 var mouseoutRestart = function mouseoutRestart() { 2846 if (autoplayHoverPaused) { 2847 setAutoplayTimer(); 2848 autoplayHoverPaused = false; 2849 } 2850 }; 2851 var onDocumentKeydown = // keydown events on document 2852 function onDocumentKeydown(e) { 2853 e = getEvent(e); 2854 var keyIndex = [ 2855 KEYS.LEFT, 2856 KEYS.RIGHT 2857 ].indexOf(e.keyCode); 2858 if (keyIndex >= 0) onControlsClick(e, keyIndex === 0 ? -1 : 1); 2859 }; 2860 var onControlsKeydown = // on key control 2861 function onControlsKeydown(e) { 2862 e = getEvent(e); 2863 var keyIndex = [ 2864 KEYS.LEFT, 2865 KEYS.RIGHT 2866 ].indexOf(e.keyCode); 2867 if (keyIndex >= 0) { 2868 if (keyIndex === 0) { 2869 if (!prevButton.disabled) onControlsClick(e, -1); 2870 } else if (!nextButton.disabled) onControlsClick(e, 1); 2871 } 2872 }; 2873 var setFocus = // set focus 2874 function setFocus(el) { 2875 el.focus(); 2876 }; 2877 var onNavKeydown = // on key nav 2878 function onNavKeydown(e) { 2879 e = getEvent(e); 2880 var curElement = doc.activeElement; 2881 if (!(0, _hasAttrJs.hasAttr)(curElement, "data-nav")) return; 2882 // var code = e.keyCode, 2883 var keyIndex = [ 2884 KEYS.LEFT, 2885 KEYS.RIGHT, 2886 KEYS.ENTER, 2887 KEYS.SPACE 2888 ].indexOf(e.keyCode), navIndex = Number((0, _getAttrJs.getAttr)(curElement, "data-nav")); 2889 if (keyIndex >= 0) { 2890 if (keyIndex === 0) { 2891 if (navIndex > 0) setFocus(navItems[navIndex - 1]); 2892 } else if (keyIndex === 1) { 2893 if (navIndex < pages - 1) setFocus(navItems[navIndex + 1]); 2894 } else { 2895 navClicked = navIndex; 2896 goTo(navIndex, e); 2897 } 2898 } 2899 }; 2900 var getEvent = function getEvent(e) { 2901 e = e || win.event; 2902 return isTouchEvent(e) ? e.changedTouches[0] : e; 2903 }; 2904 var getTarget = function getTarget(e) { 2905 return e.target || win.event.srcElement; 2906 }; 2907 var isTouchEvent = function isTouchEvent(e) { 2908 return e.type.indexOf("touch") >= 0; 2909 }; 2910 var preventDefaultBehavior = function preventDefaultBehavior(e) { 2911 e.preventDefault ? e.preventDefault() : e.returnValue = false; 2912 }; 2913 var getMoveDirectionExpected = function getMoveDirectionExpected() { 2914 return (0, _getTouchDirectionJs.getTouchDirection)((0, _toDegreeJs.toDegree)(lastPosition.y - initPosition.y, lastPosition.x - initPosition.x), swipeAngle) === options.axis; 2915 }; 2916 var onPanStart = function onPanStart(e) { 2917 if (running) { 2918 if (preventActionWhenRunning) return; 2919 else onTransitionEnd(); 2920 } 2921 if (autoplay && animating) stopAutoplayTimer(); 2922 panStart = true; 2923 if (rafIndex) { 2924 (0, _cafJs.caf)(rafIndex); 2925 rafIndex = null; 2926 } 2927 var $ = getEvent(e); 2928 events.emit(isTouchEvent(e) ? "touchStart" : "dragStart", info(e)); 2929 if (!isTouchEvent(e) && [ 2930 "img", 2931 "a" 2932 ].indexOf(getLowerCaseNodeName(getTarget(e))) >= 0) preventDefaultBehavior(e); 2933 lastPosition.x = initPosition.x = $.clientX; 2934 lastPosition.y = initPosition.y = $.clientY; 2935 if (carousel) { 2936 translateInit = parseFloat(container.style[transformAttr].replace(transformPrefix, "")); 2937 resetDuration(container, "0s"); 2938 } 2939 }; 2940 var onPanMove = function onPanMove(e) { 2941 if (panStart) { 2942 var $ = getEvent(e); 2943 lastPosition.x = $.clientX; 2944 lastPosition.y = $.clientY; 2945 if (carousel) { 2946 if (!rafIndex) rafIndex = (0, _rafJs.raf)(function() { 2947 panUpdate(e); 2948 }); 2949 } else { 2950 if (moveDirectionExpected === "?") moveDirectionExpected = getMoveDirectionExpected(); 2951 if (moveDirectionExpected) preventScroll = true; 2952 } 2953 if ((typeof e.cancelable !== "boolean" || e.cancelable) && preventScroll) e.preventDefault(); 2954 } 2955 }; 2956 var onPanEnd = function onPanEnd(e) { 2957 if (panStart) { 2958 if (rafIndex) { 2959 (0, _cafJs.caf)(rafIndex); 2960 rafIndex = null; 2961 } 2962 if (carousel) resetDuration(container, ""); 2963 panStart = false;
2964 var $ = getEvent(e); 2965 lastPosition.x = $.clientX; 2966 lastPosition.y = $.clientY; 2967 var dist = getDist(lastPosition, initPosition); 2968 if (Math.abs(dist)) { 2969 // drag vs click 2970 if (!isTouchEvent(e)) { 2971 // prevent "click" 2972 var target = getTarget(e); 2973 (0, _addEventsJs.addEvents)(target, { 2974 "click": function preventClick(e) { 2975 preventDefaultBehavior(e); 2976 (0, _removeEventsJs.removeEvents)(target, { 2977 "click": preventClick 2978 }); 2979 } 2980 }); 2981 } 2982 if (carousel) rafIndex = (0, _rafJs.raf)(function() { 2983 if (horizontal && !autoWidth) { 2984 var indexMoved = -dist * items / (viewport + gutter); 2985 indexMoved = dist > 0 ? Math.floor(indexMoved) : Math.ceil(indexMoved); 2986 index += indexMoved; 2987 } else { 2988 var moved = -(translateInit + dist); 2989 if (moved <= 0) index = indexMin; 2990 else if (moved >= slidePositions[slideCountNew - 1]) index = indexMax; 2991 else { 2992 var i = 0; 2993 while(i < slideCountNew && moved >= slidePositions[i]){ 2994 index = i; 2995 if (moved > slidePositions[i] && dist < 0) index += 1; 2996 i++; 2997 } 2998 } 2999 } 3000 render(e, dist); 3001 events.emit(isTouchEvent(e) ? "touchEnd" : "dragEnd", info(e)); 3002 }); 3003 else if (moveDirectionExpected) onControlsClick(e, dist > 0 ? -1 : 1); 3004 } 3005 } 3006 // reset 3007 if (options.preventScrollOnTouch === "auto") preventScroll = false; 3008 if (swipeAngle) moveDirectionExpected = "?"; 3009 if (autoplay && !animating) setAutoplayTimer(); 3010 }; 3011 var updateContentWrapperHeight = // === RESIZE FUNCTIONS === // 3012 // (slidePositions, index, items) => vertical_conentWrapper.height 3013 function updateContentWrapperHeight() { 3014 var wp = middleWrapper ? middleWrapper : innerWrapper; 3015 wp.style.height = slidePositions[index + items] - slidePositions[index] + "px"; 3016 }; 3017 var getPages = function getPages() { 3018 var rough = fixedWidth ? (fixedWidth + gutter) * slideCount / viewport : slideCount / items; 3019 return Math.min(Math.ceil(rough), slideCount); 3020 }; 3021 var updateNavVisibility = /* 3022 * 1. update visible nav items list 3023 * 2. add "hidden" attributes to previous visible nav items 3024 * 3. remove "hidden" attrubutes to new visible nav items 3025 */ function updateNavVisibility() { 3026 if (!nav || navAsThumbnails) return; 3027 if (pages !== pagesCached) { 3028 var min = pagesCached, max = pages, fn = (0, _showElementJs.showElement); 3029 if (pagesCached > pages) { 3030 min = pages; 3031 max = pagesCached; 3032 fn = (0, _hideElementJs.hideElement); 3033 } 3034 while(min < max){ 3035 fn(navItems[min]); 3036 min++; 3037 } 3038 // cache pages 3039 pagesCached = pages; 3040 } 3041 }; 3042 var info = function info(e) { 3043 return { 3044 container: container, 3045 slideItems: slideItems, 3046 navContainer: navContainer, 3047 navItems: navItems, 3048 controlsContainer: controlsContainer, 3049 hasControls: hasControls, 3050 prevButton: prevButton, 3051 nextButton: nextButton, 3052 items: items, 3053 slideBy: slideBy, 3054 cloneCount: cloneCount, 3055 slideCount: slideCount, 3056 slideCountNew: slideCountNew, 3057 index: index, 3058 indexCached: indexCached, 3059 displayIndex: getCurrentSlide(), 3060 navCurrentIndex: navCurrentIndex, 3061 navCurrentIndexCached: navCurrentIndexCached, 3062 pages: pages, 3063 pagesCached: pagesCached, 3064 sheet: sheet, 3065 isOn: isOn, 3066 event: e || {} 3067 }; 3068 }; 3069 options = (0, _extendJs.extend)({ 3070 container: ".slider", 3071 mode: "carousel", 3072 axis: "horizontal", 3073 items: 1, 3074 gutter: 0, 3075 edgePadding: 0, 3076 fixedWidth: false, 3077 autoWidth: false, 3078 viewportMax: false, 3079 slideBy: 1, 3080 center: false, 3081 controls: true, 3082 controlsPosition: "top", 3083 controlsText: [ 3084 "prev", 3085 "next" 3086 ], 3087 controlsContainer: false,
3088 prevButton: false, 3089 nextButton: false, 3090 nav: true, 3091 navPosition: "top", 3092 navContainer: false, 3093 navAsThumbnails: false, 3094 arrowKeys: false, 3095 speed: 300, 3096 autoplay: false, 3097 autoplayPosition: "top", 3098 autoplayTimeout: 5000, 3099 autoplayDirection: "forward", 3100 autoplayText: [ 3101 "start", 3102 "stop" 3103 ], 3104 autoplayHoverPause: false, 3105 autoplayButton: false, 3106 autoplayButtonOutput: true, 3107 autoplayResetOnVisibility: true, 3108 animateIn: "tns-fadeIn", 3109 animateOut: "tns-fadeOut", 3110 animateNormal: "tns-normal", 3111 animateDelay: false, 3112 loop: true, 3113 rewind: false, 3114 autoHeight: false, 3115 responsive: false, 3116 lazyload: false, 3117 lazyloadSelector: ".tns-lazy-img", 3118 touch: true, 3119 mouseDrag: false, 3120 swipeAngle: 15, 3121 nested: false, 3122 preventActionWhenRunning: false, 3123 preventScrollOnTouch: false, 3124 freezable: true, 3125 onInit: false, 3126 useLocalStorage: true, 3127 nonce: false 3128 }, options || {}); 3129 var doc = document, win = window, KEYS = { 3130 ENTER: 13, 3131 SPACE: 32, 3132 LEFT: 37, 3133 RIGHT: 39 3134 }, tnsStorage = {}, localStorageAccess = options.useLocalStorage; 3135 if (localStorageAccess) { 3136 // check browser version and local storage access 3137 var browserInfo = navigator.userAgent; 3138 var uid = new Date; 3139 try { 3140 tnsStorage = win.localStorage; 3141 if (tnsStorage) { 3142 tnsStorage.setItem(uid, uid); 3143 localStorageAccess = tnsStorage.getItem(uid) == uid; 3144 tnsStorage.removeItem(uid); 3145 } else localStorageAccess = false; 3146 if (!localStorageAccess) tnsStorage = {}; 3147 } catch (e) { 3148 localStorageAccess = false; 3149 } 3150 if (localStorageAccess) { 3151 // remove storage when browser version changes 3152 if (tnsStorage["tnsApp"] && tnsStorage["tnsApp"] !== browserInfo) [ 3153 "tC", 3154 "tPL", 3155 "tMQ", 3156 "tTf", 3157 "t3D", 3158 "tTDu", 3159 "tTDe", 3160 "tADu", 3161 "tADe", 3162 "tTE", 3163 "tAE" 3164 ].forEach(function(item) { 3165 tnsStorage.removeItem(item); 3166 }); 3167 // update browserInfo 3168 localStorage["tnsApp"] = browserInfo; 3169 } 3170 } 3171 var CALC = tnsStorage["tC"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tC"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tC", (0, _calcJs.calc)(), localStorageAccess), PERCENTAGELAYOUT = tnsStorage["tPL"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tPL"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tPL", (0, _percentageLayoutJs.percentageLayout)(), localStorageAccess), CSSMQ = tnsStorage["tMQ"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tMQ"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tMQ", (0, _mediaquerySupportJs.mediaquerySupport)(), localStorageAccess), TRANSFORM = tnsStorage["tTf"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tTf"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tTf", (0, _whichPropertyJs.whichProperty)("transform"), localStorageAccess), HAS3DTRANSFORMS = tnsStorage["t3D"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["t3D"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "t3D", (0, _has3DTransformsJs.has3DTransforms)(TRANSFORM), localStorageAccess), TRANSITIONDURATION = tnsStorage["tTDu"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tTDu"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tTDu", (0, _whichPropertyJs.whichProperty)("transitionDuration"), localStorageAccess), TRANSITIONDELAY = tnsStorage["tTDe"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tTDe"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tTDe", (0, _whichPropertyJs.whichProperty)("transitionDelay"), localStorageAccess), ANIMATIONDURATION = tnsStorage["tADu"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tADu"]) : (0, _set
3171LocalStorageJs.setLocalStorage)(tnsStorage, "tADu", (0, _whichPropertyJs.whichProperty)("animationDuration"), localStorageAccess), ANIMATIONDELAY = tnsStorage["tADe"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tADe"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tADe", (0, _whichPropertyJs.whichProperty)("animationDelay"), localStorageAccess), TRANSITIONEND = tnsStorage["tTE"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tTE"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tTE", (0, _getEndPropertyJs.getEndProperty)(TRANSITIONDURATION, "Transition"), localStorageAccess), ANIMATIONEND = tnsStorage["tAE"] ? (0, _checkStorageValueJs.checkStorageValue)(tnsStorage["tAE"]) : (0, _setLocalStorageJs.setLocalStorage)(tnsStorage, "tAE", (0, _getEndPropertyJs.getEndProperty)(ANIMATIONDURATION, "Animation"), localStorageAccess); 3172 // get element nodes from selectors 3173 var supportConsoleWarn = win.console && typeof win.console.warn === "function", tnsList = [ 3174 "container", 3175 "controlsContainer", 3176 "prevButton", 3177 "nextButton", 3178 "navContainer", 3179 "autoplayButton" 3180 ], optionsElements = {}; 3181 tnsList.forEach(function(item) { 3182 if (typeof options[item] === "string") { 3183 var str = options[item], el = doc.querySelector(str); 3184 optionsElements[item] = str; 3185 if (el && el.nodeName) options[item] = el; 3186 else { 3187 if (supportConsoleWarn) console.warn("Can't find", options[item]); 3188 return; 3189 } 3190 } 3191 }); 3192 // make sure at least 1 slide 3193 if (options.container.children.length < 1) { 3194 if (supportConsoleWarn) console.warn("No slides found in", options.container); 3195 return; 3196 } 3197 // update options 3198 var responsive = options.responsive, nested = options.nested, carousel = options.mode === "carousel" ? true : false; 3199 if (responsive) { 3200 // apply responsive[0] to options and remove it 3201 if (0 in responsive) { 3202 options = (0, _extendJs.extend)(options, responsive[0]); 3203 delete responsive[0]; 3204 } 3205 var responsiveTem = {}; 3206 for(var key in responsive){ 3207 var val = responsive[key]; 3208 // update responsive 3209 // from: 300: 2 3210 // to: 3211 // 300: { 3212 // items: 2 3213 // } 3214 val = typeof val === "number" ? { 3215 items: val 3216 } : val; 3217 responsiveTem[key] = val; 3218 } 3219 responsive = responsiveTem; 3220 responsiveTem = null; 3221 } 3222 // update options 3223 function updateOptions(obj) { 3224 for(var key in obj){ 3225 if (!carousel) { 3226 if (key === "slideBy") obj[key] = "page"; 3227 if (key === "edgePadding") obj[key] = false; 3228 if (key === "autoHeight") obj[key] = false; 3229 } 3230 // update responsive options 3231 if (key === "responsive") updateOptions(obj[key]); 3232 } 3233 } 3234 if (!carousel) updateOptions(options); 3235 // === define and set variables === 3236 if (!carousel) { 3237 options.axis = "horizontal"; 3238 options.slideBy = "page"; 3239 options.edgePadding = false; 3240 var animateIn = options.animateIn, animateOut = options.animateOut, animateDelay = options.animateDelay, animateNormal = options.animateNormal; 3241 } 3242 var horizontal = options.axis === "horizontal" ? true : false, outerWrapper = doc.createElement("div"), innerWrapper = doc.createElement("div"), middleWrapper, container = options.container, containerParent = container.parentNode, containerHTML = container.outerHTML, slideItems = container.children, slideCount = slideItems.length, breakpointZone, windowWidth = getWindowWidth(), isOn = false; 3243 if (responsive) setBreakpointZone(); 3244 if (carousel) container.className += " tns-vpfix"; 3245 // fixedWidth: viewport > rightBoundary > indexMax 3246 var autoWidth = options.autoWidth, fixedWidth = getOption("fixedWidth"), edgePadding = getOption("edgePadding"), gutter = getOption("gutter"), viewport = getViewportWidth(), center = getOption("center"), items = !autoWidth ? Math.floor(getOption("items")) : 1, slideBy = getOption("slideBy"), viewportMax = options.viewportMax || options.fixedWidthViewportWidth, arrowKeys = getOption("arrowKeys"), speed = getOption("speed"), rewind = options.rewind, loop = rewind ? false : options.loop, autoHeight = getOption("autoHeight"), controls = getOption("c
3246ontrols"), controlsText = getOption("controlsText"), nav = getOption("nav"), touch = getOption("touch"), mouseDrag = getOption("mouseDrag"), autoplay = getOption("autoplay"), autoplayTimeout = getOption("autoplayTimeout"), autoplayText = getOption("autoplayText"), autoplayHoverPause = getOption("autoplayHoverPause"), autoplayResetOnVisibility = getOption("autoplayResetOnVisibility"), sheet = (0, _createStyleSheetJs.createStyleSheet)(null, getOption("nonce")), lazyload = options.lazyload, lazyloadSelector = options.lazyloadSelector, slidePositions, slideItemsOut = [], cloneCount = loop ? getCloneCountForLoop() : 0, slideCountNew = !carousel ? slideCount + cloneCount : slideCount + cloneCount * 2, hasRightDeadZone = (fixedWidth || autoWidth) && !loop ? true : false, rightBoundary = fixedWidth ? getRightBoundary() : null, updateIndexBeforeTransform = !carousel || !loop ? true : false, // transform 3247 transformAttr = horizontal ? "left" : "top", transformPrefix = "", transformPostfix = "", // index 3248 getIndexMax = function() { 3249 if (fixedWidth) return function() { 3250 return center && !loop ? slideCount - 1 : Math.ceil(-rightBoundary / (fixedWidth + gutter)); 3251 }; 3252 else if (autoWidth) return function() { 3253 for(var i = 0; i < slideCountNew; i++){ 3254 if (slidePositions[i] >= -rightBoundary) return i; 3255 } 3256 }; 3257 else return function() { 3258 if (center && carousel && !loop) return slideCount - 1; 3259 else return loop || carousel ? Math.max(0, slideCountNew - Math.ceil(items)) : slideCountNew - 1; 3260 }; 3261 }(), index = getStartIndex(getOption("startIndex")), indexCached = index, displayIndex = getCurrentSlide(), indexMin = 0, indexMax = !autoWidth ? getIndexMax() : null, // resize 3262 resizeTimer, preventActionWhenRunning = options.preventActionWhenRunning, swipeAngle = options.swipeAngle, moveDirectionExpected = swipeAngle ? "?" : true, running = false, onInit = options.onInit, events = new (0, _eventsJs.Events)(), // id, class 3263 newContainerClasses = " tns-slider tns-" + options.mode, slideId = container.id || (0, _getSlideIdJs.getSlideId)(), disable = getOption("disable"), disabled = false, freezable = options.freezable, freeze = freezable && !autoWidth ? getFreeze() : false, frozen = false, controlsEvents = { 3264 "click": onControlsClick, 3265 "keydown": onControlsKeydown 3266 }, navEvents = { 3267 "click": onNavClick, 3268 "keydown": onNavKeydown 3269 }, hoverEvents = { 3270 "mouseover": mouseoverPause, 3271 "mouseout": mouseoutRestart 3272 }, visibilityEvent = { 3273 "visibilitychange": onVisibilityChange 3274 }, docmentKeydownEvent = { 3275 "keydown": onDocumentKeydown 3276 }, touchEvents = { 3277 "touchstart": onPanStart, 3278 "touchmove": onPanMove, 3279 "touchend": onPanEnd, 3280 "touchcancel": onPanEnd 3281 }, dragEvents = { 3282 "mousedown": onPanStart, 3283 "mousemove": onPanMove, 3284 "mouseup": onPanEnd, 3285 "mouseleave": onPanEnd 3286 }, hasControls = hasOption("controls"), hasNav = hasOption("nav"), navAsThumbnails = autoWidth ? true : options.navAsThumbnails, hasAutoplay = hasOption("autoplay"), hasTouch = hasOption("touch"), hasMouseDrag = hasOption("mouseDrag"), slideActiveClass = "tns-slide-active", slideClonedClass = "tns-slide-cloned", imgCompleteClass = "tns-complete", imgEvents = { 3287 "load": onImgLoaded, 3288 "error": onImgFailed 3289 }, imgsComplete, liveregionCurrent, preventScroll = options.preventScrollOnTouch === "force" ? true : false; 3290 // controls 3291 if (hasControls) var controlsContainer = options.controlsContainer, controlsContainerHTML = options.controlsContainer ? options.controlsContainer.outerHTML : "", prevButton = options.prevButton, nextButton = options.nextButton, prevButtonHTML = options.prevButton ? options.prevButton.outerHTML : "", nextButtonHTML = options.nextButton ? options.nextButton.outerHTML : "", prevIsButton, nextIsButton; 3292 // nav 3293 if (hasNav) var navContainer = options.navContainer, navContainerHTML = options.navContainer ? options.navContainer.outerHTML : "", navItems, pages = autoWidth ? slideCount : getPages(), pagesCached = 0, navClicked = -1, navCurrentIndex = getCurrentNavIndex(), navCurrentIndexCached = navCurrentIndex, navActiveClass = "tns-nav-active", navStr = "Carousel Page ", navStrCurrent = " (Current Slide)"; 3294 // autoplay 3295 if (hasAutoplay) var autoplayDirection = options.autoplayDirection === "forward" ? 1 : -1, autoplayButton = options.autoplayButton, autoplayButtonHTML = options.autoplayButton ? options.autoplayButton.outerHTML : "", autoplayHtmlStrings = [ 3296 "<span class='tns-visually-hidden'>", 3297 " animation</span>" 3298 ], autoplayTimer, animating, autoplayHoverPaused, autoplayUserPaused, autoplayVisibilityPaused; 3299 if (hasTouch || hasMouseDrag) var initPosition = {}, lastPosition = {}, translateInit, disX, disY, panStart = false, rafIndex, getDist = horizontal ? function getDist(a, b) { 3300 return a.x - b.x; 3301 } : function(a, b) { 3302 return a.y - b.y; 3303 }; 3304 // disable slider when slidecount <= items 3305 if (!autoWidth) resetVariblesWhenDisable(disable || freeze); 3306 if (TRANSFORM) { 3307 transformAttr = TRANSFORM; 3308 transformPrefix = "translate"; 3309 if (HAS3DTRANSFORMS) { 3310 transformPrefix += horizontal ? "3d(" : "3d(0px, "; 3311 transformPostfix = horizontal ? ", 0px, 0px)" : ", 0px)"; 3312 } else { 3313 transformPrefix += horizontal ? "X(" : "Y("; 3314 transformPostfix = ")"; 3315 } 3316 } 3317 if (carousel) container.className = container.className.replace("tns-vpfix", ""); 3318 initStructure(); 3319 initSheet(); 3320 initSliderTransform(); 3321 function getClientWidth(el) { 3322 if (el == null) return; 3323 var div = doc.createElement("div"), rect, width; 3324 el.appendChild(div); 3325 rect = div.getBoundingClientRect(); 3326 width = rect.right - rect.left; 3327 div.remove(); 3328 return width || getClientWidth(el.parentNode); 3329 } 3330 // get option: 3331 // fixed width: viewport, fixedWidth, gutter => items 3332 // others: window width => all variables 3333 // all: items => slideBy 3334 function getOption(item, ww) { 3335 if (ww == null) ww = windowWidth; 3336 if (item === "items" && fixedWidth) return Math.floor((viewport + gutter) / (fixedWidth + gutter)) || 1; 3337 else { 3338 var result = options[item]; 3339 if (responsive) for(var bp in responsive){ 3340 // bp: convert string to number 3341 if (ww >= parseInt(bp)) { 3342 if (item in responsive[bp]) result = responsive[bp][item]; 3343 } 3344 } 3345 if (item === "slideBy" && result === "page") result = getOption("items"); 3346 if (!carousel && (item === "slideBy" || item === "items")) result = Math.floor(result); 3347 return result; 3348 } 3349 } 3350 // (slideBy, indexMin, indexMax) => index 3351 var updateIndex = function() { 3352 return loop ? carousel ? // loop + carousel
3353 function() { 3354 var leftEdge = indexMin, rightEdge = indexMax; 3355 leftEdge += slideBy; 3356 rightEdge -= slideBy; 3357 // adjust edges when has edge paddings 3358 // or fixed-width slider with extra space on the right side 3359 if (edgePadding) { 3360 leftEdge += 1; 3361 rightEdge -= 1; 3362 } else if (fixedWidth) { 3363 if ((viewport + gutter) % (fixedWidth + gutter)) rightEdge -= 1; 3364 } 3365 if (cloneCount) { 3366 if (index > rightEdge) index -= slideCount; 3367 else if (index < leftEdge) index += slideCount; 3368 } 3369 } : // loop + gallery 3370 function() { 3371 if (index > indexMax) while(index >= indexMin + slideCount)index -= slideCount; 3372 else if (index < indexMin) while(index <= indexMax - slideCount)index += slideCount; 3373 } : // non-loop 3374 function() { 3375 index = Math.max(indexMin, Math.min(indexMax, index)); 3376 }; 3377 }(); 3378 function imgsLoadedCheck(imgs, cb) { 3379 // execute callback function if all images are complete 3380 if (imgsComplete) return cb(); 3381 // check image classes 3382 imgs.forEach(function(img, index) { 3383 if (!lazyload && img.complete) imgCompleted(img); 3384 // Check image.complete 3385 if ((0, _hasClassJs.hasClass)(img, imgCompleteClass)) imgs.splice(index, 1); 3386 }); 3387 // execute callback function if selected images are all complete 3388 if (!imgs.length) return cb(); 3389 // otherwise execute this functiona again 3390 (0, _rafJs.raf)(function() { 3391 imgsLoadedCheck(imgs, cb); 3392 }); 3393 } 3394 // make transfer after click/drag: 3395 // 1. change 'transform' property for mordern browsers 3396 // 2. change 'left' property for legacy browsers 3397 var transformCore = function() { 3398 return carousel ? function() { 3399 resetDuration(container, ""); 3400 if (TRANSITIONDURATION || !speed) { 3401 // for morden browsers with non-zero duration or 3402 // zero duration for all browsers 3403 doContainerTransform(); 3404 // run fallback function manually 3405 // when duration is 0 / container is hidden 3406 if (!speed || !(0, _isVisibleJs.isVisible)(container)) onTransitionEnd(); 3407 } else // for old browser with non-zero duration 3408 (0, _jsTransformJs.jsTransform)(container, transformAttr, transformPrefix, transformPostfix, getContainerTransformValue(), speed, onTransitionEnd); 3409 if (!horizontal) updateContentWrapperHeight(); 3410 } : function() { 3411 slideItemsOut = []; 3412 var eve = {}; 3413 eve[TRANSITIONEND] = eve[ANIMATIONEND] = onTransitionEnd; 3414 (0, _removeEventsJs.removeEvents)(slideItems[indexCached], eve); 3415 (0, _addEventsJs.addEvents)(slideItems[index], eve); 3416 animateSlide(indexCached, animateIn, animateOut, true); 3417 animateSlide(index, animateNormal, animateIn); 3418 // run fallback function manually 3419 // when transition or animation not supported / duration is 0 3420 if (!TRANSITIONEND || !ANIMATIONEND || !speed || !(0, _isVisibleJs.isVisible)(container)) onTransitionEnd(); 3421 }; 3422 }(); 3423 function panUpdate(e) { 3424 if (!moveDirectionExpected) { 3425 panStart = false;
3426 return; 3427 } 3428 (0, _cafJs.caf)(rafIndex); 3429 if (panStart) rafIndex = (0, _rafJs.raf)(function() { 3430 panUpdate(e); 3431 }); 3432 if (moveDirectionExpected === "?") moveDirectionExpected = getMoveDirectionExpected(); 3433 if (moveDirectionExpected) { 3434 if (!preventScroll && isTouchEvent(e)) preventScroll = true; 3435 try { 3436 if (e.type) events.emit(isTouchEvent(e) ? "touchMove" : "dragMove", info(e)); 3437 } catch (err) {} 3438 var x = translateInit, dist = getDist(lastPosition, initPosition); 3439 if (!horizontal || fixedWidth || autoWidth) { 3440 x += dist; 3441 x += "px"; 3442 } else { 3443 var percentageX = TRANSFORM ? dist * items * 100 / ((viewport + gutter) * slideCountNew) : dist * 100 / (viewport + gutter); 3444 x += percentageX; 3445 x += "%"; 3446 } 3447 container.style[transformAttr] = transformPrefix + x + transformPostfix; 3448 } 3449 } 3450 return { 3451 version: "2.9.4", 3452 getInfo: info, 3453 events: events, 3454 goTo: goTo, 3455 play: play, 3456 pause: pause, 3457 isOn: isOn, 3458 updateSliderHeight: updateInnerWrapperHeight, 3459 refresh: initSliderTransform, 3460 destroy: destroy, 3461 rebuild: function rebuild() { 3462 return tns((0, _extendJs.extend)(options, optionsElements)); 3463 } 3464 }; 3465}; 3466 3467},{"./helpers/raf.js":"lDsmc","./helpers/caf.js":"cQFXo","./helpers/extend.js":"68ioS","./helpers/checkStorageValue.js":"eMgyB","./helpers/setLocalStorage.js":"L8aKM","./helpers/getSlideId.js":"7IP1q","./helpers/calc.js":"7XiAu","./helpers/percentageLayout.js":"iptJh","./helpers/mediaquerySupport.js":"ef5nu","./helpers/createStyleSheet.js":"bOnHM","./helpers/addCSSRule.js":"3kfdC","./helpers/removeCSSRule.js":"ltpHE","./helpers/getCssRulesLength.js":"9gAor","./helpers/toDegree.js":"1CsEb","./helpers/getTouchDirection.js":"403Ql","./helpers/forEach.js":"6iFYy","./helpers/hasClass.js":"e4x6P","./helpers/addClass.js":"2erkL","./helpers/removeClass.js":"lcI6l","./helpers/hasAttr.js":"j5D4a","./helpers/getAttr.js":"cROts","./helpers/setAttrs.js":"iBJUu","./helpers/removeAttrs.js":"9u1R4","./helpers/arrayFromNodeList.js":"fabVn","./helpers/hideElement.js":"eVq2N","./helpers/showElement.js":"4F9lX","./helpers/isVisible.js":"GsYeI","./helpers/whichProperty.js":"fQSrz","./helpers/has3DTransforms.js":"54Rk4","./helpers/getEndProperty.js":"hbW9c","./helpers/addEvents.js":"b8eEh","./helpers/removeEvents.js":"1yN4c","./helpers/events.js":"eEqOW","./helpers/jsTransform.js":"aCBhA","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"lDsmc":[function(require,module,exports) { 3468var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3469parcelHelpers.defineInteropFlag(exports); 3470parcelHelpers.export(exports, "raf", function() { 3471 return raf; 3472}); 3473var win = window; 3474var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.msRequestAnimationFrame || function(cb) { 3475 return setTimeout(cb, 16); 3476}; 3477 3478},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"cQFXo":[function(require,module,exports) { 3479var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3480parcelHelpers.defineInteropFlag(exports); 3481parcelHelpers.export(exports, "caf", function() { 3482 return caf; 3483}); 3484var win = window; 3485var caf = win.cancelAnimationFrame || win.mozCancelAnimationFrame || function(id) { 3486 clearTimeout(id); 3487}; 3488 3489},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"68ioS":[function(require,module,exports) { 3490var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3491parcelHelpers.defineInteropFlag(exports); 3492parcelHelpers.export(exports, "extend", function() { 3493 return extend; 3494}); 3495function extend() { 3496 var obj, name, copy, target = arguments[0] || {}, i = 1, length = arguments.length; 3497 for(; i < length; i++){ 3498 if ((obj = arguments[i]) !== null) for(name in obj){ 3499 copy = obj[name]; 3500 if (target === copy) continue; 3501 else if (copy !== undefined) target[name] = copy; 3502 } 3503 } 3504 return target; 3505} 3506 3507},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"eMgyB":[function(require,module,exports) { 3508var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3509parcelHelpers.defineInteropFlag(exports); 3510parcelHelpers.export(exports, "checkStorageValue", function() { 3511 return checkStorageValue; 3512}); 3513function checkStorageValue(value) { 3514 return [ 3515 "true", 3516 "false" 3517 ].indexOf(value) >= 0 ? JSON.parse(value) : value; 3518} 3519 3520},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"L8aKM":[function(require,module,exports) { 3521var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3522parcelHelpers.defineInteropFlag(exports); 3523parcelHelpers.export(exports, "setLocalStorage", function() { 3524 return setLocalStorage; 3525}); 3526function setLocalStorage(storage, key, value, access) { 3527 if (access) try { 3528 storage.setItem(key, value); 3529 } catch (e) {} 3530 return value; 3531} 3532 3533},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}
3533],"7IP1q":[function(require,module,exports) { 3534var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3535parcelHelpers.defineInteropFlag(exports); 3536parcelHelpers.export(exports, "getSlideId", function() { 3537 return getSlideId; 3538}); 3539function getSlideId() { 3540 var id = window.tnsId; 3541 window.tnsId = !id ? 1 : id + 1; 3542 return "tns" + window.tnsId; 3543} 3544 3545},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"7XiAu":[function(require,module,exports) { 3546// get css-calc 3547// @return - false | calc | -webkit-calc | -moz-calc 3548// @usage - var calc = getCalc(); 3549var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3550parcelHelpers.defineInteropFlag(exports); 3551parcelHelpers.export(exports, "calc", function() { 3552 return calc; 3553}); 3554var _getBodyJs = require("./getBody.js"); 3555var _setFakeBodyJs = require("./setFakeBody.js"); 3556var _resetFakeBodyJs = require("./resetFakeBody.js"); 3557function calc() { 3558 var doc = document, body = (0, _getBodyJs.getBody)(), docOverflow = (0, _setFakeBodyJs.setFakeBody)(body), div = doc.createElement("div"), result = false;
3559 body.appendChild(div); 3560 try { 3561 var str = "(10px * 10)", vals = [ 3562 "calc" + str, 3563 "-moz-calc" + str, 3564 "-webkit-calc" + str 3565 ], val; 3566 for(var i = 0; i < 3; i++){ 3567 val = vals[i]; 3568 div.style.width = val; 3569 if (div.offsetWidth === 100) { 3570 result = val.replace(str, ""); 3571 break; 3572 } 3573 } 3574 } catch (e) {} 3575 body.fake ? (0, _resetFakeBodyJs.resetFakeBody)(body, docOverflow) : div.remove(); 3576 return result; 3577} 3578 3579},{"./getBody.js":"cQdcE","./setFakeBody.js":"e2ZOJ","./resetFakeBody.js":"2r7Gm","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"cQdcE":[function(require,module,exports) { 3580var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3581parcelHelpers.defineInteropFlag(exports); 3582parcelHelpers.export(exports, "getBody", function() { 3583 return getBody; 3584}); 3585function getBody() { 3586 var doc = document, body = doc.body; 3587 if (!body) { 3588 body = doc.createElement("body"); 3589 body.fake = true; 3590 } 3591 return body; 3592} 3593 3594},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"e2ZOJ":[function(require,module,exports) { 3595var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3596parcelHelpers.defineInteropFlag(exports); 3597parcelHelpers.export(exports, "setFakeBody", function() { 3598 return setFakeBody; 3599}); 3600var _docElementJs = require("./docElement.js"); 3601function setFakeBody(body) { 3602 var docOverflow = ""; 3603 if (body.fake) { 3604 docOverflow = (0, _docElementJs.docElement).style.overflow; 3605 //avoid crashing IE8, if background image is used 3606 body.style.background = ""; 3607 //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible 3608 body.style.overflow = (0, _docElementJs.docElement).style.overflow = "hidden"; 3609 (0, _docElementJs.docElement).appendChild(body); 3610 } 3611 return docOverflow; 3612} 3613 3614},{"./docElement.js":"lJ12T","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"lJ12T":[function(require,module,exports) { 3615var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3616parcelHelpers.defineInteropFlag(exports); 3617parcelHelpers.export(exports, "docElement", function() { 3618 return docElement; 3619}); 3620var docElement = document.documentElement; 3621 3622},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"2r7Gm":[function(require,module,exports) { 3623var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3624parcelHelpers.defineInteropFlag(exports); 3625parcelHelpers.export(exports, "resetFakeBody", function() { 3626 return resetFakeBody; 3627}); 3628var _docElementJs = require("./docElement.js"); 3629function resetFakeBody(body, docOverflow) { 3630 if (body.fake) { 3631 body.remove(); 3632 (0, _docElementJs.docElement).style.overflow = docOverflow; 3633 // Trigger layout so kinetic scrolling isn't disabled in iOS6+ 3634 // eslint-disable-next-line 3635 (0, _docElementJs.docElement).offsetHeight; 3636 } 3637} 3638 3639},{"./docElement.js":"lJ12T","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"iptJh":[function(require,module,exports) { 3640// get subpixel support value 3641// @return - boolean 3642var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3643parcelHelpers.defineInteropFlag(exports); 3644parcelHelpers.export(exports, "percentageLayout", function() { 3645 return percentageLayout; 3646}); 3647var _getBodyJs = require("./getBody.js"); 3648var _setFakeBodyJs = require("./setFakeBody.js"); 3649var _resetFakeBodyJs = require("./resetFakeBody.js"); 3650function percentageLayout() { 3651 // check subpixel layout supporting 3652 var doc = document, body = (0, _getBodyJs.getBody)(), docOverflow = (0, _setFakeBodyJs.setFakeBody)(body), wrapper = doc.createElement("div"), outer = doc.createElement("div"), str = "", count = 70, perPage = 3, supported = false; 3653 wrapper.className = "tns-t-subp2"; 3654 outer.className = "tns-t-ct"; 3655 for(var i = 0; i < count; i++)str += "<div></div>"; 3656 outer.innerHTML = str; 3657 wrapper.appendChild(outer); 3658 body.appendChild(wrapper); 3659 supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2; 3660 body.fake ? (0, _resetFakeBodyJs.resetFakeBody)(body, docOverflow) : wrapper.remove(); 3661 return supported; 3662} 3663 3664},{"./getBody.js":"cQdcE","./setFakeBody.js":"e2ZOJ","./resetFakeBody.js":"2r7Gm","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"ef5nu":[function(require,module,exports) { 3665var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3666parcelHelpers.defineInteropFlag(exports); 3667parcelHelpers.export(exports, "mediaquerySupport", function() { 3668 return mediaquerySupport; 3669}); 3670var _getBodyJs = require("./getBody.js"); 3671var _setFakeBodyJs = require("./setFakeBody.js"); 3672var _resetFakeBodyJs = require("./resetFakeBody.js"); 3673function mediaquerySupport() { 3674 if (window.matchMedia || window.msMatchMedia) return true; 3675 var doc = document, body = (0, _getBodyJs.getBody)(), docOverflow = (0, _setFakeBodyJs.setFakeBody)(body), div = doc.createElement("div"), style = doc.createElement("style"), rule = "@media all and (min-width:1px){.tns-mq-test{position:absolute}}", position; 3676 style.type = "text/css"; 3677 div.className = "tns-mq-test"; 3678 body.appendChild(style); 3679 body.appendChild(div); 3680 if (style.styleSheet) style.styleSheet.cssText = rule; 3681 else style.appendChild(doc.createTextNode(rule)); 3682 position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle["position"]; 3683 body.fake ? (0, _resetFakeBodyJs.resetFakeBody)(body, docOverflow) : div.remove(); 3684 return position === "absolute"; 3685} 3686 3687},{"./getBody.js":"cQdcE","./setFakeBody.js":"e2ZOJ","./resetFakeBody.js":"2r7Gm","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"bOnHM":[function(require,module,exports) { 3688// create and append style sheet 3689var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3690parcelHelpers.defineInteropFlag(exports); 3691parcelHelpers.export(exports, "createStyleSheet", function() { 3692 return createStyleSheet; 3693}); 3694function createStyleSheet(media, nonce) { 3695 // Create the <style> tag 3696 var style = document.createElement("style"); 3697 // style.setAttribute("type", "text/css"); 3698 // Add a media (and/or media query) here if you'd like! 3699 // style.setAttribute("media", "screen") 3700 // style.setAttribute("media", "only screen and (max-width : 1024px)") 3701 if (media) style.setAttribute("media", media); 3702 // Add nonce attribute for Content Security Policy 3703 if (nonce) style.setAttribute("nonce", nonce); 3704 // WebKit hack :( 3705 // style.appendChild(document.createTextNode("")); 3706 // Add the <style> element to the page 3707 document.querySelector("head").appendChild(style); 3708 return style.sheet ? style.sheet : style.styleSheet; 3709} 3710 3711},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"3kfdC":[function(require,module,exports) { 3712// cross browsers addRule method 3713var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3714parcelHelpers.defineInteropFlag(exports); 3715parcelHelpers.export(exports, "addCSSRule", function() { 3716 return addCSSRule; 3717}); 3718var _rafJs = require("./raf.js"); 3719function addCSSRule(sheet, selector, rules, index) { 3720 // return raf(function() { 3721 "insertRule" in sheet ? sheet.insertRule(selector + "{" + rules + "}", index) : sheet.addRule(selector, rules, index); 3722// }); 3723} 3724 3725},{"./raf.js":"lDsmc","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"ltpHE":[function(require,module,exports) { 3726// cross browsers addRule method 3727var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3728parcelHelpers.defineInteropFlag(exports); 3729parcelHelpers.export(exports, "removeCSSRule", function() { 3730 return removeCSSRule; 3731}); 3732var _rafJs = require("./raf.js"); 3733function removeCSSRule(sheet, index) { 3734 // return raf(function() { 3735 "deleteRule" in sheet ? sheet.deleteRule(index) : sheet.removeRule(index); 3736// }); 3737} 3738 3739},{"./raf.js":"lDsmc","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"9gAor":[function(require,module,exports) { 3740var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3741parcelHelpers.defineInteropFlag(exports); 3742parcelHelpers.export(exports, "getCssRulesLength", function() { 3743 return getCssRulesLength; 3744}); 3745function getCssRulesLength(sheet) { 3746 var rule = "insertRule" in sheet ? sheet.cssRules : sheet.rules; 3747 return rule.length; 3748} 3749 3750},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"1CsEb":[function(require,module,exports) { 3751var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3752parcelHelpers.defineInteropFlag(exports); 3753parcelHelpers.export(exports, "toDegree", function() { 3754 return toDegree; 3755}); 3756function toDegree(y, x) { 3757 return Math.atan2(y, x) * (180 / Math.PI); 3758} 3759 3760},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"403Ql":[function(require,module,exports) { 3761var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3762parcelHelpers.defineInteropFlag(exports); 3763parcelHelpers.export(exports, "getTouchDirection", function() { 3764 return getTouchDirection; 3765}); 3766function getTouchDirection(angle, range) { 3767 var direction = false, gap = Math.abs(90 - Math.abs(angle)); 3768 if (gap >= 90 - range) direction = "horizontal"; 3769 else if (gap <= range) direction = "vertical"; 3770 return direction; 3771} 3772 3773},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"6iFYy":[function(require,module,exports) { 3774// https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/ 3775var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3776parcelHelpers.defineInteropFlag(exports); 3777parcelHelpers.export(exports, "forEach", function() { 3778 return forEach; 3779}); 3780function forEach(arr, callback, scope) { 3781 for(var i = 0, l = arr.length; i < l; i++)callback.call(scope, arr[i], i); 3782} 3783 3784},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"e4x6P":[function(require,module,exports) { 3785var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3786parcelHelpers.defineInteropFlag(exports); 3787parcelHelpers.export(exports, "classListSupport", function() { 3788 return 0, _classListSupportJs.classListSupport; 3789}); 3790parcelHelpers.export(exports, "hasClass", function() { 3791 return hasClass; 3792}); 3793var _classListSupportJs = require("./classListSupport.js"); 3794var hasClass = (0, _classListSupportJs.classListSupport) ? function hasClass(el, str) { 3795 return el.classList.contains(str); 3796} : function(el, str) { 3797 return el.className.indexOf(str) >= 0; 3798}; 3799 3800},{"./classListSupport.js":"hFCTw","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"hFCTw":[function(require,module,exports) { 3801var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3802parcelHelpers.defineInteropFlag(exports); 3803parcelHelpers.export(exports, "classListSupport", function() { 3804 return classListSupport; 3805}); 3806var classListSupport = "classList" in document.createElement("_"); 3807 3808},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"2erkL":[function(require,module,exports) { 3809var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3810parcelHelpers.defineInteropFlag(exports); 3811parcelHelpers.export(exports, "addClass", function() { 3812 return addClass; 3813}); 3814var _hasClassJs = require("./hasClass.js"); 3815var addClass = (0, _hasClassJs.classListSupport) ? function addClass(el, str) { 3816 if (!(0, _hasClassJs.hasClass)(el, str)) el.classList.add(str); 3817} : function(el, str) { 3818 if (!(0, _hasClassJs.hasClass)(el, str)) el.className += " " + str; 3819}; 3820 3821},{"./hasClass.js":"e4x6P","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"lcI6l":[function(require,module,exports) { 3822var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3823parcelHelpers.defineInteropFlag(exports); 3824parcelHelpers.export(exports, "removeClass", function() { 3825 return removeClass; 3826}); 3827var _hasClassJs = require("./hasClass.js"); 3828var removeClass = (0, _hasClassJs.classListSupport) ? function removeClass(el, str) { 3829 if ((0, _hasClassJs.hasClass)(el, str)) el.classList.remove(str); 3830} : function(el, str) { 3831 if ((0, _hasClassJs.hasClass)(el, str)) el.className = el.className.replace(str, ""); 3832}; 3833 3834},{"./hasClass.js":"e4x6P","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"j5D4a":[function(require,module,exports) { 3835var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3836parcelHelpers.defineInteropFlag(exports); 3837parcelHelpers.export(exports, "hasAttr", function() { 3838 return hasAttr; 3839}); 3840function hasAttr(el, attr) { 3841 return el.hasAttribute(attr); 3842} 3843 3844},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"cROts":[function(require,module,exports) { 3845var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3846parcelHelpers.defineInteropFlag(exports); 3847parcelHelpers.export(exports, "getAttr", function() { 3848 return getAttr; 3849}); 3850function getAttr(el, attr) { 3851 return el.getAttribute(attr); 3852} 3853 3854},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"iBJUu":[function(require,module,exports) { 3855var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3856parcelHelpers.defineInteropFlag(exports); 3857parcelHelpers.export(exports, "setAttrs", function() { 3858 return setAttrs; 3859}); 3860var _isNodeListJs = require("./isNodeList.js"); 3861function setAttrs(els, attrs) { 3862 els = (0, _isNodeListJs.isNodeList)(els) || els instanceof Array ? els : [ 3863 els 3864 ]; 3865 if (Object.prototype.toString.call(attrs) !== "[object Object]") return; 3866 for(var i = els.length; i--;)for(var key in attrs)els[i].setAttribute(key, attrs[key]); 3867} 3868 3869}
3869,{"./isNodeList.js":"hOoN7","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"hOoN7":[function(require,module,exports) { 3870var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3871parcelHelpers.defineInteropFlag(exports); 3872parcelHelpers.export(exports, "isNodeList", function() { 3873 return isNodeList; 3874}); 3875function isNodeList(el) { 3876 // Only NodeList has the "item()" function 3877 return typeof el.item !== "undefined"; 3878} 3879 3880},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"9u1R4":[function(require,module,exports) { 3881var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3882parcelHelpers.defineInteropFlag(exports); 3883parcelHelpers.export(exports, "removeAttrs", function() { 3884 return removeAttrs; 3885}); 3886var _isNodeListJs = require("./isNodeList.js"); 3887function removeAttrs(els, attrs) { 3888 els = (0, _isNodeListJs.isNodeList)(els) || els instanceof Array ? els : [ 3889 els 3890 ]; 3891 attrs = attrs instanceof Array ? attrs : [ 3892 attrs 3893 ]; 3894 var attrLength = attrs.length; 3895 for(var i = els.length; i--;)for(var j = attrLength; j--;)els[i].removeAttribute(attrs[j]); 3896} 3897 3898},{"./isNodeList.js":"hOoN7","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"fabVn":[function(require,module,exports) { 3899var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3900parcelHelpers.defineInteropFlag(exports); 3901parcelHelpers.export(exports, "arrayFromNodeList", function() { 3902 return arrayFromNodeList; 3903}); 3904function arrayFromNodeList(nl) { 3905 var arr = []; 3906 for(var i = 0, l = nl.length; i < l; i++)arr.push(nl[i]); 3907 return arr; 3908} 3909 3910},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"eVq2N":[function(require,module,exports) { 3911var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3912parcelHelpers.defineInteropFlag(exports); 3913parcelHelpers.export(exports, "hideElement", function() { 3914 return hideElement; 3915}); 3916function hideElement(el, forceHide) { 3917 if (el.style.display !== "none") el.style.display = "none"; 3918} 3919 3920},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"4F9lX":[function(require,module,exports) { 3921var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3922parcelHelpers.defineInteropFlag(exports); 3923parcelHelpers.export(exports, "showElement", function() { 3924 return showElement; 3925}); 3926function showElement(el, forceHide) { 3927 if (el.style.display === "none") el.style.display = ""; 3928} 3929 3930},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"GsYeI":[function(require,module,exports) { 3931var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3932parcelHelpers.defineInteropFlag(exports); 3933parcelHelpers.export(exports, "isVisible", function() { 3934 return isVisible; 3935}); 3936function isVisible(el) { 3937 return window.getComputedStyle(el).display !== "none"; 3938} 3939 3940},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"fQSrz":[function(require,module,exports) { 3941var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3942parcelHelpers.defineInteropFlag(exports); 3943parcelHelpers.export(exports, "whichProperty", function() { 3944 return whichProperty; 3945}); 3946function whichProperty(props) { 3947 if (typeof props === "string") { 3948 var arr = [ 3949 props 3950 ], Props = props.charAt(0).toUpperCase() + props.substr(1), prefixes = [ 3951 "Webkit", 3952 "Moz", 3953 "ms", 3954 "O" 3955 ]; 3956 prefixes.forEach(function(prefix) { 3957 if (prefix !== "ms" || props === "transform") arr.push(prefix + Props); 3958 }); 3959 props = arr; 3960 } 3961 var el = document.createElement("fakeelement"), len = props.length; 3962 for(var i = 0; i < props.length; i++){ 3963 var prop = props[i]; 3964 if (el.style[prop] !== undefined) return prop; 3965 } 3966 return false; // explicit for ie9- 3967} 3968 3969},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"54Rk4":[function(require,module,exports) { 3970var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3971parcelHelpers.defineInteropFlag(exports); 3972parcelHelpers.export(exports, "has3DTransforms", function() { 3973 return has3DTransforms; 3974}); 3975var _getBodyJs = require("./getBody.js"); 3976var _setFakeBodyJs = require("./setFakeBody.js"); 3977var _resetFakeBodyJs = require("./resetFakeBody.js"); 3978function has3DTransforms(tf) { 3979 if (!tf) return false;
3980 if (!window.getComputedStyle) return false; 3981 var doc = document, body = (0, _getBodyJs.getBody)(), docOverflow = (0, _setFakeBodyJs.setFakeBody)(body), el = doc.createElement("p"), has3d, cssTF = tf.length > 9 ? "-" + tf.slice(0, -9).toLowerCase() + "-" : ""; 3982 cssTF += "transform"; 3983 // Add it to the body to get the computed style 3984 body.insertBefore(el, null); 3985 el.style[tf] = "translate3d(1px,1px,1px)"; 3986 has3d = window.getComputedStyle(el).getPropertyValue(cssTF); 3987 body.fake ? (0, _resetFakeBodyJs.resetFakeBody)(body, docOverflow) : el.remove(); 3988 return has3d !== undefined && has3d.length > 0 && has3d !== "none"; 3989} 3990 3991},{"./getBody.js":"cQdcE","./setFakeBody.js":"e2ZOJ","./resetFakeBody.js":"2r7Gm","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"hbW9c":[function(require,module,exports) { 3992// get transitionend, animationend based on transitionDuration 3993// @propin: string 3994// @propOut: string, first-letter uppercase 3995// Usage: getEndProperty('WebkitTransitionDuration', 'Transition') => webkitTransitionEnd 3996var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 3997parcelHelpers.defineInteropFlag(exports); 3998parcelHelpers.export(exports, "getEndProperty", function() { 3999 return getEndProperty; 4000}); 4001function getEndProperty(propIn, propOut) { 4002 var endProp = false; 4003 if (/^Webkit/.test(propIn)) endProp = "webkit" + propOut + "End"; 4004 else if (/^O/.test(propIn)) endProp = "o" + propOut + "End"; 4005 else if (propIn) endProp = propOut.toLowerCase() + "end"; 4006 return endProp; 4007} 4008 4009},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"b8eEh":[function(require,module,exports) { 4010var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4011parcelHelpers.defineInteropFlag(exports); 4012parcelHelpers.export(exports, "addEvents", function() { 4013 return addEvents; 4014}); 4015var _passiveOptionJs = require("./passiveOption.js"); 4016function addEvents(el, obj, preventScrolling) { 4017 for(var prop in obj){ 4018 var option = [ 4019 "touchstart", 4020 "touchmove" 4021 ].indexOf(prop) >= 0 && !preventScrolling ? (0, _passiveOptionJs.passiveOption) : false; 4022 el.addEventListener(prop, obj[prop], option); 4023 } 4024} 4025 4026},{"./passiveOption.js":"bpYm8","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"bpYm8":[function(require,module,exports) { 4027// Test via a getter in the options object to see if the passive property is accessed 4028var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4029parcelHelpers.defineInteropFlag(exports); 4030parcelHelpers.export(exports, "passiveOption", function() { 4031 return passiveOption; 4032}); 4033var supportsPassive = false; 4034try { 4035 var opts = Object.defineProperty({}, "passive", { 4036 get: function get() { 4037 supportsPassive = true; 4038 } 4039 }); 4040 window.addEventListener("test", null, opts); 4041} catch (e) {} 4042var passiveOption = supportsPassive ? { 4043 passive: true 4044} : false; 4045 4046},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"1yN4c":[function(require,module,exports) { 4047var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4048parcelHelpers.defineInteropFlag(exports); 4049parcelHelpers.export(exports, "removeEvents", function() { 4050 return removeEvents; 4051}); 4052var _passiveOptionJs = require("./passiveOption.js"); 4053function removeEvents(el, obj) { 4054 for(var prop in obj){ 4055 var option = [ 4056 "touchstart", 4057 "touchmove" 4058 ].indexOf(prop) >= 0 ? (0, _passiveOptionJs.passiveOption) : false; 4059 el.removeEventListener(prop, obj[prop], option); 4060 } 4061} 4062 4063},{"./passiveOption.js":"bpYm8","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"eEqOW":[function(require,module,exports) { 4064var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4065parcelHelpers.defineInteropFlag(exports); 4066parcelHelpers.export(exports, "Events", function() { 4067 return Events; 4068}); 4069function Events() { 4070 return { 4071 topics: {}, 4072 on: function on(eventName, fn) { 4073 this.topics[eventName] = this.topics[eventName] || []; 4074 this.topics[eventName].push(fn); 4075 }, 4076 off: function off(eventName, fn) { 4077 if (this.topics[eventName]) { 4078 for(var i = 0; i < this.topics[eventName].length; i++)if (this.topics[eventName][i] === fn) { 4079 this.topics[eventName].splice(i, 1); 4080 break; 4081 } 4082 } 4083 }, 4084 emit: function emit(eventName, data) { 4085 data.type = eventName; 4086 if (this.topics[eventName]) this.topics[eventName].forEach(function(fn) { 4087 fn(data, eventName); 4088 }); 4089 } 4090 }; 4091} 4092 4093},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"aCBhA":[function(require,module,exports) { 4094var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4095parcelHelpers.defineInteropFlag(exports); 4096parcelHelpers.export(exports, "jsTransform", function() { 4097 return jsTransform; 4098}); 4099function jsTransform(element, attr, prefix, postfix, to, duration, callback) { 4100 var tick = Math.min(duration, 10), unit = to.indexOf("%") >= 0 ? "%" : "px", to = to.replace(unit, ""), from = Number(element.style[attr].replace(prefix, "").replace(postfix, "").replace(unit, "")), positionTick = (to - from) / duration * tick, running; 4101 setTimeout(moveElement, tick); 4102 function moveElement() { 4103 duration -= tick; 4104 from += positionTick; 4105 element.style[attr] = prefix + from + unit + postfix; 4106 if (duration > 0) setTimeout(moveElement, tick); 4107 else callback(); 4108 } 4109} 4110 4111},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"8ePgH":[function(require,module,exports) { 4112var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4113parcelHelpers.defineInteropFlag(exports); 4114exports.default = function(el) { 4115 var showdiv = document.querySelector(el); 4116 document.addEventListener("scroll", function() { 4117 if (window.pageYOffset > 700) showdiv.classList.add("scrolled"); 4118 else showdiv.classList.remove("scrolled"); 4119 }); 4120}; 4121 4122},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"8wXjG":[function() {},{}],"6WNk5":[function(require,module,exports) { 4123/*! npm.im/object-fit-images 3.2.4 */ "use strict"; 4124var OFI = "bfred-it:object-fit-images"; 4125var propRegex = /(object-fit|object-position)\s*:\s*([-.\w\s%]+)/g; 4126var testImg = typeof Image === "undefined" ? { 4127 style: { 4128 "object-position": 1 4129 } 4130} : new Image(); 4131var supportsObjectFit = "object-fit" in testImg.style; 4132var supportsObjectPosition = "object-position" in testImg.style; 4133var supportsOFI = "background-size" in testImg.style; 4134var supportsCurrentSrc = typeof testImg.currentSrc === "string"; 4135var nativeGetAttribute = testImg.getAttribute; 4136var nativeSetAttribute = testImg.setAttribute; 4137var autoModeEnabled = false;
4138function createPlaceholder(w, h) { 4139 return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" + w + "' height='" + h + "'%3E%3C/svg%3E"; 4140} 4141function polyfillCurrentSrc(el) { 4142 if (el.srcset && !supportsCurrentSrc && window.picturefill) { 4143 var pf = window.picturefill._; 4144 // parse srcset with picturefill where currentSrc isn't available 4145 if (!el[pf.ns] || !el[pf.ns].evaled) // force synchronous srcset parsing 4146 pf.fillImg(el, { 4147 reselect: true 4148 }); 4149 if (!el[pf.ns].curSrc) { 4150 // force picturefill to parse srcset 4151 el[pf.ns].supported = false; 4152 pf.fillImg(el, { 4153 reselect: true 4154 }); 4155 } 4156 // retrieve parsed currentSrc, if any 4157 el.currentSrc = el[pf.ns].curSrc || el.src; 4158 } 4159} 4160function getStyle(el) { 4161 var style = getComputedStyle(el).fontFamily; 4162 var parsed; 4163 var props = {}; 4164 while((parsed = propRegex.exec(style)) !== null)props[parsed[1]] = parsed[2]; 4165 return props; 4166} 4167function setPlaceholder(img, width, height) { 4168 // Default: fill width, no height 4169 var placeholder = createPlaceholder(width || 1, height || 0); 4170 // Only set placeholder if it's different 4171 if (nativeGetAttribute.call(img, "src") !== placeholder) nativeSetAttribute.call(img, "src", placeholder); 4172} 4173function onImageReady(img, callback) { 4174 // naturalWidth is only available when the image headers are loaded, 4175 // this loop will poll it every 100ms. 4176 if (img.naturalWidth) callback(img); 4177 else setTimeout(onImageReady, 100, img, callback); 4178} 4179function fixOne(el) { 4180 var style = getStyle(el); 4181 var ofi = el[OFI]; 4182 style["object-fit"] = style["object-fit"] || "fill"; // default value 4183 // Avoid running where unnecessary, unless OFI had already done its deed 4184 if (!ofi.img) { 4185 // fill is the default behavior so no action is necessary 4186 if (style["object-fit"] === "fill") return; 4187 // Where object-fit is supported and object-position isn't (Safari < 10) 4188 if (!ofi.skipTest && // unless user wants to apply regardless of browser support 4189 supportsObjectFit && // if browser already supports object-fit 4190 !style["object-position"] // unless object-position is used 4191 ) return; 4192 } 4193 // keep a clone in memory while resetting the original to a blank 4194 if (!ofi.img) { 4195 ofi.img = new Image(el.width, el.height); 4196 ofi.img.srcset = nativeGetAttribute.call(el, "data-ofi-srcset") || el.srcset; 4197 ofi.img.src = nativeGetAttribute.call(el, "data-ofi-src") || el.src; 4198 // preserve for any future cloneNode calls 4199 // https://github.com/bfred-it/object-fit-images/issues/53 4200 nativeSetAttribute.call(el, "data-ofi-src", el.src); 4201 if (el.srcset) nativeSetAttribute.call(el, "data-ofi-srcset", el.srcset); 4202 setPlaceholder(el, el.naturalWidth || el.width, el.naturalHeight || el.height); 4203 // remove srcset because it overrides src 4204 if (el.srcset) el.srcset = ""; 4205 try { 4206 keepSrcUsable(el); 4207 } catch (err) { 4208 if (window.console) console.warn("https://bit.ly/ofi-old-browser"); 4209 } 4210 } 4211 polyfillCurrentSrc(ofi.img); 4212 el.style.backgroundImage = 'url("' + (ofi.img.currentSrc || ofi.img.src).replace(/"/g, '\\"') + '")'; 4213 el.style.backgroundPosition = style["object-position"] || "center"; 4214 el.style.backgroundRepeat = "no-repeat"; 4215 el.style.backgroundOrigin = "content-box"; 4216 if (/scale-down/.test(style["object-fit"])) onImageReady(ofi.img, function() { 4217 if (ofi.img.naturalWidth > el.width || ofi.img.naturalHeight > el.height) el.style.backgroundSize = "contain"; 4218 else el.style.backgroundSize = "auto"; 4219 }); 4220 else el.style.backgroundSize = style["object-fit"].replace("none", "auto").replace("fill", "100% 100%"); 4221 onImageReady(ofi.img, function(img) { 4222 setPlaceholder(el, img.naturalWidth, img.naturalHeight); 4223 }); 4224} 4225function keepSrcUsable(el) { 4226 var descriptors = { 4227 get: function get(prop) { 4228 return el[OFI].img[prop ? prop : "src"]; 4229 }, 4230 set: function set(value, prop) { 4231 el[OFI].img[prop ? prop : "src"] = value; 4232 nativeSetAttribute.call(el, "data-ofi-" + prop, value); // preserve for any future cloneNode 4233 fixOne(el); 4234 return value; 4235 } 4236 };
4237 Object.defineProperty(el, "src", descriptors); 4238 Object.defineProperty(el, "currentSrc", { 4239 get: function get() { 4240 return descriptors.get("currentSrc"); 4241 } 4242 }); 4243 Object.defineProperty(el, "srcset", { 4244 get: function get() { 4245 return descriptors.get("srcset"); 4246 }, 4247 set: function set(ss) { 4248 return descriptors.set(ss, "srcset"); 4249 } 4250 }); 4251} 4252function hijackAttributes() { 4253 var getOfiImageMaybe = function getOfiImageMaybe(el, name) { 4254 return el[OFI] && el[OFI].img && (name === "src" || name === "srcset") ? el[OFI].img : el; 4255 }; 4256 if (!supportsObjectPosition) { 4257 HTMLImageElement.prototype.getAttribute = function(name) { 4258 return nativeGetAttribute.call(getOfiImageMaybe(this, name), name); 4259 }; 4260 HTMLImageElement.prototype.setAttribute = function(name, value) { 4261 return nativeSetAttribute.call(getOfiImageMaybe(this, name), name, String(value)); 4262 }; 4263 } 4264} 4265function fix(imgs, opts) { 4266 var startAutoMode = !autoModeEnabled && !imgs; 4267 opts = opts || {}; 4268 imgs = imgs || "img"; 4269 if (supportsObjectPosition && !opts.skipTest || !supportsOFI) return false;
4270 // use imgs as a selector or just select all images 4271 if (imgs === "img") imgs = document.getElementsByTagName("img"); 4272 else if (typeof imgs === "string") imgs = document.querySelectorAll(imgs); 4273 else if (!("length" in imgs)) imgs = [ 4274 imgs 4275 ]; 4276 // apply fix to all 4277 for(var i = 0; i < imgs.length; i++){ 4278 imgs[i][OFI] = imgs[i][OFI] || { 4279 skipTest: opts.skipTest 4280 }; 4281 fixOne(imgs[i]); 4282 } 4283 if (startAutoMode) { 4284 document.body.addEventListener("load", function(e) { 4285 if (e.target.tagName === "IMG") fix(e.target, { 4286 skipTest: opts.skipTest 4287 }); 4288 }, true); 4289 autoModeEnabled = true; 4290 imgs = "img"; // reset to a generic selector for watchMQ 4291 } 4292 // if requested, watch media queries for object-fit change 4293 if (opts.watchMQ) window.addEventListener("resize", fix.bind(null, imgs, { 4294 skipTest: opts.skipTest 4295 })); 4296} 4297fix.supportsObjectFit = supportsObjectFit; 4298fix.supportsObjectPosition = supportsObjectPosition; 4299hijackAttributes(); 4300module.exports = fix; 4301 4302},{}],"aVwuS":[function(require,module,exports) { 4303var global = arguments[3]; 4304/*! 4305 * Modals v10.1.2: Simple modal dialogue pop-up windows 4306 * (c) 2017 Chris Ferdinandi 4307 * MIT License 4308 * http://github.com/cferdinandi/modals 4309 */ (function(root, factory) { 4310 if (typeof define === "function" && define.amd) define([], factory(root)); 4311 else module.exports = factory(root); 4312})(typeof global !== "undefined" ? global : this.window || this.global, function(root) { 4313 "use strict"; 4314 // 4315 // Variables 4316 // 4317 var publicApi = {}; // Object for public APIs 4318 var supports = "querySelector" in document && "addEventListener" in root && "classList" in document.createElement("_"); // Feature test 4319 var state = "closed"; 4320 var scrollbarWidth, placeholder, settings; 4321 // Default settings 4322 var defaults = { 4323 selectorToggle: "[data-modal]", 4324 selectorWindow: "[data-modal-window]", 4325 selectorClose: "[data-modal-close]", 4326 modalActiveClass: "active", 4327 modalBGClass: "modal-bg", 4328 preventBGScroll: true, 4329 preventBGScrollHtml: true, 4330 preventBGScrollBody: true, 4331 backspaceClose: false, 4332 stopVideo: true, 4333 callbackOpen: function callbackOpen() {}, 4334 callbackClose: function callbackClose() {} 4335 }; 4336 // 4337 // Methods 4338 // 4339 /** 4340 * A simple forEach() implementation for Arrays, Objects and NodeLists. 4341 * @private 4342 * @author Todd Motto 4343 * @link https://github.com/toddmotto/foreach 4344 * @param {Array|Object|NodeList} collection Collection of items to iterate 4345 * @param {Function} callback Callback function for each iteration 4346 * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) 4347 */ var forEach = function forEach(collection, callback, scope) { 4348 if (Object.prototype.toString.call(collection) === "[object Object]") { 4349 for(var prop in collection)if (Object.prototype.hasOwnProperty.call(collection, prop
4349)) callback.call(scope, collection[prop], prop, collection); 4350 } else for(var i = 0, len = collection.length; i < len; i++)callback.call(scope, collection[i], i, collection); 4351 }; 4352 /** 4353 * Merge two or more objects. Returns a new object. 4354 * @private 4355 * @param {Boolean} deep If true, do a deep (or recursive) merge [optional] 4356 * @param {Object} objects The objects to merge together 4357 * @returns {Object} Merged values of defaults and options 4358 */ var extend = function extend1() { 4359 // Variables 4360 var extended = {}; 4361 var deep = false; 4362 var i = 0; 4363 var length = arguments.length; 4364 // Check if a deep merge 4365 if (Object.prototype.toString.call(arguments[0]) === "[object Boolean]") { 4366 deep = arguments[0]; 4367 i++; 4368 } 4369 // Merge the object into the extended object 4370 var merge = function merge(obj) { 4371 for(var prop in obj)if (Object.prototype.hasOwnProperty.call(obj, prop)) { 4372 // If deep merge and property is an object, merge properties 4373 if (deep && Object.prototype.toString.call(obj[prop]) === "[object Object]") extended[prop] = extend(true, extended[prop], obj[prop]); 4374 else extended[prop] = obj[prop]; 4375 } 4376 }; 4377 // Loop through each object and conduct a merge 4378 for(; i < length; i++){ 4379 var obj = arguments[i]; 4380 merge(obj); 4381 } 4382 return extended; 4383 }; 4384 /** 4385 * Get the closest matching element up the DOM tree. 4386 * @private 4387 * @param {Element} elem Starting element 4388 * @param {String} selector Selector to match against 4389 * @return {Boolean|Element} Returns null if not match found 4390 */ var getClosest = function getClosest(elem, selector) { 4391 // Element.matches() polyfill 4392 if (!Element.prototype.matches) Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { 4393 var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; 4394 while(--i >= 0 && matches.item(i) !== this); 4395 return i > -1; 4396 }; 4397 // Get closest match 4398 for(; elem && elem !== document; elem = elem.parentNode){ 4399 if (elem.matches(selector)) return elem; 4400 } 4401 return null; 4402 }; 4403 /** 4404 * Stop YouTube, Vimeo, and HTML5 videos from playing when leaving the slide 4405 * @private 4406 * @param {Element} content The content container the video is in 4407 * @param {String} activeClass The class asigned to expanded content areas 4408 */ var stopVideos = function stopVideos(content, settings) { 4409 // Check if stop video enabled 4410 if (!settings.stopVideo) return; 4411 // Only run if content container was open 4412 if (!content.classList.contains(settings.modalActiveClass)) return; 4413 // Check if the video is an iframe or HTML5 video 4414 var iframe = content.querySelector("iframe"); 4415 var video = content.querySelector("video"); 4416 // Stop the video 4417 if (iframe) { 4418 var iframeSrc = iframe.src; 4419 iframe.src = iframeSrc; 4420 } 4421 if (video) video.pause(); 4422 }; 4423 /** 4424 * Get the width of the scroll bars 4425 * @private 4426 */ var getScrollbarWidth = function getScrollbarWidth() { 4427 // Setup div 4428 var outer = document.createElement("div"); 4429 outer.style.visibility = "hidden"; 4430 outer.style.width = "100px"; 4431 outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps 4432 document.body.appendChild(outer); 4433 // Force scrollbars 4434 var widthNoScroll = outer.offsetWidth; 4435 outer.style.overflow = "scroll"; 4436 // Add innerdiv 4437 var inner = document.createElement("div"); 4438 inner.style.width = "100%"; 4439 outer.appendChild(inner); 4440 var widthWithScroll = inner.offsetWidth; 4441 // Remove divs 4442 outer.parentNode.removeChild(outer); 4443 return widthNoScroll - widthWithScroll; 4444 }; 4445 /** 4446 * Create the modal background and append it to the DOM 4447 * @private 4448 */ var createModalBg = function createModalBg() { 4449 // If modal BG already exists, don't create another one 4450 if (document.querySelector("[data-modal-bg]")) return; 4451 // Define the modal background 4452 var modalBg = document.createElement("div"); 4453 modalBg.setAttribute("data-modal-bg", true); 4454 modalBg.classList.add(settings.modalBGClass); 4455 // Append the modal background to the page 4456 document.body.appendChild(modalBg); 4457 }; 4458 /** 4459 * Remove the modal background from the DOM 4460 * @private 4461 */ var removeModalBg = function removeModalBg() { 4462 var modalBg = document.querySelector("[data-modal-bg]"); 4463 if (!modalBg) return; 4464 document.body.removeChild(modalBg); 4465 }; 4466 /** 4467 * Close open modal window 4468 * @public 4469 * @param {Object} options 4470 * @param {Event} event 4471 */ publicApi.closeModal = function(options) { 4472 // Selectors and variables 4473 var localSettings = extend(settings || defaults, options || {}); // Merge user options with defaults 4474 var modal = document.querySelector(localSettings.selectorWindow + "." + localSettings.modalActiveClass); // Get open modal 4475 // Sanity check 4476 if (!modal) return; 4477 // Stop videos from playing 4478 stopVideos(modal, localSettings); 4479 // Close the modal 4480 modal.classList.remove(localSettings.modalActiveClass); 4481 // Remove the modal background from the DOM 4482 removeModalBg(); 4483 // Set state to closed 4484 state = "closed"; 4485 // Reallow background scrolling 4486 if (localSettings.preventBGScroll) { 4487 document.documentElement.style.overflowY = ""; 4488 document.body.style.overflowY = ""; 4489 document.body.style.paddingRight = ""; 4490 } 4491 // Run callbacks after closing a modal 4492 localSettings.callbackClose(placeholder, modal); 4493 // Bring focus back to the button that toggles the modal 4494 if (placeholder) { 4495 placeholder.focus(); 4496 placeholder = null; 4497 } 4498 }; 4499 /** 4500 * Open the target modal window 4501 * @public 4502 * @param {Element} toggle The element that toggled the open modal event 4503 * @param {String} modalID ID of the modal to open 4504 * @param {Object} options 4505 * @param {Event} event 4506 */ publicApi.openModal = function(toggle, modalID, options) { 4507 // Define the modal 4508 var localSettings = extend(settings || defaults, options || {}); // Merge user options with defaults 4509 var modal = document.querySelector(modalID); 4510 // If a modal is already open, close it first 4511 if (state === "open") publicApi.closeModal(localSettings); 4512 // Save the visitor's spot on the page 4513 if (toggle) placeholder = toggle; 4514 // Activate the modal 4515 modal.classList.add(localSettings.modalActiveClass); 4516 createModalBg(); 4517 state = "open"; 4518 // Bring modal into focus 4519 modal.setAttribute("tabindex", "-1"); 4520 modal.focus(); 4521 // Prevent background scrolling 4522 if (localSettings.preventBGScroll) { 4523 if (localSettings.preventBGScrollHtml) document.documentElement.style.overflowY = "hidden"; 4524 if (localSettings.preventBGScrollBody) document.body.style.overflowY = "hidden"; 4525 document.body.style.paddingRight = scrollbarWidth + "px"; 4526 } 4527 localSettings.callbackOpen(toggle, modal); // Run callbacks after opening a modal 4528 }; 4529 /** 4530 * Run a callback after a click or tap, without running duplicate callbacks for the same event 4531 * @param {Node} elem The element to listen for clicks and taps on 4532 * @param {Function} callback The callback function to run on a click or tap 4533 */ var onClickOrTap = function onClickOrTap(elem, callback, destroy) { 4534 // Remove event listeners 4535 if (destroy) { 4536 elem.removeEventListener("touchstart", onTouchStartEvent, false); 4537 elem.removeEventListener("touchend", onTouchEndEvent, false); 4538 elem.removeEventListener("click", onClickEvent, false); 4539 return; 4540 } 4541 // Make sure a callback is provided 4542 if (!callback || typeof callback !== "function") return; 4543 // Variables 4544 var isTouch, startX, startY, distX, distY; 4545 /** 4546 * touchstart handler 4547 * @param {event} event The touchstart event 4548 */ var onTouchStartEvent = function onTouchStartEvent(event) { 4549 // Disable click event 4550 isTouch = true; 4551 // Get the starting location and time when finger first touches surface 4552 startX = event.changedTouches[0].pageX; 4553 startY = event.changedTouches[0].pageY; 4554 }; 4555 /** 4556 * touchend handler 4557 * @param {event} event The touchend event 4558 */ var onTouchEndEvent = function onTouchEndEvent(event) { 4559 // Get the distance travelled and how long it took 4560 distX = event.changedTouches[0].pageX - startX; 4561 distY = event.changedTouches[0].pageY - startY; 4562 // If a swipe happened, do nothing 4563 if (Math.abs(distX) >= 7 || Math.abs(distY) >= 10) return; 4564 // Run callback 4565 callback(event); 4566 }; 4567 /** 4568 * click handler 4569 * @param {event} event The click event 4570 */ var onClickEvent = function onClickEvent(event) { 4571 // If touch is active, reset and bail 4572 if (isTouch) { 4573 isTouch = false;
4574 return; 4575 } 4576 // Run our callback 4577 callback(event); 4578 }; 4579 // Event listeners 4580 elem.addEventListener("touchstart", onTouchStartEvent, false); 4581 elem.addEventListener("touchend", onTouchEndEvent, false); 4582 elem.addEventListener("click", onClickEvent, false); 4583 }; 4584 /** 4585 * Handle toggle click events 4586 * @private 4587 */ var eventHandler = function eventHandler(event) { 4588 var toggle = event.target; 4589 var open = getClosest(toggle, settings.selectorToggle); 4590 var close = getClosest(toggle, settings.selectorClose); 4591 var modal = getClosest(toggle, settings.selectorWindow); 4592 var key = event.keyCode; 4593 // alert(event.target); 4594 if (key && state === "open") { 4595 if (key === 27 || settings.backspaceClose && (key === 8 || key === 46)) publicApi.closeModal(); 4596 } else if (toggle) { 4597 if (modal && !close) return; 4598 else if (open && (!key || key === 13)) { 4599 event.preventDefault(); 4600 publicApi.openModal(open, open.getAttribute("data-modal"), settings); 4601 } else if (state === "open" && close) { 4602 event.preventDefault(); 4603 publicApi.closeModal(); 4604 } 4605 } 4606 }; 4607 /** 4608 * Destroy the current initialization. 4609 * @public 4610 */ publicApi.destroy = function() { 4611 if (!settings) return; 4612 onClickOrTap(document, null, true); 4613 document.removeEventListener("keydown", eventHandler, false); 4614 document.documentElement.style.overflowY = ""; 4615 document.body.style.overflowY = ""; 4616 document.body.style.paddingRight = ""; 4617 scrollbarWidth = null; 4618 placeholder = null; 4619 settings = null; 4620 }; 4621 /** 4622 * Initialize Modals 4623 * @public 4624 * @param {Object} options User settings 4625 */ publicApi.init = function(options) { 4626 // feature test 4627 if (!supports) return; 4628 // Destroy any existing initializations 4629 publicApi.destroy(); 4630 // Merge user options with defaults 4631 settings = extend(defaults, options || {}); 4632 // Get scrollbar width 4633 scrollbarWidth = getScrollbarWidth(); 4634 // Listen for events 4635 onClickOrTap(document, eventHandler); 4636 document.addEventListener("keydown", eventHandler, false); 4637 }; 4638 // 4639 // Public APIs 4640 // 4641 return publicApi; 4642}); 4643 4644},{}],"630mG":[function(require,module,exports) { 4645/** 4646 * File menus.js. 4647 * 4648 * Handles toggling the navigation menu for small screens and enables TAB key 4649 * navigation support for dropdown menus. 4650 */ (function() { 4651 var toggleState = // General function to change state 4652 function toggleState(el, state) { 4653 el.classList.toggle(state); 4654 if (-1 !== el.className.indexOf(state)) el.setAttribute("aria-expanded", "false"); 4655 else el.setAttribute("aria-expanded", "true"); 4656 }; 4657 var toggleFocus = /** 4658 * Sets or removes .focus class on an element. 4659 */ function toggleFocus(self, listLength, listName) { 4660 // Move up through the ancestors of the current link until we hit .nav-menu. 4661 var parentMenu = self.closest(".menu"); 4662 while(-1 === self.className.indexOf(listName)){ 4663 // On li elements toggle the class .focus. 4664 if ("li" === self.tagName.toLowerCase()) { 4665 if (-1 !== self.className.indexOf("focus")) self.className = self.className.replace(" focus", ""); 4666 else self.className += " focus"; 4667 } 4668 self = self.parentElement; 4669 } 4670 }; 4671 var submenuAccess = /** 4672 * Toggles `focus` class to allow submenu access on tablets. 4673 */ function submenuAccess(container) { 4674 // console.log('go'); 4675 var touchStartFn, i, parentLink = container.querySelectorAll(".menu-item-has-children > a, .page_item_has_children > a"); 4676 if ("ontouchstart" in window) { 4677 touchStartFn = function touchStartFn(e) { 4678 var menuItem = this.parentNode, i; 4679 if (!menuItem.classList.contains("focus")) { 4680 e.preventDefault(); 4681 for(i = 0; i < menuItem.parentNode.children.length; ++i){ 4682 if (menuItem === menuItem.parentNode.children[i]) continue; 4683 menuItem.parentNode.children[i].classList.remove("focus"); 4684 } 4685 menuItem.classList.add("focus"); 4686 } else menuItem.classList.remove("focus"); 4687 }; 4688 for(i = 0; i < parentLink.length; ++i)parentLink[i].addEventListener("touchstart", touchStartFn, false); 4689 } 4690 }; 4691 var button, menu, links, i, len; 4692 btnAttrib = "data-menu-toggle"; // Attribute name that buttons use to target a menu 4693 menuAttrib = "data-menu"; // Attribute where menu name is set 4694 stateName = "toggled"; // the class the menu and button get when clicked 4695 menuListName = ""; 4696 // Get buttons that target a menu 4697 buttons = document.querySelectorAll("[" + btnAttrib + "]"); 4698 if ("undefined" === typeof buttons) return; 4699 // Go over each button and setup menu toggles 4700 buttons.forEach(function(button) { 4701 var _loop = function() { 4702 var link = links[i]; 4703 var listLength = links.length; 4704 link.addEventListener("focus", function() { 4705 toggleFocus(link, listLength, listName); 4706 }, false); 4707 link.addEventListener("blur", function() { 4708 toggleFocus(link, listLength, listName); 4709 }, false); 4710 }; 4711 var menuName, menu, listName, list, links; 4712 menuName = button.getAttribute(btnAttrib); 4713 menu = document.querySelector("[" + menuAttrib + '="' + menuName + '"]'); 4714 //alert(menuAttrib + '="' + menuName); 4715 // Hide menu toggle button if menu is empty and return early. 4716 if ("undefined" === typeof menu) return; 4717 submenuAccess(menu); 4718 linkedButtons = document.querySelectorAll("[" + btnAttrib + '="' + menuName + '"]'); 4719 button.onclick = function() { 4720 //toggleState(button, stateName); // Give button state class 4721 toggleState(menu, stateName); // Give menu state class 4722 toggleState(document.body, menuName + "-" + stateName); // Give body menu name + state class 4723 if ("undefined" != typeof linkedButtons) linkedButtons.forEach(function(linkedButton) { 4724 toggleState(linkedButton, stateName); // Give button state class 4725 }); 4726 }; 4727 list = menu.getElementsByTagName("ul")[0]; 4728 // Hide menu toggle button if menu is empty and return early. 4729 if ("undefined" === typeof list) return; 4730 listName = menuName + "-list"; 4731 list.setAttribute("aria-expanded", "false"); 4732 if (-1 === list.className.indexOf(listName)) list.className += " " + listName; 4733 links = list.getElementsByTagName("a"); 4734 // Each time a menu link is focused or blurred, toggle focus. 4735 for(i = 0, len = links.length; i < len; i++)_loop(); 4736 }); 4737})(); 4738 4739},{}],"dZzoK":[function(require,module,exports) { 4740/** 4741 * File skip-link-focus-fix.js. 4742 * 4743 * Helps with accessibility for keyboard only users. 4744 * 4745 * Learn more: https://git.io/vWdr2 4746 */ (function() { 4747 var isIe = /(trident|msie)/i.test(navigator.userAgent); 4748 if (isIe && document.getElementById && window.addEventListener) window.addEventListener("hashchange", function() { 4749 var id = location.hash.substring(1), element; 4750 if (!/^[A-z0-9_-]+$/.test(id)) return; 4751 element = document.getElementById(id); 4752 if (element) { 4753 if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) element.tabIndex = -1; 4754 element.focus(); 4755 } 4756 }, false); 4757})(); 4758 4759},{}],"7Qqpu":[function(require,module,exports) { 4760var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4761parcelHelpers.defineInteropFlag(exports); 4762function initYoutubeVideos() { 4763 var players = []; 4764 if (typeof videoPlayerList === "undefined") return; 4765 for(var i = 0; i < videoPlayerList.length; i++){ 4766 var curplayer = createPlayer(videoPlayerList[i]); 4767 players[i] = curplayer; 4768 } 4769 return players; 4770} 4771exports.default = initYoutubeVideos; 4772function createPlayer(playerInfo) { 4773 return new YT.Player(playerInfo.id, { 4774 height: playerInfo.height, 4775 width: playerInfo.width, 4776 videoId: playerInfo.videoId, 4777 playerVars: playerInfo.playerVars, 4778 events: playerInfo.events 4779 }); 4780} 4781 4782},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"iiUaO":[function(require,module,exports) { 4783// searchbar toggle 4784var toggle = document.querySelectorAll('[data-search-toggle="search"]'); 4785var searchbar = document.querySelector('[data-search="search"]'); 4786var input = searchbar.querySelector(".search-field"); 4787var body = document.querySelector("body"); 4788for(i = 0; i < toggle.length; i++)toggle[i].addEventListener("click", function(e) { 4789 e.preventDefault(); 4790 body.classList.toggle("search-active"); 4791 searchbar.classList.toggle("active"); 4792 toggle.classList.toggle("active"); 4793 input.focus(); 4794 alert("ja"); 4795}); 4796var close = document.querySelector('[data-search-close="search"]'); 4797close.addEventListener("click", function(e) { 4798 e.preventDefault(); 4799 body.classList.remove("search-active"); 4800 searchbar.classList.remove("active"); 4801 toggle.classList.remove("active"); 4802 input.blur(); 4803}); 4804 4805},{}],"5z9kn":[function(require,module,exports) { 4806var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4807parcelHelpers.defineInteropFlag(exports); 4808var _tinySlider = require("tiny-slider/src/tiny-slider"); 4809// POSSIBLE OPTIONS 4810// Also find more documentation here: http://ganlanyuan.github.io/tiny-slider/demo/ 4811var default_options = { 4812 // container: '.slider', 4813 // mode: 'carousel', 4814 // axis: 'horizontal', 4815 items: 1, 4816 // gutter: 0, 4817 // edgePadding: 0, 4818 // fixedWidth: false, 4819 // autoWidth: false, 4820 // viewportMax: false, 4821 // slideBy: 2, 4822 // center: false, 4823 controls: false, 4824 // controlsPosition: 'top', 4825 // controlsText: ['prev', 'next'],
4826 // controlsContainer: false, 4827 // prevButton: false, 4828 // nextButton: false, 4829 nav: true, 4830 navPosition: "bottom", 4831 // navContainer: false, 4832 // navAsThumbnails: false, 4833 // arrowKeys: false, 4834 // speed: 300, 4835 autoplay: false, 4836 // autoplayPosition: 'top', 4837 autoplayTimeout: 5000, 4838 // autoplayDirection: 'forward', 4839 // autoplayText: ['start', 'stop'], 4840 // autoplayHoverPause: false, 4841 autoplayButton: false, 4842 autoplayButtonOutput: false, 4843 // autoplayResetOnVisibility: true, 4844 // animateIn: 'tns-fadeIn', 4845 // animateOut: 'tns-fadeOut', 4846 // animateNormal: 'tns-normal', 4847 // animateDelay: false, 4848 loop: true, 4849 // rewind: false, 4850 autoHeight: true, 4851 // responsive: false, 4852 // lazyload: false, 4853 // lazyloadSelector: '.tns-lazy-img', 4854 // touch: true, 4855 mouseDrag: true, 4856 lazyload: true 4857}; 4858function initSliders() { 4859 var sliders = getSliders([ 4860 "[data-slider]" 4861 ]); 4862 var result = {}; 4863 if (!sliders) return; 4864 var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; 4865 try { 4866 for(var _iterator = sliders[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ 4867 var sliderssss = _step.value; 4868 name = getSliderName(sliderssss); 4869 result[name] = initSlider(sliderssss); 4870 } 4871 } catch (err) { 4872 _didIteratorError = true; 4873 _iteratorError = err; 4874 } finally{ 4875 try { 4876 if (!_iteratorNormalCompletion && _iterator.return != null) { 4877 _iterator.return(); 4878 } 4879 } finally{ 4880 if (_didIteratorError) { 4881 throw _iteratorError; 4882 } 4883 } 4884 } 4885 return result; 4886} 4887exports.default = initSliders; 4888function getSliders(selector) { 4889 return document.querySelectorAll(selector); 4890} 4891function getSliderElements(name1) { 4892 var elements = { 4893 prevButton: document.querySelector('[data-slider-prev="' + name1 + '"]'), 4894 nextButton: document.querySelector('[data-slider-next="' + name1 + '"]'), 4895 counter: document.querySelector('[data-slider-counter="' + name1 + '"]') 4896 }; 4897 console.log(elements); 4898 if (elements.prevButton != null || elements.nextButton != null) elements.controls = true; 4899 console.log(elements); 4900 return elements; 4901} 4902function getSliderOptions(slider) { 4903 return JSON.parse(slider.getAttribute("data-slider-options")); 4904} 4905function getSliderName(slider) { 4906 return slider.getAttribute("data-slider"); 4907} 4908function configSlider(slider) { 4909 var name1 = getSliderName(slider); 4910 var config = default_options; 4911 var elements = getSliderElements(name1); 4912 if (elements) config = Object.assign(config, elements); 4913 var options = getSliderOptions(slider); 4914 if (options) config = Object.assign(config, options); 4915 config = Object.assign(config, { 4916 "container": slider 4917 }); 4918 return config; 4919} 4920// Hero slider 4921function initSlider(element) { 4922 var config = configSlider(element); 4923 var slider = (0, _tinySlider.tns)(config); 4924 var sliderCounter = config.counter; 4925 slider.events.on("indexChanged", function(info, eventName) { 4926 console.log(info); 4927 if (sliderCounter) { 4928 var newValue = info.displayIndex + " / " + info.slideCount; 4929 updateCounter(sliderCounter, newValue); 4930 } 4931 }); 4932 return slider; 4933} 4934function updateCounter(counter, newValue) { 4935 counter.innerText = newValue; 4936} 4937 4938},{"tiny-slider/src/tiny-slider":"cHMyp","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"1zduL":[function(require,module,exports) { 4939var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4940parcelHelpers.defineInteropFlag(exports); 4941parcelHelpers.export(exports, "gsap", function() { 4942 return gsapWithCSS; 4943}); 4944parcelHelpers.export(exports, "default", function() { 4945 return gsapWithCSS; 4946}); 4947parcelHelpers.export(exports, "CSSPlugin", function() {
4948 return 0, _csspluginJs.CSSPlugin; 4949}); 4950parcelHelpers.export(exports, "TweenMax", function() { 4951 return TweenMaxWithCSS; 4952}); 4953parcelHelpers.export(exports, "TweenLite", function() { 4954 return 0, _gsapCoreJs.TweenLite; 4955}); 4956parcelHelpers.export(exports, "TimelineMax", function() { 4957 return 0, _gsapCoreJs.TimelineMax; 4958}); 4959parcelHelpers.export(exports, "TimelineLite", function() { 4960 return 0, _gsapCoreJs.TimelineLite; 4961}); 4962parcelHelpers.export(exports, "Power0", function() { 4963 return 0, _gsapCoreJs.Power0; 4964}); 4965parcelHelpers.export(exports, "Power1", function() { 4966 return 0, _gsapCoreJs.Power1; 4967}); 4968parcelHelpers.export(exports, "Power2", function() { 4969 return 0, _gsapCoreJs.Power2; 4970}); 4971parcelHelpers.export(exports, "Power3", function() { 4972 return 0, _gsapCoreJs.Power3; 4973}); 4974parcelHelpers.export(exports, "Power4", function() { 4975 return 0, _gsapCoreJs.Power4; 4976}); 4977parcelHelpers.export(exports, "Linear", function() { 4978 return 0, _gsapCoreJs.Linear; 4979}); 4980parcelHelpers.export(exports, "Quad", function() { 4981 return 0, _gsapCoreJs.Quad; 4982}); 4983parcelHelpers.export(exports, "Cubic", function() { 4984 return 0, _gsapCoreJs.Cubic; 4985}); 4986parcelHelpers.export(exports, "Quart", function() { 4987 return 0, _gsapCoreJs.Quart; 4988}); 4989parcelHelpers.export(exports, "Quint", function() { 4990 return 0, _gsapCoreJs.Quint; 4991}); 4992parcelHelpers.export(exports, "Strong", function() { 4993 return 0, _gsapCoreJs.Strong; 4994}); 4995parcelHelpers.export(exports, "Elastic", function() { 4996 return 0, _gsapCoreJs.Elastic; 4997}); 4998parcelHelpers.export(exports, "Back", function() { 4999 return 0, _gsapCoreJs.Back; 5000}); 5001parcelHelpers.export(exports, "SteppedEase", function() { 5002 return 0, _gsapCoreJs.SteppedEase; 5003}); 5004parcelHelpers.export(exports, "Bounce", function() { 5005 return 0, _gsapCoreJs.Bounce; 5006}); 5007parcelHelpers.export(exports, "Sine", function() { 5008 return 0, _gsapCoreJs.Sine; 5009}); 5010parcelHelpers.export(exports, "Expo", function() { 5011 return 0, _gsapCoreJs.Expo; 5012}); 5013parcelHelpers.export(exports, "Circ", function() { 5014 return 0, _gsapCoreJs.Circ; 5015}); 5016var _gsapCoreJs = require("./gsap-core.js"); 5017var _csspluginJs = require("./CSSPlugin.js"); 5018var gsapWithCSS = (0, _gsapCoreJs.gsap).registerPlugin((0, _csspluginJs.CSSPlugin)) || (0, _gsapCoreJs.gsap), // to protect from tree shaking 5019TweenMaxWithCSS = gsapWithCSS.core.Tween; 5020 5021},{"./gsap-core.js":"5QIej","./CSSPlugin.js":"cJqgy","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"5QIej":[function(require,module,exports) { 5022var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 5023parcelHelpers.defineInteropFlag(exports); 5024parcelHelpers.export(exports, "GSCache", function() { 5025 return GSCache; 5026}); 5027parcelHelpers.export(exports, "Animation", function() { 5028 return Animation; 5029}); 5030parcelHelpers.export(exports, "Timeline", function() { 5031 return Timeline; 5032}); 5033parcelHelpers.export(exports, "Tween", function() { 5034 return Tween; 5035}); 5036parcelHelpers.export(exports, "PropTween", function() { 5037 return PropTween; 5038}); 5039parcelHelpers.export(exports, "gsap", function() { 5040 return gsap; 5041}); 5042parcelHelpers.export(exports, "Power0", function() { 5043 return Power0; 5044}); 5045parcelHelpers.export(exports, "Power1", function() { 5046 return Power1; 5047}); 5048parcelHelpers.export(exports, "Power2", function() { 5049 return Power2; 5050}); 5051parcelHelpers.export(exports, "Power3", function() { 5052 return Power3; 5053}); 5054parcelHelpers.export(exports, "Power4", function() { 5055 return Power4; 5056}); 5057parcelHelpers.export(exports, "Linear", function() { 5058 return Linear; 5059}); 5060parcelHelpers.export(exports, "Quad", function() { 5061 return Quad; 5062}); 5063parcelHelpers.export(exports, "Cubic", function() { 5064 return Cubic; 5065}); 5066parcelHelpers.export(exports, "Quart", function() { 5067 return Quart; 5068}); 5069parcelHelpers.export(exports, "Quint", function() { 5070 return Quint; 5071}); 5072parcelHelpers.export(exports, "Strong", function() { 5073 return Strong; 5074}); 5075parcelHelpers.export(exports, "Elastic", function() { 5076 return Elastic; 5077}); 5078parcelHelpers.export(exports, "Back", function() { 5079 return Back; 5080}); 5081parcelHelpers.export(exports, "SteppedEase", function() { 5082 return SteppedEase; 5083}); 5084parcelHelpers.export(exports, "Bounce", function() { 5085 return Bounce; 5086}); 5087parcelHelpers.export(exports, "Sine", function() { 5088 return Sine; 5089}); 5090parcelHelpers.export(exports, "Expo", function() { 5091 return Expo; 5092}); 5093parcelHelpers.export(exports, "Circ", function() { 5094 return Circ; 5095}); 5096parcelHelpers.export(exports, "TweenMax", function() { 5097 return Tween; 5098}) //export some internal methods/orojects for use in CSSPlugin so that we can externalize that file and allow custom builds that exclude it. 5099; 5100parcelHelpers.export(exports, "TweenLite", function() { 5101 return Tween; 5102}); 5103parcelHelpers.export(exports, "TimelineMax", function() { 5104 return Timeline; 5105}); 5106parcelHelpers.export(exports, "TimelineLite", function() { 5107 return Timeline; 5108}); 5109parcelHelpers.export(exports, "default", function() { 5110 return gsap; 5111}); 5112parcelHelpers.export(exports, "wrap", function() { 5113 return wrap; 5114}); 5115parcelHelpers.export(exports, "wrapYoyo", function() { 5116 return wrapYoyo; 5117}); 5118parcelHelpers.export(exports, "distribute", function() { 5119 return distribute; 5120}); 5121parcelHelpers.export(exports, "random", function() { 5122 return random; 5123}); 5124parcelHelpers.export(exports, "snap", function() { 5125 return snap; 5126}); 5127parcelHelpers.export(exports, "normalize", function() { 5128 return normalize; 5129}); 5130parcelHelpers.export(exports, "getUnit", function() { 5131 return getUnit; 5132}); 5133parcelHelpers.export(exports, "clamp", function() { 5134 return clamp; 5135}); 5136parcelHelpers.export(exports, "splitColor", function() { 5137 return splitColor; 5138}); 5139parcelHelpers.export(exports, "toArray", function() { 5140 return toArray; 5141}); 5142parcelHelpers.export(exports, "selector", function() { 5143 return selector; 5144}); 5145parcelHelpers.export(exports, "mapRange", function() { 5146 return mapRange; 5147}); 5148parcelHelpers.export(exports, "pipe", function() { 5149 return pipe; 5150}); 5151parcelHelpers.export(exports, "unitize", function() { 5152 return unitize; 5153}); 5154parcelHelpers.export(exports, "interpolate", function() { 5155 return interpolate; 5156}); 5157parcelHelpers.export(exports, "shuffle", function() { 5158 return shuffle; 5159}); 5160parcelHelpers.export(exports, "_getProperty", function() { 5161 return _getProperty; 5162}); 5163parcelHelpers.export(exports, "_numExp", function() { 5164 return _numExp; 5165}); 5166parcelHelpers.export(exports, "_numWithUnitExp", function() { 5167 return _numWithUnitExp; 5168}); 5169parcelHelpers.export(exports, "_isString", function() { 5170 return _isString; 5171}); 5172parcelHelpers.export(exports, "_isUndefined", function() { 5173 return _isUndefined; 5174}); 5175parcelHelpers.export(exports, "_renderComplexString", function() { 5176 return _renderComplexString; 5177}); 5178parcelHelpers.export(exports, "_relExp", function() {
vendor: 4,345 bytes, lines 5179-5281
5179 return _relExp; 5180}); 5181parcelHelpers.export(exports, "_setDefaults", function() { 5182 return _setDefaults; 5183}); 5184parcelHelpers.export(exports, "_removeLinkedListItem", function() { 5185 return _removeLinkedListItem; 5186}); 5187parcelHelpers.export(exports, "_forEachName", function() { 5188 return _forEachName; 5189}); 5190parcelHelpers.export(exports, "_sortPropTweensByPriority", function() { 5191 return _sortPropTweensByPriority; 5192}); 5193parcelHelpers.export(exports, "_colorStringFilter", function() { 5194 return _colorStringFilter; 5195}); 5196parcelHelpers.export(exports, "_replaceRandom", function() { 5197 return _replaceRandom; 5198}); 5199parcelHelpers.export(exports, "_checkPlugin", function() { 5200 return _checkPlugin; 5201}); 5202parcelHelpers.export(exports, "_plugins", function() { 5203 return _plugins; 5204}); 5205parcelHelpers.export(exports, "_ticker", function() { 5206 return _ticker; 5207}); 5208parcelHelpers.export(exports, "_config", function() { 5209 return _config; 5210}); 5211parcelHelpers.export(exports, "_roundModifier", function() { 5212 return _roundModifier; 5213}); 5214parcelHelpers.export(exports, "_round", function() { 5215 return _round; 5216}); 5217parcelHelpers.export(exports, "_missingPlugin", function() { 5218 return _missingPlugin; 5219}); 5220parcelHelpers.export(exports, "_getSetter", function() { 5221 return _getSetter; 5222}); 5223parcelHelpers.export(exports, "_getCache", function() { 5224 return _getCache; 5225}); 5226parcelHelpers.export(exports, "_colorExp", function() { 5227 return _colorExp; 5228}); 5229parcelHelpers.export(exports, "_parseRelative", function() { 5230 return _parseRelative; 5231}); 5232function _assertThisInitialized(self) { 5233 if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 5234 return self; 5235} 5236function _inheritsLoose(subClass, superClass) { 5237 subClass.prototype = Object.create(superClass.prototype); 5238 subClass.prototype.constructor = subClass; 5239 subClass.__proto__ = superClass; 5240} 5241/*! 5242 * GSAP 3.11.5 5243 * https://greensock.com 5244 * 5245 * @license Copyright 2008-2023, GreenSock. All rights reserved. 5246 * Subject to the terms at https://greensock.com/standard-license or for 5247 * Club GreenSock members, the agreement issued with that membership. 5248 * @author: Jack Doyle, [email protected] 5249*/ /* eslint-disable */ var _config = { 5250 autoSleep: 120, 5251 force3D: "auto", 5252 nullTargetWarn: 1, 5253 units: { 5254 lineHeight: "" 5255 } 5256}, _defaults = { 5257 duration: .5, 5258 overwrite: false, 5259 delay: 0 5260}, _suppressOverwrites, _reverting, _context, _bigNum = 1e8, _tinyNum = 1 / _bigNum, _2PI = Math.PI * 2, _HALF_PI = _2PI / 4, _gsID = 0, _sqrt = Math.sqrt, _cos = Math.cos, _sin = Math.sin, _isString = function _isString(value) { 5261 return typeof value === "string"; 5262}, _isFunction = function _isFunction(value) { 5263 return typeof value === "function"; 5264}, _isNumber = function _isNumber(value) { 5265 return typeof value === "number"; 5266}, _isUndefined = function _isUndefined(value) { 5267 return typeof value === "undefined"; 5268}, _isObject = function _isObject(value) { 5269 return typeof value === "object"; 5270}, _isNotFalse = function _isNotFalse(value) { 5271 return value !== false; 5272}, _windowExists = function _windowExists() { 5273 return typeof window !== "undefined"; 5274}, _isFuncOrString = function _isFuncOrString(value) { 5275 return _isFunction(value) || _isString(value); 5276}, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {}, // note: IE10 has ArrayBuffer, but NOT ArrayBuffer.isView(). 5277_isArray = Array.isArray, _strictNumExp = /(?:-?\.?\d|\.)+/gi, //only numbers (including negatives and decimals) but NOT relative values. 5278_numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, //finds any numbers, including ones that start with += or -=, negative numbers, and ones in scientific notation like 1e-8. 5279_numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, //duplicate so that while we're looping through matches from exec(), it doesn't contaminate the lastIndex of _numExp which we use to search for colors too. 5280_relExp = /[+-]=-?[.\d]+/, _delimitedValueExp = /[^,'"\[\]\s]+/gi, // previously /[#\-+.]*\b[a-z\d\-=+%.]+/gi but didn't catch special characters. 5281_unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, _globalTimeline, _win, _coreInitted, _doc, _globals = {}, _installScope = {}, _coreReady, _install = function _install(scope) {
vendor: 29,672 bytes, lines 5282-5715
5282 return (_installScope = _merge(scope, _globals)) && gsap; 5283}, _missingPlugin = function _missingPlugin(property, value) { 5284 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 5285}, _warn = function _warn(message, suppress) { 5286 return !suppress && console.warn(message); 5287}, _addGlobal = function _addGlobal(name, obj) { 5288 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 5289}, _emptyFunc = function _emptyFunc() { 5290 return 0; 5291}, _startAtRevertConfig = { 5292 suppressEvents: true, 5293 isStart: true, 5294 kill: false 5295}, _revertConfigNoKill = { 5296 suppressEvents: true, 5297 kill: false 5298}, _revertConfig = { 5299 suppressEvents: true 5300}, _reservedProps = {}, _lazyTweens = [], _lazyLookup = {}, _lastRenderedFrame, _plugins = {}, _effects = {}, _nextGCFrame = 30, _harnessPlugins = [], _callbackNames = "", _harness = function _harness(targets) { 5301 var target = targets[0], harnessPlugin, i; 5302 _isObject(target) || _isFunction(target) || (targets = [ 5303 targets 5304 ]); 5305 if (!(harnessPlugin = (target._gsap || {}).harness)) { 5306 // find the first target with a harness. We assume targets passed into an animation will be of similar type, meaning the same kind of harness can be used for them all (performance optimization) 5307 i = _harnessPlugins.length; 5308 while(i-- && !_harnessPlugins[i].targetTest(target)); 5309 harnessPlugin = _harnessPlugins[i]; 5310 } 5311 i = targets.length; 5312 while(i--)targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 5313 return targets; 5314}, _getCache = function _getCache(target) { 5315 return target._gsap || _harness(toArray(target))[0]._gsap; 5316}, _getProperty = function _getProperty(target, property, v) { 5317 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 5318}, _forEachName = function _forEachName(names, func) { 5319 return (names = names.split(",")).forEach(func) || names; 5320}, //split a comma-delimited list of names into an array, then run a forEach() function and return the split array (this is just a way to consolidate/shorten some code). 5321_round = function _round(value) { 5322 return Math.round(value * 100000) / 100000 || 0; 5323}, _roundPrecise = function _roundPrecise(value) { 5324 return Math.round(value * 10000000) / 10000000 || 0; 5325}, // increased precision mostly for timing values. 5326_parseRelative = function _parseRelative(start, value) { 5327 var operator = value.charAt(0), end = parseFloat(value.substr(2)); 5328 start = parseFloat(start); 5329 return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; 5330}, _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 5331 //searches one array to find matches for any of the items in the toFind array. As soon as one is found, it returns true. It does NOT return all the matches; it's simply a boolean search. 5332 var l = toFind.length, i = 0; 5333 for(; toSearch.indexOf(toFind[i]) < 0 && ++i < l;); 5334 return i < l; 5335}, _lazyRender = function _lazyRender() { 5336 var l = _lazyTweens.length, a = _lazyTweens.slice(0), i, tween; 5337 _lazyLookup = {}; 5338 _lazyTweens.length = 0; 5339 for(i = 0; i < l; i++){ 5340 tween = a[i]; 5341 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 5342 } 5343}, _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 5344 _lazyTweens.length && !_reverting && _lazyRender(); 5345 animation.render(time, suppressEvents, force || _reverting && time < 0 && (animation._initted || animation._startAt)); 5346 _lazyTweens.length && !_reverting && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. 5347}, _numericIfPossible = function _numericIfPossible(value) { 5348 var n = parseFloat(value); 5349 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 5350}, _passThrough = function _passThrough(p) { 5351 return p; 5352}, _setDefaults = function _setDefaults(obj, defaults) { 5353 for(var p in defaults)p in obj || (obj[p] = defaults[p]); 5354 return obj; 5355}, _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { 5356 return function(obj, defaults) { 5357 for(var p in defaults)p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]); 5358 }; 5359}, _merge = function _merge(base, toMerge) { 5360 for(var p in toMerge)base[p] = toMerge[p]; 5361 return base; 5362}, _mergeDeep = function _mergeDeep(base, toMerge) { 5363 for(var p in toMerge)p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 5364 return base; 5365}, _copyExcluding = function _copyExcluding(obj, excluding) { 5366 var copy = {}, p; 5367 for(p in obj)p in excluding || (copy[p] = obj[p]); 5368 return copy; 5369}, _inheritDefaults = function _inheritDefaults(vars) { 5370 var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; 5371 if (_isNotFalse(vars.inherit)) while(parent){ 5372 func(vars, parent.vars.defaults); 5373 parent = parent.parent || parent._dp; 5374 } 5375 return vars; 5376}, _arraysMatch = function _arraysMatch(a1, a2) { 5377 var i = a1.length, match = i === a2.length; 5378 while(match && i-- && a1[i] === a2[i]); 5379 return i < 0; 5380}, _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 5381 if (firstProp === void 0) firstProp = "_first"; 5382 if (lastProp === void 0) lastProp = "_last"; 5383 var prev = parent[lastProp], t; 5384 if (sortBy) { 5385 t = child[sortBy]; 5386 while(prev && prev[sortBy] > t)prev = prev._prev; 5387 } 5388 if (prev) { 5389 child._next = prev._next; 5390 prev._next = child; 5391 } else { 5392 child._next = parent[firstProp]; 5393 parent[firstProp] = child; 5394 } 5395 if (child._next) child._next._prev = child; 5396 else parent[lastProp] = child; 5397 child._prev = prev; 5398 child.parent = child._dp = parent; 5399 return child; 5400}, _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 5401 if (firstProp === void 0) firstProp = "_first"; 5402 if (lastProp === void 0) lastProp = "_last"; 5403 var prev = child._prev, next = child._next; 5404 if (prev) prev._next = next; 5405 else if (parent[firstProp] === child) parent[firstProp] = next; 5406 if (next) next._prev = prev; 5407 else if (parent[lastProp] === child) parent[lastProp] = prev; 5408 child._next = child._prev = child.parent = null; // don't delete the _dp just so we can revert if necessary. But parent should be null to indicate the item isn't in a linked list. 5409}, _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 5410 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child); 5411 child._act = 0; 5412}, _uncache = function _uncache(animation, child) { 5413 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 5414 // performance optimization: if a child animation is passed in we should only uncache if that child EXTENDS the animation (its end time is beyond the end) 5415 var a = animation; 5416 while(a){ 5417 a._dirty = 1; 5418 a = a.parent; 5419 } 5420 } 5421 return animation; 5422}, _recacheAncestors = function _recacheAncestors(animation) { 5423 var parent = animation.parent; 5424 while(parent && parent.parent){ 5425 //sometimes we must force a re-sort of all children and update the duration/totalDuration of all ancestor timelines immediately in case, for example, in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though. 5426 parent._dirty = 1; 5427 parent.totalDuration(); 5428 parent = parent.parent; 5429 } 5430 return animation; 5431}, _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { 5432 return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 5433}, _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 5434 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 5435}, _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 5436 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 5437}, // feed in the totalTime and cycleDuration and it'll return the cycle (iteration minus 1) and if the playhead is exactly at the very END, it will NOT bump up to the next cycle. 5438_animationCycle = function _animationCycle(tTime, cycleDuration) { 5439 var whole = Math.floor(tTime /= cycleDuration); 5440 return tTime && whole === tTime ? whole - 1 : whole; 5441}, _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 5442 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 5443}, _setEnd = function _setEnd(animation) { 5444 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 5445}, _alignPlayhead = function _alignPlayhead(animation, totalTime) { 5446 // adjusts the animation's _start and _end according to the provided totalTime (only if the parent's smoothChildTiming is true and the animation isn't paused). It doesn't do any rendering or forcing things back into parent timelines, etc. - that's what totalTime() is for. 5447 var parent = animation._dp; 5448 if (parent && parent.smoothChildTiming && animation._ts) { 5449 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 5450 _setEnd(animation); 5451 parent._dirty || _uncache(parent, animation); //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. 5452 } 5453 return animation; 5454}, /* 5455_totalTimeToTime = (clampedTotalTime, duration, repeat, repeatDelay, yoyo) => { 5456 let cycleDuration = duration + repeatDelay, 5457 time = _round(clampedTotalTime % cycleDuration); 5458 if (time > duration) { 5459 time = duration; 5460 } 5461 return (yoyo && (~~(clampedTotalTime / cycleDuration) & 1)) ? duration - time : time; 5462}, 5463*/ _postAddChecks = function _postAddChecks(timeline, child) { 5464 var t; 5465 if (child._time || child._initted && !child._dur) { 5466 //in case, for example, the _start is moved on a tween that has already rendered. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning. 5467 t = _parentToChildTotalTime(timeline.rawTime(), child); 5468 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) child.render(t, true); 5469 } //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. 5470 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 5471 //in case any of the ancestors had completed but should now be enabled... 5472 if (timeline._dur < timeline.duration()) { 5473 t = timeline; 5474 while(t._dp){ 5475 t.rawTime() >= 0 && t.totalTime(t._tTime); //moves the timeline (shifts its startTime) if necessary, and also enables it. If it's currently zero, though, it may not be scheduled to render until later so there's no need to force it to align with the current playhead position. Only move to catch up with the playhead. 5476 t = t._dp; 5477 } 5478 } 5479 timeline._zTime = -_tinyNum; // helps ensure that the next render() will be forced (crossingStart = true in render()), even if the duration hasn't changed (we're adding a child which would need to get rendered). Definitely an edge case. Note: we MUST do this AFTER the loop above where the totalTime() might trigger a render() because this _addToTimeline() method gets called from the Animation constructor, BEFORE tweens even record their targets, etc. so we wouldn't want things to get triggered in the wrong order. 5480 } 5481}, _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 5482 child.parent && _removeFromParent(child); 5483 child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 5484 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 5485 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 5486 _isFromOrFromStart(child) || (timeline._recent = child); 5487 skipChecks || _postAddChecks(timeline, child); 5488 timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); // if the timeline is reversed and the new child makes it longer, we may need to adjust the parent's _start (push it back) 5489 return timeline; 5490}, _scrollTrigger = function _scrollTrigger(animation, trigger) { 5491 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 5492}, _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { 5493 _initTween(tween, time, tTime); 5494 if (!tween._initted) return 1; 5495 if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 5496 _lazyTweens.push(tween); 5497 tween._lazy = [ 5498 tTime, 5499 suppressEvents 5500 ]; 5501 return 1; 5502 } 5503}, _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 5504 var parent = _ref.parent; 5505 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 5506}, // check parent's _lock because when a timeline repeats/yoyos and does its artificial wrapping, we shouldn't force the ratio back to 0 5507_isFromOrFromStart = function _isFromOrFromStart(_ref2) { 5508 var data = _ref2.data; 5509 return data === "isFromStart" || data === "isStart"; 5510}, _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 5511 var prevRatio = tween.ratio, ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, // if the tween or its parent is reversed and the totalTime is 0, we should go to a ratio of 0. Edge case: if a from() or fromTo() stagger tween is placed later in a timeline, the "startAt" zero-duration tween could initially render at a time when the parent timeline's playhead is technically BEFORE where this tween is, so make sure that any "from" and "fromTo" startAt tweens are rendered the first time at a ratio of 1. 5512 repeatDelay = tween._rDelay, tTime = 0, pt, iteration, prevIteration; 5513 if (repeatDelay && tween._repeat) { 5514 // in case there's a zero-duration tween that has a repeat with a repeatDelay 5515 tTime = _clamp(0, tween._tDur, totalTime); 5516 iteration = _animationCycle(tTime, repeatDelay); 5517 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 5518 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 5519 // if iteration changed 5520 prevRatio = 1 - ratio; 5521 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 5522 } 5523 } 5524 if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 5525 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) // if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. 5526 return; 5527 prevIteration = tween._zTime; 5528 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); // when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 5529 suppressEvents || (suppressEvents = totalTime && !prevIteration); // if it was rendered previously at exactly 0 (_zTime) and now the playhead is moving away, DON'T fire callbacks otherwise they'll seem like duplicates. 5530 tween.ratio = ratio; 5531 tween._from && (ratio = 1 - ratio); 5532 tween._time = 0; 5533 tween._tTime = tTime; 5534 pt = tween._pt; 5535 while(pt){ 5536 pt.r(ratio, pt.d); 5537 pt = pt._next; 5538 } 5539 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 5540 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 5541 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 5542 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 5543 ratio && _removeFromParent(tween, 1); 5544 if (!suppressEvents && !_reverting) { 5545 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 5546 tween._prom && tween._prom(); 5547 } 5548 } 5549 } else if (!tween._zTime) tween._zTime = totalTime; 5550}, _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 5551 var child; 5552 if (time > prevTime) { 5553 child = animation._first; 5554 while(child && child._start <= time){ 5555 if (child.data === "isPause" && child._start > prevTime) return child; 5556 child = child._next; 5557 } 5558 } else { 5559 child = animation._last; 5560 while(child && child._start >= time){ 5561 if (child.data === "isPause" && child._start < prevTime) return child; 5562 child = child._prev; 5563 } 5564 } 5565}, _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 5566 var repeat = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur; 5567 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 5568 animation._dur = dur; 5569 animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); 5570 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 5571 animation.parent && _setEnd(animation); 5572 skipUncache || _uncache(animation.parent, animation); 5573 return animation; 5574}, _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 5575 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 5576}, _zeroPosition = { 5577 _start: 0, 5578 endTime: _emptyFunc, 5579 totalDuration: _emptyFunc 5580}, _parsePosition = function _parsePosition(animation, position, percentAnimation) { 5581 var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead. 5582 i, offset, isPercent; 5583 if (_isString(position) && (isNaN(position) || position in labels)) { 5584 //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). 5585 offset = position.charAt(0); 5586 isPercent = position.substr(-1) === "%"; 5587 i = position.indexOf("="); 5588 if (offset === "<" || offset === ">") { 5589 i >= 0 && (position = position.replace(/=/, "")); 5590 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 5591 } 5592 if (i < 0) { 5593 position in labels || (labels[position] = clippedDuration); 5594 return labels[position]; 5595 } 5596 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 5597 if (isPercent && percentAnimation) offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 5598 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 5599 } 5600 return position == null ? clippedDuration : +position; 5601}, _createTweenType = function _createTweenType(type, params, timeline) { 5602 var isLegacy = _isNumber(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent; 5603 isLegacy && (vars.duration = params[1]); 5604 vars.parent = timeline; 5605 if (type) { 5606 irVars = vars; 5607 parent = timeline; 5608 while(parent && !("immediateRender" in irVars)){ 5609 // inheritance hasn't happened yet, but someone may have set a default in an ancestor timeline. We could do vars.immediateRender = _isNotFalse(_inheritDefaults(vars).immediateRender) but that'd exact a slight performance penalty because _inheritDefaults() also runs in the Tween constructor. We're paying a small kb price here to gain speed. 5610 irVars = parent.vars.defaults || {}; 5611 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 5612 } 5613 vars.immediateRender = _isNotFalse(irVars.immediateRender); 5614 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; // "from" vars 5615 } 5616 return new Tween(params[0], vars, params[varsIndex + 1]); 5617}, _conditionalReturn = function _conditionalReturn(value, func) { 5618 return value || value === 0 ? func(value) : func; 5619}, _clamp = function _clamp(min, max, value) { 5620 return value < min ? min : value > max ? max : value; 5621}, getUnit = function getUnit(value, v) { 5622 return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; 5623}, // note: protect against padded numbers as strings, like "100.100". That shouldn't return "00" as the unit. If it's numeric, return no unit. 5624clamp = function clamp(min, max, value) { 5625 return _conditionalReturn(value, function(v) { 5626 return _clamp(min, max, v); 5627 }); 5628}, _slice = [].slice, _isArrayLike = function _isArrayLike(value, nonEmpty) { 5629 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; 5630}, _flatten = function _flatten(ar, leaveStrings, accumulator) { 5631 if (accumulator === void 0) accumulator = []; 5632 return ar.forEach(function(value) { 5633 var _accumulator; 5634 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 5635 }) || accumulator; 5636}, //takes any value and returns an array. If it's a string (and leaveStrings isn't true), it'll use document.querySelectorAll() and convert that to an array. It'll also accept iterables like jQuery objects. 5637toArray = function toArray(value, scope, leaveStrings) { 5638 return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [ 5639 value 5640 ] : []; 5641}, selector = function selector(value) { 5642 value = toArray(value)[0] || _warn("Invalid scope") || {}; 5643 return function(v) { 5644 var el = value.current || value.nativeElement || value; 5645 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 5646 }; 5647}, shuffle = function shuffle(a) { 5648 return a.sort(function() { 5649 return .5 - Math.random(); 5650 }); 5651}, // alternative that's a bit faster and more reliably diverse but bigger: for (let j, v, i = a.length; i; j = Math.floor(Math.random() * i), v = a[--i], a[i] = a[j], a[j] = v); return a; 5652//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following 5653distribute = function distribute(v) { 5654 if (_isFunction(v)) return v; 5655 var vars = _isObject(v) ? v : { 5656 each: v 5657 }, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all. 5658 ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {}, isDecimal = from > 0 && from < 1, ratios = isNaN(from) || isDecimal, axis = vars.axis, ratioX = from, ratioY = from; 5659 if (_isString(from)) ratioX = ratioY = ({ 5660 center: .5, 5661 edges: .5, 5662 end: 1 5663 })[from] || 0; 5664 else if (!isDecimal && ratios) { 5665 ratioX = from[0]; 5666 ratioY = from[1]; 5667 } 5668 return function(i, target, a) { 5669 var l = (a || vars).length, distances = cache[l], originX, originY, x, y, d, j, max, min, wrapAt; 5670 if (!distances) { 5671 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [ 5672 1, 5673 _bigNum 5674 ])[1]; 5675 if (!wrapAt) { 5676 max = -_bigNum; 5677 while(max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l); 5678 wrapAt--; 5679 } 5680 distances = cache[l] = []; 5681 originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt; 5682 originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0; 5683 max = 0; 5684 min = _bigNum; 5685 for(j = 0; j < l; j++){ 5686 x = j % wrapAt - originX; 5687 y = originY - (j / wrapAt | 0); 5688 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 5689 d > max && (max = d); 5690 d < min && (min = d); 5691 } 5692 from === "random" && shuffle(distances); 5693 distances.max = max - min; 5694 distances.min = min; 5695 distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 5696 distances.b = l < 0 ? base - l : base; 5697 distances.u = getUnit(vars.amount || vars.each) || 0; //unit 5698 ease = ease && l < 0 ? _invertEase(ease) : ease; 5699 } 5700 l = (distances[i] - distances.min) / distances.max || 0; 5701 return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; //round in order to work around floating point errors 5702 }; 5703}, _roundModifier = function _roundModifier(v) { 5704 //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. 5705 var p = Math.pow(10, ((v + "").split(".")[1] || "").length); //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed()) 5706 return function(raw) { 5707 var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); 5708 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); // n - n % 1 replaces Math.floor() in order to handle negative values properly. For example, Math.floor(-150.00000000000003) is 151! 5709 }; 5710}, snap = function snap(snapTo, value) { 5711 var isArray = _isArray(snapTo), radius, is2D; 5712 if (!isArray && _isObject(snapTo)) { 5713 radius = isArray = snapTo.radius || _bigNum; 5714 if (snapTo.values) { 5715 snapTo = toArray(snapTo.values);
vendor: 5,137 bytes, lines 5716-5813
5716 if (is2D = !_isNumber(snapTo[0])) radius *= radius; //performance optimization so we don't have to Math.sqrt() in the loop. 5717 } else snapTo = _roundModifier(snapTo.increment); 5718 } 5719 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function(raw) { 5720 is2D = snapTo(raw); 5721 return Math.abs(is2D - raw) <= radius ? is2D : raw; 5722 } : function(raw) { 5723 var x = parseFloat(is2D ? raw.x : raw), y = parseFloat(is2D ? raw.y : 0), min = _bigNum, closest = 0, i = snapTo.length, dx, dy; 5724 while(i--){ 5725 if (is2D) { 5726 dx = snapTo[i].x - x; 5727 dy = snapTo[i].y - y; 5728 dx = dx * dx + dy * dy; 5729 } else dx = Math.abs(snapTo[i] - x); 5730 if (dx < min) { 5731 min = dx; 5732 closest = i; 5733 } 5734 } 5735 closest = !radius || min <= radius ? snapTo[closest] : raw; 5736 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 5737 }); 5738}, random = function random(min, max, roundingIncrement, returnFunction) { 5739 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? (roundingIncrement = 0, false) : !returnFunction, function() { 5740 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5, returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; 5741 }); 5742}, pipe = function pipe() { 5743 for(var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++)functions[_key] = arguments[_key]; 5744 return function(value) { 5745 return functions.reduce(function(v, f) { 5746 return f(v); 5747 }, value); 5748 }; 5749}, unitize = function unitize(func, unit) { 5750 return function(value) { 5751 return func(parseFloat(value)) + (unit || getUnit(value)); 5752 }; 5753}, normalize = function normalize(min, max, value) { 5754 return mapRange(min, max, 0, 1, value); 5755}, _wrapArray = function _wrapArray(a, wrapper, value) { 5756 return _conditionalReturn(value, function(index) { 5757 return a[~~wrapper(index)]; 5758 }); 5759}, wrap = function wrap(min, max, value) { 5760 // NOTE: wrap() CANNOT be an arrow function! A very odd compiling bug causes problems (unrelated to GSAP). 5761 var range = max - min; 5762 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function(value) { 5763 return (range + (value - min) % range) % range + min; 5764 }); 5765}, wrapYoyo = function wrapYoyo(min, max, value) { 5766 var range = max - min, total = range * 2; 5767 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function(value) { 5768 value = (total + (value - min) % total) % total || 0; 5769 return min + (value > range ? total - value : value); 5770 }); 5771}, _replaceRandom = function _replaceRandom(value) { 5772 //replaces all occurrences of random(...) in a string with the calculated random value. can be a range like random(-100, 100, 5) or an array like random([0, 100, 500]) 5773 var prev = 0, s = "", i, nums, end, isArray; 5774 while(~(i = value.indexOf("random(", prev))){ 5775 end = value.indexOf(")", i); 5776 isArray = value.charAt(i + 7) === "["; 5777 nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); 5778 s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); 5779 prev = end + 1; 5780 } 5781 return s + value.substr(prev, value.length - prev); 5782}, mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 5783 var inRange = inMax - inMin, outRange = outMax - outMin; 5784 return _conditionalReturn(value, function(value) { 5785 return outMin + ((value - inMin) / inRange * outRange || 0); 5786 }); 5787}, interpolate = function interpolate(start, end, progress, mutate) { 5788 var func = isNaN(start + end) ? 0 : function func(p) { 5789 return (1 - p) * start + p * end; 5790 }; 5791 if (!func) { 5792 var isString = _isString(start), master = {}, p, i, interpolators, l, il; 5793 progress === true && (mutate = 1) && (progress = null); 5794 if (isString) { 5795 start = { 5796 p: start 5797 }; 5798 end = { 5799 p: end 5800 }; 5801 } else if (_isArray(start) && !_isArray(end)) { 5802 interpolators = []; 5803 l = start.length; 5804 il = l - 2; 5805 for(i = 1; i < l; i++)interpolators.push(interpolate(start[i - 1], start[i])); //build the interpolators up front as a performance optimization so that when the function is called many times, it can just reuse them. 5806 l--; 5807 func = function func(p) { 5808 p *= l; 5809 var i = Math.min(il, ~~p); 5810 return interpolators[i](p - i); 5811 }; 5812 progress = end; 5813 }
vendor: 16,399 bytes, lines 5813-6210
5813 else if (!mutate) start = _merge(_isArray(start) ? [] : {}, start); 5814 if (!interpolators) { 5815 for(p in end)_addPropTween.call(master, start, p, "get", end[p]); 5816 func = function func(p) { 5817 return _renderPropTweens(p, master) || (isString ? start.p : start); 5818 }; 5819 } 5820 } 5821 return _conditionalReturn(progress, func); 5822}, _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 5823 //used for nextLabel() and previousLabel() 5824 var labels = timeline.labels, min = _bigNum, p, distance, label; 5825 for(p in labels){ 5826 distance = labels[p] - fromTime; 5827 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 5828 label = p; 5829 min = distance; 5830 } 5831 } 5832 return label; 5833}, _callback = function _callback(animation, type, executeLazyFirst) { 5834 var v = animation.vars, callback = v[type], prevContext = _context, context = animation._ctx, params, scope, result; 5835 if (!callback) return; 5836 params = v[type + "Params"]; 5837 scope = v.callbackScope || animation; 5838 executeLazyFirst && _lazyTweens.length && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. 5839 context && (_context = context); 5840 result = params ? callback.apply(scope, params) : callback.call(scope); 5841 _context = prevContext; 5842 return result; 5843}, _interrupt = function _interrupt(animation) { 5844 _removeFromParent(animation); 5845 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); 5846 animation.progress() < 1 && _callback(animation, "onInterrupt"); 5847 return animation; 5848}, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin(config) { 5849 if (!_windowExists()) { 5850 _registerPluginQueue.push(config); 5851 return; 5852 } 5853 config = !config.name && config["default"] || config; //UMD packaging wraps things oddly, so for example MotionPathHelper becomes {MotionPathHelper:MotionPathHelper, default:MotionPathHelper}. 5854 var name = config.name, isFunc = _isFunction(config), Plugin = name && !isFunc && config.init ? function Plugin() { 5855 this._props = []; 5856 } : config, //in case someone passes in an object that's not a plugin, like CustomEase 5857 instanceDefaults = { 5858 init: _emptyFunc, 5859 render: _renderPropTweens, 5860 add: _addPropTween, 5861 kill: _killPropTweensOf, 5862 modifier: _addPluginModifier, 5863 rawVars: 0 5864 }, statics = { 5865 targetTest: 0, 5866 get: 0, 5867 getSetter: _getSetter, 5868 aliases: {}, 5869 register: 0 5870 }; 5871 _wake(); 5872 if (config !== Plugin) { 5873 if (_plugins[name]) return; 5874 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); //static methods 5875 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); //instance methods 5876 _plugins[Plugin.prop = name] = Plugin; 5877 if (config.targetTest) { 5878 _harnessPlugins.push(Plugin); 5879 _reservedProps[name] = 1; 5880 } 5881 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; //for the global name. "motionPath" should become MotionPathPlugin 5882 } 5883 _addGlobal(name, Plugin); 5884 config.register && config.register(gsap, Plugin, PropTween); 5885}, /* 5886 * -------------------------------------------------------------------------------------- 5887 * COLORS 5888 * -------------------------------------------------------------------------------------- 5889 */ _255 = 255, _colorLookup = { 5890 aqua: [ 5891 0, 5892 _255, 5893 _255 5894 ], 5895 lime: [ 5896 0, 5897 _255, 5898 0 5899 ], 5900 silver: [ 5901 192, 5902 192, 5903 192 5904 ], 5905 black: [ 5906 0, 5907 0, 5908 0 5909 ], 5910 maroon: [ 5911 128, 5912 0, 5913 0 5914 ], 5915 teal: [ 5916 0, 5917 128, 5918 128 5919 ], 5920 blue: [ 5921 0, 5922 0, 5923 _255 5924 ], 5925 navy: [ 5926 0, 5927 0, 5928 128 5929 ], 5930 white: [ 5931 _255, 5932 _255, 5933 _255 5934 ], 5935 olive: [ 5936 128, 5937 128, 5938 0 5939 ], 5940 yellow: [ 5941 _255, 5942 _255, 5943 0 5944 ], 5945 orange: [ 5946 _255, 5947 165, 5948 0 5949 ], 5950 gray: [ 5951 128, 5952 128, 5953 128 5954 ], 5955 purple: [ 5956 128, 5957 0, 5958 128 5959 ], 5960 green: [ 5961 0, 5962 128, 5963 0 5964 ], 5965 red: [ 5966 _255, 5967 0, 5968 0 5969 ], 5970 pink: [ 5971 _255, 5972 192, 5973 203 5974 ], 5975 cyan: [ 5976 0, 5977 _255, 5978 _255 5979 ], 5980 transparent: [ 5981 _255, 5982 _255, 5983 _255, 5984 0 5985 ] 5986}, // possible future idea to replace the hard-coded color name values - put this in the ticker.wake() where we set the _doc: 5987// let ctx = _doc.createElement("canvas").getContext("2d"); 5988// _forEachName("aqua,lime,silver,black,maroon,teal,blue,navy,white,olive,yellow,orange,gray,purple,green,red,pink,cyan", color => {ctx.fillStyle = color; _colorLookup[color] = splitColor(ctx.fillStyle)}); 5989_hue = function _hue(h, m1, m2) { 5990 h += h < 0 ? 1 : h > 1 ? -1 : 0; 5991 return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0; 5992}, splitColor = function splitColor(v, toHSL, forceAlpha) { 5993 var a = !v ? _colorLookup.black : _isNumber(v) ? [ 5994 v >> 16, 5995 v >> 8 & _255, 5996 v & _255 5997 ] : 0, r, g, b, h, s, l, max, min, d, wasHSL; 5998 if (!a) { 5999 if (v.substr(-1) === ",") //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. 6000 v = v.substr(0, v.length - 1); 6001 if (_colorLookup[v]) a = _colorLookup[v]; 6002 else if (v.charAt(0) === "#") { 6003 if (v.length < 6) { 6004 //for shorthand like #9F0 or #9F0F (could have alpha) 6005 r = v.charAt(1); 6006 g = v.charAt(2); 6007 b = v.charAt(3); 6008 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 6009 } 6010 if (v.length === 9) { 6011 // hex with alpha, like #fd5e53ff 6012 a = parseInt(v.substr(1, 6), 16); 6013 return [ 6014 a >> 16, 6015 a >> 8 & _255, 6016 a & _255, 6017 parseInt(v.substr(7), 16) / 255 6018 ]; 6019 } 6020 v = parseInt(v.substr(1), 16); 6021 a = [ 6022 v >> 16, 6023 v >> 8 & _255, 6024 v & _255 6025 ]; 6026 } else if (v.substr(0, 3) === "hsl") { 6027 a = wasHSL = v.match(_strictNumExp); 6028 if (!toHSL) { 6029 h = +a[0] % 360 / 360; 6030 s = +a[1] / 100; 6031 l = +a[2] / 100; 6032 g = l <= .5 ? l * (s + 1) : l + s - l * s; 6033 r = l * 2 - g; 6034 a.length > 3 && (a[3] *= 1); //cast as number 6035 a[0] = _hue(h + 1 / 3, r, g); 6036 a[1] = _hue(h, r, g); 6037 a[2] = _hue(h - 1 / 3, r, g); 6038 } else if (~v.indexOf("=")) { 6039 //if relative values are found, just return the raw strings with the relative prefixes in place. 6040 a = v.match(_numExp); 6041 forceAlpha && a.length < 4 && (a[3] = 1); 6042 return a; 6043 } 6044 } else a = v.match(_strictNumExp) || _colorLookup.transparent; 6045 a = a.map(Number); 6046 } 6047 if (toHSL && !wasHSL) { 6048 r = a[0] / _255; 6049 g = a[1] / _255; 6050 b = a[2] / _255; 6051 max = Math.max(r, g, b); 6052 min = Math.min(r, g, b); 6053 l = (max + min) / 2; 6054 if (max === min) h = s = 0; 6055 else { 6056 d = max - min; 6057 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 6058 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 6059 h *= 60; 6060 } 6061 a[0] = ~~(h + .5); 6062 a[1] = ~~(s * 100 + .5); 6063 a[2] = ~~(l * 100 + .5); 6064 } 6065 forceAlpha && a.length < 4 && (a[3] = 1); 6066 return a; 6067}, _colorOrderData = function _colorOrderData(v) { 6068 // strips out the colors from the string, finds all the numeric slots (with units) and returns an array of those. The Array also has a "c" property which is an Array of the index values where the colors belong. This is to help work around issues where there's a mis-matched order of color/numeric data like drop-shadow(#f00 0px 1px 2px) and drop-shadow(0x 1px 2px #f00). This is basically a helper function used in _formatColors() 6069 var values = [], c = [], i = -1; 6070 v.split(_colorExp).forEach(function(v) { 6071 var a = v.match(_numWithUnitExp) || []; 6072 values.push.apply(values, a); 6073 c.push(i += a.length + 1); 6074 }); 6075 values.c = c; 6076 return values; 6077}, _formatColors = function _formatColors(s, toHSL, orderMatchData) { 6078 var result = "", colors = (s + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i = 0, c, shell, d, l; 6079 if (!colors) return s; 6080 colors = colors.map(function(color) { 6081 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 6082 }); 6083 if (orderMatchData) { 6084 d = _colorOrderData(s); 6085 c = orderMatchData.c; 6086 if (c.join(result) !== d.c.join(result)) { 6087 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 6088 l = shell.length - 1; 6089 for(; i < l; i++)result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 6090 } 6091 } 6092 if (!shell) { 6093 shell = s.split(_colorExp); 6094 l = shell.length - 1; 6095 for(; i < l; i++)result += shell[i] + colors[i]; 6096 } 6097 return result + shell[l]; 6098}, _colorExp = function() { 6099 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc., 6100 p; 6101 for(p in _colorLookup)s += "|" + p + "\\b"; 6102 return new RegExp(s + ")", "gi"); 6103}(), _hslExp = /hsl[a]?\(/, _colorStringFilter = function _colorStringFilter(a) { 6104 var combined = a.join(" "), toHSL; 6105 _colorExp.lastIndex = 0; 6106 if (_colorExp.test(combined)) { 6107 toHSL = _hslExp.test(combined); 6108 a[1] = _formatColors(a[1], toHSL); 6109 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); // make sure the order of numbers/colors match with the END value. 6110 return true; 6111 } 6112}, /* 6113 * -------------------------------------------------------------------------------------- 6114 * TICKER 6115 * -------------------------------------------------------------------------------------- 6116 */ _tickerActive, _ticker = function() { 6117 var _getTime = Date.now, _lagThreshold = 500, _adjustedLag = 33, _startTime = _getTime(), _lastUpdate = _startTime, _gap = 1000 / 240, _nextTime = _gap, _listeners = [], _id, _req, _raf, _self, _delta, _i, _tick = function _tick(v) { 6118 var elapsed = _getTime() - _lastUpdate, manual = v === true, overlap, dispatch, time, frame; 6119 elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag); 6120 _lastUpdate += elapsed; 6121 time = _lastUpdate - _startTime; 6122 overlap = time - _nextTime; 6123 if (overlap > 0 || manual) { 6124 frame = ++_self.frame; 6125 _delta = time - _self.time * 1000; 6126 _self.time = time = time / 1000; 6127 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 6128 dispatch = 1; 6129 } 6130 manual || (_id = _req(_tick)); //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. 6131 if (dispatch) for(_i = 0; _i < _listeners.length; _i++)// use _i and check _listeners.length instead of a variable because a listener could get removed during the loop, and if that happens to an element less than the current index, it'd throw things off in the loop. 6132 _listeners[_i](time, _delta, frame, v); 6133 }; 6134 _self = { 6135 time: 0, 6136 frame: 0, 6137 tick: function tick() { 6138 _tick(true); 6139 }, 6140 deltaRatio: function deltaRatio(fps) { 6141 return _delta / (1000 / (fps || 60)); 6142 }, 6143 wake: function wake() { 6144 if (_coreReady) { 6145 if (!_coreInitted && _windowExists()) { 6146 _win = _coreInitted = window; 6147 _doc = _win.document || {}; 6148 _globals.gsap = gsap; 6149 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 6150 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 6151 _raf = _win.requestAnimationFrame; 6152 _registerPluginQueue.forEach(_createPlugin); 6153 } 6154 _id && _self.sleep(); 6155 _req = _raf || function(f) { 6156 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 6157 }; 6158 _tickerActive = 1; 6159 _tick(2); 6160 } 6161 }, 6162 sleep: function sleep() { 6163 (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id); 6164 _tickerActive = 0; 6165 _req = _emptyFunc; 6166 }, 6167 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 6168 _lagThreshold = threshold || Infinity; // zero should be interpreted as basically unlimited 6169 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 6170 }, 6171 fps: function fps(_fps) { 6172 _gap = 1000 / (_fps || 240); 6173 _nextTime = _self.time * 1000 + _gap; 6174 }, 6175 add: function add(callback, once, prioritize) { 6176 var func = once ? function func1(t, d, f, v) { 6177 callback(t, d, f, v); 6178 _self.remove(func); 6179 } : callback; 6180 _self.remove(callback); 6181 _listeners[prioritize ? "unshift" : "push"](func); 6182 _wake(); 6183 return func; 6184 }, 6185 remove: function remove(callback, i) { 6186 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 6187 }, 6188 _listeners: _listeners 6189 }; 6190 return _self; 6191}(), _wake = function _wake() { 6192 return !_tickerActive && _ticker.wake(); 6193}, //also ensures the core classes are initialized. 6194/* 6195* ------------------------------------------------- 6196* EASING 6197* ------------------------------------------------- 6198*/ _easeMap = {}, _customEaseExp = /^[\d.\-M][\d.\-,\s]/, _quotesExp = /["']/g, _parseObjectInString = function _parseObjectInString(value) { 6199 //takes a string like "{wiggles:10, type:anticipate})" and turns it into a real object. Notice it ends in ")" and includes the {} wrappers. This is because we only use this function for parsing ease configs and prioritized optimization rather than reusability. 6200 var obj = {}, split = value.substr(1, value.length - 3).split(":"), key = split[0], i = 1, l = split.length, index, val, parsedVal; 6201 for(; i < l; i++){ 6202 val = split[i]; 6203 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 6204 parsedVal = val.substr(0, index); 6205 obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 6206 key = val.substr(index + 1).trim(); 6207 } 6208 return obj; 6209}, _valueInParentheses = function _valueInParentheses(value) { 6210 var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open
vendor: 5,265 bytes, lines 6210-6310
6210); 6211 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 6212}, _configEaseFromString = function _configEaseFromString(name) { 6213 //name can be a string like "elastic.out(1,0.5)", and pass in _easeMap as obj and it'll parse it out and call the actual function like _easeMap.Elastic.easeOut.config(1,0.5). It will also parse custom ease strings as long as CustomEase is loaded and registered (internally as _easeMap._CE). 6214 var split = (name + "").split("("), ease = _easeMap[split[0]]; 6215 return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [ 6216 _parseObjectInString(split[1]) 6217 ] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 6218}, _invertEase = function _invertEase(ease) { 6219 return function(p) { 6220 return 1 - ease(1 - p); 6221 }; 6222}, // allow yoyoEase to be set in children and have those affected when the parent/ancestor timeline yoyos. 6223_propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 6224 var child = timeline._first, ease; 6225 while(child){ 6226 if (child instanceof Timeline) _propagateYoyoEase(child, isYoyo); 6227 else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 6228 if (child.timeline) _propagateYoyoEase(child.timeline, isYoyo); 6229 else { 6230 ease = child._ease; 6231 child._ease = child._yEase; 6232 child._yEase = ease; 6233 child._yoyo = isYoyo; 6234 } 6235 } 6236 child = child._next; 6237 } 6238}, _parseEase = function _parseEase(ease, defaultEase) { 6239 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 6240}, _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 6241 if (easeOut === void 0) easeOut = function easeOut(p) { 6242 return 1 - easeIn(1 - p); 6243 }; 6244 if (easeInOut === void 0) easeInOut = function easeInOut(p) { 6245 return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 6246 }; 6247 var ease = { 6248 easeIn: easeIn, 6249 easeOut: easeOut, 6250 easeInOut: easeInOut 6251 }, lowercaseName; 6252 _forEachName(names, function(name) { 6253 _easeMap[name] = _globals[name] = ease; 6254 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 6255 for(var p in ease)_easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 6256 }); 6257 return ease; 6258}, _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 6259 return function(p) { 6260 return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; 6261 }; 6262}, _configElastic = function _configElastic(type, amplitude, period) { 6263 var p1 = amplitude >= 1 ? amplitude : 1, //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. 6264 p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), easeOut = function easeOut(p) { 6265 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 6266 }, ease = type === "out" ? easeOut : type === "in" ? function ease(p) { 6267 return 1 - easeOut(1 - p); 6268 } : _easeInOutFromOut(easeOut); 6269 p2 = _2PI / p2; //precalculate to optimize 6270 ease.config = function(amplitude, period) { 6271 return _configElastic(type, amplitude, period); 6272 }; 6273 return ease; 6274}, _configBack = function _configBack(type, overshoot) { 6275 if (overshoot === void 0) overshoot = 1.70158; 6276 var easeOut = function easeOut(p) { 6277 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 6278 }, ease = type === "out" ? easeOut : type === "in" ? function ease(p) { 6279 return 1 - easeOut(1 - p); 6280 } : _easeInOutFromOut(easeOut); 6281 ease.config = function(overshoot) { 6282 return _configBack(type, overshoot); 6283 }; 6284 return ease; 6285}; // a cheaper (kb and cpu) but more mild way to get a parameterized weighted ease by feeding in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 6286// _weightedEase = ratio => { 6287// let y = 0.5 + ratio / 2; 6288// return p => (2 * (1 - p) * p * y + p * p); 6289// }, 6290// a stronger (but more expensive kb/cpu) parameterized weighted ease that lets you feed in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 6291// _weightedEaseStrong = ratio => { 6292// ratio = .5 + ratio / 2; 6293// let o = 1 / 3 * (ratio < .5 ? ratio : 1 - ratio), 6294// b = ratio - o, 6295// c = ratio + o; 6296// return p => p === 1 ? p : 3 * b * (1 - p) * (1 - p) * p + 3 * c * (1 - p) * p * p + p * p * p; 6297// }; 6298_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i) { 6299 var power = i < 5 ? i + 1 : i; 6300 _insertEase(name + ",Power" + (power - 1), i ? function(p) { 6301 return Math.pow(p, power); 6302 } : function(p) { 6303 return p; 6304 }, function(p) { 6305 return 1 - Math.pow(1 - p, power); 6306 }, function(p) { 6307 return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 6308 }); 6309}); 6310_easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
vendor: 5,092 bytes, lines 6311-6398
6311_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 6312(function(n, c) { 6313 var n1 = 1 / c, n2 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut(p) { 6314 return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375; 6315 }; 6316 _insertEase("Bounce", function(p) { 6317 return 1 - easeOut(1 - p); 6318 }, easeOut); 6319})(7.5625, 2.75); 6320_insertEase("Expo", function(p) { 6321 return p ? Math.pow(2, 10 * (p - 1)) : 0; 6322}); 6323_insertEase("Circ", function(p) { 6324 return -(_sqrt(1 - p * p) - 1); 6325}); 6326_insertEase("Sine", function(p) { 6327 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 6328}); 6329_insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 6330_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 6331 config: function config(steps, immediateStart) { 6332 if (steps === void 0) steps = 1; 6333 var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum; 6334 return function(p) { 6335 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 6336 }; 6337 } 6338}; 6339_defaults.ease = _easeMap["quad.out"]; 6340_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) { 6341 return _callbackNames += name + "," + name + "Params,"; 6342}); 6343var GSCache = function GSCache(target, harness) { 6344 this.id = _gsID++; 6345 target._gsap = this; 6346 this.target = target; 6347 this.harness = harness; 6348 this.get = harness ? harness.get : _getProperty; 6349 this.set = harness ? harness.getSetter : _getSetter; 6350}; 6351var Animation = /*#__PURE__*/ function() { 6352 var Animation = function Animation(vars) { 6353 this.vars = vars; 6354 this._delay = +vars.delay || 0; 6355 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 6356 // TODO: repeat: Infinity on a timeline's children must flag that timeline internally and affect its totalDuration, otherwise it'll stop in the negative direction when reaching the start. 6357 this._rDelay = vars.repeatDelay || 0; 6358 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 6359 } 6360 this._ts = 1; 6361 _setDuration(this, +vars.duration, 1, 1); 6362 this.data = vars.data; 6363 if (_context) { 6364 this._ctx = _context; 6365 _context.data.push(this); 6366 } 6367 _tickerActive || _ticker.wake(); 6368 }; 6369 var _proto = Animation.prototype; 6370 _proto.delay = function delay(value) { 6371 if (value || value === 0) { 6372 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 6373 this._delay = value; 6374 return this; 6375 } 6376 return this._delay; 6377 }; 6378 _proto.duration = function duration(value) { 6379 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 6380 }; 6381 _proto.totalDuration = function totalDuration(value) { 6382 if (!arguments.length) return this._tDur; 6383 this._dirty = 0; 6384 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 6385 }; 6386 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 6387 _wake(); 6388 if (!arguments.length) return this._tTime; 6389 var parent = this._dp; 6390 if (parent && parent.smoothChildTiming && this._ts) { 6391 _alignPlayhead(this, _totalTime); 6392 !parent._dp || parent.parent || _postAddChecks(parent, this); // edge case: if this is a child of a timeline that already completed, for example, we must re-activate the parent. 6393 //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The start of that child would get pushed out, but one of the ancestors may have completed. 6394 while(parent && parent.parent){ 6395 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) parent.totalTime(parent._tTime, true); 6396 parent = parent.parent; 6397 } 6398 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) //if the animation doesn't have a parent, put it back into its last parent (recorded as _dp for exactly cases like this). Limit to parents with autoRemoveChildren (like globalTimeline) so that if the user manually removes an animation from a timeline and then alters its playhead, it doesn't get added back in.
vendor: 3,225 bytes, lines 6399-6429
6399 _addToTimeline(this._dp, this, this._start - this._delay); 6400 } 6401 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 6402 // check for _ptLookup on a Tween instance to ensure it has actually finished being instantiated, otherwise if this.reverse() gets called in the Animation constructor, it could trigger a render() here even though the _targets weren't populated, thus when _init() is called there won't be any PropTweens (it'll act like the tween is non-functional) 6403 this._ts || (this._pTime = _totalTime); // otherwise, if an animation is paused, then the playhead is moved back to zero, then resumed, it'd revert back to the original time at the pause 6404 //if (!this._lock) { // avoid endless recursion (not sure we need this yet or if it's worth the performance hit) 6405 // this._lock = 1; 6406 _lazySafeRender(this, _totalTime, suppressEvents); // this._lock = 0; 6407 //} 6408 } 6409 return this; 6410 }; 6411 _proto.time = function time(value, suppressEvents) { 6412 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; // note: if the modulus results in 0, the playhead could be exactly at the end or the beginning, and we always defer to the END with a non-zero value, otherwise if you set the time() to the very end (duration()), it would render at the START! 6413 }; 6414 _proto.totalProgress = function totalProgress(value, suppressEvents) { 6415 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio; 6416 }; 6417 _proto.progress = function progress(value, suppressEvents) { 6418 return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.ratio; 6419 }; 6420 _proto.iteration = function iteration(value, suppressEvents) { 6421 var cycleDuration = this.duration() + this._rDelay; 6422 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 6423 } // potential future addition: 6424 ; 6425 _proto.timeScale = function timeScale(value) { 6426 if (!arguments.length) return this._rts === -_tinyNum ? 0 : this._rts; // recorded timeScale. Special case: if someone calls reverse() on an animation with timeScale of 0, we assign it -_tinyNum to remember it's reversed. 6427 if (this._rts === value) return this; 6428 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; // make sure to do the parentToChildTotalTime() BEFORE setting the new _ts because the old one must be used in that calculation. 6429 // future addition? Up side: fast and minimal file size. Down side: only works on this animation;
vendor: 7,050 bytes, lines 6429-6539
6429 if a timeline is reversed, for example, its childrens' onReverse wouldn't get called. 6430 //(+value < 0 && this._rts >= 0) && _callback(this, "onReverse", true); 6431 // prioritize rendering where the parent's playhead lines up instead of this._tTime because there could be a tween that's animating another tween's timeScale in the same rendering loop (same parent), thus if the timeScale tween renders first, it would alter _start BEFORE _tTime was set on that tick (in the rendering loop), effectively freezing it until the timeScale tween finishes. 6432 this._rts = +value || 0; 6433 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; // _ts is the functional timeScale which would be 0 if the animation is paused. 6434 this.totalTime(_clamp(-Math.abs(this._delay), this._tDur, tTime), true); 6435 _setEnd(this); // if parent.smoothChildTiming was false, the end time didn't get updated in the _alignPlayhead() method, so do it here. 6436 return _recacheAncestors(this); 6437 }; 6438 _proto.paused = function paused(value) { 6439 if (!arguments.length) return this._ps; 6440 if (this._ps !== value) { 6441 this._ps = value; 6442 if (value) { 6443 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); // if the pause occurs during the delay phase, make sure that's factored in when resuming. 6444 this._ts = this._act = 0; // _ts is the functional timeScale, so a paused tween would effectively have a timeScale of 0. We record the "real" timeScale as _rts (recorded time scale) 6445 } else { 6446 _wake(); 6447 this._ts = this._rts; //only defer to _pTime (pauseTime) if tTime is zero. Remember, someone could pause() an animation, then scrub the playhead and resume(). If the parent doesn't have smoothChildTiming, we render at the rawTime() because the startTime won't get updated. 6448 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); // edge case: animation.progress(1).pause().play() wouldn't render again because the playhead is already at the end, but the call to totalTime() below will add it back to its parent...and not remove it again (since removing only happens upon rendering at a new time). Offsetting the _tTime slightly is done simply to cause the final render in totalTime() that'll pop it off its timeline (if autoRemoveChildren is true, of course). Check to make sure _zTime isn't -_tinyNum to avoid an edge case where the playhead is pushed to the end but INSIDE a tween/callback, the timeline itself is paused thus halting rendering and leaving a few unrendered. When resuming, it wouldn't render those otherwise. 6449 } 6450 } 6451 return this; 6452 }; 6453 _proto.startTime = function startTime(value) { 6454 if (arguments.length) { 6455 this._start = value; 6456 var parent = this.parent || this._dp; 6457 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 6458 return this; 6459 } 6460 return this._start; 6461 }; 6462 _proto.endTime = function endTime(includeRepeats) { 6463 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 6464 }; 6465 _proto.rawTime = function rawTime(wrapRepeats) { 6466 var parent = this.parent || this._dp; // _dp = detached parent 6467 return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); 6468 }; 6469 _proto.revert = function revert(config) { 6470 if (config === void 0) config = _revertConfig; 6471 var prevIsReverting = _reverting; 6472 _reverting = config; 6473 if (this._initted || this._startAt) { 6474 this.timeline && this.timeline.revert(config); 6475 this.totalTime(-0.01, config.suppressEvents); 6476 } 6477 this.data !== "nested" && config.kill !== false && this.kill(); 6478 _reverting = prevIsReverting; 6479 return this; 6480 }; 6481 _proto.globalTime = function globalTime(rawTime) { 6482 var animation = this, time = arguments.length ? rawTime : animation.rawTime(); 6483 while(animation){ 6484 time = animation._start + time / (animation._ts || 1); 6485 animation = animation._dp; 6486 } 6487 return !this.parent && this._sat ? this._sat.vars.immediateRender ? -1 : this._sat.globalTime(rawTime) : time; // the _startAt tweens for .fromTo() and .from() that have immediateRender should always be FIRST in the timeline (important for context.revert()). "_sat" stands for _startAtTween, referring to the parent tween that created the _startAt. We must discern if that tween had immediateRender so that we can know whether or not to prioritize it in revert(). 6488 }; 6489 _proto.repeat = function repeat(value) { 6490 if (arguments.length) { 6491 this._repeat = value === Infinity ? -2 : value; 6492 return _onUpdateTotalDuration(this); 6493 } 6494 return this._repeat === -2 ? Infinity : this._repeat; 6495 }; 6496 _proto.repeatDelay = function repeatDelay(value) { 6497 if (arguments.length) { 6498 var time = this._time; 6499 this._rDelay = value; 6500 _onUpdateTotalDuration(this); 6501 return time ? this.time(time) : this; 6502 } 6503 return this._rDelay; 6504 }; 6505 _proto.yoyo = function yoyo(value) { 6506 if (arguments.length) { 6507 this._yoyo = value; 6508 return this; 6509 } 6510 return this._yoyo; 6511 }; 6512 _proto.seek = function seek(position, suppressEvents) { 6513 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 6514 }; 6515 _proto.restart = function restart(includeDelay, suppressEvents) { 6516 return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 6517 }; 6518 _proto.play = function play(from, suppressEvents) { 6519 from != null && this.seek(from, suppressEvents); 6520 return this.reversed(false).paused(false); 6521 }; 6522 _proto.reverse = function reverse(from, suppressEvents) { 6523 from != null && this.seek(from || this.totalDuration(), suppressEvents); 6524 return this.reversed(true).paused(false); 6525 }; 6526 _proto.pause = function pause(atTime, suppressEvents) { 6527 atTime != null && this.seek(atTime, suppressEvents); 6528 return this.paused(true); 6529 }; 6530 _proto.resume = function resume() { 6531 return this.paused(false); 6532 }; 6533 _proto.reversed = function reversed(value) { 6534 if (arguments.length) { 6535 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); // in case timeScale is zero, reversing would have no effect so we use _tinyNum. 6536 return this; 6537 } 6538 return this._rts < 0; 6539 };
vendor: 9,776 bytes, lines 6540-6705
6540 _proto.invalidate = function invalidate() { 6541 this._initted = this._act = 0; 6542 this._zTime = -_tinyNum; 6543 return this; 6544 }; 6545 _proto.isActive = function isActive() { 6546 var parent = this.parent || this._dp, start = this._start, rawTime; 6547 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 6548 }; 6549 _proto.eventCallback = function eventCallback(type, callback, params) { 6550 var vars = this.vars; 6551 if (arguments.length > 1) { 6552 if (!callback) delete vars[type]; 6553 else { 6554 vars[type] = callback; 6555 params && (vars[type + "Params"] = params); 6556 type === "onUpdate" && (this._onUpdate = callback); 6557 } 6558 return this; 6559 } 6560 return vars[type]; 6561 }; 6562 _proto.then = function then(onFulfilled) { 6563 var self = this; 6564 return new Promise(function(resolve) { 6565 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, _resolve = function _resolve() { 6566 var _then = self.then; 6567 self.then = null; // temporarily null the then() method to avoid an infinite loop (see https://github.com/greensock/GSAP/issues/322) 6568 _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); 6569 resolve(f); 6570 self.then = _then; 6571 }; 6572 if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) _resolve(); 6573 else self._prom = _resolve; 6574 }); 6575 }; 6576 _proto.kill = function kill() { 6577 _interrupt(this); 6578 }; 6579 return Animation; 6580}(); 6581_setDefaults(Animation.prototype, { 6582 _time: 0, 6583 _start: 0, 6584 _end: 0, 6585 _tTime: 0, 6586 _tDur: 0, 6587 _dirty: 0, 6588 _repeat: 0, 6589 _yoyo: false, 6590 parent: null, 6591 _initted: false, 6592 _rDelay: 0, 6593 _ts: 1, 6594 _dp: 0, 6595 ratio: 0, 6596 _zTime: -_tinyNum, 6597 _prom: 0, 6598 _ps: false, 6599 _rts: 1 6600}); 6601var Timeline = /*#__PURE__*/ function(_Animation) { 6602 var Timeline = function Timeline(vars, position) { 6603 var _this; 6604 if (vars === void 0) vars = {}; 6605 _this = _Animation.call(this, vars) || this; 6606 _this.labels = {}; 6607 _this.smoothChildTiming = !!vars.smoothChildTiming; 6608 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 6609 _this._sort = _isNotFalse(vars.sortChildren); 6610 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 6611 vars.reversed && _this.reverse(); 6612 vars.paused && _this.paused(true); 6613 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 6614 return _this; 6615 }; 6616 _inheritsLoose(Timeline, _Animation); 6617 var _proto2 = Timeline.prototype; 6618 _proto2.to = function to(targets, vars, position) { 6619 _createTweenType(0, arguments, this); 6620 return this; 6621 }; 6622 _proto2.from = function from(targets, vars, position) { 6623 _createTweenType(1, arguments, this); 6624 return this; 6625 }; 6626 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 6627 _createTweenType(2, arguments, this); 6628 return this; 6629 }; 6630 _proto2.set = function set(targets, vars, position) { 6631 vars.duration = 0; 6632 vars.parent = this; 6633 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 6634 vars.immediateRender = !!vars.immediateRender; 6635 new Tween(targets, vars, _parsePosition(this, position), 1); 6636 return this; 6637 }; 6638 _proto2.call = function call(callback, params, position) { 6639 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 6640 } //ONLY for backward compatibility! Maybe delete? 6641 ; 6642 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 6643 vars.duration = duration; 6644 vars.stagger = vars.stagger || stagger; 6645 vars.onComplete = onCompleteAll; 6646 vars.onCompleteParams = onCompleteAllParams; 6647 vars.parent = this; 6648 new Tween(targets, vars, _parsePosition(this, position)); 6649 return this; 6650 }; 6651 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 6652 vars.runBackwards = 1; 6653 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 6654 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 6655 }; 6656 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 6657 toVars.startAt = fromVars; 6658 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 6659 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 6660 }; 6661 _proto2.render = function render(totalTime, suppressEvents, force) { 6662 var prevTime = this._time, tDur = this._dirty ? this.totalDuration() : this._tDur, dur = this._dur, tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), // if a paused timeline is resumed (or its _start is updated for another reason...which rounds it), that could result in the playhead shifting a **tiny** amount and a zero-duration child at that spot may get rendered at a different ratio, like its totalTime in render() may be 1e-17 instead of 0, for example. 6663 crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), time, child, next, iteration, cycleDuration, prevPaused, pauseTween, timeScale, prevStart, prevIteration, yoyo, isYoyo; 6664 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 6665 if (tTime !== this._tTime || force || crossingStart) { 6666 if (prevTime !== this._time && dur) { 6667 //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). 6668 tTime += this._time - prevTime; 6669 totalTime += this._time - prevTime; 6670 } 6671 time = tTime; 6672 prevStart = this._start; 6673 timeScale = this._ts; 6674 prevPaused = !timeScale; 6675 if (crossingStart) { 6676 dur || (prevTime = this._zTime); //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 6677 (totalTime || !suppressEvents) && (this._zTime = totalTime); 6678 } 6679 if (this._repeat) { 6680 //adjust the time for repeats and yoyos 6681 yoyo = this._yoyo; 6682 cycleDuration = dur + this._rDelay; 6683 if (this._repeat < -1 && totalTime < 0) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 6684 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 6685 if (tTime === tDur) { 6686 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 6687 iteration = this._repeat; 6688 time = dur; 6689 } else { 6690 iteration = ~~(tTime / cycleDuration); 6691 if (iteration && iteration === tTime / cycleDuration) { 6692 time = dur; 6693 iteration--; 6694 } 6695 time > dur && (time = dur); 6696 } 6697 prevIteration = _animationCycle(this._tTime, cycleDuration); 6698 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); // edge case - if someone does addPause() at the very beginning of a repeating timeline, that pause is technically at the same spot as the end which causes this._time to get set to 0 when the totalTime would normally place the playhead at the end. See https://greensock.com/forums/topic/23823-closing-nav-animation-not-working-on-ie-and-iphone-6-maybe-other-older-browser/?tab=comments#comment-113005 also, this._tTime - prevIteration * cycleDuration - this._dur <= 0 just checks to make sure it wasn't previously in the "repeatDelay" portion 6699 if (yoyo && iteration & 1) { 6700 time = dur - time; 6701 isYoyo = 1; 6702 } 6703 /* 6704 make sure children at the end/beginning of the timeline are rendered properly. If, for example, 6705 a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
6706 would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there 6707 could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So 6708 we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must 6709 ensure that zero-duration tweens at the very beginning or end of the Timeline work. 6710 */ if (iteration !== prevIteration && !this._lock) { 6711 var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1); 6712 iteration < prevIteration && (rewinding = !rewinding); 6713 prevTime = rewinding ? 0 : dur; 6714 this._lock = 1; 6715 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 6716 this._tTime = tTime; // if a user gets the iteration() inside the onRepeat, for example, it should be accurate. 6717 !suppressEvents && this.parent && _callback(this, "onRepeat"); 6718 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 6719 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) // if prevTime is 0 and we render at the very end, _time will be the end, thus won't match. So in this edge case, prevTime won't match _time but that's okay. If it gets killed in the onRepeat, eject as well. 6720 return this; 6721 dur = this._dur; // in case the duration changed in the onRepeat 6722 tDur = this._tDur; 6723 if (doesWrap) { 6724 this._lock = 2; 6725 prevTime = rewinding ? dur : -0.0001; 6726 this.render(prevTime, true); 6727 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 6728 } 6729 this._lock = 0; 6730 if (!this._ts && !prevPaused) return this; 6731 //in order for yoyoEase to work properly when there's a stagger, we must swap out the ease in each sub-tween. 6732 _propagateYoyoEase(this, isYoyo); 6733 } 6734 } 6735 if (this._hasPause && !this._forcing && this._lock < 2) { 6736 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 6737 if (pauseTween) tTime -= time - (time = pauseTween._start); 6738 } 6739 this._tTime = tTime; 6740 this._time = time; 6741 this._act = !timeScale; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 6742 if (!this._initted) { 6743 this._onUpdate = this.vars.onUpdate; 6744 this._initted = 1; 6745 this._zTime = totalTime; 6746 prevTime = 0; // upon init, the playhead should always go forward;
6746 someone could invalidate() a completed timeline and then if they restart(), that would make child tweens render in reverse order which could lock in the wrong starting values if they build on each other, like tl.to(obj, {x: 100}).to(obj, {x: 0}). 6747 } 6748 if (!prevTime && time && !suppressEvents && !iteration) { 6749 _callback(this, "onStart"); 6750 if (this._tTime !== tTime) // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 6751 return this; 6752 } 6753 if (time >= prevTime && totalTime >= 0) { 6754 child = this._first; 6755 while(child){ 6756 next = child._next; 6757 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 6758 if (child.parent !== this) // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 6759 return this.render(totalTime, suppressEvents, force); 6760 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 6761 if (time !== this._time || !this._ts && !prevPaused) { 6762 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 6763 pauseTween = 0; 6764 next && (tTime += this._zTime = -_tinyNum); // it didn't finish rendering, so flag zTime as negative so that so that the next time render() is called it'll be forced (to render any remaining children) 6765 break; 6766 } 6767 } 6768 child = next; 6769 } 6770 } else { 6771 child = this._last; 6772 var adjustedTime = totalTime < 0 ? totalTime : time; //when the playhead goes backward beyond the start of this timeline, we must pass that information down to the child animations so that zero-duration tweens know whether to render their starting or ending values. 6773 while(child){ 6774 next = child._prev; 6775 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 6776 if (child.parent !== this) // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 6777 return this.render(totalTime, suppressEvents, force); 6778 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && (child._initted || child._startAt)); // if reverting, we should always force renders of initted tweens (but remember that .fromTo() or .from() may have a _startAt but not _initted yet). If, for example, a .fromTo() tween with a stagger (which creates an internal timeline) gets reverted BEFORE some of its child tweens render for the first time, it may not properly trigger them to revert. 6779 if (time !== this._time || !this._ts && !prevPaused) { 6780 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 6781 pauseTween = 0; 6782 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); // it didn't finish rendering, so adjust zTime so that so that the next time render() is called it'll be forced (to render any remaining children) 6783 break; 6784 } 6785 } 6786 child = next; 6787 } 6788 } 6789 if (pauseTween && !suppressEvents) { 6790 this.pause(); 6791 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
6792 if (this._ts) { 6793 //the callback resumed playback! So since we may have held back the playhead due to where the pause is positioned, go ahead and jump to where it's SUPPOSED to be (if no pause happened). 6794 this._start = prevStart; //if the pause was at an earlier time and the user resumed in the callback, it could reposition the timeline (changing its startTime), throwing things off slightly, so we make sure the _start doesn't shift. 6795 _setEnd(this); 6796 return this.render(totalTime, suppressEvents, force); 6797 } 6798 } 6799 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 6800 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) { 6801 if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) { 6802 if (!this._lock) { 6803 // remember, a child's callback may alter this timeline's playhead or timeScale which is why we need to add some of these checks. 6804 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 6805 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 6806 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 6807 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 6808 } 6809 } 6810 } 6811 } 6812 } 6813 return this; 6814 }; 6815 _proto2.add = function add(child, position) { 6816 var _this2 = this; 6817 _isNumber(position) || (position = _parsePosition(this, position, child)); 6818 if (!(child instanceof Animation)) { 6819 if (_isArray(child)) { 6820 child.forEach(function(obj) { 6821 return _this2.add(obj, position); 6822 }); 6823 return this; 6824 } 6825 if (_isString(child)) return this.addLabel(child, position); 6826 if (_isFunction(child)) child = Tween.delayedCall(0, child); 6827 else return this; 6828 } 6829 return this !== child ? _addToTimeline(this, child, position) : this; //don't allow a timeline to be added to itself as a child! 6830 }; 6831 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 6832 if (nested === void 0) nested = true; 6833 if (tweens === void 0) tweens = true; 6834 if (timelines === void 0) timelines = true; 6835 if (ignoreBeforeTime === void 0) ignoreBeforeTime = -_bigNum; 6836 var a = [], child = this._first; 6837 while(child){ 6838 if (child._start >= ignoreBeforeTime) { 6839 if (child instanceof Tween) tweens && a.push(child); 6840 else { 6841 timelines && a.push(child); 6842 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 6843 } 6844 } 6845 child = child._next; 6846 } 6847 return a; 6848 }; 6849 _proto2.getById = function getById(id) { 6850 var animations = this.getChildren(1, 1, 1), i = animations.length; 6851 while(i--){ 6852 if (animations[i].vars.id === id) return animations[i]; 6853 } 6854 }; 6855 _proto2.remove = function remove(child) { 6856 if (_isString(child)) return this.removeLabel(child); 6857 if (_isFunction(child)) return this.killTweensOf(child); 6858 _removeLinkedListItem(this, child); 6859 if (child === this._recent) this._recent = this._last; 6860 return _uncache(this); 6861 }; 6862 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 6863 if (!arguments.length) return this._tTime; 6864 this._forcing = 1; 6865 if (!this._dp && this._ts) //special case for the global timeline (or any other that has no parent or detached parent). 6866 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts
vendor: 9,373 bytes, lines 6866-7057
6866)); 6867 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 6868 this._forcing = 0; 6869 return this; 6870 }; 6871 _proto2.addLabel = function addLabel(label, position) { 6872 this.labels[label] = _parsePosition(this, position); 6873 return this; 6874 }; 6875 _proto2.removeLabel = function removeLabel(label) { 6876 delete this.labels[label]; 6877 return this; 6878 }; 6879 _proto2.addPause = function addPause(position, callback, params) { 6880 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 6881 t.data = "isPause"; 6882 this._hasPause = 1; 6883 return _addToTimeline(this, t, _parsePosition(this, position)); 6884 }; 6885 _proto2.removePause = function removePause(position) { 6886 var child = this._first; 6887 position = _parsePosition(this, position); 6888 while(child){ 6889 if (child._start === position && child.data === "isPause") _removeFromParent(child); 6890 child = child._next; 6891 } 6892 }; 6893 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 6894 var tweens = this.getTweensOf(targets, onlyActive), i = tweens.length; 6895 while(i--)_overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 6896 return this; 6897 }; 6898 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 6899 var a = [], parsedTargets = toArray(targets), child = this._first, isGlobalTime = _isNumber(onlyActive), // a number is interpreted as a global time. If the animation spans 6900 children; 6901 while(child){ 6902 if (child instanceof Tween) { 6903 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) // note: if this is for overwriting, it should only be for tweens that aren't paused and are initted. 6904 a.push(child); 6905 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) a.push.apply(a, children); 6906 child = child._next; 6907 } 6908 return a; 6909 } // potential future feature - targets() on timelines 6910 ; 6911 _proto2.tweenTo = function tweenTo(position, vars) { 6912 vars = vars || {}; 6913 var tl = this, endTime = _parsePosition(tl, position), _vars = vars, startAt = _vars.startAt, _onStart = _vars.onStart, onStartParams = _vars.onStartParams, immediateRender = _vars.immediateRender, initted, tween = Tween.to(tl, _setDefaults({ 6914 ease: vars.ease || "none", 6915 lazy: false, 6916 immediateRender: false, 6917 time: endTime, 6918 overwrite: "auto", 6919 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 6920 onStart: function onStart() { 6921 tl.pause(); 6922 if (!initted) { 6923 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 6924 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 6925 initted = 1; 6926 } 6927 _onStart && _onStart.apply(tween, onStartParams || []); //in case the user had an onStart in the vars - we don't want to overwrite it. 6928 } 6929 }, vars)); 6930 return immediateRender ? tween.render(0) : tween; 6931 }; 6932 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 6933 return this.tweenTo(toPosition, _setDefaults({ 6934 startAt: { 6935 time: _parsePosition(this, fromPosition) 6936 } 6937 }, vars)); 6938 }; 6939 _proto2.recent = function recent() { 6940 return this._recent; 6941 }; 6942 _proto2.nextLabel = function nextLabel(afterTime) { 6943 if (afterTime === void 0) afterTime = this._time; 6944 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 6945 }; 6946 _proto2.previousLabel = function previousLabel(beforeTime) { 6947 if (beforeTime === void 0) beforeTime = this._time; 6948 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 6949 }; 6950 _proto2.currentLabel = function currentLabel(value) { 6951 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 6952 }; 6953 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 6954 if (ignoreBeforeTime === void 0) ignoreBeforeTime = 0; 6955 var child = this._first, labels = this.labels, p; 6956 while(child){ 6957 if (child._start >= ignoreBeforeTime) { 6958 child._start += amount; 6959 child._end += amount; 6960 } 6961 child = child._next; 6962 } 6963 if (adjustLabels) { 6964 for(p in labels)if (labels[p] >= ignoreBeforeTime) labels[p] += amount; 6965 } 6966 return _uncache(this); 6967 }; 6968 _proto2.invalidate = function invalidate(soft) { 6969 var child = this._first; 6970 this._lock = 0; 6971 while(child){ 6972 child.invalidate(soft); 6973 child = child._next; 6974 } 6975 return _Animation.prototype.invalidate.call(this, soft); 6976 }; 6977 _proto2.clear = function clear(includeLabels) { 6978 if (includeLabels === void 0) includeLabels = true; 6979 var child = this._first, next; 6980 while(child){ 6981 next = child._next; 6982 this.remove(child); 6983 child = next; 6984 } 6985 this._dp && (this._time = this._tTime = this._pTime = 0); 6986 includeLabels && (this.labels = {}); 6987 return _uncache(this); 6988 }; 6989 _proto2.totalDuration = function totalDuration(value) { 6990 var max = 0, self = this, child = self._last, prevStart = _bigNum, prev, start, parent; 6991 if (arguments.length) return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); 6992 if (self._dirty) { 6993 parent = self.parent; 6994 while(child){ 6995 prev = child._prev; //record it here in case the tween changes position in the sequence... 6996 child._dirty && child.totalDuration(); //could change the tween._startTime, so make sure the animation's cache is clean before analyzing it. 6997 start = child._start; 6998 if (start > prevStart && self._sort && child._ts && !self._lock) { 6999 //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence 7000 self._lock = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(). 7001 _addToTimeline(self, child, start - child._delay, 1)._lock = 0; 7002 } else prevStart = start; 7003 if (start < 0 && child._ts) { 7004 //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. 7005 max -= start; 7006 if (!parent && !self._dp || parent && parent.smoothChildTiming) { 7007 self._start += start / self._ts; 7008 self._time -= start; 7009 self._tTime -= start; 7010 } 7011 self.shiftChildren(-start, false, -Infinity); 7012 prevStart = 0; 7013 } 7014 child._end > max && child._ts && (max = child._end); 7015 child = prev; 7016 } 7017 _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); 7018 self._dirty = 0; 7019 } 7020 return self._tDur; 7021 }; 7022 Timeline.updateRoot = function updateRoot(time) { 7023 if (_globalTimeline._ts) { 7024 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 7025 _lastRenderedFrame = _ticker.frame; 7026 } 7027 if (_ticker.frame >= _nextGCFrame) { 7028 _nextGCFrame += _config.autoSleep || 120; 7029 var child = _globalTimeline._first; 7030 if (!child || !child._ts) { 7031 if (_config.autoSleep && _ticker._listeners.length < 2) { 7032 while(child && !child._ts)child = child._next; 7033 child || _ticker.sleep(); 7034 } 7035 } 7036 } 7037 }; 7038 return Timeline; 7039}(Animation); 7040_setDefaults(Timeline.prototype, { 7041 _lock: 0, 7042 _hasPause: 0, 7043 _forcing: 0 7044}); 7045var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 7046 //note: we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 7047 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), index = 0, matchIndex = 0, result, startNums, color, endNum, chunk, startNum, hasRandom, a; 7048 pt.b = start; 7049 pt.e = end; 7050 start += ""; //ensure values are strings 7051 end += ""; 7052 if (hasRandom = ~end.indexOf("random(")) end = _replaceRandom(end); 7053 if (stringFilter) { 7054 a = [ 7055 start, 7056 end 7057 ];
vendor: 5,755 bytes, lines 7058-7128
7058 stringFilter(a, target, prop); //pass an array with the starting and ending values and let the filter do whatever it needs to the values. 7059 start = a[0]; 7060 end = a[1]; 7061 } 7062 startNums = start.match(_complexStringNumExp) || []; 7063 while(result = _complexStringNumExp.exec(end)){ 7064 endNum = result[0]; 7065 chunk = end.substring(index, result.index); 7066 if (color) color = (color + 1) % 5; 7067 else if (chunk.substr(-5) === "rgba(") color = 1; 7068 if (endNum !== startNums[matchIndex++]) { 7069 startNum = parseFloat(startNums[matchIndex - 1]) || 0; //these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 7070 pt._pt = { 7071 _next: pt._pt, 7072 p: chunk || matchIndex === 1 ? chunk : ",", 7073 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 7074 s: startNum, 7075 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 7076 m: color && color < 4 ? Math.round : 0 7077 }; 7078 index = _complexStringNumExp.lastIndex; 7079 } 7080 } 7081 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 7082 pt.fp = funcParam; 7083 if (_relExp.test(end) || hasRandom) pt.e = 0; //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 7084 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 7085 return pt; 7086}, _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { 7087 _isFunction(end) && (end = end(index || 0, target, targets)); 7088 var currentValue = target[prop], parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, pt; 7089 if (_isString(end)) { 7090 if (~end.indexOf("random(")) end = _replaceRandom(end); 7091 if (end.charAt(1) === "=") { 7092 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 7093 if (pt || pt === 0) // to avoid isNaN, like if someone passes in a value like "!= whatever" 7094 end = pt; 7095 } 7096 } 7097 if (!optional || parsedStart !== end || _forceAllPropTweens) { 7098 if (!isNaN(parsedStart * end) && end !== "") { 7099 // fun fact: any number multiplied by "" is evaluated as the number 0! 7100 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 7101 funcParam && (pt.fp = funcParam); 7102 modifier && pt.modifier(modifier, this, target); 7103 return this._pt = pt; 7104 } 7105 !currentValue && !(prop in target) && _missingPlugin(prop, end); 7106 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 7107 } 7108}, //creates a copy of the vars object and processes any function-based values (putting the resulting values directly into the copy) as well as strings with "random()" in them. It does NOT process relative values. 7109_processVars = function _processVars(vars, index, target, targets, tween) { 7110 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 7111 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 7112 var copy = {}, p; 7113 for(p in vars)copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 7114 return copy; 7115}, _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 7116 var plugin, pt, ptLookup, i; 7117 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 7118 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 7119 if (tween !== _quickTween) { 7120 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; //note: we can't use tween._ptLookup[index] because for staggered tweens, the index from the fullTargets array won't match what it is in each individual tween that spawns from the stagger. 7121 i = plugin._props.length; 7122 while(i--)ptLookup[plugin._props[i]] = pt; 7123 } 7124 } 7125 return plugin; 7126}, _overwritingTween, //store a reference temporarily so we can avoid overwriting itself. 7127_forceAllPropTweens, _initTween = function _initTween(tween, time, tTime) { 7128 var vars = tween.vars, ease = vars.ease, startAt = vars.startAt, immediateRender = vars.immediateRender, lazy = vars.lazy, onUpdate = vars.onUp
vendor: 4,104 bytes, lines 7128-7171
7128date, onUpdateParams = vars.onUpdateParams, callbackScope = vars.callbackScope, runBackwards = vars.runBackwards, yoyoEase = vars.yoyoEase, keyframes = vars.keyframes, autoRevert = vars.autoRevert, dur = tween._dur, prevStartAt = tween._startAt, targets = tween._targets, parent = tween.parent, fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, tl = tween.timeline, cleanVars, i, p, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index, harnessVars, overwritten; 7129 tl && (!keyframes || !ease) && (ease = "none"); 7130 tween._ease = _parseEase(ease, _defaults.ease); 7131 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 7132 if (yoyoEase && tween._yoyo && !tween._repeat) { 7133 //there must have been a parent timeline with yoyo:true that is currently in its yoyo phase, so flip the eases. 7134 yoyoEase = tween._yEase; 7135 tween._yEase = tween._ease; 7136 tween._ease = yoyoEase; 7137 } 7138 tween._from = !tl && !!vars.runBackwards; //nested timelines should never run backwards - the backwards-ness is in the child tweens. 7139 if (!tl || keyframes && !vars.stagger) { 7140 //if there's an internal timeline, skip all the parsing because we passed that task down the chain. 7141 harness = targets[0] ? _getCache(targets[0]).harness : 0; 7142 harnessVars = harness && vars[harness.prop]; //someone may need to specify CSS-specific values AND non-CSS values, like if the element has an "x" property plus it's a standard DOM element. We allow people to distinguish by wrapping plugin-specific stuff in a css:{} object for example. 7143 cleanVars = _copyExcluding(vars, _reservedProps); 7144 if (prevStartAt) { 7145 prevStartAt._zTime < 0 && prevStartAt.progress(1); // in case it's a lazy startAt that hasn't rendered yet. 7146 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); // if it's a "startAt" (not "from()" or runBackwards: true), we only need to do a shallow revert (keep transforms cached in CSSPlugin) 7147 // don't just _removeFromParent(prevStartAt.render(-1, true)) because that'll leave inline styles. We're creating a new _startAt for "startAt" tweens that re-capture things to ensure that if the pre-tween values changed since the tween was created, they're recorded. 7148 prevStartAt._lazy = 0; 7149 } 7150 if (startAt) { 7151 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 7152 data: "isStart", 7153 overwrite: false, 7154 parent: parent, 7155 immediateRender: true, 7156 lazy: !prevStartAt && _isNotFalse(lazy), 7157 startAt: null, 7158 delay: 0, 7159 onUpdate: onUpdate, 7160 onUpdateParams: onUpdateParams, 7161 callbackScope: callbackScope, 7162 stagger: 0 7163 }, startAt))); //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, from, to).fromTo(e, to, from); 7164 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! Like when revert() is called and totalTime() gets set. 7165 tween._startAt._sat = tween; // used in globalTime(). _sat stands for _startAtTween 7166 time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); // rare edge case, like if a render is forced in the negative direction of a non-initted tween. 7167 if (immediateRender) { 7168 if (dur && time <= 0 && tTime <= 0) { 7169 // check tTime here because in the case of a yoyo tween whose playhead gets pushed to the end like tween.progress(1), we should allow it through so that the onComplete gets fired properly. 7170 time && (tween._zTime = time); 7171 return;
vendor: 15,064 bytes, lines 7171-7362
7171 //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a Timeline, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. 7172 } 7173 } 7174 } else if (runBackwards && dur) //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) 7175 { 7176 if (!prevStartAt) { 7177 time && (immediateRender = false); //in rare cases (like if a from() tween runs and then is invalidate()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0 7178 p = _setDefaults({ 7179 overwrite: false, 7180 data: "isFromStart", 7181 //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. 7182 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 7183 immediateRender: immediateRender, 7184 //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) 7185 stagger: 0, 7186 parent: parent //ensures that nested tweens that had a stagger are handled properly, like gsap.from(".class", {y:gsap.utils.wrap([-100,100])}) 7187 }, cleanVars); 7188 harnessVars && (p[harness.prop] = harnessVars); // in case someone does something like .from(..., {css:{}}) 7189 _removeFromParent(tween._startAt = Tween.set(targets, p)); 7190 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! 7191 tween._startAt._sat = tween; // used in globalTime() 7192 time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 7193 tween._zTime = time; 7194 if (!immediateRender) _initTween(tween._startAt, _tinyNum, _tinyNum); //ensures that the initial values are recorded 7195 else if (!time) return; 7196 } 7197 } 7198 tween._pt = tween._ptCache = 0; 7199 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 7200 for(i = 0; i < targets.length; i++){ 7201 target = targets[i]; 7202 gsData = target._gsap || _harness(targets)[i]._gsap; 7203 tween._ptLookup[i] = ptLookup = {}; 7204 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end) 7205 index = fullTargets === targets ? i : fullTargets.indexOf(target); 7206 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 7207 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 7208 plugin._props.forEach(function(name) { 7209 ptLookup[name] = pt; 7210 }); 7211 plugin.priority && (hasPriority = 1); 7212 } 7213 if (!harness || harnessVars) { 7214 for(p in cleanVars)if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) plugin.priority && (hasPriority = 1); 7215 else ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 7216 } 7217 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 7218 if (autoOverwrite && tween._pt) { 7219 _overwritingTween = tween; 7220 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); // make sure the overwriting doesn't overwrite THIS tween!!! 7221 overwritten = !tween.parent; 7222 _overwritingTween = 0; 7223 } 7224 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 7225 } 7226 hasPriority && _sortPropTweensByPriority(tween); 7227 tween._onInit && tween._onInit(tween); //plugins like RoundProps must wait until ALL of the PropTweens are instantiated. In the plugin's init() function, it sets the _onInit on the tween instance. May not be pretty/intuitive, but it's fast and keeps file size down. 7228 } 7229 tween._onUpdate = onUpdate; 7230 tween._initted = (!tween._op || tween._pt) && !overwritten; // if overwrittenProps resulted in the entire tween being killed, do NOT flag it as initted or else it may render for one tick. 7231 keyframes && time <= 0 && tl.render(_bigNum, true, true); // if there's a 0% keyframe, it'll render in the "before" state for any staggered/delayed animations thus when the following tween initializes, it'll use the "before" state instead of the "after" state as the initial values. 7232}, _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time) { 7233 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, rootPT, lookup, i; 7234 if (!ptCache) { 7235 ptCache = tween._ptCache[property] = []; 7236 lookup = tween._ptLookup; 7237 i = tween._targets.length; 7238 while(i--){ 7239 pt = lookup[i][property]; 7240 if (pt && pt.d && pt.d._pt) { 7241 // it's a plugin, so find the nested PropTween 7242 pt = pt.d._pt; 7243 while(pt && pt.p !== property && pt.fp !== property)// "fp" is functionParam for things like setting CSS variables which require .setProperty("--var-name", value) 7244 pt = pt._next; 7245 } 7246 if (!pt) { 7247 // there is no PropTween associated with that property, so we must FORCE one to be created and ditch out of this 7248 // if the tween has other properties that already rendered at new positions, we'd normally have to rewind to put them back like tween.render(0, true) before forcing an _initTween(), but that can create another edge case like tweening a timeline's progress would trigger onUpdates to fire which could move other things around. It's better to just inform users that .resetTo() should ONLY be used for tweens that already have that property. For example, you can't gsap.to(...{ y: 0 }) and then tween.restTo("x", 200) for example. 7249 _forceAllPropTweens = 1; // otherwise, when we _addPropTween() and it finds no change between the start and end values, it skips creating a PropTween (for efficiency...why tween when there's no difference?) but in this case we NEED that PropTween created so we can edit it. 7250 tween.vars[property] = "+=0"; 7251 _initTween(tween, time); 7252 _forceAllPropTweens = 0; 7253 return 1; 7254 } 7255 ptCache.push(pt); 7256 } 7257 } 7258 i = ptCache.length; 7259 while(i--){ 7260 rootPT = ptCache[i]; 7261 pt = rootPT._pt || rootPT; // complex values may have nested PropTweens. We only accommodate the FIRST value. 7262 pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; 7263 pt.c = value - pt.s; 7264 rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); // mainly for CSSPlugin (end value) 7265 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); // (beginning value) 7266 } 7267}, _addAliasesToVars = function _addAliasesToVars(targets, vars) { 7268 var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p, i, aliases; 7269 if (!propertyAliases) return vars; 7270 copy = _merge({}, vars); 7271 for(p in propertyAliases)if (p in copy) { 7272 aliases = propertyAliases[p].split(","); 7273 i = aliases.length; 7274 while(i--)copy[aliases[i]] = copy[p]; 7275 } 7276 return copy; 7277}, // parses multiple formats, like {"0%": {x: 100}, {"50%": {x: -20}} and { x: {"0%": 100, "50%": -20} }, and an "ease" can be set on any object. We populate an "allProps" object with an Array for each property, like {x: [{}, {}], y:[{}, {}]} with data for each property tween. The objects have a "t" (time), "v", (value), and "e" (ease) property. This allows us to piece together a timeline later. 7278_parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) { 7279 var ease = obj.ease || easeEach || "power1.inOut", p, a; 7280 if (_isArray(obj)) { 7281 a = allProps[prop] || (allProps[prop] = []); // t = time (out of 100), v = value, e = ease 7282 obj.forEach(function(value, i) { 7283 return a.push({ 7284 t: i / (obj.length - 1) * 100, 7285 v: value, 7286 e: ease 7287 }); 7288 }); 7289 } else for(p in obj){ 7290 a = allProps[p] || (allProps[p] = []); 7291 p === "ease" || a.push({ 7292 t: parseFloat(prop), 7293 v: obj[p], 7294 e: ease 7295 }); 7296 } 7297}, _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 7298 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 7299}, _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", _staggerPropsToSkip = {}; 7300_forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) { 7301 return _staggerPropsToSkip[name] = 1; 7302}); 7303var Tween = /*#__PURE__*/ function(_Animation2) { 7304 var Tween = function Tween(targets, vars, position, skipInherit) { 7305 var _this3; 7306 if (typeof vars === "number") { 7307 position.duration = vars; 7308 vars = position; 7309 position = null; 7310 } 7311 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 7312 var _this3$vars = _this3.vars, duration = _this3$vars.duration, delay = _this3$vars.delay, immediateRender = _this3$vars.immediateRender, stagger = _this3$vars.stagger, overwrite = _this3$vars.overwrite, keyframes = _this3$vars.keyframes, defaults = _this3$vars.defaults, scrollTrigger = _this3$vars.scrollTrigger, yoyoEase = _this3$vars.yoyoEase, parent = vars.parent || _globalTimeline, parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [ 7313 targets 7314 ] : toArray(targets), tl, i, copy, l, p, curTarget, staggerFunc, staggerVarsToMerge; 7315 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || []; 7316 _this3._ptLookup = []; //PropTween lookup. An array containing an object for each target, having keys for each tweening property 7317 _this3._overwrite = overwrite; 7318 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 7319 vars = _this3.vars; 7320 tl = _this3.timeline = new Timeline({ 7321 data: "nested", 7322 defaults: defaults || {}, 7323 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 7324 }); // we need to store the targets because for staggers and keyframes, we end up creating an individual tween for each but function-based values need to know the index and the whole Array of targets. 7325 tl.kill(); 7326 tl.parent = tl._dp = _assertThisInitialized(_this3); 7327 tl._start = 0; 7328 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 7329 l = parsedTargets.length; 7330 staggerFunc = stagger && distribute(stagger); 7331 if (_isObject(stagger)) { 7332 //users can pass in callbacks like onStart/onComplete in the stagger object. These should fire with each individual tween. 7333 for(p in stagger)if (~_staggerTweenProps.indexOf(p)) { 7334 staggerVarsToMerge || (staggerVarsToMerge = {}); 7335 staggerVarsToMerge[p] = stagger[p]; 7336 } 7337 } 7338 for(i = 0; i < l; i++){ 7339 copy = _copyExcluding(vars, _staggerPropsToSkip); 7340 copy.stagger = 0; 7341 yoyoEase && (copy.yoyoEase = yoyoEase); 7342 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 7343 curTarget = parsedTargets[i]; //don't just copy duration or delay because if they're a string or function, we'd end up in an infinite loop because _isFuncOrString() would evaluate as true in the child tweens, entering this loop, etc. So we parse the value straight from vars and default to 0. 7344 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 7345 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 7346 if (!stagger && l === 1 && copy.delay) { 7347 // if someone does delay:"random(1, 5)", repeat:-1, for example, the delay shouldn't be inside the repeat. 7348 _this3._delay = delay = copy.delay; 7349 _this3._start += delay; 7350 copy.delay = 0; 7351 } 7352 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); 7353 tl._ease = _easeMap.none; 7354 } 7355 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; // if the timeline's duration is 0, we don't need a timeline internally! 7356 } else if (keyframes) { 7357 _inheritDefaults(_setDefaults(tl.vars.defaults, { 7358 ease: "none" 7359 })); 7360 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 7361 var time = 0, a, kf, v; 7362 if (_isArray(keyframes)) {
vendor: 6,415 bytes, lines 7363-7458
7363 keyframes.forEach(function(frame) { 7364 return tl.to(parsedTargets, frame, ">"); 7365 }); 7366 tl.duration(); // to ensure tl._dur is cached because we tap into it for performance purposes in the render() method. 7367 } else { 7368 copy = {}; 7369 for(p in keyframes)p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); 7370 for(p in copy){ 7371 a = copy[p].sort(function(a, b) { 7372 return a.t - b.t; 7373 }); 7374 time = 0; 7375 for(i = 0; i < a.length; i++){ 7376 kf = a[i]; 7377 v = { 7378 ease: kf.e, 7379 duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration 7380 }; 7381 v[p] = kf.v; 7382 tl.to(parsedTargets, v, time); 7383 time += v.duration; 7384 } 7385 } 7386 tl.duration() < duration && tl.to({}, { 7387 duration: duration - tl.duration() 7388 }); // in case keyframes didn't go to 100% 7389 } 7390 } 7391 duration || _this3.duration(duration = tl.duration()); 7392 } else _this3.timeline = 0; //speed optimization, faster lookups (no going up the prototype chain) 7393 if (overwrite === true && !_suppressOverwrites) { 7394 _overwritingTween = _assertThisInitialized(_this3); 7395 _globalTimeline.killTweensOf(parsedTargets); 7396 _overwritingTween = 0; 7397 } 7398 _addToTimeline(parent, _assertThisInitialized(_this3), position); 7399 vars.reversed && _this3.reverse(); 7400 vars.paused && _this3.paused(true); 7401 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 7402 _this3._tTime = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) 7403 _this3.render(Math.max(0, -delay) || 0); //in case delay is negative 7404 } 7405 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 7406 return _this3; 7407 }; 7408 _inheritsLoose(Tween, _Animation2); 7409 var _proto3 = Tween.prototype; 7410 _proto3.render = function render(totalTime, suppressEvents, force) { 7411 var prevTime = this._time, tDur = this._tDur, dur = this._dur, isNegative = totalTime < 0, tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, time, pt, iteration, cycleDuration, prevIteration, isYoyo, ratio, timeline, yoyoEase; 7412 if (!dur) _renderZeroDurationTween(this, totalTime, suppressEvents, force); 7413 else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) { 7414 //this senses if we're crossing over the start time, in which case we must record _zTime and force the render, but we do it in this lengthy conditional way for performance reasons (usually we can skip the calculations): this._initted && (this._zTime < 0) !== (totalTime < 0) 7415 time = tTime; 7416 timeline = this.timeline; 7417 if (this._repeat) { 7418 //adjust the time for repeats and yoyos 7419 cycleDuration = dur + this._rDelay; 7420 if (this._repeat < -1 && isNegative) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 7421 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 7422 if (tTime === tDur) { 7423 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 7424 iteration = this._repeat; 7425 time = dur; 7426 } else { 7427 iteration = ~~(tTime / cycleDuration); 7428 if (iteration && iteration === tTime / cycleDuration) { 7429 time = dur; 7430 iteration--; 7431 } 7432 time > dur && (time = dur); 7433 } 7434 isYoyo = this._yoyo && iteration & 1; 7435 if (isYoyo) { 7436 yoyoEase = this._yEase; 7437 time = dur - time; 7438 } 7439 prevIteration = _animationCycle(this._tTime, cycleDuration); 7440 if (time === prevTime && !force && this._initted) { 7441 //could be during the repeatDelay part. No need to render and fire callbacks. 7442 this._tTime = tTime; 7443 return this; 7444 } 7445 if (iteration !== prevIteration) { 7446 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); //repeatRefresh functionality 7447 if (this.vars.repeatRefresh && !isYoyo && !this._lock) { 7448 this._lock = force = 1; //force, otherwise if lazy is true, the _attemptInitTween() will return and we'll jump out and get caught bouncing on each tick. 7449 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 7450 } 7451 } 7452 } 7453 if (!this._initted) { 7454 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 7455 this._tTime = 0; // in constructor if immediateRender is true, we set _tTime to -_tinyNum to have the playhead cross the starting point but we can't leave _tTime as a negative number. 7456 return this; 7457 } 7458 if (prevTime !== this._time) // rare edge case - during initialization, an onUpdate in the _startAt (.fromTo()) might force this tween to render at a different spot in
7458which case we should ditch this render() call so that it doesn't revert the values. 7459 return this; 7460 if (dur !== this._dur) // while initting, a plugin like InertiaPlugin might alter the duration, so rerun from the start to ensure everything renders as it should. 7461 return this.render(totalTime, suppressEvents, force); 7462 } 7463 this._tTime = tTime; 7464 this._time = time; 7465 if (!this._act && this._ts) { 7466 this._act = 1; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 7467 this._lazy = 0; 7468 } 7469 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 7470 if (this._from) this.ratio = ratio = 1 - ratio; 7471 if (time && !prevTime && !suppressEvents && !iteration) { 7472 _callback(this, "onStart"); 7473 if (this._tTime !== tTime) // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 7474 return this; 7475 } 7476 pt = this._pt; 7477 while(pt){ 7478 pt.r(ratio, pt.d); 7479 pt = pt._next; 7480 } 7481 timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 7482 if (this._onUpdate && !suppressEvents) { 7483 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. 7484 _callback(this, "onUpdate"); 7485 } 7486 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 7487 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 7488 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 7489 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if we're rendering at exactly a time of 0, as there could be autoRevert values that should get set on the next tick (if the playhead goes backward beyond the startTime, negative totalTime). Don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 7490 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 7491 // if prevTime and tTime are zero, we shouldn't fire the onReverseComplete. This could happen if you gsap.to(... {paused:true}).play(); 7492 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 7493 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 7494 } 7495 } 7496 } 7497 return this; 7498 }; 7499 _proto3.targets = function targets() { 7500 return this._targets; 7501 };
vendor: 8,710 bytes, lines 7502-7649
7502 _proto3.invalidate = function invalidate(soft) { 7503 // "soft" gives us a way to clear out everything EXCEPT the recorded pre-"from" portion of from() tweens. Otherwise, for example, if you tween.progress(1).render(0, true true).invalidate(), the "from" values would persist and then on the next render, the from() tweens would initialize and the current value would match the "from" values, thus animate from the same value to the same value (no animation). We tap into this in ScrollTrigger's refresh() where we must push a tween to completion and then back again but honor its init state in case the tween is dependent on another tween further up on the page. 7504 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 7505 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 7506 this._ptLookup = []; 7507 this.timeline && this.timeline.invalidate(soft); 7508 return _Animation2.prototype.invalidate.call(this, soft); 7509 }; 7510 _proto3.resetTo = function resetTo(property, value, start, startIsRelative) { 7511 _tickerActive || _ticker.wake(); 7512 this._ts || this.play(); 7513 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio; 7514 this._initted || _initTween(this, time); 7515 ratio = this._ease(time / this._dur); // don't just get tween.ratio because it may not have rendered yet. 7516 // possible future addition to allow an object with multiple values to update, like tween.resetTo({x: 100, y: 200}); At this point, it doesn't seem worth the added kb given the fact that most users will likely opt for the convenient gsap.quickTo() way of interacting with this method. 7517 // if (_isObject(property)) { // performance optimization 7518 // for (p in property) { 7519 // if (_updatePropTweens(this, p, property[p], value ? value[p] : null, start, ratio, time)) { 7520 // return this.resetTo(property, value, start, startIsRelative); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 7521 // } 7522 // } 7523 // } else { 7524 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time)) return this.resetTo(property, value, start, startIsRelative); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 7525 //} 7526 _alignPlayhead(this, 0); 7527 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 7528 return this.render(0); 7529 }; 7530 _proto3.kill = function kill(targets, vars) { 7531 if (vars === void 0) vars = "all"; 7532 if (!targets && (!vars || vars === "all")) { 7533 this._lazy = this._pt = 0; 7534 return this.parent ? _interrupt(this) : this; 7535 } 7536 if (this.timeline) { 7537 var tDur = this.timeline.totalDuration(); 7538 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); // if nothing is left tweening, interrupt. 7539 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); // if a nested tween is killed that changes the duration, it should affect this tween's duration. We must use the ratio, though, because sometimes the internal timeline is stretched like for keyframes where they don't all add up to whatever the parent tween's duration was set to. 7540 return this; 7541 } 7542 var parsedTargets = this._targets, killingTargets = targets ? toArray(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p, pt, i; 7543 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 7544 vars === "all" && (this._pt = 0); 7545 return _interrupt(this); 7546 } 7547 overwrittenProps = this._op = this._op || []; 7548 if (vars !== "all") { 7549 //so people can pass in a comma-delimited list of property names 7550 if (_isString(vars)) { 7551 p = {}; 7552 _forEachName(vars, function(name) { 7553 return p[name] = 1; 7554 }); 7555 vars = p; 7556 } 7557 vars = _addAliasesToVars(parsedTargets, vars); 7558 } 7559 i = parsedTargets.length; 7560 while(i--)if (~killingTargets.indexOf(parsedTargets[i])) { 7561 curLookup = propTweenLookup[i]; 7562 if (vars === "all") { 7563 overwrittenProps[i] = vars; 7564 props = curLookup; 7565 curOverwriteProps = {}; 7566 } else { 7567 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 7568 props = vars; 7569 } 7570 for(p in props){ 7571 pt = curLookup && curLookup[p]; 7572 if (pt) { 7573 if (!("kill" in pt.d) || pt.d.kill(p) === true) _removeLinkedListItem(this, pt, "_pt"); 7574 delete curLookup[p]; 7575 } 7576 if (curOverwriteProps !== "all") curOverwriteProps[p] = 1; 7577 } 7578 } 7579 this._initted && !this._pt && firstPT && _interrupt(this); //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. 7580 return this; 7581 }; 7582 Tween.to = function to(targets, vars) { 7583 return new Tween(targets, vars, arguments[2]); 7584 }; 7585 Tween.from = function from(targets, vars) { 7586 return _createTweenType(1, arguments); 7587 }; 7588 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 7589 return new Tween(callback, 0, { 7590 immediateRender: false, 7591 lazy: false, 7592 overwrite: false, 7593 delay: delay, 7594 onComplete: callback, 7595 onReverseComplete: callback, 7596 onCompleteParams: params, 7597 onReverseCompleteParams: params, 7598 callbackScope: scope 7599 }); // we must use onReverseComplete too for things like timeline.add(() => {...}) which should be triggered in BOTH directions (forward and reverse) 7600 }; 7601 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 7602 return _createTweenType(2, arguments); 7603 }; 7604 Tween.set = function set(targets, vars) { 7605 vars.duration = 0; 7606 vars.repeatDelay || (vars.repeat = 0); 7607 return new Tween(targets, vars); 7608 }; 7609 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 7610 return _globalTimeline.killTweensOf(targets, props, onlyActive); 7611 }; 7612 return Tween; 7613}(Animation); 7614_setDefaults(Tween.prototype, { 7615 _targets: [], 7616 _lazy: 0, 7617 _startAt: 0, 7618 _op: 0, 7619 _onInit: 0 7620}); //add the pertinent timeline methods to Tween instances so that users can chain conveniently and create a timeline automatically. (removed due to concerns that it'd ultimately add to more confusion especially for beginners) 7621// _forEachName("to,from,fromTo,set,call,add,addLabel,addPause", name => { 7622// Tween.prototype[name] = function() { 7623// let tl = new Timeline(); 7624// return _addToTimeline(tl, this)[name].apply(tl, toArray(arguments)); 7625// } 7626// }); 7627//for backward compatibility. Leverage the timeline calls. 7628_forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) { 7629 Tween[name] = function() { 7630 var tl = new Timeline(), params = _slice.call(arguments, 0); 7631 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 7632 return tl[name].apply(tl, params); 7633 }; 7634}); 7635/* 7636 * -------------------------------------------------------------------------------------- 7637 * PROPTWEEN 7638 * -------------------------------------------------------------------------------------- 7639 */ var _setterPlain = function _setterPlain(target, property, value) { 7640 return target[property] = value; 7641}, _setterFunc = function _setterFunc(target, property, value) { 7642 return target[property](value); 7643}, _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 7644 return target[property](data.fp, value); 7645}, _setterAttribute = function _setterAttribute(target, property, value) { 7646 return target.setAttribute(property, value); 7647}, _getSetter = function _getSetter(target, property) { 7648 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 7649}
7649, _renderPlain = function _renderPlain(ratio, data) { 7650 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); 7651}, _renderBoolean = function _renderBoolean(ratio, data) { 7652 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 7653}, _renderComplexString = function _renderComplexString(ratio, data) { 7654 var pt = data._pt, s = ""; 7655 if (!ratio && data.b) //b = beginning string 7656 s = data.b; 7657 else if (ratio === 1 && data.e) //e = ending string 7658 s = data.e; 7659 else { 7660 while(pt){ 7661 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; //we use the "p" property for the text inbetween (like a suffix). And in the context of a complex string, the modifier (m) is typically just Math.round(), like for RGB colors. 7662 pt = pt._next; 7663 } 7664 s += data.c; //we use the "c" of the PropTween to store the final chunk of non-numeric text. 7665 } 7666 data.set(data.t, data.p, s, data); 7667}, _renderPropTweens = function _renderPropTweens(ratio, data) { 7668 var pt = data._pt; 7669 while(pt){ 7670 pt.r(ratio, pt.d); 7671 pt = pt._next; 7672 } 7673}, _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 7674 var pt = this._pt, next; 7675 while(pt){ 7676 next = pt._next; 7677 pt.p === property && pt.modifier(modifier, tween, target); 7678 pt = next; 7679 } 7680}, _killPropTweensOf = function _killPropTweensOf(property) { 7681 var pt = this._pt, hasNonDependentRemaining, next; 7682 while(pt){ 7683 next = pt._next; 7684 if (pt.p === property && !pt.op || pt.op === property) _removeLinkedListItem(this, pt, "_pt"); 7685 else if (!pt.dep) hasNonDependentRemaining = 1; 7686 pt = next; 7687 } 7688 return !hasNonDependentRemaining; 7689}, _setterWithModifier = function _setterWithModifier(target, property, value, data) { 7690 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 7691}, _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 7692 var pt = parent._pt, next, pt2, first, last; //sorts the PropTween linked list in order of priority because some plugins need to do their work after ALL of the PropTweens were created (like RoundPropsPlugin and ModifiersPlugin) 7693 while(pt){ 7694 next = pt._next; 7695 pt2 = first; 7696 while(pt2 && pt2.pr > pt.pr)pt2 = pt2._next; 7697 if (pt._prev = pt2 ? pt2._prev : last) pt._prev._next = pt; 7698 else first = pt; 7699 if (pt._next = pt2) pt2._prev = pt; 7700 else last = pt; 7701 pt = next; 7702 } 7703 parent._pt = first; 7704}; //PropTween key: t = target, p = prop, r = renderer, d = data, s = start, c = change, op = overwriteProperty (ONLY populated when it's different than p), pr = priority, _next/_prev for the linked list siblings, set = setter, m = modifier, mSet = modifierSetter (the original setter, before a modifier was added) 7705var PropTween = /*#__PURE__*/ function() { 7706 var PropTween = function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 7707 this.t = target; 7708 this.s = start; 7709 this.c = change; 7710 this.p = prop; 7711 this.r = renderer || _renderPlain; 7712 this.d = data || this; 7713 this.set = setter || _setterPlain; 7714 this.pr = priority || 0; 7715 this._next = next; 7716 if (next) next._prev = this; 7717 }; 7718 var _proto4 = PropTween.prototype; 7719 _proto4.modifier = function modifier(func, tween, target) { 7720 this.mSet = this.mSet || this.set; //in case it was already set (a PropTween can only have one modifier) 7721 this.set = _setterWithModifier; 7722 this.m = func; 7723 this.mt = target; //modifier target 7724 this.tween = tween; 7725 }; 7726 return PropTween; 7727}(); //Initialization tasks 7728_forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function(name) { 7729 return _reservedProps[name] = 1; 7730}); 7731_globals.TweenMax = _globals.TweenLite = Tween; 7732_globals.TimelineLite = _globals.TimelineMax = Timeline; 7733_globalTimeline = new Timeline({ 7734 sortChildren: false, 7735 defaults: _defaults, 7736 autoRemoveChildren: true, 7737 id: "root", 7738 smoothChildTiming: true 7739}); 7740_config.stringFilter = _colorStringFilter; 7741var _media = [], _listeners = {}, _emptyArray = [], _lastMediaTime = 0, _dispatch = function _dispatch(type) { 7742 return (_listeners[type] || _emptyArray).map(function(f) { 7743 return f(); 7744 }); 7745}, _onMediaChange = function _onMediaChange() { 7746 var time = Date.now(), matches = []; 7747 if (time - _lastMediaTime > 2) { 7748 _dispatch("matchMediaInit");
vendor: 4,066 bytes, lines 7749-7843
7749 _media.forEach(function(c) { 7750 var queries = c.queries, conditions = c.conditions, match, p, anyMatch, toggled; 7751 for(p in queries){ 7752 match = _win.matchMedia(queries[p]).matches; // Firefox doesn't update the "matches" property of the MediaQueryList object correctly - it only does so as it calls its change handler - so we must re-create a media query here to ensure it's accurate. 7753 match && (anyMatch = 1); 7754 if (match !== conditions[p]) { 7755 conditions[p] = match; 7756 toggled = 1; 7757 } 7758 } 7759 if (toggled) { 7760 c.revert(); 7761 anyMatch && matches.push(c); 7762 } 7763 }); 7764 _dispatch("matchMediaRevert"); 7765 matches.forEach(function(c) { 7766 return c.onMatch(c); 7767 }); 7768 _lastMediaTime = time; 7769 _dispatch("matchMedia"); 7770 } 7771}; 7772var Context = /*#__PURE__*/ function() { 7773 var Context = function Context(func, scope) { 7774 this.selector = scope && selector(scope); 7775 this.data = []; 7776 this._r = []; // returned/cleanup functions 7777 this.isReverted = false; 7778 func && this.add(func); 7779 }; 7780 var _proto5 = Context.prototype; 7781 _proto5.add = function add(name, func, scope) { 7782 // possible future addition if we need the ability to add() an animation to a context and for whatever reason cannot create that animation inside of a context.add(() => {...}) function. 7783 // if (name && _isFunction(name.revert)) { 7784 // this.data.push(name); 7785 // return (name._ctx = this); 7786 // } 7787 if (_isFunction(name)) { 7788 scope = func; 7789 func = name; 7790 name = _isFunction; 7791 } 7792 var self = this, f = function f() { 7793 var prev = _context, prevSelector = self.selector, result; 7794 prev && prev !== self && prev.data.push(self); 7795 scope && (self.selector = selector(scope)); 7796 _context = self; 7797 result = func.apply(self, arguments); 7798 _isFunction(result) && self._r.push(result); 7799 _context = prev; 7800 self.selector = prevSelector; 7801 self.isReverted = false; 7802 return result; 7803 }; 7804 self.last = f; 7805 return name === _isFunction ? f(self) : name ? self[name] = f : f; 7806 }; 7807 _proto5.ignore = function ignore(func) { 7808 var prev = _context; 7809 _context = null; 7810 func(this); 7811 _context = prev; 7812 }; 7813 _proto5.getTweens = function getTweens() { 7814 var a = []; 7815 this.data.forEach(function(e) { 7816 return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); 7817 }); 7818 return a; 7819 }; 7820 _proto5.clear = function clear() { 7821 this._r.length = this.data.length = 0; 7822 }; 7823 _proto5.kill = function kill(revert, matchMedia) { 7824 var _this4 = this; 7825 if (revert) { 7826 var tweens = this.getTweens(); 7827 this.data.forEach(function(t) { 7828 // Flip plugin tweens are very different in that they should actually be pushed to their end. The plugin replaces the timeline's .revert() method to do exactly that. But we also need to remove any of those nested tweens inside the flip timeline so that they don't get individually reverted. 7829 if (t.data === "isFlip") { 7830 t.revert(); 7831 t.getChildren(true, true, false).forEach(function(tween) { 7832 return tweens.splice(tweens.indexOf(tween), 1); 7833 }); 7834 } 7835 }); // save as an object so that we can cache the globalTime for each tween to optimize performance during the sort 7836 tweens.map(function(t) { 7837 return { 7838 g: t.globalTime(0), 7839 t: t 7840 }; 7841 }).sort(function(a, b) { 7842 return b.g - a.g || -1; 7843 }
7843).forEach(function(o) { 7844 return o.t.revert(revert); 7845 }); // note: all of the _startAt tweens should be reverted in reverse order that they were created, and they'll all have the same globalTime (-1) so the " || -1" in the sort keeps the order properly. 7846 this.data.forEach(function(e) { 7847 return !(e instanceof Animation) && e.revert && e.revert(revert); 7848 }); 7849 this._r.forEach(function(f) { 7850 return f(revert, _this4); 7851 }); 7852 this.isReverted = true; 7853 } else this.data.forEach(function(e) { 7854 return e.kill && e.kill(); 7855 }); 7856 this.clear(); 7857 if (matchMedia) { 7858 var i = _media.indexOf(this); 7859 !!~i && _media.splice(i, 1); 7860 } 7861 }; 7862 _proto5.revert = function revert(config) { 7863 this.kill(config || {}); 7864 }; 7865 return Context; 7866}(); 7867var MatchMedia = /*#__PURE__*/ function() { 7868 var MatchMedia = function MatchMedia(scope) { 7869 this.contexts = []; 7870 this.scope = scope; 7871 }; 7872 var _proto6 = MatchMedia.prototype; 7873 _proto6.add = function add(conditions, func, scope) { 7874 _isObject(conditions) || (conditions = { 7875 matches: conditions 7876 }); 7877 var context = new Context(0, scope || this.scope), cond = context.conditions = {}, mq, p, active; 7878 this.contexts.push(context); 7879 func = context.add("onMatch", func); 7880 context.queries = conditions; 7881 for(p in conditions)if (p === "all") active = 1; 7882 else { 7883 mq = _win.matchMedia(conditions[p]); 7884 if (mq) { 7885 _media.indexOf(context) < 0 && _media.push(context); 7886 (cond[p] = mq.matches) && (active = 1); 7887 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 7888 } 7889 } 7890 active && func(context); 7891 return this; 7892 } // refresh() { 7893 ; 7894 _proto6.revert = function revert(config) { 7895 this.kill(config || {}); 7896 }; 7897 _proto6.kill = function kill(revert) {
vendor: 12,799 bytes, lines 7898-8193
7898 this.contexts.forEach(function(c) { 7899 return c.kill(revert, true); 7900 }); 7901 }; 7902 return MatchMedia; 7903}(); 7904/* 7905 * -------------------------------------------------------------------------------------- 7906 * GSAP 7907 * -------------------------------------------------------------------------------------- 7908 */ var _gsap = { 7909 registerPlugin: function registerPlugin() { 7910 for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; 7911 args.forEach(function(config) { 7912 return _createPlugin(config); 7913 }); 7914 }, 7915 timeline: function timeline(vars) { 7916 return new Timeline(vars); 7917 }, 7918 getTweensOf: function getTweensOf(targets, onlyActive) { 7919 return _globalTimeline.getTweensOf(targets, onlyActive); 7920 }, 7921 getProperty: function getProperty(target, property, unit, uncache) { 7922 _isString(target) && (target = toArray(target)[0]); //in case selector text or an array is passed in 7923 var getter = _getCache(target || {}).get, format = unit ? _passThrough : _numericIfPossible; 7924 unit === "native" && (unit = ""); 7925 return !target ? target : !property ? function(property, unit, uncache) { 7926 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 7927 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 7928 }, 7929 quickSetter: function quickSetter(target, property, unit) { 7930 target = toArray(target); 7931 if (target.length > 1) { 7932 var setters = target.map(function(t) { 7933 return gsap.quickSetter(t, property, unit); 7934 }), l = setters.length; 7935 return function(value) { 7936 var i = l; 7937 while(i--)setters[i](value); 7938 }; 7939 } 7940 target = target[0] || {}; 7941 var Plugin = _plugins[property], cache = _getCache(target), p = cache.harness && (cache.harness.aliases || {})[property] || property, // in case it's an alias, like "rotate" for "rotation". 7942 setter = Plugin ? function setter(value) { 7943 var p = new Plugin(); 7944 _quickTween._pt = 0; 7945 p.init(target, unit ? value + unit : value, _quickTween, 0, [ 7946 target 7947 ]); 7948 p.render(1, p); 7949 _quickTween._pt && _renderPropTweens(1, _quickTween); 7950 } : cache.set(target, p); 7951 return Plugin ? setter : function(value) { 7952 return setter(target, p, unit ? value + unit : value, cache, 1); 7953 }; 7954 }, 7955 quickTo: function quickTo(target, property, vars) { 7956 var _merge2; 7957 var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})), func = function func(value, start, startIsRelative) { 7958 return tween.resetTo(property, value, start, startIsRelative); 7959 }; 7960 func.tween = tween; 7961 return func; 7962 }, 7963 isTweening: function isTweening(targets) { 7964 return _globalTimeline.getTweensOf(targets, true).length > 0; 7965 }, 7966 defaults: function defaults(value) { 7967 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 7968 return _mergeDeep(_defaults, value || {}); 7969 }, 7970 config: function config(value) { 7971 return _mergeDeep(_config, value || {}); 7972 }, 7973 registerEffect: function registerEffect(_ref3) { 7974 var name = _ref3.name, effect = _ref3.effect, plugins = _ref3.plugins, defaults = _ref3.defaults, extendTimeline = _ref3.extendTimeline; 7975 (plugins || "").split(",").forEach(function(pluginName) { 7976 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 7977 }); 7978 _effects[name] = function(targets, vars, tl) { 7979 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 7980 }; 7981 if (extendTimeline) Timeline.prototype[name] = function(targets, vars, position) { 7982 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 7983 }; 7984 }, 7985 registerEase: function registerEase(name, ease) { 7986 _easeMap[name] = _parseEase(ease); 7987 }, 7988 parseEase: function parseEase(ease, defaultEase) { 7989 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 7990 }, 7991 getById: function getById(id) { 7992 return _globalTimeline.getById(id); 7993 }, 7994 exportRoot: function exportRoot(vars, includeDelayedCalls) { 7995 if (vars === void 0) vars = {}; 7996 var tl = new Timeline(vars), child, next; 7997 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 7998 _globalTimeline.remove(tl); 7999 tl._dp = 0; //otherwise it'll get re-activated when adding children and be re-introduced into _globalTimeline's linked list (then added to itself). 8000 tl._time = tl._tTime = _globalTimeline._time; 8001 child = _globalTimeline._first; 8002 while(child){ 8003 next = child._next; 8004 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) _addToTimeline(tl, child, child._start - child._delay); 8005 child = next; 8006 } 8007 _addToTimeline(_globalTimeline, tl, 0); 8008 return tl; 8009 }, 8010 context: function context(func, scope) { 8011 return func ? new Context(func, scope) : _context; 8012 }, 8013 matchMedia: function matchMedia(scope) { 8014 return new MatchMedia(scope); 8015 }, 8016 matchMediaRefresh: function matchMediaRefresh() { 8017 return _media.forEach(function(c) { 8018 var cond = c.conditions, found, p; 8019 for(p in cond)if (cond[p]) { 8020 cond[p] = false; 8021 found = 1; 8022 } 8023 found && c.revert(); 8024 }) || _onMediaChange(); 8025 }, 8026 addEventListener: function addEventListener(type, callback) { 8027 var a = _listeners[type] || (_listeners[type] = []); 8028 ~a.indexOf(callback) || a.push(callback); 8029 }, 8030 removeEventListener: function removeEventListener(type, callback) { 8031 var a = _listeners[type], i = a && a.indexOf(callback); 8032 i >= 0 && a.splice(i, 1); 8033 }, 8034 utils: { 8035 wrap: wrap, 8036 wrapYoyo: wrapYoyo, 8037 distribute: distribute, 8038 random: random, 8039 snap: snap, 8040 normalize: normalize, 8041 getUnit: getUnit, 8042 clamp: clamp, 8043 splitColor: splitColor, 8044 toArray: toArray, 8045 selector: selector, 8046 mapRange: mapRange, 8047 pipe: pipe, 8048 unitize: unitize, 8049 interpolate: interpolate, 8050 shuffle: shuffle 8051 }, 8052 install: _install, 8053 effects: _effects, 8054 ticker: _ticker, 8055 updateRoot: Timeline.updateRoot, 8056 plugins: _plugins, 8057 globalTimeline: _globalTimeline, 8058 core: { 8059 PropTween: PropTween, 8060 globals: _addGlobal, 8061 Tween: Tween, 8062 Timeline: Timeline, 8063 Animation: Animation, 8064 getCache: _getCache, 8065 _removeLinkedListItem: _removeLinkedListItem, 8066 reverting: function reverting() { 8067 return _reverting; 8068 }, 8069 context: function context(toAdd) { 8070 if (toAdd && _context) { 8071 _context.data.push(toAdd); 8072 toAdd._ctx = _context; 8073 } 8074 return _context; 8075 }, 8076 suppressOverwrites: function suppressOverwrites(value) { 8077 return _suppressOverwrites = value; 8078 } 8079 } 8080}; 8081_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) { 8082 return _gsap[name] = Tween[name]; 8083}); 8084_ticker.add(Timeline.updateRoot); 8085_quickTween = _gsap.to({}, { 8086 duration: 0 8087}); // ---- EXTRA PLUGINS -------------------------------------------------------- 8088var _getPluginPropTween = function _getPluginPropTween(plugin, prop) { 8089 var pt = plugin._pt; 8090 while(pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop)pt = pt._next; 8091 return pt; 8092}, _addModifiers = function _addModifiers(tween, modifiers) { 8093 var targets = tween._targets, p, i, pt; 8094 for(p in modifiers){ 8095 i = targets.length; 8096 while(i--){ 8097 pt = tween._ptLookup[i][p]; 8098 if (pt && (pt = pt.d)) { 8099 if (pt._pt) // is a plugin 8100 pt = _getPluginPropTween(pt, p); 8101 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 8102 } 8103 } 8104 } 8105}, _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 8106 return { 8107 name: name, 8108 rawVars: 1, 8109 //don't pre-process function-based values or "random()" strings. 8110 init: function init(target, vars, tween) { 8111 tween._onInit = function(tween) { 8112 var temp, p; 8113 if (_isString(vars)) { 8114 temp = {}; 8115 _forEachName(vars, function(name) { 8116 return temp[name] = 1; 8117 }); //if the user passes in a comma-delimited list of property names to roundProps, like "x,y", we round to whole numbers. 8118 vars = temp; 8119 } 8120 if (modifier) { 8121 temp = {}; 8122 for(p in vars)temp[p] = modifier(vars[p]); 8123 vars = temp; 8124 } 8125 _addModifiers(tween, vars); 8126 }; 8127 } 8128 }; 8129}; //register core plugins 8130var gsap = _gsap.registerPlugin({ 8131 name: "attr", 8132 init: function init(target, vars, tween, index, targets) { 8133 var p, pt, v; 8134 this.tween = tween; 8135 for(p in vars){ 8136 v = target.getAttribute(p) || ""; 8137 pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); 8138 pt.op = p; 8139 pt.b = v; // record the beginning value so we can revert() 8140 this._props.push(p); 8141 } 8142 }, 8143 render: function render(ratio, data) { 8144 var pt = data._pt; 8145 while(pt){ 8146 _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); // if reverting, go back to the original (pt.b) 8147 pt = pt._next; 8148 } 8149 } 8150}, { 8151 name: "endArray", 8152 init: function init(target, value) { 8153 var i = value.length; 8154 while(i--)this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); 8155 } 8156}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; //to prevent the core plugins from being dropped via aggressive tree shaking, we must include them in the variable declaration in this way. 8157Tween.version = Timeline.version = gsap.version = "3.11.5"; 8158_coreReady = 1; 8159_windowExists() && _wake(); 8160var Power0 = _easeMap.Power0, Power1 = _easeMap.Power1, Power2 = _easeMap.Power2, Power3 = _easeMap.Power3, Power4 = _easeMap.Power4, Linear = _easeMap.Linear, Quad = _easeMap.Quad, Cubic = _easeMap.Cubic, Quart = _easeMap.Quart, Quint = _easeMap.Quint, Strong = _easeMap.Strong, Elastic = _easeMap.Elastic, Back = _easeMap.Back, SteppedEase = _easeMap.SteppedEase, Bounce = _easeMap.Bounce, Sine = _easeMap.Sine, Expo = _easeMap.Expo, Circ = _easeMap.Circ; 8161 8162},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"cJqgy":[function(require,module,exports) { 8163/*! 8164 * CSSPlugin 3.11.5 8165 * https://greensock.com 8166 * 8167 * Copyright 2008-2023, GreenSock. All rights reserved. 8168 * Subject to the terms at https://greensock.com/standard-license or for 8169 * Club GreenSock members, the agreement issued with that membership. 8170 * @author: Jack Doyle, [email protected] 8171*/ /* eslint-disable */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 8172parcelHelpers.defineInteropFlag(exports); 8173parcelHelpers.export(exports, "CSSPlugin", function() { 8174 return CSSPlugin; 8175}); 8176parcelHelpers.export(exports, "default", function() { 8177 return CSSPlugin; 8178}); 8179parcelHelpers.export(exports, "_getBBox", function() { 8180 return _getBBox; 8181}); 8182parcelHelpers.export(exports, "_createElement", function() { 8183 return _createElement; 8184}); 8185parcelHelpers.export(exports, "checkPrefix", function() { 8186 return _checkPropPrefix; 8187}); 8188var _typeOfMjs = require("@swc/helpers/src/_type_of.mjs"); 8189var _typeOfMjsDefault = parcelHelpers.interopDefault(_typeOfMjs); 8190var _gsapCoreJs = require("./gsap-core.js"); 8191var _win, _doc, _docElement, _pluginInitted, _tempDiv, _tempDivStyler, _recentSetterPlugin, _reverting, _windowExists = function _windowExists() { 8192 return typeof window !== "undefined"; 8193}, _transformProps = {}, _RAD2DEG = 180 / Math.PI, _DEG2RAD = Math.PI / 180, _atan2 = Math.atan2, _bigNum = 1e8, _capsExp = /([A-Z])/g, _horizontalExp = /(left|right|width|margin|padding|x)/i, _complexExp = /[\
8193s,\(]\S/, _propertyAliases = { 8194 autoAlpha: "opacity,visibility", 8195 scale: "scaleX,scaleY", 8196 alpha: "opacity" 8197}, _renderCSSProp = function _renderCSSProp(ratio, data) { 8198 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 8199}, _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 8200 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 8201}, _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 8202 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); 8203}, //if units change, we need a way to render the original unit/value when the tween goes all the way back to the beginning (ratio:0) 8204_renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 8205 var value = data.s + data.c * ratio; 8206 data.set(data.t, data.p, ~~(value + (value < 0 ? -0.5 : .5)) + data.u, data); 8207}, _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 8208 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 8209}, _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 8210 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 8211}, _setterCSSStyle = function _setterCSSStyle(target, property, value) { 8212 return target.style[property] = value; 8213}, _setterCSSProp = function _setterCSSProp(target, property, value) { 8214 return target.style.setProperty(property, value); 8215}, _setterTransform = function _setterTransform(target, property, value) { 8216 return target._gsap[property] = value; 8217}, _setterScale = function _setterScale(target, property, value) { 8218 return target._gsap.scaleX = target._gsap.scaleY = value; 8219}, _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 8220 var cache = target._gsap; 8221 cache.scaleX = cache.scaleY = value; 8222 cache.renderTransform(ratio, cache); 8223}, _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 8224 var cache = target._gsap; 8225 cache[property] = value; 8226 cache.renderTransform(ratio, cache); 8227}, _transformProp = "transform", _transformOriginProp = _transformProp + "Origin", _saveStyle = function _saveStyle(property, isNotCSS) { 8228 var _this = this; 8229 var target = this.target, style = target.style; 8230 if (property in _transformProps) { 8231 this.tfm = this.tfm || {}; 8232 if (property !== "transform") { 8233 property = _propertyAliases[property] || property; 8234 ~property.indexOf(",") ? property.split(",").forEach(function(a) { 8235 return _this.tfm[a] = _get(target, a); 8236 }) : this.tfm[property] = target._gsap.x ? target._gsap[property] : _get(target, property); // note: scale would map to "scaleX,scaleY", thus we loop and apply them both. 8237 } else return _propertyAliases.transform.split(",").forEach(function(p) { 8238 return _saveStyle.call(_this, p, isNotCSS); 8239 }); 8240 if (this.props.indexOf(_transformProp) >= 0) return; 8241 if (target._gsap.svg) { 8242 this.svgo = target.getAttribute("data-svg-origin"); 8243 this.props.push(_transformOriginProp, isNotCSS, ""); 8244 } 8245 property = _transformProp; 8246 } 8247 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 8248}, _removeIndependentTransforms = function _removeIndependentTransforms(style) { 8249 if (style.translate) { 8250 style.removeProperty("translate"); 8251 style.removeProperty("scale"); 8252 style.removeProperty("rotate"); 8253 } 8254}, _revertStyle = function _revertStyle() { 8255 var props = this.props, target = this.target, style = target.style, cache = target._gsap, i, p; 8256 for(i = 0; i < props.length; i += 3)// stored like this: property, isNotCSS, value 8257 props[i + 1] ? target[props[i]] = props[i + 2] : props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase()); 8258 if (this.tfm) { 8259 for(p in this.tfm)cache[p] = this.tfm[p]; 8260 if (cache.svg) { 8261 cache.renderTransform(); 8262 target.setAttribute("data-svg-origin", this.svgo || ""); 8263 } 8264 i = _reverting(); 8265 if ((!i || !i.isStart) && !style[_transformProp]) { 8266 _removeIndependentTransforms(style); 8267 cache.uncache = 1; // if it's a startAt that's being reverted in the _initTween() of the core, we don't need to uncache transforms. This is purely a performance optimization. 8268 } 8269 } 8270}, _getStyleSaver = function _getStyleSaver(target, properties) { 8271 var saver = { 8272 target: target, 8273 props: [], 8274 revert: _revertStyle, 8275 save: _saveStyle 8276 }; 8277 target._gsap || (0, _gsapCoreJs.gsap).core.getCache(target); // just make sure there's a _gsap cache defined because we read from it in _saveStyle() and it's more efficient to just check it here once. 8278 properties && properties.split(",").forEach(function(p) { 8279 return saver.save(p); 8280 }); 8281 return saver; 8282}, _supports3D, _createElement = function _createElement(type, ns) { 8283 var e = _doc.createElementNS ? _doc.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc.createElement(type); //some servers swap in https for http in the namespace which can break things, making "style" inaccessible. 8284 return e.style ? e : _doc.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://greensock.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/). 8285}, _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 8286 var cs = getComputedStyle(target); 8287 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; //css variables may not need caps swapped out for dashes and lowercase. 8288}, _prefixes = "O,Moz,ms,Ms,Webkit".split(","), _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 8289 var e = element || _tempDiv, s = e.style, i = 5; 8290 if (property in s && !preferPrefix) return property; 8291 property = property.charAt(0).toUpperCase() + property.substr(1); 8292 while(i-- && !(_prefixes[i] + property in s)); 8293 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 8294}, _initCore = function _initCore() { 8295 if (_windowExists() && window.document) { 8296 _win = window; 8297 _doc = _win.document; 8298 _docElement = _doc.documentElement; 8299 _tempDiv = _createElement("div") || { 8300 style: {} 8301 }; 8302 _tempDivStyler = _createElement("div"); 8303 _transformProp = _checkPropPrefix(_transformProp); 8304 _transformOriginProp = _transformProp + "Origin"; 8305 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; //make sure to override certain properties that may contaminate measurements, in case the user has overreaching style sheets. 8306 _supports3D = !!_checkPropPrefix("perspective"); 8307 _reverting = (0, _gsapCoreJs.gsap).core.reverting; 8308 _pluginInitted = 1; 8309 } 8310}, _getBBoxHack = function _getBBoxHack(swapIfPossible) { 8311 //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a <defs> element and/or <mask>. We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). 8312 var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), oldParent = this.parentNode, oldSibling = this.nextSibling, oldCSS = this.style.cssText, bbox; 8313 _docElement.appendChild(svg); 8314 svg.appendChild(this); 8315 this.style.display = "block"; 8316 if (swapIfPossible) try { 8317 bbox = this.getBBox(); 8318 this._gsapBBox = this.getBBox; //store the original 8319 this.getBBox = _getBBoxHack; 8320 } catch (e) {} 8321 else if (this._gsapBBox) bbox = this._gsapBBox(); 8322 if (oldParent) { 8323 if (oldSibling) oldParent.insertBefore(this, oldSibling); 8324 else oldParent.appendChild(this); 8325 } 8326 _docElement.removeChild(svg); 8327 this.style.cssText = oldCSS; 8328 return bbox; 8329}, _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 8330 var i = attributesArray.length; 8331 while(i--){ 8332 if (target.hasAttribute(attributesArray[i])) return target.getAttribute(attributesArray[i]); 8333 } 8334}, _getBBox = function _getBBox(target) { 8335 var bounds; 8336 try { 8337 bounds = target.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a <symbol> or <defs>). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 8338 } catch (error) { 8339 bounds = _getBBoxHack.call(target, true); 8340 } 8341 bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. 8342 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 8343 x: +_getAttributeFallbacks(target, [ 8344 "x", 8345 "cx", 8346 "x1" 8347 ]) || 0, 8348 y: +_getAttributeFallbacks(target, [ 8349 "y", 8350 "cy", 8351 "y1" 8352 ]) || 0, 8353 width: 0, 8354 height: 0 8355 } : bounds; 8356}, _isSVG = function _isSVG(e) { 8357 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 8358}, //reports if the element is an SVG on which getBBox() actually works 8359_removeProperty = function _removeProperty(target, property) { 8360 if (property) { 8361 var style = target.style; 8362 if (property in _transformProps && property !== _transformOriginProp) property = _transformProp; 8363 if (style.removeProperty) { 8364 if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) 8365 property = "-" + property; 8366 style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase()); 8367 } else //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" 8368 style.removeAttribute(property); 8369 } 8370}, _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 8371 var pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 8372 plugin._pt = pt; 8373 pt.b = beginning; 8374 pt.e = end; 8375 plugin._props.push(property); 8376 return pt; 8377}, _nonConvertibleUnits = { 8378 deg: 1, 8379 rad: 1, 8380 turn: 1 8381}, _nonStandardLayouts = { 8382 grid: 1, 8383 flex: 1 8384}, //takes a single value like 20px and converts it to the unit specified, like "%", returning only the numeric amount. 8385_convertToUnit = function _convertToUnit(target, property, value, unit) { 8386 var curValue = parseFloat(value) || 0, curUnit = (value + "").trim().substr((curValue + "").length) || "px", // some browsers leave extra whitespace at the beginning of CSS variables, hence the need to trim() 8387 style = _tempDiv.style, horizontal = _horizontalExp.test(property), isRootSVG = target.tagName.toLowerCase() === "svg", measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), amount = 100, toPixels = unit === "px", toPercent = unit === "%", px, parent, cache, isSVG; 8388 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) return curValue; 8389 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 8390 isSVG = target.getCTM && _isSVG(target); 8391 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 8392 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 8393 return (0, _gsapCoreJs._round)(toPercent ? curValue / px * amount : curValue / 100 * px); 8394 } 8395 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 8396 parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 8397 if (isSVG) parent = (target.ownerSVGElement || {}).parentNode; 8398 if (!parent || parent === _doc || !parent.appendChild) parent = _doc.body; 8399 cache = parent._gsap; 8400 if (cache && toPercent && cache.width && horizontal && cache.time === (0, _gsapCoreJs._ticker).time && !cache.uncache) return (0, _gsapCoreJs._round)(curValue / cache.width * amount); 8401 else { 8402 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 8403 parent === target && (style.position = "static"); // like for borderRadius, if it's a % we must have it relative to the target itself but that may not have position: relative or position: absolute in
8403which case it'd go up the chain until it finds its offsetParent (bad). position: static protects against that. 8404 parent.appendChild(_tempDiv); 8405 px = _tempDiv[measureProperty]; 8406 parent.removeChild(_tempDiv); 8407 style.position = "absolute"; 8408 if (horizontal && toPercent) { 8409 cache = (0, _gsapCoreJs._getCache)(parent); 8410 cache.time = (0, _gsapCoreJs._ticker).time; 8411 cache.width = parent[measureProperty]; 8412 } 8413 } 8414 return (0, _gsapCoreJs._round)(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 8415}, _get = function _get(target, property, unit, uncache) { 8416 var value; 8417 _pluginInitted || _initCore(); 8418 if (property in _propertyAliases && property !== "transform") { 8419 property = _propertyAliases[property]; 8420 if (~property.indexOf(",")) property = property.split(",")[0]; 8421 } 8422 if (_transformProps[property] && property !== "transform") { 8423 value = _parseTransform(target, uncache); 8424 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 8425 } else { 8426 value = target.style[property]; 8427 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || (0, _gsapCoreJs._getProperty)(target, property) || (property === "opacity" ? 1 : 0); // note: some browsers, like Firefox, don't report borderRadius correctly! Instead, it only reports every corner like borderTopLeftRadius 8428 } 8429 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 8430}, _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 8431 // note: we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 8432 if (!start || start === "none") { 8433 // some browsers like Safari actually PREFER the prefixed property and mis-report the unprefixed value like clipPath (BUG). In other words, even though clipPath exists in the style ("clipPath" in target.style) and it's set in the CSS properly (along with -webkit-clip-path), Safari reports clipPath as "none" whereas WebkitClipPath reports accurately like "ellipse(100% 0% at 50% 0%)", so in this case we must SWITCH to using the prefixed property instead. See https://greensock.com/forums/topic/18310-clippath-doesnt-work-on-ios/ 8434 var p = _checkPropPrefix(prop, target, 1), s = p && _getComputedProperty(target, p, 1); 8435 if (s && s !== start) { 8436 prop = p; 8437 start = s; 8438 } else if (prop === "borderColor") start = _getComputedProperty(target, "borderTopColor"); // Firefox bug: always reports "borderColor" as "", so we must fall back to borderTopColor. See https://greensock.com/forums/topic/24583-how-to-return-colors-that-i-had-after-reverse/ 8439 } 8440 var pt = new (0, _gsapCoreJs.PropTween)(this._pt, target.style, prop, 0, 1, (0, _gsapCoreJs._renderComplexString)), index = 0, matchIndex = 0, a, result, startValues, startNum, color, startValue, endValue, endNum, chunk, endUnit, startUnit, endValues; 8441 pt.b = start; 8442 pt.e = end; 8443 start += ""; // ensure values are strings 8444 end += ""; 8445 if (end === "auto") { 8446 target.style[prop] = end; 8447 end = _getComputedProperty(target, prop) || end; 8448 target.style[prop] = start; 8449 } 8450 a = [ 8451 start, 8452 end 8453 ]; 8454 (0, _gsapCoreJs._colorStringFilter)(a); // pass an array with the starting and ending values and let the filter do whatever it needs to the values. If colors are found, it returns true and then we must match where the color shows up order-wise because for things like boxShadow, sometimes the browser provides the computed values with the color FIRST, but the user provides it with the color LAST, so flip them if necessary. Same for drop-shadow(). 8455 start = a[0]; 8456 end = a[1]; 8457 startValues = start.match((0, _gsapCoreJs._numWithUnitExp)) || []; 8458 endValues = end.match((0, _gsapCoreJs._numWithUnitExp)) || []; 8459 if (endValues.length) { 8460 while(result = (0, _gsapCoreJs._numWithUnitExp).exec(end)){ 8461 endValue = result[0]; 8462 chunk = end.substring(index, result.index); 8463 if (color) color = (color + 1) % 5; 8464 else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") color = 1; 8465 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 8466 startNum = parseFloat(startValue) || 0; 8467 startUnit = startValue.substr((startNum + "").length); 8468 endValue.charAt(1) === "=" && (endValue = (0, _gsapCoreJs._parseRelative)(startNum, endValue) + startUnit); 8469 endNum = parseFloat(endValue); 8470 endUnit = endValue.substr((endNum + "").length); 8471 index = (0, _gsapCoreJs._numWithUnitExp).lastIndex - endUnit.length; 8472 if (!endUnit) { 8473 //if something like "perspective:300" is passed in and we must add a unit to the end 8474 endUnit = endUnit || (0, _gsapCoreJs._config).units[prop] || startUnit; 8475 if (index === end.length) { 8476 end += endUnit; 8477 pt.e += endUnit; 8478 } 8479 } 8480 if (startUnit !== endUnit) startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 8481 // these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 8482 pt._pt = { 8483 _next: pt._pt, 8484 p: chunk || matchIndex === 1 ? chunk : ",",
vendor: 15,436 bytes, lines 8485-8743
8485 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 8486 s: startNum, 8487 c: endNum - startNum, 8488 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 8489 }; 8490 } 8491 } 8492 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 8493 } else pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 8494 (0, _gsapCoreJs._relExp).test(end) && (pt.e = 0); //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 8495 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within another plugin too, thus "this" would refer to the plugin. 8496 return pt; 8497}, _keywordToPercent = { 8498 top: "0%", 8499 bottom: "100%", 8500 left: "0%", 8501 right: "100%", 8502 center: "50%" 8503}, _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 8504 var split = value.split(" "), x = split[0], y = split[1] || "50%"; 8505 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 8506 //the user provided them in the wrong order, so flip them 8507 value = x; 8508 x = y; 8509 y = value; 8510 } 8511 split[0] = _keywordToPercent[x] || x; 8512 split[1] = _keywordToPercent[y] || y; 8513 return split.join(" "); 8514}, _renderClearProps = function _renderClearProps(ratio, data) { 8515 if (data.tween && data.tween._time === data.tween._dur) { 8516 var target = data.t, style = target.style, props = data.u, cache = target._gsap, prop, clearTransforms, i; 8517 if (props === "all" || props === true) { 8518 style.cssText = ""; 8519 clearTransforms = 1; 8520 } else { 8521 props = props.split(","); 8522 i = props.length; 8523 while(--i > -1){ 8524 prop = props[i]; 8525 if (_transformProps[prop]) { 8526 clearTransforms = 1; 8527 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 8528 } 8529 _removeProperty(target, prop); 8530 } 8531 } 8532 if (clearTransforms) { 8533 _removeProperty(target, _transformProp); 8534 if (cache) { 8535 cache.svg && target.removeAttribute("transform"); 8536 _parseTransform(target, 1); // force all the cached values back to "normal"/identity, otherwise if there's another tween that's already set to render transforms on this element, it could display the wrong values. 8537 cache.uncache = 1; 8538 _removeIndependentTransforms(style); 8539 } 8540 } 8541 } 8542}, // note: specialProps should return 1 if (and only if) they have a non-zero priority. It indicates we need to sort the linked list. 8543_specialProps = { 8544 clearProps: function clearProps(plugin, target, property, endValue, tween) { 8545 if (tween.data !== "isFromStart") { 8546 var pt = plugin._pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, 0, 0, _renderClearProps); 8547 pt.u = endValue; 8548 pt.pr = -10; 8549 pt.tween = tween; 8550 plugin._props.push(property); 8551 return 1; 8552 } 8553 } 8554}, /* 8555 * -------------------------------------------------------------------------------------- 8556 * TRANSFORMS 8557 * -------------------------------------------------------------------------------------- 8558 */ _identity2DMatrix = [ 8559 1, 8560 0, 8561 0, 8562 1, 8563 0, 8564 0 8565], _rotationalProperties = {}, _isNullTransform = function _isNullTransform(value) { 8566 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 8567}, _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 8568 var matrixString = _getComputedProperty(target, _transformProp); 8569 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match((0, _gsapCoreJs._numExp)).map((0, _gsapCoreJs._round)); 8570}, _getMatrix = function _getMatrix(target, force2D) { 8571 var cache = target._gsap || (0, _gsapCoreJs._getCache)(target), style = target.style, matrix = _getComputedTransformMatrixAsArray(target), parent, nextSibling, temp, addedToDOM; 8572 if (cache.svg && target.getAttribute("transform")) { 8573 temp = target.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. 8574 matrix = [ 8575 temp.a, 8576 temp.b, 8577 temp.c, 8578 temp.d, 8579 temp.e, 8580 temp.f 8581 ]; 8582 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 8583 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 8584 //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 8585 //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). 8586 temp = style.display; 8587 style.display = "block"; 8588 parent = target.parentNode; 8589 if (!parent || !target.offsetParent) { 8590 // note: in 3.3.0 we switched target.offsetParent to _doc.body.contains(target) to avoid [sometimes unnecessary] MutationObserver calls but that wasn't adequate because there are edge cases where nested position: fixed elements need to get reparented to accurately sense transforms. See https://github.com/greensock/GSAP/issues/388 and https://github.com/greensock/GSAP/issues/375 8591 addedToDOM = 1; //flag 8592 nextSibling = target.nextElementSibling; 8593 _docElement.appendChild(target); //we must add it to the DOM in order to get values properly 8594 } 8595 matrix = _getComputedTransformMatrixAsArray(target); 8596 temp ? style.display = temp : _removeProperty(target, "display"); 8597 if (addedToDOM) nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 8598 } 8599 return force2D && matrix.length > 6 ? [ 8600 matrix[0], 8601 matrix[1], 8602 matrix[4], 8603 matrix[5], 8604 matrix[12], 8605 matrix[13] 8606 ] : matrix; 8607}, _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 8608 var cache = target._gsap, matrix = matrixArray || _getMatrix(target, true), xOriginOld = cache.xOrigin || 0, yOriginOld = cache.yOrigin || 0, xOffsetOld = cache.xOffset || 0, yOffsetOld = cache.yOffset || 0, a = matrix[0], b = matrix[1], c = matrix[2], d = matrix[3], tx = matrix[4], ty = matrix[5], originSplit = origin.split(" "), xOrigin = parseFloat(originSplit[0]) || 0, yOrigin = parseFloat(originSplit[1]) || 0, bounds, determinant, x, y; 8609 if (!originIsAbsolute) { 8610 bounds = _getBBox(target); 8611 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); 8612 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); 8613 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 8614 //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. 8615 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 8616 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 8617 xOrigin = x; 8618 yOrigin = y; 8619 } 8620 if (smooth || smooth !== false && cache.smooth) { 8621 tx = xOrigin - xOriginOld; 8622 ty = yOrigin - yOriginOld; 8623 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 8624 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 8625 } else cache.xOffset = cache.yOffset = 0; 8626 cache.xOrigin = xOrigin; 8627 cache.yOrigin = yOrigin; 8628 cache.smooth = !!smooth; 8629 cache.origin = origin; 8630 cache.originIsAbsolute = !!originIsAbsolute; 8631 target.style[_transformOriginProp] = "0px 0px"; //otherwise, if someone sets an origin via CSS, it will likely interfere with the SVG transform attribute ones (because remember, we're baking the origin into the matrix() value). 8632 if (pluginToAddPropTweensTo) { 8633 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 8634 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 8635 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 8636 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 8637 } 8638 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 8639}, _parseTransform = function _parseTransform(target, uncache) { 8640 var cache = target._gsap || new (0, _gsapCoreJs.GSCache)(target); 8641 if ("x" in cache && !uncache && !cache.uncache) return cache; 8642 var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp) || "0", x, y, z, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos, sin, a, b, c, d, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32; 8643 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 8644 scaleX = scaleY = 1; 8645 cache.svg = !!(target.getCTM && _isSVG(target)); 8646 if (cs.translate) { 8647 // accommodate independent transforms by combining them into normal ones. 8648 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") style[_transformProp] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp] !== "none" ? cs[_transformProp] : ""); 8649 style.scale = style.rotate = style.translate = "none"; 8650 } 8651 matrix = _getMatrix(target, cache.svg); 8652 if (cache.svg) { 8653 if (cache.uncache) { 8654 // if cache.uncache is true (and maybe if origin is 0,0), we need to set element.style.transformOrigin = (cache.xOrigin - bbox.x) + "px " + (cache.yOrigin - bbox.y) + "px". Previously we let the data-svg-origin stay instead, but when introducing revert(), it complicated things. 8655 t2 = target.getBBox(); 8656 origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; 8657 t1 = ""; 8658 } else t1 = !uncache && target.getAttribute("data-svg-origin"); // Remember, to work around browser inconsistencies we always force SVG elements' transformOrigin to 0,0 and offset the translation accordingly. 8659 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 8660 } 8661 xOrigin = cache.xOrigin || 0; 8662 yOrigin = cache.yOrigin || 0; 8663 if (matrix !== _identity2DMatrix) { 8664 a = matrix[0]; //a11 8665 b = matrix[1]; //a21 8666 c = matrix[2]; //a31 8667 d = matrix[3]; //a41 8668 x = a12 = matrix[4]; 8669 y = a22 = matrix[5]; //2D matrix 8670 if (matrix.length === 6) { 8671 scaleX = Math.sqrt(a * a + b * b); 8672 scaleY = Math.sqrt(d * d + c * c); 8673 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). 8674 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 8675 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 8676 if (cache.svg) { 8677 x -= xOrigin - (xOrigin * a + yOrigin * c); 8678 y -= yOrigin - (xOrigin * b + yOrigin * d); 8679 } //3D matrix 8680 } else { 8681 a32 = matrix[6]; 8682 a42 = matrix[7]; 8683 a13 = matrix[8]; 8684 a23 = matrix[9]; 8685 a33 = matrix[10]; 8686 a43 = matrix[11]; 8687 x = matrix[12]; 8688 y = matrix[13]; 8689 z = matrix[14]; 8690 angle = _atan2(a32, a33); 8691 rotationX = angle * _RAD2DEG; //rotationX 8692 if (angle) { 8693 cos = Math.cos(-angle); 8694 sin = Math.sin(-angle); 8695 t1 = a12 * cos + a13 * sin; 8696 t2 = a22 * cos + a23 * sin; 8697 t3 = a32 * cos + a33 * sin; 8698 a13 = a12 * -sin + a13 * cos; 8699 a23 = a22 * -sin + a23 * cos; 8700 a33 = a32 * -sin + a33 * cos; 8701 a43 = a42 * -sin + a43 * cos; 8702 a12 = t1; 8703 a22 = t2; 8704 a32 = t3; 8705 } //rotationY 8706 angle = _atan2(-c, a33); 8707 rotationY = angle * _RAD2DEG; 8708 if (angle) { 8709 cos = Math.cos(-angle); 8710 sin = Math.sin(-angle); 8711 t1 = a * cos - a13 * sin; 8712 t2 = b * cos - a23 * sin; 8713 t3 = c * cos - a33 * sin; 8714 a43 = d * sin + a43 * cos; 8715 a = t1; 8716 b = t2; 8717 c = t3; 8718 } //rotationZ 8719 angle = _atan2(b, a); 8720 rotation = angle * _RAD2DEG; 8721 if (angle) { 8722 cos = Math.cos(angle); 8723 sin = Math.sin(angle); 8724 t1 = a * cos + b * sin; 8725 t2 = a12 * cos + a22 * sin; 8726 b = b * cos - a * sin; 8727 a22 = a22 * cos - a12 * sin; 8728 a = t1; 8729 a12 = t2; 8730 } 8731 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 8732 //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. 8733 rotationX = rotation = 0; 8734 rotationY = 180 - rotationY; 8735 } 8736 scaleX = (0, _gsapCoreJs._round)(Math.sqrt(a * a + b * b + c * c)); 8737 scaleY = (0, _gsapCoreJs._round)(Math.sqrt(a22 * a22 + a32 * a32)); 8738 angle = _atan2(a12, a22); 8739 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 8740 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 8741 } 8742 if (cache.svg) { 8743 //sense if there are CSS transforms applied on an SVG element in which case we must over
8743write them when rendering. The transform attribute is more reliable cross-browser, but we can't just remove the CSS ones because they may be applied in a CSS rule somewhere (not just inline). 8744 t1 = target.getAttribute("transform"); 8745 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 8746 t1 && target.setAttribute("transform", t1); 8747 } 8748 } 8749 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 8750 if (invertedScaleX) { 8751 scaleX *= -1; 8752 skewX += rotation <= 0 ? 180 : -180; 8753 rotation += rotation <= 0 ? 180 : -180; 8754 } else { 8755 scaleY *= -1; 8756 skewX += skewX <= 0 ? 180 : -180; 8757 } 8758 } 8759 uncache = uncache || cache.uncache; 8760 cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; 8761 cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; 8762 cache.z = z + px; 8763 cache.scaleX = (0, _gsapCoreJs._round)(scaleX); 8764 cache.scaleY = (0, _gsapCoreJs._round)(scaleY); 8765 cache.rotation = (0, _gsapCoreJs._round)(rotation) + deg; 8766 cache.rotationX = (0, _gsapCoreJs._round)(rotationX) + deg; 8767 cache.rotationY = (0, _gsapCoreJs._round)(rotationY) + deg; 8768 cache.skewX = skewX + deg; 8769 cache.skewY = skewY + deg; 8770 cache.transformPerspective = perspective + px; 8771 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) style[_transformOriginProp] = _firstTwoOnly(origin); 8772 cache.xOffset = cache.yOffset = 0; 8773 cache.force3D = (0, _gsapCoreJs._config).force3D; 8774 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 8775 cache.uncache = 0; 8776 return cache; 8777}, _firstTwoOnly = function _firstTwoOnly(value) { 8778 return (value = value.split(" "))[0] + " " + value[1]; 8779}, //for handling transformOrigin values, stripping out the 3rd dimension 8780_addPxTranslate = function _addPxTranslate(target, start, value) { 8781 var unit = (0, _gsapCoreJs.getUnit)(start); 8782 return (0, _gsapCoreJs._round)(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 8783}, _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 8784 cache.z = "0px"; 8785 cache.rotationY = cache.rotationX = "0deg"; 8786 cache.force3D = 0; 8787 _renderCSSTransforms(ratio, cache); 8788}, _zeroDeg = "0deg", _zeroPx = "0px", _endParenthesis = ") ", _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 8789 var _ref = cache || this, xPercent = _ref.xPercent, yPercent = _ref.yPercent, x = _ref.x, y = _ref.y, z = _ref.z, rotation = _ref.rotation, rotationY = _ref.rotationY, rotationX = _ref.rotationX, skewX = _ref.skewX, skewY = _ref.skewY, scaleX = _ref.scaleX, scaleY = _ref.scaleY, transformPerspective = _ref.transformPerspective, force3D = _ref.force3D, target = _ref.target, zOrigin = _ref.zOrigin, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; // Safari has a bug that causes it not to render 3D transform-origin values properly, so we force the z origin to 0, record it in the cache, and then do the math here to offset the translate values accordingly (basically do the 3D transform-origin part manually) 8790 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 8791 var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle), cos; 8792 angle = parseFloat(rotationX) * _DEG2RAD; 8793 cos = Math.cos(angle); 8794 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 8795 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 8796 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 8797 } 8798 if (transformPerspective !== _zeroPx) transforms += "perspective(" + transformPerspective + _endParenthesis; 8799 if (xPercent || yPercent) transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 8800 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 8801 if (rotation !== _zeroDeg) transforms += "rotate(" + rotation + _endParenthesis; 8802 if (rotationY !== _zeroDeg) transforms += "rotateY(" + rotationY + _endParenthesis; 8803 if (rotationX !== _zeroDeg) transforms += "rotateX(" + rotationX + _endParenthesis;
8804 if (skewX !== _zeroDeg || skewY !== _zeroDeg) transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 8805 if (scaleX !== 1 || scaleY !== 1) transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 8806 target.style[_transformProp] = transforms || "translate(0, 0)"; 8807}, _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 8808 var _ref2 = cache || this, xPercent = _ref2.xPercent, yPercent = _ref2.yPercent, x = _ref2.x, y = _ref2.y, rotation = _ref2.rotation, skewX = _ref2.skewX, skewY = _ref2.skewY, scaleX = _ref2.scaleX, scaleY = _ref2.scaleY, target = _ref2.target, xOrigin = _ref2.xOrigin, yOrigin = _ref2.yOrigin, xOffset = _ref2.xOffset, yOffset = _ref2.yOffset, forceCSS = _ref2.forceCSS, tx = parseFloat(x), ty = parseFloat(y), a11, a21, a12, a22, temp; 8809 rotation = parseFloat(rotation); 8810 skewX = parseFloat(skewX); 8811 skewY = parseFloat(skewY); 8812 if (skewY) { 8813 //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. 8814 skewY = parseFloat(skewY); 8815 skewX += skewY; 8816 rotation += skewY; 8817 } 8818 if (rotation || skewX) { 8819 rotation *= _DEG2RAD; 8820 skewX *= _DEG2RAD; 8821 a11 = Math.cos(rotation) * scaleX; 8822 a21 = Math.sin(rotation) * scaleX; 8823 a12 = Math.sin(rotation - skewX) * -scaleY; 8824 a22 = Math.cos(rotation - skewX) * scaleY; 8825 if (skewX) { 8826 skewY *= _DEG2RAD; 8827 temp = Math.tan(skewX - skewY); 8828 temp = Math.sqrt(1 + temp * temp); 8829 a12 *= temp; 8830 a22 *= temp; 8831 if (skewY) { 8832 temp = Math.tan(skewY); 8833 temp = Math.sqrt(1 + temp * temp); 8834 a11 *= temp; 8835 a21 *= temp; 8836 } 8837 } 8838 a11 = (0, _gsapCoreJs._round)(a11); 8839 a21 = (0, _gsapCoreJs._round)(a21); 8840 a12 = (0, _gsapCoreJs._round)(a12); 8841 a22 = (0, _gsapCoreJs._round)(a22); 8842 } else { 8843 a11 = scaleX; 8844 a22 = scaleY; 8845 a21 = a12 = 0; 8846 } 8847 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 8848 tx = _convertToUnit(target, "x", x, "px"); 8849 ty = _convertToUnit(target, "y", y, "px"); 8850 } 8851 if (xOrigin || yOrigin || xOffset || yOffset) { 8852 tx = (0, _gsapCoreJs._round)(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 8853 ty = (0, _gsapCoreJs._round)(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 8854 } 8855 if (xPercent || yPercent) { 8856 //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the translation to simulate it. 8857 temp = target.getBBox(); 8858 tx = (0, _gsapCoreJs._round)(tx + xPercent / 100 * temp.width); 8859 ty = (0, _gsapCoreJs._round)(ty + yPercent / 100 * temp.height); 8860 } 8861 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 8862 target.setAttribute("transform", temp); 8863 forceCSS && (target.style[_transformProp] = temp); //some browsers prioritize CSS transforms over the transform attribute. When we sense that the user has CSS transforms applied, we must overwrite them this way (otherwise some browser simply won't render the transform attribute changes!) 8864}, _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { 8865 var cap = 360, isString = (0, _gsapCoreJs._isString)(endValue), endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), change = endNum - startNum, finalValue = startNum + change + "deg", direction, pt; 8866 if (isString) { 8867 direction = endValue.split("_")[1]; 8868 if (direction === "short") { 8869 change %= cap; 8870 if (change !== change % (cap / 2)) change += change < 0 ? cap : -cap; 8871 } 8872 if (direction === "cw" && change < 0) change = (change + cap * _bigNum) % cap - ~~(change / cap) * cap; 8873 else if (direction === "ccw" && change > 0) change = (change - cap * _bigNum) % cap - ~~(change / cap) * cap; 8874 } 8875 plugin._pt = pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 8876 pt.e = finalValue; 8877 pt.u = "deg"; 8878 plugin._props.push(property); 8879 return pt; 8880}, _assign = function _assign(target, source) { 8881 // Internet Explorer doesn't have Object.assign(), so we recreate it here. 8882 for(var p in source)target[p] = source[p]; 8883 return target; 8884}, _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 8885 //for handling cases where someone passes in a whole transform string, like transform: "scale(2, 3) rotate(20deg) translateY(30em)" 8886 var startCache = _assign({}, target._gsap), exclude = "perspective,force3D,transformOrigin,svgOrigin", style = target.style, endCache, p, startValue, endValue, startNum, endNum, startUnit, endUnit; 8887 if (startCache.svg) { 8888 startValue = target.getAttribute("transform"); 8889 target.setAttribute("transform", ""); 8890 style[_transformProp] = transforms; 8891 endCache = _parseTransform(target, 1); 8892 _removeProperty(target, _transformProp); 8893 target.setAttribute("transform", startValue); 8894 } else { 8895 startValue = getComputedStyle(target)[_transformProp]; 8896 style[_transformProp] = transforms; 8897 endCache = _parseTransform(target, 1); 8898 style[_transformProp] = startValue; 8899 } 8900 for(p in _transformProps){ 8901 startValue = startCache[p]; 8902 endValue = endCache[p]; 8903 if (startValue !== endValue && exclude.indexOf(p) < 0) { 8904 //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. 8905 startUnit = (0, _gsapCoreJs.getUnit)(startValue); 8906 endUnit = (0, _gsapCoreJs.getUnit)(endValue); 8907 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 8908 endNum = parseFloat(endValue); 8909 plugin._pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 8910 plugin._pt.u = endUnit || 0; 8911 plugin._props.push(p); 8912 } 8913 } 8914 _assign(endCache, startCache); 8915}; // handle splitting apart padding, margin, borderWidth, and borderRadius into their 4 components. Firefox, for example, won't report borderRadius correctly - it will only do borderTopLeftRadius and the other corners. We also want to handle paddingTop, marginLeft, borderRightWidth, etc.
8916(0, _gsapCoreJs._forEachName)("padding,margin,Width,Radius", function(name, index) { 8917 var t = "Top", r = "Right", b = "Bottom", l = "Left", props = (index < 3 ? [ 8918 t, 8919 r, 8920 b, 8921 l 8922 ] : [ 8923 t + l, 8924 t + r, 8925 b + r, 8926 b + l 8927 ]).map(function(side) { 8928 return index < 2 ? name + side : "border" + side + name; 8929 }); 8930 _specialProps[index > 1 ? "border" + name : name] = function(plugin, target, property, endValue, tween) { 8931 var a, vars; 8932 if (arguments.length < 4) { 8933 // getter, passed target, property, and unit (from _get()) 8934 a = props.map(function(prop) { 8935 return _get(plugin, prop, property); 8936 }); 8937 vars = a.join(" "); 8938 return vars.split(a[0]).length === 5 ? a[0] : vars; 8939 } 8940 a = (endValue + "").split(" "); 8941 vars = {}; 8942 props.forEach(function(prop, i) { 8943 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 8944 }); 8945 plugin.init(target, vars, tween); 8946 }; 8947}); 8948var CSSPlugin = { 8949 name: "css", 8950 register: _initCore, 8951 targetTest: function targetTest(target) { 8952 return target.style && target.nodeType; 8953 }, 8954 init: function init(target, vars, tween, index, targets) { 8955 var props = this._props, style = target.style, startAt = tween.vars.startAt, startValue, endValue, endNum, startNum, type, specialProp, p, startUnit, endUnit, relative, isTransformRelated, transformPropTween, cache, smooth, hasPriority, inlineProps; 8956 _pluginInitted || _initCore(); // we may call init() multiple times on the same plugin instance, like when adding special properties, so make sure we don't overwrite the revert data or inlineProps 8957 this.styles = this.styles || _getStyleSaver(target); 8958 inlineProps = this.styles.props; 8959 this.tween = tween; 8960 for(p in vars){ 8961 if (p === "autoRound") continue; 8962 endValue = vars[p]; 8963 if ((0, _gsapCoreJs._plugins)[p] && (0, _gsapCoreJs._checkPlugin)(p, vars, tween, index, target, targets)) continue; 8964 type = typeof endValue === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(endValue); 8965 specialProp = _specialProps[p]; 8966 if (type === "function") { 8967 endValue = endValue.call(tween, index, target, targets); 8968 type = typeof endValue === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(endValue); 8969 } 8970 if (type === "string" && ~endValue.indexOf("random(")) endValue = (0, _gsapCoreJs._replaceRandom)(endValue); 8971 if (specialProp) specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 8972 else if (p.substr(0, 2) === "--") { 8973 //CSS variable 8974 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 8975 endValue += ""; 8976 (0, _gsapCoreJs._colorExp).lastIndex = 0; 8977 if (!(0, _gsapCoreJs._colorExp).test(startValue)) { 8978 // colors don't have units 8979 startUnit = (0, _gsapCoreJs.getUnit)(startValue); 8980 endUnit = (0, _gsapCoreJs.getUnit)(endValue); 8981 } 8982 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 8983 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 8984 props.push(p); 8985 inlineProps.push(p, 0, style[p]); 8986 } else if (type !== "undefined") { 8987 if (startAt && p in startAt) { 8988 // in case someone hard-codes a complex value as the start, like top: "calc(2vh / 2)". Without this, it'd use the computed value (always in px) 8989 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 8990 (0, _gsapCoreJs._isString)(startValue) && ~startValue.indexOf("random(") && (startValue = (0, _gsapCoreJs._replaceRandom)(startValue)); 8991 (0, _gsapCoreJs.getUnit)(startValue + "") || (startValue += (0, _gsapCoreJs._config).units[p] || (0, _gsapCoreJs.getUnit)(_get(target, p)) || ""); // for cases when someone passes in a unitless value like {x: 100}; if we try setting translate(100, 0px) it won't work. 8992 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); // can't work with relative values 8993 } else startValue = _get(target, p); 8994 startNum = parseFloat(startValue); 8995 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 8996 relative && (endValue = endValue.substr(2)); 8997 endNum = parseFloat(endValue); 8998 if (p in _propertyAliases) { 8999 if (p === "autoAlpha") { 9000 //special case where we control the visibility along with opacity. We still allow the opacity value to pass through and get tweened. 9001 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) 9002 startNum = 0; 9003 inlineProps.push("visibility", 0, style.visibility); 9004 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 9005 } 9006 if (p !== "scale" && p !== "transform") { 9007 p = _propertyAliases[p]; 9008 ~p.indexOf(",") && (p = p.split(",")[0]); 9009 } 9010 }
9011 isTransformRelated = p in _transformProps; //--- TRANSFORM-RELATED --- 9012 if (isTransformRelated) { 9013 this.styles.save(p); 9014 if (!transformPropTween) { 9015 cache = target._gsap; 9016 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); // if, for example, gsap.set(... {transform:"translateX(50vw)"}), the _get() call doesn't parse the transform, thus cache.renderTransform won't be set yet so force the parsing of the transform here. 9017 smooth = vars.smoothOrigin !== false && cache.smooth; 9018 transformPropTween = this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); //the first time through, create the rendering PropTween so that it runs LAST (in the linked list, we keep adding to the beginning) 9019 transformPropTween.dep = 1; //flag it as dependent so that if things get killed/overwritten and this is the only PropTween left, we can safely kill the whole tween. 9020 } 9021 if (p === "scale") { 9022 this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, cache, "scaleY", cache.scaleY, (relative ? (0, _gsapCoreJs._parseRelative)(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); 9023 this._pt.u = 0; 9024 props.push("scaleY", p); 9025 p += "X"; 9026 } else if (p === "transformOrigin") { 9027 inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); 9028 endValue = _convertKeywordsToPercentages(endValue); //in case something like "left top" or "bottom right" is passed in. Convert to percentages. 9029 if (cache.svg) _applySVGOrigin(target, endValue, 0, smooth, 0, this); 9030 else { 9031 endUnit = parseFloat(endValue.split(" ")[2]) || 0; //handle the zOrigin separately! 9032 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 9033 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 9034 } 9035 continue; 9036 } else if (p === "svgOrigin") { 9037 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 9038 continue; 9039 } else if (p in _rotationalProperties) { 9040 _addRotationalPropTween(this, cache, p, startNum, relative ? (0, _gsapCoreJs._parseRelative)(startNum, relative + endValue) : endValue); 9041 continue; 9042 } else if (p === "smoothOrigin") { 9043 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 9044 continue; 9045 } else if (p === "force3D") { 9046 cache[p] = endValue; 9047 continue; 9048 } else if (p === "transform") { 9049 _addRawTransformPTs(this, endValue, target); 9050 continue; 9051 } 9052 } else if (!(p in style)) p = _checkPropPrefix(p) || p; 9053 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 9054 startUnit = (startValue + "").substr((startNum + "").length); 9055 endNum || (endNum = 0); // protect against NaN 9056 endUnit = (0, _gsapCoreJs.getUnit)(endValue) || (p in (0, _gsapCoreJs._config).units ? (0, _gsapCoreJs._config).units[p] : startUnit); 9057 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 9058 this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? (0, _gsapCoreJs._parseRelative)(startNum, relative + endNum) : endNum) - startNum,
9058!isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 9059 this._pt.u = endUnit || 0; 9060 if (startUnit !== endUnit && endUnit !== "%") { 9061 //when the tween goes all the way back to the beginning, we need to revert it to the OLD/ORIGINAL value (with those units). We record that as a "b" (beginning) property and point to a render method that handles that. (performance optimization) 9062 this._pt.b = startValue; 9063 this._pt.r = _renderCSSPropWithBeginning; 9064 } 9065 } else if (!(p in style)) { 9066 if (p in target) //maybe it's not a style - it could be a property added directly to an element in which case we'll try to animate that. 9067 this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); 9068 else if (p !== "parseTransform") { 9069 (0, _gsapCoreJs._missingPlugin)(p, endValue); 9070 continue; 9071 } 9072 } else _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); 9073 isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : inlineProps.push(p, 1, startValue || target[p])); 9074 props.push(p); 9075 } 9076 } 9077 hasPriority && (0, _gsapCoreJs._sortPropTweensByPriority)(this); 9078 }, 9079 render: function render(ratio, data) { 9080 if (data.tween._time || !_reverting()) { 9081 var pt = data._pt; 9082 while(pt){ 9083 pt.r(ratio, pt.d); 9084 pt = pt._next; 9085 } 9086 } else data.styles.revert(); 9087 }, 9088 get: _get, 9089 aliases: _propertyAliases, 9090 getSetter: function getSetter(target, property, plugin) { 9091 //returns a setter function that accepts target, property, value and applies it accordingly. Remember, properties like "x" aren't as simple as target.style.property = value because they've got to be applied to a proxy object and then merged into a transform string in a renderer. 9092 var p = _propertyAliases[property]; 9093 p && p.indexOf(",") < 0 && (property = p); 9094 return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}, property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !(0, _gsapCoreJs._isUndefined)(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : (0, _gsapCoreJs._getSetter)(target, property); 9095 }, 9096 core: { 9097 _removeProperty: _removeProperty, 9098 _getMatrix: _getMatrix 9099 } 9100}; 9101(0, _gsapCoreJs.gsap).utils.checkPrefix = _checkPropPrefix; 9102(0, _gsapCoreJs.gsap).core.getStyleSaver = _getStyleSaver; 9103(function(positionAndScale, rotation, others, aliases) { 9104 var all = (0, _gsapCoreJs._forEachName)(positionAndScale + "," + rotation + "," + others, function(name) { 9105 _transformProps[name] = 1; 9106 }); 9107 (0, _gsapCoreJs._forEachName)(rotation, function(name) { 9108 (0, _gsapCoreJs._config).units[name] = "deg"; 9109 _rotationalProperties[name] = 1; 9110 }); 9111 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 9112 (0, _gsapCoreJs._forEachName)(aliases, function(name) { 9113 var split = name.split(":"); 9114 _propertyAliases[split[1]] = all[split[0]]; 9115 }); 9116})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); 9117(0, _gsapCoreJs._forEachName)("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) { 9118 (0, _gsapCoreJs._config).units[name] = "px"; 9119}); 9120(0, _gsapCoreJs.gsap).registerPlugin(CSSPlugin); 9121 9122},{"@swc/helpers/src/_type_of.mjs":"69q0b","./gsap-core.js":"5QIej","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"3493k":[function(require,module,exports) { 9123var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 9124var _typeOfMjs = require("@swc/helpers/src/_type_of.mjs"); 9125var _typeOfMjsDefault = parcelHelpers.interopDefault(_typeOfMjs); 9126/**! 9127 * MixItUp v3.3.1 9128 * A high-performance, dependency-free library for animated filtering, sorting and more 9129 * Build 94e0fbf6-cd0b-4987-b3c0-14b59b67b8a0 9130 * 9131 * @copyright Copyright 2014-2018 KunkaLabs Limited. 9132 * @author KunkaLabs Limited. 9133 * @link https://www.kunkalabs.com/mixitup/ 9134 * 9135 * @license Commercial use requires a commercial license. 9136 * https://www.kunkalabs.com/mixitup/licenses/ 9137 * 9138 * Non-commercial use permitted under same terms as CC BY-NC 3.0 license. 9139 * http://creativecommons.org/licenses/by-nc/3.0/ 9140 */ (function(window1) { 9141 "use strict"; 9142 var mixitup = null, h = null; 9143 (function() { 9144 var VENDORS = [ 9145 "webkit", 9146 "moz", 9147 "o", 9148 "ms"
9149 ], canary = window1.document.createElement("div"), i = -1; 9150 // window.requestAnimationFrame 9151 for(i = 0; i < VENDORS.length && !window1.requestAnimationFrame; i++)window1.requestAnimationFrame = window1[VENDORS[i] + "RequestAnimationFrame"]; 9152 // Element.nextElementSibling 9153 if (typeof canary.nextElementSibling === "undefined") Object.defineProperty(window1.Element.prototype, "nextElementSibling", { 9154 get: function get() { 9155 var el = this.nextSibling; 9156 while(el){ 9157 if (el.nodeType === 1) return el; 9158 el = el.nextSibling; 9159 } 9160 return null; 9161 } 9162 }); 9163 // Element.matches 9164 (function(ElementPrototype) { 9165 ElementPrototype.matches = ElementPrototype.matches || ElementPrototype.machesSelector || ElementPrototype.mozMatchesSelector || ElementPrototype.msMatchesSelector || ElementPrototype.oMatchesSelector || ElementPrototype.webkitMatchesSelector || function(selector) { 9166 return Array.prototype.indexOf.call(this.parentElement.querySelectorAll(selector), this) > -1; 9167 }; 9168 })(window1.Element.prototype); 9169 // Object.keys 9170 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys 9171 if (!Object.keys) Object.keys = function() { 9172 var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = false, dontEnums = [], dontEnumsLength = -1; 9173 hasDontEnumBug = !({ 9174 toString: null 9175 }).propertyIsEnumerable("toString"); 9176 dontEnums = [ 9177 "toString", 9178 "toLocaleString", 9179 "valueOf", 9180 "hasOwnProperty", 9181 "isPrototypeOf", 9182 "propertyIsEnumerable", 9183 "constructor" 9184 ]; 9185 dontEnumsLength = dontEnums.length; 9186 return function(obj) { 9187 var result = [], prop = "", i = -1; 9188 if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) throw new TypeError("Object.keys called on non-object"); 9189 for(prop in obj)if (hasOwnProperty.call(obj, prop)) result.push(prop); 9190 if (hasDontEnumBug) { 9191 for(i = 0; i < dontEnumsLength; i++)if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]); 9192 } 9193 return result; 9194 }; 9195 }(); 9196 // Array.isArray 9197 // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray 9198 if (!Array.isArray) Array.isArray = function(arg) { 9199 return Object.prototype.toString.call(arg) === "[object Array]"; 9200 }; 9201 // Object.create 9202 // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/create 9203 if (typeof Object.create !== "function") Object.create = function(undefined) { 9204 var Temp = function Temp() {}; 9205 return function(prototype, propertiesObject) { 9206 if (prototype !== Object(prototype) && prototype !== null) throw TypeError("Argument must be an object, or null"); 9207 Temp.prototype = prototype || {}; 9208 var result = new Temp(); 9209 Temp.prototype = null; 9210 if (propertiesObject !== undefined) Object.defineProperties(result, propertiesObject); 9211 if (prototype === null) /* jshint ignore:start */ result.__proto__ = null; 9212 return result; 9213 }; 9214 }(); 9215 // String.prototyoe.trim 9216 if (!String.prototype.trim) String.prototype.trim = function() { 9217 return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); 9218 }; 9219 // Array.prototype.indexOf 9220 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf 9221 if (!Array.prototype.indexOf) Array.prototype.indexOf = function(searchElement) { 9222 var n, k, t, len; 9223 if (this === null) throw new TypeError(); 9224 t = Object(this); 9225 len = t.length >>> 0; 9226 if (len === 0) return -1; 9227 n = 0; 9228 if (arguments.length > 1) { 9229 n = Number(arguments[1]); 9230 if (n !== n) n = 0; 9231 else if (n !== 0 && n !== Infinity && n !== -Infinity) n = (n > 0 || -1) * Math.floor(Math.abs(n)); 9232 } 9233 if (n >= len) return -1; 9234 for(k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); k < len; k++){ 9235 if (k in t && t[k] === searchElement) return k; 9236 } 9237 return -1; 9238 }; 9239 // Function.prototype.bind 9240 // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind 9241 if (!Function.prototype.bind) Function.prototype.bind = function(oThis) { 9242 var aArgs, self, FNOP, fBound; 9243 if (typeof this !== "function") throw new TypeError(); 9244 aArgs = Array.prototype.slice.call(arguments, 1); 9245 self = this; 9246 FNOP = function FNOP() {}; 9247 fBound = function fBound() { 9248 return self.apply(this instanceof FNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 9249 }; 9250 if (this.prototype) FNOP.prototype = this.prototype; 9251 fBound.prototype = new FNOP(); 9252 return fBound; 9253 }; 9254 // Element.prototype.dispatchEvent 9255 if (!window1.Element.prototype.dispatchEvent) window1.Element.prototype.dispatchEvent = function(event) { 9256 try { 9257 return this.fireEvent("on" + event.type, event); 9258 } catch (err) {} 9259 }; 9260 })(); 9261 /** 9262 * The `mixitup()` "factory" function creates and returns individual instances 9263 * of MixItUp, known as "mixers", on which API methods can be called. 9264 * 9265 * When loading MixItUp via a script tag, the factory function is accessed 9266 * via the global variable `mixitup`. When using a module loading 9267 * system (e.g. ES2015, CommonJS, RequireJS), the factory function is 9268 * exported into your module when you require the MixItUp library. 9269 * 9270 * @example 9271 * mixitup(container [,config] [,foreignDoc]) 9272 * 9273 * @example <caption>Example 1: Creating a mixer instance with an element reference</caption> 9274 * var containerEl = document.querySelector('.container'); 9275 * 9276 * var mixer = mixitup(containerEl); 9277 * 9278 * @example <caption>Example 2: Creating a mixer instance with a selector string</caption> 9279 * var mixer = mixitup('.container'); 9280 * 9281 * @example <caption>Example 3: Passing a configuration object</caption> 9282 * var mixer = mixitup(containerEl, { 9283 * animation: { 9284 * effects: 'fade scale(0.5)' 9285 * } 9286 * }); 9287 * 9288 * @example <caption>Example 4: Passing an iframe reference</caption> 9289 * var mixer = mixitup(containerEl, config, foreignDocument); 9290 * 9291 * @global 9292 * @namespace 9293 * @public 9294 * @kind function 9295 * @since 3.0.0 9296 * @param {(Element|string)}
9296 container 9297 * A DOM element or selector string representing the container(s) on which to instantiate MixItUp. 9298 * @param {object} [config] 9299 * An optional "configuration object" used to customize the behavior of the MixItUp instance. 9300 * @param {object} [foreignDoc] 9301 * An optional reference to a `document`, which can be used to control a MixItUp instance in an iframe. 9302 * @return {mixitup.Mixer} 9303 * A "mixer" object holding the MixItUp instance. 9304 */ mixitup = function(container, config, foreignDoc) { 9305 var el = null, returnCollection = false, instance = null, facade = null, doc = null, output = null, instances = [], id = "", elements = [], i = -1; 9306 doc = foreignDoc || window1.document; 9307 if (returnCollection = arguments[3]) // A non-documented 4th paramater enabling control of multiple instances 9308 returnCollection = typeof returnCollection === "boolean"; 9309 if (typeof container === "string") elements = doc.querySelectorAll(container); 9310 else if (container && typeof container === "object" && h.isElement(container, doc)) elements = [ 9311 container 9312 ]; 9313 else if (container && typeof container === "object" && container.length) // Although not documented, the container may also be an array-like list of 9314 // elements such as a NodeList or jQuery collection, is returnCollection is true 9315 elements = container; 9316 else throw new Error(mixitup.messages.errorFactoryInvalidContainer()); 9317 if (elements.length < 1) throw new Error(mixitup.messages.errorFactoryContainerNotFound()); 9318 for(i = 0; el = elements[i]; i++){ 9319 if (i > 0 && !returnCollection) break; 9320 if (!el.id) { 9321 id = "MixItUp" + h.randomHex(); 9322 el.id = id; 9323 } else id = el.id; 9324 if (mixitup.instances[id] instanceof mixitup.Mixer) { 9325 instance = mixitup.instances[id]; 9326 if (!config || config && config.debug && config.debug.showWarnings !== false) console.warn(mixitup.messages.warningFactoryPreexistingInstance()); 9327 } else { 9328 instance = new mixitup.Mixer(); 9329 instance.attach(el, doc, id, config); 9330 mixitup.instances[id] = instance; 9331 } 9332 facade = new mixitup.Facade(instance); 9333 if (config && config.debug && config.debug.enable) instances.push(instance); 9334 else instances.push(facade); 9335 } 9336 if (returnCollection) output = new mixitup.Collection(instances); 9337 else // Return the first instance regardless 9338 output = instances[0]; 9339 return output; 9340 }; 9341 /** 9342 * The `.use()` static method is used to extend the functionality of mixitup with compatible 9343 * extensions and libraries in an environment with modular scoping e.g. ES2015, CommonJS, or RequireJS. 9344 * 9345 * You need only call the `.use()` function once per project, per extension, as module loaders 9346 * will cache a single reference to MixItUp inclusive of all changes made. 9347 * 9348 * @example 9349 * mixitup.use(extension) 9350 * 9351 * @example <caption>Example 1: Extending MixItUp with the Pagination Extension</caption> 9352 * 9353 * import mixitup from 'mixitup'; 9354 * import mixitupPagination from 'mixitup-pagination'; 9355 * 9356 * mixitup.use(mixitupPagination); 9357 * 9358 * // All mixers created by the factory function in all modules will now 9359 * // have pagination functionality 9360 * 9361 * var mixer = mixitup('.container'); 9362 * 9363 * @public 9364 * @name use 9365 * @memberof mixitup 9366 * @kind function 9367 * @static 9368 * @since 3.0.0 9369 * @param {*} extension A reference to the extension or library to be used. 9370 * @return {void} 9371 */ mixitup.use = function(extension) { 9372 mixitup.Base.prototype.callActions.call(mixitup, "beforeUse", arguments); 9373 // Call the extension's factory function, passing 9374 // the mixitup factory as a paramater 9375 if (typeof extension === "function" && extension.TYPE === "mixitup-extension") // Mixitup extension 9376 { 9377 if (typeof mixitup.extensions[extension.NAME] === "undefined") { 9378 extension(mixitup); 9379 mixitup.extensions[extension.NAME] = extension; 9380 } 9381 } else if (extension.fn && extension.fn.jquery) // jQuery 9382 mixitup.libraries.$ = extension; 9383 mixitup.Base.prototype.callActions.call(mixitup, "afterUse", arguments); 9384 }; 9385 mixitup.instances = {}; 9386 mixitup.extensions = {}; 9387 mixitup.libraries = {}; 9388 /** 9389 * @private 9390 */ h = { 9391 /** 9392 * @private 9393 * @param {HTMLElement} el 9394 * @param {string} cls 9395 * @return {boolean} 9396 */ hasClass: function hasClass(el, cls) { 9397 return !!el.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); 9398 }, 9399 /** 9400 * @private 9401 * @param {HTMLElement} el 9402 * @param {string} cls 9403 * @return {void} 9404 */ addClass: function addClass(el, cls) { 9405 if (!this.hasClass(el, cls)) el.className += el.className ? " " + cls : cls; 9406 }, 9407 /** 9408 * @private 9409 * @param {HTMLElement} el 9410 * @param {string} cls 9411 * @return {void} 9412 */ removeClass: function removeClass(el, cls) { 9413 if (this.hasClass(el, cls)) { 9414 var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)"); 9415 el.className = el.className.replace(reg, " ").trim(); 9416 } 9417 }, 9418 /** 9419 * Merges the properties of the source object onto the 9420 * target object. Alters the target object. 9421 * 9422 * @private 9423 * @param {object} destination 9424 * @param {object} source 9425 * @param {boolean} [deep=false] 9426 * @param {boolean} [handleErrors=false] 9427 * @return {void} 9428 */ extend: function extend(destination, source, deep, handleErrors) { 9429 var sourceKeys = [], key = "", i = -1; 9430 deep = deep || false; 9431 handleErrors = handleErrors || false; 9432 try { 9433 if (Array.isArray(source)) for(i = 0; i < source.length; i++)sourceKeys.push(i); 9434 else if (source) sourceKeys = Object.keys(source); 9435 for(i = 0; i < sourceKeys.length; i++){ 9436 key = sourceKeys[i]; 9437 if (!deep || typeof source[key] !== "object" || this.isElement(source[key])) // All non-object properties, or all properties if shallow extend 9438 destination[key] = source[key]; 9439 else if (Array.isArray(source[key])) { 9440 // Arrays 9441 if (!destination[key]) destination[key] = []; 9442 this.extend(destination[key], source[key], deep, handleErrors); 9443 } else { 9444 // Objects 9445 if (!destination[key]) destination[key] = {}; 9446 this.extend(destination[key], source[key], deep, handleErrors); 9447 } 9448 } 9449 } catch (err) { 9450 if (handleErrors) this.handleExtendError(err, destination); 9451 else throw err; 9452 } 9453 return destination; 9454 }, 9455 /** 9456 * @private 9457 * @param {Error} err 9458 * @param {object} destination 9459 * @return {void} 9460 */ handleExtendError: function handleExtendError(err, destination) { 9461 var re = /property "?(\w*)"?[,:] object/i, matches = null, erroneous = "", message = "", suggestion = "", probableMatch = "", key = "", mostMatchingChars = -1, i =
9461-1; 9462 if (err instanceof TypeError && (matches = re.exec(err.message))) { 9463 erroneous = matches[1]; 9464 for(key in destination){ 9465 i = 0; 9466 while(i < erroneous.length && erroneous.charAt(i) === key.charAt(i))i++; 9467 if (i > mostMatchingChars) { 9468 mostMatchingChars = i; 9469 probableMatch = key; 9470 } 9471 } 9472 if (mostMatchingChars > 1) suggestion = mixitup.messages.errorConfigInvalidPropertySuggestion({ 9473 probableMatch: probableMatch 9474 }); 9475 message = mixitup.messages.errorConfigInvalidProperty({ 9476 erroneous: erroneous, 9477 suggestion: suggestion 9478 }); 9479 throw new TypeError(message); 9480 } 9481 throw err; 9482 }, 9483 /** 9484 * @private 9485 * @param {string} str 9486 * @return {function} 9487 */ template: function template(str) { 9488 var re = /\${([\w]*)}/g, dynamics = {}, matches = null; 9489 while(matches = re.exec(str))dynamics[matches[1]] = new RegExp("\\${" + matches[1] + "}", "g"); 9490 return function(data) { 9491 var key = "", output = str; 9492 data = data || {}; 9493 for(key in dynamics)output = output.replace(dynamics[key], typeof data[key] !== "undefined" ? data[key] : ""); 9494 return output; 9495 }; 9496 }, 9497 /** 9498 * @private 9499 * @param {HTMLElement} el 9500 * @param {string} type 9501 * @param {function} fn 9502 * @param {boolean} useCapture 9503 * @return {void} 9504 */ on: function on(el, type, fn, useCapture) { 9505 if (!el) return; 9506 if (el.addEventListener) el.addEventListener(type, fn, useCapture); 9507 else if (el.attachEvent) { 9508 el["e" + type + fn] = fn; 9509 el[type + fn] = function() { 9510 el["e" + type + fn](window1.event); 9511 }; 9512 el.attachEvent("on" + type, el[type + fn]); 9513 } 9514 }, 9515 /** 9516 * @private 9517 * @param {HTMLElement} el 9518 * @param {string} type 9519 * @param {function} fn 9520 * @return {void} 9521 */ off: function off(el, type, fn) { 9522 if (!el) return; 9523 if (el.removeEventListener) el.removeEventListener(type, fn, false); 9524 else if (el.detachEvent) { 9525 el.detachEvent("on" + type, el[type + fn]); 9526 el[type + fn] = null; 9527 } 9528 }, 9529 /** 9530 * @private 9531 * @param {string} eventType 9532 * @param {object} detail 9533 * @param {Document} [doc] 9534 * @return {CustomEvent} 9535 */ getCustomEvent: function getCustomEvent(eventType, detail, doc) { 9536 var event = null; 9537 doc = doc || window1.document; 9538 if (typeof window1.CustomEvent === "function") event = new window1.CustomEvent(eventType, { 9539 detail: detail, 9540 bubbles: true, 9541 cancelable: true 9542 }); 9543 else if (typeof doc.createEvent === "function") { 9544 event = doc.createEvent("CustomEvent"); 9545 event.initCustomEvent(eventType, true, true, detail); 9546 } else { 9547 event = doc.createEventObject(), event.type = eventType; 9548 event.returnValue = false; 9549 event.cancelBubble = false; 9550 event.detail = detail; 9551 } 9552 return event; 9553 }, 9554 /** 9555 * @private 9556 * @param {Event} e 9557 * @return {Event} 9558 */ getOriginalEvent: function getOriginalEvent(e) { 9559 if (e.touches && e.touches.length) return e.touches[0]; 9560 else if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0]; 9561 else return e; 9562 }, 9563 /** 9564 * @private 9565 * @param {HTMLElement} el 9566 * @param {string} selector 9567 * @return {Number} 9568 */ index: function index(el, selector) { 9569 var i = 0; 9570 while((el = el.previousElementSibling) !== null)if (!selector || el.matches(selector)) ++i; 9571 return i; 9572 }, 9573 /** 9574 * Converts a dash or snake-case string to camel case. 9575 * 9576 * @private 9577 * @param {string} str 9578 * @param {boolean} [isPascal] 9579 * @return {string} 9580 */ camelCase: function camelCase(str) { 9581 return str.toLowerCase().replace(/([_-][a-z])/g, function($1) { 9582 return $1.toUpperCase().replace(/[_-]/, ""); 9583 }); 9584 }, 9585 /** 9586 * Converts a dash or snake-case string to pascal case. 9587 * 9588 * @private 9589 * @param {string} str 9590 * @param {boolean} [isPascal] 9591 * @return {string} 9592 */ pascalCase: function pascalCase(str) { 9593 return (str = this.camelCase(str)).charAt(0).toUpperCase() + str.slice(1); 9594 }, 9595 /** 9596 * Converts a camel or pascal-case string to dash case. 9597 * 9598 * @private 9599 * @param {string} str 9600 * @return {string} 9601 */ dashCase: function dashCase(str) { 9602 return str.replace(/([A-Z])/g, "-$1").replace(/^-/, "").toLowerCase(); 9603 }, 9604 /** 9605 * @private 9606 * @param {HTMLElement} el 9607 * @param {HTMLHtmlElement} [doc] 9608 * @return {boolean} 9609 */ isElement: function isElement(el, doc) { 9610 doc = doc || window1.document; 9611 if (window1.HTMLElement && el instanceof window1.HTMLElement) return true; 9612 else if (doc.defaultView && doc.defaultView.HTMLElement && el instanceof doc.defaultView.HTMLElement) return true; 9613 else return el !== null && el.nodeType === 1 && typeof el.nodeName === "string"; 9614 }, 9615 /** 9616 * @private 9617 * @param {string} htmlString 9618 * @param {HTMLHtmlElement} [doc] 9619 * @return {DocumentFragment} 9620 */ createElement: function createElement(htmlString, doc) { 9621 var frag = null, temp = null; 9622 doc = doc || window1.document; 9623 frag = doc.createDocumentFragment(); 9624 temp = doc.createElement("div"); 9625 temp.innerHTML = htmlString.trim(); 9626 while(temp.firstChild)frag.appendChild(temp.firstChild); 9627 return frag; 9628 }, 9629 /** 9630 * @private 9631 * @param {Node} node 9632 * @return {void} 9633 */ removeWhitespace: function removeWhitespace(node) { 9634 var deleting; 9635 while(node && node.nodeName === "#text"){ 9636 deleting = node; 9637 node = node.previousSibling; 9638 deleting.parentElement && deleting.parentElement.removeChild(deleting); 9639 } 9640 }, 9641 /** 9642 * @private 9643 * @param {Array<*>} a 9644 * @param {Array<*>} b 9645 * @return {boolean} 9646 */ isEqualArray: function isEqualArray(a, b) { 9647 var i = a.length; 9648 if (i !== b.length) return false;
9649 while(i--){ 9650 if (a[i] !== b[i]) return false; 9651 } 9652 return true; 9653 }, 9654 /** 9655 * @private 9656 * @param {object} a 9657 * @param {object} b 9658 * @return {boolean} 9659 */ deepEquals: function deepEquals(a, b) { 9660 var key; 9661 if (typeof a === "object" && a && typeof b === "object" && b) { 9662 if (Object.keys(a).length !== Object.keys(b).length) return false; 9663 for(key in a){ 9664 if (!b.hasOwnProperty(key) || !this.deepEquals(a[key], b[key])) return false; 9665 } 9666 } else if (a !== b) return false; 9667 return true; 9668 }, 9669 /** 9670 * @private 9671 * @param {Array<*>} oldArray 9672 * @return {Array<*>} 9673 */ arrayShuffle: function arrayShuffle(oldArray) { 9674 var newArray = oldArray.slice(), len = newArray.length, i = len, p = -1, t = []; 9675 while(i--){ 9676 p = ~~(Math.random() * len); 9677 t = newArray[i]; 9678 newArray[i] = newArray[p]; 9679 newArray[p] = t; 9680 } 9681 return newArray; 9682 }, 9683 /** 9684 * @private 9685 * @param {object} list 9686 */ arrayFromList: function arrayFromList(list) { 9687 var output, i; 9688 try { 9689 return Array.prototype.slice.call(list); 9690 } catch (err) { 9691 output = []; 9692 for(i = 0; i < list.length; i++)output.push(list[i]); 9693 return output; 9694 } 9695 }, 9696 /** 9697 * @private 9698 * @param {function} func 9699 * @param {Number} wait 9700 * @param {boolean} immediate 9701 * @return {function} 9702 */ debounce: function debounce(func, wait, immediate) { 9703 var timeout; 9704 return function() { 9705 var self = this, args = arguments, callNow = immediate && !timeout, later = null; 9706 later = function later() { 9707 timeout = null; 9708 if (!immediate) func.apply(self, args); 9709 }; 9710 clearTimeout(timeout); 9711 timeout = setTimeout(later, wait); 9712 if (callNow) func.apply(self, args); 9713 }; 9714 }, 9715 /** 9716 * @private 9717 * @param {HTMLElement} element 9718 * @return {object} 9719 */ position: function position(element) { 9720 var xPosition = 0, yPosition = 0, offsetParent = element; 9721 while(element){ 9722 xPosition -= element.scrollLeft; 9723 yPosition -= element.scrollTop; 9724 if (element === offsetParent) { 9725 xPosition += element.offsetLeft; 9726 yPosition += element.offsetTop; 9727 offsetParent = element.offsetParent; 9728 } 9729 element = element.parentElement; 9730 } 9731 return { 9732 x: xPosition, 9733 y: yPosition 9734 }; 9735 }, 9736 /** 9737 * @private 9738 * @param {object} node1 9739 * @param {object} node2 9740 * @return {Number} 9741 */ getHypotenuse: function getHypotenuse(node1, node2) { 9742 var distanceX = node1.x - node2.x, distanceY = node1.y - node2.y; 9743 distanceX = distanceX < 0 ? distanceX * -1 : distanceX, distanceY = distanceY < 0 ? distanceY * -1 : distanceY; 9744 return Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2)); 9745 }, 9746 /** 9747 * Calcuates the area of intersection between two rectangles and expresses it as 9748 * a ratio in comparison to the area of the first rectangle. 9749 * 9750 * @private 9751 * @param {Rect} box1 9752 * @param {Rect} box2 9753 * @return {number} 9754 */ getIntersectionRatio: function getIntersectionRatio(box1, box2) { 9755 var controlArea = box1.width * box1.height, intersectionX = -1, intersectionY = -1, intersectionArea = -1, ratio = -1; 9756 intersectionX = Math.max(0, Math.min(box1.left + box1.width, box2.left + box2.width) - Math.max(box1.left, box2.left)); 9757 intersectionY = Math.max(0, Math.min(box1.top + box1.height, box2.top + box2.height) - Math.max(box1.top, box2.top)); 9758 intersectionArea = intersectionY * intersectionX; 9759 ratio = intersectionArea / controlArea; 9760 return ratio; 9761 }, 9762 /** 9763 * @private 9764 * @param {object} el 9765 * @param {string} selector 9766 * @param {boolean} [includeSelf] 9767 * @param {HTMLHtmlElement} [doc] 9768 * @return {Element|null} 9769 */ closestParent: function closestParent(el, selector, includeSelf, doc) { 9770 var parent = el.parentNode; 9771 doc = doc || window1.document; 9772 if (includeSelf && el.matches(selector)) return el; 9773 while(parent && parent != doc.body){ 9774 if (parent.matches && parent.matches(selector)) return parent; 9775 else if (parent.parentNode) parent = parent.parentNode; 9776 else return null; 9777 } 9778 return null; 9779 }, 9780 /** 9781 * @private 9782 * @param {HTMLElement} el 9783 * @param {string} selector 9784 * @param {HTMLHtmlElement} [doc] 9785 * @return {NodeList} 9786 */ children: function children(el, selector, doc) { 9787 var children = [], tempId = ""; 9788 doc = doc || window1.doc; 9789 if (el) { 9790 if (!el.id) { 9791 tempId = "Temp" + this.randomHexKey(); 9792 el.id = tempId; 9793 } 9794 children = doc.querySelectorAll("#" + el.id + " > " + selector); 9795 if (tempId) el.removeAttribute("id"); 9796 } 9797 return children; 9798 }, 9799 /** 9800 * Creates a clone of a provided array, with any empty strings removed. 9801 * 9802 * @private 9803 * @param {Array<*>} originalArray 9804 * @return {Array<*>} 9805 */ clean: function clean(originalArray) { 9806 var cleanArray = [], i = -1; 9807 for(i = 0; i < originalArray.length; i++)if (originalArray[i] !== "") cleanArray.push(originalArray[i]); 9808 return cleanArray; 9809 }, 9810 /** 9811 * Abstracts an ES6 promise into a q-like deferred interface for storage and deferred resolution. 9812 * 9813 * @private 9814 * @param {object} libraries 9815 * @return {h.Deferred} 9816 */ defer: function defer(libraries) { 9817 var deferred = null, promiseWrapper = null, $ = null; 9818 promiseWrapper = new this.Deferred(); 9819 if (mixitup.features.has.promises) // ES6 native promise or polyfill 9820 promiseWrapper.promise = new Promise(function(resolve, reject) { 9821 promiseWrapper.resolve = resolve; 9822 promiseWrapper.reject = reject; 9823 }); 9824 else if (($ = window1.jQuery || libraries.$) && typeof $.Deferred === "function") { 9825 // jQuery 9826 deferred = $.Deferred(); 9827 promiseWrapper.promise = deferred.promise(); 9828 promiseWrapper.resolve = deferred.resolve; 9829 promiseWrapper.reject = deferred.reject; 9830 } else if (window1.console) // No implementation 9831 console.warn(mixitup.messages.warningNoPromiseImplementation()); 9832 return promiseWrapper; 9833 }, 9834 /** 9835 * @private 9836 * @param {Array<Promise>} tasks 9837 * @param {object} libraries 9838 * @return {Promise<Array>} 9839 */ all: function all(tasks, libraries) { 9840 var $ = null; 9841 if (mixitup.features.has.promises) return Promise.all(tasks); 9842 else if (($ = window1.jQuery || libraries.$) && typeof $.when === "function") return $.when.apply($, tasks).done(function() { 9843 // jQuery when returns spread arguments rather than an array or resolutions 9844 return arguments; 9845 }); 9846 // No implementation 9847 if (window1.console) console.warn(mixitup.messages.warningNoPromiseImplementation()); 9848 return []; 9849 }, 9850 /** 9851 * @private 9852 * @param {HTMLElement} el 9853 * @param {string} property 9854 * @param {Array<string>}
9854 vendors 9855 * @return {string} 9856 */ getPrefix: function getPrefix(el, property, vendors) { 9857 var i = -1, prefix = ""; 9858 if (h.dashCase(property) in el.style) return ""; 9859 for(i = 0; prefix = vendors[i]; i++){ 9860 if (prefix + property in el.style) return prefix.toLowerCase(); 9861 } 9862 return "unsupported"; 9863 }, 9864 /** 9865 * @private 9866 * @return {string} 9867 */ randomHex: function randomHex() { 9868 return ("00000" + (Math.random() * 16777216 << 0).toString(16)).substr(-6).toUpperCase(); 9869 }, 9870 /** 9871 * @private 9872 * @param {HTMLDocument} [doc] 9873 * @return {object} 9874 */ getDocumentState: function getDocumentState(doc) { 9875 doc = typeof doc.body === "object" ? doc : window1.document; 9876 return { 9877 scrollTop: window1.pageYOffset, 9878 scrollLeft: window1.pageXOffset, 9879 docHeight: doc.documentElement.scrollHeight, 9880 docWidth: doc.documentElement.scrollWidth, 9881 viewportHeight: doc.documentElement.clientHeight, 9882 viewportWidth: doc.documentElement.clientWidth 9883 }; 9884 }, 9885 /** 9886 * @private 9887 * @param {object} obj 9888 * @param {function} fn 9889 * @return {function} 9890 */ bind: function bind(obj, fn) { 9891 return function() { 9892 return fn.apply(obj, arguments); 9893 }; 9894 }, 9895 /** 9896 * @private 9897 * @param {HTMLElement} el 9898 * @return {boolean} 9899 */ isVisible: function isVisible(el) { 9900 var styles = null; 9901 if (el.offsetParent) return true; 9902 styles = window1.getComputedStyle(el); 9903 if (styles.position === "fixed" && styles.visibility !== "hidden" && styles.opacity !== "0") // Fixed elements report no offsetParent, 9904 // but may still be invisible 9905 return true; 9906 return false; 9907 }, 9908 /** 9909 * @private 9910 * @param {object} obj 9911 */ seal: function seal(obj) { 9912 if (typeof Object.seal === "function") Object.seal(obj); 9913 }, 9914 /** 9915 * @private 9916 * @param {object} obj 9917 */ freeze: function freeze(obj) { 9918 if (typeof Object.freeze === "function") Object.freeze(obj); 9919 }, 9920 /** 9921 * @private 9922 * @param {string} control 9923 * @param {string} specimen 9924 * @return {boolean} 9925 */ compareVersions: function compareVersions(control, specimen) { 9926 var controlParts = control.split("."), specimenParts = specimen.split("."), controlPart = -1, specimenPart = -1, i = -1; 9927 for(i = 0; i < controlParts.length; i++){ 9928 controlPart = parseInt(controlParts[i].replace(/[^\d.]/g, "")); 9929 specimenPart = parseInt(specimenParts[i].replace(/[^\d.]/g, "") || 0); 9930 if (specimenPart < controlPart) return false; 9931 else if (specimenPart > controlPart) return true; 9932 } 9933 return true; 9934 }, 9935 /** 9936 * @private 9937 * @constructor 9938 */ Deferred: function Deferred() { 9939 this.promise = null; 9940 this.resolve = null; 9941 this.reject = null; 9942 this.id = h.randomHex(); 9943 }, 9944 /** 9945 * @private 9946 * @param {object} obj 9947 * @return {boolean} 9948 */ isEmptyObject: function isEmptyObject(obj) { 9949 var key = ""; 9950 if (typeof Object.keys === "function") return Object.keys(obj).length === 0; 9951 for(key in obj){ 9952 if (obj.hasOwnProperty(key)) return false; 9953 } 9954 return true; 9955 }, 9956 /** 9957 * @param {mixitup.Config.ClassNames} classNames 9958 * @param {string} elementName 9959 * @param {string} [modifier] 9960 * @return {string} 9961 */ getClassname: function getClassname(classNames, elementName, modifier) { 9962 var classname = ""; 9963 classname += classNames.block; 9964 if (classname.length) classname += classNames.delineatorElement; 9965 classname += classNames["element" + this.pascalCase(elementName)]; 9966 if (!modifier) return classname; 9967 if (classname.length) classname += classNames.delineatorModifier; 9968 classname += modifier; 9969 return classname; 9970 }, 9971 /** 9972 * Returns the value of a property on a given object via its string key. 9973 * 9974 * @param {object} obj 9975 * @param {string} stringKey 9976 * @return {*} value
9977 */ getProperty: function getProperty(obj, stringKey) { 9978 var parts = stringKey.split("."), returnCurrent = null, current = "", i = 0; 9979 if (!stringKey) return obj; 9980 returnCurrent = function returnCurrent(obj) { 9981 if (!obj) return null; 9982 else return obj[current]; 9983 }; 9984 while(i < parts.length){ 9985 current = parts[i]; 9986 obj = returnCurrent(obj); 9987 i++; 9988 } 9989 if (typeof obj !== "undefined") return obj; 9990 else return null; 9991 } 9992 }; 9993 mixitup.h = h; 9994 /** 9995 * The Base class adds instance methods to all other extensible MixItUp classes, 9996 * enabling the calling of any registered hooks. 9997 * 9998 * @constructor 9999 * @namespace 10000 * @memberof mixitup 10001 * @private 10002 * @since 3.0.0 10003 */ mixitup.Base = function() {}; 10004 mixitup.Base.prototype = { 10005 constructor: mixitup.Base, 10006 /** 10007 * Calls any registered hooks for the provided action. 10008 * 10009 * @memberof mixitup.Base 10010 * @private 10011 * @instance 10012 * @since 2.0.0 10013 * @param {string} actionName 10014 * @param {Array<*>} args 10015 * @return {void} 10016 */ callActions: function callActions(actionName, args) { 10017 var self = this, hooks = self.constructor.actions[actionName], extensionName = ""; 10018 if (!hooks || h.isEmptyObject(hooks)) return; 10019 for(extensionName in hooks)hooks[extensionName].apply(self, args); 10020 }, 10021 /** 10022 * Calls any registered hooks for the provided filter. 10023 * 10024 * @memberof mixitup.Base 10025 * @private 10026 * @instance 10027 * @since 2.0.0 10028 * @param {string} filterName 10029 * @param {*} input 10030 * @param {Array<*>} args 10031 * @return {*} 10032 */ callFilters: function callFilters(filterName, input, args) { 10033 var self = this, hooks = self.constructor.filters[filterName], output = input, extensionName = ""; 10034 if (!hooks || h.isEmptyObject(hooks)) return output; 10035 args = args || []; 10036 for(extensionName in hooks){ 10037 args = h.arrayFromList(args); 10038 args.unshift(output); 10039 output = hooks[extensionName].apply(self, args); 10040 } 10041 return output; 10042 } 10043 }; 10044 /** 10045 * The BaseStatic class holds a set of static methods which are then added to all other 10046 * extensible MixItUp classes as a means of integrating extensions via the addition of new 10047 * methods and/or actions and hooks. 10048 * 10049 * @constructor 10050 * @namespace 10051 * @memberof mixitup 10052 * @private 10053 * @since 3.0.0 10054 */ mixitup.BaseStatic = function() { 10055 this.actions = {}; 10056 this.filters = {}; 10057 /** 10058 * Performs a shallow extend on the class's prototype, adding one or more new members to 10059 * the class in a single operation. 10060 * 10061 * @memberof mixitup.BaseStatic 10062 * @public 10063 * @static 10064 * @since 2.1.0 10065 * @param {object} extension 10066 * @return {void} 10067 */ this.extend = function(extension) { 10068 h.extend(this.prototype, extension); 10069 }; 10070 /** 10071 * Registers a function to be called on the action hook of the provided name. 10072 * 10073 * @memberof mixitup.BaseStatic 10074 * @public 10075 * @static 10076 * @since 2.1.0 10077 * @param {string} hookName 10078 * @param {string} extensionName 10079 * @param {function} func 10080 * @return {void} 10081 */ this.registerAction = function(hookName, extensionName, func) { 10082 (this.actions[hookName] = this.actions[hookName] || {})[extensionName] = func; 10083 }; 10084 /** 10085 * Registers a function to be called on the filter of the provided name. 10086 * 10087 * @memberof mixitup.BaseStatic 10088 * @public 10089 * @static 10090 * @since 2.1.0 10091 * @param {string} hookName 10092 * @param {string} extensionName 10093 * @param {function} func 10094 * @return {void} 10095 */ this.registerFilter = function(hookName, extensionName, func) { 10096 (this.filters[hookName] = this.filters[hookName] || {})[extensionName] = func; 10097 }; 10098 }; 10099 /** 10100 * The `mixitup.Features` class performs all feature and CSS prefix detection 10101 * neccessary for MixItUp to function correctly, as well as storing various 10102 * string and array constants. All feature decection is on evaluation of the 10103 * library and stored in a singleton instance for use by other internal
vendor: 11,306 bytes, lines 10103-10389
10103classes. 10104 * 10105 * @constructor 10106 * @namespace 10107 * @memberof mixitup 10108 * @private 10109 * @since 3.0.0 10110 */ mixitup.Features = function() { 10111 mixitup.Base.call(this); 10112 this.callActions("beforeConstruct"); 10113 this.boxSizingPrefix = ""; 10114 this.transformPrefix = ""; 10115 this.transitionPrefix = ""; 10116 this.boxSizingPrefix = ""; 10117 this.transformProp = ""; 10118 this.transformRule = ""; 10119 this.transitionProp = ""; 10120 this.perspectiveProp = ""; 10121 this.perspectiveOriginProp = ""; 10122 this.has = new mixitup.Has(); 10123 this.canary = null; 10124 this.BOX_SIZING_PROP = "boxSizing"; 10125 this.TRANSITION_PROP = "transition"; 10126 this.TRANSFORM_PROP = "transform"; 10127 this.PERSPECTIVE_PROP = "perspective"; 10128 this.PERSPECTIVE_ORIGIN_PROP = "perspectiveOrigin"; 10129 this.VENDORS = [ 10130 "Webkit", 10131 "moz", 10132 "O", 10133 "ms" 10134 ]; 10135 this.TWEENABLE = [ 10136 "opacity", 10137 "width", 10138 "height", 10139 "marginRight", 10140 "marginBottom", 10141 "x", 10142 "y", 10143 "scale", 10144 "translateX", 10145 "translateY", 10146 "translateZ", 10147 "rotateX", 10148 "rotateY", 10149 "rotateZ" 10150 ]; 10151 this.callActions("afterConstruct"); 10152 }; 10153 mixitup.BaseStatic.call(mixitup.Features); 10154 mixitup.Features.prototype = Object.create(mixitup.Base.prototype); 10155 h.extend(mixitup.Features.prototype, /** @lends mixitup.Features */ { 10156 constructor: mixitup.Features, 10157 /** 10158 * @private 10159 * @return {void} 10160 */ init: function init() { 10161 var self = this; 10162 self.callActions("beforeInit", arguments); 10163 self.canary = document.createElement("div"); 10164 self.setPrefixes(); 10165 self.runTests(); 10166 self.callActions("beforeInit", arguments); 10167 }, 10168 /** 10169 * @private 10170 * @return {void} 10171 */ runTests: function runTests() { 10172 var self = this; 10173 self.callActions("beforeRunTests", arguments); 10174 self.has.promises = typeof window1.Promise === "function"; 10175 self.has.transitions = self.transitionPrefix !== "unsupported"; 10176 self.callActions("afterRunTests", arguments); 10177 h.freeze(self.has); 10178 }, 10179 /** 10180 * @private 10181 * @return {void} 10182 */ setPrefixes: function setPrefixes() { 10183 var self = this; 10184 self.callActions("beforeSetPrefixes", arguments); 10185 self.transitionPrefix = h.getPrefix(self.canary, "Transition", self.VENDORS); 10186 self.transformPrefix = h.getPrefix(self.canary, "Transform", self.VENDORS); 10187 self.boxSizingPrefix = h.getPrefix(self.canary, "BoxSizing", self.VENDORS); 10188 self.boxSizingProp = self.boxSizingPrefix ? self.boxSizingPrefix + h.pascalCase(self.BOX_SIZING_PROP) : self.BOX_SIZING_PROP; 10189 self.transitionProp = self.transitionPrefix ? self.transitionPrefix + h.pascalCase(self.TRANSITION_PROP) : self.TRANSITION_PROP; 10190 self.transformProp = self.transformPrefix ? self.transformPrefix + h.pascalCase(self.TRANSFORM_PROP) : self.TRANSFORM_PROP; 10191 self.transformRule = self.transformPrefix ? "-" + self.transformPrefix + "-" + self.TRANSFORM_PROP : self.TRANSFORM_PROP; 10192 self.perspectiveProp = self.transformPrefix ? self.transformPrefix + h.pascalCase(self.PERSPECTIVE_PROP) : self.PERSPECTIVE_PROP; 10193 self.perspectiveOriginProp = self.transformPrefix ? self.transformPrefix + h.pascalCase(self.PERSPECTIVE_ORIGIN_PROP) : self.PERSPECTIVE_ORIGIN_PROP; 10194 self.callActions("afterSetPrefixes", arguments); 10195 } 10196 }); 10197 /** 10198 * @constructor 10199 * @memberof mixitup 10200 * @private 10201 * @since 3.0.0 10202 */ mixitup.Has = function() { 10203 this.transitions = false; 10204 this.promises = false; 10205 h.seal(this); 10206 }; 10207 // Assign a singleton instance to `mixitup.features` and initialise: 10208 mixitup.features = new mixitup.Features(); 10209 mixitup.features.init(); 10210 /** 10211 * A group of properties defining the mixer's animation and effects settings. 10212 * 10213 * @constructor 10214 * @memberof mixitup.Config 10215 * @name animation 10216 * @namespace 10217 * @public 10218 * @since 2.0.0 10219 */ mixitup.ConfigAnimation = function() { 10220 mixitup.Base.call(this); 10221 this.callActions("beforeConstruct"); 10222 /** 10223 * A boolean dictating whether or not animation should be enabled for the MixItUp instance. 10224 * If `false`, all operations will occur instantly and syncronously, although callback 10225 * functions and any returned promises will still be fulfilled. 10226 * 10227 * @example <caption>Example: Create a mixer with all animations disabled</caption> 10228 * var mixer = mixitup(containerEl, { 10229 * animation: { 10230 * enable: false 10231 * } 10232 * }); 10233 * 10234 * @name enable 10235 * @memberof mixitup.Config.animation 10236 * @instance 10237 * @type {boolean} 10238 * @default true 10239 */ this.enable = true; 10240 /** 10241 * A string of one or more space-seperated properties to which transitions will be 10242 * applied for all filtering animations. 10243 * 10244 * Properties can be listed any order or combination, although they will be applied in a specific 10245 * predefined order to produce consistent results. 10246 * 10247 * To learn more about available effects, experiment with our <a href="https://www.kunkalabs.com/mixitup/"> 10248 * sandbox demo</a> and try out the "Export config" button in the Animation options drop down. 10249 * 10250 * @example <caption>Example: Apply "fade" and "translateZ" effects to all animations</caption> 10251 * // As targets are filtered in and out, they will fade between 10252 * // opacity 1 and 0 and transform between translateZ(-100px) and 10253 * // translateZ(0). 10254 * 10255 * var mixer = mixitup(containerEl, { 10256 * animation: { 10257 * effects: 'fade translateZ(-100px)' 10258 * } 10259 * }); 10260 * 10261 * @name effects 10262 * @memberof mixitup.Config.animation 10263 * @instance 10264 * @type {string} 10265 * @default 'fade scale' 10266 */ this.effects = "fade scale"; 10267 /** 10268 * A string of one or more space-seperated effects to be applied only to filter-in 10269 * animations, overriding `config.animation.effects` if set. 10270 * 10271 * @example <caption>Example: Apply downwards vertical translate to targets being filtered in</caption> 10272 * 10273 * var mixer = mixitup(containerEl, { 10274 * animation: { 10275 * effectsIn: 'fade translateY(-100%)' 10276 * } 10277 * }); 10278 * 10279 * @name effectsIn 10280 * @memberof mixitup.Config.animation 10281 * @instance 10282 * @type {string} 10283 * @default '' 10284 */ this.effectsIn = ""; 10285 /** 10286 * A string of one or more space-seperated effects to be applied only to filter-out 10287 * animations, overriding `config.animation.effects` if set. 10288 * 10289 * @example <caption>Example: Apply upwards vertical translate to targets being filtered out</caption> 10290 * 10291 * var mixer = mixitup(containerEl, { 10292 * animation: { 10293 * effectsOut: 'fade translateY(-100%)' 10294 * } 10295 * }); 10296 * 10297 * @name effectsOut 10298 * @memberof mixitup.Config.animation 10299 * @instance 10300 * @type {string} 10301 * @default '' 10302 */ this.effectsOut = ""; 10303 /** 10304 * An integer dictating the duration of all MixItUp animations in milliseconds, not 10305 * including any additional delay apllied via the `'stagger'` effect. 10306 * 10307 * @example <caption>Example: Apply an animation duration of 200ms to all mixitup animations</caption> 10308 * 10309 * var mixer = mixitup(containerEl, { 10310 * animation: { 10311 * duration: 200 10312 * } 10313 * }); 10314 * 10315 * @name duration 10316 * @memberof mixitup.Config.animation 10317 * @instance 10318 * @type {number} 10319 * @default 600 10320 */ this.duration = 600; 10321 /** 10322 * A valid CSS3 transition-timing function or shorthand. For a full list of accepted 10323 * values, visit <a href="http://easings.net" target="_blank">easings.net</a>. 10324 * 10325 * @example <caption>Example 1: Apply "ease-in-out" easing to all animations</caption> 10326 * 10327 * var mixer = mixitup(containerEl, { 10328 * animation: { 10329 * easing: 'ease-in-out' 10330 * } 10331 * }); 10332 * 10333 * @example <caption>Example 2: Apply a custom "cubic-bezier" easing function to all animations</caption> 10334 * var mixer = mixitup(containerEl, { 10335 * animation: { 10336 * easing: 'cubic-bezier(0.645, 0.045, 0.355, 1)' 10337 * } 10338 * }); 10339 * 10340 * @name easing 10341 * @memberof mixitup.Config.animation 10342 * @instance 10343 * @type {string} 10344 * @default 'ease' 10345 */ this.easing = "ease"; 10346 /** 10347 * A boolean dictating whether or not to apply perspective to the MixItUp container 10348 * during animations. By default, perspective is always applied and creates the 10349 * illusion of three-dimensional space for effects such as `translateZ`, `rotateX`, 10350 * and `rotateY`. 10351 * 10352 * You may wish to disable this and define your own perspective settings via CSS. 10353 * 10354 * @example <caption>Example: Prevent perspective from being applied to any 3D transforms</caption> 10355 * var mixer = mixitup(containerEl, { 10356 * animation: { 10357 * applyPerspective: false 10358 * } 10359 * }); 10360 * 10361 * @name applyPerspective 10362 * @memberof mixitup.Config.animation 10363 * @instance 10364 * @type {bolean} 10365 * @default true 10366 */ this.applyPerspective = true; 10367 /** 10368 * The perspective distance value to be applied to the container during animations, 10369 * affecting any 3D-transform-based effects. 10370 * 10371 * @example <caption>Example: Set a perspective distance of 2000px</caption> 10372 * var mixer = mixitup(containerEl, { 10373 * animation: { 10374 * effects: 'rotateY(-25deg)', 10375 * perspectiveDistance: '2000px' 10376 * } 10377 * }); 10378 * 10379 * @name perspectiveDistance 10380 * @memberof mixitup.Config.animation 10381 * @instance 10382 * @type {string} 10383 * @default '3000px' 10384 */ this.perspectiveDistance = "3000px"; 10385 /** 10386 * The perspective-origin value to be applied to the container during animations, 10387 * affecting any 3D-transform-based effects. 10388 * 10389 * @example <caption>
10389Example: Set a perspective origin in the top-right of the container</caption> 10390 * var mixer = mixitup(containerEl, { 10391 * animation: { 10392 * effects: 'transateZ(-200px)', 10393 * perspectiveOrigin: '100% 0' 10394 * } 10395 * }); 10396 * 10397 * @name perspectiveOrigin 10398 * @memberof mixitup.Config.animation 10399 * @instance 10400 * @type {string} 10401 * @default '50% 50%' 10402 */ this.perspectiveOrigin = "50% 50%"; 10403 /** 10404 * A boolean dictating whether or not to enable the queuing of operations. 10405 * 10406 * If `true` (default), and a control is clicked or an API call is made while another 10407 * operation is progress, the operation will go into the queue and will be automatically exectuted 10408 * when the previous operaitons is finished. 10409 * 10410 * If `false`, any requested operations will be ignored, and the `onMixBusy` callback and `mixBusy` 10411 * event will be fired. If `debug.showWarnings` is enabled, a console warning will also occur. 10412 * 10413 * @example <caption>Example: Disable queuing</caption> 10414 * var mixer = mixitup(containerEl, { 10415 * animation: { 10416 * queue: false 10417 * } 10418 * }); 10419 * 10420 * @name queue 10421 * @memberof mixitup.Config.animation 10422 * @instance 10423 * @type {boolean} 10424 * @default true 10425 */ this.queue = true; 10426 /** 10427 * An integer dictacting the maximum number of operations allowed in the queue at 10428 * any time, when queuing is enabled. 10429 * 10430 * @example <caption>Example: Allow a maximum of 5 operations in the queue at any time</caption> 10431 * var mixer = mixitup(containerEl, { 10432 * animation: { 10433 * queueLimit: 5 10434 * } 10435 * }); 10436 * 10437 * @name queueLimit 10438 * @memberof mixitup.Config.animation 10439 * @instance 10440 * @type {number} 10441 * @default 3 10442 */ this.queueLimit = 3; 10443 /** 10444 * A boolean dictating whether or not to transition the height and width of the 10445 * container as elements are filtered in and out. If disabled, the container height 10446 * will change abruptly. 10447 * 10448 * It may be desirable to disable this on mobile devices as the CSS `height` and 10449 * `width` properties do not receive GPU-acceleration and can therefore cause stuttering. 10450 * 10451 * @example <caption>Example 1: Disable the transitioning of the container height and/or width</caption> 10452 * var mixer = mixitup(containerEl, { 10453 * animation: { 10454 * animateResizeContainer: false 10455 * } 10456 * }); 10457 * 10458 * @example <caption>Example 2: Disable the transitioning of the container height and/or width for mobile devices only</caption> 10459 * var mixer = mixitup(containerEl, { 10460 * animation: { 10461 * animateResizeContainer: myFeatureTests.isMobile ? false : true 10462 * } 10463 * }); 10464 * 10465 * @name animateResizeContainer 10466 * @memberof mixitup.Config.animation 10467 * @instance 10468 * @type {boolean} 10469 * @default true 10470 */ this.animateResizeContainer = true; 10471 /** 10472 * A boolean dictating whether or not to transition the height and width of target 10473 * elements as they change throughout the course of an animation. 10474 * 10475 * This is often a must for flex-box grid layouts where the size of target elements may change 10476 * depending on final their position in relation to their siblings, or for `.changeLayout()` 10477 * operations where the size of targets change between layouts. 10478 * 10479 * NB: This feature requires additional calculations and manipulation to non-hardware-accelerated 10480 * properties which may adversely affect performance on slower devices, and is therefore 10481 * disabled by default. 10482 * 10483 * @example <caption>Example: Enable the transitioning of target widths and heights</caption> 10484 * var mixer = mixitup(containerEl, { 10485 * animation: { 10486 * animateResizeTargets: true 10487 * } 10488 * }); 10489 * 10490 * @name animateResizeTargets 10491 * @memberof mixitup.Config.animation 10492 * @instance 10493 * @type {boolean} 10494 * @default false 10495 */ this.animateResizeTargets = false;
10496 /** 10497 * A custom function used to manipulate the order in which the stagger delay is 10498 * incremented when using the âstaggerâ effect. 10499 * 10500 * When using the 'stagger' effect, the delay applied to each target element is incremented 10501 * based on its index. You may create a custom function to manipulate the order in which the 10502 * delay is incremented and create engaging non-linear stagger effects. 10503 * 10504 * The function receives the index of the target element as a parameter, and must 10505 * return an integer which serves as the multiplier for the stagger delay. 10506 * 10507 * @example <caption>Example 1: Stagger target elements by column in a 3-column grid</caption> 10508 * var mixer = mixitup(containerEl, { 10509 * animation: { 10510 * effects: 'fade stagger(100ms)', 10511 * staggerSequence: function(i) { 10512 * return i % 3; 10513 * } 10514 * } 10515 * }); 10516 * 10517 * @example <caption>Example 2: Using an algorithm to produce a more complex sequence</caption> 10518 * var mixer = mixitup(containerEl, { 10519 * animation: { 10520 * effects: 'fade stagger(100ms)', 10521 * staggerSequence: function(i) { 10522 * return (2*i) - (5*((i/3) - ((1/3) * (i%3)))); 10523 * } 10524 * } 10525 * }); 10526 * 10527 * @name staggerSequence 10528 * @memberof mixitup.Config.animation 10529 * @instance 10530 * @type {function} 10531 * @default null 10532 */ this.staggerSequence = null; 10533 /** 10534 * A boolean dictating whether or not to reverse the direction of `translate` 10535 * and `rotate` transforms for elements being filtered out. 10536 * 10537 * It can be used to create carousel-like animations where elements enter and exit 10538 * from opposite directions. If enabled, the effect `translateX(-100%)` for elements 10539 * being filtered in would become `translateX(100%)` for targets being filtered out. 10540 * 10541 * This functionality can also be achieved by providing seperate effects 10542 * strings for `config.animation.effectsIn` and `config.animation.effectsOut`. 10543 * 10544 * @example <caption>Example: Reverse the desired direction on any translate/rotate effect for targets being filtered out</caption> 10545 * // Elements being filtered in will be translated from '100%' to '0' while 10546 * // elements being filtered out will be translated from 0 to '-100%' 10547 * 10548 * var mixer = mixitup(containerEl, { 10549 * animation: { 10550 * effects: 'fade translateX(100%)', 10551 * reverseOut: true, 10552 * nudge: false // Disable nudging to create a carousel-like effect 10553 * } 10554 * }); 10555 * 10556 * @name reverseOut 10557 * @memberof mixitup.Config.animation 10558 * @instance 10559 * @type {boolean} 10560 * @default false 10561 */ this.reverseOut = false;
10562 /** 10563 * A boolean dictating whether or not to "nudge" the animation path of targets 10564 * when they are being filtered in and out simulatenously. 10565 * 10566 * This has been the default behavior of MixItUp since version 1, but it 10567 * may be desirable to disable this effect when filtering directly from 10568 * one exclusive set of targets to a different exclusive set of targets, 10569 * to create a carousel-like effect, or a generally more subtle animation. 10570 * 10571 * @example <caption>Example: Disable the "nudging" of targets being filtered in and out simulatenously</caption> 10572 * 10573 * var mixer = mixitup(containerEl, { 10574 * animation: { 10575 * nudge: false 10576 * } 10577 * }); 10578 * 10579 * @name nudge 10580 * @memberof mixitup.Config.animation 10581 * @instance 10582 * @type {boolean} 10583 * @default true 10584 */ this.nudge = true; 10585 /** 10586 * A boolean dictating whether or not to clamp the height of the container while MixItUp's 10587 * geometry tests are carried out before an operation. 10588 * 10589 * To prevent scroll-bar flicker, clamping is turned on by default. But in the case where the 10590 * height of the container might affect its vertical positioning in the viewport 10591 * (e.g. a vertically-centered container), this should be turned off to ensure accurate 10592 * test results and a smooth animation. 10593 * 10594 * @example <caption>Example: Disable container height-clamping</caption> 10595 * 10596 * var mixer = mixitup(containerEl, { 10597 * animation: { 10598 * clampHeight: false 10599 * } 10600 * }); 10601 * 10602 * @name clampHeight 10603 * @memberof mixitup.Config.animation 10604 * @instance 10605 * @type {boolean} 10606 * @default true 10607 */ this.clampHeight = true; 10608 /** 10609 * A boolean dictating whether or not to clamp the width of the container while MixItUp's 10610 * geometry tests are carried out before an operation. 10611 * 10612 * To prevent scroll-bar flicker, clamping is turned on by default. But in the case where the 10613 * width of the container might affect its horitzontal positioning in the viewport 10614 * (e.g. a horizontall-centered container), this should be turned off to ensure accurate 10615 * test results and a smooth animation. 10616 * 10617 * @example <caption>Example: Disable container width-clamping</caption> 10618 * 10619 * var mixer = mixitup(containerEl, { 10620 * animation: { 10621 * clampWidth: false 10622 * } 10623 * }); 10624 * 10625 * @name clampWidth 10626 * @memberof mixitup.Config.animation 10627 * @instance 10628 * @type {boolean} 10629 * @default true 10630 */ this.clampWidth = true; 10631 this.callActions("afterConstruct"); 10632 h.seal(this); 10633 }; 10634 mixitup.BaseStatic.call(mixitup.ConfigAnimation); 10635 mixitup.ConfigAnimation.prototype = Object.create(mixitup.Base.prototype); 10636 mixitup.ConfigAnimation.prototype.constructor = mixitup.ConfigAnimation; 10637 /** 10638 * A group of properties relating to the behavior of the Mixer. 10639 * 10640 * @constructor 10641 * @memberof mixitup.Config 10642 * @name behavior 10643 * @namespace 10644 * @public 10645 * @since 3.1.12 10646 */ mixitup.ConfigBehavior = function() { 10647 mixitup.Base.call(this); 10648 this.callActions("beforeConstruct"); 10649 /** 10650 * A boolean dictating whether to allow "live" sorting of the mixer. 10651 * 10652 * Because of the expensive nature of sorting, MixItUp makes use of several 10653 * internal optimizations to skip redundant sorting operations, such as when 10654 * the newly requested sort command is the same as the active one. The caveat 10655 * to this optimization is that "live" edits to the value of a target's sorting 10656 * attribute will be ignored when requesting a re-sort by the same attribute. 10657 * 10658 * By setting to `behavior.liveSort` to `true`, the mixer will always re-sort 10659 * regardless of whether or not the sorting attribute and order have changed. 10660 * 10661 * @example <caption>Example: Enabling `liveSort` to allow for re-sorting</caption> 10662 * 10663 * var mixer = mixitup(containerEl, { 10664 * behavior: { 10665 * liveSort: true 10666 * }, 10667 * load: { 10668 * sort: 'edited:desc' 10669 * } 10670 * }); 10671 * 10672 * var target = containerEl.children[3]; 10673 * 10674 * console.log(target.getAttribute('data-edited')); // '2015-04-24' 10675 * 10676 * target.setAttribute('data-edited', '2017-08-10'); // Update the target's edited date 10677 * 10678 * mixer.sort('edited:desc') 10679 * .then(function(state) { 10680 * // The target is now at the top of the list 10681 * 10682 * console.log(state.targets[0] === target); // true 10683 * }); 10684 * 10685 * @name liveSort 10686 * @memberof mixitup.Config.behavior 10687 * @instance 10688 * @type {boolean} 10689 * @default false 10690 */ this.liveSort = false;
10691 this.callActions("afterConstruct"); 10692 h.seal(this); 10693 }; 10694 mixitup.BaseStatic.call(mixitup.ConfigBehavior); 10695 mixitup.ConfigBehavior.prototype = Object.create(mixitup.Base.prototype); 10696 mixitup.ConfigBehavior.prototype.constructor = mixitup.ConfigBehavior; 10697 /** 10698 * A group of optional callback functions to be invoked at various 10699 * points within the lifecycle of a mixer operation. 10700 * 10701 * Each function is analogous to an event of the same name triggered from the 10702 * container element, and is invoked immediately after it. 10703 * 10704 * All callback functions receive the current `state` object as their first 10705 * argument, as well as other more specific arguments described below. 10706 * 10707 * @constructor 10708 * @memberof mixitup.Config 10709 * @name callbacks 10710 * @namespace 10711 * @public 10712 * @since 2.0.0 10713 */ mixitup.ConfigCallbacks = function() { 10714 mixitup.Base.call(this); 10715 this.callActions("beforeConstruct"); 10716 /** 10717 * A callback function invoked immediately after any MixItUp operation is requested 10718 * and before animations have begun. 10719 * 10720 * A second `futureState` argument is passed to the function which represents the final 10721 * state of the mixer once the requested operation has completed. 10722 * 10723 * @example <caption>Example: Adding an `onMixStart` callback function</caption> 10724 * var mixer = mixitup(containerEl, { 10725 * callbacks: { 10726 * onMixStart: function(state, futureState) { 10727 * console.log('Starting operation...'); 10728 * } 10729 * } 10730 * }); 10731 * 10732 * @name onMixStart 10733 * @memberof mixitup.Config.callbacks 10734 * @instance 10735 * @type {function} 10736 * @default null 10737 */ this.onMixStart = null; 10738 /** 10739 * A callback function invoked when a MixItUp operation is requested while another 10740 * operation is in progress, and the animation queue is full, or queueing 10741 * is disabled. 10742 * 10743 * @example <caption>Example: Adding an `onMixBusy` callback function</caption> 10744 * var mixer = mixitup(containerEl, { 10745 * callbacks: { 10746 * onMixBusy: function(state) { 10747 * console.log('Mixer busy'); 10748 * } 10749 * } 10750 * }); 10751 * 10752 * @name onMixBusy 10753 * @memberof mixitup.Config.callbacks 10754 * @instance 10755 * @type {function} 10756 * @default null 10757 */ this.onMixBusy = null; 10758 /** 10759 * A callback function invoked after any MixItUp operation has completed, and the 10760 * state has been updated. 10761 * 10762 * @example <caption>Example: Adding an `onMixEnd` callback function</caption> 10763 * var mixer = mixitup(containerEl, { 10764 * callbacks: { 10765 * onMixEnd: function(state) { 10766 * console.log('Operation complete'); 10767 * } 10768 * } 10769 * }); 10770 * 10771 * @name onMixEnd 10772 * @memberof mixitup.Config.callbacks 10773 * @instance 10774 * @type {function} 10775 * @default null 10776 */ this.onMixEnd = null; 10777 /** 10778 * A callback function invoked whenever an operation "fails", i.e. no targets 10779 * could be found matching the requested filter. 10780 * 10781 * @example <caption>Example: Adding an `onMixFail` callback function</caption> 10782 * var mixer = mixitup(containerEl, { 10783 * callbacks: { 10784 * onMixFail: function(state) { 10785 * console.log('No items could be found matching the requested filter'); 10786 * } 10787 * } 10788 * }); 10789 * 10790 * @name onMixFail 10791 * @memberof mixitup.Config.callbacks 10792 * @instance 10793 * @type {function} 10794 * @default null 10795 */ this.onMixFail = null; 10796 /** 10797 * A callback function invoked whenever a MixItUp control is clicked, and before its 10798 * respective operation is requested. 10799 * 10800 * The clicked element is assigned to the `this` keyword within the function. The original 10801 * click event is passed to the function as the second argument, which can be useful if 10802 * using `<a>` tags as controls where the default behavior needs to be prevented. 10803 * 10804 * Returning `false` from the callback will prevent the control click from triggering 10805 * an operation. 10806 * 10807 * @example <caption>Example 1: Adding an `onMixClick` callback function</caption> 10808 * var mixer = mixitup(containerEl, { 10809 * callbacks: { 10810 * onMixClick: function(state, originalEvent) { 10811 * console.log('The control "' + this.innerText + '" was clicked'); 10812 * } 10813 * } 10814 * }); 10815 * 10816 * @example <caption>Example 2: Using `onMixClick` to manipulate the original click event</caption> 10817 * var mixer = mixitup(containerEl, { 10818 * callbacks: { 10819 * onMixClick: function(state, originalEvent) { 10820 * // Prevent original click event from bubbling up: 10821 * originalEvent.stopPropagation(); 10822 * 10823 * // Prevent default behavior of clicked element: 10824 * originalEvent.preventDefault(); 10825 * } 10826 * } 10827 * }); 10828 * 10829 * @example <caption>Example 3: Using `onMixClick` to conditionally cancel operations</caption> 10830 * var mixer = mixitup(containerEl, { 10831 * callbacks: { 10832 * onMixClick: function(state, originalEvent) { 10833 * // Perform some conditional check: 10834 * 10835 * if (myApp.isLoading) { 10836 * // By returning false, we can prevent the control click from triggering an operation. 10837 * 10838 * return false;
10839 * } 10840 * } 10841 * } 10842 * }); 10843 * 10844 * @name onMixClick 10845 * @memberof mixitup.Config.callbacks 10846 * @instance 10847 * @type {function} 10848 * @default null 10849 */ this.onMixClick = null; 10850 this.callActions("afterConstruct"); 10851 h.seal(this); 10852 }; 10853 mixitup.BaseStatic.call(mixitup.ConfigCallbacks); 10854 mixitup.ConfigCallbacks.prototype = Object.create(mixitup.Base.prototype); 10855 mixitup.ConfigCallbacks.prototype.constructor = mixitup.ConfigCallbacks; 10856 /** 10857 * A group of properties relating to clickable control elements. 10858 * 10859 * @constructor 10860 * @memberof mixitup.Config 10861 * @name controls 10862 * @namespace 10863 * @public 10864 * @since 2.0.0 10865 */ mixitup.ConfigControls = function() { 10866 mixitup.Base.call(this); 10867 this.callActions("beforeConstruct"); 10868 /** 10869 * A boolean dictating whether or not controls should be enabled for the mixer instance. 10870 * 10871 * If `true` (default behavior), MixItUp will search the DOM for any clickable elements with 10872 * `data-filter`, `data-sort` or `data-toggle` attributes, and bind them for click events. 10873 * 10874 * If `false`, no click handlers will be bound, and all functionality must therefore be performed 10875 * via the mixer's API methods. 10876 * 10877 * If you do not intend to use the default controls, setting this property to `false` will 10878 * marginally improve the startup time of your mixer instance, and will also prevent any other active 10879 * mixer instances in the DOM which are bound to controls from controlling the instance. 10880 * 10881 * @example <caption>Example: Disabling controls</caption> 10882 * var mixer = mixitup(containerEl, { 10883 * controls: { 10884 * enable: false 10885 * } 10886 * }); 10887 * 10888 * // With the default controls disabled, we can only control 10889 * // the mixer via its API methods, e.g.: 10890 * 10891 * mixer.filter('.cat-1'); 10892 * 10893 * @name enable 10894 * @memberof mixitup.Config.controls 10895 * @instance 10896 * @type {boolean} 10897 * @default true 10898 */ this.enable = true; 10899 /** 10900 * A boolean dictating whether or not to use event delegation when binding click events 10901 * to the default controls. 10902 * 10903 * If `false` (default behavior), each control button in the DOM will be found and 10904 * individually bound when a mixer is instantiated, with their corresponding actions 10905 * cached for performance. 10906 * 10907 * If `true`, a single click handler will be applied to the `window` (or container element - see 10908 * `config.controls.scope`), and any click events triggered by elements with `data-filter`, 10909 * `data-sort` or `data-toggle` attributes present will be handled as they propagate upwards. 10910 * 10911 * If you require a user interface where control buttons may be added, removed, or changed during the 10912 * lifetime of a mixer, `controls.live` should be set to `true`. There is a marginal but unavoidable 10913 * performance deficit when using live controls, as the value of each control button must be read 10914 * from the DOM in real time once the click event has propagated. 10915 * 10916 * @example <caption>Example: Setting live controls</caption> 10917 * var mixer = mixitup(containerEl, { 10918 * controls: { 10919 * live: true 10920 * } 10921 * }); 10922 * 10923 * // Control buttons can now be added, remove and changed without breaking 10924 * // the mixer's UI 10925 * 10926 * @name live 10927 * @memberof mixitup.Config.controls 10928 * @instance 10929 * @type {boolean} 10930 * @default true 10931 */ this.live = false; 10932 /** 10933 * A string dictating the "scope" to use when binding or querying the default controls. The available 10934 * values are `'global'` or `'local'`. 10935 * 10936 * When set to `'global'` (default behavior), MixItUp will query the entire document for control buttons 10937 * to bind, or delegate click events from (see `config.controls.live`). 10938 * 10939 * When set to `'local'`, MixItUp will only query (or bind click events to) its own container element. 10940 * This may be desireable if you require multiple active mixer instances within the same document, with 10941 * controls that would otherwise intefere with each other if scoped globally. 10942 * 10943 * Conversely, if you wish to control multiple instances with a single UI, you would create one 10944 * set of controls and keep the controls scope of each mixer set to `global`. 10945 * 10946 * @example <caption>Example: Setting 'local' scoped controls</caption> 10947 * var mixerOne = mixitup(containerOne, { 10948 * controls: { 10949 * scope: 'local' 10950 * } 10951 * }); 10952 * 10953 * var mixerTwo = mixitup(containerTwo, { 10954 * controls: { 10955 * scope: 'local' 10956 * } 10957 * }); 10958 * 10959 * // Both mixers can now exist within the same document with 10960 * // isolated controls placed within their container elements. 10961 * 10962 * @name scope 10963 * @memberof mixitup.Config.controls 10964 * @instance 10965 * @type {string} 10966 * @default 'global' 10967 */ this.scope = "global"; // enum: ['local' ,'global'] 10968 /** 10969 * A string dictating the type of logic to apply when concatenating the filter selectors of 10970 * active toggle buttons (i.e. any clickable element with a `data-toggle` attribute). 10971 * 10972 * If set to `'or'` (default behavior), selectors will be concatenated together as 10973 * a comma-seperated list. For example: 10974 * 10975 * `'.cat-1, .cat-2'` (shows any elements matching `'.cat-1'` OR `'.cat-2'`) 10976 * 10977 * If set to `'and'`, selectors will be directly concatenated together. For example: 10978 * 10979 * `'.cat-1.cat-2'` (shows any elements which match both `'.cat-1'` AND `'.cat-2'`) 10980 * 10981 * @example <caption>Example: Setting "and" toggle logic</caption> 10982 * var mixer = mixitup(containerEl, { 10983 * controls: { 10984 * toggleLogic: 'and' 10985 * } 10986 * }); 10987 * 10988 * @name toggleLogic 10989 * @memberof mixitup.Config.controls 10990 * @instance 10991 * @type {string} 10992 * @default 'or' 10993 */ this.toggleLogic = "or"; // enum: ['or', 'and'] 10994 /** 10995 * A string dictating the filter behavior when all toggles are inactive. 10996 * 10997 * When set to `'all'` (default behavior), *all* targets will be shown by default 10998 * when no toggles are active, or at the moment all active toggles are toggled off. 10999 * 11000 * When set to `'none'`, no targets will be shown by default when no toggles are 11001 * active, or at the moment all active toggles are toggled off. 11002 * 11003 * @example <caption>Example 1: Setting the default toggle behavior to `'all'`</caption> 11004 * var mixer = mixitup(containerEl, { 11005 * controls: { 11006 * toggleDefault: 'all' 11007 * } 11008 * }); 11009 * 11010 * mixer.toggleOn('.cat-2') 11011 * .then(function() { 11012 * // Deactivate all active toggles 11013 * 11014 * return mixer.toggleOff('.cat-2') 11015 * }) 11016 * .then(function(state) { 11017 * console.log(state.activeFilter.selector); // 'all' 11018 * console.log(state.totalShow); // 12 11019 * }); 11020 * 11021 * @example <caption>
11021Example 2: Setting the default toggle behavior to `'none'`</caption> 11022 * var mixer = mixitup(containerEl, { 11023 * controls: { 11024 * toggleDefault: 'none' 11025 * } 11026 * }); 11027 * 11028 * mixer.toggleOn('.cat-2') 11029 * .then(function() { 11030 * // Deactivate all active toggles 11031 * 11032 * return mixer.toggleOff('.cat-2') 11033 * }) 11034 * .then(function(state) { 11035 * console.log(state.activeFilter.selector); // 'none' 11036 * console.log(state.totalShow); // 0 11037 * }); 11038 * 11039 * @name toggleDefault 11040 * @memberof mixitup.Config.controls 11041 * @instance 11042 * @type {string} 11043 * @default 'all' 11044 */ this.toggleDefault = "all"; // enum: ['all', 'none'] 11045 this.callActions("afterConstruct"); 11046 h.seal(this); 11047 }; 11048 mixitup.BaseStatic.call(mixitup.ConfigControls); 11049 mixitup.ConfigControls.prototype = Object.create(mixitup.Base.prototype); 11050 mixitup.ConfigControls.prototype.constructor = mixitup.ConfigControls; 11051 /** 11052 * A group of properties defining the output and structure of class names programmatically 11053 * added to controls and containers to reflect the state of the mixer. 11054 * 11055 * Most commonly, class names are added to controls by MixItUp to indicate that 11056 * the control is active so that it can be styled accordingly - `'mixitup-control-active'` by default. 11057 * 11058 * Using a "BEM" like structure, each classname is broken into the three parts: 11059 * a block namespace (`'mixitup'`), an element name (e.g. `'control'`), and an optional modifier 11060 * name (e.g. `'active'`) reflecting the state of the element. 11061 * 11062 * By default, each part of the classname is concatenated together using single hyphens as 11063 * delineators, but this can be easily customised to match the naming convention and style of 11064 * your project. 11065 * 11066 * @constructor 11067 * @memberof mixitup.Config 11068 * @name classNames 11069 * @namespace 11070 * @public 11071 * @since 3.0.0 11072 */ mixitup.ConfigClassNames = function() { 11073 mixitup.Base.call(this); 11074 this.callActions("beforeConstruct"); 11075 /** 11076 * The "block" portion, or top-level namespace added to the start of any class names created by MixItUp. 11077 * 11078 * @example <caption>Example 1: changing the `config.classNames.block` value</caption> 11079 * var mixer = mixitup(containerEl, { 11080 * classNames: { 11081 * block: 'portfolio' 11082 * } 11083 * }); 11084 * 11085 * // Active control output: "portfolio-control-active" 11086 * 11087 * @example <caption>Example 2: Removing `config.classNames.block`</caption> 11088 * var mixer = mixitup(containerEl, { 11089 * classNames: { 11090 * block: '' 11091 * } 11092 * }); 11093 * 11094 * // Active control output: "control-active" 11095 * 11096 * @name block 11097 * @memberof mixitup.Config.classNames 11098 * @instance 11099 * @type {string} 11100 * @default 'mixitup' 11101 */ this.block = "mixitup"; 11102 /** 11103 * The "element" portion of the class name added to container. 11104 * 11105 * @name elementContainer 11106 * @memberof mixitup.Config.classNames 11107 * @instance 11108 * @type {string} 11109 * @default 'container' 11110 */ this.elementContainer = "container"; 11111 /** 11112 * The "element" portion of the class name added to filter controls. 11113 * 11114 * By default, all filter, sort, multimix and toggle controls take the same element value of `'control'`, but 11115 * each type's element value can be individually overwritten to match the unique classNames of your controls as needed. 11116 * 11117 * @example <caption>Example 1: changing the `config.classNames.elementFilter` value</caption> 11118 * var mixer = mixitup(containerEl, { 11119 * classNames: { 11120 * elementFilter: 'filter' 11121 * } 11122 * }); 11123 * 11124 * // Active filter output: "mixitup-filter-active" 11125 * 11126 * @example <caption>Example 2: changing the `config.classNames.block` and `config.classNames.elementFilter` values</caption> 11127 * var mixer = mixitup(containerEl, { 11128 * classNames: { 11129 * block: 'portfolio', 11130 * elementFilter: 'filter' 11131 * } 11132 * }); 11133 * 11134 * // Active filter output: "portfolio-filter-active" 11135 * 11136 * @name elementFilter 11137 * @memberof mixitup.Config.classNames 11138 * @instance 11139 * @type {string} 11140 * @default 'control' 11141 */ this.elementFilter = "control"; 11142 /** 11143 * The "element" portion of the class name added to sort controls. 11144 * 11145 * By default, all filter, sort, multimix and toggle controls take the same element value of `'control'`, but 11146 * each type's element value can be individually overwritten to match the unique classNames of your controls as needed. 11147 * 11148 * @example <caption>Example 1: changing the `config.classNames.elementSort` value</caption> 11149 * var mixer = mixitup(containerEl, { 11150 * classNames: { 11151 * elementSort: 'sort' 11152 * } 11153 * }); 11154 * 11155 * // Active sort output: "mixitup-sort-active" 11156 * 11157 * @example <caption>Example 2: changing the `config.classNames.block` and `config.classNames.elementSort` values</caption> 11158 * var mixer = mixitup(containerEl, { 11159 * classNames: { 11160 * block: 'portfolio', 11161 * elementSort: 'sort' 11162 * } 11163 * }); 11164 * 11165 * // Active sort output: "portfolio-sort-active" 11166 * 11167 * @name elementSort 11168 * @memberof mixitup.Config.classNames 11169 * @instance 11170 * @type {string} 11171 * @default 'control' 11172 */ this.elementSort = "control"; 11173 /** 11174 * The "element" portion of the class name added to multimix controls. 11175 * 11176 * By default, all filter, sort, multimix and toggle controls take the same element value of `'control'`, but 11177 * each type's element value can be individually overwritten to match the unique classNames of your controls as needed. 11178 * 11179 * @example <caption>Example 1: changing the `config.classNames.elementMultimix` value</caption> 11180 * var mixer = mixitup(containerEl, { 11181 * classNames: { 11182 * elementMultimix: 'multimix' 11183 * } 11184 * }); 11185 * 11186 * // Active multimix output: "mixitup-multimix-active" 11187 * 11188 * @example <caption>Example 2: changing the `config.classNames.block` and `config.classNames.elementMultimix` values</caption> 11189 * var mixer = mixitup(containerEl, { 11190 * classNames: { 11191 * block: 'portfolio', 11192 * elementSort: 'multimix' 11193 * } 11194 * }); 11195 * 11196 * // Active multimix output: "portfolio-multimix-active" 11197 * 11198 * @name elementMultimix 11199 * @memberof mixitup.Config.classNames 11200 * @instance 11201 * @type {string} 11202 * @default 'control' 11203 */ this.elementMultimix = "control"; 11204 /** 11205 * The "element" portion of the class name added to toggle controls. 11206 * 11207 * By default, all filter, sort, multimix and toggle controls take the same element value of `'control'`, but 11208 * each type's element value can be individually overwritten to match the unique classNames of your controls as needed. 11209 * 11210 * @example <caption>Example 1: changing the `config.classNames.elementToggle` value</caption> 11211 * var mixer = mixitup(containerEl, { 11212 * classNames: { 11213 * elementToggle: 'toggle' 11214 * } 11215 * }); 11216 * 11217 * // Active toggle output: "mixitup-toggle-active" 11218 * 11219 * @example <caption>Example 2: changing the `config.classNames.block` and `config.classNames.elementToggle` values</caption> 11220 * var mixer = mixitup(containerEl, { 11221 * classNames: { 11222 * block: 'portfolio', 11223 * elementToggle: 'toggle' 11224 * } 11225 * }); 11226 * 11227 * // Active toggle output: "portfolio-toggle-active" 11228 * 11229 * @name elementToggle 11230 * @memberof mixitup.Config.classNames 11231 * @instance 11232 * @type {string} 11233 * @default 'control' 11234 */ this.elementToggle = "control"; 11235 /** 11236 * The "modifier" portion of the class name added to active controls. 11237 * @name modifierActive 11238 * @memberof mixitup.Config.classNames 11239 * @instance 11240 * @type {string} 11241 * @default 'active' 11242 */ this.modifierActive = "active"; 11243 /** 11244 * The "modifier" portion of the class name added to disabled controls. 11245 * 11246 * @name modifierDisabled 11247 * @memberof mixitup.Config.classNames 11248 * @instance 11249 * @type {string} 11250 * @default 'disabled' 11251 */ this.modifierDisabled = "disabled"; 11252 /** 11253 * The "modifier" portion of the class name added to the container when in a "failed" state. 11254 * 11255 * @name modifierFailed 11256 * @memberof mixitup.Config.classNames 11257 * @instance 11258 * @type {string} 11259 * @default 'failed' 11260 */ this.modifierFailed = "failed"; 11261 /** 11262 * The delineator used between the "block" and "element" portions of any class name added by MixItUp. 11263 * 11264 * If the block portion is ommited by setting it to an empty string, no delineator will be added. 11265 * 11266 * @example <caption>Example: changing the delineator to match BEM convention</caption> 11267 * var mixer = mixitup(containerEl, { 11268 * classNames: { 11269 * delineatorElement: '__' 11270 * } 11271 * }); 11272 * 11273 * // example active control output: "mixitup__control-active" 11274 * 11275 * @name delineatorElement 11276 * @memberof mixitup.Config.classNames 11277 * @instance 11278 * @type {string} 11279 * @default '-' 11280 */ this.delineatorElement = "-"; 11281 /** 11282 * The delineator used between the "element" and "modifier" portions of any class name added by MixItUp. 11283 * 11284 * If the element portion is ommited by setting it to an empty string, no delineator will be added. 11285 * 11286 * @example <caption>Example: changing both delineators to match BEM convention</caption> 11287 * var mixer = mixitup(containerEl, { 11288 * classNames: { 11289 * delineatorElement: '__' 11290 * delineatorModifier: '--' 11291 * } 11292 * }); 11293 * 11294 * // Active control output: "mixitup__control--active" 11295 * 11296 * @name delineatorModifier 11297 * @memberof mixitup.Config.classNames 11298 * @instance 11299 * @type {string} 11300 * @default '-' 11301 */ this.delineatorModifier = "-"; 11302 this.callActions("afterConstruct"); 11303 h.seal(this); 11304 };
11305 mixitup.BaseStatic.call(mixitup.ConfigClassNames); 11306 mixitup.ConfigClassNames.prototype = Object.create(mixitup.Base.prototype); 11307 mixitup.ConfigClassNames.prototype.constructor = mixitup.ConfigClassNames; 11308 /** 11309 * A group of properties relating to MixItUp's dataset API. 11310 * 11311 * @constructor 11312 * @memberof mixitup.Config 11313 * @name data 11314 * @namespace 11315 * @public 11316 * @since 3.0.0 11317 */ mixitup.ConfigData = function() { 11318 mixitup.Base.call(this); 11319 this.callActions("beforeConstruct"); 11320 /** 11321 * A string specifying the name of the key containing your data model's unique 11322 * identifier (UID). To use the dataset API, a UID key must be specified and 11323 * be present and unique on all objects in the dataset you provide to MixItUp. 11324 * 11325 * For example, if your dataset is made up of MongoDB documents, the UID 11326 * key would be `'id'` or `'_id'`. 11327 * 11328 * @example <caption>Example: Setting the UID to `'id'`</caption> 11329 * var mixer = mixitup(containerEl, { 11330 * data: { 11331 * uidKey: 'id' 11332 * } 11333 * }); 11334 * 11335 * @name uidKey 11336 * @memberof mixitup.Config.data 11337 * @instance 11338 * @type {string} 11339 * @default '' 11340 */ this.uidKey = ""; 11341 /** 11342 * A boolean dictating whether or not MixItUp should "dirty check" each object in 11343 * your dataset for changes whenever `.dataset()` is called, and re-render any targets 11344 * for which a change is found. 11345 * 11346 * Depending on the complexity of your data model, dirty checking can be expensive 11347 * and is therefore disabled by default. 11348 * 11349 * NB: For changes to be detected, a new immutable instance of the edited model must be 11350 * provided to mixitup, rather than manipulating properties on the existing instance. 11351 * If your changes are a result of a DB write and read, you will most likely be calling 11352 * `.dataset()` with a clean set of objects each time, so this will not be an issue. 11353 * 11354 * @example <caption>Example: Enabling dirty checking</caption> 11355 * 11356 * var myDataset = [ 11357 * { 11358 * id: 0, 11359 * title: "Blog Post Title 0" 11360 * ... 11361 * }, 11362 * { 11363 * id: 1, 11364 * title: "Blog Post Title 1" 11365 * ... 11366 * } 11367 * ]; 11368 * 11369 * // Instantiate a mixer with a pre-loaded dataset, and a target renderer 11370 * // function defined 11371 * 11372 * var mixer = mixitup(containerEl, { 11373 * data: { 11374 * uidKey: 'id', 11375 * dirtyCheck: true 11376 * }, 11377 * load: { 11378 * dataset: myDataset 11379 * }, 11380 * render: { 11381 * target: function() { ... } 11382 * } 11383 * }); 11384 * 11385 * // For illustration, we will clone and edit the second object in the dataset. 11386 * // NB: this would typically be done server-side in response to a DB update, 11387 * and then re-queried via an API. 11388 * 11389 * myDataset[1] = Object.assign({}, myDataset[1]); 11390 * 11391 * myDataset[1].title = 'Blog Post Title 11'; 11392 * 11393 * mixer.dataset(myDataset) 11394 * .then(function() { 11395 * // the target with ID "1", will be re-rendered reflecting its new title 11396 * }); 11397 * 11398 * @name dirtyCheck 11399 * @memberof mixitup.Config.data 11400 * @instance 11401 * @type {boolean} 11402 * @default false 11403 */ this.dirtyCheck = false; 11404 this.callActions("afterConstruct"); 11405 h.seal(this); 11406 }; 11407 mixitup.BaseStatic.call(mixitup.ConfigData); 11408 mixitup.ConfigData.prototype = Object.create(mixitup.Base.prototype); 11409 mixitup.ConfigData.prototype.constructor = mixitup.ConfigData; 11410 /** 11411 * A group of properties allowing the toggling of various debug features. 11412 * 11413 * @constructor 11414 * @memberof mixitup.Config 11415 * @name debug 11416 * @namespace 11417 * @public 11418 * @since 3.0.0 11419 */ mixitup.ConfigDebug = function() { 11420 mixitup.Base.call(this); 11421 this.callActions("beforeConstruct"); 11422 /** 11423 * A boolean dictating whether or not the mixer instance returned by the 11424 * `mixitup()` factory function should expose private properties and methods. 11425 * 11426 * By default, mixer instances only expose their public API, but enabling 11427 * debug mode will give you access to various mixer internals which may aid 11428 * in debugging, or the authoring of extensions. 11429 * 11430 * @example <caption>Example: Enabling debug mode</caption> 11431 * 11432 * var mixer = mixitup(containerEl, { 11433 * debug: { 11434 * enable: true 11435 * } 11436 * }); 11437 * 11438 * // Private properties and methods will now be visible on the mixer instance: 11439 * 11440 * console.log(mixer); 11441 * 11442 * @name enable 11443 * @memberof mixitup.Config.debug 11444 * @instance 11445 * @type {boolean} 11446 * @default false 11447 */ this.enable = false;
11448 /** 11449 * A boolean dictating whether or not warnings should be shown when various 11450 * common gotchas occur. 11451 * 11452 * Warnings are intended to provide insights during development when something 11453 * occurs that is not a fatal, but may indicate an issue with your integration, 11454 * and are therefore turned on by default. However, you may wish to disable 11455 * them in production. 11456 * 11457 * @example <caption>Example 1: Disabling warnings</caption> 11458 * 11459 * var mixer = mixitup(containerEl, { 11460 * debug: { 11461 * showWarnings: false 11462 * } 11463 * }); 11464 * 11465 * @example <caption>Example 2: Disabling warnings based on environment</caption> 11466 * 11467 * var showWarnings = myAppConfig.environment === 'development' ? true : false; 11468 * 11469 * var mixer = mixitup(containerEl, { 11470 * debug: { 11471 * showWarnings: showWarnings 11472 * } 11473 * }); 11474 * 11475 * @name showWarnings 11476 * @memberof mixitup.Config.debug 11477 * @instance 11478 * @type {boolean} 11479 * @default true 11480 */ this.showWarnings = true; 11481 /** 11482 * Used for server-side testing only. 11483 * 11484 * @private 11485 * @name fauxAsync 11486 * @memberof mixitup.Config.debug 11487 * @instance 11488 * @type {boolean} 11489 * @default false 11490 */ this.fauxAsync = false; 11491 this.callActions("afterConstruct"); 11492 h.seal(this); 11493 }; 11494 mixitup.BaseStatic.call(mixitup.ConfigDebug); 11495 mixitup.ConfigDebug.prototype = Object.create(mixitup.Base.prototype); 11496 mixitup.ConfigDebug.prototype.constructor = mixitup.ConfigDebug; 11497 /** 11498 * A group of properties relating to the layout of the container. 11499 * 11500 * @constructor 11501 * @memberof mixitup.Config 11502 * @name layout 11503 * @namespace 11504 * @public 11505 * @since 3.0.0 11506 */ mixitup.ConfigLayout = function() { 11507 mixitup.Base.call(this); 11508 this.callActions("beforeConstruct"); 11509 /** 11510 * A boolean dictating whether or not mixitup should query all descendants 11511 * of the container for targets, or only immediate children. 11512 * 11513 * By default, mixitup will query all descendants matching the 11514 * `selectors.target` selector when indexing targets upon instantiation. 11515 * This allows for targets to be nested inside a sub-container which is 11516 * useful when ring-fencing targets from locally scoped controls in your 11517 * markup (see `controls.scope`). 11518 * 11519 * However, if you are building a more complex UI requiring the nesting 11520 * of mixers within mixers, you will most likely want to limit targets to 11521 * immediate children of the container by setting this property to `false`. 11522 * 11523 * @example <caption>Example: Restricting targets to immediate children</caption> 11524 * 11525 * var mixer = mixitup(containerEl, { 11526 * layout: { 11527 * allowNestedTargets: false 11528 * } 11529 * }); 11530 * 11531 * @name allowNestedTargets 11532 * @memberof mixitup.Config.layout 11533 * @instance 11534 * @type {boolean} 11535 * @default true 11536 */ this.allowNestedTargets = true; 11537 /** 11538 * A string specifying an optional class name to apply to the container when in 11539 * its default state. 11540 * 11541 * By changing this class name or adding a class name to the container via the 11542 * `.changeLayout()` API method, the CSS layout of the container can be changed, 11543 * and MixItUp will attemp to gracefully animate the container and its targets 11544 * between states. 11545 * 11546 * @example <caption>Example 1: Specifying a container class name</caption> 11547 * 11548 * var mixer = mixitup(containerEl, { 11549 * layout: { 11550 * containerClassName: 'grid' 11551 * } 11552 * }); 11553 * 11554 * @example <caption>Example 2: Changing the default class name with `.changeLayout()`</caption> 11555 * 11556 * var mixer = mixitup(containerEl, { 11557 * layout: { 11558 * containerClassName: 'grid' 11559 * } 11560 * }); 11561 * 11562 * mixer.changeLayout('list') 11563 * .then(function(state) { 11564 * console.log(state.activeContainerClass); // "list" 11565 * }); 11566 * 11567 * @name containerClassName 11568 * @memberof mixitup.Config.layout 11569 * @instance 11570 * @type {string} 11571 * @default '' 11572 */ this.containerClassName = ""; 11573 /** 11574 * A reference to a non-target sibling element after which to insert targets 11575 * when there are no targets in the container. 11576 * 11577 * @example <caption>Example: Setting a `siblingBefore` reference element</caption> 11578 * 11579 * var addButton = containerEl.querySelector('button'); 11580 * 11581 * var mixer = mixitup(containerEl, { 11582 * layout: { 11583 * siblingBefore: addButton 11584 * } 11585 * }); 11586 * 11587 * @name siblingBefore 11588 * @memberof mixitup.Config.layout 11589 * @instance 11590 * @type {HTMLElement} 11591 * @default null 11592 */ this.siblingBefore = null; 11593 /** 11594 * A reference to a non-target sibling element before which to insert targets 11595 * when there are no targets in the container. 11596 * 11597 * @example <caption>Example: Setting an `siblingAfter` reference element</caption> 11598 * 11599 * var gap = containerEl.querySelector('.gap'); 11600 * 11601 * var mixer = mixitup(containerEl, { 11602 * layout: { 11603 * siblingAfter: gap 11604 * } 11605 * }); 11606 * 11607 * @name siblingAfter 11608 * @memberof mixitup.Config.layout 11609 * @instance 11610 * @type {HTMLElement} 11611 * @default null 11612 */ this.siblingAfter = null; 11613 this.callActions("afterConstruct"); 11614 h.seal(this); 11615 };
11616 mixitup.BaseStatic.call(mixitup.ConfigLayout); 11617 mixitup.ConfigLayout.prototype = Object.create(mixitup.Base.prototype); 11618 mixitup.ConfigLayout.prototype.constructor = mixitup.ConfigLayout; 11619 /** 11620 * A group of properties defining the initial state of the mixer on load (instantiation). 11621 * 11622 * @constructor 11623 * @memberof mixitup.Config 11624 * @name load 11625 * @namespace 11626 * @public 11627 * @since 2.0.0 11628 */ mixitup.ConfigLoad = function() { 11629 mixitup.Base.call(this); 11630 this.callActions("beforeConstruct"); 11631 /** 11632 * A string defining any filtering to be statically applied to the mixer on load. 11633 * As per the `.filter()` API, this can be any valid selector string, or the 11634 * values `'all'` or `'none'`. 11635 * 11636 * @example <caption>Example 1: Defining an initial filter selector to be applied on load</caption> 11637 * 11638 * // The mixer will show only those targets matching '.category-a' on load. 11639 * 11640 * var mixer = mixitup(containerEl, { 11641 * load: { 11642 * filter: '.category-a' 11643 * } 11644 * }); 11645 * 11646 * @example <caption>Example 2: Hiding all targets on load</caption> 11647 * 11648 * // The mixer will show hide all targets on load. 11649 * 11650 * var mixer = mixitup(containerEl, { 11651 * load: { 11652 * filter: 'none' 11653 * } 11654 * }); 11655 * 11656 * @name filter 11657 * @memberof mixitup.Config.load 11658 * @instance 11659 * @type {string} 11660 * @default 'all' 11661 */ this.filter = "all"; 11662 /** 11663 * A string defining any sorting to be statically applied to the mixer on load. 11664 * As per the `.sort()` API, this should be a valid "sort string" made up of 11665 * an attribute to sort by (or `'default'`) followed by an optional sorting 11666 * order, or the value `'random'`; 11667 * 11668 * @example <caption>Example: Defining sorting to be applied on load</caption> 11669 * 11670 * // The mixer will sort the container by the value of the `data-published-date` 11671 * // attribute, in descending order. 11672 * 11673 * var mixer = mixitup(containerEl, { 11674 * load: { 11675 * sort: 'published-date:desc' 11676 * } 11677 * }); 11678 * 11679 * @name sort 11680 * @memberof mixitup.Config.load 11681 * @instance 11682 * @type {string} 11683 * @default 'default:asc' 11684 */ this.sort = "default:asc"; 11685 /** 11686 * An array of objects representing the underlying data of any pre-rendered targets, 11687 * when using the `.dataset()` API. 11688 * 11689 * NB: If targets are pre-rendered when the mixer is instantiated, this must be set. 11690 * 11691 * @example <caption>Example: Defining the initial underyling dataset</caption> 11692 * 11693 * var myDataset = [ 11694 * { 11695 * id: 0, 11696 * title: "Blog Post Title 0", 11697 * ... 11698 * }, 11699 * { 11700 * id: 1, 11701 * title: "Blog Post Title 1", 11702 * ... 11703 * } 11704 * ]; 11705 * 11706 * var mixer = mixitup(containerEl, { 11707 * data: { 11708 * uidKey: 'id' 11709 * }, 11710 * load: { 11711 * dataset: myDataset 11712 * } 11713 * }); 11714 * 11715 * @name dataset 11716 * @memberof mixitup.Config.load 11717 * @instance 11718 * @type {Array.<object>} 11719 * @default null 11720 */ this.dataset = null; 11721 this.callActions("afterConstruct"); 11722 h.seal(this); 11723 }; 11724 mixitup.BaseStatic.call(mixitup.ConfigLoad); 11725 mixitup.ConfigLoad.prototype = Object.create(mixitup.Base.prototype); 11726 mixitup.ConfigLoad.prototype.constructor = mixitup.ConfigLoad; 11727 /** 11728 * A group of properties defining the selectors used to query elements within a mixitup container. 11729 * 11730 * @constructor 11731 * @memberof mixitup.Config 11732 * @name selectors 11733 * @namespace 11734 * @public 11735 * @since 3.0.0 11736 */ mixitup.ConfigSelectors = function() { 11737 mixitup.Base.call(this); 11738 this.callActions("beforeConstruct"); 11739 /** 11740 * A selector string used to query and index target elements within the container. 11741 * 11742 * By default, the class selector `'.mix'` is used, but this can be changed to an 11743 * attribute or element selector to match the style of your project. 11744 * 11745 * @example <caption>Example 1: Changing the target selector</caption> 11746 * 11747 * var mixer = mixitup(containerEl, { 11748 * selectors: { 11749 * target: '.portfolio-item' 11750 * } 11751 * }); 11752 * 11753 * @example <caption>Example 2: Using an attribute selector as a target selector</caption> 11754 * 11755 * // The mixer will search for any children with the attribute `data-ref="mix"` 11756 * 11757 * var mixer = mixitup(containerEl, { 11758 * selectors: { 11759 * target: '[data-ref="mix"]' 11760 * } 11761 * }); 11762 * 11763 * @name target 11764 * @memberof mixitup.Config.selectors 11765 * @instance 11766 * @type {string} 11767 * @default '.mix' 11768 */ this.target = ".mix"; 11769 /** 11770 * A optional selector string used to add further specificity to the querying of control elements, 11771 * in addition to their mandatory data attribute (e.g. `data-filter`, `data-toggle`, `data-sort`). 11772 * 11773 * This can be used if other elements in your document must contain the above attributes 11774 * (e.g. for use in third-party scripts), and would otherwise interfere with MixItUp. Adding 11775 * an additional `control` selector of your choice allows MixItUp to restrict event handling 11776 * to only those elements matching the defined selector. 11777 * 11778 * @name control 11779 * @memberof mixitup.Config.selectors 11780 * @instance 11781 * @type {string} 11782 * @default '' 11783 * 11784 * @example <caption>Example 1: Adding a `selectors.control` selector</caption> 11785 * 11786 * var mixer = mixitup(containerEl, { 11787 * selectors: { 11788 * control: '.mixitup-control' 11789 * } 11790 * }); 11791 * 11792 * // Will not be handled: 11793 * // <button data-filter=".category-a"></button> 11794 * 11795 * // Will be handled: 11796 * // <button class="mixitup-control" data-filter=".category-a"></button> 11797 */ this.control = ""; 11798 this.callActions("afterConstruct"); 11799 h.seal(this); 11800 };
11801 mixitup.BaseStatic.call(mixitup.ConfigSelectors); 11802 mixitup.ConfigSelectors.prototype = Object.create(mixitup.Base.prototype); 11803 mixitup.ConfigSelectors.prototype.constructor = mixitup.ConfigSelectors; 11804 /** 11805 * A group of optional render functions for creating and updating elements. 11806 * 11807 * All render functions receive a data object, and should return a valid HTML string. 11808 * 11809 * @constructor 11810 * @memberof mixitup.Config 11811 * @name render 11812 * @namespace 11813 * @public 11814 * @since 3.0.0 11815 */ mixitup.ConfigRender = function() { 11816 mixitup.Base.call(this); 11817 this.callActions("beforeConstruct"); 11818 /** 11819 * A function returning an HTML string representing a target element, or a reference to a 11820 * single DOM element. 11821 * 11822 * The function is invoked as part of the `.dataset()` API, whenever a new item is added 11823 * to the dataset, or an item in the dataset changes (if `dataset.dirtyCheck` is enabled). 11824 * 11825 * The function receives the relevant dataset item as its first parameter. 11826 * 11827 * @example <caption>Example 1: Using string concatenation</caption> 11828 * 11829 * var mixer = mixitup(containerEl, { 11830 * render: { 11831 * target: function(item) { 11832 * return ( 11833 * '<div class="mix">' + 11834 * '<h2>' + item.title + '</h2>' + 11835 * '</div>' 11836 * ); 11837 * } 11838 * } 11839 * }); 11840 * 11841 * @example <caption>Example 2: Using an ES2015 template literal</caption> 11842 * 11843 * var mixer = mixitup(containerEl, { 11844 * render: { 11845 * target: function(item) { 11846 * return ( 11847 * `<div class="mix"> 11848 * <h2>${item.title}</h2> 11849 * </div>` 11850 * ); 11851 * } 11852 * } 11853 * }); 11854 * 11855 * @example <caption>Example 3: Using a Handlebars template</caption> 11856 * 11857 * var targetTemplate = Handlebars.compile('<div class="mix"><h2>{{title}}</h2></div>'); 11858 * 11859 * var mixer = mixitup(containerEl, { 11860 * render: { 11861 * target: targetTemplate 11862 * } 11863 * }); 11864 * 11865 * @example <caption>Example 4: Returning a DOM element</caption> 11866 * 11867 * var mixer = mixitup(containerEl, { 11868 * render: { 11869 * target: function(item) { 11870 * // Create a single element using your framework's built-in renderer 11871 * 11872 * var el = ... 11873 * 11874 * return el; 11875 * } 11876 * } 11877 * }); 11878 * 11879 * @name target 11880 * @memberof mixitup.Config.render 11881 * @instance 11882 * @type {function} 11883 * @default 'null' 11884 */ this.target = null; 11885 this.callActions("afterConstruct"); 11886 h.seal(this); 11887 }; 11888 mixitup.BaseStatic.call(mixitup.ConfigRender); 11889 mixitup.ConfigRender.prototype = Object.create(mixitup.Base.prototype); 11890 mixitup.ConfigRender.prototype.constructor = mixitup.ConfigRender; 11891 /** 11892 * @constructor 11893 * @memberof mixitup 11894 * @private 11895 * @since 3.0.0 11896 */ mixitup.ConfigTemplates = function() { 11897 mixitup.Base.call(this); 11898 this.callActions("beforeConstruct"); 11899 this.callActions("afterConstruct"); 11900 h.seal(this); 11901 }; 11902 mixitup.BaseStatic.call(mixitup.ConfigTemplates); 11903 mixitup.ConfigTemplates.prototype = Object.create(mixitup.Base.prototype); 11904 mixitup.ConfigTemplates.prototype.constructor = mixitup.ConfigTemplates; 11905 /** 11906 * `mixitup.Config` is an interface used for customising the functionality of a 11907 * mixer instance. It is organised into several semantically distinct sub-objects, 11908 * each one pertaining to a particular aspect of MixItUp functionality. 11909 * 11910 * An object literal containing any or all of the available properies, 11911 * known as the "configuration object", can be passed as the second parameter to 11912 * the `mixitup` factory function when creating a mixer instance to customise its 11913 * functionality as needed. 11914 * 11915 * If no configuration object is passed, the mixer instance will take on the default 11916 * configuration values detailed below. 11917 * 11918 * @example <caption>Example 1: Creating and passing the configuration object</caption> 11919 * // Create a configuration object with desired values 11920 * 11921 * var config = { 11922 * animation: { 11923 * enable: false 11924 * }, 11925 * selectors: { 11926 * target: '.item' 11927 * } 11928 * }; 11929 * 11930 * // Pass the configuration object to the mixitup factory function 11931 * 11932 * var mixer = mixitup(containerEl, config); 11933 * 11934 * @example <caption>Example 2: Passing the configuration object inline</caption> 11935 * // Typically, the configuration object is passed inline for brevity. 11936 * 11937 * var mixer = mixitup(containerEl, { 11938 * controls: { 11939 * live: true, 11940 * toggleLogic: 'and' 11941 * } 11942 * }); 11943 * 11944 * 11945 * @constructor 11946 * @memberof mixitup 11947 * @namespace 11948 * @public 11949 * @since 2.0.0 11950 */ mixitup.Config = function() { 11951 mixitup.Base.call(this); 11952 this.callActions("beforeConstruct"); 11953 this.animation = new mixitup.ConfigAnimation(); 11954 this.behavior = new mixitup.ConfigBehavior(); 11955 this.callbacks = new mixitup.ConfigCallbacks(); 11956 this.controls = new mixitup.ConfigControls(); 11957 this.classNames = new mixitup.ConfigClassNames(); 11958 this.data = new mixitup.ConfigData(); 11959 this.debug = new mixitup.ConfigDebug(); 11960 this.layout = new mixitup.ConfigLayout(); 11961 this.load = new mixitup.ConfigLoad(); 11962 this.selectors = new mixitup.ConfigSelectors(); 11963 this.render = new mixitup.ConfigRender(); 11964 this.templates = new mixitup.ConfigTemplates(); 11965 this.callActions("afterConstruct"); 11966 h.seal(this); 11967 };
11968 mixitup.BaseStatic.call(mixitup.Config); 11969 mixitup.Config.prototype = Object.create(mixitup.Base.prototype); 11970 mixitup.Config.prototype.constructor = mixitup.Config; 11971 /** 11972 * @constructor 11973 * @memberof mixitup 11974 * @private 11975 * @since 3.0.0 11976 */ mixitup.MixerDom = function() { 11977 mixitup.Base.call(this); 11978 this.callActions("beforeConstruct"); 11979 this.document = null; 11980 this.body = null; 11981 this.container = null; 11982 this.parent = null; 11983 this.targets = []; 11984 this.callActions("afterConstruct"); 11985 h.seal(this); 11986 }; 11987 mixitup.BaseStatic.call(mixitup.MixerDom); 11988 mixitup.MixerDom.prototype = Object.create(mixitup.Base.prototype); 11989 mixitup.MixerDom.prototype.constructor = mixitup.MixerDom; 11990 /** 11991 * @constructor 11992 * @memberof mixitup 11993 * @private 11994 * @since 3.0.0 11995 */ mixitup.UiClassNames = function() { 11996 mixitup.Base.call(this); 11997 this.callActions("beforeConstruct"); 11998 this.base = ""; 11999 this.active = ""; 12000 this.disabled = ""; 12001 this.callActions("afterConstruct"); 12002 h.seal(this); 12003 }; 12004 mixitup.BaseStatic.call(mixitup.UiClassNames); 12005 mixitup.UiClassNames.prototype = Object.create(mixitup.Base.prototype); 12006 mixitup.UiClassNames.prototype.constructor = mixitup.UiClassNames; 12007 /** 12008 * An object into which all arbitrary arguments sent to '.dataset()' are mapped. 12009 * 12010 * @constructor 12011 * @memberof mixitup 12012 * @private 12013 * @since 3.0.0 12014 */ mixitup.CommandDataset = function() { 12015 mixitup.Base.call(this); 12016 this.callActions("beforeConstruct"); 12017 this.dataset = null; 12018 this.callActions("afterConstruct"); 12019 h.seal(this); 12020 }; 12021 mixitup.BaseStatic.call(mixitup.CommandDataset); 12022 mixitup.CommandDataset.prototype = Object.create(mixitup.Base.prototype); 12023 mixitup.CommandDataset.prototype.constructor = mixitup.CommandDataset; 12024 /** 12025 * An object into which all arbitrary arguments sent to '.multimix()' are mapped. 12026 * 12027 * @constructor 12028 * @memberof mixitup 12029 * @private 12030 * @since 3.0.0 12031 */ mixitup.CommandMultimix = function() { 12032 mixitup.Base.call(this); 12033 this.callActions("beforeConstruct"); 12034 this.filter = null; 12035 this.sort = null; 12036 this.insert = null; 12037 this.remove = null; 12038 this.changeLayout = null; 12039 this.callActions("afterConstruct"); 12040 h.seal(this); 12041 }; 12042 mixitup.BaseStatic.call(mixitup.CommandMultimix); 12043 mixitup.CommandMultimix.prototype = Object.create(mixitup.Base.prototype); 12044 mixitup.CommandMultimix.prototype.constructor = mixitup.CommandMultimix; 12045 /** 12046 * An object into which all arbitrary arguments sent to '.filter()' are mapped. 12047 * 12048 * @constructor 12049 * @memberof mixitup 12050 * @private 12051 * @since 3.0.0 12052 */ mixitup.CommandFilter = function() { 12053 mixitup.Base.call(this); 12054 this.callActions("beforeConstruct"); 12055 this.selector = ""; 12056 this.collection = null; 12057 this.action = "show"; // enum: ['show', 'hide'] 12058 this.callActions("afterConstruct"); 12059 h.seal(this); 12060 }; 12061 mixitup.BaseStatic.call(mixitup.CommandFilter); 12062 mixitup.CommandFilter.prototype = Object.create(mixitup.Base.prototype); 12063 mixitup.CommandFilter.prototype.constructor = mixitup.CommandFilter; 12064 /** 12065 * An object into which all arbitrary arguments sent to '.sort()' are mapped. 12066 * 12067 * @constructor 12068 * @memberof mixitup 12069 * @private 12070 * @since 3.0.0 12071 */ mixitup.CommandSort = function() { 12072 mixitup.Base.call(this); 12073 this.callActions("beforeConstruct"); 12074 this.sortString = ""; 12075 this.attribute = ""; 12076 this.order = "asc"; 12077 this.collection = null; 12078 this.next = null; 12079 this.callActions("afterConstruct"); 12080 h.seal(this); 12081 }; 12082 mixitup.BaseStatic.call(mixitup.CommandSort); 12083 mixitup.CommandSort.prototype = Object.create(mixitup.Base.prototype); 12084 mixitup.CommandSort.prototype.constructor = mixitup.CommandSort; 12085 /** 12086 * An object into which all arbitrary arguments sent to '.insert()' are mapped. 12087 * 12088 * @constructor 12089 * @memberof mixitup 12090 * @private 12091 * @since 3.0.0 12092 */ mixitup.CommandInsert = function() { 12093 mixitup.Base.call(this); 12094 this.callActions("beforeConstruct"); 12095 this.index = 0; 12096 this.collection = []; 12097 this.position = "before"; // enum: ['before', 'after'] 12098 this.sibling = null; 12099 this.callActions("afterConstruct"); 12100 h.seal(this); 12101 };
vendor: 5,373 bytes, lines 12102-12234
12102 mixitup.BaseStatic.call(mixitup.CommandInsert); 12103 mixitup.CommandInsert.prototype = Object.create(mixitup.Base.prototype); 12104 mixitup.CommandInsert.prototype.constructor = mixitup.CommandInsert; 12105 /** 12106 * An object into which all arbitrary arguments sent to '.remove()' are mapped. 12107 * 12108 * @constructor 12109 * @memberof mixitup 12110 * @private 12111 * @since 3.0.0 12112 */ mixitup.CommandRemove = function() { 12113 mixitup.Base.call(this); 12114 this.callActions("beforeConstruct"); 12115 this.targets = []; 12116 this.collection = []; 12117 this.callActions("afterConstruct"); 12118 h.seal(this); 12119 }; 12120 mixitup.BaseStatic.call(mixitup.CommandRemove); 12121 mixitup.CommandRemove.prototype = Object.create(mixitup.Base.prototype); 12122 mixitup.CommandRemove.prototype.constructor = mixitup.CommandRemove; 12123 /** 12124 * An object into which all arbitrary arguments sent to '.changeLayout()' are mapped. 12125 * 12126 * @constructor 12127 * @memberof mixitup 12128 * @private 12129 * @since 3.0.0 12130 */ mixitup.CommandChangeLayout = function() { 12131 mixitup.Base.call(this); 12132 this.callActions("beforeConstruct"); 12133 this.containerClassName = ""; 12134 this.callActions("afterConstruct"); 12135 h.seal(this); 12136 }; 12137 mixitup.BaseStatic.call(mixitup.CommandChangeLayout); 12138 mixitup.CommandChangeLayout.prototype = Object.create(mixitup.Base.prototype); 12139 mixitup.CommandChangeLayout.prototype.constructor = mixitup.CommandChangeLayout; 12140 /** 12141 * @constructor 12142 * @memberof mixitup 12143 * @private 12144 * @since 3.0.0 12145 * @param {string} type 12146 * @param {string} selector 12147 * @param {boolean} [live] 12148 * @param {string} [parent] 12149 * An optional string representing the name of the mixer.dom property containing a reference to a parent element. 12150 */ mixitup.ControlDefinition = function(type, selector, live, parent) { 12151 mixitup.Base.call(this); 12152 this.callActions("beforeConstruct"); 12153 this.type = type; 12154 this.selector = selector; 12155 this.live = live || false; 12156 this.parent = parent || ""; 12157 this.callActions("afterConstruct"); 12158 h.freeze(this); 12159 h.seal(this); 12160 }; 12161 mixitup.BaseStatic.call(mixitup.ControlDefinition); 12162 mixitup.ControlDefinition.prototype = Object.create(mixitup.Base.prototype); 12163 mixitup.ControlDefinition.prototype.constructor = mixitup.ControlDefinition; 12164 mixitup.controlDefinitions = []; 12165 mixitup.controlDefinitions.push(new mixitup.ControlDefinition("multimix", "[data-filter][data-sort]")); 12166 mixitup.controlDefinitions.push(new mixitup.ControlDefinition("filter", "[data-filter]")); 12167 mixitup.controlDefinitions.push(new mixitup.ControlDefinition("sort", "[data-sort]")); 12168 mixitup.controlDefinitions.push(new mixitup.ControlDefinition("toggle", "[data-toggle]")); 12169 /** 12170 * @constructor 12171 * @memberof mixitup 12172 * @private 12173 * @since 3.0.0 12174 */ mixitup.Control = function() { 12175 mixitup.Base.call(this); 12176 this.callActions("beforeConstruct"); 12177 this.el = null; 12178 this.selector = ""; 12179 this.bound = []; 12180 this.pending = -1; 12181 this.type = ""; 12182 this.status = "inactive"; // enum: ['inactive', 'active', 'disabled', 'live'] 12183 this.filter = ""; 12184 this.sort = ""; 12185 this.canDisable = false; 12186 this.handler = null; 12187 this.classNames = new mixitup.UiClassNames(); 12188 this.callActions("afterConstruct"); 12189 h.seal(this); 12190 }; 12191 mixitup.BaseStatic.call(mixitup.Control); 12192 mixitup.Control.prototype = Object.create(mixitup.Base.prototype); 12193 h.extend(mixitup.Control.prototype, /** @lends mixitup.Control */ { 12194 constructor: mixitup.Control, 12195 /** 12196 * @private 12197 * @param {HTMLElement} el 12198 * @param {string} type 12199 * @param {string} selector 12200 */ init: function init(el, type, selector) { 12201 var self = this; 12202 this.callActions("beforeInit", arguments); 12203 self.el = el; 12204 self.type = type; 12205 self.selector = selector; 12206 if (self.selector) self.status = "live"; 12207 else { 12208 self.canDisable = typeof self.el.disable === "boolean"; 12209 switch(self.type){ 12210 case "filter": 12211 self.filter = self.el.getAttribute("data-filter"); 12212 break; 12213 case "toggle": 12214 self.filter = self.el.getAttribute("data-toggle"); 12215 break; 12216 case "sort": 12217 self.sort = self.el.getAttribute("data-sort"); 12218 break; 12219 case "multimix": 12220 self.filter = self.el.getAttribute("data-filter"); 12221 self.sort = self.el.getAttribute("data-sort"); 12222 break; 12223 } 12224 } 12225 self.bindClick(); 12226 mixitup.controls.push(self); 12227 this.callActions("afterInit", arguments); 12228 }, 12229 /** 12230 * @private 12231 * @param {mixitup.Mixer} mixer 12232 * @return {boolean} 12233 */ isBound: function isBound(mixer) { 12234 var self = this, isBound = false;
12235 this.callActions("beforeIsBound", arguments); 12236 isBound = self.bound.indexOf(mixer) > -1; 12237 return self.callFilters("afterIsBound", isBound, arguments); 12238 }, 12239 /** 12240 * @private 12241 * @param {mixitup.Mixer} mixer 12242 * @return {void} 12243 */ addBinding: function addBinding(mixer) { 12244 var self = this; 12245 this.callActions("beforeAddBinding", arguments); 12246 if (!self.isBound()) self.bound.push(mixer); 12247 this.callActions("afterAddBinding", arguments); 12248 }, 12249 /** 12250 * @private 12251 * @param {mixitup.Mixer} mixer 12252 * @return {void} 12253 */ removeBinding: function removeBinding(mixer) { 12254 var self = this, removeIndex = -1; 12255 this.callActions("beforeRemoveBinding", arguments); 12256 if ((removeIndex = self.bound.indexOf(mixer)) > -1) self.bound.splice(removeIndex, 1); 12257 if (self.bound.length < 1) { 12258 // No bindings exist, unbind event click handlers 12259 self.unbindClick(); 12260 // Remove from `mixitup.controls` list 12261 removeIndex = mixitup.controls.indexOf(self); 12262 mixitup.controls.splice(removeIndex, 1); 12263 if (self.status === "active") self.renderStatus(self.el, "inactive"); 12264 } 12265 this.callActions("afterRemoveBinding", arguments); 12266 }, 12267 /** 12268 * @private 12269 * @return {void} 12270 */ bindClick: function bindClick() { 12271 var self = this; 12272 this.callActions("beforeBindClick", arguments); 12273 self.handler = function(e) { 12274 self.handleClick(e); 12275 }; 12276 h.on(self.el, "click", self.handler); 12277 this.callActions("afterBindClick", arguments); 12278 }, 12279 /** 12280 * @private 12281 * @return {void} 12282 */ unbindClick: function unbindClick() { 12283 var self = this; 12284 this.callActions("beforeUnbindClick", arguments); 12285 h.off(self.el, "click", self.handler); 12286 self.handler = null; 12287 this.callActions("afterUnbindClick", arguments); 12288 }, 12289 /** 12290 * @private 12291 * @param {MouseEvent} e 12292 * @return {void} 12293 */ handleClick: function handleClick(e) { 12294 var self = this, button = null, mixer = null, isActive = false, returnValue = void 0, command = {}, clone = null, commands = [], i = -1; 12295 this.callActions("beforeHandleClick", arguments); 12296 this.pending = 0; 12297 mixer = self.bound[0]; 12298 if (!self.selector) button = self.el; 12299 else button = h.closestParent(e.target, mixer.config.selectors.control + self.selector, true, mixer.dom.document); 12300 if (!button) { 12301 self.callActions("afterHandleClick", arguments); 12302 return; 12303 } 12304 switch(self.type){ 12305 case "filter": 12306 command.filter = self.filter || button.getAttribute("data-filter"); 12307 break; 12308 case "sort": 12309 command.sort = self.sort || button.getAttribute("data-sort"); 12310 break; 12311 case "multimix": 12312 command.filter = self.filter || button.getAttribute("data-filter"); 12313 command.sort = self.sort || button.getAttribute("data-sort"); 12314 break; 12315 case "toggle": 12316 command.filter = self.filter || button.getAttribute("data-toggle"); 12317 if (self.status === "live") isActive = h.hasClass(button, self.classNames.active); 12318 else isActive = self.status === "active"; 12319 break; 12320 } 12321 for(i = 0; i < self.bound.length; i++){ 12322 // Create a clone of the command for each bound mixer instance 12323 clone = new mixitup.CommandMultimix(); 12324 h.extend(clone, command); 12325 commands.push(clone); 12326 } 12327 commands = self.callFilters("commandsHandleClick", commands, arguments); 12328 self.pending = self.bound.length; 12329 for(i = 0; mixer = self.bound[i]; i++){ 12330 command = commands[i]; 12331 if (!command) continue; 12332 if (!mixer.lastClicked) mixer.lastClicked = button; 12333 mixitup.events.fire("mixClick", mixer.dom.container, { 12334 state: mixer.state, 12335 instance: mixer, 12336 originalEvent: e, 12337 control: mixer.lastClicked 12338 }, mixer.dom.document); 12339 if (typeof mixer.config.callbacks.onMixClick === "function") { 12340 returnValue = mixer.config.callbacks.onMixClick.call(mixer.lastClicked, mixer.state, e, mixer); 12341 if (returnValue === false) continue; 12342 } 12343 if (self.type === "toggle") isActive ? mixer.toggleOff(command.filter) : mixer.toggleOn(command.filter); 12344 else mixer.multimix(command); 12345 } 12346 this.callActions("afterHandleClick", arguments); 12347 }, 12348 /** 12349 * @param {object} command 12350 * @param {Array<string>} toggleArray 12351 * @return {void} 12352 */ update: function update(command, toggleArray) { 12353 var self = this, actions = new mixitup.CommandMultimix(); 12354 self.callActions("beforeUpdate", arguments); 12355 self.pending--; 12356 self.pending = Math.max(0, self.pending); 12357 if (self.pending > 0) return;
12358 if (self.status === "live") // Live control (status unknown) 12359 self.updateLive(command, toggleArray); 12360 else { 12361 // Static control 12362 actions.sort = self.sort; 12363 actions.filter = self.filter; 12364 self.callFilters("actionsUpdate", actions, arguments); 12365 self.parseStatusChange(self.el, command, actions, toggleArray); 12366 } 12367 self.callActions("afterUpdate", arguments); 12368 }, 12369 /** 12370 * @param {mixitup.CommandMultimix} command 12371 * @param {Array<string>} toggleArray 12372 * @return {void} 12373 */ updateLive: function updateLive(command, toggleArray) { 12374 var self = this, controlButtons = null, actions = null, button = null, i = -1; 12375 self.callActions("beforeUpdateLive", arguments); 12376 if (!self.el) return; 12377 controlButtons = self.el.querySelectorAll(self.selector); 12378 for(i = 0; button = controlButtons[i]; i++){ 12379 actions = new mixitup.CommandMultimix(); 12380 switch(self.type){ 12381 case "filter": 12382 actions.filter = button.getAttribute("data-filter"); 12383 break; 12384 case "sort": 12385 actions.sort = button.getAttribute("data-sort"); 12386 break; 12387 case "multimix": 12388 actions.filter = button.getAttribute("data-filter"); 12389 actions.sort = button.getAttribute("data-sort"); 12390 break; 12391 case "toggle": 12392 actions.filter = button.getAttribute("data-toggle"); 12393 break; 12394 } 12395 actions = self.callFilters("actionsUpdateLive", actions, arguments); 12396 self.parseStatusChange(button, command, actions, toggleArray); 12397 } 12398 self.callActions("afterUpdateLive", arguments); 12399 }, 12400 /** 12401 * @param {HTMLElement} button 12402 * @param {mixitup.CommandMultimix} command 12403 * @param {mixitup.CommandMultimix} actions 12404 * @param {Array<string>} toggleArray 12405 * @return {void} 12406 */ parseStatusChange: function parseStatusChange(button, command, actions, toggleArray) { 12407 var self = this, alias = "", toggle = "", i = -1; 12408 self.callActions("beforeParseStatusChange", arguments); 12409 switch(self.type){ 12410 case "filter": 12411 if (command.filter === actions.filter) self.renderStatus(button, "active"); 12412 else self.renderStatus(button, "inactive"); 12413 break; 12414 case "multimix": 12415 if (command.sort === actions.sort && command.filter === actions.filter) self.renderStatus(button, "active"); 12416 else self.renderStatus(button, "inactive"); 12417 break; 12418 case "sort": 12419 if (command.sort.match(/:asc/g)) alias = command.sort.replace(/:asc/g, ""); 12420 if (command.sort === actions.sort || alias === actions.sort) self.renderStatus(button, "active"); 12421 else self.renderStatus(button, "inactive"); 12422 break; 12423 case "toggle": 12424 if (toggleArray.length < 1) self.renderStatus(button, "inactive"); 12425 if (command.filter === actions.filter) self.renderStatus(button, "active"); 12426 for(i = 0; i < toggleArray.length; i++){ 12427 toggle = toggleArray[i]; 12428 if (toggle === actions.filter) { 12429 // Button matches one active toggle 12430 self.renderStatus(button, "active"); 12431 break; 12432 } 12433 self.renderStatus(button, "inactive"); 12434 } 12435 break; 12436 } 12437 self.callActions("afterParseStatusChange", arguments); 12438 }, 12439 /** 12440 * @param {HTMLElement} button 12441 * @param {string} status 12442 * @return {void}
vendor: 6,659 bytes, lines 12443-12619
12443 */ renderStatus: function renderStatus(button, status) { 12444 var self = this; 12445 self.callActions("beforeRenderStatus", arguments); 12446 switch(status){ 12447 case "active": 12448 h.addClass(button, self.classNames.active); 12449 h.removeClass(button, self.classNames.disabled); 12450 if (self.canDisable) self.el.disabled = false; 12451 break; 12452 case "inactive": 12453 h.removeClass(button, self.classNames.active); 12454 h.removeClass(button, self.classNames.disabled); 12455 if (self.canDisable) self.el.disabled = false; 12456 break; 12457 case "disabled": 12458 if (self.canDisable) self.el.disabled = true; 12459 h.addClass(button, self.classNames.disabled); 12460 h.removeClass(button, self.classNames.active); 12461 break; 12462 } 12463 if (self.status !== "live") // Update the control's status propery if not live 12464 self.status = status; 12465 self.callActions("afterRenderStatus", arguments); 12466 } 12467 }); 12468 mixitup.controls = []; 12469 /** 12470 * @constructor 12471 * @memberof mixitup 12472 * @private 12473 * @since 3.0.0 12474 */ mixitup.StyleData = function() { 12475 mixitup.Base.call(this); 12476 this.callActions("beforeConstruct"); 12477 this.x = 0; 12478 this.y = 0; 12479 this.top = 0; 12480 this.right = 0; 12481 this.bottom = 0; 12482 this.left = 0; 12483 this.width = 0; 12484 this.height = 0; 12485 this.marginRight = 0; 12486 this.marginBottom = 0; 12487 this.opacity = 0; 12488 this.scale = new mixitup.TransformData(); 12489 this.translateX = new mixitup.TransformData(); 12490 this.translateY = new mixitup.TransformData(); 12491 this.translateZ = new mixitup.TransformData(); 12492 this.rotateX = new mixitup.TransformData(); 12493 this.rotateY = new mixitup.TransformData(); 12494 this.rotateZ = new mixitup.TransformData(); 12495 this.callActions("afterConstruct"); 12496 h.seal(this); 12497 }; 12498 mixitup.BaseStatic.call(mixitup.StyleData); 12499 mixitup.StyleData.prototype = Object.create(mixitup.Base.prototype); 12500 mixitup.StyleData.prototype.constructor = mixitup.StyleData; 12501 /** 12502 * @constructor 12503 * @memberof mixitup 12504 * @private 12505 * @since 3.0.0 12506 */ mixitup.TransformData = function() { 12507 mixitup.Base.call(this); 12508 this.callActions("beforeConstruct"); 12509 this.value = 0; 12510 this.unit = ""; 12511 this.callActions("afterConstruct"); 12512 h.seal(this); 12513 }; 12514 mixitup.BaseStatic.call(mixitup.TransformData); 12515 mixitup.TransformData.prototype = Object.create(mixitup.Base.prototype); 12516 mixitup.TransformData.prototype.constructor = mixitup.TransformData; 12517 /** 12518 * @constructor 12519 * @memberof mixitup 12520 * @private 12521 * @since 3.0.0 12522 */ mixitup.TransformDefaults = function() { 12523 mixitup.StyleData.apply(this); 12524 this.callActions("beforeConstruct"); 12525 this.scale.value = 0.01; 12526 this.scale.unit = ""; 12527 this.translateX.value = 20; 12528 this.translateX.unit = "px"; 12529 this.translateY.value = 20; 12530 this.translateY.unit = "px"; 12531 this.translateZ.value = 20; 12532 this.translateZ.unit = "px"; 12533 this.rotateX.value = 90; 12534 this.rotateX.unit = "deg"; 12535 this.rotateY.value = 90; 12536 this.rotateY.unit = "deg"; 12537 this.rotateX.value = 90; 12538 this.rotateX.unit = "deg"; 12539 this.rotateZ.value = 180; 12540 this.rotateZ.unit = "deg"; 12541 this.callActions("afterConstruct"); 12542 h.seal(this); 12543 }; 12544 mixitup.BaseStatic.call(mixitup.TransformDefaults); 12545 mixitup.TransformDefaults.prototype = Object.create(mixitup.StyleData.prototype); 12546 mixitup.TransformDefaults.prototype.constructor = mixitup.TransformDefaults; 12547 /** 12548 * @private 12549 * @static 12550 * @since 3.0.0 12551 * @type {mixitup.TransformDefaults} 12552 */ mixitup.transformDefaults = new mixitup.TransformDefaults(); 12553 /** 12554 * @constructor 12555 * @memberof mixitup 12556 * @private 12557 * @since 3.0.0 12558 */ mixitup.EventDetail = function() { 12559 this.state = null; 12560 this.futureState = null; 12561 this.instance = null; 12562 this.originalEvent = null; 12563 }; 12564 /** 12565 * The `mixitup.Events` class contains all custom events dispatched by MixItUp at various 12566 * points within the lifecycle of a mixer operation. 12567 * 12568 * Each event is analogous to the callback function of the same name defined in 12569 * the `callbacks` configuration object, and is triggered immediately before it. 12570 * 12571 * Events are always triggered from the container element on which MixItUp is instantiated 12572 * upon. 12573 * 12574 * As with any event, registered event handlers receive the event object as a parameter 12575 * which includes a `detail` property containting references to the current `state`, 12576 * the `mixer` instance, and other event-specific properties described below. 12577 * 12578 * @constructor 12579 * @namespace 12580 * @memberof mixitup 12581 * @public 12582 * @since 3.0.0 12583 */ mixitup.Events = function() { 12584 mixitup.Base.call(this); 12585 this.callActions("beforeConstruct"); 12586 /** 12587 * A custom event triggered immediately after any MixItUp operation is requested 12588 * and before animations have begun. 12589 * 12590 * The `mixStart` event also exposes a `futureState` property via the 12591 * `event.detail` object, which represents the final state of the mixer once 12592 * the requested operation has completed. 12593 * 12594 * @name mixStart 12595 * @memberof mixitup.Events 12596 * @static 12597 * @type {CustomEvent} 12598 */ this.mixStart = null; 12599 /** 12600 * A custom event triggered when a MixItUp operation is requested while another 12601 * operation is in progress, and the animation queue is full, or queueing 12602 * is disabled. 12603 * 12604 * @name mixBusy 12605 * @memberof mixitup.Events 12606 * @static 12607 * @type {CustomEvent} 12608 */ this.mixBusy = null; 12609 /** 12610 * A custom event triggered after any MixItUp operation has completed, and the 12611 * state has been updated. 12612 * 12613 * @name mixEnd 12614 * @memberof mixitup.Events 12615 * @static 12616 * @type {CustomEvent} 12617 */ this.mixEnd = null; 12618 /** 12619 * A custom event triggered whenever a filter operation "fail
12619s", i.e. no targets 12620 * could be found matching the requested filter. 12621 * 12622 * @name mixFail 12623 * @memberof mixitup.Events 12624 * @static 12625 * @type {CustomEvent} 12626 */ this.mixFail = null; 12627 /** 12628 * A custom event triggered whenever a MixItUp control is clicked, and before its 12629 * respective operation is requested. 12630 * 12631 * This event also exposes an `originalEvent` property via the `event.detail` 12632 * object, which holds a reference to the original click event. 12633 * 12634 * @name mixClick 12635 * @memberof mixitup.Events 12636 * @static 12637 * @type {CustomEvent} 12638 */ this.mixClick = null; 12639 this.callActions("afterConstruct"); 12640 h.seal(this); 12641 }; 12642 mixitup.BaseStatic.call(mixitup.Events); 12643 mixitup.Events.prototype = Object.create(mixitup.Base.prototype); 12644 mixitup.Events.prototype.constructor = mixitup.Events; 12645 /** 12646 * @private 12647 * @param {string} eventType 12648 * @param {Element} el 12649 * @param {object} detail 12650 * @param {Document} [doc] 12651 */ mixitup.Events.prototype.fire = function(eventType, el, detail, doc) { 12652 var self = this, event = null, eventDetail = new mixitup.EventDetail(); 12653 self.callActions("beforeFire", arguments); 12654 if (typeof self[eventType] === "undefined") throw new Error('Event type "' + eventType + '" not found.'); 12655 eventDetail.state = new mixitup.State(); 12656 h.extend(eventDetail.state, detail.state); 12657 if (detail.futureState) { 12658 eventDetail.futureState = new mixitup.State(); 12659 h.extend(eventDetail.futureState, detail.futureState); 12660 } 12661 eventDetail.instance = detail.instance; 12662 if (detail.originalEvent) eventDetail.originalEvent = detail.originalEvent; 12663 event = h.getCustomEvent(eventType, eventDetail, doc); 12664 self.callFilters("eventFire", event, arguments); 12665 el.dispatchEvent(event); 12666 }; 12667 // Asign a singleton instance to `mixitup.events`: 12668 mixitup.events = new mixitup.Events(); 12669 /** 12670 * @constructor 12671 * @memberof mixitup 12672 * @private 12673 * @since 3.0.0 12674 */ mixitup.QueueItem = function() { 12675 mixitup.Base.call(this); 12676 this.callActions("beforeConstruct"); 12677 this.args = []; 12678 this.instruction = null; 12679 this.triggerElement = null; 12680 this.deferred = null; 12681 this.isToggling = false; 12682 this.callActions("afterConstruct"); 12683 h.seal(this); 12684 }; 12685 mixitup.BaseStatic.call(mixitup.QueueItem); 12686 mixitup.QueueItem.prototype = Object.create(mixitup.Base.prototype); 12687 mixitup.QueueItem.prototype.constructor = mixitup.QueueItem; 12688 /** 12689 * The `mixitup.Mixer` class is used to hold discreet, user-configured 12690 * instances of MixItUp on a provided container element. 12691 * 12692 * Mixer instances are returned whenever the `mixitup()` factory function is called, 12693 * which expose a range of methods enabling API-based filtering, sorting, 12694 * insertion, removal and more. 12695 * 12696 * @constructor 12697 * @namespace 12698 * @memberof mixitup 12699 * @public 12700 * @since 3.0.0 12701 */ mixitup.Mixer = function() { 12702 mixitup.Base.call(this); 12703 this.callActions("beforeConstruct"); 12704 this.config = new mixitup.Config(); 12705 this.id = ""; 12706 this.isBusy = false; 12707 this.isToggling = false; 12708 this.incPadding = true; 12709 this.controls = []; 12710 this.targets = []; 12711 this.origOrder = []; 12712 this.cache = {}; 12713 this.toggleArray = []; 12714 this.targetsMoved = 0; 12715 this.targetsImmovable = 0; 12716 this.targetsBound = 0; 12717 this.targetsDone = 0; 12718 this.staggerDuration = 0; 12719 this.effectsIn = null; 12720 this.effectsOut = null; 12721 this.transformIn = []; 12722 this.transformOut = []; 12723 this.queue = []; 12724 this.state = null; 12725 this.lastOperation = null; 12726 this.lastClicked = null; 12727 this.userCallback = null; 12728 this.userDeferred = null; 12729 this.dom = new mixitup.MixerDom(); 12730 this.callActions("afterConstruct"); 12731 h.seal(this); 12732 };
12733 mixitup.BaseStatic.call(mixitup.Mixer); 12734 mixitup.Mixer.prototype = Object.create(mixitup.Base.prototype); 12735 h.extend(mixitup.Mixer.prototype, /** @lends mixitup.Mixer */ { 12736 constructor: mixitup.Mixer, 12737 /** 12738 * @private 12739 * @instance 12740 * @since 3.0.0 12741 * @param {HTMLElement} container 12742 * @param {HTMLElement} document 12743 * @param {string} id 12744 * @param {object} [config] 12745 */ attach: function attach(container, document1, id, config) { 12746 var self = this, target = null, i = -1; 12747 self.callActions("beforeAttach", arguments); 12748 self.id = id; 12749 if (config) h.extend(self.config, config, true, true); 12750 self.sanitizeConfig(); 12751 self.cacheDom(container, document1); 12752 if (self.config.layout.containerClassName) h.addClass(self.dom.container, self.config.layout.containerClassName); 12753 if (!mixitup.features.has.transitions) self.config.animation.enable = false; 12754 if (typeof window1.console === "undefined") self.config.debug.showWarnings = false; 12755 if (self.config.data.uidKey) // If the dataset API is in use, force disable controls 12756 self.config.controls.enable = false; 12757 self.indexTargets(); 12758 self.state = self.getInitialState(); 12759 for(i = 0; target = self.lastOperation.toHide[i]; i++)target.hide(); 12760 if (self.config.controls.enable) { 12761 self.initControls(); 12762 self.buildToggleArray(null, self.state); 12763 self.updateControls({ 12764 filter: self.state.activeFilter, 12765 sort: self.state.activeSort 12766 }); 12767 } 12768 self.parseEffects(); 12769 self.callActions("afterAttach", arguments); 12770 }, 12771 /** 12772 * @private 12773 * @instance 12774 * @since 3.0.0 12775 * @return {void} 12776 */ sanitizeConfig: function sanitizeConfig() { 12777 var self = this; 12778 self.callActions("beforeSanitizeConfig", arguments); 12779 // Sanitize enum/string config options 12780 self.config.controls.scope = self.config.controls.scope.toLowerCase().trim(); 12781 self.config.controls.toggleLogic = self.config.controls.toggleLogic.toLowerCase().trim(); 12782 self.config.controls.toggleDefault = self.config.controls.toggleDefault.toLowerCase().trim(); 12783 self.config.animation.effects = self.config.animation.effects.trim(); 12784 self.callActions("afterSanitizeConfig", arguments); 12785 }, 12786 /** 12787 * @private 12788 * @instance 12789 * @since 3.0.0 12790 * @return {mixitup.State} 12791 */ getInitialState: function getInitialState() { 12792 var self = this, state = new mixitup.State(), operation = new mixitup.Operation(); 12793 self.callActions("beforeGetInitialState", arguments); 12794 // Map initial values into a mock state object in order to construct an operation 12795 state.activeContainerClassName = self.config.layout.containerClassName; 12796 if (self.config.load.dataset) { 12797 // Dataset API 12798 if (!self.config.data.uidKey || typeof self.config.data.uidKey !== "string") throw new TypeError(mixitup.messages.errorConfigDataUidKeyNotSet()); 12799 operation.startDataset = operation.newDataset = state.activeDataset = self.config.load.dataset.slice(); 12800 operation.startContainerClassName = operation.newContainerClassName = state.activeContainerClassName; 12801 operation.show = self.targets.slice(); 12802 state = self.callFilters("stateGetInitialState", state, arguments); 12803 } else { 12804 // DOM API 12805 state.activeFilter = self.parseFilterArgs([ 12806 self.config.load.filter 12807 ]).command; 12808 state.activeSort = self.parseSortArgs([ 12809 self.config.load.sort 12810 ]).command; 12811 state.totalTargets = self.targets.length; 12812 state = self.callFilters("stateGetInitialState", state, arguments); 12813 if (state.activeSort.collection || state.activeSort.attribute || state.activeSort.order === "random" || state.activeSort.order === "desc") { 12814 // Sorting on load 12815 operation.newSort = state.activeSort; 12816 self.sortOperation(operation); 12817 self.printSort(false, operation); 12818 self.targets = operation.newOrder; 12819 } else operation.startOrder = operation.newOrder = self.targets; 12820 operation.startFilter = operation.newFilter = state.activeFilter; 12821 operation.startSort = operation.newSort = state.activeSort; 12822 operation.startContainerClassName = operation.newContainerClassName = state.activeContainerClassName; 12823 if (operation.newFilter.selector === "all") operation.newFilter.selector = self.config.selectors.target; 12824 else if (operation.newFilter.selector === "none") operation.newFilter.selector = ""; 12825 } 12826 operation = self.callFilters("operationGetInitialState", operation, [ 12827 state 12828 ]); 12829 self.lastOperation = operation; 12830 if (operation.newFilter) self.filterOperation(operation); 12831 state = self.buildState(operation); 12832 return state; 12833 }, 12834 /** 12835 * Caches references of DOM elements neccessary for the mixer's functionality. 12836 * 12837 * @private 12838 * @instance 12839 * @since 3.0.0 12840 * @param {HTMLElement} el 12841 * @param {HTMLHtmlElement} document 12842 * @return {void} 12843 */ cacheDom: function cacheDom(el, document1) { 12844 var self = this; 12845 self.callActions("beforeCacheDom", arguments); 12846 self.dom.document = document1; 12847 self.dom.body = self.dom.document.querySelector("body"); 12848 self.dom.container = el; 12849 self.dom.parent = el; 12850 self.callActions("afterCacheDom", arguments); 12851 }, 12852 /**
12853 * Indexes all child elements of the mixer matching the `selectors.target` 12854 * selector, instantiating a mixitup.Target for each one. 12855 * 12856 * @private 12857 * @instance 12858 * @since 3.0.0 12859 * @return {void} 12860 */ indexTargets: function indexTargets() { 12861 var self = this, target = null, el = null, dataset = null, i = -1; 12862 self.callActions("beforeIndexTargets", arguments); 12863 self.dom.targets = self.config.layout.allowNestedTargets ? self.dom.container.querySelectorAll(self.config.selectors.target) : h.children(self.dom.container, self.config.selectors.target, self.dom.document); 12864 self.dom.targets = h.arrayFromList(self.dom.targets); 12865 self.targets = []; 12866 if ((dataset = self.config.load.dataset) && dataset.length !== self.dom.targets.length) throw new Error(mixitup.messages.errorDatasetPrerenderedMismatch()); 12867 if (self.dom.targets.length) { 12868 for(i = 0; el = self.dom.targets[i]; i++){ 12869 target = new mixitup.Target(); 12870 target.init(el, self, dataset ? dataset[i] : void 0); 12871 target.isInDom = true; 12872 self.targets.push(target); 12873 } 12874 self.dom.parent = self.dom.targets[0].parentElement === self.dom.container ? self.dom.container : self.dom.targets[0].parentElement; 12875 } 12876 self.origOrder = self.targets; 12877 self.callActions("afterIndexTargets", arguments); 12878 }, 12879 initControls: function initControls() { 12880 var self = this, definition = "", controlElements = null, el = null, parent = null, delagators = null, control = null, i = -1, j = -1; 12881 self.callActions("beforeInitControls", arguments); 12882 switch(self.config.controls.scope){ 12883 case "local": 12884 parent = self.dom.container; 12885 break; 12886 case "global": 12887 parent = self.dom.document; 12888 break; 12889 default: 12890 throw new Error(mixitup.messages.errorConfigInvalidControlsScope()); 12891 } 12892 for(i = 0; definition = mixitup.controlDefinitions[i]; i++)if (self.config.controls.live || definition.live) { 12893 if (definition.parent) { 12894 delagators = self.dom[definition.parent]; 12895 if (!delagators || delagators.length < 0) continue; 12896 if (typeof delagators.length !== "number") delagators = [ 12897 delagators 12898 ]; 12899 } else delagators = [ 12900 parent 12901 ]; 12902 for(j = 0; el = delagators[j]; j++){ 12903 control = self.getControl(el, definition.type, definition.selector); 12904 self.controls.push(control); 12905 } 12906 } else { 12907 controlElements = parent.querySelectorAll(self.config.selectors.control + definition.selector); 12908 for(j = 0; el = controlElements[j]; j++){ 12909 control = self.getControl(el, definition.type, ""); 12910 if (!control) continue; 12911 self.controls.push(control); 12912 } 12913 } 12914 self.callActions("afterInitControls", arguments); 12915 }, 12916 /** 12917 * @private 12918 * @instance 12919 * @since 3.0.0 12920 * @param {HTMLElement} el 12921 * @param {string} type 12922 * @param {string} selector 12923 * @return {mixitup.Control|null} 12924 */ getControl: function getControl(el, type, selector) { 12925 var self = this, control = null, i = -1; 12926 self.callActions("beforeGetControl", arguments); 12927 if (!selector) // Static controls only 12928 for(i = 0; control = mixitup.controls[i]; i++){ 12929 if (control.el === el && control.isBound(self)) // Control already bound to this mixer (as another type). 12930 // NB: This prevents duplicate controls from being registered where a selector 12931 // might collide, eg: "[data-filter]" and "[data-filter][data-sort]" 12932 return self.callFilters("controlGetControl", null, arguments); 12933 else if (control.el === el && control.type === type && control.selector === selector) { 12934 // Another mixer is already using this control, add this mixer as a binding 12935 control.addBinding(self); 12936 return self.callFilters("controlGetControl", control, arguments); 12937 } 12938 } 12939 // Create new control 12940 control = new mixitup.Control(); 12941 control.init(el, type, selector); 12942 control.classNames.base = h.getClassname(self.config.classNames, type); 12943 control.classNames.active = h.getClassname(self.config.classNames, type, self.config.classNames.modifierActive); 12944 control.classNames.disabled = h.getClassname(self.config.classNames, type, self.config.classNames.modifierDisabled); 12945 // Add a reference to this mixer as a binding 12946 control.addBinding(self); 12947 return self.callFilters("controlGetControl", control, arguments); 12948 }, 12949 /** 12950 * Creates a compound selector by joining the `toggleArray` value as per the 12951 * defined toggle logic. 12952 * 12953 * @private 12954 * @instance 12955 * @since 3.0.0 12956 * @return {string} 12957 */ getToggleSelector: function getToggleSelector() { 12958 var self = this, delineator = self.config.controls.toggleLogic === "or" ? ", " : "", toggleSelector = ""; 12959 self.callActions("beforeGetToggleSelector", arguments); 12960 self.toggleArray = h.clean(self.toggleArray); 12961 toggleSelector = self.toggleArray.join(delineator); 12962 if (toggleSelector === "") toggleSelector = self.config.controls.toggleDefault; 12963 return self.callFilters("selectorGetToggleSelector", toggleSelector, arguments); 12964 }, 12965 /** 12966 * Breaks compound selector strings in an array of discreet selectors, 12967 * as per the active `controls.toggleLogic` configuration option. Accepts 12968 * either a dynamic command object, or a state object. 12969 * 12970 * @private 12971 * @instance 12972 * @since 2.0.0 12973 * @param {object} [command] 12974 * @param {mixitup.State} [state] 12975 * @return {void} 12976 */ buildToggleArray: function buildToggleArray(command, state) { 12977 var self = this, activeFilterSelector = ""; 12978 self.callActions("beforeBuildToggleArray", arguments); 12979 if (command && command.filter) activeFilterSelector = command.filter.selector.replace(/\s/g, ""); 12980 else if (state) activeFilterSelector = state.activeFilter.selector.replace(/\s/g, ""); 12981 else return; 12982 if (activeFilterSelector === self.config.selectors.target || activeFilterSelector === "all") activeFilterSelector = ""; 12983 if (self.config.controls.toggleLogic === "or") self.toggleArray = activeFilterSelector.split(","); 12984 else self.toggleArray = self.splitCompoundSelector(activeFilterSelector); 12985 self.toggleArray = h.clean(self.toggleArray); 12986 self.callActions("afterBuildToggleArray", arguments); 12987 }, 12988 /**
12989 * Takes a compound selector (e.g. `.cat-1.cat-2`, `[data-cat="1"][data-cat="2"]`) 12990 * and breaks into its individual selectors. 12991 * 12992 * @private 12993 * @instance 12994 * @since 3.0.0 12995 * @param {string} compoundSelector 12996 * @return {string[]} 12997 */ splitCompoundSelector: function splitCompoundSelector(compoundSelector) { 12998 // Break at a `.` or `[`, capturing the delineator 12999 var partials = compoundSelector.split(/([\.\[])/g), toggleArray = [], selector = "", i = -1; 13000 if (partials[0] === "") partials.shift(); 13001 for(i = 0; i < partials.length; i++){ 13002 if (i % 2 === 0) selector = ""; 13003 selector += partials[i]; 13004 if (i % 2 !== 0) toggleArray.push(selector); 13005 } 13006 return toggleArray; 13007 }, 13008 /** 13009 * Updates controls to their active/inactive state based on the command or 13010 * current state of the mixer. 13011 * 13012 * @private 13013 * @instance 13014 * @since 2.0.0 13015 * @param {object} command 13016 * @return {void} 13017 */ updateControls: function updateControls(command) { 13018 var self = this, control = null, output = new mixitup.CommandMultimix(), i = -1; 13019 self.callActions("beforeUpdateControls", arguments); 13020 // Sanitise to defaults 13021 if (command.filter) output.filter = command.filter.selector; 13022 else output.filter = self.state.activeFilter.selector; 13023 if (command.sort) output.sort = self.buildSortString(command.sort); 13024 else output.sort = self.buildSortString(self.state.activeSort); 13025 if (output.filter === self.config.selectors.target) output.filter = "all"; 13026 if (output.filter === "") output.filter = "none"; 13027 h.freeze(output); 13028 for(i = 0; control = self.controls[i]; i++)control.update(output, self.toggleArray); 13029 self.callActions("afterUpdateControls", arguments); 13030 }, 13031 /** 13032 * @private 13033 * @instance 13034 * @since 3.0.0 13035 * @param {mixitup.CommandSort} command 13036 * @return {string} 13037 */ buildSortString: function buildSortString(command) { 13038 var self = this; 13039 var output = ""; 13040 output += command.sortString; 13041 if (command.next) output += " " + self.buildSortString(command.next); 13042 return output; 13043 }, 13044 /** 13045 * @private 13046 * @instance 13047 * @since 3.0.0 13048 * @param {object} command 13049 * @param {Operation} operation 13050 * @return {Promise.<mixitup.State>} 13051 */ insertTargets: function insertTargets(command, operation) { 13052 var self = this, nextSibling = null, insertionIndex = -1, frag = null, target = null, el = null, i = -1; 13053 self.callActions("beforeInsertTargets", arguments); 13054 if (typeof command.index === "undefined") command.index = 0; 13055 nextSibling = self.getNextSibling(command.index, command.sibling, command.position); 13056 frag = self.dom.document.createDocumentFragment(); 13057 if (nextSibling) insertionIndex = h.index(nextSibling, self.config.selectors.target); 13058 else insertionIndex = self.targets.length; 13059 if (command.collection) { 13060 for(i = 0; el = command.collection[i]; i++){ 13061 if (self.dom.targets.indexOf(el) > -1) throw new Error(mixitup.messages.errorInsertPreexistingElement()); 13062 // Ensure elements are hidden when they are added to the DOM, so they can 13063 // be animated in gracefully 13064 el.style.display = "none"; 13065 frag.appendChild(el); 13066 frag.appendChild(self.dom.document.createTextNode(" ")); 13067 if (!h.isElement(el, self.dom.document) || !el.matches(self.config.selectors.target)) continue; 13068 target = new mixitup.Target(); 13069 target.init(el, self); 13070 target.isInDom = true; 13071 self.targets.splice(insertionIndex, 0, target); 13072 insertionIndex++; 13073 } 13074 self.dom.parent.insertBefore(frag, nextSibling); 13075 } 13076 // Since targets have been added, the original order must be updated 13077 operation.startOrder = self.origOrder = self.targets; 13078 self.callActions("afterInsertTargets", arguments); 13079 }, 13080 /** 13081 * @private 13082 * @instance 13083 * @since 3.0.0 13084 * @param {Number} [index] 13085 * @param {Element} [sibling] 13086 * @param {string} [position] 13087 * @return {Element} 13088 */ getNextSibling: function getNextSibling(index, sibling, position) { 13089 var self = this, element = null; 13090 index = Math.max(index, 0); 13091 if (sibling && position === "before") // Explicit sibling 13092 element = sibling; 13093 else if (sibling && position === "after") // Explicit sibling 13094 element = sibling.nextElementSibling || null; 13095 else if (self.targets.length > 0 && typeof index !== "undefined") // Index and targets exist 13096 element = index < self.targets.length || !self.targets.length ? self.targets[index].dom.el : self.targets[self.targets.length - 1].dom.el.nextElementSibling; 13097 else if (self.targets.length === 0 && self.dom.parent.children.length > 0) { 13098 // No targets but other siblings 13099 if (self.config.layout.siblingAfter) element = self.config.layout.siblingAfter; 13100 else if (self.config.layout.siblingBefore) element = self.config.layout.siblingBefore.nextElementSibling; 13101 else self.dom.parent.children[0]; 13102 } else element; 13103 return self.callFilters("elementGetNextSibling", element, arguments); 13104 }, 13105 /** 13106 * @private 13107 * @instance 13108 * @since 2.0.0 13109 * @param {Operation} operation 13110 * @return {void}
13111 */ filterOperation: function filterOperation(operation) { 13112 var self = this, testResult = false, index = -1, action = "", target = null, i = -1; 13113 self.callActions("beforeFilterOperation", arguments); 13114 action = operation.newFilter.action; 13115 for(i = 0; target = operation.newOrder[i]; i++){ 13116 if (operation.newFilter.collection) // show via collection 13117 testResult = operation.newFilter.collection.indexOf(target.dom.el) > -1; 13118 else // show via selector 13119 if (operation.newFilter.selector === "") testResult = false; 13120 else testResult = target.dom.el.matches(operation.newFilter.selector); 13121 self.evaluateHideShow(testResult, target, action, operation); 13122 } 13123 if (operation.toRemove.length) { 13124 for(i = 0; target = operation.show[i]; i++)if (operation.toRemove.indexOf(target) > -1) { 13125 // If any shown targets should be removed, move them into the toHide array 13126 operation.show.splice(i, 1); 13127 if ((index = operation.toShow.indexOf(target)) > -1) operation.toShow.splice(index, 1); 13128 operation.toHide.push(target); 13129 operation.hide.push(target); 13130 i--; 13131 } 13132 } 13133 operation.matching = operation.show.slice(); 13134 if (operation.show.length === 0 && operation.newFilter.selector !== "" && self.targets.length !== 0) operation.hasFailed = true; 13135 self.callActions("afterFilterOperation", arguments); 13136 }, 13137 /** 13138 * @private 13139 * @instance 13140 * @since 3.0.0 13141 * @param {boolean} testResult 13142 * @param {Element} target 13143 * @param {string} action 13144 * @param {Operation} operation 13145 * @return {void} 13146 */ evaluateHideShow: function evaluateHideShow(testResult, target, action, operation) { 13147 var self = this, filteredTestResult = false, args = Array.prototype.slice.call(arguments, 1); 13148 filteredTestResult = self.callFilters("testResultEvaluateHideShow", testResult, args); 13149 self.callActions("beforeEvaluateHideShow", arguments); 13150 if (filteredTestResult === true && action === "show" || filteredTestResult === false && action === "hide") { 13151 operation.show.push(target); 13152 !target.isShown && operation.toShow.push(target); 13153 } else { 13154 operation.hide.push(target); 13155 target.isShown && operation.toHide.push(target); 13156 } 13157 self.callActions("afterEvaluateHideShow", arguments); 13158 }, 13159 /** 13160 * @private 13161 * @instance 13162 * @since 2.0.0 13163 * @param {Operation} operation 13164 * @return {void} 13165 */ sortOperation: function sortOperation(operation) { 13166 var self = this, newOrder = [], target = null, el = null, i = -1; 13167 self.callActions("beforeSortOperation", arguments); 13168 operation.startOrder = self.targets; 13169 if (operation.newSort.collection) { 13170 // Sort by collection 13171 newOrder = []; 13172 for(i = 0; el = operation.newSort.collection[i]; i++){ 13173 if (self.dom.targets.indexOf(el) < 0) throw new Error(mixitup.messages.errorSort
13173NonExistentElement()); 13174 target = new mixitup.Target(); 13175 target.init(el, self); 13176 target.isInDom = true; 13177 newOrder.push(target); 13178 } 13179 operation.newOrder = newOrder; 13180 } else if (operation.newSort.order === "random") // Sort random 13181 operation.newOrder = h.arrayShuffle(operation.startOrder); 13182 else if (operation.newSort.attribute === "") { 13183 // Sort by default 13184 operation.newOrder = self.origOrder.slice(); 13185 if (operation.newSort.order === "desc") operation.newOrder.reverse(); 13186 } else { 13187 // Sort by attribute 13188 operation.newOrder = operation.startOrder.slice(); 13189 operation.newOrder.sort(function(a, b) { 13190 return self.compare(a, b, operation.newSort); 13191 }); 13192 } 13193 if (h.isEqualArray(operation.newOrder, operation.startOrder)) operation.willSort = false; 13194 self.callActions("afterSortOperation", arguments); 13195 }, 13196 /** 13197 * @private 13198 * @instance 13199 * @since 2.0.0 13200 * @param {mixitup.Target} a 13201 * @param {mixitup.Target} b 13202 * @param {mixitup.CommandSort} command 13203 * @return {Number} 13204 */ compare: function compare(a, b, command) { 13205 var self = this, order = command.order, attrA = self.getAttributeValue(a, command.attribute), attrB = self.getAttributeValue(b, command.attribute); 13206 if (isNaN(attrA * 1) || isNaN(attrB * 1)) { 13207 attrA = attrA.toLowerCase(); 13208 attrB = attrB.toLowerCase(); 13209 } else { 13210 attrA = attrA * 1; 13211 attrB = attrB * 1; 13212 } 13213 if (attrA < attrB) return order === "asc" ? -1 : 1; 13214 if (attrA > attrB) return order === "asc" ? 1 : -1; 13215 if (attrA === attrB && command.next) return self.compare(a, b, command.next); 13216 return 0; 13217 }, 13218 /** 13219 * Reads the values of any data attributes present the provided target element 13220 * which match the current sort command. 13221 * 13222 * @private 13223 * @instance 13224 * @since 3.0.0 13225 * @param {mixitup.Target} target 13226 * @param {string} [attribute] 13227 * @return {(String|Number)} 13228 */ getAttributeValue: function getAttributeValue(target, attribute) { 13229 var self = this, value = ""; 13230 value = target.dom.el.getAttribute("data-" + attribute); 13231 if (value === null) { 13232 if (self.config.debug.showWarnings) // Encourage users to assign values to all targets to avoid erroneous sorting 13233 // when types are mixed 13234 console.warn(mixitup.messages.warningInconsistentSortingAttributes({ 13235 attribute: "data-" + attribute 13236 })); 13237 } 13238 // If an attribute is not present, return 0 as a safety value 13239 return self.callFilters("valueGetAttributeValue", value || 0, arguments); 13240 }, 13241 /** 13242 * Inserts elements into the DOM in the appropriate 13243 * order using a document fragment for minimal 13244 * DOM thrashing 13245 * 13246 * @private 13247 * @instance 13248 * @since 2.0.0 13249 * @param {boolean} isResetting 13250 * @param {Operation} operation 13251 * @return {void} 13252 */ printSort: function printSort(isResetting, operation) { 13253 var self = this, startOrder = isResetting ? operation.newOrder : operation.startOrder, newOrder = isResetting ? operation.startOrder : operation.newOrder, nextSibling = startOrder.length ? startOrder[startOrder.length - 1].dom.el.nextElementSibling : null, frag = window1.document.createDocumentFragment(), whitespace = null, target = null, el = null, i = -1; 13254 self.callActions("beforePrintSort", arguments); 13255 // Empty the container 13256 for(i = 0; target = startOrder[i]; i++){ 13257 el = target.dom.el; 13258 if (el.style.position === "absolute") continue; 13259 h.removeWhitespace(el.previousSibling); 13260 el.parentElement.removeChild(el); 13261 } 13262 whitespace = nextSibling ? nextSibling.previousSibling : self.dom.parent.lastChild; 13263 if (whitespace && whitespace.nodeName === "#text") h.removeWhitespace(whitespace); 13264 for(i = 0; target = newOrder[i]; i++){ 13265 // Add targets into a document fragment 13266 el = target.dom.el; 13267 if (h.isElement(frag.lastChild)) frag.appendChild(window1.document.createTextNode(" ")); 13268 frag.appendChild(el); 13269 } 13270 // Insert the document fragment into the container 13271 // before any other non-target elements 13272 if (self.dom.parent.firstChild && self.dom.parent.firstChild !== nextSibling) frag.insertBefore(window1.document.createTextNode(" "), frag.childNodes[0]); 13273 if (nextSibling) { 13274 frag.appendChild(window1.document.createTextNode(" ")); 13275 self.dom.parent.insertBefore(frag, nextSibling); 13276 } else self.dom.parent.appendChild(frag); 13277 self.callActions("afterPrintSort", arguments); 13278 }, 13279 /** 13280 * Parses user-defined sort strings (i.e. `default:asc`) into sort commands objects. 13281 * 13282 * @private 13283 * @instance 13284 * @since 3.0.0 13285 * @param {string} sortString 13286 * @param {mixitup.CommandSort} command 13287 * @return {mixitup.CommandSort} 13288 */ parseSortString: function parseSortString(sortString, command) { 13289 var self = this, rules = sortString.split(" "), current = command, rule = [], i = -1; 13290 // command.sortString = sortString; 13291 for(i = 0; i < rules.length; i++){ 13292 rule = rules[i].split(":"); 13293 current.sortString = rules[i]; 13294 current.attribute = h.dashCase(rule[0]); 13295 current.order = rule[1] || "asc"; 13296 switch(current.attribute){ 13297 case "default": 13298 // treat "default" as sorting by no attribute 13299 current.attribute = ""; 13300 break; 13301 case "random": 13302 // treat "random" as an order not an attribute 13303 current.attribute = ""; 13304 current.order = "random"; 13305 break; 13306 } 13307 if (!current.attribute || current.order === "random") break; 13308 if (i < rules.length - 1) { 13309 // Embed reference to the next command 13310 current.next = new mixitup.CommandSort(); 13311 h.freeze(current); 13312 current = current.next; 13313 } 13314 } 13315 return self.callFilters("commandsParseSort", command, arguments); 13316 }, 13317 /** 13318 * Parses all effects out of the user-defined `animation.effects` string into 13319 * their respective properties and units. 13320 * 13321 * @private 13322 * @instance 13323 * @since 2.0.0 13324 * @return {void} 13325 */ parseEffects: function parseEffects() { 13326 var self = this, transformName = "", effectsIn = self.config.animation.effectsIn || self.config.animation.effects, effectsOut = self.config.animation.effectsOut || self.config.animation.effects; 13327 self.callActions("beforeParseEffects", arguments); 13328 self.effectsIn = new mixitup.StyleData(); 13329 self.effectsOut = new mixitup.StyleData(); 13330 self.transformIn = []; 13331 self.transformOut = []; 13332 self.effectsIn.opacity = self.effectsOut.opacity = 1; 13333 self.parseEffect("fade", effectsIn, self.effectsIn, self.transformIn); 13334 self.parseEffect("fade", effectsOut, self.effectsOut, self.transformOut, true); 13335 for(transformName in mixitup.transformDefaults){ 13336 if (!(mixitup.transformDefaults[transformName] instanceof mixitup.TransformData)) continue; 13337 self.parseEffect(transformName, effectsIn, self.effectsIn, self.transformIn); 13338 self.parseEffect(transformName, effectsOut, self.effectsOut, self.transformOut, true); 13339 } 13340 self.parseEffect("stagger", effectsIn, self.effectsIn, self.transformIn); 13341 self.parseEffect("stagger", effectsOut, self.effectsOut, self.transformOut, true); 13342 self.callActions("afterParseEffects", arguments); 13343 }, 13344 /** 13345 * @private 13346 * @instance 13347 * @since 2.0.0 13348 * @param {string} effectName 13349 * @param {string} effectString 13350 * @param {StyleData} effects
13351 * @param {String[]} transform 13352 * @param {boolean} [isOut] 13353 */ parseEffect: function parseEffect(effectName, effectString, effects, transform, isOut) { 13354 var self = this, re = /\(([^)]+)\)/, propIndex = -1, str = "", match = [], val = "", units = [ 13355 "%", 13356 "px", 13357 "em", 13358 "rem", 13359 "vh", 13360 "vw", 13361 "deg" 13362 ], unit = "", i = -1; 13363 self.callActions("beforeParseEffect", arguments); 13364 if (typeof effectString !== "string") throw new TypeError(mixitup.messages.errorConfigInvalidAnimationEffects()); 13365 if (effectString.indexOf(effectName) < 0) { 13366 // The effect is not present in the effects string 13367 if (effectName === "stagger") // Reset stagger to 0 13368 self.staggerDuration = 0; 13369 return; 13370 } 13371 // The effect is present 13372 propIndex = effectString.indexOf(effectName + "("); 13373 if (propIndex > -1) { 13374 // The effect has a user defined value in parentheses 13375 // Extract from the first parenthesis to the end of string 13376 str = effectString.substring(propIndex); 13377 // Match any number of characters between "(" and ")" 13378 match = re.exec(str); 13379 val = match[1]; 13380 } 13381 switch(effectName){ 13382 case "fade": 13383 effects.opacity = val ? parseFloat(val) : 0; 13384 break; 13385 case "stagger": 13386 self.staggerDuration = val ? parseFloat(val) : 100; 13387 break; 13388 default: 13389 // All other effects are transforms following the same structure 13390 if (isOut && self.config.animation.reverseOut && effectName !== "scale") effects[effectName].value = (val ? parseFloat(val) : mixitup.transformDefaults[effectName].value) * -1; 13391 else effects[effectName].value = val ? parseFloat(val) : mixitup.transformDefaults[effectName].value; 13392 if (val) { 13393 for(i = 0; unit = units[i]; i++)if (val.indexOf(unit) > -1) { 13394 effects[effectName].unit = unit; 13395 break; 13396 } 13397 } else effects[effectName].unit = mixitup.transformDefaults[effectName].unit; 13398 transform.push(effectName + "(" + effects[effectName].value + effects[effectName].unit + ")"); 13399 } 13400 self.callActions("afterParseEffect", arguments); 13401 }, 13402 /** 13403 * @private 13404 * @instance 13405 * @since 2.0.0 13406 * @param {Operation} operation 13407 * @return {State} 13408 */ buildState: function buildState(operation) { 13409 var self = this, state = new mixitup.State(), target = null, i = -1; 13410 self.callActions("beforeBuildState", arguments); 13411 // Map target elements into state arrays. 13412 // the real target objects should never be exposed 13413 for(i = 0; target = self.targets[i]; i++)if (!operation.toRemove.length || operation.toRemove.indexOf(target) < 0) state.targets.push(target.dom.el); 13414 for(i = 0; target = operation.matching[i]; i++)state.matching.push(target.dom.el); 13415 for(i = 0; target = operation.show[i]; i++)state.show.push(target.dom.el); 13416 for(i = 0; target = operation.hide[i]; i++)if (!operation.toRemove.length || operation.toRemove.indexOf(target) < 0) state.hide.push(target.dom.el); 13417 state.id = self.id; 13418 state.container = self.dom.container; 13419 state.activeFilter = operation.newFilter; 13420 state.activeSort = operation.newSort; 13421 state.activeDataset = operation.newDataset; 13422 state.activeContainerClassName = operation.newContainerClassName; 13423 state.hasFailed = operation.hasFailed; 13424 state.totalTargets = self.targets.length; 13425 state.totalShow = operation.show.length; 13426 state.totalHide = operation.hide.length; 13427 state.totalMatching = operation.matching.length; 13428 state.triggerElement = operation.triggerElement; 13429 return self.callFilters("stateBuildState", state, arguments); 13430 }, 13431 /** 13432 * @private 13433 * @instance 13434 * @since 2.0.0 13435 * @param {boolean} shouldAnimate 13436 * @param {Operation} operation 13437 * @return {void} 13438 */ goMix: function goMix(shouldAnimate, operation) { 13439 var self = this, deferred = null; 13440 self.callActions("beforeGoMix", arguments); 13441 // If the animation duration is set to 0ms, 13442 // or no effects specified, 13443 // or the container is hidden 13444 // then abort animation 13445 if (!self.config.animation.duration || !self.config.animation.effects || !h.isVisible(self.dom.container)) shouldAnimate = false;
13446 if (!operation.toShow.length && !operation.toHide.length && !operation.willSort && !operation.willChangeLayout) // If nothing to show or hide, and not sorting or 13447 // changing layout 13448 shouldAnimate = false; 13449 if (!operation.startState.show.length && !operation.show.length) // If nothing currently shown, nothing to show 13450 shouldAnimate = false; 13451 mixitup.events.fire("mixStart", self.dom.container, { 13452 state: operation.startState, 13453 futureState: operation.newState, 13454 instance: self 13455 }, self.dom.document); 13456 if (typeof self.config.callbacks.onMixStart === "function") self.config.callbacks.onMixStart.call(self.dom.container, operation.startState, operation.newState, self); 13457 h.removeClass(self.dom.container, h.getClassname(self.config.classNames, "container", self.config.classNames.modifierFailed)); 13458 if (!self.userDeferred) // Queue empty, no pending operations 13459 deferred = self.userDeferred = h.defer(mixitup.libraries); 13460 else // Use existing deferred 13461 deferred = self.userDeferred; 13462 self.isBusy = true; 13463 if (!shouldAnimate || !mixitup.features.has.transitions) { 13464 // Abort 13465 if (self.config.debug.fauxAsync) setTimeout(function() { 13466 self.cleanUp(operation); 13467 }, self.config.animation.duration); 13468 else self.cleanUp(operation); 13469 return self.callFilters("promiseGoMix", deferred.promise, arguments); 13470 } 13471 // If we should animate and the platform supports transitions, go for it 13472 if (window1.pageYOffset !== operation.docState.scrollTop) window1.scrollTo(operation.docState.scrollLeft, operation.docState.scrollTop); 13473 if (self.config.animation.applyPerspective) { 13474 self.dom.parent.style[mixitup.features.perspectiveProp] = self.config.animation.perspectiveDistance; 13475 self.dom.parent.style[mixitup.features.perspectiveOriginProp] = self.config.animation.perspectiveOrigin; 13476 } 13477 if (self.config.animation.animateResizeContainer && operation.startHeight !== operation.newHeight && operation.viewportDeltaY !== operation.startHeight - operation.newHeight) self.dom.parent.style.height = operation.startHeight + "px"; 13478 if (self.config.animation.animateResizeContainer && operation.startWidth !== operation.newWidth && operation.viewportDeltaX !== operation.startWidth - operation.newWidth) self.dom.parent.style.width = operation.startWidth + "px"; 13479 if (operation.startHeight === operation.newHeight) self.dom.parent.style.height = operation.startHeight + "px"; 13480 if (operation.startWidth === operation.newWidth) self.dom.parent.style.width = operation.startWidth + "px"; 13481 if (operation.startHeight === operation.newHeight && operation.startWidth === operation.newWidth) self.dom.parent.style.overflow = "hidden"; 13482 requestAnimationFrame(function() { 13483 self.moveTargets(operation); 13484 }); 13485 return self.callFilters("promiseGoMix", deferred.promise, arguments); 13486 }, 13487 /** 13488 * @private 13489 * @instance 13490 * @since 2.0.0 13491 * @param {Operation} operation 13492 * @return {void} 13493 */ getStartMixData: function getStartMixData(operation) { 13494 var self = this, parentStyle = window1.getComputedStyle(self.dom.parent), parentRect = self.dom.parent.getBoundingClientRect(), target = null, data = {}, i = -1, boxSizing = parentStyle[mixitup.features.boxSizingProp]; 13495 self.incPadding = boxSizing === "border-box"; 13496 self.callActions("beforeGetStartMixData", arguments); 13497 for(i = 0; target = operation.show[i]; i++){ 13498 data = target.getPosData(); 13499 operation.showPosData[i] = { 13500 startPosData: data 13501 }; 13502 } 13503 for(i = 0; target = operation.toHide[i]; i++){ 13504 data = target.getPosData(); 13505 operation.toHidePosData[i] = { 13506 startPosData: data 13507 }; 13508 } 13509 operation.startX = parentRect.left; 13510 operation.startY = parentRect.top; 13511 operation.startHeight = self.incPadding ? parentRect.height : parentRect.height - parseFloat(parentStyle.paddingTop) - parseFloat(parentStyle.paddingBottom) - parseFloat(parentStyle.borderTop) - parseFloat(parentStyle.borderBottom); 13512 operation.startWidth = self.incPadding ? parentRect.width : parentRect.width - parseFloat(parentStyle.paddingLeft) - parseFloat(parentStyle.paddingRight) - parseFloat(parentStyle.borderLeft) - parseFloat(parentStyle.borderRight); 13513 self.callActions("afterGetStartMixData", arguments); 13514 }, 13515 /** 13516 * @private 13517 * @instance 13518 * @since 2.0.0 13519 * @param {Operation} operation 13520 * @return {void} 13521 */ setInter: function setInter(operation) { 13522 var self = this, target = null, i = -1; 13523 self.callActions("beforeSetInter", arguments); 13524 // Prevent scrollbar flicker on non-inertial scroll platforms by clamping height/width 13525 if (self.config.animation.clampHeight) { 13526 self.dom.parent.style.height = operation.startHeight + "px"; 13527 self.dom.parent.style.overflow = "hidden"; 13528 } 13529 if (self.config.animation.clampWidth) { 13530 self.dom.parent.style.width = operation.startWidth + "px"; 13531 self.dom.parent.style.overflow = "hidden"; 13532 } 13533 for(i = 0; target = operation.toShow[i]; i++)target.show(); 13534 if (operation.willChangeLayout) { 13535 h.removeClass(self.dom.container, operation.startContainerClassName); 13536 h.addClass(self.dom.container, operation.newContainerClassName); 13537 } 13538 self.callActions("afterSetInter", arguments); 13539 }, 13540 /** 13541 * @private 13542 * @instance 13543 * @since 2.0.0 13544 * @param {Operation} operation 13545 * @return {void} 13546 */ getInterMixData: function getInterMixData(operation) { 13547 var self = this, target = null, i = -1; 13548 self.callActions("beforeGetInterMixData", arguments); 13549 for(i = 0; target = operation.show[i]; i++)operation.showPosData[i].interPosData = target.getPosData(); 13550 for(i = 0; target = operation.toHide[i]; i++)operation.toHidePosData[i].interPosData = target.getPosData(); 13551 self.callActions("afterGetInterMixData", arguments); 13552 }, 13553 /** 13554 * @private 13555 * @instance 13556 * @since 2.0.0 13557 * @param {Operation} operation 13558 * @return {void} 13559 */ setFinal: function setFinal(operation) { 13560 var self = this, target = null, i = -1; 13561 self.callActions("beforeSetFinal", arguments); 13562 operation.willSort && self.printSort(false, operation); 13563 for(i = 0; target = operation.toHide[i]; i++)target.hide(); 13564 self.callActions("afterSetFinal", arguments); 13565 }, 13566 /** 13567 * @private 13568 * @instance 13569 * @since 2.0.0 13570 * @param {Operation} operation 13571 * @return {void} 13572 */ getFinalMixData: function getFinalMixData(operation) { 13573 var self = this, parentStyle = null, parentRect = null, target = null, i = -1; 13574 self.callActions("beforeGetFinalMixData", arguments); 13575 for(i = 0; target = operation.show[i]; i++)operation.showPosData[i].finalPosData = target.getPosData(); 13576 for(i = 0; target = operation.toHide[i]; i++)operation.toHidePosData[i].finalPosData = target.getPosData(); 13577 // Remove clamping 13578 if (self.config.animation.clampHeight || self.config.animation.clampWidth) self.dom.parent.style.height = self.dom.parent.style.width = self.dom.parent.style.overflow = ""; 13579 if (!self.incPadding) parentStyle = window1.getComputedStyle(self.dom.parent); 13580 parentRect = self.dom.parent.getBoundingClientRect(); 13581 operation.newX = parentRect.left; 13582 operation.newY = parentRect.top; 13583 operation.newHeight = self.incPadding ? parentRect.height : parentRect.height - parseFloat(parentStyle.paddingTop) - parseFloat(parentStyle.paddingBottom) - parseFloat(parentStyle.borderTop) - parseFloat(parentStyle.borderBottom); 13584 operation.newWidth = self.incPadding ? parentRect.width : parentRect.width - parseFloat(parentStyle.paddingLeft) - parseFloat(parentStyle.paddingRight) - parseFloat(parentStyle.borderLeft) - parseFloat(parentStyle.borderRight); 13585 operation.viewportDeltaX = operation.docState.viewportWidth - this.dom.document.documentElement.clientWidth; 13586 operation.viewportDeltaY = operation.docState.viewportHe
vendor: 11,112 bytes, lines 13586-13760
13586ight - this.dom.document.documentElement.clientHeight; 13587 if (operation.willSort) self.printSort(true, operation); 13588 for(i = 0; target = operation.toShow[i]; i++)target.hide(); 13589 for(i = 0; target = operation.toHide[i]; i++)target.show(); 13590 if (operation.willChangeLayout) { 13591 h.removeClass(self.dom.container, operation.newContainerClassName); 13592 h.addClass(self.dom.container, self.config.layout.containerClassName); 13593 } 13594 self.callActions("afterGetFinalMixData", arguments); 13595 }, 13596 /** 13597 * @private 13598 * @instance 13599 * @since 3.0.0 13600 * @param {Operation} operation 13601 */ getTweenData: function getTweenData(operation) { 13602 var self = this, target = null, posData = null, effectNames = Object.getOwnPropertyNames(self.effectsIn), effectName = "", effect = null, widthChange = -1, heightChange = -1, i = -1, j = -1; 13603 self.callActions("beforeGetTweenData", arguments); 13604 for(i = 0; target = operation.show[i]; i++){ 13605 posData = operation.showPosData[i]; 13606 posData.posIn = new mixitup.StyleData(); 13607 posData.posOut = new mixitup.StyleData(); 13608 posData.tweenData = new mixitup.StyleData(); 13609 // Process x and y 13610 if (target.isShown) { 13611 posData.posIn.x = posData.startPosData.x - posData.interPosData.x; 13612 posData.posIn.y = posData.startPosData.y - posData.interPosData.y; 13613 } else posData.posIn.x = posData.posIn.y = 0; 13614 posData.posOut.x = posData.finalPosData.x - posData.interPosData.x; 13615 posData.posOut.y = posData.finalPosData.y - posData.interPosData.y; 13616 // Process opacity 13617 posData.posIn.opacity = target.isShown ? 1 : self.effectsIn.opacity; 13618 posData.posOut.opacity = 1; 13619 posData.tweenData.opacity = posData.posOut.opacity - posData.posIn.opacity; 13620 // Adjust x and y if not nudging 13621 if (!target.isShown && !self.config.animation.nudge) { 13622 posData.posIn.x = posData.posOut.x; 13623 posData.posIn.y = posData.posOut.y; 13624 } 13625 posData.tweenData.x = posData.posOut.x - posData.posIn.x; 13626 posData.tweenData.y = posData.posOut.y - posData.posIn.y; 13627 // Process width, height, and margins 13628 if (self.config.animation.animateResizeTargets) { 13629 posData.posIn.width = posData.startPosData.width; 13630 posData.posIn.height = posData.startPosData.height; 13631 // "||" Prevents width/height change from including 0 width/height if hiding or showing 13632 widthChange = (posData.startPosData.width || posData.finalPosData.width) - posData.interPosData.width; 13633 posData.posIn.marginRight = posData.startPosData.marginRight - widthChange; 13634 heightChange = (posData.startPosData.height || posData.finalPosData.height) - posData.interPosData.height; 13635 posData.posIn.marginBottom = posData.startPosData.marginBottom - heightChange; 13636 posData.posOut.width = posData.finalPosData.width; 13637 posData.posOut.height = posData.finalPosData.height; 13638 widthChange = (posData.finalPosData.width || posData.startPosData.width) - posData.interPosData.width; 13639 posData.posOut.marginRight = posData.finalPosData.marginRight - widthChange; 13640 heightChange = (posData.finalPosData.height || posData.startPosData.height) - posData.interPosData.height; 13641 posData.posOut.marginBottom = posData.finalPosData.marginBottom - heightChange; 13642 posData.tweenData.width = posData.posOut.width - posData.posIn.width; 13643 posData.tweenData.height = posData.posOut.height - posData.posIn.height; 13644 posData.tweenData.marginRight = posData.posOut.marginRight - posData.posIn.marginRight; 13645 posData.tweenData.marginBottom = posData.posOut.marginBottom - posData.posIn.marginBottom; 13646 } 13647 // Process transforms 13648 for(j = 0; effectName = effectNames[j]; j++){ 13649 effect = self.effectsIn[effectName]; 13650 if (!(effect instanceof mixitup.TransformData) || !effect.value) continue; 13651 posData.posIn[effectName].value = effect.value; 13652 posData.posOut[effectName].value = 0; 13653 posData.tweenData[effectName].value = posData.posOut[effectName].value - posData.posIn[effectName].value; 13654 posData.posIn[effectName].unit = posData.posOut[effectName].unit = posData.tweenData[effectName].unit = effect.unit; 13655 } 13656 } 13657 for(i = 0; target = operation.toHide[i]; i++){ 13658 posData = operation.toHidePosData[i]; 13659 posData.posIn = new mixitup.StyleData(); 13660 posData.posOut = new mixitup.StyleData(); 13661 posData.tweenData = new mixitup.StyleData(); 13662 // Process x and y 13663 posData.posIn.x = target.isShown ? posData.startPosData.x - posData.interPosData.x : 0; 13664 posData.posIn.y = target.isShown ? posData.startPosData.y - posData.interPosData.y : 0; 13665 posData.posOut.x = self.config.animation.nudge ? 0 : posData.posIn.x; 13666 posData.posOut.y = self.config.animation.nudge ? 0 : posData.posIn.y; 13667 posData.tweenData.x = posData.posOut.x - posData.posIn.x; 13668 posData.tweenData.y = posData.posOut.y - posData.posIn.y; 13669 // Process width, height, and margins 13670 if (self.config.animation.animateResizeTargets) { 13671 posData.posIn.width = posData.startPosData.width; 13672 posData.posIn.height = posData.startPosData.height; 13673 widthChange = posData.startPosData.width - posData.interPosData.width; 13674 posData.posIn.marginRight = posData.startPosData.marginRight - widthChange; 13675 heightChange = posData.startPosData.height - posData.interPosData.height; 13676 posData.posIn.marginBottom = posData.startPosData.marginBottom - heightChange; 13677 } 13678 // Process opacity 13679 posData.posIn.opacity = 1; 13680 posData.posOut.opacity = self.effectsOut.opacity; 13681 posData.tweenData.opacity = posData.posOut.opacity - posData.posIn.opacity; 13682 // Process transforms 13683 for(j = 0; effectName = effectNames[j]; j++){ 13684 effect = self.effectsOut[effectName]; 13685 if (!(effect instanceof mixitup.TransformData) || !effect.value) continue; 13686 posData.posIn[effectName].value = 0; 13687 posData.posOut[effectName].value = effect.value; 13688 posData.tweenData[effectName].value = posData.posOut[effectName].value - posData.posIn[effectName].value; 13689 posData.posIn[effectName].unit = posData.posOut[effectName].unit = posData.tweenData[effectName].unit = effect.unit; 13690 } 13691 } 13692 self.callActions("afterGetTweenData", arguments); 13693 }, 13694 /** 13695 * @private 13696 * @instance 13697 * @since 3.0.0 13698 * @param {Operation} operation 13699 * @return {void} 13700 */ moveTargets: function moveTargets(operation) { 13701 var self = this, target = null, moveData = null, posData = null, statusChange = "", willTransition = false, staggerIndex = -1, i = -1, checkProgress = self.checkProgress.bind(self); 13702 self.callActions("beforeMoveTargets", arguments); 13703 // TODO: this is an extra loop in addition to the calcs 13704 // done in getOperation, could some of this be done there? 13705 for(i = 0; target = operation.show[i]; i++){ 13706 moveData = new mixitup.IMoveData(); 13707 posData = operation.showPosData[i]; 13708 statusChange = target.isShown ? "none" : "show"; 13709 willTransition = self.willTransition(statusChange, operation.hasEffect, posData.posIn, posData.posOut); 13710 if (willTransition) // Prevent non-transitioning targets from incrementing the staggerIndex 13711 staggerIndex++; 13712 target.show(); 13713 moveData.posIn = posData.posIn; 13714 moveData.posOut = posData.posOut; 13715 moveData.statusChange = statusChange; 13716 moveData.staggerIndex = staggerIndex; 13717 moveData.operation = operation; 13718 moveData.callback = willTransition ? checkProgress : null; 13719 target.move(moveData); 13720 } 13721 for(i = 0; target = operation.toHide[i]; i++){ 13722 posData = operation.toHidePosData[i]; 13723 moveData = new mixitup.IMoveData(); 13724 statusChange = "hide"; 13725 willTransition = self.willTransition(statusChange, posData.posIn, posData.posOut); 13726 moveData.posIn = posData.posIn; 13727 moveData.posOut = posData.posOut; 13728 moveData.statusChange = statusChange; 13729 moveData.staggerIndex = i; 13730 moveData.operation = operation; 13731 moveData.callback = willTransition ? checkProgress : null; 13732 target.move(moveData); 13733 } 13734 if (self.config.animation.animateResizeContainer) { 13735 self.dom.parent.style[mixitup.features.transitionProp] = "height " + self.config.animation.duration + "ms ease, " + "width " + self.config.animation.duration + "ms ease "; 13736 requestAnimationFrame(function() { 13737 if (operation.startHeight !== operation.newHeight && operation.viewportDeltaY !== operation.startHeight - operation.newHeight) self.dom.parent.style.height = operation.newHeight + "px"; 13738 if (operation.startWidth !== operation.newWidth && operation.viewportDeltaX !== operation.startWidth - operation.newWidth) self.dom.parent.style.width = operation.newWidth + "px"; 13739 }); 13740 } 13741 if (operation.willChangeLayout) { 13742 h.removeClass(self.dom.container, self.config.layout.ContainerClassName); 13743 h.addClass(self.dom.container, operation.newContainerClassName); 13744 } 13745 self.callActions("afterMoveTargets", arguments); 13746 }, 13747 /** 13748 * @private 13749 * @instance 13750 * @return {boolean} 13751 */ hasEffect: function hasEffect() { 13752 var self = this, EFFECTABLES = [ 13753 "scale", 13754 "translateX", 13755 "translateY", 13756 "translateZ", 13757 "rotateX", 13758 "rotateY", 13759 "rotateZ" 13760 ], effectName = "", effect = null, result = false, value = -1, i =
13760-1; 13761 if (self.effectsIn.opacity !== 1) return self.callFilters("resultHasEffect", true, arguments); 13762 for(i = 0; effectName = EFFECTABLES[i]; i++){ 13763 effect = self.effectsIn[effectName]; 13764 value = (typeof effect === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(effect)) && effect.value !== "undefined" ? effect.value : effect; 13765 if (value !== 0) { 13766 result = true; 13767 break; 13768 } 13769 } 13770 return self.callFilters("resultHasEffect", result, arguments); 13771 }, 13772 /** 13773 * Determines if a target element will transition in 13774 * some fasion and therefore requires binding of 13775 * transitionEnd 13776 * 13777 * @private 13778 * @instance 13779 * @since 3.0.0 13780 * @param {string} statusChange 13781 * @param {boolean} hasEffect 13782 * @param {StyleData} posIn 13783 * @param {StyleData} posOut 13784 * @return {boolean} 13785 */ willTransition: function willTransition(statusChange, hasEffect, posIn, posOut) { 13786 var self = this, result = false;
13787 if (!h.isVisible(self.dom.container)) // If the container is not visible, the transitionEnd 13788 // event will not occur and MixItUp will hang 13789 result = false; 13790 else if (statusChange !== "none" && hasEffect || posIn.x !== posOut.x || posIn.y !== posOut.y) // If opacity and/or translate will change 13791 result = true; 13792 else if (self.config.animation.animateResizeTargets) // Check if width, height or margins will change 13793 result = posIn.width !== posOut.width || posIn.height !== posOut.height || posIn.marginRight !== posOut.marginRight || posIn.marginTop !== posOut.marginTop; 13794 else result = false; 13795 return self.callFilters("resultWillTransition", result, arguments); 13796 }, 13797 /** 13798 * @private 13799 * @instance 13800 * @since 2.0.0 13801 * @param {Operation} operation 13802 * @return {void} 13803 */ checkProgress: function checkProgress(operation) { 13804 var self = this; 13805 self.targetsDone++; 13806 if (self.targetsBound === self.targetsDone) self.cleanUp(operation); 13807 }, 13808 /** 13809 * @private 13810 * @instance 13811 * @since 2.0.0 13812 * @param {Operation} operation 13813 * @return {void} 13814 */ cleanUp: function cleanUp(operation) { 13815 var self = this, target = null, whitespaceBefore = null, whitespaceAfter = null, nextInQueue = null, i = -1; 13816 self.callActions("beforeCleanUp", arguments); 13817 self.targetsMoved = self.targetsImmovable = self.targetsBound = self.targetsDone = 0; 13818 for(i = 0; target = operation.show[i]; i++){ 13819 target.cleanUp(); 13820 target.show(); 13821 } 13822 for(i = 0; target = operation.toHide[i]; i++){ 13823 target.cleanUp(); 13824 target.hide(); 13825 } 13826 if (operation.willSort) self.printSort(false, operation); 13827 // Remove any styles applied to the parent container 13828 self.dom.parent.style[mixitup.features.transitionProp] = self.dom.parent.style.height = self.dom.parent.style.width = self.dom.parent.style.overflow = self.dom.parent.style[mixitup.features.perspectiveProp] = self.dom.parent.style[mixitup.features.perspectiveOriginProp] = ""; 13829 if (operation.willChangeLayout) { 13830 h.removeClass(self.dom.container, operation.startContainerClassName); 13831 h.addClass(self.dom.container, operation.newContainerClassName); 13832 } 13833 if (operation.toRemove.length) { 13834 for(i = 0; target = self.targets[i]; i++)if (operation.toRemove.indexOf(target) > -1) { 13835 if ((whitespaceBefore = target.dom.el.previousSibling) && whitespaceBefore.nodeName === "#text" && (whitespaceAfter = target.dom.el.nextSibling) && whitespaceAfter.nodeName === "#text") h.removeWhitespace(whitespaceBefore); 13836 if (!operation.willSort) // NB: Sorting will remove targets as a bi-product of `printSort()` 13837 self.dom.parent.removeChild(target.dom.el); 13838 self.targets.splice(i, 1); 13839 target.isInDom = false;
13840 i--; 13841 } 13842 // Since targets have been removed, the original order must be updated 13843 self.origOrder = self.targets; 13844 } 13845 if (operation.willSort) self.targets = operation.newOrder; 13846 self.state = operation.newState; 13847 self.lastOperation = operation; 13848 self.dom.targets = self.state.targets; 13849 // mixEnd 13850 mixitup.events.fire("mixEnd", self.dom.container, { 13851 state: self.state, 13852 instance: self 13853 }, self.dom.document); 13854 if (typeof self.config.callbacks.onMixEnd === "function") self.config.callbacks.onMixEnd.call(self.dom.container, self.state, self); 13855 if (operation.hasFailed) { 13856 // mixFail 13857 mixitup.events.fire("mixFail", self.dom.container, { 13858 state: self.state, 13859 instance: self 13860 }, self.dom.document); 13861 if (typeof self.config.callbacks.onMixFail === "function") self.config.callbacks.onMixFail.call(self.dom.container, self.state, self); 13862 h.addClass(self.dom.container, h.getClassname(self.config.classNames, "container", self.config.classNames.modifierFailed)); 13863 } 13864 // User-defined callback function 13865 if (typeof self.userCallback === "function") self.userCallback.call(self.dom.container, self.state, self); 13866 if (typeof self.userDeferred.resolve === "function") self.userDeferred.resolve(self.state); 13867 self.userCallback = null; 13868 self.userDeferred = null; 13869 self.lastClicked = null; 13870 self.isToggling = false; 13871 self.isBusy = false; 13872 if (self.queue.length) { 13873 self.callActions("beforeReadQueueCleanUp", arguments); 13874 nextInQueue = self.queue.shift(); 13875 // Update non-public API properties stored in queue 13876 self.userDeferred = nextInQueue.deferred; 13877 self.isToggling = nextInQueue.isToggling; 13878 self.lastClicked = nextInQueue.triggerElement; 13879 if (nextInQueue.instruction.command instanceof mixitup.CommandMultimix) self.multimix.apply(self, nextInQueue.args); 13880 else self.dataset.apply(self, nextInQueue.args); 13881 } 13882 self.callActions("afterCleanUp", arguments); 13883 }, 13884 /** 13885 * @private 13886 * @instance 13887 * @since 2.0.0 13888 * @param {Array<*>} args 13889 * @return {mixitup.UserInstruction} 13890 */ parseMultimixArgs: function parseMultimixArgs(args) { 13891 var self = this, instruction = new mixitup.UserInstruction(), arg = null, i = -1; 13892 instruction.animate = self.config.animation.enable; 13893 instruction.command = new mixitup.CommandMultimix(); 13894 for(i = 0; i < args.length; i++){ 13895 arg = args[i]; 13896 if (arg === null) continue; 13897 if (typeof arg === "object") h.extend(instruction.command, arg); 13898 else if (typeof arg === "boolean") instruction.animate = arg; 13899 else if (typeof arg === "function") instruction.callback = arg; 13900 } 13901 // Coerce arbitrary command arguments into typed command objects 13902 if (instruction.command.insert && !(instruction.command.insert instanceof mixitup.CommandInsert)) instruction.command.insert = self.parseInsertArgs([ 13903 instruction.command.insert 13904 ]).command; 13905 if (instruction.command.remove && !(instruction.command.remove instanceof mixitup.CommandRemove)) instruction.command.remove = self.parseRemoveArgs([ 13906 instruction.command.remove 13907 ]).command; 13908 if (instruction.command.filter && !(instruction.command.filter instanceof mixitup.CommandFilter)) instruction.command.filter = self.parseFilterArgs([ 13909 instruction.command.filter 13910 ]).command; 13911 if (instruction.command.sort && !(instruction.command.sort instanceof mixitup.CommandSort)) instruction.command.sort = self.parseSortArgs([ 13912 instruction.command.sort 13913 ]).command; 13914 if (instruction.command.changeLayout && !(instruction.command.changeLayout instanceof mixitup.CommandChangeLayout)) instruction.command.changeLayout = self.parseChangeLayoutArgs([ 13915 instruction.command.changeLayout 13916 ]).command; 13917 instruction = self.callFilters("instructionParseMultimixArgs", instruction, arguments); 13918 h.freeze(instruction); 13919 return instruction; 13920 }, 13921 /** 13922 * @private 13923 * @instance 13924 * @since 2.0.0 13925 * @param {Array<*>} args 13926 * @return {mixitup.UserInstruction} 13927 */ parseFilterArgs: function parseFilterArgs(args) { 13928 var self = this, instruction = new mixitup.UserInstruction(), arg = null, i = -1; 13929 instruction.animate = self.config.animation.enable; 13930 instruction.command = new mixitup.CommandFilter(); 13931 for(i = 0; i < args.length; i++){ 13932 arg = args[i]; 13933 if (typeof arg === "string") // Selector 13934 instruction.command.selector = arg; 13935 else if (arg === null) instruction.command.collection = []; 13936 else if (typeof arg === "object" && h.isElement(arg, self.dom.document)) // Single element 13937 instruction.command.collection = [ 13938 arg 13939 ]; 13940 else if (typeof arg === "object" && typeof arg.length !== "undefined") // Multiple elements in array, NodeList or jQuery collection 13941 instruction.command.collection = h.arrayFromList(
13941arg); 13942 else if (typeof arg === "object") // Filter command 13943 h.extend(instruction.command, arg); 13944 else if (typeof arg === "boolean") instruction.animate = arg; 13945 else if (typeof arg === "function") instruction.callback = arg; 13946 } 13947 if (instruction.command.selector && instruction.command.collection) throw new Error(mixitup.messages.errorFilterInvalidArguments()); 13948 instruction = self.callFilters("instructionParseFilterArgs", instruction, arguments); 13949 h.freeze(instruction); 13950 return instruction; 13951 }, 13952 parseSortArgs: function parseSortArgs(args) { 13953 var self = this, instruction = new mixitup.UserInstruction(), arg = null, sortString = "", i = -1; 13954 instruction.animate = self.config.animation.enable; 13955 instruction.command = new mixitup.CommandSort(); 13956 for(i = 0; i < args.length; i++){ 13957 arg = args[i]; 13958 if (arg === null) continue; 13959 switch(typeof arg === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(arg)){ 13960 case "string": 13961 // Sort string 13962 sortString = arg; 13963 break; 13964 case "object": 13965 // Array of element references 13966 if (arg.length) instruction.command.collection = h.arrayFromList(arg); 13967 break; 13968 case "boolean": 13969 instruction.animate = arg; 13970 break; 13971 case "function": 13972 instruction.callback = arg; 13973 break; 13974 } 13975 } 13976 if (sortString) instruction.command = self.parseSortString(sortString, instruction.command); 13977 instruction = self.callFilters("instructionParseSortArgs", instruction, arguments); 13978 h.freeze(instruction); 13979 return instruction; 13980 }, 13981 /** 13982 * @private 13983 * @instance 13984 * @since 2.0.0 13985 * @param {Array<*>} args 13986 * @return {mixitup.UserInstruction} 13987 */ parseInsertArgs: function parseInsertArgs(args) { 13988 var self = this, instruction = new mixitup.UserInstruction(), arg = null, i = -1; 13989 instruction.animate = self.config.animation.enable; 13990 instruction.command = new mixitup.CommandInsert(); 13991 for(i = 0; i < args.length; i++){ 13992 arg = args[i]; 13993 if (arg === null) continue; 13994 if (typeof arg === "number") // Insert index 13995 instruction.command.index = arg; 13996 else if (typeof arg === "string" && [ 13997 "before", 13998 "after" 13999 ].indexOf(arg) > -1) // 'before'/'after' 14000 instruction.command.position = arg; 14001 else if (typeof arg === "string") // Markup 14002 instruction.command.collection = h.arrayFromList(h.createElement(arg).childNodes); 14003 else if (typeof arg === "object" && h.isElement(arg, self.dom.document)) // Single element 14004 !instruction.command.collection.length ? instruction.command.collection = [ 14005 arg 14006 ] : instruction.command.sibling = arg; 14007 else if (typeof arg === "object" && arg.length) // Multiple elements in array or jQuery collection 14008 !instruction.command.collection.length ? instruction.command.collection = arg : instruction.command.sibling = arg[0]; 14009 else if (typeof arg === "object" && arg.childNodes && arg.childNodes.length) // Document fragment 14010 !instruction.command.collection.length ? instruction.command.collection = h.arrayFromList(arg.childNodes) : instruction.command.sibling = arg.childNodes[0]; 14011 else if (typeof arg === "object") // Insert command 14012 h.extend(instruction.command, arg); 14013 else if (typeof arg === "boolean") instruction.animate = arg; 14014 else if (typeof arg === "function") instruction.callback = arg; 14015 } 14016 if (instruction.command.index && instruction.command.sibling) throw new Error(mixitup.messages.errorInsertInvalidArguments()); 14017 if (!instruction.command.collection.length && self.config.debug.showWarnings) console.warn(mixitup.messages.warningInsertNoElements()); 14018 instruction = self.callFilters("instructionParseInsertArgs", instruction, arguments); 14019 h.freeze(instruction); 14020 return instruction; 14021 }, 14022 /** 14023 * @private 14024 * @instance 14025 * @since 3.0.0 14026 * @param {Array<*>} args 14027 * @return {mixitup.UserInstruction} 14028 */ parseRemoveArgs: function parseRemoveArgs(args) { 14029 var self = this, instruction = new mixitup.UserInstruction(), target = null, arg = null, i = -1; 14030 instruction.animate = self.config.animation.enable; 14031 instruction.command = new mixitup.CommandRemove(); 14032 for(i = 0; i < args.length; i++){ 14033 arg = args[i]; 14034 if (arg === null) continue; 14035 switch(typeof arg === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(arg)){ 14036 case "number": 14037 if (self.targets[arg]) instruction.command.targets[0] = self.targets[arg]; 14038 break; 14039 case "string": 14040 instruction.command.collection = h.arrayFromList(self.dom.parent.querySelectorAll(arg)); 14041 break; 14042 case "object": 14043 if (arg && arg.length) instruction.command.collection = arg; 14044 else if (h.isElement(arg, self.dom.document)) instruction.command.collection = [ 14045 arg 14046 ];
14047 else // Remove command 14048 h.extend(instruction.command, arg); 14049 break; 14050 case "boolean": 14051 instruction.animate = arg; 14052 break; 14053 case "function": 14054 instruction.callback = arg; 14055 break; 14056 } 14057 } 14058 if (instruction.command.collection.length) { 14059 for(i = 0; target = self.targets[i]; i++)if (instruction.command.collection.indexOf(target.dom.el) > -1) instruction.command.targets.push(target); 14060 } 14061 if (!instruction.command.targets.length && self.config.debug.showWarnings) console.warn(mixitup.messages.warningRemoveNoElements()); 14062 h.freeze(instruction); 14063 return instruction; 14064 }, 14065 /** 14066 * @private 14067 * @instance 14068 * @since 3.0.0 14069 * @param {Array<*>} args 14070 * @return {mixitup.UserInstruction} 14071 */ parseDatasetArgs: function parseDatasetArgs(args) { 14072 var self = this, instruction = new mixitup.UserInstruction(), arg = null, i = -1; 14073 instruction.animate = self.config.animation.enable; 14074 instruction.command = new mixitup.CommandDataset(); 14075 for(i = 0; i < args.length; i++){ 14076 arg = args[i]; 14077 if (arg === null) continue; 14078 switch(typeof arg === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(arg)){ 14079 case "object": 14080 if (Array.isArray(arg) || typeof arg.length === "number") instruction.command.dataset = arg; 14081 else // Change layout command 14082 h.extend(instruction.command, arg); 14083 break; 14084 case "boolean": 14085 instruction.animate = arg; 14086 break; 14087 case "function": 14088 instruction.callback = arg; 14089 break; 14090 } 14091 } 14092 h.freeze(instruction); 14093 return instruction; 14094 }, 14095 /** 14096 * @private 14097 * @instance 14098 * @since 3.0.0 14099 * @param {Array<*>} args 14100 * @return {mixitup.UserInstruction} 14101 */ parseChangeLayoutArgs: function parseChangeLayoutArgs(args) { 14102 var self = this, instruction = new mixitup.UserInstruction(), arg = null, i = -1; 14103 instruction.animate = self.config.animation.enable; 14104 instruction.command = new mixitup.CommandChangeLayout(); 14105 for(i = 0; i < args.length; i++){ 14106 arg = args[i]; 14107 if (arg === null) continue; 14108 switch(typeof arg === "undefined" ? "undefined" : (0, _typeOfMjsDefault.default)(arg)){ 14109 case "string": 14110 instruction.command.containerClassName = arg; 14111 break; 14112 case "object": 14113 // Change layout command 14114 h.extend(instruction.command, arg); 14115 break; 14116 case "boolean": 14117 instruction.animate = arg; 14118 break; 14119 case "function": 14120 instruction.callback = arg; 14121 break; 14122 } 14123 } 14124 h.freeze(instruction); 14125 return instruction; 14126 }, 14127 /** 14128 * @private 14129 * @instance 14130 * @since 3.0.0 14131 * @param {mixitup.QueueItem} queueItem 14132 * @return {Promise.<mixitup.State>} 14133 */ queueMix: function queueMix(queueItem) { 14134 var self = this, deferred = null, toggleSelector = ""; 14135 self.callActions("beforeQueueMix", arguments); 14136 deferred = h.defer(mixitup.libraries); 14137 if (self.config.animation.queue && self.queue.length < self.config.animation.queueLimit) { 14138 queueItem.deferred = deferred; 14139 self.queue.push(queueItem); 14140 // Keep controls in sync with user interactions. Mixer will catch up as it drains the queue. 14141 if (self.config.controls.enable) { 14142 if (self.isToggling) { 14143 self.buildToggleArray(queueItem.instruction.command); 14144 toggleSelector = self.getToggleSelector(); 14145 self.updateControls({ 14146 filter: { 14147 selector: toggleSelector 14148 } 14149 }); 14150 } else self.updateControls(queueItem.instruction.command); 14151 } 14152 } else { 14153 if (self.config.debug.showWarnings) console.warn(mixitup.messages.warningMultimixInstanceQueueFull()); 14154 deferred.resolve(self.state); 14155 mixitup.events.fire("mixBusy", self.dom.container, { 14156 state: self.state, 14157 instance: self 14158 }, self.dom.document); 14159 if (typeof self.config.callbacks.onMixBusy === "function") self.config.callbacks.onMixBusy.call(self.dom.container, self.state, self); 14160 } 14161 return self.callFilters("promiseQueueMix", deferred.promise, arguments); 14162 }, 14163 /** 14164 * @private 14165 * @instance 14166 * @since 3.0.0 14167 * @param {Array.<object>} newDataset 14168 * @return {Operation} 14169 */ getDataOperation: function getDataOperation(newDataset) { 14170 var self = this, operation = new mixitup.Operation(), startDataset = []; 14171 operation = self.callFilters("operationUnmappedGetDataOperation", operation, arguments); 14172 if (self.dom.targets.length && !(startDataset = self.state.activeDataset || []).length) throw new Error(mixitup.messages.errorDatasetNotSet()); 14173 operation.id = h.randomHex(); 14174 operation.startState = self.state; 14175 operation.startDataset = startDataset;
14176 operation.newDataset = newDataset.slice(); 14177 self.diffDatasets(operation); 14178 operation.startOrder = self.targets; 14179 operation.newOrder = operation.show; 14180 if (self.config.animation.enable) { 14181 self.getStartMixData(operation); 14182 self.setInter(operation); 14183 operation.docState = h.getDocumentState(self.dom.document); 14184 self.getInterMixData(operation); 14185 self.setFinal(operation); 14186 self.getFinalMixData(operation); 14187 self.parseEffects(); 14188 operation.hasEffect = self.hasEffect(); 14189 self.getTweenData(operation); 14190 } 14191 self.targets = operation.show.slice(); 14192 operation.newState = self.buildState(operation); 14193 // NB: Targets to be removed must be included in `self.targets` for removal during clean up, 14194 // but are added after state is built so that state is accurate 14195 Array.prototype.push.apply(self.targets, operation.toRemove); 14196 operation = self.callFilters("operationMappedGetDataOperation", operation, arguments); 14197 return operation; 14198 }, 14199 /** 14200 * @private 14201 * @instance 14202 * @since 3.0.0 14203 * @param {mixitup.Operation} operation 14204 * @return {void} 14205 */ diffDatasets: function diffDatasets(operation) { 14206 var self = this, persistantStartIds = [], persistantNewIds = [], insertedTargets = [], data = null, target = null, el = null, frag = null, nextEl = null, uids = {}, id = "", i = -1; 14207 self.callActions("beforeDiffDatasets", arguments); 14208 for(i = 0; data = operation.newDataset[i]; i++){ 14209 if (typeof (id = data[self.config.data.uidKey]) === "undefined" || id.toString().length < 1) throw new TypeError(mixitup.messages.errorDatasetInvalidUidKey({ 14210 uidKey: self.config.data.uidKey 14211 })); 14212 if (!uids[id]) uids[id] = true; 14213 else throw new Error(mixitup.messages.errorDatasetDuplicateUid({ 14214 uid: id 14215 })); 14216 if ((target = self.cache[id]) instanceof mixitup.Target) { 14217 // Already in cache 14218 if (self.config.data.dirtyCheck && !h.deepEquals(data, target.data)) { 14219 // change detected 14220 el = target.render(data); 14221 target.data = data; 14222 if (el !== target.dom.el) { 14223 // Update target element reference 14224 if (target.isInDom) { 14225 target.unbindEvents(); 14226 self.dom.parent.replaceChild(el, target.dom.el); 14227 } 14228 if (!target.isShown) el.style.display = "none"; 14229 target.dom.el = el; 14230 if (target.isInDom) target.bindEvents(); 14231 } 14232 } 14233 el = target.dom.el; 14234 } else { 14235 // New target 14236 target = new mixitup.Target(); 14237 target.init(null, self, data); 14238 target.hide(); 14239 } 14240 if (!target.isInDom) { 14241 // Adding to DOM 14242 if (!frag) // Open frag 14243 frag = self.dom.document.createDocumentFragment(); 14244 if (frag.lastElementChild) frag.appendChild(self.dom.document.createTextNode(" ")); 14245 frag.appendChild(target.dom.el); 14246 target.isInDom = true; 14247 target.unbindEvents(); 14248 target.bindEvents(); 14249 target.hide(); 14250 operation.toShow.push(target); 14251 insertedTargets.push(target); 14252 } else { 14253 // Already in DOM 14254 nextEl = target.dom.el.nextElementSibling; 14255 persistantNewIds.push(id); 14256 if (frag) { 14257 // Close and insert previously opened frag 14258 if (frag.lastElementChild) frag.appendChild(self.dom.document.createTextNode(" ")); 14259 self.insertDatasetFrag(frag, target.dom.el, insertedTargets); 14260 frag = null; 14261 } 14262 } 14263 operation.show.push(target); 14264 } 14265 if (frag) { 14266 // Unclosed frag remaining 14267 nextEl = nextEl || self.config.layout.siblingAfter; 14268 if (nextEl) frag.appendChild(self.dom.document.createTextNode(" ")); 14269 self.insertDatasetFrag(frag, nextEl, insertedTargets); 14270 } 14271 for(i = 0; data = operation.startDataset[i]; i++){ 14272 id = data[self.config.data.uidKey]; 14273 target = self.cache[id]; 14274 if (operation.show.indexOf(target) < 0) { 14275 // Previously shown but now absent 14276 operation.hide.push(target);
14277 operation.toHide.push(target); 14278 operation.toRemove.push(target); 14279 } else persistantStartIds.push(id); 14280 } 14281 if (!h.isEqualArray(persistantStartIds, persistantNewIds)) operation.willSort = true; 14282 self.callActions("afterDiffDatasets", arguments); 14283 }, 14284 /** 14285 * @private 14286 * @instance 14287 * @since 3.1.5 14288 * @param {DocumentFragment} frag 14289 * @param {(HTMLElement|null)} nextEl 14290 * @param {Array.<mixitup.Target>} targets 14291 * @return {void} 14292 */ insertDatasetFrag: function insertDatasetFrag(frag, nextEl, targets) { 14293 var self = this; 14294 var insertAt = nextEl ? h.arrayFromList(self.dom.parent.children).indexOf(nextEl) : self.targets.length; 14295 self.dom.parent.insertBefore(frag, nextEl); 14296 while(targets.length){ 14297 self.targets.splice(insertAt, 0, targets.shift()); 14298 insertAt++; 14299 } 14300 }, 14301 /** 14302 * @private 14303 * @instance 14304 * @since 3.0.0 14305 * @param {mixitup.CommandSort} sortCommandA 14306 * @param {mixitup.CommandSort} sortCommandB 14307 * @return {boolean} 14308 */ willSort: function willSort(sortCommandA, sortCommandB) { 14309 var self = this, result = false;
14310 if (self.config.behavior.liveSort || sortCommandA.order === "random" || sortCommandA.attribute !== sortCommandB.attribute || sortCommandA.order !== sortCommandB.order || sortCommandA.collection !== sortCommandB.collection || sortCommandA.next === null && sortCommandB.next || sortCommandA.next && sortCommandB.next === null) result = true; 14311 else if (sortCommandA.next && sortCommandB.next) result = self.willSort(sortCommandA.next, sortCommandB.next); 14312 else result = false; 14313 return self.callFilters("resultWillSort", result, arguments); 14314 }, 14315 /** 14316 * A shorthand method for `.filter('all')`. Shows all targets in the container. 14317 * 14318 * @example 14319 * 14320 * .show() 14321 * 14322 * @example <caption>Example: Showing all targets</caption> 14323 * 14324 * mixer.show() 14325 * .then(function(state) { 14326 * console.log(state.totalShow === state.totalTargets); // true 14327 * }); 14328 * 14329 * @public 14330 * @instance 14331 * @since 3.0.0 14332 * @return {Promise.<mixitup.State>} 14333 */ show: function show() { 14334 var self = this; 14335 return self.filter("all"); 14336 }, 14337 /** 14338 * A shorthand method for `.filter('none')`. Hides all targets in the container. 14339 * 14340 * @example 14341 * 14342 * .hide() 14343 * 14344 * @example <caption>Example: Hiding all targets</caption> 14345 * 14346 * mixer.hide() 14347 * .then(function(state) { 14348 * console.log(state.totalShow === 0); // true 14349 * console.log(state.totalHide === state.totalTargets); // true 14350 * }); 14351 * 14352 * @public 14353 * @instance 14354 * @since 3.0.0 14355 * @return {Promise.<mixitup.State>} 14356 */ hide: function hide() { 14357 var self = this; 14358 return self.filter("none"); 14359 }, 14360 /** 14361 * Returns a boolean indicating whether or not a MixItUp operation is 14362 * currently in progress. 14363 * 14364 * @example 14365 * 14366 * .isMixing() 14367 * 14368 * @example <caption>Example: Checking the status of a mixer</caption> 14369 * 14370 * mixer.sort('random', function() { 14371 * console.log(mixer.isMixing()) // false 14372 * }); 14373 * 14374 * console.log(mixer.isMixing()) // true 14375 * 14376 * @public 14377 * @instance 14378 * @since 2.0.0 14379 * @return {boolean} 14380 */ isMixing: function isMixing() { 14381 var self = this; 14382 return self.isBusy; 14383 }, 14384 /** 14385 * Filters all targets in the container by a provided selector string, or the values `'all'` 14386 * or `'none'`. Only targets matching the selector will be shown. 14387 * 14388 * @example 14389 * 14390 * .filter(selector [, animate] [, callback]) 14391 * 14392 * @example <caption>Example 1: Filtering targets by a class selector</caption> 14393 * 14394 * mixer.filter('.category-a') 14395 * .then(function(state) { 14396 * console.log(state.totalShow === containerEl.querySelectorAll('.category-a').length); // true 14397 * }); 14398 * 14399 * @example <caption>Example 2: Filtering targets by an attribute selector</caption> 14400 * 14401 * mixer.filter('[data-category~="a"]') 14402 * .then(function(state) { 14403 * console.log(state.totalShow === containerEl.querySelectorAll('[data-category~="a"]').length); // true 14404 * }); 14405 * 14406 * @example <caption>Example 3: Filtering targets by a compound selector</caption> 14407 * 14408 * // Show only those targets with the classes 'category-a' AND 'category-b' 14409 * 14410 * mixer.filter('.category-a.category-c') 14411 * .then(function(state) { 14412 * console.log(state.totalShow === containerEl.querySelectorAll('.category-a.category-c').length); // true 14413 * }); 14414 * 14415 * @example <caption>Example 4: Filtering via an element collection</caption> 14416 * 14417 * var collection = Array.from(container.querySelectorAll('.mix')); 14418 * 14419 * console.log(collection.length); // 34 14420 * 14421 * // Filter the collection manually using Array.prototype.filter 14422 * 14423 * var filtered = collection.filter(function(target) { 14424 * return parseInt(target.getAttribute('data-price')) > 10; 14425 * }); 14426 * 14427 * console.log(filtered.length); // 22 14428 * 14429 * // Pass the filtered collection to MixItUp 14430 * 14431 * mixer.filter(filtered) 14432 * .then(function(state) { 14433 * console.log(state.activeFilter.collection.length === 22); // true 14434 * }); 14435 * 14436 * @public 14437 * @instance 14438 * @since 2.0.0 14439 * @param {(string|HTMLElement|Array.<HTMLElement>)} selector 14440 * Any valid CSS selector (i.e. `'.category-a'`), or the values `'all'` or `'none'`. The filter method also accepts a reference to single target element or a collection of target elements to show. 14441 * @param {boolean} [animate=true] 14442 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14443 * @param {function} [callback=null] 14444 * An optional callback function to be invoked after the operation has completed. 14445 * @return {Promise.<mixitup.State>} 14446 * A promise resolving with the current state object.
14447 */ filter: function filter() { 14448 var self = this, instruction = self.parseFilterArgs(arguments); 14449 return self.multimix({ 14450 filter: instruction.command 14451 }, instruction.animate, instruction.callback); 14452 }, 14453 /** 14454 * Adds an additional selector to the currently active filter selector, concatenating 14455 * as per the logic defined in `controls.toggleLogic`. 14456 * 14457 * @example 14458 * 14459 * .toggleOn(selector [, animate] [, callback]) 14460 * 14461 * @example <caption>Example: Toggling on a filter selector</caption> 14462 * 14463 * console.log(mixer.getState().activeFilter.selector); // '.category-a' 14464 * 14465 * mixer.toggleOn('.category-b') 14466 * .then(function(state) { 14467 * console.log(state.activeFilter.selector); // '.category-a, .category-b' 14468 * }); 14469 * 14470 * @public 14471 * @instance 14472 * @since 3.0.0 14473 * @param {string} selector 14474 * Any valid CSS selector (i.e. `'.category-a'`) 14475 * @param {boolean} [animate=true] 14476 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14477 * @param {function} [callback=null] 14478 * An optional callback function to be invoked after the operation has completed. 14479 * @return {Promise.<mixitup.State>} 14480 * A promise resolving with the current state object. 14481 */ toggleOn: function toggleOn() { 14482 var self = this, instruction = self.parseFilterArgs(arguments), selector = instruction.command.selector, toggleSelector = ""; 14483 self.isToggling = true; 14484 if (self.toggleArray.indexOf(selector) < 0) self.toggleArray.push(selector); 14485 toggleSelector = self.getToggleSelector(); 14486 return self.multimix({ 14487 filter: toggleSelector 14488 }, instruction.animate, instruction.callback); 14489 }, 14490 /** 14491 * Removes a selector from the active filter selector. 14492 * 14493 * @example 14494 * 14495 * .toggleOff(selector [, animate] [, callback]) 14496 * 14497 * @example <caption>Example: Toggling off a filter selector</caption> 14498 * 14499 * console.log(mixer.getState().activeFilter.selector); // '.category-a, .category-b' 14500 * 14501 * mixer.toggleOff('.category-b') 14502 * .then(function(state) { 14503 * console.log(state.activeFilter.selector); // '.category-a' 14504 * }); 14505 * 14506 * @public 14507 * @instance 14508 * @since 3.0.0 14509 * @param {string} selector 14510 * Any valid CSS selector (i.e. `'.category-a'`) 14511 * @param {boolean} [animate=true] 14512 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14513 * @param {function} [callback=null] 14514 * An optional callback function to be invoked after the operation has completed. 14515 * @return {Promise.<mixitup.State>} 14516 * A promise resolving with the current state object. 14517 */ toggleOff: function toggleOff() { 14518 var self = this, instruction = self.parseFilterArgs(arguments), selector = instruction.command.selector, selectorIndex = self.toggleArray.indexOf(selector), toggleSelector = ""; 14519 self.isToggling = true; 14520 if (selectorIndex > -1) self.toggleArray.splice(selectorIndex, 1); 14521 toggleSelector = self.getToggleSelector(); 14522 return self.multimix({ 14523 filter: toggleSelector 14524 }, instruction.animate, instruction.callback); 14525 }, 14526 /** 14527 * Sorts all targets in the container according to a provided sort string. 14528 * 14529 * @example 14530 * 14531 * .sort(sortString [, animate] [, callback]) 14532 * 14533 * @example <caption>Example 1: Sorting by the default DOM order</caption> 14534 * 14535 * // Reverse the default order of the targets 14536 * 14537 * mixer.sort('default:desc') 14538 * .then(function(state) { 14539 * console.log(state.activeSort.attribute === 'default'); // true 14540 * console.log(state.activeSort.order === 'desc'); // true 14541 * }); 14542 * 14543 * @example <caption>Example 2: Sorting by a custom data-attribute</caption> 14544 * 14545 * // Sort the targets by the value of a `data-published-date` attribute 14546 * 14547 * mixer.sort('published-date:asc') 14548 * .then(function(state) { 14549 * console.log(state.activeSort.attribute === 'published-date'); // true 14550 * console.log(state.activeSort.order === 'asc'); // true 14551 * }); 14552 * 14553 * @example <caption>Example 3: Sorting by multiple attributes</caption> 14554 * 14555 * // Sort the targets by the value of a `data-published-date` attribute, then by `data-title` 14556 * 14557 * mixer.sort('published-date:desc data-title:asc') 14558 * .then(function(state) { 14559 * console.log(state.activeSort.attribute === 'published-date'); // true 14560 * console.log(state.activeSort.order === 'desc'); // true 14561 * 14562 * console.log(state.activeSort.next.attribute === 'title'); // true 14563 * console.log(state.activeSort.next.order === 'asc'); // true 14564 * }); 14565 * 14566 * @example <caption>Example 4: Sorting by random</caption> 14567 * 14568 * mixer.sort('random') 14569 * .then(function(state) { 14570 * console.log(state.activeSort.order === 'random') // true 14571 * }); 14572 * 14573 * @example <caption>Example 5: Sorting via an element collection</caption> 14574 * 14575 * var collection = Array.from(container.querySelectorAll('.mix')); 14576 * 14577 * // Swap the position of two elements in the collection: 14578 * 14579 * var temp = collection[1]; 14580 * 14581 * collection[1] = collection[0]; 14582 * collection[0] = temp; 14583 * 14584 * // Pass the sorted collection to MixItUp 14585 * 14586 * mixer.sort(collection) 14587 * .then(function(state) { 14588 * console.log(state.targets[0] === collection[0]); // true 14589 * }); 14590 * 14591 * @public 14592 * @instance 14593 * @since 2.0.0 14594 * @param {(string|Array.<HTMLElement>)} sortString 14595 * A valid sort string (e.g. `'default'`, `'published-date:asc'`, or `'random'`). The sort method also accepts an array of all target elements in a user-defined order. 14596 * @param {boolean} [animate=true] 14597 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14598 * @param {function} [callback=null] 14599 * An optional callback function to be invoked after the operation has completed. 14600 * @return {Promise.<mixitup.State>} 14601 * A promise resolving with the current state object. 14602 */ sort: function sort() { 14603 var self = this, instruction = self.parseSortArgs(arguments); 14604 return self.multimix({ 14605 sort: instruction.command 14606 }, instruction.animate, instruction.callback); 14607 }, 14608 /**
14609 * Changes the layout of the container by adding, removing or updating a 14610 * layout-specific class name. If `animation.animateResizetargets` is 14611 * enabled, MixItUp will attempt to gracefully animate the width, height, 14612 * and position of targets between layout states. 14613 * 14614 * @example 14615 * 14616 * .changeLayout(containerClassName [, animate] [, callback]) 14617 * 14618 * @example <caption>Example 1: Adding a new class name to the container</caption> 14619 * 14620 * mixer.changeLayout('container-list') 14621 * .then(function(state) { 14622 * console.log(state.activeContainerClass === 'container-list'); // true 14623 * }); 14624 * 14625 * @example <caption>Example 2: Removing a previously added class name from the container</caption> 14626 * 14627 * mixer.changeLayout('') 14628 * .then(function(state) { 14629 * console.log(state.activeContainerClass === ''); // true 14630 * }); 14631 * 14632 * @public 14633 * @instance 14634 * @since 2.0.0 14635 * @param {string} containerClassName 14636 * A layout-specific class name to add to the container. 14637 * @param {boolean} [animate=true] 14638 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14639 * @param {function} [callback=null] 14640 * An optional callback function to be invoked after the operation has completed. 14641 * @return {Promise.<mixitup.State>} 14642 * A promise resolving with the current state object. 14643 */ changeLayout: function changeLayout() { 14644 var self = this, instruction = self.parseChangeLayoutArgs(arguments); 14645 return self.multimix({ 14646 changeLayout: instruction.command 14647 }, instruction.animate, instruction.callback); 14648 }, 14649 /** 14650 * Updates the contents and order of the container to reflect the provided dataset, 14651 * if the dataset API is in use. 14652 * 14653 * The dataset API is designed for use in API-driven JavaScript applications, and 14654 * can be used instead of DOM-based methods such as `.filter()`, `.sort()`, 14655 * `.insert()`, etc. When used, insertion, removal, sorting and pagination can be 14656 * achieved purely via changes to your data model, without the uglyness of having 14657 * to interact with or query the DOM directly. 14658 * 14659 * @example 14660 * 14661 * .dataset(dataset [, animate] [, callback]) 14662 * 14663 * @example <caption>Example 1: Rendering a dataset</caption> 14664 * 14665 * var myDataset = [ 14666 * {id: 1, ...}, 14667 * {id: 2, ...}, 14668 * {id: 3, ...} 14669 * ]; 14670 * 14671 * mixer.dataset(myDataset) 14672 * .then(function(state) { 14673 * console.log(state.totalShow === 3); // true 14674 * }); 14675 * 14676 * @example <caption>Example 2: Sorting a dataset</caption> 14677 * 14678 * // Create a new dataset in reverse order 14679 * 14680 * var newDataset = myDataset.slice().reverse(); 14681 * 14682 * mixer.dataset(newDataset) 14683 * .then(function(state) { 14684 * console.log(state.activeDataset[0] === myDataset[2]); // true 14685 * }); 14686 * 14687 * @example <caption>Example 3: Removing an item from the dataset</caption> 14688 * 14689 * console.log(myDataset.length); // 3 14690 * 14691 * // Create a new dataset with the last item removed. 14692 * 14693 * var newDataset = myDataset.slice().pop(); 14694 * 14695 * mixer.dataset(newDataset) 14696 * .then(function(state) { 14697 * console.log(state.totalShow === 2); // true 14698 * }); 14699 * 14700 * @public 14701 * @instance 14702 * @since 3.0.0 14703 * @param {Array.<object>} dataset 14704 * An array of objects, each one representing the underlying data model of a target to be rendered. 14705 * @param {boolean} [animate=true] 14706 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14707 * @param {function} [callback=null] 14708 * An optional callback function to be invoked after the operation has completed. 14709 * @return {Promise.<mixitup.State>} 14710 * A promise resolving with the current state object. 14711 */ dataset: function dataset() { 14712 var self = this, instruction = self.parseDatasetArgs(arguments), operation = null, queueItem = null, animate = false;
14713 self.callActions("beforeDataset", arguments); 14714 if (!self.isBusy) { 14715 if (instruction.callback) self.userCallback = instruction.callback; 14716 animate = instruction.animate ^ self.config.animation.enable ? instruction.animate : self.config.animation.enable; 14717 operation = self.getDataOperation(instruction.command.dataset); 14718 return self.goMix(animate, operation); 14719 } else { 14720 queueItem = new mixitup.QueueItem(); 14721 queueItem.args = arguments; 14722 queueItem.instruction = instruction; 14723 return self.queueMix(queueItem); 14724 } 14725 }, 14726 /** 14727 * Performs simultaneous `filter`, `sort`, `insert`, `remove` and `changeLayout` 14728 * operations as requested. 14729 * 14730 * @example 14731 * 14732 * .multimix(multimixCommand [, animate] [, callback]) 14733 * 14734 * @example <caption>Example 1: Performing simultaneous filtering and sorting</caption> 14735 * 14736 * mixer.multimix({ 14737 * filter: '.category-b', 14738 * sort: 'published-date:desc' 14739 * }) 14740 * .then(function(state) { 14741 * console.log(state.activeFilter.selector === '.category-b'); // true 14742 * console.log(state.activeSort.attribute === 'published-date'); // true 14743 * }); 14744 * 14745 * @example <caption>Example 2: Performing simultaneous sorting, insertion, and removal</caption> 14746 * 14747 * console.log(mixer.getState().totalShow); // 6 14748 * 14749 * // NB: When inserting via `multimix()`, an object should be provided as the value 14750 * // for the `insert` portion of the command, allowing for a collection of elements 14751 * // and an insertion index to be specified. 14752 * 14753 * mixer.multimix({ 14754 * sort: 'published-date:desc', // Sort the container, including any new elements 14755 * insert: { 14756 * collection: [newElementReferenceA, newElementReferenceB], // Add 2 new elements at index 5 14757 * index: 5 14758 * }, 14759 * remove: existingElementReference // Remove 1 existing element 14760 * }) 14761 * .then(function(state) { 14762 * console.log(state.activeSort.attribute === 'published-date'); // true 14763 * console.log(state.totalShow === 7); // true 14764 * }); 14765 * 14766 * @public 14767 * @instance 14768 * @since 2.0.0 14769 * @param {object} multimixCommand 14770 * An object containing one or more things to do 14771 * @param {boolean} [animate=true] 14772 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14773 * @param {function} [callback=null] 14774 * An optional callback function to be invoked after the operation has completed. 14775 * @return {Promise.<mixitup.State>} 14776 * A promise resolving with the current state object. 14777 */ multimix: function multimix() { 14778 var self = this, operation = null, animate = false, queueItem = null, instruction = self.parseMultimixArgs(arguments); 14779 self.callActions("beforeMultimix", arguments); 14780 if (!self.isBusy) { 14781 operation = self.getOperation(instruction.command); 14782 if (self.config.controls.enable) { 14783 // Update controls for API calls 14784 if (instruction.command.filter && !self.isToggling) { 14785 // As we are not toggling, reset the toggle array 14786 // so new filter overrides existing toggles 14787 self.toggleArray.length = 0; 14788 self.buildToggleArray(operation.command); 14789 } 14790 if (self.queue.length < 1) self.updateControls(operation.command); 14791 } 14792 if (instruction.callback) self.userCallback = instruction.callback; 14793 // Always allow the instruction to override the instance setting 14794 animate = instruction.animate ^ self.config.animation.enable ? instruction.animate : self.config.animation.enable; 14795 self.callFilters("operationMultimix", operation, arguments); 14796 return self.goMix(animate, operation); 14797 } else { 14798 queueItem = new mixitup.QueueItem(); 14799 queueItem.args = arguments; 14800 queueItem.instruction = instruction; 14801 queueItem.triggerElement = self.lastClicked; 14802 queueItem.isToggling = self.isToggling; 14803 return self.queueMix(queueItem); 14804 } 14805 }, 14806 /** 14807 * @private 14808 * @instance 14809 * @since 3.0.0 14810 * @param {object} multimixCommand 14811 * @param {boolean} [isPreFetch] 14812 * An optional boolean indicating that the operation is being pre-fetched for execution at a later time. 14813 * @return {Operation|null} 14814 */ getOperation: function getOperation(multimixCommand) { 14815 var self = this, sortCommand = multimixCommand.sort, filterCommand = multimixCommand.filter, changeLayoutCommand = multimixCommand.changeLayout, removeCommand = multimixCommand.remove, insertCommand = multimixCommand.insert, operation = new mixitup.Operation(); 14816 operation = self.callFilters("operationUnmappedGetOperation", operation, arguments); 14817 operation.id = h.randomHex(); 14818 operation.command = multimixCommand; 14819 operation.startState = self.state; 14820 operation.triggerElement = self.lastClicked; 14821 if (self.isBusy) { 14822 if (self.config.debug.showWarnings) console.warn(mixitup.messages.warningGetOperationInstanceBusy()); 14823 return null; 14824 } 14825 if (insertCommand) self.insertTargets(insertCommand, operation);
14826 if (removeCommand) operation.toRemove = removeCommand.targets; 14827 operation.startSort = operation.newSort = operation.startState.activeSort; 14828 operation.startOrder = operation.newOrder = self.targets; 14829 if (sortCommand) { 14830 operation.startSort = operation.startState.activeSort; 14831 operation.newSort = sortCommand; 14832 operation.willSort = self.willSort(sortCommand, operation.startState.activeSort); 14833 if (operation.willSort) self.sortOperation(operation); 14834 } 14835 operation.startFilter = operation.startState.activeFilter; 14836 if (filterCommand) operation.newFilter = filterCommand; 14837 else operation.newFilter = h.extend(new mixitup.CommandFilter(), operation.startFilter); 14838 if (operation.newFilter.selector === "all") operation.newFilter.selector = self.config.selectors.target; 14839 else if (operation.newFilter.selector === "none") operation.newFilter.selector = ""; 14840 self.filterOperation(operation); 14841 operation.startContainerClassName = operation.startState.activeContainerClassName; 14842 if (changeLayoutCommand) { 14843 operation.newContainerClassName = changeLayoutCommand.containerClassName; 14844 if (operation.newContainerClassName !== operation.startContainerClassName) operation.willChangeLayout = true; 14845 } else operation.newContainerClassName = operation.startContainerClassName; 14846 if (self.config.animation.enable) { 14847 // Populate the operation's position data 14848 self.getStartMixData(operation); 14849 self.setInter(operation); 14850 operation.docState = h.getDocumentState(self.dom.document); 14851 self.getInterMixData(operation); 14852 self.setFinal(operation); 14853 self.getFinalMixData(operation); 14854 self.parseEffects(); 14855 operation.hasEffect = self.hasEffect(); 14856 self.getTweenData(operation); 14857 } 14858 if (operation.willSort) self.targets = operation.newOrder; 14859 operation.newState = self.buildState(operation); 14860 return self.callFilters("operationMappedGetOperation", operation, arguments); 14861 }, 14862 /** 14863 * Renders a previously created operation at a specific point in its path, as 14864 * determined by a multiplier between 0 and 1. 14865 * 14866 * @example 14867 * .tween(operation, multiplier) 14868 * 14869 * @private 14870 * @instance 14871 * @since 3.0.0 14872 * @param {mixitup.Operation} operation 14873 * An operation object created via the `getOperation` method 14874 * 14875 * @param {Float} multiplier 14876 * Any number between 0 and 1 representing the percentage complete of the operation 14877 * @return {void} 14878 */ tween: function tween(operation, multiplier) { 14879 var target = null, posData = null, toHideIndex = -1, i = -1; 14880 multiplier = Math.min(multiplier, 1); 14881 multiplier = Math.max(multiplier, 0); 14882 for(i = 0; target = operation.show[i]; i++){ 14883 posData = operation.showPosData[i]; 14884 target.applyTween(posData, multiplier); 14885 } 14886 for(i = 0; target = operation.hide[i]; i++){ 14887 if (target.isShown) target.hide(); 14888 if ((toHideIndex = operation.toHide.indexOf(target)) > -1) { 14889 posData = operation.toHidePosData[toHideIndex]; 14890 if (!target.isShown) target.show(); 14891 target.applyTween(posData, multiplier); 14892 } 14893 } 14894 }, 14895 /** 14896 * Inserts one or more new target elements into the container at a specified 14897 * index. 14898 * 14899 * To be indexed as targets, new elements must match the `selectors.target` 14900 * selector (`'.mix'` by default). 14901 * 14902 * @example 14903 * 14904 * .insert(newElements [, index] [, animate], [, callback]) 14905 * 14906 * @example <caption>Example 1: Inserting a single element via reference</caption> 14907 * 14908 * console.log(mixer.getState().totalShow); // 0 14909 * 14910 * // Create a new element 14911 * 14912 * var newElement = document.createElement('div'); 14913 * newElement.classList.add('mix'); 14914 * 14915 * mixer.insert(newElement) 14916 * .then(function(state) { 14917 * console.log(state.totalShow === 1); // true 14918 * }); 14919 * 14920 * @example <caption>Example 2: Inserting a single element via HTML string</caption> 14921 * 14922 * console.log(mixer.getState().totalShow); // 1 14923 * 14924 * // Create a new element via reference 14925 * 14926 * var newElementHtml = '<div class="mix"></div>'; 14927 * 14928 * // Create and insert the new element at index 1 14929 * 14930 * mixer.insert(newElementHtml, 1) 14931 * .then(function(state) { 14932 * console.log(state.totalShow === 2); // true 14933 * console.log(state.show[1].outerHTML === newElementHtml); // true 14934 * }); 14935 * 14936 * @example <caption>Example 3: Inserting multiple elements via reference</caption> 14937 * 14938 * console.log(mixer.getState().totalShow); // 2 14939 * 14940 * // Create an array of new elements to insert. 14941 * 14942 * var newElement1 = document.createElement('div'); 14943 * var newElement2 = document.createElement('div'); 14944 * 14945 * newElement1.classList.add('mix'); 14946 * newElement2.classList.add('mix'); 14947 * 14948 * var newElementsCollection = [newElement1, newElement2]; 14949 * 14950 * // Insert the new elements starting at index 1 14951 * 14952 * mixer.insert(newElementsCollection, 1) 14953 * .then(function(state) { 14954 * console.log(state.totalShow === 4); // true 14955 * console.log(state.show[1] === newElement1); // true 14956 * console.log(state.show[2] === newElement2); // true 14957 * }); 14958 * 14959 * @example <caption>
14959Example 4: Inserting a jQuery collection object containing one or more elements</caption> 14960 * 14961 * console.log(mixer.getState().totalShow); // 4 14962 * 14963 * var $newElement = $('<div class="mix"></div>'); 14964 * 14965 * // Insert the new elements starting at index 3 14966 * 14967 * mixer.insert($newElement, 3) 14968 * .then(function(state) { 14969 * console.log(state.totalShow === 5); // true 14970 * console.log(state.show[3] === $newElement[0]); // true 14971 * }); 14972 * 14973 * @public 14974 * @instance 14975 * @since 2.0.0 14976 * @param {(HTMLElement|Array.<HTMLElement>|string)} newElements 14977 * A reference to a single element to insert, an array-like collection of elements, or an HTML string representing a single element. 14978 * @param {number} index=0 14979 * The index at which to insert the new element(s). `0` by default. 14980 * @param {boolean} [animate=true] 14981 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 14982 * @param {function} [callback=null] 14983 * An optional callback function to be invoked after the operation has completed. 14984 * @return {Promise.<mixitup.State>} 14985 * A promise resolving with the current state object. 14986 */ insert: function insert() { 14987 var self = this, args = self.parseInsertArgs(arguments); 14988 return self.multimix({ 14989 insert: args.command 14990 }, args.animate, args.callback); 14991 }, 14992 /** 14993 * Inserts one or more new elements before a provided reference element. 14994 * 14995 * @example 14996 * 14997 * .insertBefore(newElements, referenceElement [, animate] [, callback]) 14998 * 14999 * @example <caption>Example: Inserting a new element before a reference element</caption> 15000 * 15001 * // An existing reference element is chosen at index 2 15002 * 15003 * var referenceElement = mixer.getState().show[2]; 15004 * 15005 * // Create a new element 15006 * 15007 * var newElement = document.createElement('div'); 15008 * newElement.classList.add('mix'); 15009 * 15010 * mixer.insertBefore(newElement, referenceElement) 15011 * .then(function(state) { 15012 * // The new element is inserted into the container at index 2, before the reference element 15013 * 15014 * console.log(state.show[2] === newElement); // true 15015 * 15016 * // The reference element is now at index 3 15017 * 15018 * console.log(state.show[3] === referenceElement); // true 15019 * }); 15020 * 15021 * @public 15022 * @instance 15023 * @since 3.0.0 15024 * @param {(HTMLElement|Array.<HTMLElement>|string)} newElements 15025 * A reference to a single element to insert, an array-like collection of elements, or an HTML string representing a single element. 15026 * @param {HTMLElement} referenceElement 15027 * A reference to an existing element in the container to insert new elements before. 15028 *@param {boolean} [animate=true] 15029 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 15030 * @param {function} [callback=null] 15031 * An optional callback function to be invoked after the operation has completed. 15032 * @return {Promise.<mixitup.State>} 15033 * A promise resolving with the current state object. 15034 */ insertBefore: function insertBefore() { 15035 var self = this, args = self.parseInsertArgs(arguments); 15036 return self.insert(args.command.collection, "before", args.command.sibling, args.animate, args.callback); 15037 }, 15038 /** 15039 * Inserts one or more new elements after a provided reference element. 15040 * 15041 * @example 15042 * 15043 * .insertAfter(newElements, referenceElement [, animate] [, callback]) 15044 * 15045 * @example <caption>Example: Inserting a new element after a reference element</caption> 15046 * 15047 * // An existing reference element is chosen at index 2 15048 * 15049 * var referenceElement = mixer.getState().show[2]; 15050 * 15051 * // Create a new element 15052 * 15053 * var newElement = document.createElement('div'); 15054 * newElement.classList.add('mix'); 15055 * 15056 * mixer.insertAfter(newElement, referenceElement) 15057 * .then(function(state) { 15058 * // The new element is inserted into the container at index 3, after the reference element 15059 * 15060 * console.log(state.show[3] === newElement); // true 15061 * }); 15062 * 15063 * @public 15064 * @instance 15065 * @since 3.0.0 15066 * @param {(HTMLElement|Array.<HTMLElement>|string)} newElements 15067 * A reference to a single element to insert, an array-like collection of elements, or an HTML string representing a single element. 15068 * @param {HTMLElement} referenceElement 15069 * A reference to an existing element in the container to insert new elements after. 15070 * @param {boolean} [animate=true] 15071 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 15072 * @param {function} [callback=null] 15073 * An optional callback function to be invoked after the operation has completed. 15074 * @return {Promise.<mixitup.State>} 15075 * A promise resolving with the current state object. 15076 */ insertAfter: function insertAfter() { 15077 var self = this, args = self.parseInsertArgs(arguments); 15078 return self.insert(args.command.collection, "after", args.command.sibling, args.animate, args.callback); 15079 }, 15080 /** 15081 * Inserts one or more new elements into the container before all existing targets. 15082 * 15083 * @example 15084 * 15085 * .prepend(newElements [,animate] [,callback]) 15086 * 15087 * @example <caption>Example: Prepending a new element</caption> 15088 * 15089 * // Create a new element 15090 * 15091 * var newElement = document.createElement('div'); 15092 * newElement.classList.add('mix'); 15093 * 15094 * // Insert the element into the container 15095 * 15096 * mixer.prepend(newElement) 15097 * .then(function(state) { 15098 * console.log(state.show[0] === newElement); // true 15099 * }); 15100 * 15101 * @public 15102 * @instance 15103 * @since 3.0.0 15104 * @param {(HTMLElement|Array.<HTMLElement>|string)} newElements 15105 * A reference to a single element to insert, an array-like collection of elements, or an HTML string representing a single element. 15106 * @param {boolean} [animate=true] 15107 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 15108 * @param {function} [callback=null] 15109 * An optional callback function to be invoked after the operation has completed. 15110 * @return {Promise.<mixitup.State>} 15111 * A promise resolving with the current state object. 15112 */ prepend: function prepend() { 15113 var self = this, args = self.parseInsertArgs(arguments); 15114 return self.insert(0, args.command.collection, args.animate, args.callback); 15115 }, 15116 /** 15117 * Inserts one or more new elements into the container after all existing targets. 15118 * 15119 * @example 15120 * 15121 * .append(newElements [,animate] [,callback]) 15122 * 15123 * @example <caption>Example: Appending a new element</caption> 15124 * 15125 * // Create a new element 15126 * 15127 * var newElement = document.createElement('div'); 15128 * newElement.classList.add('mix'); 15129 * 15130 * // Insert the element into the container 15131 * 15132 * mixer.append(newElement) 15133 * .then(function(state) { 15134 * console.log(state.show[state.show.length - 1] === newElement); // true 15135 * }); 15136 * 15137 * @public 15138 * @instance 15139 * @since 3.0.0 15140 * @param {(HTMLElement|Array.<HTMLElement>|string)} newElements 15141 * A reference to a single element to insert, an array-like collection of elements, or an HTML string representing a single element. 15142 * @param {boolean} [animate=true] 15143 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 15144 * @param {function} [callback=null] 15145 * An optional callback function to be invoked after the operation has completed. 15146 * @return {Promise.<mixitup.State>} 15147 * A promise resolving with the current state object. 15148 */ append: function append() { 15149 var self = this, args = self.parseInsertArgs(arguments); 15150 return self.insert(self.state.totalTargets, args.command.collection, args.animate, args.callback); 15151 }, 15152 /** 15153 * Removes one or more existing target elements from the container. 15154 * 15155 * @example 15156 * 15157 * .remove(elements [, animate] [, callback]) 15158 * 15159 * @example <caption>Example 1: Removing an element by reference</caption> 15160 * 15161 * var elementToRemove = containerEl.firstElementChild; 15162 * 15163 * mixer.remove(elementToRemove) 15164 * .then(function(state) { 15165 * console.log(state.targets.indexOf(elementToRemove) === -1); // true 15166 * }); 15167 * 15168 * @example <caption>Example 2: Removing a collection of elements by reference</caption> 15169 * 15170 * var elementsToRemove = containerEl.querySelectorAll('.category-a'); 15171 * 15172 * console.log(elementsToRemove.length) // 3 15173 * 15174 * mixer.remove(elementsToRemove) 15175 * .then(function() { 15176 * console.log(containerEl.querySelectorAll('.category-a').length); // 0 15177 * }); 15178 * 15179 * @example <caption>Example 3: Removing one or more elements by selector</caption> 15180 * 15181 * mixer.remove('.category-a') 15182 * .then(function() { 15183 * console.log(containerEl.querySelectorAll('.category-a').length); // 0 15184 * }); 15185 * 15186 * @example <caption>Example 4: Removing an element by index</caption> 15187 * 15188 * console.log(mixer.getState.totalShow); // 4 15189 * 15190 * // Remove the element at index 3 15191 * 15192 * mixer.remove(3) 15193 * .then(function(state) { 15194 * console.log(state.totalShow); // 3 15195 * console.log(state.show[3]); // undefined 15196 * }); 15197 * 15198 * 15199 * @public 15200 * @instance 15201 * @since 3.0.0 15202 * @param {(HTMLElement|Array.<HTMLElement>|string|number)} elements 15203 * A reference to a single element to remove, an array-like collection of elements, a selector string, or the index of an element to remove. 15204 * @param {boolean} [animate=true] 15205 * An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default. 15206 * @param {function} [callback=null] 15207 * An optional callback function to be invoked after the operation has completed. 15208 * @return {Promise.<mixitup.State>} 15209 * A promise resolving with the current state object. 15210 */ remove: function remove() { 15211 var self = this, args = self.parseRemoveArgs(arguments); 15212 return self.multimix({ 15213 remove: args.command 15214 }, args.animate, args.callback); 15215 }, 15216 /** 15217 * Retrieves the the value of any property or sub-object within the current 15218 * mixitup configuration, or the whole configuration object. 15219 * 15220 * @example 15221 * 15222 * .getConfig([stringKey]) 15223 * 15224 * @example <caption>Example 1: retrieve the entire configuration object</caption> 15225 * 15226 * var config = mixer.getConfig(); // Config { ... } 15227 * 15228 * @example <caption>Example 2: retrieve a named sub-object of configuration object</caption> 15229 * 15230 * var animation = mixer.getConfig('animation'); // ConfigAnimation { ... } 15231 * 15232 * @example <caption>Example 3: retrieve a value of configuration object via a dot-notation string key</caption> 15233 * 15234 * var effects = mixer.getConfig('animation.effects'); // 'fade scale' 15235 * 15236 * @public 15237 * @instance 15238 * @since 2.0.0 15239 * @param {string} [stringKey] A "dot-notation" string key 15240 * @return {*} 15241 */ getConfig: function getConfig(stringKey) { 15242 var self = this, value = null; 15243 if (!stringKey) value = self.config; 15244 else value = h.getProperty(self.config, stringKey); 15245 return self.callFilters("valueGetConfig", value, arguments); 15246 }, 15247 /** 15248 * Updates the configuration of the mixer, after it has been instantiated. 15249 * 15250 * See the Configuration Object documentation for a full list of avilable 15251 * configuration options. 15252 * 15253 * @example 15254 * 15255 * .configure(config) 15256 * 15257 * @example <caption>Example 1: Updating animation options</caption> 15258 * 15259 * mixer.configure({ 15260 * animation: { 15261 * effects: 'fade translateX(-100%)', 15262 * duration: 300 15263 * } 15264 * }); 15265 * 15266 * @example <caption>Example 2: Removing a callback after it has been set</caption> 15267 * 15268 * var mixer; 15269 * 15270 * function handleMixEndOnce() { 15271 * // Do something .. 15272 * 15273 * // Then nullify the callback 15274 * 15275 * mixer.configure({ 15276 * callbacks: { 15277 * onMixEnd: null 15278 * } 15279 * }); 15280 * }; 15281 * 15282 * // Instantiate a mixer with a callback defined 15283 * 15284 * mixer = mixitup(containerEl, { 15285 * callbacks: { 15286 * onMixEnd: handleMixEndOnce 15287 * } 15288 * }); 15289 * 15290 * @public 15291 * @instance 15292 * @since 3.0.0 15293 * @param {object} config
15294 * An object containing one of more configuration options. 15295 * @return {void} 15296 */ configure: function configure(config) { 15297 var self = this; 15298 self.callActions("beforeConfigure", arguments); 15299 h.extend(self.config, config, true, true); 15300 self.callActions("afterConfigure", arguments); 15301 }, 15302 /** 15303 * Returns an object containing information about the current state of the 15304 * mixer. See the State Object documentation for more information. 15305 * 15306 * NB: State objects are immutable and should therefore be regenerated 15307 * after any operation. 15308 * 15309 * @example 15310 * 15311 * .getState(); 15312 * 15313 * @example <caption>Example: Retrieving a state object</caption> 15314 * 15315 * var state = mixer.getState(); 15316 * 15317 * console.log(state.totalShow + 'targets are currently shown'); 15318 * 15319 * @public 15320 * @instance 15321 * @since 2.0.0 15322 * @return {mixitup.State} An object reflecting the current state of the mixer. 15323 */ getState: function getState() { 15324 var self = this, state = null; 15325 state = new mixitup.State(); 15326 h.extend(state, self.state); 15327 h.freeze(state); 15328 return self.callFilters("stateGetState", state, arguments); 15329 }, 15330 /** 15331 * Forces the re-indexing all targets within the container. 15332 * 15333 * This should only be used if some other piece of code in your application 15334 * has manipulated the contents of your container, which should be avoided. 15335 * 15336 * If you need to add or remove target elements from the container, use 15337 * the built-in `.insert()` or `.remove()` methods, and MixItUp will keep 15338 * itself up to date. 15339 * 15340 * @example 15341 * 15342 * .forceRefresh() 15343 * 15344 * @example <caption>Example: Force refreshing the mixer after external DOM manipulation</caption> 15345 * 15346 * console.log(mixer.getState().totalShow); // 3 15347 * 15348 * // An element is removed from the container via some external DOM manipulation code: 15349 * 15350 * containerEl.removeChild(containerEl.firstElementChild); 15351 * 15352 * // The mixer does not know that the number of targets has changed: 15353 * 15354 * console.log(mixer.getState().totalShow); // 3 15355 * 15356 * mixer.forceRefresh(); 15357 * 15358 * // After forceRefresh, the mixer is in sync again: 15359 * 15360 * console.log(mixer.getState().totalShow); // 2 15361 * 15362 * @public 15363 * @instance 15364 * @since 2.1.2 15365 * @return {void} 15366 */ forceRefresh: function forceRefresh() { 15367 var self = this; 15368 self.indexTargets(); 15369 }, 15370 /** 15371 * Forces the re-rendering of all targets when using the Dataset API. 15372 * 15373 * By default, targets are only re-rendered when `data.dirtyCheck` is 15374 * enabled, and an item's data has changed when `dataset()` is called. 15375 * 15376 * The `forceRender()` method allows for the re-rendering of all targets 15377 * in response to some arbitrary event, such as the changing of the target 15378 * render function. 15379 * 15380 * Targets are rendered against their existing data. 15381 * 15382 * @example 15383 * 15384 * .forceRender() 15385 * 15386 * @example <caption>Example: Force render targets after changing the target render function</caption> 15387 * 15388 * console.log(container.innerHTML); // ... <span class="mix">Foo</span> ... 15389 * 15390 * mixer.configure({ 15391 * render: { 15392 * target: (item) => `<a href="/${item.slug}/" class="mix">${item.title}</a>` 15393 * } 15394 * }); 15395 * 15396 * mixer.forceRender(); 15397 * 15398 * console.log(container.innerHTML); // ... <a href="/foo/" class="mix">Foo</a> ... 15399 * 15400 * @public 15401 * @instance 15402 * @since 3.2.1 15403 * @return {void} 15404 */ forceRender: function forceRender() { 15405 var self = this, target = null, el = null, id = ""; 15406 for(id in self.cache){ 15407 target = self.cache[id]; 15408 el = target.render(target.data); 15409 if (el !== target.dom.el) { 15410 // Update target element reference 15411 if (target.isInDom) { 15412 target.unbindEvents(); 15413 self.dom.parent.replaceChild(el, target.dom.el); 15414 } 15415 if (!target.isShown) el.style.display = "none"; 15416 target.dom.el = el; 15417 if (target.isInDom) target.bindEvents(); 15418 } 15419 } 15420 self.state = self.buildState(self.lastOperation); 15421 }, 15422 /** 15423 * Removes mixitup functionality from the container, unbinds all control 15424 * event handlers, and deletes the mixer instance from MixItUp's internal 15425 * cache. 15426 * 15427 * This should be performed whenever a mixer's container is removed from 15428 * the DOM, such as during a page change in a single page application, 15429 * or React's `componentWillUnmount()`. 15430 * 15431 * @example 15432 * 15433 * .destroy([cleanUp]) 15434 * 15435 * @example <caption>Example: Destroying the mixer before removing its container element</caption> 15436 * 15437 * mixer.destroy(); 15438 * 15439 * containerEl.parentElement.removeChild(containerEl); 15440 * 15441 * @public 15442 * @instance 15443 * @since 2.0.0 15444 * @param {boolean} [cleanUp=false] 15445 * An optional boolean dictating whether or not to clean up any inline `display: none;` styling applied to hidden targets. 15446 * @return {void} 15447 */ destroy: function destroy(cleanUp) {
15448 var self = this, control = null, target = null, i = 0; 15449 self.callActions("beforeDestroy", arguments); 15450 for(i = 0; control = self.controls[i]; i++)control.removeBinding(self); 15451 for(i = 0; target = self.targets[i]; i++){ 15452 if (cleanUp) target.show(); 15453 target.unbindEvents(); 15454 } 15455 if (self.dom.container.id.match(/^MixItUp/)) self.dom.container.removeAttribute("id"); 15456 delete mixitup.instances[self.id]; 15457 self.callActions("afterDestroy", arguments); 15458 } 15459 }); 15460 /** 15461 * @constructor 15462 * @memberof mixitup 15463 * @private 15464 * @since 3.0.0 15465 */ mixitup.IMoveData = function() { 15466 mixitup.Base.call(this); 15467 this.callActions("beforeConstruct"); 15468 this.posIn = null; 15469 this.posOut = null; 15470 this.operation = null; 15471 this.callback = null; 15472 this.statusChange = ""; 15473 this.duration = -1; 15474 this.staggerIndex = -1; 15475 this.callActions("afterConstruct"); 15476 h.seal(this); 15477 }; 15478 mixitup.BaseStatic.call(mixitup.IMoveData); 15479 mixitup.IMoveData.prototype = Object.create(mixitup.Base.prototype); 15480 mixitup.IMoveData.prototype.constructor = mixitup.IMoveData; 15481 /** 15482 * @constructor 15483 * @memberof mixitup 15484 * @private 15485 * @since 3.0.0 15486 */ mixitup.TargetDom = function() { 15487 mixitup.Base.call(this); 15488 this.callActions("beforeConstruct"); 15489 this.el = null; 15490 this.callActions("afterConstruct"); 15491 h.seal(this); 15492 }; 15493 mixitup.BaseStatic.call(mixitup.TargetDom); 15494 mixitup.TargetDom.prototype = Object.create(mixitup.Base.prototype); 15495 mixitup.TargetDom.prototype.constructor = mixitup.TargetDom; 15496 /** 15497 * @constructor 15498 * @namespace 15499 * @memberof mixitup 15500 * @private 15501 * @since 3.0.0 15502 */ mixitup.Target = function() { 15503 mixitup.Base.call(this); 15504 this.callActions("beforeConstruct"); 15505 this.id = ""; 15506 this.sortString = ""; 15507 this.mixer = null; 15508 this.callback = null; 15509 this.isShown = false; 15510 this.isBound = false; 15511 this.isExcluded = false; 15512 this.isInDom = false;
15513 this.handler = null; 15514 this.operation = null; 15515 this.data = null; 15516 this.dom = new mixitup.TargetDom(); 15517 this.callActions("afterConstruct"); 15518 h.seal(this); 15519 }; 15520 mixitup.BaseStatic.call(mixitup.Target); 15521 mixitup.Target.prototype = Object.create(mixitup.Base.prototype); 15522 h.extend(mixitup.Target.prototype, { 15523 constructor: mixitup.Target, 15524 /** 15525 * Initialises a newly instantiated Target. 15526 * 15527 * @private 15528 * @instance 15529 * @since 3.0.0 15530 * @param {(Element|null)} el 15531 * @param {object} mixer 15532 * @param {object} [data] 15533 * @return {void} 15534 */ init: function init(el, mixer, data) { 15535 var self = this, id = ""; 15536 self.callActions("beforeInit", arguments); 15537 self.mixer = mixer; 15538 if (!el) // If no element is provided, render it 15539 el = self.render(data); 15540 self.cacheDom(el); 15541 self.bindEvents(); 15542 if (self.dom.el.style.display !== "none") self.isShown = true; 15543 if (data && mixer.config.data.uidKey) { 15544 if (typeof (id = data[mixer.config.data.uidKey]) === "undefined" || id.toString().length < 1) throw new TypeError(mixitup.messages.errorDatasetInvalidUidKey({ 15545 uidKey: mixer.config.data.uidKey 15546 })); 15547 self.id = id; 15548 self.data = data; 15549 mixer.cache[id] = self; 15550 } 15551 self.callActions("afterInit", arguments); 15552 }, 15553 /** 15554 * Renders the target element using a user-defined renderer function. 15555 * 15556 * @private 15557 * @instance 15558 * @since 3.1.4 15559 * @param {object} data 15560 * @return {void} 15561 */ render: function render(data) { 15562 var self = this, render = null, el = null, temp = null, output = ""; 15563 self.callActions("beforeRender", arguments); 15564 render = self.callFilters("renderRender", self.mixer.config.render.target, arguments); 15565 if (typeof render !== "function") throw new TypeError(mixitup.messages.errorDatasetRendererNotSet()); 15566 output = render(data); 15567 if (output && typeof output === "object" && h.isElement(output)) el = output; 15568 else if (typeof output === "string") { 15569 temp = document.createElement("div"); 15570 temp.innerHTML = output; 15571 el = temp.firstElementChild; 15572 } 15573 return self.callFilters("elRender", el, arguments); 15574 }, 15575 /** 15576 * Caches references of DOM elements neccessary for the target's functionality. 15577 * 15578 * @private 15579 * @instance 15580 * @since 3.0.0 15581 * @param {Element} el 15582 * @return {void} 15583 */ cacheDom: function cacheDom(el) { 15584 var self = this; 15585 self.callActions("beforeCacheDom", arguments); 15586 self.dom.el = el; 15587 self.callActions("afterCacheDom", arguments); 15588 }, 15589 /** 15590 * @private 15591 * @instance 15592 * @since 3.0.0 15593 * @param {string} attributeName 15594 * @return {void} 15595 */ getSortString: function getSortString(attributeName) { 15596 var self = this, value = self.dom.el.getAttribute("data-" + attributeName) || ""; 15597 self.callActions("beforeGetSortString", arguments); 15598 value = isNaN(value * 1) ? value.toLowerCase() : value * 1; 15599 self.sortString = value; 15600 self.callActions("afterGetSortString", arguments); 15601 }, 15602 /** 15603 * @private 15604 * @instance 15605 * @since 3.0.0 15606 * @return {void} 15607 */ show: function show() { 15608 var self = this; 15609 self.callActions("beforeShow", arguments); 15610 if (!self.isShown) { 15611 self.dom.el.style.display = ""; 15612 self.isShown = true; 15613 } 15614 self.callActions("afterShow", arguments); 15615 }, 15616 /** 15617 * @private 15618 * @instance 15619 * @since 3.0.0 15620 * @return {void} 15621 */ hide: function hide() { 15622 var self = this; 15623 self.callActions("beforeHide", arguments); 15624 if (self.isShown) { 15625 self.dom.el.style.display = "none"; 15626 self.isShown = false;
15627 } 15628 self.callActions("afterHide", arguments); 15629 }, 15630 /** 15631 * @private 15632 * @instance 15633 * @since 3.0.0 15634 * @param {mixitup.IMoveData} moveData 15635 * @return {void} 15636 */ move: function move(moveData) { 15637 var self = this; 15638 self.callActions("beforeMove", arguments); 15639 if (!self.isExcluded) self.mixer.targetsMoved++; 15640 self.applyStylesIn(moveData); 15641 requestAnimationFrame(function() { 15642 self.applyStylesOut(moveData); 15643 }); 15644 self.callActions("afterMove", arguments); 15645 }, 15646 /** 15647 * @private 15648 * @instance 15649 * @since 3.0.0 15650 * @param {object} posData 15651 * @param {number} multiplier 15652 * @return {void} 15653 */ applyTween: function applyTween(posData, multiplier) { 15654 var self = this, propertyName = "", tweenData = null, posIn = posData.posIn, currentTransformValues = [], currentValues = new mixitup.StyleData(), i = -1; 15655 self.callActions("beforeApplyTween", arguments); 15656 currentValues.x = posIn.x; 15657 currentValues.y = posIn.y; 15658 if (multiplier === 0) self.hide(); 15659 else if (!self.isShown) self.show(); 15660 for(i = 0; propertyName = mixitup.features.TWEENABLE[i]; i++){ 15661 tweenData = posData.tweenData[propertyName]; 15662 if (propertyName === "x") { 15663 if (!tweenData) continue; 15664 currentValues.x = posIn.x + tweenData * multiplier; 15665 } else if (propertyName === "y") { 15666 if (!tweenData) continue; 15667 currentValues.y = posIn.y + tweenData * multiplier; 15668 } else if (tweenData instanceof mixitup.TransformData) { 15669 if (!tweenData.value) continue; 15670 currentValues[propertyName].value = posIn[propertyName].value + tweenData.value * multiplier; 15671 currentValues[propertyName].unit = tweenData.unit; 15672 currentTransformValues.push(propertyName + "(" + currentValues[propertyName].value + tweenData.unit + ")"); 15673 } else { 15674 if (!tweenData) continue; 15675 currentValues[propertyName] = posIn[propertyName] + tweenData * multiplier; 15676 self.dom.el.style[propertyName] = currentValues[propertyName]; 15677 } 15678 } 15679 if (currentValues.x || currentValues.y) currentTransformValues.unshift("translate(" + currentValues.x + "px, " + currentValues.y + "px)"); 15680 if (currentTransformValues.length) self.dom.el.style[mixitup.features.transformProp] = currentTransformValues.join(" "); 15681 self.callActions("afterApplyTween", arguments); 15682 }, 15683 /** 15684 * Applies the initial styling to a target element before any transition 15685 * is applied. 15686 * 15687 * @private 15688 * @instance 15689 * @param {mixitup.IMoveData} moveData 15690 * @return {void} 15691 */ applyStylesIn: function applyStylesIn(moveData) { 15692 var self = this, posIn = moveData.posIn, isFading = self.mixer.effectsIn.opacity !== 1, transformValues = []; 15693 self.callActions("beforeApplyStylesIn", arguments); 15694 transformValues.push("translate(" + posIn.x + "px, " + posIn.y + "px)"); 15695 if (self.mixer.config.animation.animateResizeTargets) { 15696 if (moveData.statusChange !== "show") { 15697 // Don't apply posIn width or height or showing, as will be 0 15698 self.dom.el.style.width = posIn.width + "px"; 15699 self.dom.el.style.height = posIn.height + "px"; 15700 } 15701 self.dom.el.style.marginRight = posIn.marginRight + "px"; 15702 self.dom.el.style.marginBottom = posIn.marginBottom + "px"; 15703 } 15704 isFading && (self.dom.el.style.opacity = posIn.opacity); 15705 if (moveData.statusChange === "show") transformValues = transformValues.concat(self.mixer.transformIn); 15706 self.dom.el.style[mixitup.features.transformProp] = transformValues.join(" "); 15707 self.callActions("afterApplyStylesIn", arguments); 15708 }, 15709 /** 15710 * Applies a transition followed by the final styles for the element to 15711 * transition towards. 15712 * 15713 * @private 15714 * @instance 15715 * @param {mixitup.IMoveData} moveData 15716 * @return {void} 15717 */ applyStylesOut: function applyStylesOut(moveData) { 15718 var self = this, transitionRules = [], transformValues = [], isResizing = self.mixer.config.animation.animateResizeTargets, isFading = typeof self.mixer.effectsIn.opacity !== "undefined"; 15719 self.callActions("beforeApplyStylesOut", arguments); 15720 // Build the transition rules 15721 transitionRules.push(self.writeTransitionRule(mixitup.features.transformRule, moveData.staggerIndex));
15722 if (moveData.statusChange !== "none") transitionRules.push(self.writeTransitionRule("opacity", moveData.staggerIndex, moveData.duration)); 15723 if (isResizing) { 15724 transitionRules.push(self.writeTransitionRule("width", moveData.staggerIndex, moveData.duration)); 15725 transitionRules.push(self.writeTransitionRule("height", moveData.staggerIndex, moveData.duration)); 15726 transitionRules.push(self.writeTransitionRule("margin", moveData.staggerIndex, moveData.duration)); 15727 } 15728 // If no callback was provided, the element will 15729 // not transition in any way so tag it as "immovable" 15730 if (!moveData.callback) { 15731 self.mixer.targetsImmovable++; 15732 if (self.mixer.targetsMoved === self.mixer.targetsImmovable) // If the total targets moved is equal to the 15733 // number of immovable targets, the operation 15734 // should be considered finished 15735 self.mixer.cleanUp(moveData.operation); 15736 return; 15737 } 15738 // If the target will transition in some fasion, 15739 // assign a callback function 15740 self.operation = moveData.operation; 15741 self.callback = moveData.callback; 15742 // As long as the target is not excluded, increment 15743 // the total number of targets bound 15744 !self.isExcluded && self.mixer.targetsBound++;
vendor: 14,907 bytes, lines 15745-16097
15745 // Tag the target as bound to differentiate from transitionEnd 15746 // events that may come from stylesheet driven effects 15747 self.isBound = true; 15748 // Apply the transition 15749 self.applyTransition(transitionRules); 15750 // Apply width, height and margin negation 15751 if (isResizing && moveData.posOut.width > 0 && moveData.posOut.height > 0) { 15752 self.dom.el.style.width = moveData.posOut.width + "px"; 15753 self.dom.el.style.height = moveData.posOut.height + "px"; 15754 self.dom.el.style.marginRight = moveData.posOut.marginRight + "px"; 15755 self.dom.el.style.marginBottom = moveData.posOut.marginBottom + "px"; 15756 } 15757 if (!self.mixer.config.animation.nudge && moveData.statusChange === "hide") // If we're not nudging, the translation should be 15758 // applied before any other transforms to prevent 15759 // lateral movement 15760 transformValues.push("translate(" + moveData.posOut.x + "px, " + moveData.posOut.y + "px)"); 15761 // Apply fade 15762 switch(moveData.statusChange){ 15763 case "hide": 15764 isFading && (self.dom.el.style.opacity = self.mixer.effectsOut.opacity); 15765 transformValues = transformValues.concat(self.mixer.transformOut); 15766 break; 15767 case "show": 15768 isFading && (self.dom.el.style.opacity = 1); 15769 } 15770 if (self.mixer.config.animation.nudge || !self.mixer.config.animation.nudge && moveData.statusChange !== "hide") // Opposite of above - apply translate after 15771 // other transform 15772 transformValues.push("translate(" + moveData.posOut.x + "px, " + moveData.posOut.y + "px)"); 15773 // Apply transforms 15774 self.dom.el.style[mixitup.features.transformProp] = transformValues.join(" "); 15775 self.callActions("afterApplyStylesOut", arguments); 15776 }, 15777 /** 15778 * Combines the name of a CSS property with the appropriate duration and delay 15779 * values to created a valid transition rule. 15780 * 15781 * @private 15782 * @instance 15783 * @since 3.0.0 15784 * @param {string} property 15785 * @param {number} staggerIndex 15786 * @param {number} duration 15787 * @return {string} 15788 */ writeTransitionRule: function writeTransitionRule(property, staggerIndex, duration) { 15789 var self = this, delay = self.getDelay(staggerIndex), rule = ""; 15790 rule = property + " " + (duration > 0 ? duration : self.mixer.config.animation.duration) + "ms " + delay + "ms " + (property === "opacity" ? "linear" : self.mixer.config.animation.easing); 15791 return self.callFilters("ruleWriteTransitionRule", rule, arguments); 15792 }, 15793 /** 15794 * Calculates the transition delay for each target element based on its index, if 15795 * staggering is applied. If defined, A custom `animation.staggerSeqeuence` 15796 * function can be used to manipulate the order of indices to produce custom 15797 * stagger effects (e.g. for use in a grid with irregular row lengths). 15798 * 15799 * @private 15800 * @instance 15801 * @since 2.0.0 15802 * @param {number} index 15803 * @return {number} 15804 */ getDelay: function getDelay(index) { 15805 var self = this, delay = -1; 15806 if (typeof self.mixer.config.animation.staggerSequence === "function") index = self.mixer.config.animation.staggerSequence.call(self, index, self.state); 15807 delay = !!self.mixer.staggerDuration ? index * self.mixer.staggerDuration : 0; 15808 return self.callFilters("delayGetDelay", delay, arguments); 15809 }, 15810 /** 15811 * @private 15812 * @instance 15813 * @since 3.0.0 15814 * @param {string[]} rules 15815 * @return {void} 15816 */ applyTransition: function applyTransition(rules) { 15817 var self = this, transitionString = rules.join(", "); 15818 self.callActions("beforeApplyTransition", arguments); 15819 self.dom.el.style[mixitup.features.transitionProp] = transitionString; 15820 self.callActions("afterApplyTransition", arguments); 15821 }, 15822 /** 15823 * @private 15824 * @instance 15825 * @since 3.0.0 15826 * @param {Event} e 15827 * @return {void} 15828 */ handleTransitionEnd: function handleTransitionEnd(e) { 15829 var self = this, propName = e.propertyName, canResize = self.mixer.config.animation.animateResizeTargets; 15830 self.callActions("beforeHandleTransitionEnd", arguments); 15831 if (self.isBound && e.target.matches(self.mixer.config.selectors.target) && (propName.indexOf("transform") > -1 || propName.indexOf("opacity") > -1 || canResize && propName.indexOf("height") > -1 || canResize && propName.indexOf("width") > -1 || canResize && propName.indexOf("margin") > -1)) { 15832 self.callback.call(self, self.operation); 15833 self.isBound = false; 15834 self.callback = null; 15835 self.operation = null; 15836 } 15837 self.callActions("afterHandleTransitionEnd", arguments); 15838 }, 15839 /** 15840 * @private 15841 * @instance 15842 * @since 3.0.0 15843 * @param {Event} e 15844 * @return {void} 15845 */ eventBus: function eventBus(e) { 15846 var self = this; 15847 self.callActions("beforeEventBus", arguments); 15848 switch(e.type){ 15849 case "webkitTransitionEnd": 15850 case "transitionend": 15851 self.handleTransitionEnd(e); 15852 } 15853 self.callActions("afterEventBus", arguments); 15854 }, 15855 /** 15856 * @private 15857 * @instance 15858 * @since 3.0.0 15859 * @return {void} 15860 */ unbindEvents: function unbindEvents() { 15861 var self = this; 15862 self.callActions("beforeUnbindEvents", arguments); 15863 h.off(self.dom.el, "webkitTransitionEnd", self.handler); 15864 h.off(self.dom.el, "transitionend", self.handler); 15865 self.callActions("afterUnbindEvents", arguments); 15866 }, 15867 /** 15868 * @private 15869 * @instance 15870 * @since 3.0.0 15871 * @return {void} 15872 */ bindEvents: function bindEvents() { 15873 var self = this, transitionEndEvent = ""; 15874 self.callActions("beforeBindEvents", arguments); 15875 transitionEndEvent = mixitup.features.transitionPrefix === "webkit" ? "webkitTransitionEnd" : "transitionend"; 15876 self.handler = function(e) { 15877 return self.eventBus(e); 15878 }; 15879 h.on(self.dom.el, transitionEndEvent, self.handler); 15880 self.callActions("afterBindEvents", arguments); 15881 }, 15882 /** 15883 * @private 15884 * @instance 15885 * @since 3.0.0 15886 * @param {boolean} [getBox] 15887 * @return {PosData} 15888 */ getPosData: function getPosData(getBox) { 15889 var self = this, styles = {}, rect = null, posData = new mixitup.StyleData(); 15890 self.callActions("beforeGetPosData", arguments); 15891 posData.x = self.dom.el.offsetLeft; 15892 posData.y = self.dom.el.offsetTop; 15893 if (self.mixer.config.animation.animateResizeTargets || getBox) { 15894 rect = self.dom.el.getBoundingClientRect(); 15895 posData.top = rect.top; 15896 posData.right = rect.right; 15897 posData.bottom = rect.bottom; 15898 posData.left = rect.left; 15899 posData.width = rect.width; 15900 posData.height = rect.height; 15901 } 15902 if (self.mixer.config.animation.animateResizeTargets) { 15903 styles = window1.getComputedStyle(self.dom.el); 15904 posData.marginBottom = parseFloat(styles.marginBottom); 15905 posData.marginRight = parseFloat(styles.marginRight); 15906 } 15907 return self.callFilters("posDataGetPosData", posData, arguments); 15908 }, 15909 /** 15910 * @private 15911 * @instance 15912 * @since 3.0.0 15913 * @return {void} 15914 */ cleanUp: function cleanUp() { 15915 var self = this; 15916 self.callActions("beforeCleanUp", arguments); 15917 self.dom.el.style[mixitup.features.transformProp] = ""; 15918 self.dom.el.style[mixitup.features.transitionProp] = ""; 15919 self.dom.el.style.opacity = ""; 15920 if (self.mixer.config.animation.animateResizeTargets) { 15921 self.dom.el.style.width = ""; 15922 self.dom.el.style.height = ""; 15923 self.dom.el.style.marginRight = ""; 15924 self.dom.el.style.marginBottom = ""; 15925 } 15926 self.callActions("afterCleanUp", arguments); 15927 } 15928 }); 15929 /** 15930 * A jQuery-collection-like wrapper around one or more `mixitup.Mixer` instances 15931 * allowing simultaneous control of said instances similar to the MixItUp 2 API. 15932 * 15933 * @example 15934 * new mixitup.Collection(instances) 15935 * 15936 * @constructor 15937 * @namespace 15938 * @memberof mixitup 15939 * @private 15940 * @since 3.0.0 15941 * @param {mixitup.Mixer[]} instances 15942 */ mixitup.Collection = function(instances) { 15943 var instance = null, i = -1; 15944 this.callActions("beforeConstruct"); 15945 for(i = 0; instance = instances[i]; i++)this[i] = instance; 15946 this.length = instances.length; 15947 this.callActions("afterConstruct"); 15948 h.freeze(this); 15949 }; 15950 mixitup.BaseStatic.call(mixitup.Collection); 15951 mixitup.Collection.prototype = Object.create(mixitup.Base.prototype); 15952 h.extend(mixitup.Collection.prototype, /** @lends mixitup.Collection */ { 15953 constructor: mixitup.Collection, 15954 /** 15955 * Calls a method on all instances in the collection by passing the method 15956 * name as a string followed by any applicable parameters to be curried into 15957 * to the method. 15958 * 15959 * @example 15960 * .mixitup(methodName[,arg1][,arg2..]); 15961 * 15962 * @example 15963 * var collection = new Collection([mixer1, mixer2]); 15964 * 15965 * return collection.mixitup('filter', '.category-a') 15966 * .then(function(states) { 15967 * state.forEach(function(state) { 15968 * console.log(state.activeFilter.selector); // .category-a 15969 * }); 15970 * }); 15971 * 15972 * @public 15973 * @instance 15974 * @since 3.0.0 15975 * @param {string} methodName 15976 * @return {Promise<Array<mixitup.State>>} 15977 */ mixitup: function mixitup1(methodName) { 15978 var self = this, instance = null, args = Array.prototype.slice.call(arguments), tasks = [], i = -1; 15979 this.callActions("beforeMixitup"); 15980 args.shift(); 15981 for(i = 0; instance = self[i]; i++)tasks.push(instance[methodName].apply(instance, args)); 15982 return self.callFilters("promiseMixitup", h.all(tasks, mixitup.libraries), arguments); 15983 } 15984 }); 15985 /** 15986 * `mixitup.Operation` objects contain all data neccessary to describe the full 15987 * lifecycle of any MixItUp operation. They can be used to compute and store an 15988 * operation for use at a later time (e.g. programmatic tweening). 15989 * 15990 * @constructor 15991 * @namespace 15992 * @memberof mixitup 15993 * @private 15994 * @since 3.0.0 15995 */ mixitup.Operation = function() { 15996 mixitup.Base.call(this); 15997 this.callActions("beforeConstruct"); 15998 this.id = ""; 15999 this.args = []; 16000 this.command = null; 16001 this.showPosData = []; 16002 this.toHidePosData = []; 16003 this.startState = null; 16004 this.newState = null; 16005 this.docState = null; 16006 this.willSort = false; 16007 this.willChangeLayout = false; 16008 this.hasEffect = false; 16009 this.hasFailed = false; 16010 this.triggerElement = null; 16011 this.show = []; 16012 this.hide = []; 16013 this.matching = []; 16014 this.toShow = []; 16015 this.toHide = []; 16016 this.toMove = []; 16017 this.toRemove = []; 16018 this.startOrder = []; 16019 this.newOrder = []; 16020 this.startSort = null; 16021 this.newSort = null; 16022 this.startFilter = null; 16023 this.newFilter = null; 16024 this.startDataset = null; 16025 this.newDataset = null; 16026 this.viewportDeltaX = 0; 16027 this.viewportDeltaY = 0; 16028 this.startX = 0; 16029 this.startY = 0; 16030 this.startHeight = 0; 16031 this.startWidth = 0; 16032 this.newX = 0; 16033 this.newY = 0; 16034 this.newHeight = 0; 16035 this.newWidth = 0; 16036 this.startContainerClassName = ""; 16037 this.startDisplay = ""; 16038 this.newContainerClassName = ""; 16039 this.newDisplay = ""; 16040 this.callActions("afterConstruct"); 16041 h.seal(this); 16042 }; 16043 mixitup.BaseStatic.call(mixitup.Operation); 16044 mixitup.Operation.prototype = Object.create(mixitup.Base.prototype); 16045 mixitup.Operation.prototype.constructor = mixitup.Operation; 16046 /** 16047 * `mixitup.State` objects expose various pieces of data detailing the state of 16048 * a MixItUp instance. They are provided at the start and end of any operation via 16049 * callbacks and events, with the most recent state stored between operations 16050 * for retrieval at any time via the API. 16051 * 16052 * @constructor 16053 * @namespace 16054 * @memberof mixitup 16055 * @public 16056 * @since 3.0.0 16057 */ mixitup.State = function() { 16058 mixitup.Base.call(this); 16059 this.callActions("beforeConstruct"); 16060 /** 16061 * The ID of the mixer instance. 16062 * 16063 * @name id 16064 * @memberof mixitup.State 16065 * @instance 16066 * @type {string} 16067 * @default '' 16068 */ this.id = ""; 16069 /** 16070 * The currently active filter command as set by a control click or API call. 16071 * 16072 * @name activeFilter 16073 * @memberof mixitup.State 16074 * @instance 16075 * @type {mixitup.CommandFilter} 16076 * @default null 16077 */ this.activeFilter = null; 16078 /** 16079 * The currently active sort command as set by a control click or API call. 16080 * 16081 * @name activeSort 16082 * @memberof mixitup.State 16083 * @instance 16084 * @type {mixitup.CommandSort} 16085 * @default null 16086 */ this.activeSort = null; 16087 /** 16088 * The current layout-specific container class name, if applied. 16089 * 16090 * @name activeContainerClassName 16091 * @memberof mixitup.State 16092 * @instance 16093 * @type {string} 16094 * @default '' 16095 */ this.activeContainerClassName = ""; 16096 /** 16097 * A reference to the container element that the mixer is
16097instantiated on. 16098 * 16099 * @name container 16100 * @memberof mixitup.State 16101 * @instance 16102 * @type {Element} 16103 * @default null 16104 */ this.container = null; 16105 /** 16106 * An array of all target elements indexed by the mixer. 16107 * 16108 * @name targets 16109 * @memberof mixitup.State 16110 * @instance 16111 * @type {Array.<Element>} 16112 * @default [] 16113 */ this.targets = []; 16114 /** 16115 * An array of all target elements not matching the current filter. 16116 * 16117 * @name hide 16118 * @memberof mixitup.State 16119 * @instance 16120 * @type {Array.<Element>} 16121 * @default [] 16122 */ this.hide = []; 16123 /** 16124 * An array of all target elements matching the current filter and any additional 16125 * limits applied such as pagination. 16126 * 16127 * @name show 16128 * @memberof mixitup.State 16129 * @instance 16130 * @type {Array.<Element>} 16131 * @default [] 16132 */ this.show = []; 16133 /** 16134 * An array of all target elements matching the current filter irrespective of 16135 * any additional limits applied such as pagination. 16136 * 16137 * @name matching 16138 * @memberof mixitup.State 16139 * @instance 16140 * @type {Array.<Element>} 16141 * @default [] 16142 */ this.matching = []; 16143 /** 16144 * An integer representing the total number of target elements indexed by the 16145 * mixer. Equivalent to `state.targets.length`. 16146 * 16147 * @name totalTargets 16148 * @memberof mixitup.State 16149 * @instance 16150 * @type {number} 16151 * @default -1 16152 */ this.totalTargets = -1; 16153 /** 16154 * An integer representing the total number of target elements matching the 16155 * current filter and any additional limits applied such as pagination. 16156 * Equivalent to `state.show.length`. 16157 * 16158 * @name totalShow 16159 * @memberof mixitup.State 16160 * @instance 16161 * @type {number} 16162 * @default -1 16163 */ this.totalShow = -1; 16164 /** 16165 * An integer representing the total number of target elements not matching 16166 * the current filter. Equivalent to `state.hide.length`. 16167 * 16168 * @name totalHide 16169 * @memberof mixitup.State 16170 * @instance 16171 * @type {number} 16172 * @default -1 16173 */ this.totalHide = -1; 16174 /** 16175 * An integer representing the total number of target elements matching the 16176 * current filter irrespective of any other limits applied such as pagination. 16177 * Equivalent to `state.matching.length`. 16178 * 16179 * @name totalMatching 16180 * @memberof mixitup.State 16181 * @instance 16182 * @type {number} 16183 * @default -1 16184 */ this.totalMatching = -1; 16185 /** 16186 * A boolean indicating whether the last operation "failed", i.e. no targets 16187 * could be found matching the filter. 16188 * 16189 * @name hasFailed 16190 * @memberof mixitup.State 16191 * @instance 16192 * @type {boolean} 16193 * @default false 16194 */ this.hasFailed = false; 16195 /** 16196 * The DOM element that was clicked if the last operation was triggered by the 16197 * clicking of a control and not an API call. 16198 * 16199 * @name triggerElement 16200 * @memberof mixitup.State 16201 * @instance 16202 * @type {Element|null} 16203 * @default null 16204 */ this.triggerElement = null; 16205 /** 16206 * The currently active dataset underlying the rendered targets, if the 16207 * dataset API is in use. 16208 * 16209 * @name activeDataset 16210 * @memberof mixitup.State 16211 * @instance 16212 * @type {Array.<object>} 16213 * @default null 16214 */ this.activeDataset = null; 16215 this.callActions("afterConstruct"); 16216 h.seal(this); 16217 };
16218 mixitup.BaseStatic.call(mixitup.State); 16219 mixitup.State.prototype = Object.create(mixitup.Base.prototype); 16220 mixitup.State.prototype.constructor = mixitup.State; 16221 /** 16222 * @constructor 16223 * @memberof mixitup 16224 * @private 16225 * @since 3.0.0 16226 */ mixitup.UserInstruction = function() { 16227 mixitup.Base.call(this); 16228 this.callActions("beforeConstruct"); 16229 this.command = {}; 16230 this.animate = false; 16231 this.callback = null; 16232 this.callActions("afterConstruct"); 16233 h.seal(this); 16234 }; 16235 mixitup.BaseStatic.call(mixitup.UserInstruction); 16236 mixitup.UserInstruction.prototype = Object.create(mixitup.Base.prototype); 16237 mixitup.UserInstruction.prototype.constructor = mixitup.UserInstruction; 16238 /** 16239 * @constructor 16240 * @memberof mixitup 16241 * @private 16242 * @since 3.0.0 16243 */ mixitup.Messages = function() { 16244 mixitup.Base.call(this); 16245 this.callActions("beforeConstruct"); 16246 /* Errors 16247 ----------------------------------------------------------------------------- */ this.ERROR_FACTORY_INVALID_CONTAINER = "[MixItUp] An invalid selector or element reference was passed to the mixitup factory function"; 16248 this.ERROR_FACTORY_CONTAINER_NOT_FOUND = "[MixItUp] The provided selector yielded no container element"; 16249 this.ERROR_CONFIG_INVALID_ANIMATION_EFFECTS = "[MixItUp] Invalid value for `animation.effects`"; 16250 this.ERROR_CONFIG_INVALID_CONTROLS_SCOPE = "[MixItUp] Invalid value for `controls.scope`"; 16251 this.ERROR_CONFIG_INVALID_PROPERTY = '[MixitUp] Invalid configuration object property "${erroneous}"${suggestion}'; 16252 this.ERROR_CONFIG_INVALID_PROPERTY_SUGGESTION = '. Did you mean "${probableMatch}"?'; 16253 this.ERROR_CONFIG_DATA_UID_KEY_NOT_SET = "[MixItUp] To use the dataset API, a UID key must be specified using `data.uidKey`"; 16254 this.ERROR_DATASET_INVALID_UID_KEY = '[MixItUp] The specified UID key "${uidKey}" is not present on one or more dataset items'; 16255 this.ERROR_DATASET_DUPLICATE_UID = '[MixItUp] The UID "${uid}" was found on two or more dataset items. UIDs must be unique.'; 16256 this.ERROR_INSERT_INVALID_ARGUMENTS = "[MixItUp] Please provider either an index or a sibling and position to insert, not both"; 16257 this.ERROR_INSERT_PREEXISTING_ELEMENT = "[MixItUp] An element to be inserted already exists in the container"; 16258 this.ERROR_FILTER_INVALID_ARGUMENTS = "[MixItUp] Please provide either a selector or collection `.filter()`, not both"; 16259 this.ERROR_DATASET_NOT_SET = "[MixItUp] To use the dataset API with pre-rendered targets, a starting dataset must be set using `load.dataset`"; 16260 this.ERROR_DATASET_PRERENDERED_MISMATCH = "[MixItUp] `load.dataset` does not match pre-rendered targets"; 16261 this.ERROR_DATASET_RENDERER_NOT_SET = "[MixItUp] To insert an element via the dataset API, a target renderer function must be provided to `render.target`"; 16262 this.ERROR_SORT_NON_EXISTENT_ELEMENT = "[MixItUp] An element to be sorted does not already exist in the container"; 16263 /* Warnings 16264 ----------------------------------------------------------------------------- */ this.WARNING_FACTORY_PREEXISTING_INSTANCE = "[MixItUp] WARNING: This element already has an active MixItUp instance. The provided configuration object will be ignored. If you wish to perform additional methods on this instance, please create a reference."; 16265 this.WARNING_INSERT_NO_ELEMENTS = "[MixItUp] WARNING: No valid elements were passed to `.insert()`"; 16266 this.WARNING_REMOVE_NO_ELEMENTS = "[MixItUp] WARNING: No valid elements were passed to `.remove()`"; 16267 this.WARNING_MULTIMIX_INSTANCE_QUEUE_FULL = "[MixItUp] WARNING: An operation was requested but the MixItUp instance was busy. The operation was rejected because the queue is full or queuing is disabled."; 16268 this.WARNING_GET_OPERATION_INSTANCE_BUSY = "[MixItUp] WARNING: Operations can be be created while the MixItUp instance is busy."; 16269 this.WARNING_NO_PROMISE_IMPLEMENTATION = "[MixItUp] WARNING: No Promise implementations could be found. If you wish to use promises with MixItUp please install an ES6 Promise polyfill."; 16270 this.WARNING_INCONSISTENT_SORTING_ATTRIBUTES = '[MixItUp] WARNING: The requested sorting data attribute "${attribute}" was not present on one or more target elements which may product unexpected sort output'; 16271 this.callActions("afterConstruct"); 16272 this.compileTemplates(); 16273 h.seal(this); 16274 };
vendor: 2,051 bytes, lines 16275-16320
16275 mixitup.BaseStatic.call(mixitup.Messages); 16276 mixitup.Messages.prototype = Object.create(mixitup.Base.prototype); 16277 mixitup.Messages.prototype.constructor = mixitup.Messages; 16278 /** 16279 * @return {void} 16280 */ mixitup.Messages.prototype.compileTemplates = function() { 16281 var errorKey = ""; 16282 var errorMessage = ""; 16283 for(errorKey in this){ 16284 if (typeof (errorMessage = this[errorKey]) !== "string") continue; 16285 this[h.camelCase(errorKey)] = h.template(errorMessage); 16286 } 16287 }; 16288 mixitup.messages = new mixitup.Messages(); 16289 /** 16290 * @constructor 16291 * @memberof mixitup 16292 * @private 16293 * @since 3.0.0 16294 * @param {mixitup.Mixer} mixer 16295 */ mixitup.Facade = function Mixer(mixer) { 16296 mixitup.Base.call(this); 16297 this.callActions("beforeConstruct", arguments); 16298 this.configure = mixer.configure.bind(mixer); 16299 this.show = mixer.show.bind(mixer); 16300 this.hide = mixer.hide.bind(mixer); 16301 this.filter = mixer.filter.bind(mixer); 16302 this.toggleOn = mixer.toggleOn.bind(mixer); 16303 this.toggleOff = mixer.toggleOff.bind(mixer); 16304 this.sort = mixer.sort.bind(mixer); 16305 this.changeLayout = mixer.changeLayout.bind(mixer); 16306 this.multimix = mixer.multimix.bind(mixer); 16307 this.dataset = mixer.dataset.bind(mixer); 16308 this.tween = mixer.tween.bind(mixer); 16309 this.insert = mixer.insert.bind(mixer); 16310 this.insertBefore = mixer.insertBefore.bind(mixer); 16311 this.insertAfter = mixer.insertAfter.bind(mixer); 16312 this.prepend = mixer.prepend.bind(mixer); 16313 this.append = mixer.append.bind(mixer); 16314 this.remove = mixer.remove.bind(mixer); 16315 this.destroy = mixer.destroy.bind(mixer); 16316 this.forceRefresh = mixer.forceRefresh.bind(mixer); 16317 this.forceRender = mixer.forceRender.bind(mixer); 16318 this.isMixing = mixer.isMixing.bind(mixer); 16319 this.getOperation = mixer.getOperation.bind(mixer); 16320 this.getConfig = mixer.getConfig.bind(mixer);
16321 this.getState = mixer.getState.bind(mixer); 16322 this.callActions("afterConstruct", arguments); 16323 h.freeze(this); 16324 h.seal(this); 16325 }; 16326 mixitup.BaseStatic.call(mixitup.Facade); 16327 mixitup.Facade.prototype = Object.create(mixitup.Base.prototype); 16328 mixitup.Facade.prototype.constructor = mixitup.Facade; 16329 module.exports = mixitup; 16330 mixitup.BaseStatic.call(mixitup.constructor); 16331 mixitup.NAME = "mixitup"; 16332 mixitup.CORE_VERSION = "3.3.1"; 16333})(window); 16334 16335},{"@swc/helpers/src/_type_of.mjs":"69q0b","@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}],"5tx57":[function(require,module,exports) { 16336var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 16337parcelHelpers.defineInteropFlag(exports); 16338exports.default = function(el) { 16339 var modul = document.querySelector(".modal"); 16340 console.log(modul); 16341 var link = document.querySelector(".modal__close"); 16342 if (localStorage.getItem("cookieState") != "accepted") link.addEventListener("click", function() { 16343 modul.style.display = "none"; 16344 localStorage.setItem("cookieState", "accepted"); 16345 }); 16346}; 16347 16348},{"@parcel/transformer-js/src/esmodule-helpers.js":"3w4z1"}]},["c1bPs","jut1O"], "jut1O", "parcelRequire6ba0") 16349 16350//# 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.