1/******************************************************************************* 2 * Copyright 2019 Adobe 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17/** 18 * Element.matches() 19 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 20 */ 21if (!Element.prototype.matches) { 22 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 23} 24 25// eslint-disable-next-line valid-jsdoc 26/** 27 * Element.closest() 28 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 29 */ 30if (!Element.prototype.closest) { 31 Element.prototype.closest = function(s) { 32 "use strict"; 33 var el = this; 34 if (!document.documentElement.contains(el)) { 35 return null; 36 } 37 do { 38 if (el.matches(s)) { 39 return el; 40 } 41 el = el.parentElement || el.parentNode; 42 } while (el !== null && el.nodeType === 1); 43 return null; 44 }; 45} 46 47/******************************************************************************* 48 * Copyright 2019 Adobe 49 * 50 * Licensed under the Apache License, Version 2.0 (the "License"); 51 * you may not use this file except in compliance with the License. 52 * You may obtain a copy of the License at 53 * 54 * http://www.apache.org/licenses/LICENSE-2.0 55 * 56 * Unless required by applicable law or agreed to in writing, software 57 * distributed under the License is distributed on an "AS IS" BASIS, 58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 * See the License for the specific language governing permissions and 60 * limitations under the License. 61 ******************************************************************************/ 62(function() { 63 "use strict"; 64 65 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 66 if (!containerUtils) { 67 // eslint-disable-next-line no-console 68 console.warn("Accordion: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 69 } 70 var dataLayerEnabled; 71 var dataLayer; 72 var dataLayerName; 73 var delay = 100; 74 75 var NS = "cmp"; 76 var IS = "accordion"; 77 78 var keyCodes = { 79 ENTER: 13, 80 SPACE: 32, 81 END: 35, 82 HOME: 36, 83 ARROW_LEFT: 37, 84 ARROW_UP: 38, 85 ARROW_RIGHT: 39, 86 ARROW_DOWN: 40 87 }; 88 89 var selectors = { 90 self: "[data-" + NS + '-is="' + IS + '"]' 91 }; 92
93 var cssClasses = { 94 button: { 95 disabled: "cmp-accordion__button--disabled", 96 expanded: "cmp-accordion__button--expanded" 97 }, 98 panel: { 99 hidden: "cmp-accordion__panel--hidden", 100 expanded: "cmp-accordion__panel--expanded" 101 } 102 }; 103 104 var dataAttributes = { 105 item: { 106 expanded: "data-cmp-expanded" 107 } 108 }; 109 110 var properties = { 111 /** 112 * Determines whether a single accordion item is forced to be expanded at a time. 113 * Expanding one item will collapse all others. 114 * 115 * @memberof Accordion 116 * @type {Boolean} 117 * @default false 118 */ 119 "singleExpansion": { 120 "default": false, 121 "transform": function(value) { 122 return !(value === null || typeof value === "undefined"); 123 } 124 } 125 }; 126 127 /** 128 * Accordion Configuration. 129 * 130 * @typedef {Object} AccordionConfig Represents an Accordion configuration 131 * @property {HTMLElement} element The HTMLElement representing the Accordion 132 * @property {Object} options The Accordion options 133 */ 134 135 /** 136 * Accordion. 137 * 138 * @class Accordion 139 * @classdesc An interactive Accordion component for toggling panels of related content 140 * @param {AccordionConfig} config The Accordion configuration 141 */ 142 function Accordion(config) { 143 var that = this; 144 145 if (config && config.element) { 146 init(config); 147 } 148 149 /** 150 * Initializes the Accordion. 151 * 152 * @private 153 * @param {AccordionConfig} config The Accordion configuration 154 */ 155 function init(config) { 156 that._config = config; 157 158 // prevents multiple initialization 159 config.element.removeAttribute("data-" + NS + "-is"); 160 161 setupProperties(config.options); 162 cacheElements(config.element); 163 164 if (that._elements["item"]) { 165 // ensures multiple element types are arrays. 166 that._elements["item"] = Array.isArray(that._elements["item"]) ? that._elements["item"] : [that._elements["item"]]; 167 that._elements["button"] = Array.isArray(that._elements["button"]) ? that._elements["button"] : [that._elements["button"]]; 168 that._elements["panel"] = Array.isArray(that._elements["panel"]) ? that._elements["panel"] : [that._elements["panel"]]; 169 170 if (that._properties.singleExpansion) { 171 var expandedItems = getExpandedItems(); 172 // multiple expanded items annotated, display the last item open. 173 if (expandedItems.length > 1) { 174 toggle(expandedItems.length - 1); 175 } 176 } 177 178 refreshItems(); 179 bindEvents(); 180 scrollToDeepLinkIdInAccordion(); 181 } 182 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 183 /* 184 * Editor message handling: 185 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 186 * - check that the message data panel container type is correct and that the id (path) matches this specific Accordion component 187 * - if so, route the "navigate" operation to enact a navigation of the Accordion based on index data 188 */ 189 window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 190 window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 191 if (message.data && message.data.type === "cmp-accordion" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 192 if (message.data.operation === "navigate") { 193 // switch to single expansion mode when navigating in edit mode. 194 var singleExpansion = that._properties.singleExpansion; 195 that._properties.singleExpansion = true; 196 toggle(message.data.index); 197 198 // revert to the configured state. 199 that._properties.singleExpansion = singleExpansion; 200 } 201 } 202 }); 203 } 204 } 205 206 /**
207 * Displays the panel containing the element that corresponds to the deep link in the URI fragment 208 * and scrolls the browser to this element. 209 */ 210 function scrollToDeepLinkIdInAccordion() { 211 if (containerUtils) { 212 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "item", "item"); 213 if (deepLinkItemIdx > -1) { 214 var deepLinkItem = that._elements["item"][deepLinkItemIdx]; 215 if (deepLinkItem && !deepLinkItem.hasAttribute(dataAttributes.item.expanded)) { 216 // if single expansion: close all accordion items 217 if (that._properties.singleExpansion) { 218 for (var j = 0; j < that._elements["item"].length; j++) { 219 if (that._elements["item"][j].hasAttribute(dataAttributes.item.expanded)) { 220 setItemExpanded(that._elements["item"][j], false, true); 221 } 222 } 223 } 224 // expand the accordion item containing the deep link 225 setItemExpanded(deepLinkItem, true, true); 226 } 227 var hashId = window.location.hash.substring(1); 228 if (hashId) { 229 var hashItem = document.querySelector("[id='" + hashId + "']"); 230 if (hashItem) { 231 hashItem.scrollIntoView(); 232 } 233 } 234 } 235 } 236 } 237 238 /** 239 * Caches the Accordion elements as defined via the {@code data-accordion-hook="ELEMENT_NAME"} markup API. 240 * 241 * @private 242 * @param {HTMLElement} wrapper The Accordion wrapper element 243 */ 244 function cacheElements(wrapper) { 245 that._elements = {}; 246 that._elements.self = wrapper; 247 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 248 249 for (var i = 0; i < hooks.length; i++) { 250 var hook = hooks[i]; 251 if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own accordion elements 252 var capitalized = IS; 253 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 254 var key = hook.dataset[NS + "Hook" + capitalized]; 255 if (that._elements[key]) { 256 if (!Array.isArray(that._elements[key])) { 257 var tmp = that._elements[key]; 258 that._elements[key] = [tmp]; 259 } 260 that._elements[key].push(hook); 261 } else { 262 that._elements[key] = hook; 263 } 264 } 265 } 266 } 267 268 /** 269 * Sets up properties for the Accordion based on the passed options. 270 * 271 * @private 272 * @param {Object} options The Accordion options 273 */ 274 function setupProperties(options) { 275 that._properties = {}; 276 277 for (var key in properties) { 278 if (Object.prototype.hasOwnProperty.call(properties, key)) { 279 var property = properties[key]; 280 var value = null; 281 282 if (options && options[key] != null) { 283 value = options[key]; 284 285 // transform the provided option 286 if (property && typeof property.transform === "function") { 287 value = property.transform(value); 288 } 289 } 290 291 if (value === null) { 292 // value still null, take the property default 293 value = properties[key]["default"]; 294 } 295 296 that._properties[key] = value; 297 } 298 } 299 } 300 301 /** 302 * Binds Accordion event handling. 303 * 304 * @private 305 */ 306 function bindEvents() { 307 window.addEventListener("hashchange", scrollToDeepLinkIdInAccordion, false); 308 var buttons = that._elements["button"]; 309 if (buttons) { 310 for (var i = 0; i < buttons.length; i++) { 311 (function(index) { 312 buttons[i].addEventListener("click", function(event) { 313 toggle(index); 314 focusButton(index); 315 }); 316 buttons[i].addEventListener("keydown", function(event) { 317 onButtonKeyDown(event, index); 318 }); 319 })(i); 320 } 321 } 322 } 323 324 /** 325 * Handles button keydown events. 326 * 327 * @private 328 * @param {Object} event The keydown event 329 * @param {Number} index The index of the button triggering the event 330 */ 331 function onButtonKeyDown(event, index) { 332 var lastIndex = that._elements["button"].length - 1; 333 334 switch (event.keyCode) { 335 case keyCodes.ARROW_LEFT: 336 case keyCodes.ARROW_UP: 337 event.preventDefault(); 338 if (index > 0) { 339 focusButton(index - 1); 340 } 341 break; 342 case keyCodes.ARROW_RIGHT: 343 case keyCodes.ARROW_DOWN: 344 event.preventDefault(); 345 if (index < lastIndex) { 346 focusButton(index + 1); 347 } 348 break; 349 case keyCodes.HOME: 350 event.preventDefault(); 351 focusButton(0); 352 break; 353 case keyCodes.END: 354 event.preventDefault(); 355 focusButton(lastIndex); 356 break;
357 case keyCodes.ENTER: 358 case keyCodes.SPACE: 359 event.preventDefault(); 360 toggle(index); 361 focusButton(index); 362 break; 363 default: 364 return; 365 } 366 } 367 368 /** 369 * General handler for toggle of an item. 370 * 371 * @private 372 * @param {Number} index The index of the item to toggle 373 */ 374 function toggle(index) { 375 var item = that._elements["item"][index]; 376 if (item) { 377 if (that._properties.singleExpansion) { 378 // ensure only a single item is expanded if single expansion is enabled. 379 for (var i = 0; i < that._elements["item"].length; i++) { 380 if (that._elements["item"][i] !== item) { 381 var expanded = getItemExpanded(that._elements["item"][i]); 382 if (expanded) { 383 setItemExpanded(that._elements["item"][i], false); 384 } 385 } 386 } 387 } 388 setItemExpanded(item, !getItemExpanded(item)); 389 390 if (dataLayerEnabled) { 391 var accordionId = that._elements.self.id; 392 var expandedItems = getExpandedItems() 393 .map(function(item) { 394 return getDataLayerId(item); 395 }); 396 397 var uploadPayload = { component: {} }; 398 uploadPayload.component[accordionId] = { shownItems: expandedItems }; 399 400 var removePayload = { component: {} }; 401 removePayload.component[accordionId] = { shownItems: undefined }; 402 403 dataLayer.push(removePayload); 404 dataLayer.push(uploadPayload); 405 } 406 } 407 } 408 409 /** 410 * Sets an item's expanded state based on the provided flag and refreshes its internals. 411 * 412 * @private 413 * @param {HTMLElement} item The item to mark as expanded, or not expanded 414 * @param {Boolean} expanded true to mark the item expanded, false otherwise 415 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 416 */ 417 function setItemExpanded(item, expanded, keepHash) { 418 if (expanded) { 419 item.setAttribute(dataAttributes.item.expanded, ""); 420 var index = that._elements["item"].indexOf(item); 421 if (!keepHash && containerUtils) { 422 containerUtils.updateUrlHash(that, "item", index); 423 } 424 if (dataLayerEnabled) { 425 dataLayer.push({ 426 event: "cmp:show", 427 eventInfo: { 428 path: "component." + getDataLayerId(item) 429 } 430 }); 431 } 432 433 } else { 434 item.removeAttribute(dataAttributes.item.expanded); 435 if (!keepHash && containerUtils) { 436 containerUtils.removeUrlHash(); 437 } 438 if (dataLayerEnabled) { 439 dataLayer.push({ 440 event: "cmp:hide", 441 eventInfo: { 442 path: "component." + getDataLayerId(item) 443 } 444 }); 445 } 446 } 447 refreshItem(item); 448 } 449 450 /** 451 * Gets an item's expanded state. 452 * 453 * @private 454 * @param {HTMLElement} item The item for checking its expanded state 455 * @returns {Boolean} true if the item is expanded, false otherwise 456 */ 457 function getItemExpanded(item) { 458 return item && item.dataset && item.dataset["cmpExpanded"] !== undefined; 459 } 460 461 /** 462 * Refreshes an item based on its expanded state. 463 * 464 * @private 465 * @param {HTMLElement} item The item to refresh 466 */ 467 function refreshItem(item) { 468 var expanded = getItemExpanded(item); 469 if (expanded) { 470 expandItem(item); 471 } else { 472 collapseItem(item); 473 } 474 } 475 476 /** 477 * Refreshes all items based on their expanded state. 478 * 479 * @private 480 */ 481 function refreshItems() { 482 for (var i = 0; i < that._elements["item"].length; i++) { 483 refreshItem(that._elements["item"][i]); 484 } 485 } 486 487 /** 488 * Returns all expanded items. 489 * 490 * @private 491 * @returns {HTMLElement[]} The expanded items 492 */ 493 function getExpandedItems() { 494 var expandedItems = []; 495 496 for (var i = 0; i < that._elements["item"].length; i++) { 497 var item = that._elements["item"][i]; 498 var expanded = getItemExpanded(item); 499 if (expanded) { 500 expandedItems.push(item); 501 } 502 } 503 504 return expandedItems; 505 } 506 507 /** 508 * Annotates the item and its internals with 509 * the necessary style and accessibility attributes to indicate it is expanded. 510 * 511 * @private 512 * @param {HTMLElement} item The item to annotate as expanded 513 */ 514 function expandItem(item) { 515 var index = that._elements["item"].indexOf(item); 516 if (index > -1) { 517 var button = that._elements["button"][index]; 518 var panel = that._elements["panel"][index];
519 button.classList.add(cssClasses.button.expanded); 520 // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute 521 // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934 522 setTimeout(function() { 523 button.setAttribute("aria-expanded", true); 524 }, delay); 525 panel.classList.add(cssClasses.panel.expanded); 526 panel.classList.remove(cssClasses.panel.hidden); 527 panel.setAttribute("aria-hidden", false); 528 } 529 } 530 531 /** 532 * Annotates the item and its internals with 533 * the necessary style and accessibility attributes to indicate it is not expanded. 534 * 535 * @private 536 * @param {HTMLElement} item The item to annotate as not expanded 537 */ 538 function collapseItem(item) { 539 var index = that._elements["item"].indexOf(item); 540 if (index > -1) { 541 var button = that._elements["button"][index]; 542 var panel = that._elements["panel"][index]; 543 button.classList.remove(cssClasses.button.expanded); 544 // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute 545 // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934 546 setTimeout(function() { 547 button.setAttribute("aria-expanded", false); 548 }, delay); 549 panel.classList.add(cssClasses.panel.hidden); 550 panel.classList.remove(cssClasses.panel.expanded); 551 panel.setAttribute("aria-hidden", true); 552 } 553 } 554 555 /** 556 * Focuses the button at the provided index. 557 * 558 * @private 559 * @param {Number} index The index of the button to focus 560 */ 561 function focusButton(index) { 562 var button = that._elements["button"][index]; 563 button.focus(); 564 } 565 } 566 567 /** 568 * Reads options data from the Accordion wrapper element, defined via {@code data-cmp-*} data attributes. 569 * 570 * @private 571 * @param {HTMLElement} element The Accordion element to read options data from 572 * @returns {Object} The options read from the component data attributes 573 */ 574 function readData(element) { 575 var data = element.dataset; 576 var options = []; 577 var capitalized = IS; 578 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 579 var reserved = ["is", "hook" + capitalized]; 580 581 for (var key in data) { 582 if (Object.prototype.hasOwnProperty.call(data, key)) { 583 var value = data[key]; 584 585 if (key.indexOf(NS) === 0) { 586 key = key.slice(NS.length); 587 key = key.charAt(0).toLowerCase() + key.substring(1); 588 589 if (reserved.indexOf(key) === -1) { 590 options[key] = value; 591 } 592 } 593 } 594 } 595 596 return options; 597 } 598 599 /** 600 * Parses the dataLayer string and returns the ID 601 * 602 * @private 603 * @param {HTMLElement} item the accordion item 604 * @returns {String} dataLayerId or undefined 605 */ 606 function getDataLayerId(item) { 607 if (item) { 608 if (item.dataset.cmpDataLayer) { 609 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 610 } else { 611 return item.id; 612 } 613 } 614 return null; 615 } 616 617 /** 618 * Document ready handler and DOM mutation observers. Initializes Accordion components as necessary. 619 * 620 * @private 621 */ 622 function onDocumentReady() { 623 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 624 if (dataLayerEnabled) { 625 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 626 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 627 } 628 629 var elements = document.querySelectorAll(selectors.self); 630 for (var i = 0; i < elements.length; i++) { 631 new Accordion({ element: elements[i], options: readData(elements[i]) }); 632 } 633 634 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 635 var body = document.querySelector("body"); 636 var observer = new MutationObserver(function(mutations) { 637 mutations.forEach(function(mutation) { 638 // needed for IE 639 var nodesArray = [].slice.call(mutation.addedNodes); 640 if (nodesArray.length > 0) { 641 nodesArray.forEach(function(addedNode) { 642 if (addedNode.querySelectorAll) { 643 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 644 elementsArray.forEach(function(element) { 645 new Accordion({ element: element, options: readData(element) }); 646 }); 647 } 648 }); 649 } 650 }); 651 }); 652 653 observer.observe(body, { 654 subtree: true, 655 childList: true, 656 characterData: true 657 }); 658 } 659 660 if (document.readyState !== "loading") { 661 onDocumentReady(); 662 } else { 663 document.addEventListener("DOMContentLoaded", onDocumentReady); 664 } 665 666 if (containerUtils) { 667 window.addEventListener("load", containerUtils.scrollToAnchor, false); 668 } 669 670}()); 671 672 673/******************************************************************************* 674 * Copyright 2018 Adobe 675 * 676 * Licensed under the Apache License, Version 2.0 (the "License");
677 * you may not use this file except in compliance with the License. 678 * You may obtain a copy of the License at 679 * 680 * http://www.apache.org/licenses/LICENSE2.0 681 * 682 * Unless required by applicable law or agreed to in writing, software 683 * distributed under the License is distributed on an "AS IS" BASIS, 684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 685 * See the License for the specific language governing permissions and 686 * limitations under the License. 687 ******************************************************************************/ 688 689/** 690 * Element.matches() 691 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 692 */ 693if (!Element.prototype.matches) { 694 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 695} 696 697// eslint-disable-next-line valid-jsdoc 698/** 699 * Element.closest() 700 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 701 */ 702if (!Element.prototype.closest) { 703 Element.prototype.closest = function(s) { 704 "use strict"; 705 var el = this; 706 if (!document.documentElement.contains(el)) { 707 return null; 708 } 709 do { 710 if (el.matches(s)) { 711 return el; 712 } 713 el = el.parentElement || el.parentNode; 714 } while (el !== null && el.nodeType === 1); 715 return null; 716 }; 717} 718 719/******************************************************************************* 720 * Copyright 2018 Adobe 721 * 722 * Licensed under the Apache License, Version 2.0 (the "License"); 723 * you may not use this file except in compliance with the License. 724 * You may obtain a copy of the License at 725 * 726 * http://www.apache.org/licenses/LICENSE-2.0 727 * 728 * Unless required by applicable law or agreed to in writing, software 729 * distributed under the License is distributed on an "AS IS" BASIS, 730 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 731 * See the License for the specific language governing permissions and 732 * limitations under the License. 733 ******************************************************************************/ 734/* global 735 CQ 736 */ 737(function() { 738 "use strict"; 739 740 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 741 if (!containerUtils) { 742 // eslint-disable-next-line no-console 743 console.warn("Tabs: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 744 } 745 var dataLayerEnabled; 746 var dataLayer; 747 var dataLayerName; 748 749 var NS = "cmp"; 750 var IS = "tabs"; 751 752 var keyCodes = { 753 END: 35, 754 HOME: 36, 755 ARROW_LEFT: 37, 756 ARROW_UP: 38, 757 ARROW_RIGHT: 39, 758 ARROW_DOWN: 40 759 }; 760 761 var selectors = { 762 self: "[data-" + NS + '-is="' + IS + '"]', 763 active: { 764 tab: "cmp-tabs__tab--active", 765 tabpanel: "cmp-tabs__tabpanel--active" 766 } 767 }; 768 769 /** 770 * Tabs Configuration 771 * 772 * @typedef {Object} TabsConfig Represents a Tabs configuration 773 * @property {HTMLElement} element The HTMLElement representing the Tabs 774 * @property {Object} options The Tabs options 775 */ 776 777 /** 778 * Tabs 779 * 780 * @class Tabs 781 * @classdesc An interactive Tabs component for navigating a list of tabs 782 * @param {TabsConfig} config The Tabs configuration 783 */ 784 function Tabs(config) { 785 var that = this; 786 787 if (config && config.element) { 788 init(config); 789 } 790 791 /** 792 * Initializes the Tabs 793 * 794 * @private 795 * @param {TabsConfig} config The Tabs configuration 796 */ 797 function init(config) { 798 that._config = config; 799 800 // prevents multiple initialization 801 config.element.removeAttribute("data-" + NS + "-is"); 802 803 cacheElements(config.element); 804 that._active = getActiveIndex(that._elements["tab"]); 805 806 if (that._elements.tabpanel) { 807 refreshActive(); 808 bindEvents(); 809 scrollToDeepLinkIdInTabs(); 810 } 811 812 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 813 /* 814 * Editor message handling: 815 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame
816 * - check that the message data panel container type is correct and that the id (path) matches this specific Tabs component 817 * - if so, route the "navigate" operation to enact a navigation of the Tabs based on index data 818 */ 819 CQ.CoreComponents.MESSAGE_CHANNEL = CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 820 CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 821 if (message.data && message.data.type === "cmp-tabs" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 822 if (message.data.operation === "navigate") { 823 navigate(message.data.index); 824 } 825 } 826 }); 827 } 828 } 829 830 /** 831 * Displays the panel containing the element that corresponds to the deep link in the URI fragment 832 * and scrolls the browser to this element. 833 */ 834 function scrollToDeepLinkIdInTabs() { 835 if (containerUtils) { 836 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "tab", "tabpanel"); 837 if (deepLinkItemIdx > -1) { 838 var deepLinkItem = that._elements["tab"][deepLinkItemIdx]; 839 if (deepLinkItem && that._elements["tab"][that._active].id !== deepLinkItem.id) { 840 navigateAndFocusTab(deepLinkItemIdx, true); 841 } 842 var hashId = window.location.hash.substring(1); 843 if (hashId) { 844 var hashItem = document.querySelector("[id='" + hashId + "']"); 845 if (hashItem) { 846 hashItem.scrollIntoView(); 847 } 848 } 849 } 850 } 851 } 852 853 /** 854 * Returns the index of the active tab, if no tab is active returns 0 855 * 856 * @param {Array} tabs Tab elements 857 * @returns {Number} Index of the active tab, 0 if none is active 858 */ 859 function getActiveIndex(tabs) { 860 if (tabs) { 861 for (var i = 0; i < tabs.length; i++) { 862 if (tabs[i].classList.contains(selectors.active.tab)) { 863 return i; 864 } 865 } 866 } 867 return 0; 868 } 869 870 /** 871 * Caches the Tabs elements as defined via the {@code data-tabs-hook="ELEMENT_NAME"} markup API 872 * 873 * @private 874 * @param {HTMLElement} wrapper The Tabs wrapper element 875 */ 876 function cacheElements(wrapper) { 877 that._elements = {}; 878 that._elements.self = wrapper; 879 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 880 881 for (var i = 0; i < hooks.length; i++) { 882 var hook = hooks[i]; 883 if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own tab elements 884 var capitalized = IS; 885 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 886 var key = hook.dataset[NS + "Hook" + capitalized]; 887 if (that._elements[key]) { 888 if (!Array.isArray(that._elements[key])) { 889 var tmp = that._elements[key]; 890 that._elements[key] = [tmp]; 891 } 892 that._elements[key].push(hook); 893 } else { 894 that._elements[key] = hook; 895 } 896 } 897 } 898 } 899 900 /** 901 * Binds Tabs event handling 902 * 903 * @private 904 */ 905 function bindEvents() { 906 window.addEventListener("hashchange", scrollToDeepLinkIdInTabs, false); 907 var tabs = that._elements["tab"]; 908 if (tabs) { 909 for (var i = 0; i < tabs.length; i++) { 910 (function(index) { 911 tabs[i].addEventListener("click", function(event) { 912 navigateAndFocusTab(index); 913 }); 914 tabs[i].addEventListener("keydown", function(event) { 915 onKeyDown(event); 916 }); 917 })(i); 918 } 919 } 920 } 921 922 /** 923 * Handles tab keydown events 924 * 925 * @private 926 * @param {Object} event The keydown event 927 */ 928 function onKeyDown(event) { 929 var index = that._active; 930 var lastIndex = that._elements["tab"].length - 1; 931 932 switch (event.keyCode) { 933 case keyCodes.ARROW_LEFT: 934 case keyCodes.ARROW_UP: 935 event.preventDefault(); 936 if (index > 0) { 937 navigateAndFocusTab(index - 1); 938 } 939 break; 940 case keyCodes.ARROW_RIGHT: 941 case keyCodes.ARROW_DOWN: 942 event.preventDefault(); 943 if (index < lastIndex) { 944 navigateAndFocusTab(index + 1); 945 } 946 break; 947 case keyCodes.HOME: 948 event.preventDefault(); 949 navigateAndFocusTab(0); 950 break; 951 case keyCodes.END: 952 event.preventDefault(); 953 navigateAndFocusTab(lastIndex); 954 break; 955 default: 956 return; 957 } 958 } 959 960 /** 961 * Refreshes the tab markup based on the current {@code Tabs#_active} index 962 * 963 * @private 964 */ 965 function refreshActive() { 966 var tabpanels = that._elements["tabpanel"]; 967 var tabs = that._elements["tab"]; 968 969 if (tabpanels) { 970 if (Array.isArray(tabpanels)) { 971 for (var i = 0; i < tabpanels.length; i++) { 972 if (i === parseInt(that._active)) { 973 tabpanels[i].classList.add(selectors.active.tabpanel); 974 tabpanels[i].removeAttribute("aria-hidden"); 975 tabs[i].classList.add(selectors.active.tab); 976 tabs[i].setAttribute("aria-selected", true); 977 tabs[i].setAttribute("tabindex", "0"); 978 } else { 979 tabpanels[i].classList.remove(selectors.active.tabpanel); 980 tabpanels[i].setAttribute("aria-hidden", true); 981 tabs[i].classList.remove(selectors.active.tab); 982 tabs[i].setAttribute("aria-selected", false); 983 tabs[i].setAttribute("tabindex", "-1"); 984 } 985 } 986 } else { 987 // only one tab 988 tabpanels.classList.add(selectors.active.tabpanel); 989 tabs.classList.add(selectors.active.tab); 990 } 991 } 992 } 993 994 /** 995 * Focuses the element and prevents scrolling the element into view 996 * 997 * @param {HTMLElement} element Element to focus 998 */ 999 function focusWithoutScroll(element) { 1000 var x = window.scrollX || window.pageXOffset; 1001 var y = window.scrollY || window.pageYOffset; 1002 element.focus(); 1003 window.scrollTo(x, y); 1004 } 1005 1006 /** 1007 * Navigates to the tab at the provided index 1008 * 1009 * @private 1010 * @param {Number} index The index of the tab to navigate to 1011 */ 1012 function navigate(index) { 1013 that._active = index; 1014 refreshActive(); 1015 } 1016 1017 /** 1018 * Navigates to the item at the provided index and ensures the active tab gains focus 1019 * 1020 * @private 1021 * @param {Number} index The index of the item to navigate to 1022 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 1023 */ 1024 function navigateAndFocusTab(index, keepHash) { 1025 var exActive = that._active; 1026 if (!keepHash && containerUtils) { 1027 containerUtils.updateUrlHash(that, "tab", index); 1028 } 1029 navigate(index); 1030 focusWithoutScroll(that._elements["tab"][index]); 1031 1032 if (dataLayerEnabled) { 1033 1034 var activeItem = getDataLayerId(that._elements.tabpanel[index]); 1035 var exActiveItem = getDataLayerId(that._elements.tabpanel[exActive]); 1036 1037 dataLayer.push({ 1038 event: "cmp:show", 1039 eventInfo: { 1040 path: "component." + activeItem 1041 } 1042 }); 1043 1044 dataLayer.push({ 1045 event: "cmp:hide", 1046 eventInfo: { 1047 path: "component." + exActiveItem 1048 } 1049 }); 1050 1051 var tabsId = that._elements.self.id; 1052 var uploadPayload = { component: {} }; 1053 uploadPayload.component[tabsId] = { shownItems: [activeItem] }; 1054 1055 var removePayload = { component: {} }; 1056 removePayload.component[tabsId] = { shownItems: undefined }; 1057 1058 dataLayer.push(removePayload); 1059 dataLayer.push(uploadPayload); 1060 } 1061 } 1062 } 1063 1064 /**
1065 * Reads options data from the Tabs wrapper element, defined via {@code data-cmp-*} data attributes 1066 * 1067 * @private 1068 * @param {HTMLElement} element The Tabs element to read options data from 1069 * @returns {Object} The options read from the component data attributes 1070 */ 1071 function readData(element) { 1072 var data = element.dataset; 1073 var options = []; 1074 var capitalized = IS; 1075 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1076 var reserved = ["is", "hook" + capitalized]; 1077 1078 for (var key in data) { 1079 if (Object.prototype.hasOwnProperty.call(data, key)) { 1080 var value = data[key]; 1081 1082 if (key.indexOf(NS) === 0) { 1083 key = key.slice(NS.length); 1084 key = key.charAt(0).toLowerCase() + key.substring(1); 1085 1086 if (reserved.indexOf(key) === -1) { 1087 options[key] = value; 1088 } 1089 } 1090 } 1091 } 1092 1093 return options; 1094 } 1095 1096 /** 1097 * Parses the dataLayer string and returns the ID 1098 * 1099 * @private 1100 * @param {HTMLElement} item the accordion item 1101 * @returns {String} dataLayerId or undefined 1102 */ 1103 function getDataLayerId(item) { 1104 if (item) { 1105 if (item.dataset.cmpDataLayer) { 1106 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 1107 } else { 1108 return item.id; 1109 } 1110 } 1111 return null; 1112 } 1113 1114 /** 1115 * Document ready handler and DOM mutation observers. Initializes Tabs components as necessary. 1116 * 1117 * @private 1118 */ 1119 function onDocumentReady() { 1120 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 1121 if (dataLayerEnabled) { 1122 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 1123 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 1124 } 1125 1126 var elements = document.querySelectorAll(selectors.self); 1127 for (var i = 0; i < elements.length; i++) { 1128 new Tabs({ element: elements[i], options: readData(elements[i]) }); 1129 } 1130 1131 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 1132 var body = document.querySelector("body"); 1133 var observer = new MutationObserver(function(mutations) { 1134 mutations.forEach(function(mutation) { 1135 // needed for IE 1136 var nodesArray = [].slice.call(mutation.addedNodes); 1137 if (nodesArray.length > 0) { 1138 nodesArray.forEach(function(addedNode) { 1139 if (addedNode.querySelectorAll) { 1140 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 1141 elementsArray.forEach(function(element) { 1142 new Tabs({ element: element, options: readData(element) }); 1143 }); 1144 } 1145 }); 1146 } 1147 }); 1148 }); 1149 1150 observer.observe(body, { 1151 subtree: true, 1152 childList: true, 1153 characterData: true 1154 }); 1155 } 1156 1157 if (document.readyState !== "loading") { 1158 onDocumentReady(); 1159 } else { 1160 document.addEventListener("DOMContentLoaded", onDocumentReady); 1161 } 1162 1163 if (containerUtils) { 1164 window.addEventListener("load", containerUtils.scrollToAnchor, false); 1165 } 1166 1167}()); 1168 1169 1170/******************************************************************************* 1171 * Copyright 2022 Adobe 1172 * 1173 * Licensed under the Apache License, Version 2.0 (the "License"); 1174 * you may not use this file except in compliance with the License. 1175 * You may obtain a copy of the License at 1176 * 1177 * http://www.apache.org/licenses/LICENSE-2.0 1178 * 1179 * Unless required by applicable law or agreed to in writing, software 1180 * distributed under the License is distributed on an "AS IS" BASIS, 1181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1182 * See the License for the specific language governing permissions and 1183 * limitations under the License. 1184 ******************************************************************************/ 1185(function(document) { 1186 "use strict"; 1187 1188 window.CMP = window.CMP || {}; 1189 window.CMP.utils = (function() { 1190 var NS = "cmp"; 1191 1192 /**
1193 * Reads options data from the Component wrapper element, defined via {@code data-cmp-*} data attributes 1194 * 1195 * @param {HTMLElement} element The component element to read options data from 1196 * @param {String} is The component identifier 1197 * @returns {String[]} The options read from the component data attributes 1198 */ 1199 var readData = function(element, is) { 1200 var data = element.dataset; 1201 var options = []; 1202 var capitalized = is; 1203 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1204 var reserved = ["is", "hook" + capitalized]; 1205 1206 for (var key in data) { 1207 if (Object.prototype.hasOwnProperty.call(data, key)) { 1208 var value = data[key]; 1209 1210 if (key.indexOf(NS) === 0) { 1211 key = key.slice(NS.length); 1212 key = key.charAt(0).toLowerCase() + key.substring(1); 1213 1214 if (reserved.indexOf(key) === -1) { 1215 options[key] = value; 1216 } 1217 } 1218 } 1219 } 1220 return options; 1221 }; 1222 1223 /** 1224 * Set up the final properties of a component by evaluating the transform function or fall back to the default value on demand 1225 * @param {String[]} options the options to transform 1226 * @param {Object} properties object of properties of property functions 1227 * @returns {Object} transformed properties 1228 */ 1229 var setupProperties = function(options, properties) { 1230 var transformedProperties = {}; 1231 1232 for (var key in properties) { 1233 if (Object.prototype.hasOwnProperty.call(properties, key)) { 1234 var property = properties[key]; 1235 if (options && options[key] != null) { 1236 if (property && typeof property.transform === "function") { 1237 transformedProperties[key] = property.transform(options[key]); 1238 } else { 1239 transformedProperties[key] = options[key]; 1240 } 1241 } else { 1242 transformedProperties[key] = properties[key]["default"]; 1243 } 1244 } 1245 } 1246 return transformedProperties; 1247 }; 1248 1249 1250 return { 1251 readData: readData, 1252 setupProperties: setupProperties 1253 }; 1254 }()); 1255}(window.document)); 1256 1257/******************************************************************************* 1258 * Copyright 2018 Adobe 1259 * 1260 * Licensed under the Apache License, Version 2.0 (the "License"); 1261 * you may not use this file except in compliance with the License. 1262 * You may obtain a copy of the License at 1263 * 1264 * http://www.apache.org/licenses/LICENSE-2.0 1265 * 1266 * Unless required by applicable law or agreed to in writing, software 1267 * distributed under the License is distributed on an "AS IS" BASIS, 1268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1269 * See the License for the specific language governing permissions and 1270 * limitations under the License. 1271 ******************************************************************************/ 1272(function() { 1273 "use strict"; 1274 1275 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 1276 if (!containerUtils) { 1277 // eslint-disable-next-line no-console 1278 console.warn("Tabs: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 1279 } 1280 var dataLayerEnabled; 1281 var dataLayer; 1282 var dataLayerName; 1283 1284 var NS = "cmp"; 1285 var IS = "carousel"; 1286 1287 var keyCodes = { 1288 SPACE: 32, 1289 END: 35, 1290 HOME: 36, 1291 ARROW_LEFT: 37, 1292 ARROW_UP: 38, 1293 ARROW_RIGHT: 39, 1294 ARROW_DOWN: 40 1295 }; 1296 1297 var selectors = { 1298 self: "[data-" + NS + '-is="' + IS + '"]' 1299 }; 1300 1301 var properties = { 1302 /** 1303 * Determines whether the Carousel will automatically transition between slides 1304 * 1305 * @memberof Carousel
1306 * @type {Boolean} 1307 * @default false 1308 */ 1309 "autoplay": { 1310 "default": false, 1311 "transform": function(value) { 1312 return !(value === null || typeof value === "undefined"); 1313 } 1314 }, 1315 /** 1316 * Duration (in milliseconds) before automatically transitioning to the next slide 1317 * 1318 * @memberof Carousel 1319 * @type {Number} 1320 * @default 5000 1321 */ 1322 "delay": { 1323 "default": 5000, 1324 "transform": function(value) { 1325 value = parseFloat(value); 1326 return !isNaN(value) ? value : null; 1327 } 1328 }, 1329 /** 1330 * Determines whether automatic pause on hovering the carousel is disabled 1331 * 1332 * @memberof Carousel 1333 * @type {Boolean} 1334 * @default false 1335 */ 1336 "autopauseDisabled": { 1337 "default": false, 1338 "transform": function(value) { 1339 return !(value === null || typeof value === "undefined"); 1340 } 1341 } 1342 }; 1343 1344 /** 1345 * Carousel Configuration 1346 * 1347 * @typedef {Object} CarouselConfig Represents a Carousel configuration 1348 * @property {HTMLElement} element The HTMLElement representing the Carousel 1349 * @property {*[]} options The Carousel options 1350 */ 1351 1352 /** 1353 * Carousel 1354 * 1355 * @class Carousel 1356 * @classdesc An interactive Carousel component for navigating a list of generic items 1357 * @param {CarouselConfig} config The Carousel configuration 1358 */ 1359 function Carousel(config) { 1360 var that = this; 1361 1362 if (config && config.element) { 1363 init(config); 1364 } 1365 1366 /** 1367 * Initializes the Carousel 1368 * 1369 * @private 1370 * @param {CarouselConfig} config The Carousel configuration 1371 */ 1372 function init(config) { 1373 that._config = config; 1374 1375 // prevents multiple initialization 1376 config.element.removeAttribute("data-" + NS + "-is"); 1377 1378 setupProperties(config.options); 1379 cacheElements(config.element); 1380 1381 that._active = 0; 1382 that._paused = false; 1383 1384 if (that._elements.item) { 1385 initializeActive(); 1386 bindEvents(); 1387 resetAutoplayInterval(); 1388 refreshPlayPauseActions(); 1389 scrollToDeepLinkIdInCarousel(); 1390 } 1391 1392 // TODO: This section is only relevant in edit mode and should move to the editor clientLib 1393 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 1394 /* 1395 * Editor message handling: 1396 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 1397 * - check that the message data panel container type is correct and that the id (path) matches this specific Carousel component 1398 * - if so, route the "navigate" operation to enact a navigation of the Carousel based on index data 1399 */ 1400 window.CQ = window.CQ || {}; 1401 window.CQ.CoreComponents = window.CQ.CoreComponents || {}; 1402 window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 1403 window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 1404 if (message.data && message.data.type === "cmp-carousel" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 1405 if (message.data.operation === "navigate") { 1406 navigate(message.data.index); 1407 } 1408 } 1409 }); 1410 } 1411 } 1412 1413 /** 1414 * Displays the slide containing the element that corresponds to the deep link in the URI fragment 1415 * and scrolls the browser to this element. 1416 */ 1417 function scrollToDeepLinkIdInCarousel() { 1418 if (containerUtils) { 1419 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "item", "item"); 1420 if (deepLinkItemIdx > -1) { 1421 var deepLinkItem = that._elements["item"][deepLinkItemIdx]; 1422 if (deepLinkItem && that._elements["item"][that._active].id !== deepLinkItem.id) { 1423 navigateAndFocusIndicator(deepLinkItemIdx, true); 1424 // pause the carousel auto-rotation 1425 pause(); 1426 } 1427 var hashId = window.location.hash.substring(1); 1428 if (hashId) { 1429 var hashItem = document.querySelector("[id='" + hashId + "']"); 1430 if (hashItem) { 1431 hashItem.scrollIntoView(); 1432 } 1433 } 1434 } 1435 } 1436 } 1437 1438 /** 1439 * Caches the Carousel elements as defined via the {@code data-carousel-hook="ELEMENT_NAME"} markup API 1440 * 1441 * @private 1442 * @param {HTMLElement} wrapper The Carousel wrapper element 1443 */ 1444 function cacheElements(wrapper) { 1445 that._elements = {}; 1446 that._elements.self = wrapper; 1447 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 1448 1449 for (var i = 0; i < hooks.length; i++) { 1450 var hook = hooks[i]; 1451 var capitalized = IS; 1452 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1453 var key = hook.dataset[NS + "Hook" + capitalized]; 1454 if (that._elements[key]) { 1455 if (!Array.isArray(that._elements[key])) { 1456 var tmp = that._elements[key]; 1457 that._elements[key] = [tmp]; 1458 } 1459 that._elements[key].push(hook); 1460 } else { 1461 that._elements[key] = hook; 1462 } 1463 } 1464 } 1465 1466 /** 1467 * Sets up properties for the Carousel based on the passed options. 1468 * 1469 * @private 1470 * @param {Object} options The Carousel options 1471 */ 1472 function setupProperties(options) { 1473 that._properties = {}; 1474 1475 for (var key in properties) { 1476 if (Object.prototype.hasOwnProperty.call(properties, key)) { 1477 var property = properties[key]; 1478 var value = null; 1479 1480 if (options && options[key] != null) { 1481 value = options[key]; 1482 1483 // transform the provided option 1484 if (property && typeof property.transform === "function") { 1485 value = property.transform(value); 1486 } 1487 } 1488 1489 if (value === null) { 1490 // value still null, take the property default 1491 value = properties[key]["default"]; 1492 } 1493 1494 that._properties[key] = value; 1495 } 1496 } 1497 } 1498 1499 /** 1500 * Binds Carousel event handling 1501 * 1502 * @private 1503 */ 1504 function bindEvents() { 1505 window.addEventListener("hashchange", scrollToDeepLinkIdInCarousel, false); 1506 if (that._elements["previous"]) { 1507 that._elements["previous"].addEventListener("click", function() { 1508 var index = getPreviousIndex(); 1509 navigate(index); 1510 if (dataLayerEnabled) { 1511 dataLayer.push({ 1512 event: "cmp:show", 1513 eventInfo: { 1514 path: "component." + getDataLayerId(that._elements.item[index]) 1515 } 1516 }); 1517 } 1518 }); 1519 } 1520 1521 if (that._elements["next"]) { 1522 that._elements["next"].addEventListener("click", function() { 1523 var index = getNextIndex(); 1524 navigate(index); 1525 if (dataLayerEnabled) { 1526 dataLayer.push({ 1527 event: "cmp:show", 1528 eventInfo: { 1529 path: "component." + getDataLayerId(that._elements.item[index]) 1530 } 1531 }); 1532 } 1533 }); 1534 } 1535 1536 var indicators = that._elements["indicator"]; 1537 if (indicators) { 1538 for (var i = 0; i < indicators.length; i++) { 1539 (function(index) { 1540 indicators[i].addEventListener("click", function(event) { 1541 navigateAndFocusIndicator(index); 1542 // pause the carousel auto-rotation 1543 pause(); 1544 }); 1545 })(i); 1546 } 1547 } 1548 1549 if (that._elements["pause"]) { 1550 if (that._properties.autoplay) { 1551 that._elements["pause"].addEventListener("click", onPauseClick); 1552 } 1553 } 1554 1555 if (that._elements["play"]) { 1556 if (that._properties.autoplay) { 1557 that._elements["play"].addEventListener("click", onPlayClick); 1558 } 1559 } 1560 1561 that._elements.self.addEventListener("keydown", onKeyDown); 1562 1563 if (!that._properties.autopauseDisabled) { 1564 that._elements.self.addEventListener("mouseenter", onMouseEnter); 1565 that._elements.self.addEventListener("mouseleave", onMouseLeave); 1566 } 1567 1568 // for accessibility we pause animation when a element get focused 1569 var items = that._elements["item"]; 1570 if (items) { 1571 for (var j = 0; j < items.length; j++) { 1572 items[j].addEventListener("focusin", onMouseEnter); 1573 items[j].addEventListener("focusout", onMouseLeave); 1574 } 1575 } 1576 } 1577 1578 /**
1579 * Handles carousel keydown events 1580 * 1581 * @private 1582 * @param {Object} event The keydown event 1583 */ 1584 function onKeyDown(event) { 1585 var index = that._active; 1586 var lastIndex = that._elements["indicator"].length - 1; 1587 1588 switch (event.keyCode) { 1589 case keyCodes.ARROW_LEFT: 1590 case keyCodes.ARROW_UP: 1591 event.preventDefault(); 1592 if (index > 0) { 1593 navigateAndFocusIndicator(index - 1); 1594 } 1595 break; 1596 case keyCodes.ARROW_RIGHT: 1597 case keyCodes.ARROW_DOWN: 1598 event.preventDefault(); 1599 if (index < lastIndex) { 1600 navigateAndFocusIndicator(index + 1); 1601 } 1602 break; 1603 case keyCodes.HOME: 1604 event.preventDefault(); 1605 navigateAndFocusIndicator(0); 1606 break; 1607 case keyCodes.END: 1608 event.preventDefault(); 1609 navigateAndFocusIndicator(lastIndex); 1610 break; 1611 case keyCodes.SPACE: 1612 if (that._properties.autoplay && (event.target !== that._elements["previous"] && event.target !== that._elements["next"])) { 1613 event.preventDefault(); 1614 if (!that._paused) { 1615 pause(); 1616 } else { 1617 play(); 1618 } 1619 } 1620 if (event.target === that._elements["pause"]) { 1621 that._elements["play"].focus(); 1622 } 1623 if (event.target === that._elements["play"]) { 1624 that._elements["pause"].focus(); 1625 } 1626 break; 1627 default: 1628 return; 1629 } 1630 } 1631 1632 /** 1633 * Handles carousel mouseenter events 1634 * 1635 * @private 1636 * @param {Object} event The mouseenter event 1637 */ 1638 function onMouseEnter(event) { 1639 clearAutoplayInterval(); 1640 } 1641 1642 /** 1643 * Handles carousel mouseleave events 1644 * 1645 * @private 1646 * @param {Object} event The mouseleave event 1647 */ 1648 function onMouseLeave(event) { 1649 resetAutoplayInterval(); 1650 } 1651 1652 /** 1653 * Handles pause element click events 1654 * 1655 * @private 1656 * @param {Object} event The click event 1657 */ 1658 function onPauseClick(event) { 1659 pause(); 1660 that._elements["play"].focus(); 1661 } 1662 1663 /** 1664 * Handles play element click events 1665 * 1666 * @private 1667 * @param {Object} event The click event 1668 */ 1669 function onPlayClick() { 1670 play(); 1671 that._elements["pause"].focus(); 1672 } 1673 1674 /** 1675 * Pauses the playing of the Carousel. Sets {@code Carousel#_paused} marker. 1676 * Only relevant when autoplay is enabled 1677 * 1678 * @private 1679 */ 1680 function pause() { 1681 that._paused = true; 1682 clearAutoplayInterval(); 1683 refreshPlayPauseActions(); 1684 } 1685 1686 /** 1687 * Enables the playing of the Carousel. Sets {@code Carousel#_paused} marker. 1688 * Only relevant when autoplay is enabled 1689 * 1690 * @private 1691 */ 1692 function play() { 1693 that._paused = false; 1694 1695 // If the Carousel is hovered, don't begin auto transitioning until the next mouse leave event 1696 var hovered = false; 1697 if (that._elements.self.parentElement) { 1698 hovered = that._elements.self.parentElement.querySelector(":hover") === that._elements.self; 1699 } 1700 if (that._properties.autopauseDisabled || !hovered) { 1701 resetAutoplayInterval(); 1702 } 1703 1704 refreshPlayPauseActions(); 1705 } 1706 1707 /** 1708 * Refreshes the play/pause action markup based on the {@code Carousel#_paused} state 1709 * 1710 * @private 1711 */ 1712 function refreshPlayPauseActions() {
1713 setActionDisabled(that._elements["pause"], that._paused); 1714 setActionDisabled(that._elements["play"], !that._paused); 1715 } 1716 1717 /** 1718 * Initialize {@code Carousel#_active} based on the active item of the carousel. 1719 */ 1720 function initializeActive() { 1721 var items = that._elements["item"]; 1722 if (items && Array.isArray(items)) { 1723 for (var i = 0; i < items.length; i++) { 1724 if (items[i].classList.contains("cmp-carousel__item--active")) { 1725 that._active = i; 1726 break; 1727 } 1728 } 1729 } 1730 } 1731 1732 /** 1733 * Refreshes the item markup based on the current {@code Carousel#_active} index 1734 * 1735 * @private 1736 */ 1737 function refreshActive() { 1738 var items = that._elements["item"]; 1739 var indicators = that._elements["indicator"]; 1740 1741 if (items) { 1742 if (Array.isArray(items)) { 1743 for (var i = 0; i < items.length; i++) { 1744 if (i === parseInt(that._active)) { 1745 items[i].classList.add("cmp-carousel__item--active"); 1746 items[i].removeAttribute("aria-hidden"); 1747 indicators[i].classList.add("cmp-carousel__indicator--active"); 1748 indicators[i].setAttribute("aria-selected", true); 1749 indicators[i].setAttribute("tabindex", "0"); 1750 } else { 1751 items[i].classList.remove("cmp-carousel__item--active"); 1752 items[i].setAttribute("aria-hidden", true); 1753 indicators[i].classList.remove("cmp-carousel__indicator--active"); 1754 indicators[i].setAttribute("aria-selected", false); 1755 indicators[i].setAttribute("tabindex", "-1"); 1756 } 1757 } 1758 } else { 1759 // only one item 1760 items.classList.add("cmp-carousel__item--active"); 1761 indicators.classList.add("cmp-carousel__indicator--active"); 1762 } 1763 } 1764 } 1765 1766 /** 1767 * Focuses the element and prevents scrolling the element into view 1768 * 1769 * @param {HTMLElement} element Element to focus 1770 */ 1771 function focusWithoutScroll(element) { 1772 var x = window.scrollX || window.pageXOffset; 1773 var y = window.scrollY || window.pageYOffset; 1774 element.focus(); 1775 window.scrollTo(x, y); 1776 } 1777 1778 /** 1779 * Retrieves the next active index, with looping 1780 * 1781 * @private 1782 * @returns {Number} Index of the next carousel item 1783 */ 1784 function getNextIndex() { 1785 return that._active === (that._elements["item"].length - 1) ? 0 : that._active + 1; 1786 } 1787 1788 /** 1789 * Retrieves the previous active index, with looping 1790 * 1791 * @private 1792 * @returns {Number} Index of the previous carousel item 1793 */ 1794 function getPreviousIndex() { 1795 return that._active === 0 ? (that._elements["item"].length - 1) : that._active - 1; 1796 } 1797 1798 /** 1799 * Navigates to the item at the provided index 1800 * 1801 * @private 1802 * @param {Number} index The index of the item to navigate to 1803 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 1804 */ 1805 function navigate(index, keepHash) { 1806 if (index < 0 || index > (that._elements["item"].length - 1)) { 1807 return; 1808 } 1809 1810 that._active = index; 1811 refreshActive(); 1812 1813 if (!keepHash && containerUtils) { 1814 containerUtils.updateUrlHash(that, "item", index); 1815 } 1816 1817 if (dataLayerEnabled) { 1818 var carouselId = that._elements.self.id; 1819 var activeItem = getDataLayerId(that._elements.item[index]); 1820 var updatePayload = { component: {} }; 1821 updatePayload.component[carouselId] = { shownItems: [activeItem] }; 1822 1823 var removePayload = { component: {} }; 1824 removePayload.component[carouselId] = { shownItems: undefined }; 1825 1826 dataLayer.push(removePayload); 1827 dataLayer.push(updatePayload); 1828 } 1829 1830 // reset the autoplay transition interval following navigation, if not already hovering the carousel
1831 if (that._elements.self.parentElement) { 1832 if (that._elements.self.parentElement.querySelector(":hover") !== that._elements.self) { 1833 resetAutoplayInterval(); 1834 } 1835 } 1836 } 1837 1838 /** 1839 * Navigates to the item at the provided index and ensures the active indicator gains focus 1840 * 1841 * @private 1842 * @param {Number} index The index of the item to navigate to 1843 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 1844 */ 1845 function navigateAndFocusIndicator(index, keepHash) { 1846 navigate(index, keepHash); 1847 focusWithoutScroll(that._elements["indicator"][index]); 1848 1849 if (dataLayerEnabled) { 1850 dataLayer.push({ 1851 event: "cmp:show", 1852 eventInfo: { 1853 path: "component." + getDataLayerId(that._elements.item[index]) 1854 } 1855 }); 1856 } 1857 } 1858 1859 /** 1860 * Starts/resets automatic slide transition interval 1861 * 1862 * @private 1863 */ 1864 function resetAutoplayInterval() { 1865 if (that._paused || !that._properties.autoplay) { 1866 return; 1867 } 1868 clearAutoplayInterval(); 1869 that._autoplayIntervalId = window.setInterval(function() { 1870 if (document.visibilityState && document.hidden) { 1871 return; 1872 } 1873 var indicators = that._elements["indicators"]; 1874 if (indicators !== document.activeElement && indicators.contains(document.activeElement)) { 1875 // if an indicator has focus, ensure we switch focus following navigation 1876 navigateAndFocusIndicator(getNextIndex(), true); 1877 } else { 1878 navigate(getNextIndex(), true); 1879 } 1880 }, that._properties.delay); 1881 } 1882 1883 /** 1884 * Clears/pauses automatic slide transition interval 1885 * 1886 * @private 1887 */ 1888 function clearAutoplayInterval() { 1889 window.clearInterval(that._autoplayIntervalId); 1890 that._autoplayIntervalId = null; 1891 } 1892 1893 /** 1894 * Sets the disabled state for an action and toggles the appropriate CSS classes 1895 * 1896 * @private 1897 * @param {HTMLElement} action Action to disable 1898 * @param {Boolean} [disable] {@code true} to disable, {@code false} to enable 1899 */ 1900 function setActionDisabled(action, disable) { 1901 if (!action) { 1902 return; 1903 } 1904 if (disable !== false) { 1905 action.disabled = true; 1906 action.classList.add("cmp-carousel__action--disabled"); 1907 } else { 1908 action.disabled = false; 1909 action.classList.remove("cmp-carousel__action--disabled"); 1910 } 1911 } 1912 } 1913 1914 /** 1915 * Parses the dataLayer string and returns the ID 1916 * 1917 * @private 1918 * @param {HTMLElement} item the accordion item 1919 * @returns {String} dataLayerId or undefined 1920 */ 1921 function getDataLayerId(item) { 1922 if (item) { 1923 if (item.dataset.cmpDataLayer) { 1924 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 1925 } else { 1926 return item.id; 1927 } 1928 } 1929 return null; 1930 } 1931 1932 /** 1933 * Document ready handler and DOM mutation observers. Initializes Carousel components as necessary. 1934 * 1935 * @private 1936 */ 1937 function onDocumentReady() { 1938 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 1939 if (dataLayerEnabled) { 1940 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 1941 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 1942 } 1943 1944 var elements = document.querySelectorAll(selectors.self); 1945 for (var i = 0; i < elements.length; i++) { 1946 new Carousel({ element: elements[i], options: CMP.utils.readData(elements[i], IS) }); 1947 } 1948 1949 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 1950 var body = document.querySelector("body"); 1951 var observer = new MutationObserver(function(mutations) { 1952 mutations.forEach(function(mutation) { 1953 // needed for IE 1954 var nodesArray = [].slice.call(mutation.addedNodes); 1955 if (nodesArray.length > 0) { 1956 nodesArray.forEach(function(addedNode) { 1957 if (addedNode.querySelectorAll) { 1958 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 1959 elementsArray.forEach(function(element) { 1960 new Carousel({ element: element, options: CMP.utils.readData(element, IS) }); 1961 }); 1962 } 1963 }); 1964 } 1965 }); 1966 }); 1967 1968 observer.observe(body, { 1969 subtree: true, 1970 childList: true, 1971 characterData: true 1972 }); 1973 } 1974 1975 var documentReady = document.readyState !== "loading" ? Promise.resolve() : new Promise(function(resolve) { 1976 document.addEventListener("DOMContentLoaded", resolve); 1977 }); 1978 Promise.all([documentReady]).then(onDocumentReady); 1979 1980 if (containerUtils) { 1981 window.addEventListener("load", containerUtils.scrollToAnchor, false); 1982 } 1983 1984}()); 1985 1986 1987/******************************************************************************* 1988 * Copyright 2022 Adobe 1989 * 1990 * Licensed under the Apache License, Version 2.0 (the "License");
1991 * you may not use this file except in compliance with the License. 1992 * You may obtain a copy of the License at 1993 * 1994 * http://www.apache.org/licenses/LICENSE-2.0 1995 * 1996 * Unless required by applicable law or agreed to in writing, software 1997 * distributed under the License is distributed on an "AS IS" BASIS, 1998 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1999 * See the License for the specific language governing permissions and 2000 * limitations under the License. 2001 ******************************************************************************/ 2002(function(document) { 2003 "use strict"; 2004 2005 window.CMP = window.CMP || {}; 2006 window.CMP.utils = (function() { 2007 var NS = "cmp"; 2008 2009 /** 2010 * Reads options data from the Component wrapper element, defined via {@code data-cmp-*} data attributes 2011 * 2012 * @param {HTMLElement} element The component element to read options data from 2013 * @param {String} is The component identifier 2014 * @returns {String[]} The options read from the component data attributes 2015 */ 2016 var readData = function(element, is) { 2017 var data = element.dataset; 2018 var options = []; 2019 var capitalized = is; 2020 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2021 var reserved = ["is", "hook" + capitalized]; 2022 2023 for (var key in data) { 2024 if (Object.prototype.hasOwnProperty.call(data, key)) { 2025 var value = data[key]; 2026 2027 if (key.indexOf(NS) === 0) { 2028 key = key.slice(NS.length); 2029 key = key.charAt(0).toLowerCase() + key.substring(1); 2030 2031 if (reserved.indexOf(key) === -1) { 2032 options[key] = value; 2033 } 2034 } 2035 } 2036 } 2037 return options; 2038 }; 2039 2040 /** 2041 * Set up the final properties of a component by evaluating the transform function or fall back to the default value on demand 2042 * @param {String[]} options the options to transform 2043 * @param {Object} properties object of properties of property functions 2044 * @returns {Object} transformed properties 2045 */ 2046 var setupProperties = function(options, properties) { 2047 var transformedProperties = {}; 2048 2049 for (var key in properties) { 2050 if (Object.prototype.hasOwnProperty.call(properties, key)) { 2051 var property = properties[key]; 2052 if (options && options[key] != null) { 2053 if (property && typeof property.transform === "function") { 2054 transformedProperties[key] = property.transform(options[key]); 2055 } else { 2056 transformedProperties[key] = options[key]; 2057 } 2058 } else { 2059 transformedProperties[key] = properties[key]["default"]; 2060 } 2061 } 2062 } 2063 return transformedProperties; 2064 }; 2065 2066 2067 return { 2068 readData: readData, 2069 setupProperties: setupProperties 2070 }; 2071 }()); 2072}(window.document)); 2073 2074/******************************************************************************* 2075 * Copyright 2022 Adobe 2076 * 2077 * Licensed under the Apache License, Version 2.0 (the "License"); 2078 * you may not use this file except in compliance with the License. 2079 * You may obtain a copy of the License at 2080 * 2081 * http://www.apache.org/licenses/LICENSE-2.0 2082 * 2083 * Unless required by applicable law or agreed to in writing, software 2084 * distributed under the License is distributed on an "AS IS" BASIS, 2085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2086 * See the License for the specific language governing permissions and 2087 * limitations under the License. 2088 ******************************************************************************/ 2089(function(document) { 2090 "use strict"; 2091 2092 window.CMP = window.CMP || {}; 2093 window.CMP.image = window.CMP.image || {}; 2094 window.CMP.image.dynamicMedia = (function() { 2095 var autoSmartCrops = {}; 2096 var SRC_URI_TEMPLATE_WIDTH_VAR = "{.width}"; 2097 var SRC_URI_TEMPLATE_DPR_VAR = "{dpr}";
2098 var SRC_URI_DPR_OFF = "dpr=off"; 2099 var SRC_URI_DPR_ON = "dpr=on,{dpr}"; 2100 var dpr = window.devicePixelRatio || 1; 2101 var config = { 2102 minWidth: 20 2103 }; 2104 2105 /** 2106 * get auto smart crops from dm 2107 * @param {String} src the src uri 2108 * @returns {{}} the smart crop json object 2109 */ 2110 var getAutoSmartCrops = function(src) { 2111 var request = new XMLHttpRequest(); 2112 var url = src.split(SRC_URI_TEMPLATE_WIDTH_VAR)[0] + "?req=set,json"; 2113 request.open("GET", url, false); 2114 request.onload = function() { 2115 if (request.status >= 200 && request.status < 400) { 2116 // success status 2117 var responseText = request.responseText; 2118 var rePayload = new RegExp(/^(?:\/\*jsonp\*\/)?\s*([^()]+)\(([\s\S]+),\s*"[0-9]*"\);?$/gmi); 2119 var rePayloadJSON = new RegExp(/^{[\s\S]*}$/gmi); 2120 var resPayload = rePayload.exec(responseText); 2121 var payload; 2122 if (resPayload) { 2123 var payloadStr = resPayload[2]; 2124 if (rePayloadJSON.test(payloadStr)) { 2125 payload = JSON.parse(payloadStr); 2126 } 2127 2128 } 2129 // check "relation" - only in case of smartcrop preset 2130 if (payload && payload.set.relation && payload.set.relation.length > 0) { 2131 for (var i = 0; i < payload.set.relation.length; i++) { 2132 autoSmartCrops[parseInt(payload.set.relation[i].userdata.SmartCropWidth)] = 2133 ":" + payload.set.relation[i].userdata.SmartCropDef; 2134 } 2135 } 2136 } else { 2137 // error status 2138 } 2139 }; 2140 request.send(); 2141 return autoSmartCrops; 2142 }; 2143 2144 /** 2145 * Build and return the srcset value based on the available auto smart crops 2146 * @param {String} src the src uri 2147 * @param {Object} smartCrops the smart crops object 2148 * @returns {String} the srcset 2149 */ 2150 var getSrcSet = function(src, smartCrops) { 2151 var srcset; 2152 var keys = Object.keys(smartCrops); 2153 if (keys.length > 0) { 2154 srcset = []; 2155 for (var key in autoSmartCrops) { 2156 srcset.push(src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, smartCrops[key]) + " " + key + "w"); 2157 } 2158 } 2159 return srcset.join(","); 2160 }; 2161 2162 /** 2163 * Get the optimal width based on the available sizes 2164 * @param {[Number]} sizes the available sizes 2165 * @param {Number} width the element width 2166 * @returns {String} the optimal width 2167 */ 2168 function getOptimalWidth(sizes, width) { 2169 var len = sizes.length; 2170 var key = 0; 2171 2172 while ((key < len - 1) && (sizes[key] < width)) { 2173 key++; 2174 } 2175 2176 return sizes[key] !== undefined ? sizes[key].toString() : width; 2177 } 2178 2179 /** 2180 * Get the width of an element or parent element if the width is smaller than the minimum width 2181 * @param {HTMLElement} component the image component 2182 * @param {HTMLElement | Node} parent the parent element 2183 * @returns {Number} the width of the element 2184 */ 2185 var getWidth = function(component, parent) { 2186 var width = component.offsetWidth; 2187 while (width < config.minWidth && parent && !component._autoWidth) { 2188 width = parent.offsetWidth; 2189 parent = parent.parentNode; 2190 } 2191 return width; 2192 }; 2193 2194 /** 2195 * Set the src and srcset attribute for a Dynamic Media Image which auto smart crops enabled. 2196 * @param {HTMLElement} component the image component 2197 * @param {{}} properties the component properties 2198 */ 2199 var setDMAttributes = function(component, properties) { 2200 // for v3 we first have to turn the dpr on
2201 var src = properties.src.replace(SRC_URI_DPR_OFF, SRC_URI_DPR_ON); 2202 src = src.replace(SRC_URI_TEMPLATE_DPR_VAR, dpr); 2203 var smartCrops = {}; 2204 var width; 2205 if (properties["smartcroprendition"] === "SmartCrop:Auto") { 2206 smartCrops = getAutoSmartCrops(src); 2207 } 2208 var hasWidths = (properties.widths && properties.widths.length > 0) || Object.keys(smartCrops).length > 0; 2209 if (hasWidths) { 2210 var image = component.querySelector("img"); 2211 var elemWidth = getWidth(component, component.parentNode); 2212 if (properties["smartcroprendition"] === "SmartCrop:Auto") { 2213 image.setAttribute("srcset", CMP.image.dynamicMedia.getSrcSet(src, smartCrops)); 2214 width = getOptimalWidth(Object.keys(smartCrops, elemWidth)); 2215 image.setAttribute("src", CMP.image.dynamicMedia.getSrc(src, smartCrops[width])); 2216 } else { 2217 width = getOptimalWidth(properties.widths, elemWidth); 2218 image.setAttribute("src", CMP.image.dynamicMedia.getSrc(src, width)); 2219 } 2220 } 2221 }; 2222 2223 /** 2224 * Get the src attribute based on the optimal width 2225 * @param {String} src the src uri 2226 * @param {String} width the element width 2227 * @returns {String} the final src attribute 2228 */ 2229 var getSrc = function(src, width) { 2230 if (src.indexOf(SRC_URI_TEMPLATE_WIDTH_VAR) > -1) { 2231 src = src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, width); 2232 } 2233 return src; 2234 }; 2235 2236 2237 return { 2238 getAutoSmartCrops: getAutoSmartCrops, 2239 getSrcSet: getSrcSet, 2240 getSrc: getSrc, 2241 setDMAttributes: setDMAttributes, 2242 getWidth: getWidth 2243 }; 2244 }()); 2245 document.dispatchEvent(new CustomEvent("core.wcm.components.commons.site.image.dynamic-media.loaded")); 2246}(window.document)); 2247 2248/******************************************************************************* 2249 * Copyright 2022 Adobe 2250 * 2251 * Licensed under the Apache License, Version 2.0 (the "License"); 2252 * you may not use this file except in compliance with the License. 2253 * You may obtain a copy of the License at 2254 * 2255 * http://www.apache.org/licenses/LICENSE-2.0 2256 * 2257 * Unless required by applicable law or agreed to in writing, software 2258 * distributed under the License is distributed on an "AS IS" BASIS, 2259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2260 * See the License for the specific language governing permissions and 2261 * limitations under the License. 2262 ******************************************************************************/ 2263(function(document) { 2264 2265 "use strict"; 2266 2267 window.CMP = window.CMP || {}; 2268 window.CMP.image = window.CMP.image || {}; 2269 window.CMP.image.v3 = (function() { 2270 var IS = "image"; 2271 2272 var selectors = { 2273 self: "[data-cmp-hook-image='imageV3']" 2274 }; 2275 2276 var properties = { 2277 "widths": { 2278 "default": [], 2279 "transform": function(value) { 2280 var widths = []; 2281 value.split(",").forEach(function(item) { 2282 item = parseFloat(item); 2283 if (!isNaN(item)) { 2284 widths.push(item); 2285 } 2286 }); 2287 return widths; 2288 } 2289 }, 2290 "dmimage": { 2291 "default": false, 2292 "transform": function(value) { 2293 return !(value === null || typeof value === "undefined"); 2294 } 2295 }, 2296 "src": { 2297 "transform": function(value) { 2298 return decodeURIComponent(value); 2299 } 2300 }, 2301 "smartcroprendition": "" 2302 }; 2303 2304 function Image(config) { 2305 var that = this; 2306 /** 2307 * Init the image if the image is from dynamic media 2308 * @param {HTMLElement} component the image component 2309 */ 2310 that.initImage = function(component) { 2311 var options = CMP.utils.readData(component, IS); 2312 that._properties = CMP.utils.setupProperties(options, properties); 2313 if (that._properties.dmimage) { 2314 // use encoded src for dynamic media 2315 that._properties.src = options["src"]; 2316 CMP.image.dynamicMedia.setDMAttributes(component, that._properties); 2317 } 2318 }; 2319 that.initImage(config.element); 2320 } 2321 2322 return { 2323 init: function() { 2324 var elements = document.querySelectorAll(selectors.self); 2325 for (var i = 0; i < elements.length; i++) { 2326 new Image({ element: elements[i], options: CMP.utils.readData(elements[i], IS) }); 2327 } 2328 2329 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2330 var body = document.querySelector("body"); 2331 var observer = new MutationObserver(function(mutations) { 2332 mutations.forEach(function(mutation) { 2333 // needed for IE 2334 var nodesArray = [].slice.call(mutation.addedNodes); 2335 if (nodesArray.length > 0) { 2336 nodesArray.forEach(function(addedNode) { 2337 if (addedNode.querySelectorAll) { 2338 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 2339 elementsArray.forEach(function(element) { 2340 new Image({ element: element, options: CMP.utils.readData(element, IS) }); 2341 }); 2342 } 2343 }); 2344 } 2345 }); 2346 }); 2347 2348 observer.observe(body, { 2349 subtree: true, 2350 childList: true, 2351 characterData: true 2352 }); 2353 } 2354 }; 2355 }()); 2356 2357 var documentReady = document.readyState !== "loading" ? Promise.resolve() : new Promise(function(resolve) { 2358 document.addEventListener("DOMContentLoaded", resolve); 2359 }); 2360 Promise.all([documentReady]).then(window.CMP.image.v3.init); 2361}(window.document)); 2362 2363 2364/******************************************************************************* 2365 * Copyright 2017 Adobe 2366 * 2367 * Licensed under the Apache License, Version 2.0 (the "License");
2368 * you may not use this file except in compliance with the License. 2369 * You may obtain a copy of the License at 2370 * 2371 * http://www.apache.org/licenses/LICENSE-2.0 2372 * 2373 * Unless required by applicable law or agreed to in writing, software 2374 * distributed under the License is distributed on an "AS IS" BASIS, 2375 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2376 * See the License for the specific language governing permissions and 2377 * limitations under the License. 2378 ******************************************************************************/ 2379(function() { 2380 "use strict"; 2381 2382 var NS = "cmp"; 2383 var IS = "search"; 2384 2385 var DELAY = 300; // time before fetching new results when the user is typing a search string 2386 var LOADING_DISPLAY_DELAY = 300; // minimum time during which the loading indicator is displayed 2387 var PARAM_RESULTS_OFFSET = "resultsOffset"; 2388 2389 var keyCodes = { 2390 TAB: 9, 2391 ENTER: 13, 2392 ESCAPE: 27, 2393 ARROW_UP: 38, 2394 ARROW_DOWN: 40 2395 }; 2396 2397 var selectors = { 2398 self: "[data-" + NS + '-is="' + IS + '"]', 2399 item: { 2400 self: "[data-" + NS + "-hook-" + IS + '="item"]', 2401 title: "[data-" + NS + "-hook-" + IS + '="itemTitle"]', 2402 focused: "." + NS + "-search__item--is-focused" 2403 } 2404 }; 2405 2406 var properties = { 2407 /** 2408 * The minimum required length of the search term before results are fetched. 2409 * 2410 * @memberof Search 2411 * @type {Number} 2412 * @default 3 2413 */ 2414 minLength: { 2415 "default": 3, 2416 transform: function(value) { 2417 value = parseFloat(value); 2418 return isNaN(value) ? null : value; 2419 } 2420 }, 2421 /** 2422 * The maximal number of results fetched by a search request. 2423 * 2424 * @memberof Search 2425 * @type {Number} 2426 * @default 10 2427 */ 2428 resultsSize: { 2429 "default": 10, 2430 transform: function(value) { 2431 value = parseFloat(value); 2432 return isNaN(value) ? null : value; 2433 } 2434 } 2435 }; 2436 2437 var idCount = 0; 2438 2439 function readData(element) { 2440 var data = element.dataset; 2441 var options = []; 2442 var capitalized = IS; 2443 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2444 var reserved = ["is", "hook" + capitalized]; 2445 2446 for (var key in data) { 2447 if (Object.prototype.hasOwnProperty.call(data, key)) { 2448 var value = data[key]; 2449 2450 if (key.indexOf(NS) === 0) { 2451 key = key.slice(NS.length); 2452 key = key.charAt(0).toLowerCase() + key.substring(1); 2453 2454 if (reserved.indexOf(key) === -1) { 2455 options[key] = value; 2456 } 2457 } 2458 } 2459 } 2460 2461 return options; 2462 } 2463 2464 function toggleShow(element, show) { 2465 if (element) { 2466 if (show !== false) { 2467 element.style.display = "block"; 2468 element.setAttribute("aria-hidden", false); 2469 } else { 2470 element.style.display = "none"; 2471 element.setAttribute("aria-hidden", true); 2472 } 2473 } 2474 } 2475 2476 function serialize(form) { 2477 var query = []; 2478 if (form && form.elements) { 2479 for (var i = 0; i < form.elements.length; i++) { 2480 var node = form.elements[i]; 2481 if (!node.disabled && node.name) { 2482 var param = [node.name, encodeURIComponent(node.value)]; 2483 query.push(param.join("=")); 2484 } 2485 } 2486 } 2487 return query.join("&"); 2488 } 2489 2490 function mark(node, regex) { 2491 if (!node || !regex) { 2492 return; 2493 } 2494 2495 // text nodes 2496 if (node.nodeType === 3) { 2497 var nodeValue = node.nodeValue; 2498 var match = regex.exec(nodeValue); 2499 2500 if (nodeValue && match) { 2501 var element = document.createElement("mark"); 2502 element.className = NS + "-search__item-mark"; 2503 element.appendChild(document.createTextNode(match[0])); 2504 2505 var after = node.splitText(match.index); 2506 after.nodeValue = after.nodeValue.substring(match[0].length); 2507 node.parentNode.insertBefore(element, after); 2508 } 2509 } else if (node.hasChildNodes()) { 2510 for (var i = 0; i < node.childNodes.length; i++) { 2511 // recurse 2512 mark(node.childNodes[i], regex); 2513 } 2514 } 2515 } 2516 2517 function Search(config) { 2518 if (config.element) { 2519 // prevents multiple initialization 2520 config.element.removeAttribute("data-" + NS + "-is"); 2521 } 2522 2523 this._cacheElements(config.element); 2524 this._setupProperties(config.options); 2525 2526 this._action = this._elements.form.getAttribute("action"); 2527 this._resultsOffset = 0; 2528 this._hasMoreResults = true; 2529 2530 this._elements.input.addEventListener("input", this._onInput.bind(this)); 2531 this._elements.input.addEventListener("focus", this._onInput.bind(this)); 2532 this._elements.input.addEventListener("keydown", this._onKeydown.bind(this)); 2533 this._elements.clear.addEventListener("click", this._onClearClick.bind(this)); 2534 document.addEventListener("click", this._onDocumentClick.bind(this)); 2535 this._elements.results.addEventListener("scroll", this._onScroll.bind(this)); 2536 2537 this._makeAccessible(); 2538 } 2539 2540 Search.prototype._displayResults = function() { 2541 if (this._elements.input.value.length === 0) { 2542 toggleShow(this._elements.clear, false); 2543 this._cancelResults(); 2544 } else if (this._elements.input.value.length < this._properties.minLength) { 2545 toggleShow(this._elements.clear, true); 2546 } else { 2547 this._updateResults(); 2548 toggleShow(this._elements.clear, true); 2549 } 2550 }; 2551 2552 Search.prototype._onScroll = function(event) { 2553 // fetch new results when the results to be scrolled down are less than the visible results 2554 if (this._elements.results.scrollTop + 2 * this._elements.results.clientHeight >= this._elements.results.scrollHeight) { 2555 this._resultsOffset += this._properties.resultsSize; 2556 this._displayResults(); 2557 } 2558 }; 2559 2560 Search.prototype._onInput = function(event) { 2561 var self = this; 2562 self._cancelResults(); 2563 // start searching when the search term reaches the minimum length 2564 this._timeout = setTimeout(function() { 2565 self._displayResults(); 2566 }, DELAY); 2567 }; 2568 2569 Search.prototype._onKeydown = function(event) { 2570 var self = this; 2571 2572 switch (event.keyCode) { 2573 case keyCodes.TAB: 2574 if (self._resultsOpen()) { 2575 toggleShow(self._elements.results, false); 2576 self._elements.input.setAttribute("aria-expanded", "false"); 2577 } 2578 break;
2579 case keyCodes.ENTER: 2580 event.preventDefault(); 2581 if (self._resultsOpen()) { 2582 var focused = self._elements.results.querySelector(selectors.item.focused); 2583 if (focused) { 2584 focused.click(); 2585 } 2586 } 2587 break; 2588 case keyCodes.ESCAPE: 2589 self._cancelResults(); 2590 break; 2591 case keyCodes.ARROW_UP: 2592 if (self._resultsOpen()) { 2593 event.preventDefault(); 2594 self._stepResultFocus(true); 2595 } 2596 break; 2597 case keyCodes.ARROW_DOWN: 2598 if (self._resultsOpen()) { 2599 event.preventDefault(); 2600 self._stepResultFocus(); 2601 } else { 2602 // test the input and if necessary fetch and display the results 2603 self._onInput(); 2604 } 2605 break; 2606 default: 2607 return; 2608 } 2609 }; 2610 2611 Search.prototype._onClearClick = function(event) { 2612 event.preventDefault(); 2613 this._elements.input.value = ""; 2614 toggleShow(this._elements.clear, false); 2615 toggleShow(this._elements.results, false); 2616 this._elements.input.setAttribute("aria-expanded", "false"); 2617 }; 2618 2619 Search.prototype._onDocumentClick = function(event) { 2620 var inputContainsTarget = this._elements.input.contains(event.target); 2621 var resultsContainTarget = this._elements.results.contains(event.target); 2622 2623 if (!(inputContainsTarget || resultsContainTarget)) { 2624 toggleShow(this._elements.results, false); 2625 this._elements.input.setAttribute("aria-expanded", "false"); 2626 } 2627 }; 2628 2629 Search.prototype._resultsOpen = function() { 2630 return this._elements.results.style.display !== "none"; 2631 }; 2632 2633 Search.prototype._makeAccessible = function() { 2634 var id = NS + "-search-results-" + idCount; 2635 this._elements.input.setAttribute("aria-owns", id); 2636 this._elements.results.id = id; 2637 idCount++; 2638 }; 2639 2640 Search.prototype._generateItems = function(data, results) { 2641 var self = this; 2642 2643 data.forEach(function(item) { 2644 var el = document.createElement("span"); 2645 el.innerHTML = self._elements.itemTemplate.innerHTML; 2646 el.querySelectorAll(selectors.item.title)[0].appendChild(document.createTextNode(item.title)); 2647 el.querySelectorAll(selectors.item.self)[0].setAttribute("href", self._safeHref(item.url)); 2648 results.innerHTML += el.innerHTML; 2649 }); 2650 }; 2651 2652 Search.prototype._safeHref = function(href) { 2653 var a = document.createElement("a"); 2654 a.href = href; 2655 return a.pathname; 2656 }; 2657 2658 Search.prototype._markResults = function() { 2659 var nodeList = this._elements.results.querySelectorAll(selectors.item.self); 2660 var escapedTerm = this._elements.input.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 2661 var regex = new RegExp("(" + escapedTerm + ")", "gi"); 2662 2663 for (var i = this._resultsOffset - 1; i < nodeList.length; ++i) { 2664 var result = nodeList[i]; 2665 mark(result, regex); 2666 } 2667 }; 2668 2669 Search.prototype._stepResultFocus = function(reverse) { 2670 var results = this._elements.results.querySelectorAll(selectors.item.self); 2671 var focused = this._elements.results.querySelector(selectors.item.focused); 2672 var newFocused; 2673 var index = Array.prototype.indexOf.call(results, focused); 2674 var focusedCssClass = NS + "-search__item--is-focused"; 2675 2676 if (results.length > 0) { 2677 2678 if (!reverse) { 2679 // highlight the next result 2680 if (index < 0) { 2681 results[0].classList.add(focusedCssClass); 2682 results[0].setAttribute("aria-selected", "true"); 2683 } else if (index + 1 < results.length) { 2684 results[index].classList.remove(focusedCssClass); 2685 results[index].setAttribute("aria-selected", "false"); 2686 results[index + 1].classList.add(focusedCssClass); 2687 results[index + 1].setAttribute("aria-selected", "true"); 2688 } 2689 2690 // if the last visible result is partially hidden, scroll up until it's completely visible 2691 newFocused = this._elements.results.querySelector(selectors.item.focused); 2692 if (newFocused) { 2693 var bottomHiddenHeight = newFocused.offsetTop + newFocused.offsetHeight - this._elements.results.scrollTop - this._elements.results.clientHeight; 2694 if (bottomHiddenHeight > 0) { 2695 this._elements.results.scrollTop += bottomHiddenHeight; 2696 } else { 2697 this._onScroll(); 2698 } 2699 } 2700 2701 } else { 2702 // highlight the previous result 2703 if (index >= 1) { 2704 results[index].classList.remove(focusedCssClass); 2705 results[index].setAttribute("aria-selected", "false"); 2706 results[index - 1].classList.add(focusedCssClass); 2707 results[index - 1].setAttribute("aria-selected", "true"); 2708 } 2709 2710 // if the first visible result is partially hidden, scroll down until it's completely visible 2711 newFocused = this._elements.results.querySelector(selectors.item.focused); 2712 if (newFocused) { 2713 var topHiddenHeight = this._elements.results.scrollTop - newFocused.offsetTop; 2714 if (topHiddenHeight > 0) { 2715 this._elements.results.scrollTop -= topHiddenHeight; 2716 } 2717 } 2718 } 2719 } 2720 }; 2721 2722 Search.prototype._updateResults = function() { 2723 var self = this; 2724 if (self._hasMoreResults) { 2725 var request = new XMLHttpRequest(); 2726 var url = self._action + "?" + serialize(self._elements.form) + "&" + PARAM_RESULTS_OFFSET + "=" + self._resultsOffset; 2727 2728 request.open("GET", url, true); 2729 request.onload = function() { 2730 // when the results are loaded: hide the loading indicator and display the search icon after a minimum period 2731 setTimeout(function() { 2732 toggleShow(self._elements.loadingIndicator, false); 2733 toggleShow(self._elements.icon, true); 2734 }, LOADING_DISPLAY_DELAY); 2735 if (request.status >= 200 && request.status < 400) { 2736 // success status 2737 var data = JSON.parse(request.responseText); 2738 if (data.length > 0) { 2739 self._generateItems(data, self._elements.results); 2740 self._markResults(); 2741 toggleShow(self._elements.results, true); 2742 self._elements.input.setAttribute("aria-expanded", "true"); 2743 } else { 2744 self._hasMoreResults = false;
2745 } 2746 // the total number of results is not a multiple of the fetched results: 2747 // -> we reached the end of the query 2748 if (self._elements.results.querySelectorAll(selectors.item.self).length % self._properties.resultsSize > 0) { 2749 self._hasMoreResults = false; 2750 } 2751 } else { 2752 // error status 2753 } 2754 }; 2755 // when the results are loading: display the loading indicator and hide the search icon 2756 toggleShow(self._elements.loadingIndicator, true); 2757 toggleShow(self._elements.icon, false); 2758 request.send(); 2759 } 2760 }; 2761 2762 Search.prototype._cancelResults = function() { 2763 clearTimeout(this._timeout); 2764 this._elements.results.scrollTop = 0; 2765 this._resultsOffset = 0; 2766 this._hasMoreResults = true; 2767 this._elements.results.innerHTML = ""; 2768 this._elements.input.setAttribute("aria-expanded", "false"); 2769 }; 2770 2771 Search.prototype._cacheElements = function(wrapper) { 2772 this._elements = {}; 2773 this._elements.self = wrapper; 2774 var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 2775 2776 for (var i = 0; i < hooks.length; i++) { 2777 var hook = hooks[i]; 2778 var capitalized = IS; 2779 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2780 var key = hook.dataset[NS + "Hook" + capitalized]; 2781 this._elements[key] = hook; 2782 } 2783 }; 2784 2785 Search.prototype._setupProperties = function(options) { 2786 this._properties = {}; 2787 2788 for (var key in properties) { 2789 if (Object.prototype.hasOwnProperty.call(properties, key)) { 2790 var property = properties[key]; 2791 if (options && options[key] != null) { 2792 if (property && typeof property.transform === "function") { 2793 this._properties[key] = property.transform(options[key]); 2794 } else { 2795 this._properties[key] = options[key]; 2796 } 2797 } else { 2798 this._properties[key] = properties[key]["default"]; 2799 } 2800 } 2801 } 2802 }; 2803 2804 function onDocumentReady() { 2805 var elements = document.querySelectorAll(selectors.self); 2806 for (var i = 0; i < elements.length; i++) { 2807 new Search({ element: elements[i], options: readData(elements[i]) }); 2808 } 2809 2810 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2811 var body = document.querySelector("body"); 2812 var observer = new MutationObserver(function(mutations) { 2813 mutations.forEach(function(mutation) { 2814 // needed for IE 2815 var nodesArray = [].slice.call(mutation.addedNodes); 2816 if (nodesArray.length > 0) { 2817 nodesArray.forEach(function(addedNode) { 2818 if (addedNode.querySelectorAll) { 2819 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 2820 elementsArray.forEach(function(element) { 2821 new Search({ element: element, options: readData(element) }); 2822 }); 2823 } 2824 }); 2825 } 2826 }); 2827 }); 2828 2829 observer.observe(body, { 2830 subtree: true, 2831 childList: true, 2832 characterData: true 2833 }); 2834 } 2835 2836 if (document.readyState !== "loading") { 2837 onDocumentReady(); 2838 } else { 2839 document.addEventListener("DOMContentLoaded", onDocumentReady); 2840 } 2841 2842})(); 2843 2844 2845/******************************************************************************* 2846 * Copyright 2016 Adobe 2847 * 2848 * Licensed under the Apache License, Version 2.0 (the "License"); 2849 * you may not use this file except in compliance with the License. 2850 * You may obtain a copy of the License at 2851 * 2852 * http://www.apache.org/licenses/LICENSE-2.0 2853 * 2854 * Unless required by applicable law or agreed to in writing, softw
2854are 2855 * distributed under the License is distributed on an "AS IS" BASIS, 2856 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2857 * See the License for the specific language governing permissions and 2858 * limitations under the License. 2859 ******************************************************************************/ 2860(function() { 2861 "use strict"; 2862 2863 var NS = "cmp"; 2864 var IS = "formText"; 2865 var IS_DASH = "form-text"; 2866 var SELF_SELECTOR = "[data-" + NS + '-is="' + IS + '"]'; 2867 2868 var selectors = { 2869 self: SELF_SELECTOR, 2870 validationMessage: SELF_SELECTOR + " .cmp-form-text__validation-message" 2871 }; 2872 2873 var displayValidationMessage = false; 2874 2875 var properties = { 2876 /** 2877 * A validation message to display if there is a type mismatch between the user input and expected input. 2878 * 2879 * @type {String} 2880 */ 2881 constraintMessage: "", 2882 /** 2883 * A validation message to display if no input is supplied, but input is expected for the field. 2884 * 2885 * @type {String} 2886 */ 2887 requiredMessage: "" 2888 }; 2889 2890 function readData(element) { 2891 var data = element.dataset; 2892 var options = []; 2893 var capitalized = IS; 2894 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2895 var reserved = ["is", "hook" + capitalized]; 2896 2897 for (var key in data) { 2898 if (Object.prototype.hasOwnProperty.call(data, key)) { 2899 var value = data[key]; 2900 2901 if (key.indexOf(NS) === 0) { 2902 key = key.slice(NS.length); 2903 key = key.charAt(0).toLowerCase() + key.substring(1); 2904 2905 if (reserved.indexOf(key) === -1) { 2906 options[key] = value; 2907 } 2908 } 2909 } 2910 } 2911 2912 return options; 2913 } 2914 2915 function FormText(config) { 2916 if (config.element) { 2917 // prevents multiple initialization 2918 config.element.removeAttribute("data-" + NS + "-is"); 2919 } 2920 2921 this._cacheElements(config.element); 2922 this._setupProperties(config.options); 2923 2924 this._elements.input.addEventListener("invalid", this._onInvalid.bind(this)); 2925 this._elements.input.addEventListener("input", this._onInput.bind(this)); 2926 if (displayValidationMessage) { 2927 this._elements.input.checkValidity(); 2928 } 2929 } 2930 2931 FormText.prototype._onInvalid = function(event) { 2932 event.target.setCustomValidity(""); 2933 if (event.target.validity.typeMismatch) { 2934 if (this._properties.constraintMessage) { 2935 event.target.setCustomValidity(this._properties.constraintMessage); 2936 } 2937 } else if (event.target.validity.valueMissing) { 2938 if (this._properties.requiredMessage) { 2939 event.target.setCustomValidity(this._properties.requiredMessage); 2940 } 2941 } 2942 if (displayValidationMessage) { 2943 var validationMessage = event.target.parentElement.querySelector(".cmp-form-text__validation-message"); 2944 if (validationMessage) { 2945 validationMessage.innerText = event.target.validationMessage; 2946 } 2947 } 2948 }; 2949 2950 FormText.prototype._onInput = function(event) { 2951 event.target.setCustomValidity(""); 2952 if (displayValidationMessage) { 2953 event.target.checkValidity(); 2954 } 2955 }; 2956 2957 FormText.prototype._cacheElements = function(wrapper) { 2958 this._elements = {}; 2959 this._elements.self = wrapper; 2960 var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS_DASH + "]"); 2961 for (var i = 0; i < hooks.length; i++) { 2962 var hook = hooks[i]; 2963 var capitalized = IS; 2964 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2965 var key = hook.dataset[NS + "Hook" + capitalized]; 2966 this._elements[key] = hook; 2967 } 2968 }; 2969 2970 FormText.prototype._setupProperties = function(options) { 2971 this._properties = {}; 2972 2973 for (var key in properties) { 2974 if (Object.prototype.hasOwnProperty.call(properties, key)) { 2975 var property = properties[key]; 2976 if (options && options[key] != null) { 2977 if (property && typeof property.transform === "function") { 2978 this._properties[key] = property.transform(options[key]); 2979 } else { 2980 this._properties[key] = options[key]; 2981 } 2982 } else { 2983 this._properties[key] = properties[key]["default"]; 2984 } 2985 } 2986 } 2987 }; 2988 2989 function onDocumentReady() {
2990 var validationMessages = document.querySelectorAll(selectors.validationMessage); 2991 if (validationMessages && validationMessages.length > 0) { 2992 displayValidationMessage = true; 2993 } 2994 2995 var elements = document.querySelectorAll(selectors.self); 2996 for (var i = 0; i < elements.length; i++) { 2997 new FormText({ element: elements[i], options: readData(elements[i]) }); 2998 } 2999 3000 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 3001 var body = document.querySelector("body"); 3002 var observer = new MutationObserver(function(mutations) { 3003 mutations.forEach(function(mutation) { 3004 // needed for IE 3005 var nodesArray = [].slice.call(mutation.addedNodes); 3006 if (nodesArray.length > 0) { 3007 nodesArray.forEach(function(addedNode) { 3008 if (addedNode.querySelectorAll) { 3009 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 3010 elementsArray.forEach(function(element) { 3011 new FormText({ element: element, options: readData(element) }); 3012 }); 3013 } 3014 }); 3015 } 3016 }); 3017 }); 3018 3019 observer.observe(body, { 3020 subtree: true, 3021 childList: true, 3022 characterData: true 3023 }); 3024 } 3025 3026 if (document.readyState !== "loading") { 3027 onDocumentReady(); 3028 } else { 3029 document.addEventListener("DOMContentLoaded", onDocumentReady); 3030 } 3031 3032})(); 3033 3034 3035/******************************************************************************* 3036 * Copyright 2020 Adobe 3037 * 3038 * Licensed under the Apache License, Version 2.0 (the "License"); 3039 * you may not use this file except in compliance with the License. 3040 * You may obtain a copy of the License at 3041 * 3042 * http://www.apache.org/licenses/LICENSE2.0 3043 * 3044 * Unless required by applicable law or agreed to in writing, software 3045 * distributed under the License is distributed on an "AS IS" BASIS, 3046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3047 * See the License for the specific language governing permissions and 3048 * limitations under the License. 3049 ******************************************************************************/ 3050 3051/** 3052 * Element.matches() 3053 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 3054 */ 3055if (!Element.prototype.matches) { 3056 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 3057} 3058 3059// eslint-disable-next-line valid-jsdoc 3060/** 3061 * Element.closest() 3062 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 3063 */ 3064if (!Element.prototype.closest) { 3065 Element.prototype.closest = function(s) { 3066 "use strict"; 3067 var el = this; 3068 if (!document.documentElement.contains(el)) { 3069 return null; 3070 } 3071 do { 3072 if (el.matches(s)) { 3073 return el; 3074 } 3075 el = el.parentElement || el.parentNode; 3076 } while (el !== null && el.nodeType === 1); 3077 return null; 3078 }; 3079} 3080 3081// https://tc39.github.io/ecma262/#sec-array.prototype.find 3082if (!Array.prototype.find) { 3083 Object.defineProperty(Array.prototype, "find", { 3084 value: function(predicate) { 3085 "use strict"; 3086 // 1. Let O be ? ToObject(this value). 3087 if (this == null) { 3088 throw TypeError('"this" is null or not defined'); 3089 } 3090 3091 var o = Object(this); 3092 3093 // 2. Let len be ? ToLength(? Get(O, "length")). 3094 var len = o.length >>> 0; 3095 3096 // 3. If IsCallable(predicate) is false, throw a TypeError exception. 3097 if (typeof predicate !== "function") { 3098 throw TypeError("predicate must be a function"); 3099 } 3100 3101 // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. 3102 var thisArg = arguments[1]; 3103 3104 // 5. Let k be 0. 3105 var k = 0; 3106 3107 // 6. Repeat, while k < len 3108 while (k < len) { 3109 // a. Let Pk be ! ToString(k). 3110 // b. Let kValue be ? Get(O, Pk). 3111 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). 3112 // d. If testResult is true, return kValue. 3113 var kValue = o[k]; 3114 if (predicate.call(thisArg, kValue, k, o)) { 3115 return kValue; 3116 } 3117 // e. Increase k by 1. 3118 k++; 3119 } 3120 3121 // 7. Return undefined. 3122 return undefined; 3123 }, 3124 configurable: true, 3125 writable: true 3126 }); 3127} 3128 3129"use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to de
3129structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _createForOfIteratorHelper(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=_unsupportedIterableToArray(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,i=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){i=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function a(i,u,c){function f(e,t){if(!u[e]){if(!i[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(s)return s(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=u[e]={exports:{}};i[e][0].call(o.exports,function(t){return f(i[e][1][t]||t)},o,o.exports,a,i,u,c)}return u[e].exports}for(var s="function"==typeof require&&require,t=0;t<c.length;t++)f(c[t]);return f}({1:[function(t,wn,En){(function(On){(function(){function n(t,e){for(var n=-1,r=null==t?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a}function a(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function f(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function b(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function o(t,e,n){var r=t.length;for(n+=-1;++n<r;)if(e(t[n],n,t))return n;return-1}function i(t){return t!=t}function t(e){return function(t){return e(t)}}function h(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function e(e){var n=Object;return function(t){return e(n(t))}}function v(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function r(){}function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function s(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function d(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new s;++e<n;)this.add(t[e])}function g(t){this.size=(this.__data__=new c(t)).size}function l(t,e){var n=hn(t),r=!n&&bn(t),o=!n&&!r&&vn(t),a=!n&&!r&&!o&&_n(t);if(n=n||r||o||a){r=t.length;for(var i=String,u=-1,c=Array(r);++u<r;)c[u]=i(u);r=c}else r=[];var f;i=r.length;for(f in t)!e&&!be.call(t,f)||n&&("length"==f||o&&("offset"==f||"parent"==f)||a&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||Q(f,i))||r.push(f);return r}function _(t,e,n){(n===Mt||ft(t[e],n))&&(n!==Mt||e in t)||j(t,e,n)}function y(t,e,n){var r=t[e];be.call(t,e)&&ft(r,n)&&(n!==Mt||e in t)||j(t,e,n)}function p(t,e){for(var n=t.length;n--;)if(ft(t[n][0],e))return n;return-1}function j(t,e,n){"__proto__"==e&&xe?xe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function m(n,r,o,t,e,a){var i,u=1&r,c=2&r,f=4&r;
3129if(o&&(i=e?o(n,t,e,a):o(n)),i!==Mt)return i;if(!bt(n))return n;if(t=hn(n)){if(i=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&be.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(n),!u)return U(n,i)}else{var s=nn(n),l="[object Function]"==s||"[object GeneratorFunction]"==s;if(vn(n))return M(n,u);if("[object Object]"==s||"[object Arguments]"==s||l&&!e){if(i=c||l?{}:Y(n),!u)return c?function(t,e){return P(t,en(t),e)}(n,function(t,e){return t&&P(e,St(e),t)}(i,n)):function(t,e){return P(t,tn(t),e)}(n,function(t,e){return t&&P(e,Lt(e),t)}(i,n))}else{if(!Kt[s])return e?n:{};i=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return z(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return e=n?z(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return C(t,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return(e=new t.constructor(t.source,Ht.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new r;case"[object Symbol]":return qe?Object(qe.call(t)):{}}}(n,s,u)}}if(e=(a=a||new g).get(n))return e;if(a.set(n,i),gn(n))return n.forEach(function(t){i.add(m(t,r,o,t,n,a))}),i;if(dn(n))return n.forEach(function(t,e){i.set(e,m(t,r,o,e,n,a))}),i;c=f?c?B:H:c?St:Lt;var p=t?Mt:c(n);return function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(p||n,function(t,e){p&&(t=n[e=t]),y(i,e,m(t,r,o,e,n,a))}),i}function A(t,e){for(var n=0,r=(e=F(e,t)).length;null!=t&&n<r;)t=t[nt(e[n++])];return n&&n==r?t:Mt}function O(t,e,n){return e=e(t),hn(t)?e:f(e,n(t))}function w(t){if(null==t)t=t===Mt?"[object Undefined]":"[object Null]";else if(Te&&Te in Object(t)){var e=be.call(t,Te),n=t[Te];try{t[Te]=Mt;var r=!0}catch(t){}var o=ve.call(t);r&&(e?t[Te]=n:delete t[Te]),t=o}else t=ve.call(t);return t}function E(t,e){return null!=t&&be.call(t,e)}function L(t,e){return null!=t&&e in Object(t)}function S(t){return ht(t)&&"[object Arguments]"==w(t)}function T(t,e,n,r,o){if(t===e)e=!0;else if(null==t||null==e||!ht(t)&&!ht(e))e=t!=t&&e!=e;else t:{var a,i,u=hn(t),c=hn(e),f="[object Object]"==(a="[object Arguments]"==(a=u?"[object Array]":nn(t))?"[object Object]":a);c="[object Object]"==(i="[object Arguments]"==(i=c?"[object Array]":nn(e))?"[object Object]":i);if((i=a==i)&&vn(t)){if(!vn(e)){e=!1;break t}f=!(u=!0)}if(i&&!f)o=o||new g,e=u||_n(t)?V(t,e,n,r,T,o):function(t,e,n,r,o,a,i){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!a(new me(t),new me(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return ft(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=h;case"[object Set]":if(u=u||v,t.size!=e.size&&!(1&r))break;return(n=i.get(t))?n==e:(r|=2,i.set(t,e),e=V(u(t),u(e),r,o,a,i),i.delete(t),e);case"[object Symbol]":if(qe)return qe.call(t)==qe.call(e)}return!1}(t,e,a,n,r,T,o);else{if(!(1&n)&&(u=f&&be.call(t,"__wrapped__"),a=c&&be.call(e,"__wrapped__"),u||a)){e=T(t=u?t.value():t,e=a?e.value():e,n,r,o=o||new g);break t}if(i)e:if(o=o||new g,u=1&n,a=H(t),c=a.length,i=H(e).length,c==i||u){for(f=c;f--;){var s=a[f];if(!(u?s in e:be.call(e,s))){e=!1;break e}}if((i=o.get(t))&&o.get(e))e=i==e;else{i=!0,o.set(t,e),o.set(e,t);for(var l=u;++f<c;){var p=t[s=a[f]],y=e[s];if(r)var b=u?r(y,p,s,e,t,o):r(p,y,s,t,e,o);if(b===Mt?p!==y&&!T(p,y,n,r,o):!b){i=!1;break}l=l||"constructor"==s}i&&!l&&((n=t.constructor)!=(r=e.constructor)&&"constructor"in t&&"constructor"in e&&!("function"==typeof n&&n instanceof n&&"function"==typeof r&&r instanceof r)&&(i=!1)),o.delete(t),o.delete(e),e=i}}else e=!1;else e=!1}}return e}function x(t){return"function"==typeof t?t:null==t?It:"object"==_typeof(t)?hn(t)?function(n,r){return X(n)&&r==r&&!bt(r)?tt(nt(n),r):function(t){var e=wt(t,n);return e===Mt&&e===r?Et(t,n):T(r,e,3)}}(t[0],t[1]):function(e){var n=function(t){for(var e=Lt(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,o==o&&!bt(o)]}return e}(e);return 1==n.length&&n[0][2]?tt(n[0][0],n[0][1]):function(t){return t===e||function(t,e){var n=e.length,r=n;if(null==t)return!r;for(t=Object(t);n--;){if((o=e[n])[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++n<r;
3129){var o,a=(o=e[n])[0],i=t[a],u=o[1];if(o[2]){if(i===Mt&&!(a in t))return!1}else if(o=new g,void 0!==Mt||!T(u,i,3,void 0,o))return!1}return!0}(t,n)}}(t):Nt(t)}function I(t){if(!Z(t))return Ne(t);var e,n=[];for(e in Object(t))be.call(t,e)&&"constructor"!=e&&n.push(e);return n}function k(s,l,p,y,b){s!==l&&Xe(l,function(t,e){if(bt(t)){var n=b=b||new g,r="__proto__"==e?Mt:s[e],o="__proto__"==e?Mt:l[e];if(f=n.get(o))_(s,e,f);else{var a=(f=y?y(r,o,e+"",s,l,n):Mt)===Mt;if(a){var i=hn(o),u=!i&&vn(o),c=!i&&!u&&_n(o),f=o;i||u||c?f=hn(r)?r:lt(r)?U(r):u?M(o,!(a=!1)):c?C(o,!(a=!1)):[]:vt(o)||bn(o)?bn(f=r)?f=At(r):(!bt(r)||p&&pt(r))&&(f=Y(o)):a=!1}a&&(n.set(o,f),k(f,o,p,y,n),n.delete(o)),_(s,e,f)}}else(n=y?y("__proto__"==e?Mt:s[e],t,e+"",s,l,b):Mt)===Mt&&(n=t),_(s,e,n)},St)}function N(t){if("string"==typeof t)return t;if(hn(t))return a(t,N)+"";if(gt(t))return Je?Je.call(t):"";var e=t+"";return"0"==e&&1/t==-zt?"-0":e}function D(t,e){var n;if((e=F(e,t)).length<2)n=t;else{var r=0,o=-1,a=-1,i=(n=e).length;for(r<0&&(r=i<-r?0:i+r),(o=i<o?i:o)<0&&(o+=i),i=o<r?0:o-r>>>0,r>>>=0,o=Array(i);++a<i;)o[a]=n[a+r];n=A(t,o)}null==(t=n)||delete t[nt(it(e))]}function F(t,e){return hn(t)?t:X(t,e)?[t]:ln(Ot(t))}function M(t,e){if(e)return t.slice();var n=t.length;n=Ae?Ae(n):new t.constructor(n);return t.copy(n),n}function z(t){var e=new t.constructor(t.byteLength);return new me(e).set(new me(t)),e}function C(t,e){return new t.constructor(e?z(t.buffer):t.buffer,t.byteOffset,t.length)}function U(t,e){var n=-1,r=t.length;for(e=e||Array(r);++n<r;)e[n]=t[n];return e}function P(t,e,n){var r=!n;n=n||{};for(var o=-1,a=e.length;++o<a;){var i=e[o],u=Mt;u===Mt&&(u=t[i]),r?j(n,i,u):y(n,i,u)}return n}function R(f){return function(t){return sn(et(t,void 0,It),t+"")}(function(t,e){var n,r=-1,o=e.length,a=1<o?e[o-1]:Mt,i=2<o?e[2]:Mt;a=3<f.length&&"function"==typeof a?(o--,a):Mt;if(n=i){n=e[0];var u=e[1];if(bt(i)){var c=_typeof(u);n=!!("number"==c?st(i)&&Q(u,i.length):"string"==c&&u in i)&&ft(i[u],n)}else n=!1}for(n&&(a=o<3?Mt:a,o=1),t=Object(t);++r<o;)(i=e[r])&&f(t,i,r,a);return t})}function $(t){return vt(t)?Mt:t}function V(t,e,n,r,o,a){var i=1&n,u=t.length;if(u!=(c=e.length)&&!(i&&u<c))return!1;if((c=a.get(t))&&a.get(e))return c==e;var c=-1,f=!0,s=2&n?new d:Mt;for(a.set(t,e),a.set(e,t);++c<u;){var l=t[c],p=e[c];if(r)var y=i?r(p,l,c,e,t,a):r(l,p,c,t,e,a);if(y!==Mt){if(y)continue;f=!1;break}if(s){if(!b(e,function(t,e){if(!s.has(e)&&(l===t||o(l,t,n,r,a)))return s.push(e)})){f=!1;break}}else if(l!==p&&!o(l,p,n,r,a)){f=!1;break}}return a.delete(t),a.delete(e),f}function H(t){return O(t,Lt,tn)}function B(t){return O(t,St,en)}function W(t,e){var n=(n=r.iteratee||kt)===kt?x:n;return arguments.length?n(t,e):n}function G(t,e){var n=t.__data__,r=_typeof(e);return("string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?n["string"==typeof e?"string":"hash"]:n.map}function q(t,e){var n=null==t?Mt:t[e];return!bt(n)||he&&he in n||!(pt(n)?ge:Gt).test(rt(n))?Mt:n}function J(t,e,n){for(var r=-1,o=(e=F(e,t)).length,a=!1;++r<o;){var i=nt(e[r]);if(!(a=null!=t&&n(t,i)))break;t=t[i]}return a||++r!=o?a:!!(o=null==t?0:t.length)&&yt(o)&&Q(i,o)&&(hn(t)||bn(t))}function Y(t){return"function"!=typeof t.constructor||Z(t)?{}:Ye(Oe(t))}function K(t){return hn(t)||bn(t)||!!(Se&&t&&t[Se])}function Q(t,e){var n=_typeof(t);return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Jt.test(t))&&-1<t&&0==t%1&&t<e}function X(t,e){if(hn(t))return!1;var n=_typeof(t);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!gt(t))||Pt.test(t)||!Ut.test(t)||null!=e&&t in Object(e)}function Z(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||le)}function tt(e,n){return function(t){return null!=t&&t[e]===n&&(n!==Mt||e in Object(t))}}function et(o,a,i){return a=De(a===Mt?o.length-1:a,0),function(){for(var t=arguments,e=-1,n=De(t.length-a,0),r=Array(n);++e<n;)r[e]=t[a+e];for(e=-1,n=Array(a+1);++e<a;)n[e]=t[e];return n[a]=i(r),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(o,this,n)}}function nt(t){if("string"==typeof t||gt(t))return t;var e=t+"";return"0"==e&&1/t==-zt?"-0":e}function rt(t){if(null==t)return"";try{return ye.call(t)}catch(t){}return t+""}function ot(t,e,n){var r=null==t?0:t.length;return r?((n=null==n?0:jt(n))<0&&(n=De(r+n,0)),o(t,W(e,3),n)):-1}function at(t){return null!=t&&t.length?function t(e,n,r,o,a){var i=-1,u=e.length;for(r=r||K,a=a||[];++i<u;){var c=e[i];0<n&&r(c)?1<n?t(c,n-1,r,o,a):f(a,c):o||(a[a.length]=c)}return a}(t,1):[]}function it(t){var e=null==t?0:t.length;return e?t[e-1]:Mt}function ut(r,o){function a(){var t=arguments,e=o?o.apply(this,t):t[0],n=a.cache;return n.has(e)?n.get(e):(t=r.apply(this,t),a.cache=n.set(e,t)||n,t)}if("function"!=typeof r||null!=o&&"function"!=typeof o)throw new TypeError("Expected a function");return a.cache=new(ut.Cache||s),a}function ct(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function ft(t,e){return t===e||t!=t&&e!=e}function st(t){return null!=t&&yt(t.length)&&!pt(t)}function lt(t){return ht(t)&&st(t)}function pt(t){return!!bt(t)&&("[object Function]"==(t=w(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function yt(t){return"number"==typeof t&&-1<t&&0==t%1&&t<=9007199254740991}function bt(t){var e=_typeof(t);return null!=t&&("object"==e||"function"==e)}function ht(t){return null!=t&&"object"==_typeof(t)}function vt(t){return!(!ht(t)||"[object Object]"!=w(t))&&(null===(t=Oe(t))||"function"==typeof(t=be.call(t,"constructor")&&t.constructor)&&t instanceof t&&ye.call(t)==de)}function dt(t){return"string"==typeof t||!hn(t)&&ht(t)&&"[object String]"==w(t)}function gt(t){return"symbol"==_typeof(t)||ht(t)&&"[object Symbol]"==w(t)}function _t(t){return t?(t=mt(t))===zt||t===-zt?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function jt(t){var e=(t=_t(t))%1;return t==t?e?t-e:t:0}function mt(t){if("number"==typeof t)return t;if(gt(t))return Ct;if(bt(t)&&(t=bt(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace($t,"");var e=Wt.test(t);return e||qt.test(t)?Xt(t.slice(2),e?2:8):Bt.test(t)?Ct:+t}function At(t){return P(t,St(t))}function Ot(t){return null==t?"":N(t)}function wt(t,e,n){return(t=null==t?Mt:A(t,e))===Mt?n:t}function Et(t,e){return null!=t&&J(t,e,L)}function Lt(t){return st(t)?l(t):I(t)}function St(t){if(st(t))t=l(t,!0);else if(bt(t)){var e,n=Z(t),r=[];for(e in t)("constructor"!=e||!n&&be.call(t,e))&&r.push(e);t=r}else{if(e=[],null!=t)for(n in Object(t))e.push(n);t=e}return t}function Tt(t){return null==t?[]:function(e,t){return a(t,function(t){return e[t]})}(t,Lt(t))}function xt(t){return function(){return t}}function It(t){return t}function kt(t){return x("function"==typeof t?t:m(t,1))}function Nt(t){return X(t)?function(e){return function(t){return null==t?Mt:t[e]}}(nt(t)):function(e){return function(t){return A(t,e)}}(t)}function Dt(){return[]}function Ft(){return!1}var Mt,zt=1/0,Ct=NaN,Ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$t=/^\s+|\s+$/g,Vt=/\\(\\)?/g,Ht=/\w*$/,Bt=/^[-+]0x[0-9a-f]+$/i,Wt=/^0b[01]+$/i,Gt=/^\[object .+?Constructor\]$/,qt=/^0o[0-7]+$/i,Jt=/^(?:0|[1-9]\d*)$/,Yt={};
3129Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object Boolean]"]=Yt["[object DataView]"]=Yt["[object Date]"]=Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object WeakMap]"]=!1;var Kt={};Kt["[object Arguments]"]=Kt["[object Array]"]=Kt["[object ArrayBuffer]"]=Kt["[object DataView]"]=Kt["[object Boolean]"]=Kt["[object Date]"]=Kt["[object Float32Array]"]=Kt["[object Float64Array]"]=Kt["[object Int8Array]"]=Kt["[object Int16Array]"]=Kt["[object Int32Array]"]=Kt["[object Map]"]=Kt["[object Number]"]=Kt["[object Object]"]=Kt["[object RegExp]"]=Kt["[object Set]"]=Kt["[object String]"]=Kt["[object Symbol]"]=Kt["[object Uint8Array]"]=Kt["[object Uint8ClampedArray]"]=Kt["[object Uint16Array]"]=Kt["[object Uint32Array]"]=!0,Kt["[object Error]"]=Kt["[object Function]"]=Kt["[object WeakMap]"]=!1;var Qt,Xt=parseInt,Zt="object"==_typeof(On)&&On&&On.Object===Object&&On,te="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,ee=Zt||te||Function("return this")(),ne="object"==_typeof(En)&&En&&!En.nodeType&&En,re=ne&&"object"==_typeof(wn)&&wn&&!wn.nodeType&&wn,oe=re&&re.exports===ne,ae=oe&&Zt.process;t:{try{Qt=ae&&ae.binding&&ae.binding("util");break t}catch(t){}Qt=void 0}var ie,ue=Qt&&Qt.isMap,ce=Qt&&Qt.isSet,fe=Qt&&Qt.isTypedArray,se=Array.prototype,le=Object.prototype,pe=ee["__core-js_shared__"],ye=Function.prototype.toString,be=le.hasOwnProperty,he=(ie=/[^.]+$/.exec(pe&&pe.keys&&pe.keys.IE_PROTO||""))?"Symbol(src)_1."+ie:"",ve=le.toString,de=ye.call(Object),ge=RegExp("^"+ye.call(be).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_e=oe?ee.Buffer:Mt,je=ee.Symbol,me=ee.Uint8Array,Ae=_e?_e.a:Mt,Oe=e(Object.getPrototypeOf),we=Object.create,Ee=le.propertyIsEnumerable,Le=se.splice,Se=je?je.isConcatSpreadable:Mt,Te=je?je.toStringTag:Mt,xe=function(){try{var t=q(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ie=Object.getOwnPropertySymbols,ke=_e?_e.isBuffer:Mt,Ne=e(Object.keys),De=Math.max,Fe=Date.now,Me=q(ee,"DataView"),ze=q(ee,"Map"),Ce=q(ee,"Promise"),Ue=q(ee,"Set"),Pe=q(ee,"WeakMap"),Re=q(Object,"create"),$e=rt(Me),Ve=rt(ze),He=rt(Ce),Be=rt(Ue),We=rt(Pe),Ge=je?je.prototype:Mt,qe=Ge?Ge.valueOf:Mt,Je=Ge?Ge.toString:Mt,Ye=function(t){return bt(t)?we?we(t):(Ke.prototype=t,t=new Ke,Ke.prototype=Mt,t):{}};function Ke(){}u.prototype.clear=function(){this.__data__=Re?Re(null):{},this.size=0},u.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},u.prototype.get=function(t){var e=this.__data__;return Re?"__lodash_hash_undefined__"===(t=e[t])?Mt:t:be.call(e,t)?e[t]:Mt},u.prototype.has=function(t){var e=this.__data__;return Re?e[t]!==Mt:be.call(e,t)},u.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Re&&e===Mt?"__lodash_hash_undefined__":e,this},c.prototype.clear=function(){this.__data__=[],this.size=0},c.prototype.delete=function(t){var e=this.__data__;return!((t=p(e,t))<0||(t==e.length-1?e.pop():Le.call(e,t,1),--this.size,0))},c.prototype.get=function(t){var e=this.__data__;return(t=p(e,t))<0?Mt:e[t][1]},c.prototype.has=function(t){return-1<p(this.__data__,t)},c.prototype.set=function(t,e){var n=this.__data__,r=p(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},s.prototype.clear=function(){this.size=0,this.__data__={hash:new u,map:new(ze||c),string:new u}},s.prototype.delete=function(t){return t=G(this,t).delete(t),this.size-=t?1:0,t},s.prototype.get=function(t){return G(this,t).get(t)},s.prototype.has=function(t){return G(this,t).has(t)},s.prototype.set=function(t,e){var n=G(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},d.prototype.add=d.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},d.prototype.has=function(t){return this.__data__.has(t)},g.prototype.clear=function(){this.__data__=new c,this.size=0},g.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},g.prototype.get=function(t){return this.__data__.get(t)},g.prototype.has=function(t){return this.__data__.has(t)},g.prototype.set=function(t,e){var n=this.__data__;if(n instanceof c){var r=n.__data__;if(!ze||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new s(r)}return n.set(t,e),this.size=n.size,this};var Qe=function(t,e){if(null==t)return t;if(!st(t))return function(t,e){return t&&Xe(t,e,Lt)}(t,e);for(var n=t.length,r=-1,o=Object(t);++r<n&&!1!==e(o[r],r,o););return t},Xe=function(t,e,n){for(var r=-1,o=Object(t),a=(n=n(t)).length;a--;){var i=n[++r];if(!1===e(o[i],i,o))break}return t},Ze=xe?function(t,e){return xe(t,"toString",{configurable:!0,enumerable:!1,value:xt(e),writable:!0})}:It,tn=Ie?function(e){return null==e?[]:(e=Object(e),n(Ie(e),function(t){return Ee.call(e,t)}))}:Dt,en=Ie?function(t){for(var e=[];t;)f(e,tn(t)),t=Oe(t);return e}:Dt,nn=w;(Me&&"[object DataView]"!=nn(new Me(new ArrayBuffer(1)))||ze&&"[object Map]"!=nn(new ze)||Ce&&"[object Promise]"!=nn(Ce.resolve())||Ue&&"[object Set]"!=nn(new Ue)||Pe&&"[object WeakMap]"!=nn(new Pe))&&(nn=function(t){var e=w(t);if(t=(t="[object Object]"==e?t.constructor:Mt)?rt(t):"")switch(t){case $e:return"[object DataView]";case Ve:return"[object Map]";case He:return"[object Promise]";case Be:return"[object Set]";case We:return"[object WeakMap]"}return e});var rn,on,an,un,cn,fn,sn=(un=Ze,fn=cn=0,function(){var t=Fe(),e=16-(t-fn);if(fn=t,0<e){if(800<=++cn)return arguments[0]}else cn=0;return un.apply(Mt,arguments)}),ln=(an=(on=ut(on=function(t){var o=[];return 46===t.charCodeAt(0)&&o.push(""),t.replace(Rt,function(t,e,n,r){o.push(n?r.replace(Vt,"$1"):e||t)}),o},function(t){return 500===an.size&&an.clear(),t})).cache,on),pn=(rn=ot,function(t,e,n){var r=Object(t);if(!st(t)){var o=W(e,3);t=Lt(t),e=function(t){return o(r[t],t,r)}}return-1<(e=rn(t,e,n))?r[o?t[e]:e]:Mt});ut.Cache=s;var yn,bn=S(function(){return arguments}())?S:function(t){return ht(t)&&be.call(t,"callee")&&!Ee.call(t,"callee")},hn=Array.isArray,vn=ke||Ft,dn=ue?t(ue):function(t){return ht(t)&&"[object Map]"==nn(t)},gn=ce?t(ce):function(t){return ht(t)&&"[object Set]"==nn(t)}
3129,_n=fe?t(fe):function(t){return ht(t)&&yt(t.length)&&!!Yt[w(t)]},jn=R(function(t,e,n){k(t,e,n)}),mn=R(function(t,e,n,r){k(t,e,n,r)}),An=sn(et(yn=function(e,t){var n={};if(null==e)return n;var r=!1;t=a(t,function(t){return t=F(t,e),r=r||1<t.length,t}),P(e,B(e),n),r&&(n=m(n,7,$));for(var o=t.length;o--;)D(n,t[o]);return n},Mt,at),yn+"");r.constant=xt,r.flatten=at,r.iteratee=kt,r.keys=Lt,r.keysIn=St,r.memoize=ut,r.merge=jn,r.mergeWith=mn,r.negate=ct,r.omit=An,r.property=Nt,r.reject=function(t,e){return(hn(t)?n:function(t,r){var o=[];return Qe(t,function(t,e,n){r(t,e,n)&&o.push(t)}),o})(t,ct(W(e,3)))},r.toPlainObject=At,r.values=Tt,r.cloneDeep=function(t){return m(t,5)},r.cloneDeepWith=function(t,e){return m(t,5,e="function"==typeof e?e:Mt)},r.eq=ft,r.find=pn,r.findIndex=ot,r.get=wt,r.has=function(t,e){return null!=t&&J(t,e,E)},r.hasIn=Et,r.identity=It,r.includes=function(t,e,n,r){if(t=st(t)?t:Tt(t),n=n&&!r?jt(n):0,r=t.length,n<0&&(n=De(r+n,0)),dt(t))t=n<=r&&-1<t.indexOf(e,n);else{if(r=!!r){if(e==e)t:{for(n-=1,r=t.length;++n<r;)if(t[n]===e){t=n;break t}t=-1}else t=o(t,i,n);r=-1<t}t=r}return t},r.isArguments=bn,r.isArray=hn,r.isArrayLike=st,r.isArrayLikeObject=lt,r.isBuffer=vn,r.isEmpty=function(t){if(null==t)return!0;if(st(t)&&(hn(t)||"string"==typeof t||"function"==typeof t.splice||vn(t)||_n(t)||bn(t)))return!t.length;var e=nn(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(Z(t))return!I(t).length;for(var n in t)if(be.call(t,n))return!1;return!0},r.isEqual=function(t,e){return T(t,e)},r.isFunction=pt,r.isLength=yt,r.isMap=dn,r.isNull=function(t){return null===t},r.isObject=bt,r.isObjectLike=ht,r.isPlainObject=vt,r.isSet=gn,r.isString=dt,r.isSymbol=gt,r.isTypedArray=_n,r.last=it,r.stubArray=Dt,r.stubFalse=Ft,r.toFinite=_t,r.toInteger=jt,r.toNumber=mt,r.toString=Ot,r.VERSION="4.17.5",re&&((re.exports=r)._=r,ne._=r)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){e.exports={itemType:{DATA:"data",FCTN:"fctn",EVENT:"event",LISTENER_ON:"listenerOn",LISTENER_OFF:"listenerOff"},dataLayerEvent:{CHANGE:"adobeDataLayer:change",EVENT:"adobeDataLayer:event"},listenerScope:{PAST:"past",FUTURE:"future",ALL:"all"}}},{}],3:[function(t,e,n){var r=t("../custom-lodash"),c=t("../version.json").version,l=r.cloneDeep,p=r.get,y=t("./item"),b=t("./listener"),h=t("./listenerManager"),v=t("./constants"),d=t("./utils/customMerge");e.exports=function(t){var f,e=t||{},n=[],r=[],o={},a={getState:function(){return o},getDataLayer:function(){return n}};function i(t){o=d(o,t.data)}function u(t){t.valid?{data:function(t){i(t),f.triggerListeners(t)},fctn:function(t){t.config.call(n,n)},event:function(t){t.data&&i(t),f.triggerListeners(t)},listenerOn:function(t){var e=b(t);switch(e.scope){case v.listenerScope.PAST:var n,r=_createForOfIteratorHelper(c(t));try{for(r.s();!(n=r.n()).done;){var o=n.value;f.triggerListener(e,o)}}catch(t){r.e(t)}finally{r.f()}break;case v.listenerScope.FUTURE:f.register(e);break;case v.listenerScope.ALL:if(f.register(e)){var a,i=_createForOfIteratorHelper(c(t));try{for(i.s();!(a=i.n()).done;){var u=a.value;f.triggerListener(e,u)}}catch(t){i.e(t)}finally{i.f()}}}},listenerOff:function(t){f.unregister(b(t))}}[t.type](t):s(t);function c(t){return 0===n.length||t.index>n.length-1?[]:n.slice(0,t.index).map(function(t){return y(t)})}}function s(t){var e="The following item cannot be handled by the data layer because it does not have a valid format: "+JSON.stringify(t.config);console.error(e)}return function(){Array.isArray(e.dataLayer)||(e.dataLayer=[]);r=e.dataLayer.splice(0,e.dataLayer.length),(n=e.dataLayer).version=c,o={},f=h(a)}(),n.push=function(t){var n=arguments,r=arguments;if(Object.keys(n).forEach(function(t){var e=y(n[t]);switch(e.valid||(s(e),delete r[t]),e.type){case v.itemType.DATA:case v.itemType.EVENT:u(e);break;case v.itemType.FCTN:delete r[t],u(e);break;case v.itemType.LISTENER_ON:case v.itemType.LISTENER_OFF:delete r[t]}}),r[0])return Array.prototype.push.apply(this,r)},n.getState=function(t){return t?p(l(o),t):l(o)},n.addEventListener=function(t,e,n){u(y({on:t,handler:e,scope:n&&n.scope,path:n&&n.path}))},n.removeEventListener=function(t,e){u(y({off:t,handler:e}))},function(){for(var t=0;t<r.length;t++)n.push(r[t])}(),a}},{"../custom-lodash":1,"../version.json":14,"./constants":2,"./item":5,"./listener":7,"./listenerManager":8,"./utils/customMerge":10}],4:[function(t,e,n){var r={Manager:t("./dataLayerManager")};window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer.version?console.warn("Adobe Client Data Layer v".concat(window.adobeDataLayer.version," has already been imported/initialized on this page. You may be erroneously loading it a second time.")):r.Manager({dataLayer:window.adobeDataLayer}),e.exports=r},{"./dataLayerManager":3}],5:[function(t,e,n){var r=t("../custom-lodash"),i=r.isPlainObject,u=r.isEmpty,c=r.omit,f=r.find,s=t("./utils/dataMatchesContraints"),l=t("./itemConstraints"),p=t("./constants");e.exports=function(t,e){var n=t,r=e,o=f(Object.keys(l),function(t){return s(n,l[t])})||"function"==typeof n&&p.itemType.FCTN||i(n)&&p.itemType.DATA,a=function(){var t=c(n,Object.keys(l.event));if(!u(t))return t}();return{config:n,type:o,data:a,valid:!!o,index:r}}},{"../custom-lodash":1,"./constants":2,"./itemConstraints":6,"./utils/dataMatchesContraints":11}],6:[function(t,e,n){e.exports={event:{event:{type:"string"},eventInfo:{optional:!0}},listenerOn:{on:{type:"string"},handler:{type:"function"},scope:{type:"string",values:["past","future","all"],optional:!0},path:{type:"string",optional:!0}},listenerOff:{off:{type:"string"},handler:{type:"function",optional:!0},scope:{type:"string",values:["past","future","all"],optional:!0},path:{type:"string",optional:!0}}}},{}],7:[function(t,e,n){var r=t("./constants");e.exports=function(t){return{event:t.config.on||t.config.off,handler:t.config.handler||null,scope:t.config.scope||t.config.on&&r.listenerScope.ALL||null,path:t.config.path||null}}},{"./constants":2}],8:[function(t,e,n){var u=t("../custom-lodash").cloneDeep,c=t("./constants"),f=t("./utils/listenerMatch"),s=t("./utils/indexOfListener");e.exports=function(t){var o={},r=t,a=s.bind(null,o);function i(t,e){if(f(t,e)){var n=[u(e.config)];t.handler.apply(r.getDataLayer(),n)}}return{register:function(t){var e=t.event;return Object.prototype.hasOwnProperty.call(o,e)?-1===a(t)&&(o[t.event].push(t),!0):(o[t.event]=[t],!0)},unregister:function(t){var e=t.event;if(Object.prototype.hasOwnProperty.call(o,e))if(t.handler||t.scope||t.path){var n=a(t);-1<n&&o[e].splice(n,1)}else o[e]=[]},triggerListeners:function(r){(function(t){var e=[];switch(t.type){case c.itemType.DATA:e.push(c.dataLayerEvent.CHANGE);break;case c.itemType.EVENT:e.push(c.dataLayerEvent.EVENT),t.data&&e.push(c.dataLayerEvent.CHANGE),t.config.event!==c.dataLayerEvent.CHANGE&&e.push(t.config.event)}return e})(r).forEach(function(t){if(Object.prototype.hasOwnProperty.call(o,t)){var e,n=_createForOfIteratorHelper(o[t]);try{for(n.s();!(e=n.n()).done;){i(e.value,r)}}catch(t){n.e(t)}finally{n.f()}}})},triggerListener:function(t,e){i(t,e)}}}},{"../custom-lodash":1,"./constants":2,"./utils/indexOfListener":12,"./utils/listenerMatch":13}],9:[function(t,e,n){var r=t("../../custom-lodash"),o=r.has,a=r.get;e.exports=function(t,e){for(var n=e.substring(0,e.lastIndexOf("."));n;){if(o(t,n)){var r=a(t,n);if(null==r)return!0}n=n.substring(0,n.lastIndexOf("."))}return!1}},{"../../custom-lodash":1}],10:[function(t,e,n){var r=t("../../custom-lodash"),s=r.cloneDeepWith,l=r.isObject,p=r.isArray,y=r.reject,o=r.mergeWith,a=r.isNull;e.exports=function(t,e){return o(t,e,function(t,e,n,r){if(null==e)return null}),t=function(t,e){return s(t,function(f){return function e(t,n,r,o){if(l(t)){if(p(t))return y(t,f).map(function(t){return s(t,e)});for(var a={},i=0,u=Object.keys(t);i<u.length;i++){var c=u[i];f(t[c])||(a[c]=s(t[c],e))}return a}}}(1<arguments.length&&void 0!==e?e:function(t){return!t}))}(t,a)}},{"../../custom-lodash":1}],11:[function(t,e,n){var r=t("../../custom-lodash"),o=r.find,s=r.includes;e.exports=function(c,f){return void 0===o(Object.keys(f),function(t){var e=f[t].type,n=t&&f[t].values,r=!f[t].optional,o=c[t],a=_typeof(o),i=e&&a!==e,u=n&&!s(n,o);return r?!o||i||u:o&&(i||u)})}},{"../../custom-lodash":1}],12:[function(t,e,n){var c=t("../../custom-lodash").isEqual;e.exports=function(t,e){var n=e.event;if(Object.prototype.hasOwnProperty.call(t,n)){var r,o=_createForOfIteratorHelper(t[n].entries());try{for(o.s();!(r=o.n()).done;){var a=_slicedToArray(r.value,2),i=a[0],u=a[1];if(c(u.handler,e.handler))return i}}catch(t){o.e(t)}finally{o.f()}}return-1}},{"../../custom-lodash":1}],13:[function(t,e,n){var r=t("../../custom-lodash").has,a=t("../constants"),o=t("./ancestorRemoved");function i(t,e){return!e.data||!t.path||(r(e.data,t.path)||o(e.data,t.path))}
3129e.exports=function(t,e){var n=t.event,r=e.config,o=!1;return e.type===a.itemType.DATA?n===a.dataLayerEvent.CHANGE&&(o=i(t,e)):e.type===a.itemType.EVENT&&(n!==a.dataLayerEvent.EVENT&&n!==r.event||(o=i(t,e)),e.data&&n===a.dataLayerEvent.CHANGE&&(o=i(t,e))),o}},{"../../custom-lodash":1,"../constants":2,"./ancestorRemoved":9}],14:[function(t,e,n){e.exports={version:"2.0.2"}},{}]},{},[4]); 3130//# sourceMappingURL=adobe-client-data-layer.min.js.map 3131 3132/******************************************************************************* 3133 * Copyright 2020 Adobe 3134 * 3135 * Licensed under the Apache License, Version 2.0 (the "License"); 3136 * you may not use this file except in compliance with the License. 3137 * You may obtain a copy of the License at 3138 * 3139 * http://www.apache.org/licenses/LICENSE-2.0 3140 * 3141 * Unless required by applicable law or agreed to in writing, software 3142 * distributed under the License is distributed on an "AS IS" BASIS, 3143 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3144 * See the License for the specific language governing permissions and 3145 * limitations under the License. 3146 ******************************************************************************/ 3147(function() { 3148 "use strict"; 3149 3150 var dataLayerEnabled; 3151 var dataLayerName; 3152 var dataLayer; 3153 3154 function addComponentToDataLayer(component) { 3155 dataLayer.push({ 3156 component: getComponentObject(component) 3157 }); 3158 } 3159 3160 function attachClickEventListener(element) { 3161 element.addEventListener("click", addClickToDataLayer); 3162 } 3163 3164 function getComponentObject(element) { 3165 var component = getComponentData(element); 3166 var componentID = Object.keys(component)[0]; 3167 // if the component does not have a parent ID property, use the ID of the parent element 3168 if (component && component[componentID] && !component[componentID].parentId) { 3169 var parentElement = element.parentNode.closest("[data-cmp-data-layer], body"); 3170 if (parentElement) { 3171 component[componentID].parentId = parentElement.id; 3172 } 3173 } 3174 3175 return component; 3176 } 3177 3178 function addClickToDataLayer(event) { 3179 var element = event.currentTarget; 3180 var componentId = getClickId(element); 3181 3182 dataLayer.push({ 3183 event: "cmp:click", 3184 eventInfo: { 3185 path: "component." + componentId 3186 } 3187 }); 3188 } 3189 3190 function getComponentData(element) { 3191 var dataLayerJson = element.dataset.cmpDataLayer; 3192 if (dataLayerJson) { 3193 return JSON.parse(dataLayerJson); 3194 } else { 3195 return undefined; 3196 } 3197 } 3198 3199 function getClickId(element) { 3200 if (element.dataset.cmpDataLayer) { 3201 return Object.keys(JSON.parse(element.dataset.cmpDataLayer))[0]; 3202 } 3203 3204 var componentElement = element.closest("[data-cmp-data-layer]"); 3205 3206 return Object.keys(JSON.parse(componentElement.dataset.cmpDataLayer))[0]; 3207 } 3208 3209 function onDocumentReady() { 3210 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 3211 if (dataLayerEnabled) { 3212 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 3213 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 3214 3215 var components = document.querySelectorAll("[data-cmp-data-layer]"); 3216 var clickableElements = document.querySelectorAll("[data-cmp-clickable]"); 3217 3218 components.forEach(function(component) { 3219 addComponentToDataLayer(component); 3220 }); 3221 3222 clickableElements.forEach(function(element) { 3223 attachClickEventListener(element); 3224 }); 3225 3226 dataLayer.push({ 3227 event: "cmp:loaded" 3228 }); 3229 } 3230 } 3231 3232 if (document.readyState !== "loading") { 3233 onDocumentReady(); 3234 } else { 3235 document.addEventListener("DOMContentLoaded", onDocumentReady); 3236 } 3237 3238}()); 3239 3240 3241$(window).on("ready", function() { 3242 3243 var keyName = "NBNAllowedPages"; 3244 var currentPageUrl = $("#terms_").data("currentpage"); 3245 var previousPageUrl = $("#terms_").data("ctaredirect"); 3246 3247 if (!previousPageUrl || previousPageUrl === "") { 3248 return false;
3249 } 3250 3251 3252 3253 if (!isPageAllowed(currentPageUrl)) { 3254 window.location.href = `${previousPageUrl}?terms-error=true`; 3255 } 3256 3257 3258 3259 function isPageAllowed(url) { 3260 var isAllowed = true; 3261 console.log(localStorage[keyName]); 3262 if (!localStorage[keyName] || !JSON.parse(localStorage[keyName])[url]) { 3263 return false; 3264 } 3265 return isAllowed; 3266 } 3267 3268}); 3269 3270 3271$(document).ready(function () { 3272 var $tables = $(".cm-text-sticky-header table") 3273 3274 $tables.each(function () { 3275 var $table = $(this); 3276 var $th = $table.find('th[scope="col"]'); 3277 $(window).scroll(function () { 3278 var headerHeight=nbnco.constants.megaNavStickyTopOffset; 3279 if ($(window).width() < 992) { 3280 headerHeight=nbnco.constants.stickyNavTopOffsetMobile; 3281 } 3282 var tableEnd = $table.outerHeight() + $table.offset().top - headerHeight; 3283 var captionHeight = $table.find("caption").outerHeight(); 3284 if ( 3285 $(this).scrollTop() - captionHeight > 3286 $table.offset().top - headerHeight && 3287 $(this).scrollTop() - captionHeight < tableEnd 3288 ) { 3289 var translateY = 3290 $(this).scrollTop() - 3291 $table.offset().top - 3292 captionHeight + 3293 headerHeight; 3294 } else { 3295 var translateY = 0; 3296 } 3297 $th.css("transform", "translateY(" + translateY + "px)"); 3298 3299 }); 3300 }); 3301}); 3302 3303 3304$(document).ready(function() { 3305 3306 $(document).on("click", "a[data-cya-action='clearCookie']", function(e) { 3307 CheckAddressCookie.clear(); 3308 if (!$(this).attr('href') || $(this).attr('href') === '#'||$(this).attr('href') === 'javascript:void(0)') { 3309 e.preventDefault(); 3310 window.location.reload(); 3311 } 3312 }); 3313 3314 $(document).on("click", ".cta-button--rsp a", function(e) { 3315 $('.rsp-with-filters-content').show(); 3316 NBNUI.hashLinkHandler.scrollToElement('.rsp-with-filters-content'); 3317 }); 3318 3319 $(document).on("click", "a[data-drawer-action='true']", function(e) { 3320 e.preventDefault(); 3321 var drawerPath = $(this).attr('href'); 3322 if (drawerPath) { 3323 drawerPath = drawerPath.replace(/\s+/g, ''); 3324 if (drawerPath.indexOf('/') != -1) { 3325 drawerPath = drawerPath.substring(drawerPath.lastIndexOf("/") + 1); 3326 } 3327 drawerPath = drawerPath.replace(/[^a-zA-Z0-9 ]/g, ''); 3328 nbnco.websiteDrawerInstance.showDescriptionPanel('div[data-drawer-anchor=' + drawerPath + ']'); 3329 } 3330 }); 3331 // Keydown event handlers for Enter key 3332 $(document).on("keydown", "a[data-cya-action='clearCookie']", function(e) { 3333 if (e.key === "Enter") { 3334 e.preventDefault(); 3335 CheckAddressCookie.clear(); 3336 if (!$(this).attr('href') || $(this).attr('href') === '#'||$(this).attr('href') === 'javascript:void(0)') { 3337 window.location.reload(); 3338 }else { 3339 window.location.href = $(this).attr('href'); 3340 } 3341 } 3342 }); 3343 $(document).on("keydown", ".cta-button--rsp a", function(e) { 3344 if (e.key === "Enter") { 3345 e.preventDefault(); 3346 $('.rsp-with-filters-content').show(); 3347 NBNUI.hashLinkHandler.scrollToElement('.rsp-with-filters-content'); 3348 } 3349 }); 3350 $(document).on("keydown", "a[data-drawer-action='true']", function(e) { 3351 if (e.key === "Enter") { 3352 e.preventDefault(); 3353 var drawerPath = $(this).attr('href'); 3354 if (drawerPath) { 3355 drawerPath = drawerPath.replace(/\s+/g, ''); 3356 if (drawerPath.indexOf('/') != -1) { 3357 drawerPath = drawerPath.substring(drawerPath.lastIndexOf("/") + 1); 3358 } 3359 drawerPath = drawerPath.replace(/[^a-zA-Z0-9 ]/g, ''); 3360 nbnco.websiteDrawerInstance.showDescriptionPanel('div[data-drawer-anchor=' + drawerPath + ']'); 3361 } 3362 } 3363 }); 3364 3365}); 3366 3367$(document).ready(function() { 3368 $(".__related_article_mobile").append($(".cmp-related-article").html()) 3369}); 3370!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,document):"function"==typeof define&&define.amd?define([],function(){return t(e,document)}):e.plyr=t(e,document)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(){var e,n,r,a=navigator.userAgent,s=navigator.appName,o=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10),l=!1,u=!1,
3370c=!1,d=!1;return-1!==navigator.appVersion.indexOf("Windows NT")&&-1!==navigator.appVersion.indexOf("rv:11")?(l=!0,s="IE",o="11"):-1!==(n=a.indexOf("MSIE"))?(l=!0,s="IE",o=a.substring(n+5)):-1!==(n=a.indexOf("Chrome"))?(c=!0,s="Chrome",o=a.substring(n+7)):-1!==(n=a.indexOf("Safari"))?(d=!0,s="Safari",o=a.substring(n+7),-1!==(n=a.indexOf("Version"))&&(o=a.substring(n+8))):-1!==(n=a.indexOf("Firefox"))?(u=!0,s="Firefox",o=a.substring(n+8)):(e=a.lastIndexOf(" ")+1)<(n=a.lastIndexOf("/"))&&(s=a.substring(e,n),o=a.substring(n+1),s.toLowerCase()===s.toUpperCase()&&(s=navigator.appName)),-1!==(r=o.indexOf(";"))&&(o=o.substring(0,r)),-1!==(r=o.indexOf(" "))&&(o=o.substring(0,r)),i=parseInt(""+o,10),isNaN(i)&&(o=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10)),{name:s,version:i,isIE:l,isFirefox:u,isChrome:c,isSafari:d,isIos:/(iPad|iPhone|iPod)/g.test(navigator.platform),isIphone:/(iPhone|iPod)/g.test(navigator.userAgent),isTouch:"ontouchstart"in t.documentElement}}function r(e){if(!t.querySelectorAll('script[src="'+e+'"]').length){var n=t.createElement("script");n.src=e;var r=t.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)}}function a(e,t){return Array.prototype.indexOf&&-1!==e.indexOf(t)}function s(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function o(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var r=n>0?t.cloneNode(!0):t,a=e[n],s=a.parentNode,o=a.nextSibling;return r.appendChild(a),o?s.insertBefore(r,o):s.appendChild(r),r}}function i(e){e&&e.parentNode.removeChild(e)}function l(e,t){e.insertBefore(t,e.firstChild)}function u(e,t){for(var n in t)e.setAttribute(n,A.boolean(t[n])&&t[n]?"":t[n])}function c(e,n,r){var a=t.createElement(e);u(a,r),l(n,a)}function d(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=r+(n?" "+t:"")}}function p(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className))}function m(e,n){var r=Element.prototype;return(r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector||function(e){return-1!==[].indexOf.call(t.querySelectorAll(e),this)}).call(e,n)}function f(e,t,n,r,a){n&&b(e,t,function(t){n.apply(e,[t])},a),b(e,t,function(t){r.apply(e,[t])},a)}function y(e,t,n,r,a){var s=t.split(" ");if(A.boolean(a)||(a=!1),e instanceof NodeList)for(var o=0;o<e.length;o++)e[o]instanceof Node&&y(e[o],arguments[1],arguments[2],arguments[3]);else for(var i=0;i<s.length;i++)e[r?"addEventListener":"removeEventListener"](s[i],n,a)}function b(e,t,n,r){e&&y(e,t,n,!0,r)}function v(e,t,n,r){e&&y(e,t,n,!1,r)}function g(e,t,n,r){if(e&&t){A.boolean(n)||(n=!1);var a=new CustomEvent(t,{bubbles:n,detail:r});e.dispatchEvent(a)}}function h(e,t){if(e)return t=A.boolean(t)?t:!e.getAttribute("aria-pressed"),e.setAttribute("aria-pressed",t),t}function k(e,t){return 0===e||0===t||isNaN(e)||isNaN(t)?0:(e/t*100).toFixed(2)}function w(){var e=arguments;if(e.length){if(1===e.length)return e[0];for(var t=Array.prototype.shift.call(e),n=e.length,r=0;r<n;r++){var a=e[r];for(var s in a)a[s]&&a[s].constructor&&a[s].constructor===Object?(t[s]=t[s]||{},w(t[s],a[s])):t[s]=a[s]}return t}}function x(y,x){function N(e,t,n,r){g(e,t,n,w({},r,{plyr:Pe}))}function P(t,n){x.debug&&e.console&&(n=Array.prototype.slice.call(n),A.string(x.logPrefix)&&x.logPrefix.length&&n.unshift(x.logPrefix),console[t].apply(console,n))}function M(){return{url:x.iconUrl,absolute:0===x.iconUrl.indexOf("http")||Me.browser.isIE&&!e.svg4everybody}}function O(){var e=[],t=M(),n=(t.absolute?"":t.url)+"#"+x.iconPrefix;return a(x.controls,"play-large")&&e.push('<button type="button" data-plyr="play" class="plyr__play-large">','<svg><use xlink:href="'+n+'-play" /></svg>','<span class="plyr__sr-only">'+x.i18n.play+"</span>","</button>"),e.push('<div class="plyr__controls">'),a(x.controls,"restart")&&e.push('<button type="button" data-plyr="restart">','<svg><use xlink:href="'+n+'-restart" /></svg>','<span class="plyr__sr-only">'+x.i18n.restart+"</span>","</button>"),a(x.controls,"rewind")&&e.push('<button type="button" data-plyr="rewind">','<svg><use xlink:href="'+n+'-rewind" /></svg>','<span class="plyr__sr-only">'+x.i18n.rewind+"</span>","</button>"),a(x.controls,"play")&&e.push('<button type="button" data-plyr="play">','<svg><use xlink:href="'+n+'-play" /></svg>','<span class="plyr__sr-only">'+x.i18n.play+"</span>","</button>",'<button type="button" data-plyr="pause">','<svg><use xlink:href="'+n+'-pause" /></svg>','<span class="plyr__sr-only">'+x.i18n.pause+"</span>","</button>"),a(x.controls,"fast-forward")&&e.push('<button type="button" data-plyr="fast-forward">','<svg><use xlink:href="'+n+'-fast-forward" /></svg>','<span class="plyr__sr-only">'+x.i18n.forward+"</span>","</button>"),a(x.controls,"progress")&&(e.push('<span class="plyr__progress">','<label for="seek{id}" class="plyr__sr-only">Seek</label>','<input id="seek{id}" class="plyr__progress--seek" type="range" min="0" max="100" step="0.1" value="
33700" data-plyr="seek">','<progress class="plyr__progress--played" max="100" value="0" role="presentation"></progress>','<progress class="plyr__progress--buffer" max="100" value="0">',"<span>0</span>% "+x.i18n.buffered,"</progress>"),x.tooltips.seek&&e.push('<span class="plyr__tooltip">00:00</span>'),e.push("</span>")),a(x.controls,"current-time")&&e.push('<span class="plyr__time">','<span class="plyr__sr-only">'+x.i18n.currentTime+"</span>",'<span class="plyr__time--current">00:00</span>',"</span>"),a(x.controls,"duration")&&e.push('<span class="plyr__time">','<span class="plyr__sr-only">'+x.i18n.duration+"</span>",'<span class="plyr__time--duration">00:00</span>',"</span>"),a(x.controls,"mute")&&e.push('<button type="button" data-plyr="mute">','<svg class="icon--muted"><use xlink:href="'+n+'-muted" /></svg>','<svg><use xlink:href="'+n+'-volume" /></svg>','<span class="plyr__sr-only">'+x.i18n.toggleMute+"</span>","</button>"),a(x.controls,"volume")&&e.push('<span class="plyr__volume">','<label for="volume{id}" class="plyr__sr-only">'+x.i18n.volume+"</label>",'<input id="volume{id}" class="plyr__volume--input" type="range" min="'+x.volumeMin+'" max="'+x.volumeMax+'" value="'+x.volume+'" data-plyr="volume">','<progress class="plyr__volume--display" max="'+x.volumeMax+'" value="'+x.volumeMin+'" role="presentation"></progress>',"</span>"),a(x.controls,"captions")&&e.push('<button type="button" data-plyr="captions">','<svg class="icon--captions-on"><use xlink:href="'+n+'-captions-on" /></svg>','<svg><use xlink:href="'+n+'-captions-off" /></svg>','<span class="plyr__sr-only">'+x.i18n.toggleCaptions+"</span>","</button>"),a(x.controls,"fullscreen")&&e.push('<button type="button" data-plyr="fullscreen">','<svg class="icon--exit-fullscreen"><use xlink:href="'+n+'-exit-fullscreen" /></svg>','<svg><use xlink:href="'+n+'-enter-fullscreen" /></svg>','<span class="plyr__sr-only">'+x.i18n.toggleFullscreen+"</span>","</button>"),e.push("</div>"),e.join("")}function L(){if("video"===Me.type){q(x.selectors.captions)||Me.videoContainer.insertAdjacentHTML("afterbegin",'<div class="'+function(e){return e.replace(".","")}(x.selectors.captions)+'"></div>'),Me.usingTextTracks=!1,Me.media.textTracks&&(Me.usingTextTracks=!0);for(var e,t="",n=Me.media.childNodes,r=0;r<n.length;r++)"track"===n[r].nodeName.toLowerCase()&&("captions"!==(e=n[r].kind)&&"subtitles"!==e||(t=n[r].getAttribute("src")));if(Me.captionExists=!0,""===t?(Me.captionExists=!1,je("No caption track found")):je("Caption track found; URI: "+t),Me.captionExists){for(var a=Me.media.textTracks,s=0;s<a.length;s++)a[s].mode="hidden";if(function(){if(Me.buttons.captions){d(Me.container,x.classes.captions.enabled,!0);var e=Me.storage.captionsEnabled;A.boolean(e)||(e=x.captions.defaultActive),e&&(d(Me.container,x.classes.captions.active,!0),h(Me.buttons.captions,!0))}}(),(Me.browser.isIE&&Me.browser.version>=10||Me.browser.isFirefox&&Me.browser.version>=31)&&(je("Detected browser with known TextTrack issues - using manual fallback"),Me.usingTextTracks=!1),Me.usingTextTracks){je("TextTracks supp
3370orted");for(var o=0;o<a.length;o++){var i=a[o];"captions"!==i.kind&&"subtitles"!==i.kind||b(i,"cuechange",function(){this.activeCues[0]&&"text"in this.activeCues[0]?j(this.activeCues[0].getCueAsHTML()):j()})}}else if(je("TextTracks not supported so rendering captions manually"),Me.currentCaption="",Me.captions=[],""!==t){var l=new XMLHttpRequest;l.onreadystatechange=function(){if(4===l.readyState)if(200===l.status){var e,t,n=l.responseText,r="\r\n";-1===n.indexOf(r+r)&&(r=-1!==n.indexOf("\r\r")?"\r":"\n"),t=n.split(r+r);for(var a=0;a<t.length;a++){e=t[a],Me.captions[a]=[];var s=e.split(r),o=0;-1===s[o].indexOf(":")&&(o=1),Me.captions[a]=[s[o],s[o+1]]}Me.captions.shift(),je("Successfully loaded the caption file via AJAX")}else Re(x.logPrefix+"There was a problem loading the caption file via AJAX")},l.open("get",t,!0),l.send()}}else d(Me.container,x.classes.captions.enabled)}}function j(e){var n=q(x.selectors.captions),r=t.createElement("span");n.innerHTML="",A.undefined(e)&&(e=""),A.string(e)?r.innerHTML=e.trim():r.appendChild(e),n.appendChild(r),n.offsetHeight}function R(e){function t(e,t){var n=[];n=e.split(" --\x3e ");for(var r=0;r<n.length;r++)n[r]=n[r].replace(/(\d+:\d+:\d+\.\d+).*/,"$1");return function(e){if(null==e)return 0;var t=[],n=[];return t=e.split(","),n=t[0].split(":"),Math.floor(60*n[0]*60)+Math.floor(60*n[1])+Math.floor(n[2])}(n[t])}function n(e){return t(e,1)}if(!Me.usingTextTracks&&"video"===Me.type&&Me.supported.full&&(Me.subcount=0,e=A.number(e)?e:Me.media.currentTime,Me.captions[Me.subcount])){for(;n(Me.captions[Me.subcount][0])<e.toFixed(1);)if(Me.subcount++,Me.subcount>Me.captions.length-1){Me.subcount=Me.captions.length-1;break}Me.media.currentTime.toFixed(1)>=function(e){return t(e,0)}(Me.captions[Me.subcount][0])&&Me.media.currentTime.toFixed(1)<=n(Me.captions[Me.subcount][0])?(Me.currentCaption=Me.captions[Me.subcount][1],j(Me.currentCaption)):j()}}function V(e){return Me.container.querySelectorAll(e)}function q(e){return V(e)[0]}function D(){try{return e.self!==e.top}catch(e){return!0}}function H(){var e=V("input:not([disabled]), button:not([disabled])"),t=e[0],n=e[e.length-1];b(Me.container,"keydown",function(e){9===e.which&&Me.isFullscreen&&(e.target!==n||e.shiftKey?e.target===t&&e.shiftKey&&(e.preventDefault(),n.focus()):(e.preventDefault(),t.focus()))})}function U(e,t){if(A.string(t))c(e,Me.media,{src:t});else if(t.constructor===Array)for(var n=t.length-1;n>=0;n--)c(e,Me.media,t[n])}function W(){d(Me.container,x.selectors.container.replace(".",""),Me.supported.full)}function Y(e){e&&a(x.types.html5,Me.type)?Me.media.setAttribute("controls",""):Me.media.removeAttribute("controls")}function B(e){var t=x.i18n.play;if(A.string(x.title)&&x.title.length&&(t+=", "+x.title,Me.container.setAttribute("aria-label",x.title)),Me.supported.full&&Me.buttons.play)for(var n=Me.buttons.play.length-1;n>=0;n--)Me.buttons.play[n].setAttribute("aria-label",t);A.htmlElement(e)&&e.setAttribute("title",x.i18n.frameTitle.replace("{title}",x.title))}function X(){var t=null;Me.storage={},I.supported&&x.storage.enabled&&(e.localStorage.removeItem("plyr-volume"),(t=e.localStorage.getItem(x.storage.key))&&(/^\d+(\.\d+)?$/.test(t)?$({volume:parseFloat(t)}):Me.storage=JSON.parse(t)))}function $(t){I.supported&&x.storage.enabled&&(w(Me.storage,t),e.localStorage.setItem(x.storage.key,JSON.stringify(Me.storage)))}function J(){if(Me.media){if(Me.supported.full&&(d(Me.container,x.classes.type.replace("{0}",Me.type),!0),a(x.types.embed,Me.type)&&d(Me.container,x.classes.type.replace("{0}","video"),!0),d(Me.container,x.classes.stopped,x.autoplay),d(Me.container,x.classes.isIos,Me.browser.isIos),d(Me.container,x.classes.isTouch,Me.browser.isTouch),"video"===Me.type)){var e=t.createElement("div");e.setAttribute("class",x.classes.videoWrapper),o(Me.media,e),Me.videoContainer=e}a(x.types.embed,Me.type)&&z()}else Re("No media element found!")}function z(){var n,a=t.createElement("div"),s=Me.type+"-"+Math.floor(1e4*Math.random());switch(Me.type){case"youtube":n=function(e){return e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/)?RegExp.$2:e}(Me.embedId);break;case"vimeo":n=function(e){return e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}(Me.embedId);break;default:n=Me.embedId}for(var o=V('[id^="'+Me.type+'-"]'),l=o.length-1;l>=0;l--)i(o[l]);if(d(Me.media,x.classes.videoWrapper,!0),d(Me.media,x.classes.embedWrapper,!0),"youtube"===Me.type)Me.media.appendChild(a),a.setAttribute("id",s),A.object(e.YT)?K(n,a):(r(x.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){K(n,a)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===Me.type)if(Me.supported.full?Me.media.appendChild(a):a=Me.media,a.setAttribute("id",s),A.object(e.Vimeo))Q(n,a);else{r(x.urls.vimeo.api);var c=e.setInterval(function(){A.object(e.Vimeo)&&(e.clearInterval(c),Q(n,a))},50)}else if("soundcloud"===Me.type){var p=t.createElement("iframe");p.loaded=!1,b(p,"load",function(){p.loaded=!0}),u(p,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+n,id:s}),a.appendChild(p),Me.media.appendChild(a),e.SC||r(x.urls.soundcloud.api);var m=e.setInterval(function(){e.SC&&p.loaded&&(e.clearInterval(m),Z.call(p))},50)}}function G(){Me.supported.full&&(Ie(),Ne()),B(q("iframe"))}function K(t,n){Me.embed=new e.YT.Player(n.id,{videoId:t,playerVars:{autoplay:x.autoplay?1:0,controls:Me.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:x.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){N(Me.container,"error",!0,{code:e.data,embed:e.target})},onReady:function(t){var n=t.target;Me.media.play=function(){n.playVideo(),Me.media.paused=!1},Me.media.pause=function(){n.pauseVideo(),Me.media.paused=!0},Me.media.stop=function(){n.stopVideo(),Me.media.paused=!0},Me.media.duration=n.getDuration(),Me.media.paused=!0,Me.media.currentTime=0,Me.media.muted=n.isMuted(),"function"==typeof n.getVideoData&&(x.title=n.getVideoData().title),Me.supported.full&&Me.media.querySelector("iframe").setAttribute("tabindex","-1"),G(),N(Me.media,"timeupdate"),N(Me.media,"durationchange"),e.clearInterval(Oe.buffering),Oe.buffering=e.setInterval(function(){Me.media.buffered=n.getVideoLoadedFraction(),(null===Me.media.lastBuffered||Me.media.lastBuffered<Me.media.buffered)&&N(Me.media,"progress"),Me.media.lastBuffered=Me.media.buffered,1===Me.media.buffered&&(e.clearInterval(Oe.buffering),N(Me.media,"canplaythrough"))},200)},onStateChange:function(t){var n=t.target;switch(e.clearInterval(Oe.playing),t.data){case 0:Me.media.paused=!0,N(Me.media,"ended");break;case 1:Me.media.paused=!1,Me.media.seeking&&N(Me.media,"seeked"),Me.media.seeking=!1,N(Me.media,"play"),N(Me.media,"playing"),Oe.playing=e.setInterval(function(){Me.media.currentTime=n.getCurrentTime(),N(Me.media,"timeupdate")},100),Me.media.duration!==n.getDuration()&&(Me.media.duration=n.getDuration(),N(Me.media,"durationchange"));break;case 2:Me.media.paused=!0,N(Me.media,"pause")}N(Me.container,"statechange",!1,{code:t.data})}}})}function Q(n,r){var a=function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}({loop:x.loop,autoplay:x.autoplay,byline:!1,portrait:!1,title:!1,speed:!0,transparent:0}),s=t.createElement("iframe"),o="https://player.vimeo.com/video/"+n+"?"+a;s.setAttribute("src",o),s.setAttribute("allowfullscreen",""),r.appendChild(s),Me.embed=new e.Vimeo.Player(s),Me.media.play=function(){Me.embed.play(),Me.media.paused=!1},Me.media.pause=function(){Me.embed.pause(),Me.media.paused=!0},Me.media.stop=function(){Me.embed.stop(),Me.media.paused=!0},Me.media.paused=!0,Me.media.currentTime=0,G(),Me.embed.getCurrentTime().then(function(e){Me.media.currentTime=e,N(Me.media,"timeupdate")}
3370),Me.embed.getDuration().then(function(e){Me.media.duration=e,N(Me.media,"durationchange")}),Me.embed.on("loaded",function(){A.htmlElement(Me.embed.element)&&Me.supported.full&&Me.embed.element.setAttribute("tabindex","-1")}),Me.embed.on("play",function(){Me.media.paused=!1,N(Me.media,"play"),N(Me.media,"playing")}),Me.embed.on("pause",function(){Me.media.paused=!0,N(Me.media,"pause")}),Me.embed.on("timeupdate",function(e){Me.media.seeking=!1,Me.media.currentTime=e.seconds,N(Me.media,"timeupdate")}),Me.embed.on("progress",function(e){Me.media.buffered=e.percent,N(Me.media,"progress"),1===parseInt(e.percent)&&N(Me.media,"canplaythrough")}),Me.embed.on("seeked",function(){Me.media.seeking=!1,N(Me.media,"seeked"),N(Me.media,"play")}),Me.embed.on("ended",function(){Me.media.paused=!0,N(Me.media,"ended")})}function Z(){Me.embed=e.SC.Widget(this),Me.embed.bind(e.SC.Widget.Events.READY,function(){Me.media.play=function(){Me.embed.play(),Me.media.paused=!1},Me.media.pause=function(){Me.embed.pause(),Me.media.paused=!0},Me.media.stop=function(){Me.embed.seekTo(0),Me.embed.pause(),Me.media.paused=!0},Me.media.paused=!0,Me.media.currentTime=0,Me.embed.getDuration(function(e){Me.media.duration=e/1e3,G()}),Me.embed.getPosition(function(e){Me.media.currentTime=e,N(Me.media,"timeupdate")}),Me.embed.bind(e.SC.Widget.Events.PLAY,function(){Me.media.paused=!1,N(Me.media,"play"),N(Me.media,"playing")}),Me.embed.bind(e.SC.Widget.Events.PAUSE,function(){Me.media.paused=!0,N(Me.media,"pause")}),Me.embed.bind(e.SC.Widget.Events.PLAY_PROGRESS,function(e){Me.media.seeking=!1,Me.media.currentTime=e.currentPosition/1e3,N(Me.media,"timeupdate")}),Me.embed.bind(e.SC.Widget.Events.LOAD_PROGRESS,function(e){Me.media.buffered=e.loadProgress,N(Me.media,"progress"),1===parseInt(e.loadProgress)&&N(Me.media,"canplaythrough")}),Me.embed.bind(e.SC.Widget.Events.FINISH,function(){Me.media.paused=!0,N(Me.media,"ended")})})}function ee(){"play"in Me.media&&Me.media.play()}function te(){"pause"in Me.media&&Me.media.pause()}function ne(e){return A.boolean(e)||(e=Me.media.paused),e?ee():te(),e}function re(e){A.number(e)||(e=x.seekTime),se(Me.media.currentTime-e)}function ae(e){A.number(e)||(e=x.seekTime),se(Me.media.currentTime+e)}function se(e){var t=0,n=Me.media.paused,r=oe();A.number(e)?t=e:A.object(e)&&a(["input","change"],e.type)&&(t=e.target.value/e.target.max*r),t<0?t=0:t>r&&(t=r),Te(t);try{Me.media.currentTime=t.toFixed(4)}catch(e){}if(a(x.types.embed,Me.type)){switch(Me.type){case"youtube":Me.embed.seekTo(t);break;case"vimeo":Me.embed.setCurrentTime(t.toFixed(0));break;case"soundcloud":Me.embed.seekTo(1e3*t)}n&&te(),N(Me.media,"timeupdate"),Me.media.seeking=!0,N(Me.media,"seeking")}je("Seeking to "+Me.media.currentTime+" seconds"),R(t)}function oe(){var e=parseInt(x.duration),t=0;return null===Me.media.duration||isNaN(Me.media.duration)||(t=Me.media.duration),isNaN(e)?t:e}function ie(){d(Me.container,x.classes.playing,!Me.media.paused),d(Me.container,x.classes.stopped,Me.media.paused),Ee(Me.media.paused)}function le(){C={x:e.pageXOffset||0,y:e.pageYOffset||0}}function ue(){e.scrollTo(C.x,C.y)}function ce(e){var n=_.supportsFullScreen;if(n){if(!e||e.type!==_.fullScreenEventName)return _.isFullScreen(Me.container)?_.cancelFullScreen():(le(),_.requestFullScreen(Me.container)),void(Me.isFullscreen=_.isFullScreen(Me.container));Me.isFullscreen=_.isFullScreen(Me.container)}else Me.isFullscreen=!Me.isFullscreen,t.body.style.overflow=Me.isFullscreen?"hidden":"";d(Me.container,x.classes.fullscreen.active,Me.isFullscreen),H(Me.isFullscreen),Me.buttons&&Me.buttons.fullscreen&&h(Me.buttons.fullscreen,Me.isFullscreen),N(Me.container,Me.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!Me.isFullscreen&&n&&ue()}function de(e){if(A.boolean(e)||(e=!Me.media.muted),h(Me.buttons.mute,e),Me.media.muted=e,0===Me.media.volume&&pe(x.volume),a(x.types.embed,Me.type)){switch(Me.type){case"youtube":Me.embed[Me.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":Me.embed.setVolume(Me.media.muted?0:parseFloat(x.volume/x.volumeMax))}N(Me.media,"volumechange")}}function pe(e){var t=x.volumeMax,n=x.volumeMin;if(A.undefined(e)&&(e=Me.storage.volume),(null===e||isNaN(e))&&(e=x.volume),e>t&&(e=t),e<n&&(e=n),Me.media.volume=parseFloat(e/t),Me.volume.display&&(Me.volume.display.value=e),a(x.types.embed,Me.type)){switch(Me.type){case"youtube":Me.embed.setVolume(100*Me.media.volume);break;case"vimeo":case"soundcloud":Me.embed.setVolume(Me.media.volume)}N(Me.media,"volumechange")}0===e?Me.media.muted=!0:Me.media.muted&&e>0&&de()}function me(e){var t=Me.media.muted?0:Me.media.volume*x.volumeMax;A.number(e)||(e=x.volumeStep),pe(t+e)}function fe(e){var t=Me.media.muted?0:Me.media.volume*x.volumeMax;A.number(e)||(e=x.volumeStep),pe(t-e)}function ye(){var e=Me.media.muted?0:Me.media.volume*x.volumeMax;Me.supported.full&&(Me.volume.input&&(Me.volume.input.value=e),Me.volume.display&&(Me.volume.display.value=e)),$({volume:e}),d(Me.container,x.classes.muted,0===e),Me.supported.full&&Me.buttons.mute&&h(Me.buttons.mute,0===e)}function be(e){Me.supported.full&&Me.buttons.captions&&(A.boolean(e)||(e=-1===Me.container.className.indexOf(x.classes.captions.active)),Me.captionsEnabled=e,h(Me.buttons.captions,Me.captionsEnabled),d(Me.container,x.classes.captions.active,Me.captionsEnabled),N(Me.container,Me.captionsEnabled?"captionsenabled":"captionsdisabled",!0),$({captionsEnabled:Me.captionsEnabled}))}function ve(e){var t="waiting"===e.type;clearTimeout(Oe.loading),Oe.loading=setTimeout(function(){d(Me.container,x.classes.loading,t),Ee(t)},t?250:0)}function ge(e){if(Me.supported.full){var t=Me.progress.played,n=0,r=oe();if(e)switch(e.type){case"timeupdate":case"seeking":if(Me.controls.pressed)return;n=k(Me.media.currentTime,r),"timeupdate"===e.type&&Me.buttons.seek&&(Me.buttons.seek.value=n);break;case"playing":case"progress":t=Me.progress.buffer,n=function(){var e=Me.media.buffered;return e&&e.length?k(e.end(0),r):A.number(e)?100*e:0}()}he(t,n)}}function he(e,t){if(Me.supported.full){if(A.undefined(t)&&(t=0),A.undefined(e)){if(!Me.progress||!Me.progress.buffer)return;e=Me.progress.buffer}A.htmlElement(e)?e.value=t:e&&(e.bar&&(e.bar.value=t),e.text&&(e.text.innerHTML=t))}}function ke(e,t){if(t){isNaN(e)&&(e=0),Me.secs=parseInt(e%60),Me.mins=parseInt(e/60%60),Me.hours=parseInt(e/60/60%60);var n=parseInt(oe()/60/60%60)>0;Me.secs=("0"+Me.secs).slice(-2),Me.mins=("0"+Me.mins).slice(-2),t.innerHTML=(n?Me.hours+":":"")+Me.mins+":"+Me.secs}}function we(){if(Me.supported.full){var e=oe()||0;!Me.duration&&x.displayDuration&&Me.media.paused&&ke(e,Me.currentTime),Me.duration&&ke(e,Me.duration),Se()}}function xe(e){ke(Me.media.currentTime,Me.currentTime),e&&"timeupdate"===e.type&&Me.media.seeking||ge(e)}function Te(e){A.number(e)||(e=0);
3370var t=k(e,oe());Me.progress&&Me.progress.played&&(Me.progress.played.value=t),Me.buttons&&Me.buttons.seek&&(Me.buttons.seek.value=t)}function Se(e){var t=oe();if(x.tooltips.seek&&Me.progress.container&&0!==t){var n=Me.progress.container.getBoundingClientRect(),r=0,s=x.classes.tooltip+"--visible";if(e)r=100/n.width*(e.pageX-n.left);else{if(!p(Me.progress.tooltip,s))return;r=Me.progress.tooltip.style.left.replace("%","")}r<0?r=0:r>100&&(r=100),ke(t/100*r,Me.progress.tooltip),Me.progress.tooltip.style.left=r+"%",e&&a(["mouseenter","mouseleave"],e.type)&&d(Me.progress.tooltip,s,"mouseenter"===e.type)}}function Ee(t){if(x.hideControls&&"audio"!==Me.type){var n=0,r=!1,s=t,o=p(Me.container,x.classes.loading);if(A.boolean(t)||(t&&t.type?(r="enterfullscreen"===t.type,s=a(["mousemove","touchstart","mouseenter","focus"],t.type),a(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=p(Me.container,x.classes.hideControls)),e.clearTimeout(Oe.hover),s||Me.media.paused||o){if(d(Me.container,x.classes.hideControls,!1),Me.media.paused||o)return;Me.browser.isTouch&&(n=3e3)}s&&Me.media.paused||(Oe.hover=e.setTimeout(function(){(!Me.controls.pressed&&!Me.controls.hover||r)&&d(Me.container,x.classes.hideControls,!0)},n))}}function _e(e){A.object(e)&&"sources"in e&&e.sources.length?(d(Me.container,x.classes.ready,!1),te(),Te(),he(),function(){if(a(x.types.html5,Me.type)){for(var e=Me.media.querySelectorAll("source"),t=0;t<e.length;t++)i(e[t]);Me.media.setAttribute("src",x.blankUrl),Me.media.load(),je("Cancelled network requests")}}(),Ae(function(){if(Me.embed=null,i(Me.media),"video"===Me.type&&Me.videoContainer&&i(Me.videoContainer),Me.container&&Me.container.removeAttribute("class"),"type"in e&&(Me.type=e.type,"video"===Me.type)){var n=e.sources[0];"type"in n&&a(x.types.embed,n.type)&&(Me.type=n.type)}switch(Me.supported=S(Me.type),Me.type){case"video":Me.media=t.createElement("video");break;case"audio":Me.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":Me.media=t.createElement("div"),Me.embedId=e.sources[0].src}l(Me.container,Me.media),A.boolean(e.autoplay)&&(x.autoplay=e.autoplay),a(x.types.html5,Me.type)&&(x.crossorigin&&Me.media.setAttribute("crossorigin",""),x.autoplay&&Me.media.setAttribute("autoplay",""),"poster"in e&&Me.media.setAttribute("poster",e.poster),x.loop&&Me.media.setAttribute("loop","")),d(Me.container,x.classes.fullscreen.active,Me.isFullscreen),d(Me.container,x.classes.captions.active,Me.captionsEnabled),W(),a(x.types.html5,Me.type)&&U("source",e.sources),J(),a(x.types.html5,Me.type)&&("tracks"in e&&U("track",e.tracks),Me.media.load()),(a(x.types.html5,Me.type)||a(x.types.embed,Me.type)&&!Me.supported.full)&&(Ie(),Ne()),x.title=e.title,B()},!1)):Re("Invalid source format")}function Ce(){d(q("."+x.classes.tabFocus),x.classes.tabFocus,!1)}function Fe(){function n(){var e=ne(),t=Me.buttons[e?"play":"pause"],n=Me.buttons[e?"pause":"play"];if(n&&(n=n.length>1?n[n.length-1]:n[0]),n){var r=p(t,x.classes.tabFocus);setTimeout(function(){n.focus(),r&&(d(t,x.classes.tabFocus,!1),d(n,x.classes.tabFocus,!0))},100)}}function r(){var e=t.activeElement;return e&&e!==t.body?t.querySelector(":focus"):null}function s(e){return e.keyCode?e.keyCode:e.which}function o(e){var t=s(e),n="keydown"===e.type,r=n&&t===l;if(A.number(t))if(n){switch(a([48,49,50,51,52,53,54,56,57,32,75,38,40,77,39,37,70,67],t)&&(e.preventDefault(),e.stopPropagation()),t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:r||function(){var e=Me.media.duration;A.number(e)&&se(e/10*(t-48))}();break;case 32:case 75:r||ne();break;case 38:me();break;case 40:fe();break;case 77:r||de();break;case 39:ae();break;case 37:re();break;case 70:ce();break;case 67:r||be()}!_.supportsFullScreen&&Me.isFullscreen&&27===t&&ce(),l=t}else l=null}var i=Me.browser.isIE?"change":"input";if(x.keyboardShorcuts.focused){var l=null;x.keyboardShorcuts.global&&b(e,"keydown keyup",function(e){var t=s(e),n=r();1!==E().length||!a([48,49,50,51,52,53,54,56,57,75,77,70,67],t)||A.htmlElement(n)&&m(n,x.selectors.editable)||o(e)}),b(Me.container,"keydown keyup",o)}for(var u in b(e,"keyup",function(e){var t=s(e),n=r();9===t&&function(e){for(var t in Me.buttons){var n=Me.buttons[t];if(A.nodeList(n))for(var r=0;r<n.length;r++)d(n[r],x.classes.tabFocus,n[r]===e);else d(n,x.classes.tabFocus,n===e)}}(n)}),b(t.body,"click",Ce),Me.buttons){var c=Me.buttons[u];b(c,"blur",function(){d(c,"tab-focus",!1)})}f(Me.buttons.play,"click",x.listeners.play,n),f(Me.buttons.pause,"click",x.listeners.pause,n),f(Me.buttons.restart,"click",x.listeners.restart,se),f(Me.buttons.rewind,"click",x.listeners.rewind,re),f(Me.buttons.forward,"click",x.listeners.forward,ae),f(Me.buttons.seek,i,x.listeners.seek,se),f(Me.volume.input,i,x.listeners.volume,function(){pe(Me.volume.input.value)}),f(Me.buttons.mute,"click",x.listeners.mute,de),f(Me.buttons.fullscreen,"click",x.listeners.fullscreen,ce),_.supportsFullScreen&&b(t,_.fullScreenEventName,ce),f(Me.buttons.captions,"click",x.listeners.captions,be),b(Me.progress.container,"mouseenter mouseleave mousemove",Se),x.hideControls&&(b(Me.container,"mouseenter mouseleave mousemove touchstart touchend touchcancel touchmove enterfullscreen",Ee),b(Me.controls,"mouseenter mouseleave",function(e){Me.controls.hover="mouseenter"
3370===e.type}),b(Me.controls,"mousedown mouseup touchstart touchend touchcancel",function(e){Me.controls.pressed=a(["mousedown","touchstart"],e.type)}),b(Me.controls,"focus blur",Ee,!0)),b(Me.volume.input,"wheel",function(e){e.preventDefault();var t=e.webkitDirectionInvertedFromDevice,n=x.volumeStep/5;(e.deltaY<0||e.deltaX>0)&&(t?fe(n):me(n)),(e.deltaY>0||e.deltaX<0)&&(t?me(n):fe(n))})}function Ae(n,r){function a(){clearTimeout(Oe.cleanUp),A.boolean(r)||(r=!0),A.function(n)&&n.call(Le),r&&(Me.init=!1,Me.container.parentNode.replaceChild(Le,Me.container),Me.container=null,t.body.style.overflow="",v(t.body,"click",Ce),N(Le,"destroyed",!0))}if(!Me.init)return null;switch(Me.type){case"youtube":e.clearInterval(Oe.buffering),e.clearInterval(Oe.playing),Me.embed.destroy(),a();break;case"vimeo":Me.embed.unload().then(a),Oe.cleanUp=e.setTimeout(a,200);break;case"video":case"audio":Y(!0),a()}}function Ie(){if(!Me.supported.full)return Re("Basic support only",Me.type),i(q(x.selectors.controls.wrapper)),i(q(x.selectors.buttons.play)),void Y(!0);var e=!V(x.selectors.controls.wrapper).length;e&&function(){if(x.loadSprite){var e=M();e.absolute?(je("AJAX loading absolute SVG sprite"+(Me.browser.isIE?" (due to IE)":"")),T(e.url,"sprite-plyr")):je("Sprite will be used as external resource directly")}var n,r=x.html;if(je("Injecting custom controls"),r||(r=O()),r=s(r=s(r,"{seektime}",x.seekTime),"{id}",Math.floor(1e4*Math.random())),x.title&&(r=s(r,"{title}",x.title)),A.string(x.selectors.controls.container)&&(n=t.querySelector(x.selectors.controls.container)),A.htmlElement(n)||(n=Me.container),n.insertAdjacentHTML("beforeend",r),x.tooltips.controls)for(var a=V([x.selectors.controls.wrapper," ",x.selectors.labels," .",x.classes.hidden].join("")),o=a.length-1;o>=0;o--){var i=a[o];d(i,x.classes.hidden,!1),d(i,x.classes.tooltip,!0)}}(),function(){try{return Me.controls=q(x.selectors.controls.wrapper),Me.buttons={},Me.buttons.seek=q(x.selectors.buttons.seek),Me.buttons.play=V(x.selectors.buttons.play),Me.buttons.pause=q(x.selectors.buttons.pause),Me.buttons.restart=q(x.selectors.buttons.restart),Me.buttons.rewind=q(x.selectors.buttons.rewind),Me.buttons.forward=q(x.selectors.buttons.forward),Me.buttons.fullscreen=q(x.selectors.buttons.fullscreen),Me.buttons.mute=q(x.selectors.buttons.mute),Me.buttons.captions=q(x.selectors.buttons.captions),Me.progress={},Me.progress.container=q(x.selectors.progress.container),Me.progress.buffer={},Me.progress.buffer.bar=q(x.selectors.progress.buffer),Me.progress.buffer.text=Me.progress.buffer.bar&&Me.progress.buffer.bar.getElementsByTagName("span")[0],Me.progress.played=q(x.selectors.progress.played),Me.progress.tooltip=Me.progress.container&&Me.progress.container.querySelector("."+x.classes.tooltip),Me.volume={},Me.volume.input=q(x.selectors.volume.input),Me.volume.display=q(x.selectors.volume.display),Me.duration=q(x.selectors.duration),Me.currentTime=q(x.selectors.currentTime),Me.seekTime=V(x.selectors.seekTime),!0}catch(e){return Re("It looks like there is a problem with your controls HTML"),Y(!0),!1}}()&&(e&&Fe(),function(){if(b(Me.media,"timeupdate seeking",xe),b(Me.media,"timeupdate",R),b(Me.media,"durationchange loadedmetadata",we),b(Me.media,"ended",function(){"video"===Me.type&&x.showPosterOnEnd&&("video"===Me.type&&j(),se(),Me.media.load())}),b(Me.media,"progress playing",ge),b(Me.media,"volumechange",ye),b(Me.media,"play pause ended",ie),b(Me.media,"waiting canplay seeked",ve),x.clickToPlay&&"audio"!==Me.type){var e=q("."+x.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",b(e,"click",function(){x.hideControls&&Me.browser.isTouch&&!Me.media.paused||(Me.media.paused?ee():Me.media.ended?(se(),ee()):te())})}x.disableContextMenu&&b(Me.media,"contextmenu",function(e){e.preventDefault()}),b(Me.media,x.events.concat(["keyup","keydown"]).join(" "),function(e){N(Me.container,e.type,!0)})}(),Y(),function(){if(Me.supported.full&&("audio"!==Me.type||x.fullscreen.allowAudio)&&x.fullscreen.enabled){var e=_.supportsFullScreen;e||x.fullscreen.fallback&&!D()?(je((e?"Native":"Fallback")+" fullscreen enabled"),e||d(Me.container,x.classes.fullscreen.fallback,!0),d(Me.container,x.classes.fullscreen.enabled,!0)):je("Fullscreen not supported and fallback disabled"),Me.buttons&&Me.buttons.fullscreen&&h(Me.buttons.fullscreen,!1),H()}}(),L(),pe(),ye(),xe(),ie(),we())}function Ne(){e.setTimeout(function(){N(Me.media,"ready")},0),d(Me.media,F.classes.setup,!0),d(Me.container,x.classes.ready,!0),Me.media.plyr=Pe,x.autoplay&&ee()}var Pe,Me=this,Oe={};Me.media=y;var Le=y.cloneNode(!0),je=function(){P("log",arguments)},Re=function(){P("warn",arguments)};return je("Config",x),Pe={getOriginal:function(){return Le},getContainer:function(){return Me.container},getEmbed:function(){return Me.embed},getMedia:function(){return Me.media},getType:function(){return Me.type},getDuration:oe,getCurrentTime:function(){return Me.media.currentTime},getVolume:function(){return Me.media.volume},isMuted:function(){return Me.media.muted},isReady:function(){return p(Me.container,x.classes.ready)},isLoading:function(){return p(Me.container,x.classes.loading)},isPaused:function(){return Me.media.paused},on:function(e,t){return b(Me.container,e,t),this},play:ee,pause:te,stop:function(){te(),se()},restart:se,rewind:re,forward:ae,seek:se,source:function(e){if(A.undefined(e)){var t;switch(Me.type){case"youtube":t=Me.embed.getVideoUrl();break;case"vimeo":Me.embed.getVideoUrl.then(function(e){t=e});break;case"soundcloud":Me.embed.getCurrentSound(function(e){t=e.permalink_url});break;default:t=Me.media.currentSrc}return t||""}_e(e)},poster:function(e){"video"===Me.type&&Me.media.setAttribute("poster",e)},setVolume:pe,togglePlay:ne,toggleMute:de,toggleCaptions:be,toggleFullscreen:ce,toggleControls:Ee,isFullscreen:function(){return Me.isFullscreen||
3370!1},support:function(e){return function(e,t){var n=e.media;if("video"===e.type)switch(t){case"video/webm":return!(!n.canPlayType||!n.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!n.canPlayType||!n.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!n.canPlayType||!n.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if("audio"===e.type)switch(t){case"audio/mpeg":return!(!n.canPlayType||!n.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!n.canPlayType||!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!n.canPlayType||!n.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}(Me,e)},destroy:Ae},function(){if(Me.init)return null;if(_=function(){var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",element:null,prefix:""},n="webkit o moz ms khtml".split(" ");if(A.undefined(t.cancelFullScreen))for(var r=0,a=n.length;r<a;r++){if(e.prefix=n[r],!A.undefined(t[e.prefix+"CancelFullScreen"])){e.supportsFullScreen=!0;break}if(!A.undefined(t.msExitFullscreen)&&t.msFullscreenEnabled){e.prefix="ms",e.supportsFullScreen=!0;break}}else e.supportsFullScreen=!0;return e.supportsFullScreen&&(e.fullScreenEventName="ms"===e.prefix?"MSFullscreenChange":e.prefix+"fullscreenchange",e.isFullScreen=function(e){switch(A.undefined(e)&&(e=t.body),this.prefix){case"":return t.fullscreenElement===e;case"moz":return t.mozFullScreenElement===e;default:return t[this.prefix+"FullscreenElement"]===e}},e.requestFullScreen=function(e){return A.undefined(e)&&(e=t.body),""===this.prefix?e.requestFullScreen():e[this.prefix+("ms"===this.prefix?"RequestFullscreen":"RequestFullScreen")]()},e.cancelFullScreen=function(){return""===this.prefix?t.cancelFullScreen():t[this.prefix+("ms"===this.prefix?"ExitFullscreen":"CancelFullScreen")]()},e.element=function(){return""===this.prefix?t.fullscreenElement:t[this.prefix+"FullscreenElement"]}),e}(),Me.browser=n(),A.htmlElement(Me.media)){X();var e=y.tagName.toLowerCase();"div"===e?(Me.type=y.getAttribute("data-type"),Me.embedId=y.getAttribute("data-video-id"),y.removeAttribute("data-type"),y.removeAttribute("data-video-id")):(Me.type=e,x.crossorigin=null!==y.getAttribute("crossorigin"),x.autoplay=x.autoplay||null!==y.getAttribute("autoplay"),x.loop=x.loop||null!==y.getAttribute("loop")),Me.supported=S(Me.type),Me.supported.basic&&(Me.container=o(y,t.createElement("div")),Me.container.setAttribute("tabindex",0),W(),je(Me.browser.name+" "+Me.browser.version),J(),(a(x.types.html5,Me.type)||a(x.types.embed,Me.type)&&!Me.supported.full)&&(Ie(),Ne(),B()),Me.init=!0)}}(),Me.init?Pe:null}function T(e,n){var r=new XMLHttpRequest;if(!A.string(n)||!A.htmlElement(t.querySelector("#"+n))){var a=t.createElement("div");a.setAttribute("hidden",""),A.string(n)&&a.setAttribute("id",n),t.body.insertBefore(a,t.body.childNodes[0]),"withCredentials"in r&&(r.open("GET",e,!0),r.onload=function(){a.innerHTML=r.responseText},r.send())}}function S(e){var r=n(),a=r.isIE&&r.version<=9,s=r.isIos,o=r.isIphone,i=!!t.createElement("audio").canPlayType,l=!!t.createElement("video").canPlayType,u=!1,c=!1;switch(e){case"video":c=(u=l)&&!a&&!o;break;case"audio":c=(u=i)&&!a;break;case"vimeo":u=!0,c=!a&&!s;break;case"youtube":u=!0,c=!a&&!s,s&&!o&&r.version>=10&&(c=!0);break;case"soundcloud":u=!0,c=!a&&!o;break;default:c=(u=i&&l)&&!a}return{basic:u,full:c}}function E(e){if(A.string(e)?e=t.querySelector(e):A.undefined(e)&&(e=t.body),A.htmlElement(e)){var n=e.querySelectorAll("."+F.classes.setup),r=[];return Array.prototype.slice.call(n).forEach(function(e){A.object(e.plyr)&&r.push(e.plyr)}),r}return[]}var _,C={x:0,y:0},F={enabled:!0,debug:!1,autoplay:!1,loop:!1,seekTime:10,volume:10,volumeMin:0,volumeMax:10,volumeStep:1,duration:null,displayDuration:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/2.0.17/plyr.svg",blankUrl:"https://cdn.plyr.io/static/blank.mp4",clickToPlay:!0,hideControls:!0,showPosterOnEnd:!1,disableContextMenu:!0,keyboardShorcuts:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},selectors:{html5:"video, audio",embed:"[data-type]",editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{seek:'[data-plyr="seek"]',play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',forward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',fullscreen:'[data-plyr="fullscreen"]'},volume:{input:'[data-plyr="volume"]',display:".plyr__volume--display"},progress:{container:".plyr__progress",buffer:".plyr__progress--buffer",played:".plyr__progress--played"},captions:".plyr__captions",currentTime:".plyr__time--current",duration:".plyr__time--duration"},classes:{setup:"plyr--setup",ready:"plyr--ready",videoWrapper:"plyr__video-wrapper",embedWrapper:"plyr__video-embed",type:"plyr--{0}",stopped:"plyr--stopped",playing:"plyr--playing",muted:"plyr--muted",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",hidden:"plyr__sr-only",hideControls:"plyr--hide-control
3370s",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback",active:"plyr--fullscreen-active"},tabFocus:"tab-focus"},captions:{defaultActive:!1},fullscreen:{enabled:!0,fallback:!0,allowAudio:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","fullscreen"],i18n:{restart:"Restart",rewind:"Rewind {seektime} secs",play:"Play",pause:"Pause",forward:"Forward {seektime} secs",played:"played",buffered:"buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",toggleMute:"Toggle Mute",toggleCaptions:"Toggle Captions",toggleFullscreen:"Toggle Fullscreen",frameTitle:"Player for {title}"},types:{embed:["youtube","vimeo","soundcloud"],html5:["video","audio"]},urls:{vimeo:{api:"https://player.vimeo.com/api/player.js"},youtube:{api:"https://www.youtube.com/iframe_api"},soundcloud:{api:"https://w.soundcloud.com/player/api.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,forward:null,mute:null,volume:null,captions:null,fullscreen:null},events:["ready","ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied"],logPrefix:"[Plyr]"},A={object:function(e){return null!==e&&"object"==typeof e},array:function(e){return null!==e&&"object"==typeof e&&e.constructor===Array},number:function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"==typeof e&&e.constructor===Number)},string:function(e){return null!==e&&("string"==typeof e||"object"==typeof e&&e.constructor===String)},boolean:function(e){return null!==e&&"boolean"==typeof e},nodeList:function(e){return null!==e&&e instanceof NodeList},htmlElement:function(e){return null!==e&&e instanceof HTMLElement},function:function(e){return null!==e&&"function"==typeof e},undefined:function(e){return null!==e&&void 0===e}},I={supported:function(){try{e.localStorage.setItem("___test","OK");var t=e.localStorage.getItem("___test");return e.localStorage.removeItem("___test"),"OK"===t}catch(e){return!1}return!1}()};return{setup:function(e,n){function r(e,t){p(t,F.classes.hook)||a.push({target:e,media:t})}var a=[],s=[],o=[F.selectors.html5,F.selectors.embed].join(",");if(A.string(e)?e=t.querySelectorAll(e):A.htmlElement(e)?e=[e]:A.nodeList(e)||A.array(e)||A.string(e)||(A.undefined(n)&&A.object(e)&&(n=e),e=t.querySelectorAll(o)),A.nodeList(e)&&(e=Array.prototype.slice.call(e)),!S().basic||!e.length)return!1;for(var i=0;i<e.length;i++){var l=e[i],u=l.querySelectorAll(o);if(u.length)for(var c=0;c<u.length;c++)r(l,u[c]);else m(l,o)&&r(l,l)}return a.forEach(function(e){var t=e.target,r=e.media,a={};try{a=JSON.parse(t.getAttribute("data-plyr"))}catch(e){}var o=w({},F,n,a);if(!o.enabled)return null;var i=new x(r,o);if(A.object(i)){if(o.debug){var l=o.events.concat(["setup","statechange","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled"]);b(i.getContainer(),l.join(" "),function(e){console.log([o.logPrefix,"event:",e.type].join(" "),e.detail.plyr)})}g(i.getContainer(),"setup",!0,{plyr:i}),s.push(i)}}),s},supported:S,loadSprite:T,get:E}}),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,window.CustomEvent=e)}();
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.