-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.js
1 lines (1 loc) · 6.07 KB
/
404.js
1
(()=>{"use strict";function e(){var e=document.getElementsByClassName("theme-toggle");if(window.CSS&&CSS.supports("color","var(--bg)")&&e){var t=localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");t&&document.documentElement.setAttribute("data-theme",t);for(var o=0;o<e.length;o++)e[o].onclick=function(){var e="light";"light"===document.documentElement.getAttribute("data-theme")&&(e="dark"),document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e)}}}const t=":not([inert]):not([inert] *)",o=':not([tabindex^="-"])',i=":not(:disabled)";var s=[`a[href]${t}${o}`,`area[href]${t}${o}`,`input:not([type="hidden"]):not([type="radio"])${t}${o}${i}`,`input[type="radio"]${t}${o}${i}`,`select${t}${o}${i}`,`textarea${t}${o}${i}`,`button${t}${o}${i}`,`details${t} > summary:first-of-type${o}`,`iframe${t}${o}`,`audio[controls]${t}${o}`,`video[controls]${t}${o}`,`[contenteditable]${t}${o}`,`[tabindex]${t}${o}`];function n(e){(e.querySelector("[autofocus]")||e).focus()}function r(e,t){if(t&&d(e))return e;if(!((o=e).shadowRoot&&"-1"===o.getAttribute("tabindex")||o.matches(":disabled,[hidden],[inert]")))if(e.shadowRoot){let o=a(e.shadowRoot,t);for(;o;){const e=r(o,t);if(e)return e;o=l(o,t)}}else if("slot"===e.localName){const o=e.assignedElements({flatten:!0});t||o.reverse();for(const e of o){const o=r(e,t);if(o)return o}}else{let o=a(e,t);for(;o;){const e=r(o,t);if(e)return e;o=l(o,t)}}var o;return!t&&d(e)?e:null}function a(e,t){return t?e.firstElementChild:e.lastElementChild}function l(e,t){return t?e.nextElementSibling:e.previousElementSibling}const d=e=>!e.shadowRoot?.delegatesFocus&&(e.matches(s.join(","))&&!(e=>!(!e.matches("details:not([open]) *")||e.matches("details>summary:first-of-type"))||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))(e));function c(e=document){const t=e.activeElement;return t?t.shadowRoot?c(t.shadowRoot)||document.activeElement:t:null}function h(e,t){const[o,i]=function(e){const t=r(e,!0);return[t,t?r(e,!1)||t:null]}(e);if(!o)return t.preventDefault();const s=c();t.shiftKey&&s===o?(i.focus(),t.preventDefault()):t.shiftKey||s!==i||(o.focus(),t.preventDefault())}class u{$el;id;previouslyFocused;shown;constructor(e){this.$el=e,this.id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this.fire("destroy"),this}show(e){return this.shown||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=c(),"BODY"===this.previouslyFocused?.tagName&&e?.target&&(this.previouslyFocused=e.target),"focus"===e?.type?this.maintainFocus(e):n(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this.fire("show",e)),this}hide(e){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this.fire("hide",e),this):this}on(e,t,o){return this.$el.addEventListener(e,t,o),this}off(e,t,o){return this.$el.removeEventListener(e,t,o),this}fire(e,t){this.$el.dispatchEvent(new CustomEvent(e,{detail:t,cancelable:!0}))}handleTriggerClicks(e){const t=e.target;t.closest(`[data-a11y-dialog-show="${this.id}"]`)&&this.show(e),(t.closest(`[data-a11y-dialog-hide="${this.id}"]`)||t.closest("[data-a11y-dialog-hide]")&&t.closest('[aria-modal="true"]')===this.$el)&&this.hide(e)}bindKeypress(e){if(document.activeElement?.closest('[aria-modal="true"]')!==this.$el)return;let t=!1;try{t=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==e.key||"alertdialog"===this.$el.getAttribute("role")||t||(e.preventDefault(),this.hide(e)),"Tab"===e.key&&h(this.$el,e)}maintainFocus(e){e.target.closest('[aria-modal="true"], [data-a11y-dialog-ignore-focus-trap]')||n(this.$el)}}function m(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new u(e)}function f(){var e=this;e.n=document.querySelector("nav"),e.close=function(){document.body.style.overflow="auto",e.n.classList.remove("active")},e.open=function(){document.body.style.overflow="hidden",e.n.classList.add("active")},e.n&&(document.querySelector("nav>button").addEventListener("click",(()=>{console.log("toggleNav"),e.n.classList.contains("active")?e.close():e.open()})),document.querySelector("nav>.nav-overlay").addEventListener("click",(()=>{e.close()})),document.querySelectorAll("nav ul > a").forEach((t=>t.addEventListener("click",(()=>{e.close()})))))}function v(){let e=document.querySelectorAll("[class*=_aos]");if(IntersectionObserver&&e){let t=new IntersectionObserver((function(e){e.forEach((e=>{e.isIntersecting&&!e.target.classList.contains("_aos-done")?e.target.classList.add("_aos-done"):e.target.classList.remove("_aos-done")}))}),{root:null,threshold:0});e.forEach((e=>{t.observe(e)}))}}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",m):m()),document.addEventListener("DOMContentLoaded",(()=>{const t=new u(document.querySelector("#dlg_support"));t.on("show",(()=>document.documentElement.style.overflowY="hidden")),t.on("hide",(()=>document.documentElement.style.overflowY="")),new f,new e,new v,function(){const e=window.location.href;let t=!0;[{keyword:"awesome-extensions-for-kiwi",componentId:"aek"}].forEach((({keyword:o,componentId:i})=>{e.includes(o)&&(t=!1,document.getElementById(i).style.display="flex")})),t&&(document.getElementById("404").style.display="flex")}()}))})();