1/******/(()=>{// webpackBootstrap 2/******/"use strict"; 3/******/var e={ 4/***/29848: 5/***/(e,t,n)=>{ 6/* harmony import */var s=n(62513); 7/* eslint @wordpress/no-global-active-element: 0 -- Not relevant out of React. */ 8/** 9 * Internal dependencies 10 */ 11/** 12 * @module sensei-modal 13 * @description Adds a basic suport for modals via "data-sensei-modal-*" attribures on HTML elements. 14 * 15 * @usage 16 * The Sensei Modal consists of four basic elements: open, close, content and overlay. 17 * Each of those elements should be denoted with HTML attributes: 18 * - data-sensei-modal-open 19 * - data-sensei-modal-content 20 * - data-sensei-modal-overlay (Optional) 21 * - data-sensei-modal-close (Optional) 22 * The modal declaration should look like something this: 23 * ```html 24 * <div data-sensei-modal> 25 * <button data-sensei-modal-open>Open Modal</button> 26 * <div data-sensei-modal-overlay></div> 27 * <div data-sensei-modal-content> 28 * <h1>Hello Modal!</h1> 29 * <button data-sensei-modal-close>Close Modal</button> 30 * </div> 31 * </div> 32 * ``` 33 */ 34/** 35 * The last focused element in the document. 36 * 37 * @type {Element} 38 */let o=document.activeElement; 39/** 40 * Opens the modal 41 * @param {MouseEvent} ev The click event. 42 */const l=e=>{e?.preventDefault();const t=(0,s/* .querySelectorAncestor */.L)(e.target,"[data-sensei-modal]");if(!t)return; 43// Put element's copy at the end of the body element. 44const n=t.cloneNode(!0);n.setAttribute("data-sensei-modal-clone",""),document.body.appendChild(n),["overlay","close"].forEach((e=>{n.querySelectorAll(`[data-sensei-modal-${e}]`).forEach((e=>{e.addEventListener("click",i)}))})), 45// Open the modal. 46// Make sure the elements are opened only after they are painted by 47// the browser first. Otherwise the transition effects do not work. 48window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>{n.setAttribute("data-sensei-modal-is-open",""),document.body.dispatchEvent(new CustomEvent("sensei-modal-open",{detail:n})),o=document.activeElement;const e=n.querySelector("[data-sensei-modal-content]");e&&(e.tabIndex=0,e.focus())}))))},i=e=>{e?.preventDefault(),document.querySelectorAll("[data-sensei-modal-clone]").forEach((e=>{e.remove(),document.body.dispatchEvent(new CustomEvent("sensei-modal-close",{detail:e})),o?.focus()}))}; 49/** 50 * Closes the opened modal 51 * @param {MouseEvent} ev The click event. 52 */ 53// Init modal when the DOM is fully ready. 54window.addEventListener("load",( 55/** 56 * Attach modal events. 57 */ 58function(){ 59// Attach open events. 60document.querySelectorAll("[data-sensei-modal-open]").forEach((e=>{e.addEventListener("click",l)})), 61// Attach close event on Escape key. 62document.addEventListener("keydown",(e=>{"Escape"===e.key&&i(e)}))})), 63/** 64 * Support for closing the Modal on Esc key. 65 */ 66document.addEventListener("keydown",(e=>{["Esc","Escape"].includes(e.key)&&i()}))} 67/***/, 68/***/62513: 69/***/(e,t,n)=>{ 70/* harmony export */n.d(t,{ 71/* harmony export */L:()=>/* binding */s 72/* harmony export */}); 73/** 74 * Finds the first ancestor matching the CSS selector. 75 * 76 * @param {HTMLElement} element The element whose parent you want to retrieve. 77 * @param {string} selector The CSS selector. 78 * @return {HTMLElement|null} The parent element if found or null otherwise. 79 */ 80const s=(e,t="")=>e.parentElement?e.parentElement.matches(t)?e.parentElement:s(e.parentElement,t):null; 81/***/ 82/******/}},t={}; 83/************************************************************************/ 84/******/ // The module cache 85/******/ 86/******/ 87/******/ // The require function 88/******/function n(s){ 89/******/ // Check if module is in cache 90/******/var o=t[s]; 91/******/if(void 0!==o) 92/******/return o.exports; 93/******/ 94/******/ // Create a new module (and put it into the cache) 95/******/var l=t[s]={ 96/******/ // no module.id needed 97/******/ // no module.loaded needed 98/******/exports:{} 99/******/}; 100/******/ 101/******/ // Execute the module function 102/******/ 103/******/ 104/******/ // Return the exports of the module 105/******/return e[s](l,l.exports,n),l.exports; 106/******/} 107/******/ 108/************************************************************************/ 109/******/ /* webpack/runtime/define property getters */ 110/******/ 111/******/ // define getter functions for harmony exports 112/******/n.d=(e,t)=>{ 113/******/for(var s in t) 114/******/n.o(t,s)&&!n.o(e,s)&& 115/******/Object.defineProperty(e,s,{enumerable:!0,get:t[s]}) 116/******/; 117/******/}, 118/******/n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t) 119/******/; 120/* harmony import */n(29848); 121/** 122 * Internal dependencies 123 */window.addEventListener("load",(()=>{if(0===document.querySelectorAll(".sensei-collapsible__toggle").length)return;document.querySelectorAll(".sensei-collapsible").forEach((e=>{const t=e.querySelector(".sensei-collapsible__content"),n=e.querySelector(".sensei-collapsible__toggle");if(!t||!n)return;let s=t.offsetHeight+"px";if(t.classList.contains("sensei-collapsed")){const e=t.style.transition;t.style.transition="unset",t.style.maxHeight="unset",s=t.offsetHeight+"px",t.style.visibility="hidden",t.style.maxHeight=0,t.style.transition=e}else t.style.maxHeight=s;n.addEventListener("click",(e=>{e.preventDefault();const o=t.classList.toggle("sensei-collapsed");n.classList.toggle("sensei-collapsed",o),n.setAttribute("aria-expanded",!o),o?t.style.maxHeight="0px":(t.style.visibility="",t.style.maxHeight=s)})),t.addEventListener("transitionend",(e=>{"max-height"===e.propertyName&&t.classList.contains("sensei-collapsed")&&(t.style.visibility="hidden")}))}
123))}))}) 124/******/();
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.