@cagovweb/state-template 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/dist/css/cagov.core.css +24005 -0
  4. package/dist/css/cagov.core.min.css +6 -0
  5. package/dist/css/colortheme-delta.css +4264 -0
  6. package/dist/css/colortheme-delta.min.css +1 -0
  7. package/dist/css/colortheme-eureka.css +4264 -0
  8. package/dist/css/colortheme-eureka.min.css +1 -0
  9. package/dist/css/colortheme-mono.css +4198 -0
  10. package/dist/css/colortheme-mono.min.css +1 -0
  11. package/dist/css/colortheme-oceanside.css +4264 -0
  12. package/dist/css/colortheme-oceanside.min.css +1 -0
  13. package/dist/css/colortheme-orangecounty.css +4264 -0
  14. package/dist/css/colortheme-orangecounty.min.css +1 -0
  15. package/dist/css/colortheme-pasorobles.css +4264 -0
  16. package/dist/css/colortheme-pasorobles.min.css +1 -0
  17. package/dist/css/colortheme-sacramento.css +4352 -0
  18. package/dist/css/colortheme-sacramento.min.css +1 -0
  19. package/dist/css/colortheme-santabarbara.css +4264 -0
  20. package/dist/css/colortheme-santabarbara.min.css +1 -0
  21. package/dist/css/colortheme-santacruz.css +4264 -0
  22. package/dist/css/colortheme-santacruz.min.css +1 -0
  23. package/dist/css/colortheme-shasta.css +4264 -0
  24. package/dist/css/colortheme-shasta.min.css +1 -0
  25. package/dist/css/colortheme-sierra.css +4264 -0
  26. package/dist/css/colortheme-sierra.min.css +1 -0
  27. package/dist/css/colortheme-trinity.css +4264 -0
  28. package/dist/css/colortheme-trinity.min.css +1 -0
  29. package/dist/fonts/CaGov.svg +528 -0
  30. package/dist/fonts/CaGov.ttf +0 -0
  31. package/dist/fonts/CaGov.woff +0 -0
  32. package/dist/fonts/CaGov.woff2 +0 -0
  33. package/dist/fonts/publicsans-bold-webfont.woff +0 -0
  34. package/dist/fonts/publicsans-bold-webfont.woff2 +0 -0
  35. package/dist/fonts/publicsans-extrabold-webfont.woff +0 -0
  36. package/dist/fonts/publicsans-extrabold-webfont.woff2 +0 -0
  37. package/dist/fonts/publicsans-extralight-webfont.woff +0 -0
  38. package/dist/fonts/publicsans-extralight-webfont.woff2 +0 -0
  39. package/dist/fonts/publicsans-light-webfont.woff +0 -0
  40. package/dist/fonts/publicsans-light-webfont.woff2 +0 -0
  41. package/dist/fonts/publicsans-medium-webfont.woff +0 -0
  42. package/dist/fonts/publicsans-medium-webfont.woff2 +0 -0
  43. package/dist/fonts/publicsans-regular-webfont.woff +0 -0
  44. package/dist/fonts/publicsans-regular-webfont.woff2 +0 -0
  45. package/dist/fonts/publicsans-semibold-webfont..woff +0 -0
  46. package/dist/fonts/publicsans-semibold-webfont.woff2 +0 -0
  47. package/dist/js/cagov.core.js +2563 -0
  48. package/dist/js/cagov.core.min.js +6 -0
  49. package/dist/readme.md +5 -0
  50. package/package.json +38 -0
@@ -0,0 +1,2563 @@
1
+ /*!
2
+ * Bootstrap v5.1.3 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ */
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e();}(undefined,(function(){const t="transitionend",e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null;}return e},i=t=>{const i=e(t);return i&&document.querySelector(i)?i:null},n=t=>{const i=e(t);return i?document.querySelector(i):null},s=e=>{e.dispatchEvent(new Event(t));},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,a=(t,e,i)=>{Object.keys(i).forEach((n=>{const s=i[n],r=e[n],a=r&&o(r)?"element":null==(l=r)?`${l}`:{}.toString.call(l).match(/\s([a-z]+)/i)[1].toLowerCase();var l;if(!new RegExp(s).test(a))throw new TypeError(`${t.toUpperCase()}: Option "${n}" provided type "${a}" but expected type "${s}".`)}));},l=t=>!(!o(t)||0===t.getClientRects().length)&&"visible"===getComputedStyle(t).getPropertyValue("visibility"),c=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),h=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?h(t.parentNode):null},d=()=>{},u=t=>{t.offsetHeight;},f=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},p=[],m=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=f();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface);}},"loading"===document.readyState?(p.length||document.addEventListener("DOMContentLoaded",(()=>{p.forEach((t=>t()));})),p.push(e)):e();},_=t=>{"function"==typeof t&&t();},b=(e,i,n=!0)=>{if(!n)return void _(e);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(i)+5;let r=!1;const a=({target:n})=>{n===i&&(r=!0,i.removeEventListener(t,a),_(e));};i.addEventListener(t,a),setTimeout((()=>{r||s(i);}),o);},v=(t,e,i,n)=>{let s=t.indexOf(e);if(-1===s)return t[!i&&n?t.length-1:0];const o=t.length;return s+=i?1:-1,n&&(s=(s+o)%o),t[Math.max(0,Math.min(s,o-1))]},y=/[^.]*(?=\..*)\.|.*/,w=/\..*/,E=/::\d+$/,A={};let T=1;const O={mouseenter:"mouseover",mouseleave:"mouseout"},C=/^(mouseenter|mouseleave)/i,k=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function L(t,e){return e&&`${e}::${T++}`||t.uidEvent||T++}function x(t){const e=L(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function D(t,e,i=null){const n=Object.keys(t);for(let s=0,o=n.length;s<o;s++){const o=t[n[s]];if(o.originalHandler===e&&o.delegationSelector===i)return o}return null}function S(t,e,i){const n="string"==typeof e,s=n?i:e;let o=P(t);return k.has(o)||(o=t),[n,s,o]}function N(t,e,i,n,s){if("string"!=typeof e||!t)return;if(i||(i=n,n=null),C.test(e)){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};n?n=t(n):i=t(i);}const[o,r,a]=S(e,i,n),l=x(t),c=l[a]||(l[a]={}),h=D(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=L(r,e.replace(y,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(let a=o.length;a--;)if(o[a]===r)return s.delegateTarget=r,n.oneOff&&j.off(t,s.type,e,i),i.apply(r,[s]);return null}}(t,i,n):function(t,e){return function i(n){return n.delegateTarget=t,i.oneOff&&j.off(t,n.type,e),e.apply(t,[n])}}(t,i);u.delegationSelector=o?i:null,u.originalHandler=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o);}function I(t,e,i,n,s){const o=D(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent]);}function P(t){return t=t.replace(w,""),O[t]||t}const j={on(t,e,i,n){N(t,e,i,n,!1);},one(t,e,i,n){N(t,e,i,n,!0);},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=S(e,i,n),a=r!==e,l=x(t),c=e.startsWith(".");if(void 0!==o){if(!l||!l[r])return;return void I(t,l,r,o,s?i:null)}c&&Object.keys(l).forEach((i=>{!function(t,e,i,n){const s=e[i]||{};Object.keys(s).forEach((o=>{if(o.includes(n)){const n=s[o];I(t,e,i,n.originalHandler,n.delegationSelector);}}));}(t,l,i,e.slice(1));}));const h=l[r]||{};Object.keys(h).forEach((i=>{const n=i.replace(E,"");if(!a||e.includes(n)){const e=h[i];I(t,l,r,e.originalHandler,e.delegationSelector);}}));},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=f(),s=P(e),o=e!==s,r=k.has(s);let a,l=!0,c=!0,h=!1,d=null;return o&&n&&(a=n.Event(e,i),n(t).trigger(a),l=!a.isPropagationStopped(),c=!a.isImmediatePropagationStopped(),h=a.isDefaultPrevented()),r?(d=document.createEvent("HTMLEvents"),d.initEvent(s,l,!0)):d=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==i&&Object.keys(i).forEach((t=>{Object.defineProperty(d,t,{get:()=>i[t]});})),h&&d.preventDefault(),c&&t.dispatchEvent(d),d.defaultPrevented&&void 0!==a&&a.preventDefault(),d}},M=new Map,H={set(t,e,i){M.has(t)||M.set(t,new Map);const n=M.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`);},get:(t,e)=>M.has(t)&&M.get(t).get(e)||null,remove(t,e){if(!M.has(t))return;const i=M.get(t);i.delete(e),0===i.size&&M.delete(t);}};class B{constructor(t){(t=r(t))&&(this._element=t,H.set(this._element,this.constructor.DATA_KEY,this));}dispose(){H.remove(this._element,this.constructor.DATA_KEY),j.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((t=>{this[t]=null;}));}_queueCallback(t,e,i=!0){b(t,e,i);}static getInstance(t){return H.get(r(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return "5.1.3"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return `bs.${this.NAME}`}static get EVENT_KEY(){return `.${this.DATA_KEY}`}}const R=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;j.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),c(this))return;const o=n(this)||this.closest(`.${s}`);t.getOrCreateInstance(o)[e]();}));};class W extends B{static get NAME(){return "alert"}close(){if(j.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t);}_destroyElement(){this._element.remove(),j.trigger(this._element,"closed.bs.alert"),this.dispose();}static jQueryInterface(t){return this.each((function(){const e=W.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this);}}))}}R(W,"close"),g(W);const $='[data-bs-toggle="button"]';class z extends B{static get NAME(){return "button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"));}static jQueryInterface(t){return this.each((function(){const e=z.getOrCreateInstance(this);"toggle"===t&&e[t]();}))}}function q(t){return "true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function F(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}j.on(document,"click.bs.button.data-api",$,(t=>{t.preventDefault();const e=t.target.closest($);z.getOrCreateInstance(e).toggle();})),g(z);const U={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${F(e)}`,i);},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${F(e)}`);},getDataAttributes(t){if(!t)return {};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((i=>{let n=i.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1,n.length),e[n]=q(t.dataset[i]);})),e},getDataAttribute:(t,e)=>q(t.getAttribute(`data-bs-${F(e)}`)),offset(t){const e=t.getBoundingClientRect();return {top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}},position:t=>({top:t.offsetTop,left:t.offsetLeft})},V={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let n=t.parentNode;for(;n&&n.nodeType===Node.ELEMENT_NODE&&3!==n.nodeType;)n.matches(e)&&i.push(n),n=n.parentNode;return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return [i];i=i.previousElementSibling;}return []},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return [i];i=i.nextElementSibling;}return []},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(", ");return this.find(e,t).filter((t=>!c(t)&&l(t)))}},K="carousel",X={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},Y={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},Q="next",G="prev",Z="left",J="right",tt={ArrowLeft:J,ArrowRight:Z},et="slid.bs.carousel",it="active",nt=".active.carousel-item";class st extends B{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=V.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners();}static get Default(){return X}static get NAME(){return K}next(){this._slide(Q);}nextWhenVisible(){!document.hidden&&l(this._element)&&this.next();}prev(){this._slide(G);}pause(t){t||(this._isPaused=!0),V.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(s(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null;}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval));}to(t){this._activeElement=V.findOne(nt,this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void j.one(this._element,et,(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const i=t>e?Q:G;this._slide(i,this._items[t]);}_getConfig(t){return t={...X,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(K,t,Y),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?J:Z);}_addEventListeners(){this._config.keyboard&&j.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(j.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),j.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners();}_addTouchEventListeners(){const t=t=>this._pointerEvent&&("pen"===t.pointerType||"touch"===t.pointerType),e=e=>{t(e)?this.touchStartX=e.clientX:this._pointerEvent||(this.touchStartX=e.touches[0].clientX);},i=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX;},n=e=>{t(e)&&(this.touchDeltaX=e.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval));};V.find(".carousel-item img",this._element).forEach((t=>{j.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()));})),this._pointerEvent?(j.on(this._element,"pointerdown.bs.carousel",(t=>e(t))),j.on(this._element,"pointerup.bs.carousel",(t=>n(t))),this._element.classList.add("pointer-event")):(j.on(this._element,"touchstart.bs.carousel",(t=>e(t))),j.on(this._element,"touchmove.bs.carousel",(t=>i(t))),j.on(this._element,"touchend.bs.carousel",(t=>n(t))));}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=tt[t.key];e&&(t.preventDefault(),this._slide(e));}_getItemIndex(t){return this._items=t&&t.parentNode?V.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const i=t===Q;return v(this._items,e,i,this._config.wrap)}_triggerSlideEvent(t,e){const i=this._getItemIndex(t),n=this._getItemIndex(V.findOne(nt,this._element));return j.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:n,to:i})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=V.findOne(".active",this._indicatorsElement);e.classList.remove(it),e.removeAttribute("aria-current");const i=V.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e<i.length;e++)if(Number.parseInt(i[e].getAttribute("data-bs-slide-to"),10)===this._getItemIndex(t)){i[e].classList.add(it),i[e].setAttribute("aria-current","true");break}}}_updateInterval(){const t=this._activeElement||V.findOne(nt,this._element);if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);e?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=e):this._config.interval=this._config.defaultInterval||this._config.interval;}_slide(t,e){const i=this._directionToOrder(t),n=V.findOne(nt,this._element),s=this._getItemIndex(n),o=e||this._getItemByOrder(i,n),r=this._getItemIndex(o),a=Boolean(this._interval),l=i===Q,c=l?"carousel-item-start":"carousel-item-end",h=l?"carousel-item-next":"carousel-item-prev",d=this._orderToDirection(i);if(o&&o.classList.contains(it))return void(this._isSliding=!1);if(this._isSliding)return;if(this._triggerSlideEvent(o,d).defaultPrevented)return;if(!n||!o)return;this._isSliding=!0,a&&this.pause(),this._setActiveIndicatorElement(o),this._activeElement=o;const f=()=>{j.trigger(this._element,et,{relatedTarget:o,direction:d,from:s,to:r});};if(this._element.classList.contains("slide")){o.classList.add(h),u(o),n.classList.add(c),o.classList.add(c);const t=()=>{o.classList.remove(c,h),o.classList.add(it),n.classList.remove(it,h,c),this._isSliding=!1,setTimeout(f,0);};this._queueCallback(t,n,!0);}else n.classList.remove(it),o.classList.add(it),this._isSliding=!1,f();a&&this.cycle();}_directionToOrder(t){return [J,Z].includes(t)?m()?t===Z?G:Q:t===Z?Q:G:t}_orderToDirection(t){return [Q,G].includes(t)?m()?t===G?Z:J:t===G?J:Z:t}static carouselInterface(t,e){const i=st.getOrCreateInstance(t,e);let{_config:n}=i;"object"==typeof e&&(n={...n,...e});const s="string"==typeof e?e:n.slide;if("number"==typeof e)i.to(e);else if("string"==typeof s){if(void 0===i[s])throw new TypeError(`No method named "${s}"`);i[s]();}else n.interval&&n.ride&&(i.pause(),i.cycle());}static jQueryInterface(t){return this.each((function(){st.carouselInterface(this,t);}))}static dataApiClickHandler(t){const e=n(this);if(!e||!e.classList.contains("carousel"))return;const i={...U.getDataAttributes(e),...U.getDataAttributes(this)},s=this.getAttribute("data-bs-slide-to");s&&(i.interval=!1),st.carouselInterface(e,i),s&&st.getInstance(e).to(s),t.preventDefault();}}j.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",st.dataApiClickHandler),j.on(window,"load.bs.carousel.data-api",(()=>{const t=V.find('[data-bs-ride="carousel"]');for(let e=0,i=t.length;e<i;e++)st.carouselInterface(t[e],st.getInstance(t[e]));})),g(st);const ot="collapse",rt={toggle:!0,parent:null},at={toggle:"boolean",parent:"(null|element)"},lt="show",ct="collapse",ht="collapsing",dt="collapsed",ut=":scope .collapse .collapse",ft='[data-bs-toggle="collapse"]';class pt extends B{constructor(t,e){super(t),this._isTransitioning=!1,this._config=this._getConfig(e),this._triggerArray=[];const n=V.find(ft);for(let t=0,e=n.length;t<e;t++){const e=n[t],s=i(e),o=V.find(s).filter((t=>t===this._element));null!==s&&o.length&&(this._selector=s,this._triggerArray.push(e));}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle();}static get Default(){return rt}static get NAME(){return ot}toggle(){this._isShown()?this.hide():this.show();}show(){if(this._isTransitioning||this._isShown())return;let t,e=[];if(this._config.parent){const t=V.find(ut,this._config.parent);e=V.find(".collapse.show, .collapse.collapsing",this._config.parent).filter((e=>!t.includes(e)));}const i=V.findOne(this._selector);if(e.length){const n=e.find((t=>i!==t));if(t=n?pt.getInstance(n):null,t&&t._isTransitioning)return}if(j.trigger(this._element,"show.bs.collapse").defaultPrevented)return;e.forEach((e=>{i!==e&&pt.getOrCreateInstance(e,{toggle:!1}).hide(),t||H.set(e,"bs.collapse",null);}));const n=this._getDimension();this._element.classList.remove(ct),this._element.classList.add(ht),this._element.style[n]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const s=`scroll${n[0].toUpperCase()+n.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct,lt),this._element.style[n]="",j.trigger(this._element,"shown.bs.collapse");}),this._element,!0),this._element.style[n]=`${this._element[s]}px`;}hide(){if(this._isTransitioning||!this._isShown())return;if(j.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,u(this._element),this._element.classList.add(ht),this._element.classList.remove(ct,lt);const e=this._triggerArray.length;for(let t=0;t<e;t++){const e=this._triggerArray[t],i=n(e);i&&!this._isShown(i)&&this._addAriaAndCollapsedClass([e],!1);}this._isTransitioning=!0,this._element.style[t]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct),j.trigger(this._element,"hidden.bs.collapse");}),this._element,!0);}_isShown(t=this._element){return t.classList.contains(lt)}_getConfig(t){return (t={...rt,...U.getDataAttributes(this._element),...t}).toggle=Boolean(t.toggle),t.parent=r(t.parent),a(ot,t,at),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=V.find(ut,this._config.parent);V.find(ft,this._config.parent).filter((e=>!t.includes(e))).forEach((t=>{const e=n(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e));}));}_addAriaAndCollapsedClass(t,e){t.length&&t.forEach((t=>{e?t.classList.remove(dt):t.classList.add(dt),t.setAttribute("aria-expanded",e);}));}static jQueryInterface(t){return this.each((function(){const e={};"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1);const i=pt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]();}}))}}j.on(document,"click.bs.collapse.data-api",ft,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=i(this);V.find(e).forEach((t=>{pt.getOrCreateInstance(t,{toggle:!1}).toggle();}));})),g(pt);var mt="top",gt="bottom",_t="right",bt="left",vt="auto",yt=[mt,gt,_t,bt],wt="start",Et="end",At="clippingParents",Tt="viewport",Ot="popper",Ct="reference",kt=yt.reduce((function(t,e){return t.concat([e+"-"+wt,e+"-"+Et])}),[]),Lt=[].concat(yt,[vt]).reduce((function(t,e){return t.concat([e,e+"-"+wt,e+"-"+Et])}),[]),xt="beforeRead",Dt="read",St="afterRead",Nt="beforeMain",It="main",Pt="afterMain",jt="beforeWrite",Mt="write",Ht="afterWrite",Bt=[xt,Dt,St,Nt,It,Pt,jt,Mt,Ht];function Rt(t){return t?(t.nodeName||"").toLowerCase():null}function Wt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function $t(t){return t instanceof Wt(t).Element||t instanceof Element}function zt(t){return t instanceof Wt(t).HTMLElement||t instanceof HTMLElement}function qt(t){return "undefined"!=typeof ShadowRoot&&(t instanceof Wt(t).ShadowRoot||t instanceof ShadowRoot)}const Ft={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];zt(s)&&Rt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e);})));}));},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});zt(n)&&Rt(n)&&(Object.assign(n.style,o),Object.keys(s).forEach((function(t){n.removeAttribute(t);})));}));}},requires:["computeStyles"]};function Ut(t){return t.split("-")[0]}function Vt(t,e){var i=t.getBoundingClientRect();return {width:i.width/1,height:i.height/1,top:i.top/1,right:i.right/1,bottom:i.bottom/1,left:i.left/1,x:i.left/1,y:i.top/1}}function Kt(t){var e=Vt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Xt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return !0;if(i&&qt(i)){var n=e;do{if(n&&t.isSameNode(n))return !0;n=n.parentNode||n.host;}while(n)}return !1}function Yt(t){return Wt(t).getComputedStyle(t)}function Qt(t){return ["table","td","th"].indexOf(Rt(t))>=0}function Gt(t){return (($t(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zt(t){return "html"===Rt(t)?t:t.assignedSlot||t.parentNode||(qt(t)?t.host:null)||Gt(t)}function Jt(t){return zt(t)&&"fixed"!==Yt(t).position?t.offsetParent:null}function te(t){for(var e=Wt(t),i=Jt(t);i&&Qt(i)&&"static"===Yt(i).position;)i=Jt(i);return i&&("html"===Rt(i)||"body"===Rt(i)&&"static"===Yt(i).position)?e:i||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&zt(t)&&"fixed"===Yt(t).position)return null;for(var i=Zt(t);zt(i)&&["html","body"].indexOf(Rt(i))<0;){var n=Yt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode;}return null}(t)||e}function ee(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}var ie=Math.max,ne=Math.min,se=Math.round;function oe(t,e,i){return ie(t,ne(e,i))}function re(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ae(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}const le={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,o=i.elements.arrow,r=i.modifiersData.popperOffsets,a=Ut(i.placement),l=ee(a),c=[bt,_t].indexOf(a)>=0?"height":"width";if(o&&r){var h=function(t,e){return re("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ae(t,yt))}(s.padding,i),d=Kt(o),u="y"===l?mt:bt,f="y"===l?gt:_t,p=i.rects.reference[c]+i.rects.reference[l]-r[l]-i.rects.popper[c],m=r[l]-i.rects.reference[l],g=te(o),_=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=p/2-m/2,v=h[u],y=_-d[c]-h[f],w=_/2-d[c]/2+b,E=oe(v,w,y),A=l;i.modifiersData[n]=((e={})[A]=E,e.centerOffset=E-w,e);}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Xt(e.elements.popper,n)&&(e.elements.arrow=n);},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ce(t){return t.split("-")[1]}var he={top:"auto",right:"auto",bottom:"auto",left:"auto"};function de(t){var e,i=t.popper,n=t.popperRect,s=t.placement,o=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,d=!0===h?function(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return {x:se(se(e*n)/n)||0,y:se(se(i*n)/n)||0}}(r):"function"==typeof h?h(r):r,u=d.x,f=void 0===u?0:u,p=d.y,m=void 0===p?0:p,g=r.hasOwnProperty("x"),_=r.hasOwnProperty("y"),b=bt,v=mt,y=window;if(c){var w=te(i),E="clientHeight",A="clientWidth";w===Wt(i)&&"static"!==Yt(w=Gt(i)).position&&"absolute"===a&&(E="scrollHeight",A="scrollWidth"),w=w,s!==mt&&(s!==bt&&s!==_t||o!==Et)||(v=gt,m-=w[E]-n.height,m*=l?1:-1),s!==bt&&(s!==mt&&s!==gt||o!==Et)||(b=_t,f-=w[A]-n.width,f*=l?1:-1);}var T,O=Object.assign({position:a},c&&he);return l?Object.assign({},O,((T={})[v]=_?"0":"",T[b]=g?"0":"",T.transform=(y.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",T)):Object.assign({},O,((e={})[v]=_?m+"px":"",e[b]=g?f+"px":"",e.transform="",e))}const ue={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,o=i.adaptive,r=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Ut(e.placement),variation:ce(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,de(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,de(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});},data:{}};var fe={passive:!0};const pe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,o=void 0===s||s,r=n.resize,a=void 0===r||r,l=Wt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,fe);})),a&&l.addEventListener("resize",i.update,fe),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,fe);})),a&&l.removeEventListener("resize",i.update,fe);}},data:{}};var me={left:"right",right:"left",bottom:"top",top:"bottom"};function ge(t){return t.replace(/left|right|bottom|top/g,(function(t){return me[t]}))}var _e={start:"end",end:"start"};function be(t){return t.replace(/start|end/g,(function(t){return _e[t]}))}function ve(t){var e=Wt(t);return {scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ye(t){return Vt(Gt(t)).left+ve(t).scrollLeft}function we(t){var e=Yt(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return /auto|scroll|overlay|hidden/.test(i+s+n)}function Ee(t){return ["html","body","#document"].indexOf(Rt(t))>=0?t.ownerDocument.body:zt(t)&&we(t)?t:Ee(Zt(t))}function Ae(t,e){var i;void 0===e&&(e=[]);var n=Ee(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=Wt(n),r=s?[o].concat(o.visualViewport||[],we(n)?n:[]):n,a=e.concat(r);return s?a:a.concat(Ae(Zt(r)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Oe(t,e){return e===Tt?Te(function(t){var e=Wt(t),i=Gt(t),n=e.visualViewport,s=i.clientWidth,o=i.clientHeight,r=0,a=0;return n&&(s=n.width,o=n.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(r=n.offsetLeft,a=n.offsetTop)),{width:s,height:o,x:r+ye(t),y:a}}(t)):zt(e)?function(t){var e=Vt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):Te(function(t){var e,i=Gt(t),n=ve(t),s=null==(e=t.ownerDocument)?void 0:e.body,o=ie(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=ie(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ye(t),l=-n.scrollTop;return "rtl"===Yt(s||i).direction&&(a+=ie(i.clientWidth,s?s.clientWidth:0)-o),{width:o,height:r,x:a,y:l}}(Gt(t)))}function Ce(t){var e,i=t.reference,n=t.element,s=t.placement,o=s?Ut(s):null,r=s?ce(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case mt:e={x:a,y:i.y-n.height};break;case gt:e={x:a,y:i.y+i.height};break;case _t:e={x:i.x+i.width,y:l};break;case bt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y};}var c=o?ee(o):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case wt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case Et:e[c]=e[c]+(i[h]/2-n[h]/2);}}return e}function ke(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,o=i.boundary,r=void 0===o?At:o,a=i.rootBoundary,l=void 0===a?Tt:a,c=i.elementContext,h=void 0===c?Ot:c,d=i.altBoundary,u=void 0!==d&&d,f=i.padding,p=void 0===f?0:f,m=re("number"!=typeof p?p:ae(p,yt)),g=h===Ot?Ct:Ot,_=t.rects.popper,b=t.elements[u?g:h],v=function(t,e,i){var n="clippingParents"===e?function(t){var e=Ae(Zt(t)),i=["absolute","fixed"].indexOf(Yt(t).position)>=0&&zt(t)?te(t):t;return $t(i)?e.filter((function(t){return $t(t)&&Xt(t,i)&&"body"!==Rt(t)})):[]}(t):[].concat(e),s=[].concat(n,[i]),o=s[0],r=s.reduce((function(e,i){var n=Oe(t,i);return e.top=ie(n.top,e.top),e.right=ne(n.right,e.right),e.bottom=ne(n.bottom,e.bottom),e.left=ie(n.left,e.left),e}),Oe(t,o));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}($t(b)?b:b.contextElement||Gt(t.elements.popper),r,l),y=Vt(t.elements.reference),w=Ce({reference:y,element:_,strategy:"absolute",placement:s}),E=Te(Object.assign({},_,w)),A=h===Ot?E:y,T={top:v.top-A.top+m.top,bottom:A.bottom-v.bottom+m.bottom,left:v.left-A.left+m.left,right:A.right-v.right+m.right},O=t.modifiersData.offset;if(h===Ot&&O){var C=O[s];Object.keys(T).forEach((function(t){var e=[_t,gt].indexOf(t)>=0?1:-1,i=[mt,gt].indexOf(t)>=0?"y":"x";T[t]+=C[i]*e;}));}return T}function Le(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,o=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?Lt:l,h=ce(n),d=h?a?kt:kt.filter((function(t){return ce(t)===h})):yt,u=d.filter((function(t){return c.indexOf(t)>=0}));0===u.length&&(u=d);var f=u.reduce((function(e,i){return e[i]=ke(t,{placement:i,boundary:s,rootBoundary:o,padding:r})[Ut(i)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}const xe={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0===r||r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,u=i.altBoundary,f=i.flipVariations,p=void 0===f||f,m=i.allowedAutoPlacements,g=e.options.placement,_=Ut(g),b=l||(_!==g&&p?function(t){if(Ut(t)===vt)return [];var e=ge(t);return [be(t),e,be(e)]}(g):[ge(g)]),v=[g].concat(b).reduce((function(t,i){return t.concat(Ut(i)===vt?Le(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):i)}),[]),y=e.rects.reference,w=e.rects.popper,E=new Map,A=!0,T=v[0],O=0;O<v.length;O++){var C=v[O],k=Ut(C),L=ce(C)===wt,x=[mt,gt].indexOf(k)>=0,D=x?"width":"height",S=ke(e,{placement:C,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),N=x?L?_t:bt:L?gt:mt;y[D]>w[D]&&(N=ge(N));var I=ge(N),P=[];if(o&&P.push(S[k]<=0),a&&P.push(S[N]<=0,S[I]<=0),P.every((function(t){return t}))){T=C,A=!1;break}E.set(C,P);}if(A)for(var j=function(t){var e=v.find((function(e){var i=E.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return T=e,"break"},M=p?3:1;M>0&&"break"!==j(M);M--);e.placement!==T&&(e.modifiersData[n]._skip=!0,e.placement=T,e.reset=!0);}},requiresIfExists:["offset"],data:{_skip:!1}};function De(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Se(t){return [mt,_t,gt,bt].some((function(e){return t[e]>=0}))}const Ne={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,o=e.modifiersData.preventOverflow,r=ke(e,{elementContext:"reference"}),a=ke(e,{altBoundary:!0}),l=De(r,n),c=De(a,s,o),h=Se(l),d=Se(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d});}},Ie={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,o=void 0===s?[0,0]:s,r=Lt.reduce((function(t,i){return t[i]=function(t,e,i){var n=Ut(t),s=[bt,mt].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=o[0],a=o[1];return r=r||0,a=(a||0)*s,[bt,_t].indexOf(n)>=0?{x:a,y:r}:{x:r,y:a}}(i,e.rects,o),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=r;}},Pe={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=Ce({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement});},data:{}},je={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0!==r&&r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,u=i.tether,f=void 0===u||u,p=i.tetherOffset,m=void 0===p?0:p,g=ke(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),_=Ut(e.placement),b=ce(e.placement),v=!b,y=ee(_),w="x"===y?"y":"x",E=e.modifiersData.popperOffsets,A=e.rects.reference,T=e.rects.popper,O="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,C={x:0,y:0};if(E){if(o||a){var k="y"===y?mt:bt,L="y"===y?gt:_t,x="y"===y?"height":"width",D=E[y],S=E[y]+g[k],N=E[y]-g[L],I=f?-T[x]/2:0,P=b===wt?A[x]:T[x],j=b===wt?-T[x]:-A[x],M=e.elements.arrow,H=f&&M?Kt(M):{width:0,height:0},B=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},R=B[k],W=B[L],$=oe(0,A[x],H[x]),z=v?A[x]/2-I-$-R-O:P-$-R-O,q=v?-A[x]/2+I+$+W+O:j+$+W+O,F=e.elements.arrow&&te(e.elements.arrow),U=F?"y"===y?F.clientTop||0:F.clientLeft||0:0,V=e.modifiersData.offset?e.modifiersData.offset[e.placement][y]:0,K=E[y]+z-V-U,X=E[y]+q-V;if(o){var Y=oe(f?ne(S,K):S,D,f?ie(N,X):N);E[y]=Y,C[y]=Y-D;}if(a){var Q="x"===y?mt:bt,G="x"===y?gt:_t,Z=E[w],J=Z+g[Q],tt=Z-g[G],et=oe(f?ne(J,K):J,Z,f?ie(tt,X):tt);E[w]=et,C[w]=et-Z;}}e.modifiersData[n]=C;}},requiresIfExists:["offset"]};function Me(t,e,i){void 0===i&&(i=!1);var n=zt(e);zt(e)&&function(t){var e=t.getBoundingClientRect();e.width,t.offsetWidth,e.height,t.offsetHeight;}(e);var s,o,r=Gt(e),a=Vt(t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return (n||!n&&!i)&&(("body"!==Rt(e)||we(r))&&(l=(s=e)!==Wt(s)&&zt(s)?{scrollLeft:(o=s).scrollLeft,scrollTop:o.scrollTop}:ve(s)),zt(e)?((c=Vt(e)).x+=e.clientLeft,c.y+=e.clientTop):r&&(c.x=ye(r))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function He(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n);}})),n.push(t);}return t.forEach((function(t){e.set(t.name,t);})),t.forEach((function(t){i.has(t.name)||s(t);})),n}var Be={placement:"bottom",modifiers:[],strategy:"absolute"};function Re(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return !e.some((function(t){return !(t&&"function"==typeof t.getBoundingClientRect)}))}function We(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,s=e.defaultOptions,o=void 0===s?Be:s;return function(t,e,i){void 0===i&&(i=o);var s,r,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Be,o),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,h={state:a,setOptions:function(i){var s="function"==typeof i?i(a.options):i;d(),a.options=Object.assign({},o,a.options,s),a.scrollParents={reference:$t(t)?Ae(t):t.contextElement?Ae(t.contextElement):[],popper:Ae(e)};var r,c,u=function(t){var e=He(t);return Bt.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((r=[].concat(n,a.options.modifiers),c=r.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return a.orderedModifiers=u.filter((function(t){return t.enabled})),a.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,s=t.effect;if("function"==typeof s){var o=s({state:a,name:e,instance:h,options:n});l.push(o||function(){});}})),h.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(Re(e,i)){a.rects={reference:Me(e,te(i),"fixed"===a.options.strategy),popper:Kt(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(t){return a.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var s=a.orderedModifiers[n],o=s.fn,r=s.options,l=void 0===r?{}:r,d=s.name;"function"==typeof o&&(a=o({state:a,options:l,name:d,instance:h})||a);}else a.reset=!1,n=-1;}}},update:(s=function(){return new Promise((function(t){h.forceUpdate(),t(a);}))},function(){return r||(r=new Promise((function(t){Promise.resolve().then((function(){r=void 0,t(s());}));}))),r}),destroy:function(){d(),c=!0;}};if(!Re(t,e))return h;function d(){l.forEach((function(t){return t()})),l=[];}return h.setOptions(i).then((function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t);})),h}}var $e=We(),ze=We({defaultModifiers:[pe,Pe,ue,Ft]}),qe=We({defaultModifiers:[pe,Pe,ue,Ft,Ie,xe,je,le,Ne]});const Fe=Object.freeze({__proto__:null,popperGenerator:We,detectOverflow:ke,createPopperBase:$e,createPopper:qe,createPopperLite:ze,top:mt,bottom:gt,right:_t,left:bt,auto:vt,basePlacements:yt,start:wt,end:Et,clippingParents:At,viewport:Tt,popper:Ot,reference:Ct,variationPlacements:kt,placements:Lt,beforeRead:xt,read:Dt,afterRead:St,beforeMain:Nt,main:It,afterMain:Pt,beforeWrite:jt,write:Mt,afterWrite:Ht,modifierPhases:Bt,applyStyles:Ft,arrow:le,computeStyles:ue,eventListeners:pe,flip:xe,hide:Ne,offset:Ie,popperOffsets:Pe,preventOverflow:je}),Ue="dropdown",Ve="Escape",Ke="Space",Xe="ArrowUp",Ye="ArrowDown",Qe=new RegExp("ArrowUp|ArrowDown|Escape"),Ge="click.bs.dropdown.data-api",Ze="keydown.bs.dropdown.data-api",Je="show",ti='[data-bs-toggle="dropdown"]',ei=".dropdown-menu",ii=m()?"top-end":"top-start",ni=m()?"top-start":"top-end",si=m()?"bottom-end":"bottom-start",oi=m()?"bottom-start":"bottom-end",ri=m()?"left-start":"right-start",ai=m()?"right-start":"left-start",li={offset:[0,2],boundary:"clippingParents",reference:"toggle",display:"dynamic",popperConfig:null,autoClose:!0},ci={offset:"(array|string|function)",boundary:"(string|element)",reference:"(string|element|object)",display:"string",popperConfig:"(null|object|function)",autoClose:"(boolean|string)"};class hi extends B{constructor(t,e){super(t),this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar();}static get Default(){return li}static get DefaultType(){return ci}static get NAME(){return Ue}toggle(){return this._isShown()?this.hide():this.show()}show(){if(c(this._element)||this._isShown(this._menu))return;const t={relatedTarget:this._element};if(j.trigger(this._element,"show.bs.dropdown",t).defaultPrevented)return;const e=hi.getParentFromElement(this._element);this._inNavbar?U.setDataAttribute(this._menu,"popper","none"):this._createPopper(e),"ontouchstart"in document.documentElement&&!e.closest(".navbar-nav")&&[].concat(...document.body.children).forEach((t=>j.on(t,"mouseover",d))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Je),this._element.classList.add(Je),j.trigger(this._element,"shown.bs.dropdown",t);}hide(){if(c(this._element)||!this._isShown(this._menu))return;const t={relatedTarget:this._element};this._completeHide(t);}dispose(){this._popper&&this._popper.destroy(),super.dispose();}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update();}_completeHide(t){j.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>j.off(t,"mouseover",d))),this._popper&&this._popper.destroy(),this._menu.classList.remove(Je),this._element.classList.remove(Je),this._element.setAttribute("aria-expanded","false"),U.removeDataAttribute(this._menu,"popper"),j.trigger(this._element,"hidden.bs.dropdown",t));}_getConfig(t){if(t={...this.constructor.Default,...U.getDataAttributes(this._element),...t},a(Ue,t,this.constructor.DefaultType),"object"==typeof t.reference&&!o(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${Ue.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(t){if(void 0===Fe)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;"parent"===this._config.reference?e=t:o(this._config.reference)?e=r(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const i=this._getPopperConfig(),n=i.modifiers.find((t=>"applyStyles"===t.name&&!1===t.enabled));this._popper=qe(e,this._menu,i),n&&U.setDataAttribute(this._menu,"popper","static");}_isShown(t=this._element){return t.classList.contains(Je)}_getMenuElement(){return V.next(this._element,ei)[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return ri;if(t.classList.contains("dropstart"))return ai;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?ni:ii:e?oi:si}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return "string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return "static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=V.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(l);i.length&&v(i,e,t===Ye,!i.includes(e)).focus();}static jQueryInterface(t){return this.each((function(){const e=hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]();}}))}static clearMenus(t){if(t&&(2===t.button||"keyup"===t.type&&"Tab"!==t.key))return;const e=V.find(ti);for(let i=0,n=e.length;i<n;i++){const n=hi.getInstance(e[i]);if(!n||!1===n._config.autoClose)continue;if(!n._isShown())continue;const s={relatedTarget:n._element};if(t){const e=t.composedPath(),i=e.includes(n._menu);if(e.includes(n._element)||"inside"===n._config.autoClose&&!i||"outside"===n._config.autoClose&&i)continue;if(n._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;"click"===t.type&&(s.clickEvent=t);}n._completeHide(s);}}static getParentFromElement(t){return n(t)||t.parentNode}static dataApiKeydownHandler(t){if(/input|textarea/i.test(t.target.tagName)?t.key===Ke||t.key!==Ve&&(t.key!==Ye&&t.key!==Xe||t.target.closest(ei)):!Qe.test(t.key))return;const e=this.classList.contains(Je);if(!e&&t.key===Ve)return;if(t.preventDefault(),t.stopPropagation(),c(this))return;const i=this.matches(ti)?this:V.prev(this,ti)[0],n=hi.getOrCreateInstance(i);if(t.key!==Ve)return t.key===Xe||t.key===Ye?(e||n.show(),void n._selectMenuItem(t)):void(e&&t.key!==Ke||hi.clearMenus());n.hide();}}j.on(document,Ze,ti,hi.dataApiKeydownHandler),j.on(document,Ze,ei,hi.dataApiKeydownHandler),j.on(document,Ge,hi.clearMenus),j.on(document,"keyup.bs.dropdown.data-api",hi.clearMenus),j.on(document,Ge,ti,(function(t){t.preventDefault(),hi.getOrCreateInstance(this).toggle();})),g(hi);const di=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",ui=".sticky-top";class fi{constructor(){this._element=document.body;}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,"paddingRight",(e=>e+t)),this._setElementAttributes(di,"paddingRight",(e=>e+t)),this._setElementAttributes(ui,"marginRight",(e=>e-t));}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden";}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t)[e];t.style[e]=`${i(Number.parseFloat(s))}px`;}));}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(di,"paddingRight"),this._resetElementAttributes(ui,"marginRight");}_saveInitialAttribute(t,e){const i=t.style[e];i&&U.setDataAttribute(t,e,i);}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=U.getDataAttribute(t,e);void 0===i?t.style.removeProperty(e):(U.removeDataAttribute(t,e),t.style[e]=i);}));}_applyManipulationCallback(t,e){o(t)?e(t):V.find(t,this._element).forEach(e);}isOverflowing(){return this.getWidth()>0}}const pi={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},mi={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},gi="show",_i="mousedown.bs.backdrop";class bi{constructor(t){this._config=this._getConfig(t),this._isAppended=!1,this._element=null;}show(t){this._config.isVisible?(this._append(),this._config.isAnimated&&u(this._getElement()),this._getElement().classList.add(gi),this._emulateAnimation((()=>{_(t);}))):_(t);}hide(t){this._config.isVisible?(this._getElement().classList.remove(gi),this._emulateAnimation((()=>{this.dispose(),_(t);}))):_(t);}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t;}return this._element}_getConfig(t){return (t={...pi,..."object"==typeof t?t:{}}).rootElement=r(t.rootElement),a("backdrop",t,mi),t}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),j.on(this._getElement(),_i,(()=>{_(this._config.clickCallback);})),this._isAppended=!0);}dispose(){this._isAppended&&(j.off(this._element,_i),this._element.remove(),this._isAppended=!1);}_emulateAnimation(t){b(t,this._getElement(),this._config.isAnimated);}}const vi={trapElement:null,autofocus:!0},yi={trapElement:"element",autofocus:"boolean"},wi=".bs.focustrap",Ei="backward";class Ai{constructor(t){this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null;}activate(){const{trapElement:t,autofocus:e}=this._config;this._isActive||(e&&t.focus(),j.off(document,wi),j.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),j.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0);}deactivate(){this._isActive&&(this._isActive=!1,j.off(document,wi));}_handleFocusin(t){const{target:e}=t,{trapElement:i}=this._config;if(e===document||e===i||i.contains(e))return;const n=V.focusableChildren(i);0===n.length?i.focus():this._lastTabNavDirection===Ei?n[n.length-1].focus():n[0].focus();}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Ei:"forward");}_getConfig(t){return t={...vi,..."object"==typeof t?t:{}},a("focustrap",t,yi),t}}const Ti="modal",Oi="Escape",Ci={backdrop:!0,keyboard:!0,focus:!0},ki={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},Li="hidden.bs.modal",xi="show.bs.modal",Di="resize.bs.modal",Si="click.dismiss.bs.modal",Ni="keydown.dismiss.bs.modal",Ii="mousedown.dismiss.bs.modal",Pi="modal-open",ji="show",Mi="modal-static";class Hi extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._dialog=V.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new fi;}static get Default(){return Ci}static get NAME(){return Ti}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||j.trigger(this._element,xi,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(Pi),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),j.on(this._dialog,Ii,(()=>{j.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0);}));})),this._showBackdrop((()=>this._showElement(t))));}hide(){if(!this._isShown||this._isTransitioning)return;if(j.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove(ji),j.off(this._element,Si),j.off(this._dialog,Ii),this._queueCallback((()=>this._hideModal()),this._element,t);}dispose(){[window,this._dialog].forEach((t=>j.off(t,".bs.modal"))),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose();}handleUpdate(){this._adjustDialog();}_initializeBackDrop(){return new bi({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ai({trapElement:this._element})}_getConfig(t){return t={...Ci,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(Ti,t,ki),t}_showElement(t){const e=this._isAnimated(),i=V.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,i&&(i.scrollTop=0),e&&u(this._element),this._element.classList.add(ji),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,j.trigger(this._element,"shown.bs.modal",{relatedTarget:t});}),this._dialog,e);}_setEscapeEvent(){this._isShown?j.on(this._element,Ni,(t=>{this._config.keyboard&&t.key===Oi?(t.preventDefault(),this.hide()):this._config.keyboard||t.key!==Oi||this._triggerBackdropTransition();})):j.off(this._element,Ni);}_setResizeEvent(){this._isShown?j.on(window,Di,(()=>this._adjustDialog())):j.off(window,Di);}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(Pi),this._resetAdjustments(),this._scrollBar.reset(),j.trigger(this._element,Li);}));}_showBackdrop(t){j.on(this._element,Si,(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition());})),this._backdrop.show(t);}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(j.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:t,scrollHeight:e,style:i}=this._element,n=e>document.documentElement.clientHeight;!n&&"hidden"===i.overflowY||t.contains(Mi)||(n||(i.overflowY="hidden"),t.add(Mi),this._queueCallback((()=>{t.remove(Mi),n||this._queueCallback((()=>{i.overflowY="";}),this._dialog);}),this._dialog),this._element.focus());}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;(!i&&t&&!m()||i&&!t&&m())&&(this._element.style.paddingLeft=`${e}px`),(i&&!t&&!m()||!i&&t&&m())&&(this._element.style.paddingRight=`${e}px`);}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight="";}static jQueryInterface(t,e){return this.each((function(){const i=Hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e);}}))}}j.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=n(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),j.one(e,xi,(t=>{t.defaultPrevented||j.one(e,Li,(()=>{l(this)&&this.focus();}));}));const i=V.findOne(".modal.show");i&&Hi.getInstance(i).hide(),Hi.getOrCreateInstance(e).toggle(this);})),R(Hi),g(Hi);const Bi="offcanvas",Ri={backdrop:!0,keyboard:!0,scroll:!1},Wi={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},$i="show",zi=".offcanvas.show",qi="hidden.bs.offcanvas";class Fi extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners();}static get NAME(){return Bi}static get Default(){return Ri}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||j.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||(new fi).hide(),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add($i),this._queueCallback((()=>{this._config.scroll||this._focustrap.activate(),j.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t});}),this._element,!0));}hide(){this._isShown&&(j.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.remove($i),this._backdrop.hide(),this._queueCallback((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new fi).reset(),j.trigger(this._element,qi);}),this._element,!0)));}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose();}_getConfig(t){return t={...Ri,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(Bi,t,Wi),t}_initializeBackDrop(){return new bi({className:"offcanvas-backdrop",isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_initializeFocusTrap(){return new Ai({trapElement:this._element})}_addEventListeners(){j.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{this._config.keyboard&&"Escape"===t.key&&this.hide();}));}static jQueryInterface(t){return this.each((function(){const e=Fi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this);}}))}}j.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=n(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),c(this))return;j.one(e,qi,(()=>{l(this)&&this.focus();}));const i=V.findOne(zi);i&&i!==e&&Fi.getInstance(i).hide(),Fi.getOrCreateInstance(e).toggle(this);})),j.on(window,"load.bs.offcanvas.data-api",(()=>V.find(zi).forEach((t=>Fi.getOrCreateInstance(t).show())))),R(Fi),g(Fi);const Ui=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Vi=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Ki=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Xi=(t,e)=>{const i=t.nodeName.toLowerCase();if(e.includes(i))return !Ui.has(i)||Boolean(Vi.test(t.nodeValue)||Ki.test(t.nodeValue));const n=e.filter((t=>t instanceof RegExp));for(let t=0,e=n.length;t<e;t++)if(n[t].test(i))return !0;return !1};function Yi(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const n=(new window.DOMParser).parseFromString(t,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(let t=0,i=s.length;t<i;t++){const i=s[t],n=i.nodeName.toLowerCase();if(!Object.keys(e).includes(n)){i.remove();continue}const o=[].concat(...i.attributes),r=[].concat(e["*"]||[],e[n]||[]);o.forEach((t=>{Xi(t,r)||i.removeAttribute(t.nodeName);}));}return n.body.innerHTML}const Qi="tooltip",Gi=new Set(["sanitize","allowList","sanitizeFn"]),Zi={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},Ji={AUTO:"auto",TOP:"top",RIGHT:m()?"left":"right",BOTTOM:"bottom",LEFT:m()?"right":"left"},tn={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},en={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},nn="fade",sn="show",on="show",rn="out",an=".tooltip-inner",ln=".modal",cn="hide.bs.modal",hn="hover",dn="focus";class un extends B{constructor(t,e){if(void 0===Fe)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(e),this.tip=null,this._setListeners();}static get Default(){return tn}static get NAME(){return Qi}static get Event(){return en}static get DefaultType(){return Zi}enable(){this._isEnabled=!0;}disable(){this._isEnabled=!1;}toggleEnabled(){this._isEnabled=!this._isEnabled;}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e);}else {if(this.getTipElement().classList.contains(sn))return void this._leave(null,this);this._enter(null,this);}}dispose(){clearTimeout(this._timeout),j.off(this._element.closest(ln),cn,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose();}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const t=j.trigger(this._element,this.constructor.Event.SHOW),e=h(this._element),i=null===e?this._element.ownerDocument.documentElement.contains(this._element):e.contains(this._element);if(t.defaultPrevented||!i)return;"tooltip"===this.constructor.NAME&&this.tip&&this.getTitle()!==this.tip.querySelector(an).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const n=this.getTipElement(),s=(t=>{do{t+=Math.floor(1e6*Math.random());}while(document.getElementById(t));return t})(this.constructor.NAME);n.setAttribute("id",s),this._element.setAttribute("aria-describedby",s),this._config.animation&&n.classList.add(nn);const o="function"==typeof this._config.placement?this._config.placement.call(this,n,this._element):this._config.placement,r=this._getAttachment(o);this._addAttachmentClass(r);const{container:a}=this._config;H.set(n,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(a.append(n),j.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=qe(this._element,n,this._getPopperConfig(r)),n.classList.add(sn);const l=this._resolvePossibleFunction(this._config.customClass);l&&n.classList.add(...l.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>{j.on(t,"mouseover",d);}));const c=this.tip.classList.contains(nn);this._queueCallback((()=>{const t=this._hoverState;this._hoverState=null,j.trigger(this._element,this.constructor.Event.SHOWN),t===rn&&this._leave(null,this);}),this.tip,c);}hide(){if(!this._popper)return;const t=this.getTipElement();if(j.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;t.classList.remove(sn),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>j.off(t,"mouseover",d))),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1;const e=this.tip.classList.contains(nn);this._queueCallback((()=>{this._isWithActiveTrigger()||(this._hoverState!==on&&t.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),j.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper());}),this.tip,e),this._hoverState="";}update(){null!==this._popper&&this._popper.update();}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const t=document.createElement("div");t.innerHTML=this._config.template;const e=t.children[0];return this.setContent(e),e.classList.remove(nn,sn),this.tip=e,this.tip}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),an);}_sanitizeAndSetContent(t,e,i){const n=V.findOne(i,t);e||!n?this.setElementContent(n,e):n.remove();}setElementContent(t,e){if(null!==t)return o(e)?(e=r(e),void(this._config.html?e.parentNode!==t&&(t.innerHTML="",t.append(e)):t.textContent=e.textContent)):void(this._config.html?(this._config.sanitize&&(e=Yi(e,this._config.allowList,this._config.sanitizeFn)),t.innerHTML=e):t.textContent=e)}getTitle(){const t=this._element.getAttribute("data-bs-original-title")||this._config.title;return this._resolvePossibleFunction(t)}updateAttachment(t){return "right"===t?"end":"left"===t?"start":t}_initializeOnDelegatedTarget(t,e){return e||this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_getOffset(){const{offset:t}=this._config;return "string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return "function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:t=>this._handlePopperPlacementChange(t)}],onFirstUpdate:t=>{t.options.placement!==t.placement&&this._handlePopperPlacementChange(t);}};return {...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_addAttachmentClass(t){this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(t)}`);}_getAttachment(t){return Ji[t.toUpperCase()]}_setListeners(){this._config.trigger.split(" ").forEach((t=>{if("click"===t)j.on(this._element,this.constructor.Event.CLICK,this._config.selector,(t=>this.toggle(t)));else if("manual"!==t){const e=t===hn?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,i=t===hn?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;j.on(this._element,e,this._config.selector,(t=>this._enter(t))),j.on(this._element,i,this._config.selector,(t=>this._leave(t)));}})),this._hideModalHandler=()=>{this._element&&this.hide();},j.on(this._element.closest(ln),cn,this._hideModalHandler),this._config.selector?this._config={...this._config,trigger:"manual",selector:""}:this._fixTitle();}_fixTitle(){const t=this._element.getAttribute("title"),e=typeof this._element.getAttribute("data-bs-original-title");(t||"string"!==e)&&(this._element.setAttribute("data-bs-original-title",t||""),!t||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",t),this._element.setAttribute("title",""));}_enter(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusin"===t.type?dn:hn]=!0),e.getTipElement().classList.contains(sn)||e._hoverState===on?e._hoverState=on:(clearTimeout(e._timeout),e._hoverState=on,e._config.delay&&e._config.delay.show?e._timeout=setTimeout((()=>{e._hoverState===on&&e.show();}),e._config.delay.show):e.show());}_leave(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusout"===t.type?dn:hn]=e._element.contains(t.relatedTarget)),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=rn,e._config.delay&&e._config.delay.hide?e._timeout=setTimeout((()=>{e._hoverState===rn&&e.hide();}),e._config.delay.hide):e.hide());}_isWithActiveTrigger(){for(const t in this._activeTrigger)if(this._activeTrigger[t])return !0;return !1}_getConfig(t){const e=U.getDataAttributes(this._element);return Object.keys(e).forEach((t=>{Gi.has(t)&&delete e[t];})),(t={...this.constructor.Default,...e,..."object"==typeof t&&t?t:{}}).container=!1===t.container?document.body:r(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),a(Qi,t,this.constructor.DefaultType),t.sanitize&&(t.template=Yi(t.template,t.allowList,t.sanitizeFn)),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t}_cleanTipClass(){const t=this.getTipElement(),e=new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`,"g"),i=t.getAttribute("class").match(e);null!==i&&i.length>0&&i.map((t=>t.trim())).forEach((e=>t.classList.remove(e)));}_getBasicClassPrefix(){return "bs-tooltip"}_handlePopperPlacementChange(t){const{state:e}=t;e&&(this.tip=e.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(e.placement)));}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null);}static jQueryInterface(t){return this.each((function(){const e=un.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]();}}))}}g(un);const fn={...un.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'},pn={...un.DefaultType,content:"(string|element|function)"},mn={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class gn extends un{static get Default(){return fn}static get NAME(){return "popover"}static get Event(){return mn}static get DefaultType(){return pn}isWithContent(){return this.getTitle()||this._getContent()}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),".popover-header"),this._sanitizeAndSetContent(t,this._getContent(),".popover-body");}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return "bs-popover"}static jQueryInterface(t){return this.each((function(){const e=gn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]();}}))}}g(gn);const _n="scrollspy",bn={offset:10,method:"auto",target:""},vn={offset:"number",method:"string",target:"(string|element)"},yn="active",wn=".nav-link, .list-group-item, .dropdown-item",En="position";class An extends B{constructor(t,e){super(t),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(e),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,j.on(this._scrollElement,"scroll.bs.scrollspy",(()=>this._process())),this.refresh(),this._process();}static get Default(){return bn}static get NAME(){return _n}refresh(){const t=this._scrollElement===this._scrollElement.window?"offset":En,e="auto"===this._config.method?t:this._config.method,n=e===En?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),V.find(wn,this._config.target).map((t=>{const s=i(t),o=s?V.findOne(s):null;if(o){const t=o.getBoundingClientRect();if(t.width||t.height)return [U[e](o).top+n,s]}return null})).filter((t=>t)).sort(((t,e)=>t[0]-e[0])).forEach((t=>{this._offsets.push(t[0]),this._targets.push(t[1]);}));}dispose(){j.off(this._scrollElement,".bs.scrollspy"),super.dispose();}_getConfig(t){return (t={...bn,...U.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}}).target=r(t.target)||document.documentElement,a(_n,t,vn),t}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),i=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=i){const t=this._targets[this._targets.length-1];this._activeTarget!==t&&this._activate(t);}else {if(this._activeTarget&&t<this._offsets[0]&&this._offsets[0]>0)return this._activeTarget=null,void this._clear();for(let e=this._offsets.length;e--;)this._activeTarget!==this._targets[e]&&t>=this._offsets[e]&&(void 0===this._offsets[e+1]||t<this._offsets[e+1])&&this._activate(this._targets[e]);}}_activate(t){this._activeTarget=t,this._clear();const e=wn.split(",").map((e=>`${e}[data-bs-target="${t}"],${e}[href="${t}"]`)),i=V.findOne(e.join(","),this._config.target);i.classList.add(yn),i.classList.contains("dropdown-item")?V.findOne(".dropdown-toggle",i.closest(".dropdown")).classList.add(yn):V.parents(i,".nav, .list-group").forEach((t=>{V.prev(t,".nav-link, .list-group-item").forEach((t=>t.classList.add(yn))),V.prev(t,".nav-item").forEach((t=>{V.children(t,".nav-link").forEach((t=>t.classList.add(yn)));}));})),j.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:t});}_clear(){V.find(wn,this._config.target).filter((t=>t.classList.contains(yn))).forEach((t=>t.classList.remove(yn)));}static jQueryInterface(t){return this.each((function(){const e=An.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]();}}))}}j.on(window,"load.bs.scrollspy.data-api",(()=>{V.find('[data-bs-spy="scroll"]').forEach((t=>new An(t)));})),g(An);const Tn="active",On="fade",Cn="show",kn=".active",Ln=":scope > li > .active";class xn extends B{static get NAME(){return "tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains(Tn))return;let t;const e=n(this._element),i=this._element.closest(".nav, .list-group");if(i){const e="UL"===i.nodeName||"OL"===i.nodeName?Ln:kn;t=V.find(e,i),t=t[t.length-1];}const s=t?j.trigger(t,"hide.bs.tab",{relatedTarget:this._element}):null;if(j.trigger(this._element,"show.bs.tab",{relatedTarget:t}).defaultPrevented||null!==s&&s.defaultPrevented)return;this._activate(this._element,i);const o=()=>{j.trigger(t,"hidden.bs.tab",{relatedTarget:this._element}),j.trigger(this._element,"shown.bs.tab",{relatedTarget:t});};e?this._activate(e,e.parentNode,o):o();}_activate(t,e,i){const n=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?V.children(e,kn):V.find(Ln,e))[0],s=i&&n&&n.classList.contains(On),o=()=>this._transitionComplete(t,n,i);n&&s?(n.classList.remove(Cn),this._queueCallback(o,t,!0)):o();}_transitionComplete(t,e,i){if(e){e.classList.remove(Tn);const t=V.findOne(":scope > .dropdown-menu .active",e.parentNode);t&&t.classList.remove(Tn),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1);}t.classList.add(Tn),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),u(t),t.classList.contains(On)&&t.classList.add(Cn);let n=t.parentNode;if(n&&"LI"===n.nodeName&&(n=n.parentNode),n&&n.classList.contains("dropdown-menu")){const e=t.closest(".dropdown");e&&V.find(".dropdown-toggle",e).forEach((t=>t.classList.add(Tn))),t.setAttribute("aria-expanded",!0);}i&&i();}static jQueryInterface(t){return this.each((function(){const e=xn.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]();}}))}}j.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),c(this)||xn.getOrCreateInstance(this).show();})),g(xn);const Dn="toast",Sn="hide",Nn="show",In="showing",Pn={animation:"boolean",autohide:"boolean",delay:"number"},jn={animation:!0,autohide:!0,delay:5e3};class Mn extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners();}static get DefaultType(){return Pn}static get Default(){return jn}static get NAME(){return Dn}show(){j.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Sn),u(this._element),this._element.classList.add(Nn),this._element.classList.add(In),this._queueCallback((()=>{this._element.classList.remove(In),j.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide();}),this._element,this._config.animation));}hide(){this._element.classList.contains(Nn)&&(j.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(In),this._queueCallback((()=>{this._element.classList.add(Sn),this._element.classList.remove(In),this._element.classList.remove(Nn),j.trigger(this._element,"hidden.bs.toast");}),this._element,this._config.animation)));}dispose(){this._clearTimeout(),this._element.classList.contains(Nn)&&this._element.classList.remove(Nn),super.dispose();}_getConfig(t){return t={...jn,...U.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},a(Dn,t,this.constructor.DefaultType),t}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide();}),this._config.delay)));}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e;}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide();}_setListeners(){j.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),j.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),j.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),j.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)));}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null;}static jQueryInterface(t){return this.each((function(){const e=Mn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this);}}))}}return R(Mn),g(Mn),{Alert:W,Button:z,Carousel:st,Collapse:pt,Dropdown:hi,Modal:Hi,Offcanvas:Fi,Popover:gn,ScrollSpy:An,Tab:xn,Toast:Mn,Tooltip:un}}));
7
+
8
+ //@ts-check
9
+
10
+ /* sticky header / hiding official header on scroll */
11
+ (() => {
12
+ const doc = document.documentElement;
13
+
14
+ let prevScroll = window.scrollY || doc.scrollTop;
15
+ let curScroll;
16
+ let direction = 0;
17
+ let prevDirection = 0;
18
+ const headerAlert = document.querySelector("header .alert");
19
+ const header = document.querySelector(".utility-header");
20
+ const mainheader = document.querySelector("header");
21
+
22
+ const checkScroll = () => {
23
+ /*
24
+ ** Find the direction of scroll
25
+ ** 0 - initial, 1 - up, 2 - down
26
+ */
27
+
28
+ curScroll = window.scrollY || doc.scrollTop;
29
+ if (curScroll > prevScroll) {
30
+ //scrolled up
31
+ direction = 2;
32
+ } else if (curScroll < prevScroll) {
33
+ //scrolled down
34
+ direction = 1;
35
+ }
36
+
37
+ if (direction !== prevDirection) {
38
+ // Toggle Header
39
+ if (direction === 2 && curScroll > 40) {
40
+ const hiddenheight =
41
+ header.clientHeight + (headerAlert ? headerAlert.clientHeight : 0);
42
+
43
+ mainheader.style.top = `-${hiddenheight}px`;
44
+ prevDirection = direction;
45
+ } else if (direction === 1 && curScroll < 40) {
46
+ // mainheader.classList.remove('scrolled');
47
+ // header.classList.remove('is-hidden');
48
+ // header.removeAttribute("style");
49
+ mainheader.style.removeProperty("top");
50
+ prevDirection = direction;
51
+ }
52
+ }
53
+
54
+ prevScroll = curScroll;
55
+ };
56
+
57
+ window.addEventListener("scroll", checkScroll);
58
+ })();
59
+
60
+ // retain scroll position
61
+
62
+ //@ts-check
63
+ /**
64
+ * Accordion web component that collapses and expands content inside itself on click.
65
+ *
66
+ * @element cagov-accordion
67
+ *
68
+ *
69
+ * @fires click - Default events which may be listened to in order to discover most popular accordions
70
+ *
71
+ * @attr {string} open - set on the internal details element
72
+ * If this is true the accordion will be open before any user interaction.
73
+ *
74
+ * @cssprop --primary-700 - Default value of #165ac2, used for all colors of borders and fills
75
+ * @cssprop --primary-900 - Default value of #003588, used for background on hover
76
+ *
77
+ */
78
+ class CaGovAccordion extends HTMLElement {
79
+ connectedCallback() {
80
+ this.summaryEl = this.querySelector("summary");
81
+ // trigger the opening and closing height change animation on summary click
82
+
83
+ this.setHeight();
84
+ this.summaryEl.addEventListener("click", this.listen.bind(this));
85
+ this.summaryEl.insertAdjacentHTML(
86
+ "beforeend",
87
+ `<div class="cagov-open-indicator" aria-hidden="true" />`
88
+ );
89
+ this.detailsEl = this.querySelector("details");
90
+ this.bodyEl = this.querySelector(".accordion-body");
91
+
92
+ window.addEventListener("resize", this.debounce(this.setHeight).bind(this));
93
+ }
94
+
95
+ setHeight() {
96
+ window.requestAnimationFrame(() => {
97
+ // delay so the desired height is readable in all browsers
98
+ this.closedHeightInt = this.summaryEl.scrollHeight + 2;
99
+ this.closedHeight = `${this.closedHeightInt}px`;
100
+
101
+ // apply initial height
102
+ if (this.detailsEl.hasAttribute("open")) {
103
+ // if open get scrollHeight
104
+ this.detailsEl.style.height = `${
105
+ this.bodyEl.scrollHeight + this.closedHeightInt
106
+ }px`;
107
+ } else {
108
+ // else apply closed height
109
+ this.detailsEl.style.height = this.closedHeight;
110
+ }
111
+ });
112
+ }
113
+
114
+ listen() {
115
+ if (this.detailsEl.hasAttribute("open")) {
116
+ // was open, now closing
117
+ this.detailsEl.style.height = this.closedHeight;
118
+ } else {
119
+ // was closed, opening
120
+ window.requestAnimationFrame(() => {
121
+ // delay so the desired height is readable in all browsers
122
+ this.detailsEl.style.height = `${
123
+ this.bodyEl.scrollHeight + this.closedHeightInt
124
+ }px`;
125
+ });
126
+ }
127
+ }
128
+
129
+ /**
130
+ * @param {function} func
131
+ */
132
+ debounce(func, timeout = 300) {
133
+ let timer;
134
+ return (/** @type {any} */ ...args) => {
135
+ window.clearTimeout(timer);
136
+ timer = window.setTimeout(() => {
137
+ func.apply(this, args);
138
+ }, timeout);
139
+ };
140
+ }
141
+ }
142
+ window.customElements.define("cagov-accordion", CaGovAccordion);
143
+
144
+ //document.querySelector('head').appendChild(style);
145
+
146
+ //@ts-check
147
+ ((w, doc) => {
148
+ /**
149
+ * Local object for method references
150
+ * and define script meta-data
151
+ */
152
+ const ARIAaccordion = {};
153
+ w["ARIAaccordion"] = ARIAaccordion;
154
+
155
+ ARIAaccordion.NS = "ARIAaccordion";
156
+ ARIAaccordion.AUTHOR = "Scott O'Hara";
157
+ ARIAaccordion.VERSION = "3.2.1";
158
+ ARIAaccordion.LICENSE =
159
+ "https://github.com/scottaohara/accessible_accordions/blob/master/LICENSE";
160
+
161
+ const widgetClass = "accordion";
162
+ const widgetTriggerClass = `${widgetClass}__trigger`;
163
+ const widgetHeadingClass = `${widgetClass}__heading`;
164
+ const widgetPanelClass = `${widgetClass}__panel`;
165
+
166
+ const widgetHeading = "[data-aria-accordion-heading]";
167
+ const widgetPanel = "[data-aria-accordion-panel]";
168
+
169
+ let idCounter = 0;
170
+
171
+ /**
172
+ * gets the correct selector, "LI" children or not
173
+ * @param {string} id
174
+ */
175
+ const getChildSelector = id =>
176
+ doc.querySelectorAll(`#${id}> li`).length ? `#${id} li > ` : `#${id} > `;
177
+
178
+ /**
179
+ * Global Create
180
+ *
181
+ * This function validates that the minimum required markup
182
+ * is present to create the ARIA widget(s).
183
+ * Any additional markup elements or attributes that
184
+ * do not exist in the found required markup patterns
185
+ * will be generated via this function.
186
+ */
187
+ ARIAaccordion.create = () => {
188
+ let defaultPanel = "none";
189
+
190
+ const widget = doc.querySelectorAll("[data-aria-accordion]");
191
+
192
+ idCounter += 1;
193
+
194
+ for (let i = 0; i < widget.length; i++) {
195
+ const self = widget[i];
196
+
197
+ /**
198
+ * Check for IDs and create arrays of necessary
199
+ * panels & headings for further setup functions.
200
+ */
201
+ if (!self.hasAttribute("id")) {
202
+ self.id = `acc_${idCounter}-${i}`;
203
+ }
204
+
205
+ /**
206
+ * Setup accordion classes
207
+ */
208
+ self.classList.add(widgetClass);
209
+
210
+ /**
211
+ * Get all panels & headings of an accordion pattern based
212
+ * on a specific ID > direct child selector (this will ensure
213
+ * that nested accordions don't get properties meant for
214
+ * the parent accordion, or vice-versa).
215
+ *
216
+ * If accordions are contained within an ol/ul, the selector
217
+ * needs to be different.
218
+ */
219
+ const childSelector = getChildSelector(self.id);
220
+ const panels = doc.querySelectorAll(`${childSelector}${widgetPanel}`);
221
+ const headings = doc.querySelectorAll(`${childSelector}${widgetHeading}`);
222
+
223
+ /**
224
+ * Check for options:
225
+ * data-default - is there a default opened panel?
226
+ * data-constant - should the accordion always have A panel open?
227
+ */
228
+ if (self.hasAttribute("data-default")) {
229
+ defaultPanel = self.getAttribute("data-default");
230
+ }
231
+
232
+ /**
233
+ * Accordions with a constantly open panel are not a default
234
+ * but if a data-constant attribute is used, then we need this
235
+ * to be true.
236
+ */
237
+ const constantPanel = self.hasAttribute("data-constant");
238
+
239
+ /**
240
+ * Accordions can have multiple panels open at a time,
241
+ * if they have a data-multi attribute.
242
+ */
243
+ //const multiPanel = self.hasAttribute("data-multi");
244
+
245
+ /**
246
+ * If accordion panels are meant to transition, apply this inline style.
247
+ * This is to help mitigate a quick flash of CSS being applied to the
248
+ * no-js styling, and having an unwanted transition on initial page load.
249
+ */
250
+ if (self.hasAttribute("data-transition")) {
251
+ const thesePanels = self.querySelectorAll(widgetPanel);
252
+
253
+ for (let t = 0; t < thesePanels.length; t++) {
254
+ thesePanels[t].classList.add(`${widgetPanelClass}--transition`);
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Setup Panels, Headings & Buttons
260
+ */
261
+ ARIAaccordion.setupPanels(self.id, panels, defaultPanel, constantPanel);
262
+ ARIAaccordion.setupHeadingButton(headings, constantPanel);
263
+
264
+ const triggers = doc.querySelectorAll(
265
+ `${childSelector}${widgetHeading} .${widgetTriggerClass}`
266
+ );
267
+
268
+ /**
269
+ * Now that the headings/triggers and panels are setup
270
+ * we can grab all the triggers and setup their functionality.
271
+ */
272
+ for (let t = 0; t < triggers.length; t++) {
273
+ triggers[t].addEventListener("click", ARIAaccordion.actions);
274
+ triggers[t].addEventListener("keydown", ARIAaccordion.keytrolls);
275
+ }
276
+ } // for(widget.length)
277
+ }; // ARIAaccordion.create()
278
+
279
+ ARIAaccordion.setupPanels = function (
280
+ /** @type {string} */ id,
281
+ /** @type {NodeListOf<Element>} */ panels,
282
+ /** @type {string} */ defaultPanel,
283
+ /** @type {boolean} */ constantPanel
284
+ ) {
285
+ for (let i = 0; i < panels.length; i++) {
286
+ const panel = panels[i];
287
+ const panelID = `${id}_panel_${i + 1}`;
288
+ const setPanel = defaultPanel;
289
+ const constant = constantPanel;
290
+
291
+ panel.setAttribute("id", panelID);
292
+ ariaHidden(panels[0], true);
293
+
294
+ panel.classList.add(widgetPanelClass);
295
+
296
+ /**
297
+ * Set the accordion to have the appropriately
298
+ * opened panel if a data-default value is set.
299
+ * If no value set, then no panels are open.
300
+ */
301
+ //Removing broken code...
302
+ //if (setPanel !== 'none' && parseInt(setPanel) !== NaN) {
303
+ if (setPanel !== "none" && !Number.isNaN(parseInt(setPanel))) {
304
+ const setPanelInt = parseInt(setPanel);
305
+
306
+ // if value is 1 or less
307
+ if (setPanelInt <= 1) {
308
+ ariaHidden(panels[0], false);
309
+ }
310
+
311
+ // if value is more than the number of panels, then open
312
+ // the last panel by default
313
+ else if (setPanelInt - 1 >= panels.length) {
314
+ ariaHidden(panels[panels.length - 1], false);
315
+ }
316
+
317
+ // for any other value between 2 - the last panel #, open that one
318
+ else {
319
+ ariaHidden(panels[setPanelInt - 1], false);
320
+ }
321
+ }
322
+
323
+ /**
324
+ * If an accordion is meant to have a consistently open panel,
325
+ * and a default open panel was not set (or was not set correctly),
326
+ * then run one more check.
327
+ */
328
+ // removing broken code...
329
+ // if ((constant && setPanel === "none") || parseInt(setPanel) === NaN) {
330
+ if (
331
+ constant &&
332
+ (setPanel === "none" || Number.isNaN(parseInt(setPanel)))
333
+ ) {
334
+ ariaHidden(panels[0], false);
335
+ }
336
+ }
337
+ }; // ARIAaccordion.setupPanels
338
+
339
+ ARIAaccordion.setupHeadingButton = function (
340
+ /** @type {NodeListOf<Element>} */ headings,
341
+ /** @type {boolean} */ constantPanel
342
+ ) {
343
+ for (let i = 0; i < headings.length; i++) {
344
+ const heading = headings[i];
345
+ const targetID = heading.nextElementSibling.id;
346
+ const targetState = doc
347
+ .getElementById(targetID)
348
+ .getAttribute("aria-hidden");
349
+
350
+ // setup new heading buttons
351
+ const newButton = doc.createElement("button");
352
+ const buttonText = heading.textContent;
353
+ // clear out the heading's content
354
+ heading.innerHTML = "";
355
+ // provide the heading with a class for styling
356
+ heading.classList.add(widgetHeadingClass);
357
+
358
+ newButton.setAttribute("type", "button");
359
+ newButton.setAttribute("aria-controls", targetID);
360
+ newButton.setAttribute("id", `${targetID}_trigger`);
361
+ newButton.classList.add(widgetTriggerClass);
362
+
363
+ /**
364
+ * Check the corresponding panel to see if it was set up
365
+ * to be hidden or shown by default. Add an aria-expanded
366
+ * attribute value that is appropriate.
367
+ */
368
+ if (targetState === "false") {
369
+ ariaExpanded(newButton, true);
370
+ isCurrent(newButton, true);
371
+
372
+ /**
373
+ * Check to see if this an accordion that needs a constantly
374
+ * opened panel, and if the button's target is not hidden.
375
+ */
376
+ if (constantPanel) {
377
+ newButton.setAttribute("aria-disabled", "true");
378
+ }
379
+ } else {
380
+ ariaExpanded(newButton, false);
381
+ isCurrent(newButton, false);
382
+ }
383
+
384
+ // Add the Button & previous heading text
385
+ heading.appendChild(newButton);
386
+ newButton.appendChild(doc.createTextNode(buttonText));
387
+ }
388
+ }; // ARIAaccordion.createButton
389
+
390
+ ARIAaccordion.actions = function (/** @type {Event} */ e) {
391
+ // Need to pass in if this is a multi accordion or not.
392
+ // Also need to pass in existing trigger arrays.
393
+ const thisAccordion = this.id.replace(/_panel.*$/g, "");
394
+ const thisTarget = doc.getElementById(this.getAttribute("aria-controls"));
395
+
396
+ const childSelector = getChildSelector(thisAccordion);
397
+ const thisTriggers = doc.querySelectorAll(
398
+ `${childSelector}${widgetHeading} .${widgetTriggerClass}`
399
+ );
400
+
401
+ e.preventDefault();
402
+
403
+ ARIAaccordion.togglePanel(e, thisAccordion, thisTarget, thisTriggers);
404
+ }; // ARIAaccordion.actions()
405
+
406
+ ARIAaccordion.togglePanel = function (
407
+ /** @type {Event} */ e,
408
+ /** @type {string} */ thisAccordion,
409
+ /** @type {Element} */ targetPanel,
410
+ /** @type {NodeListOf<Element>} */ triggers
411
+ ) {
412
+ const thisTrigger = /** @type {Element} */ (e.target);
413
+
414
+ // check to see if a trigger is disabled
415
+ if (thisTrigger.getAttribute("aria-disabled") !== "true") {
416
+ isCurrent(thisTrigger, true);
417
+
418
+ if (thisTrigger.getAttribute("aria-expanded") === "true") {
419
+ ariaExpanded(thisTrigger, false);
420
+ ariaHidden(targetPanel, true);
421
+ } else {
422
+ ariaExpanded(thisTrigger, true);
423
+ ariaHidden(targetPanel, false);
424
+
425
+ if (doc.getElementById(thisAccordion).hasAttribute("data-constant"))
426
+ ariaDisabled(thisTrigger, true);
427
+ }
428
+
429
+ if (
430
+ doc.getElementById(thisAccordion).hasAttribute("data-constant") ||
431
+ !doc.getElementById(thisAccordion).hasAttribute("data-multi")
432
+ ) {
433
+ // swap expanded when there is a single constant panel
434
+ for (let trigger of triggers) {
435
+ if (thisTrigger !== trigger) {
436
+ isCurrent(trigger, false);
437
+ const getID = trigger.getAttribute("aria-controls");
438
+ ariaDisabled(trigger, false);
439
+ ariaExpanded(trigger, false);
440
+ ariaHidden(doc.getElementById(getID), true);
441
+ }
442
+ }
443
+ }
444
+ }
445
+ };
446
+
447
+ ARIAaccordion.keytrolls = function (/** @type {KeyboardEvent} */ e) {
448
+ if (
449
+ /** @type {HTMLElement} */ (e.target).classList.contains(
450
+ widgetTriggerClass
451
+ )
452
+ ) {
453
+ const keyCode = e.keyCode || e.which;
454
+
455
+ // const keyUp = 38;
456
+ // const keyDown = 40;
457
+ const keyHome = 36;
458
+ const keyEnd = 35;
459
+
460
+ const thisAccordion = this.id.replace(/_panel.*$/g, "");
461
+
462
+ const childSelector = getChildSelector(thisAccordion);
463
+
464
+ /** @type {NodeListOf<HTMLElement>} */
465
+ const thisTriggers = doc.querySelectorAll(
466
+ `${childSelector}${widgetHeading} .${widgetTriggerClass}`
467
+ );
468
+
469
+ switch (keyCode) {
470
+ /**
471
+ * keyUp & keyDown are optional controls
472
+ * for accordion components.
473
+ */
474
+ // case keyUp:
475
+ // if ( doc.getElementById(thisAccordion).hasAttribute('data-up-down') ) {
476
+ // e.preventDefault();
477
+ // // optional up arrow controls
478
+ // }
479
+ // break;
480
+ // case keyDown:
481
+ // if ( doc.getElementById(thisAccordion).hasAttribute('data-up-down') ) {
482
+ // e.preventDefault();
483
+ // // optional down arrow control
484
+ // }
485
+ // break;
486
+ /**
487
+ * keyEnd/Home are optional functions that may not be inherently known
488
+ * to most users and, in the case of END, conflict with expected
489
+ * usage of that key with NVDA.
490
+ */
491
+ case keyEnd:
492
+ e.preventDefault();
493
+ thisTriggers[thisTriggers.length - 1].focus();
494
+ break;
495
+
496
+ case keyHome:
497
+ e.preventDefault();
498
+ thisTriggers[0].focus();
499
+ break;
500
+ }
501
+ }
502
+ }; // ARIAaccordion.keytrolls()
503
+
504
+ /**
505
+ * Initialize Accordion Functions
506
+ * if expanding this script, place any other
507
+ * initialize functions within here.
508
+ */
509
+ ARIAaccordion.init = function () {
510
+ ARIAaccordion.create();
511
+ };
512
+
513
+ /**
514
+ * Helper Functions
515
+ * Just to cut down on the verboseness of some declarations
516
+ */
517
+ const ariaHidden = function (
518
+ /** @type {Element} */ el,
519
+ /** @type {boolean} */ state
520
+ ) {
521
+ el.setAttribute("aria-hidden", state.toString());
522
+ };
523
+
524
+ const ariaExpanded = function (
525
+ /** @type {Element} */ el,
526
+ /** @type {boolean} */ state
527
+ ) {
528
+ el.setAttribute("aria-expanded", state.toString());
529
+ };
530
+
531
+ const ariaDisabled = function (
532
+ /** @type {Element} */ el,
533
+ /** @type {boolean} */ state
534
+ ) {
535
+ el.setAttribute("aria-disabled", state.toString());
536
+ };
537
+
538
+ const isCurrent = function (
539
+ /** @type {Element} */ el,
540
+ /** @type {boolean} */ state
541
+ ) {
542
+ el.setAttribute("data-current", state.toString());
543
+ };
544
+
545
+ // go go JavaScript
546
+ ARIAaccordion.init();
547
+ })(window, document);
548
+
549
+ //@ts-check
550
+
551
+ /* -----------------------------------------
552
+ NAVIGATION - /source/js/cagov/navigation.js
553
+ ----------------------------------------- */
554
+
555
+ /*
556
+ * ES2015 accessible accordion system, using ARIA
557
+ * Website: https://van11y.net/accessible-accordion/
558
+ * License MIT: https://github.com/nico3333fr/van11y-accessible-accordion-aria/blob/master/LICENSE
559
+ */
560
+ (() => {
561
+ /**
562
+ * @param {Object} obj
563
+ * @param {String} key
564
+ * @param {String | Number} value
565
+ */
566
+ const _defineProperty = (obj, key, value) => {
567
+ if (key in obj) {
568
+ Object.defineProperty(obj, key, {
569
+ value: value,
570
+ enumerable: true,
571
+ configurable: true,
572
+ writable: true
573
+ });
574
+ } else {
575
+ obj[key] = value;
576
+ }
577
+ return obj;
578
+ };
579
+
580
+ const loadConfig = () => {
581
+ const CACHE = {};
582
+
583
+ /**
584
+ * @param {String | Number} id
585
+ * @param {Object} config
586
+ */
587
+ const set = (id, config) => {
588
+ CACHE[id] = config;
589
+ };
590
+
591
+ /**
592
+ *
593
+ * @param {String | Number} id
594
+ */
595
+ const get = id => {
596
+ return CACHE[id];
597
+ };
598
+
599
+ /**
600
+ *
601
+ * @param {String | Number} id
602
+ */
603
+ const remove = id => {
604
+ return CACHE[id];
605
+ };
606
+
607
+ return {
608
+ set: set,
609
+ get: get,
610
+ remove: remove
611
+ };
612
+ };
613
+
614
+ const DATA_HASH_ID = "data-nav-id";
615
+
616
+ const pluginConfig = loadConfig();
617
+
618
+ /** Find an element based on an Id
619
+ * @param {String} id Id to find
620
+ * @param {String} hash hash id (not mandatory)
621
+ * @return {Element} the element with the specified id
622
+ */
623
+ const findById = (id, hash) => {
624
+ return document.querySelector(`#${id}[${DATA_HASH_ID}="${hash}"]`);
625
+ };
626
+
627
+ /**
628
+ * @param {Element} node
629
+ * @param {{}} attrs
630
+ */
631
+ const setAttributes = (node, attrs) => {
632
+ Object.keys(attrs).forEach(attribute => {
633
+ node.setAttribute(attribute, attrs[attribute]);
634
+ });
635
+ };
636
+
637
+ /** search if element is or is contained in another element with attribute data-nav-id
638
+ * @param {Element} el element (node)
639
+ * @param {String} hashId the attribute data-hashtooltip-id
640
+ * @return {String} the value of attribute data-hashtooltip-id
641
+ */
642
+ const searchParentHashId = (el, hashId) => {
643
+ let found = false;
644
+
645
+ let parentElement = el;
646
+ while (parentElement && !found) {
647
+ if (parentElement.hasAttribute(hashId)) {
648
+ return parentElement.getAttribute(hashId);
649
+ } else {
650
+ parentElement = parentElement.parentElement;
651
+ }
652
+ }
653
+ return "";
654
+ };
655
+
656
+ /**
657
+ * @param {Element} el
658
+ * @param {String} parentClass
659
+ * @param {String} hashId
660
+ */
661
+ const searchParent = (el, parentClass, hashId) => {
662
+ let found = false;
663
+
664
+ let parentElement = el;
665
+ while (parentElement && !found) {
666
+ if (
667
+ parentElement.classList.contains(parentClass) &&
668
+ parentElement.getAttribute(DATA_HASH_ID) === hashId
669
+ ) {
670
+ return parentElement.getAttribute("id");
671
+ } else {
672
+ parentElement = parentElement.parentElement;
673
+ }
674
+ }
675
+ return "";
676
+ };
677
+
678
+ const mobileView = () => {
679
+ const mobileElement = document.querySelector(
680
+ ".global-header .mobile-controls"
681
+ );
682
+
683
+ return mobileElement
684
+ ? getComputedStyle(mobileElement)["display"] !== "none"
685
+ : false;
686
+ };
687
+
688
+ /**
689
+ * @param {...any} pluginArgs
690
+ */
691
+ const plugin = (...pluginArgs) => {
692
+ // Arrow functions do not have their own arguments object.
693
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
694
+
695
+ const config =
696
+ pluginArgs.length <= 0 || pluginArgs[0] === undefined
697
+ ? {}
698
+ : pluginArgs[0];
699
+ // Finding if first-level-link has sub-nav then changing its clasee to first-level-btn
700
+ const className = "first-level-btn";
701
+
702
+ //Change all the links next to sub-navs to first-level-btn
703
+ document.querySelectorAll(".main-navigation .sub-nav").forEach(node => {
704
+ node.parentElement.querySelector("a").className = className;
705
+ });
706
+
707
+ let CONFIG = {
708
+ ACCORDION_JS: "main-navigation",
709
+ ACCORDION_JS_HEADER: className, // Assigning button class to link that has sub-nav
710
+ ACCORDION_JS_PANEL: "nav-panel",
711
+
712
+ ACCORDION_DATA_PREFIX_CLASS: "data-nav-prefix-classes",
713
+ ACCORDION_DATA_OPENED: "data-nav-opened",
714
+ ACCORDION_DATA_MULTISELECTABLE: "data-nav-multiselectable",
715
+ ACCORDION_DATA_COOL_SELECTORS: true,
716
+
717
+ ACCORDION_PREFIX_IDS: "nav",
718
+ ACCORDION_BUTTON_ID: "_tab",
719
+ ACCORDION_PANEL_ID: "_panel",
720
+
721
+ ACCORDION_STYLE: "nav",
722
+ ACCORDION_TITLE_STYLE: "has-sub-btn",
723
+ ACCORDION_HEADER_STYLE: "nav-header",
724
+ ACCORDION_PANEL_STYLE: "sub-nav",
725
+
726
+ ACCORDION_ROLE_TABLIST: "tablist",
727
+ ACCORDION_ROLE_TAB: "tab",
728
+ ACCORDION_ROLE_TABPANEL: "tabpanel",
729
+
730
+ ATTR_ROLE: "role",
731
+ ATTR_MULTISELECTABLE: "data-multiselectable",
732
+ ATTR_EXPANDED: "aria-expanded",
733
+ ATTR_LABELLEDBY: "aria-labelledby",
734
+ ATTR_HIDDEN: "aria-hidden",
735
+ ATTR_CONTROLS: "aria-controls",
736
+ ATTR_SELECTED: "aria-selected"
737
+ };
738
+
739
+ CONFIG = Object.assign(CONFIG, config);
740
+
741
+ const HASH_ID = Math.random().toString(32).slice(2, 12);
742
+
743
+ pluginConfig.set(HASH_ID, CONFIG);
744
+
745
+ // Find all accordions inside a container
746
+ /**
747
+ * @param {Element[]} listAccordionArgs
748
+ */
749
+ const listAccordions = listAccordionArgs => {
750
+ // Arrow functions do not have their own arguments object.
751
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
752
+
753
+ const node =
754
+ listAccordionArgs.length <= 0
755
+ ? document.documentElement
756
+ : listAccordionArgs[0];
757
+
758
+ return /** @type {Element[]} */ (
759
+ [].slice.call(node.querySelectorAll(`.${CONFIG.ACCORDION_JS}`))
760
+ );
761
+ };
762
+
763
+ // Build accordions for a container
764
+ /**
765
+ * @param {...Element} node
766
+ */
767
+ const attach = (...node) => {
768
+ listAccordions(node).forEach(accordion_node => {
769
+ const iLisible = `z${Math.random().toString(32).slice(2, 12)}`; // avoid selector exception when starting by a number
770
+
771
+ const prefixClassName = accordion_node.hasAttribute(
772
+ CONFIG.ACCORDION_DATA_PREFIX_CLASS
773
+ )
774
+ ? `${accordion_node.getAttribute(
775
+ CONFIG.ACCORDION_DATA_PREFIX_CLASS
776
+ )}-`
777
+ : "";
778
+
779
+ const coolSelectors = CONFIG.ACCORDION_DATA_COOL_SELECTORS;
780
+ const childClassName = "first-level-btn";
781
+
782
+ // Init attributes accordion
783
+ accordion_node.setAttribute(
784
+ CONFIG.ATTR_MULTISELECTABLE,
785
+ mobileView() ? "true" : "false"
786
+ );
787
+
788
+ accordion_node.setAttribute(DATA_HASH_ID, HASH_ID);
789
+ accordion_node.classList.add(prefixClassName + CONFIG.ACCORDION_STYLE);
790
+
791
+ /** @type {Element[]} */
792
+ const listAccordionsHeader = [].slice.call(
793
+ accordion_node.querySelectorAll(`.${childClassName}`)
794
+ );
795
+ listAccordionsHeader.forEach((header_node, index_header) => {
796
+ let _setAttributes2, _setAttributes3;
797
+
798
+ // if we do not have cool selectors enabled,
799
+ // it is not a direct child, we ignore it
800
+ if (header_node.parentNode !== accordion_node && !coolSelectors) {
801
+ return;
802
+ }
803
+
804
+ const indexHeaderLisible = index_header + 1;
805
+ const accordionPanel = header_node.nextElementSibling;
806
+ const accordionHeaderText = header_node.innerHTML;
807
+ const accordionButton = document.createElement("BUTTON");
808
+ const accordionOpenedAttribute = header_node.hasAttribute(
809
+ CONFIG.ACCORDION_DATA_OPENED
810
+ )
811
+ ? header_node.getAttribute(CONFIG.ACCORDION_DATA_OPENED)
812
+ : "";
813
+
814
+ // set button with attributes
815
+ accordionButton.innerHTML = accordionHeaderText;
816
+ accordionButton.classList.add(
817
+ childClassName,
818
+ prefixClassName + CONFIG.ACCORDION_HEADER_STYLE
819
+ );
820
+ setAttributes(
821
+ accordionButton,
822
+ ((_setAttributes2 = {}),
823
+ _defineProperty(
824
+ _setAttributes2,
825
+ "id",
826
+ CONFIG.ACCORDION_PREFIX_IDS +
827
+ iLisible +
828
+ CONFIG.ACCORDION_BUTTON_ID +
829
+ indexHeaderLisible
830
+ ),
831
+ _defineProperty(
832
+ _setAttributes2,
833
+ CONFIG.ATTR_CONTROLS,
834
+ CONFIG.ACCORDION_PREFIX_IDS +
835
+ iLisible +
836
+ CONFIG.ACCORDION_PANEL_ID +
837
+ indexHeaderLisible
838
+ ),
839
+ _defineProperty(_setAttributes2, DATA_HASH_ID, HASH_ID),
840
+ _setAttributes2)
841
+ );
842
+
843
+ // place button
844
+ header_node.innerHTML = "";
845
+ header_node.appendChild(accordionButton);
846
+
847
+ // set title with attributes
848
+ header_node.classList.add(
849
+ prefixClassName + CONFIG.ACCORDION_TITLE_STYLE
850
+ );
851
+ header_node.classList.remove(childClassName);
852
+
853
+ // set attributes to panels
854
+ accordionPanel.classList.add(
855
+ prefixClassName + CONFIG.ACCORDION_PANEL_STYLE
856
+ );
857
+ setAttributes(
858
+ accordionPanel,
859
+ ((_setAttributes3 = {}),
860
+ _defineProperty(
861
+ _setAttributes3,
862
+ CONFIG.ATTR_ROLE,
863
+ CONFIG.ACCORDION_ROLE_TABPANEL
864
+ ),
865
+ _defineProperty(
866
+ _setAttributes3,
867
+ CONFIG.ATTR_LABELLEDBY,
868
+ CONFIG.ACCORDION_PREFIX_IDS +
869
+ iLisible +
870
+ CONFIG.ACCORDION_BUTTON_ID +
871
+ indexHeaderLisible
872
+ ),
873
+ _defineProperty(
874
+ _setAttributes3,
875
+ "id",
876
+ CONFIG.ACCORDION_PREFIX_IDS +
877
+ iLisible +
878
+ CONFIG.ACCORDION_PANEL_ID +
879
+ indexHeaderLisible
880
+ ),
881
+ _defineProperty(_setAttributes3, DATA_HASH_ID, HASH_ID),
882
+ _setAttributes3)
883
+ );
884
+
885
+ if (accordionOpenedAttribute === "true") {
886
+ accordionButton.setAttribute(CONFIG.ATTR_EXPANDED, "true");
887
+ header_node.removeAttribute(CONFIG.ACCORDION_DATA_OPENED);
888
+ accordionPanel.setAttribute(CONFIG.ATTR_HIDDEN, "false");
889
+ accordionPanel
890
+ .querySelectorAll(".second-level-link")
891
+ .forEach(item => {
892
+ item.removeAttribute("tabindex");
893
+ });
894
+ } else {
895
+ accordionButton.setAttribute(CONFIG.ATTR_EXPANDED, "false");
896
+ accordionPanel.setAttribute(CONFIG.ATTR_HIDDEN, "true");
897
+ // making sure all second level links are not tabable
898
+ accordionPanel
899
+ .querySelectorAll(".second-level-link")
900
+ .forEach(item => {
901
+ item.setAttribute("tabindex", "-1");
902
+ });
903
+ }
904
+ });
905
+ });
906
+ };
907
+
908
+ return {
909
+ attach: attach
910
+ };
911
+ };
912
+
913
+ const main = function main() {
914
+ /* listeners for all configs */
915
+ ["click", "keydown", "focus"].forEach(eventName => {
916
+ document.body.addEventListener(
917
+ eventName,
918
+ e => {
919
+ const hashId = searchParentHashId(
920
+ /** @type {Element} */ (e.target),
921
+ DATA_HASH_ID
922
+ );
923
+ // search if click on button or on element in a button contains data-hash-id (it is needed to load config and know which class to search)
924
+
925
+ if (hashId !== "") {
926
+ (() => {
927
+ // loading config from element
928
+ const CONFIG = pluginConfig.get(hashId);
929
+
930
+ // click on button
931
+ if (
932
+ /** @type {Element} */ (e.target).classList.contains(
933
+ "first-level-btn"
934
+ ) &&
935
+ eventName === "click"
936
+ ) {
937
+ (() => {
938
+ const buttonTag = /** @type {HTMLInputElement} */ (e.target);
939
+ const accordionContainer = findById(
940
+ searchParent(buttonTag, CONFIG.ACCORDION_JS, hashId),
941
+ hashId
942
+ );
943
+ const coolSelectors =
944
+ CONFIG.ACCORDION_DATA_COOL_SELECTORS === true;
945
+
946
+ /**@type {Element[]} */
947
+ let accordionAllHeaders = [].slice.call(
948
+ accordionContainer.querySelectorAll(".first-level-btn")
949
+ );
950
+
951
+ const destination = findById(
952
+ buttonTag.getAttribute(CONFIG.ATTR_CONTROLS),
953
+ hashId
954
+ );
955
+ const stateButton = buttonTag.getAttribute(
956
+ CONFIG.ATTR_EXPANDED
957
+ );
958
+
959
+ if (!coolSelectors) {
960
+ accordionAllHeaders = accordionAllHeaders.filter(
961
+ element =>
962
+ element.parentNode.parentNode === accordionContainer
963
+ );
964
+ }
965
+
966
+ // if closed
967
+ if (stateButton === "false") {
968
+ buttonTag.setAttribute(CONFIG.ATTR_EXPANDED, "true");
969
+ destination.removeAttribute(CONFIG.ATTR_HIDDEN);
970
+ destination.classList.add("open");
971
+ // making second level links tabbable if sub nav panel is opened
972
+ destination
973
+ .querySelectorAll(".second-level-link")
974
+ .forEach(item => item.removeAttribute("tabindex"));
975
+ } else {
976
+ buttonTag.setAttribute(CONFIG.ATTR_EXPANDED, "false");
977
+ destination.setAttribute(CONFIG.ATTR_HIDDEN, "true");
978
+ destination.classList.remove("open");
979
+ // adding tabindex to links to make sure they are not tabable if sub nav panel is closed
980
+ destination
981
+ .querySelectorAll(".second-level-link")
982
+ .forEach(item => item.setAttribute("tabindex", "-1"));
983
+ }
984
+
985
+ if (!mobileView()) {
986
+ accordionAllHeaders.forEach(header_node => {
987
+ //Close all the other panels
988
+
989
+ const destinationPanel = findById(
990
+ header_node.getAttribute(CONFIG.ATTR_CONTROLS),
991
+ hashId
992
+ );
993
+
994
+ if (header_node !== buttonTag) {
995
+ header_node.setAttribute(CONFIG.ATTR_EXPANDED, "false");
996
+ destinationPanel.classList.remove("open");
997
+
998
+ //Added fix to make closed panels non-tabbable
999
+ destinationPanel
1000
+ .querySelectorAll(".second-level-link")
1001
+ .forEach(item => item.setAttribute("tabindex", "-1"));
1002
+ }
1003
+ });
1004
+ }
1005
+
1006
+ setTimeout(() => {
1007
+ buttonTag.focus();
1008
+ }, 0);
1009
+ e.stopPropagation(); // making icons and other buttons elements clickable https://css-tricks.com/slightly-careful-sub-elements-clickable-things/
1010
+ e.preventDefault();
1011
+ })();
1012
+ }
1013
+ })();
1014
+ }
1015
+ },
1016
+ true
1017
+ );
1018
+ });
1019
+
1020
+ return plugin;
1021
+ };
1022
+
1023
+ // @ts-ignore
1024
+ window.van11yAccessibleAccordionAria = main();
1025
+
1026
+ const onLoad = function onLoad() {
1027
+ // @ts-ignore
1028
+ const expand_default = window.van11yAccessibleAccordionAria();
1029
+ expand_default.attach();
1030
+
1031
+ document.removeEventListener("DOMContentLoaded", onLoad);
1032
+ };
1033
+
1034
+ document.addEventListener("DOMContentLoaded", onLoad);
1035
+
1036
+ function NavReset() {
1037
+ //RESET
1038
+ document
1039
+ .querySelectorAll(".first-level-btn")
1040
+ .forEach(el => el.setAttribute("aria-expanded", "false"));
1041
+ document.querySelectorAll(".sub-nav").forEach(el => {
1042
+ el.setAttribute("aria-hidden", "true");
1043
+ el.classList.remove("open");
1044
+ });
1045
+ document
1046
+ .querySelectorAll(".second-level-link")
1047
+ .forEach(el => el.setAttribute("tabindex", "-1"));
1048
+
1049
+ if (window.innerWidth <= 991) {
1050
+ document
1051
+ .querySelectorAll(".rotate")
1052
+ .forEach(
1053
+ (/**@type {HTMLElement} */ el) => (el.style.display = "block")
1054
+ );
1055
+ } else {
1056
+ document
1057
+ .querySelectorAll(".rotate")
1058
+ .forEach((/**@type {HTMLElement} */ el) => (el.style.display = "none"));
1059
+ const nav = document.querySelector("#navigation");
1060
+ nav.removeAttribute("aria-hidden");
1061
+ }
1062
+ }
1063
+
1064
+ const isDocumentReady = (
1065
+ /** @type {{ (): void; (this: Document, ev: Event): any; }} */ callbackFunction
1066
+ ) => {
1067
+ if (document.readyState != "loading") callbackFunction();
1068
+ else document.addEventListener("DOMContentLoaded", callbackFunction);
1069
+ };
1070
+
1071
+ // Remove href if <a> has a link
1072
+ isDocumentReady(() => {
1073
+ const navigationJS = document.querySelector(".main-navigation");
1074
+
1075
+ const subnavbtnJS = document.querySelectorAll(
1076
+ ".main-navigation .nav-item a.has-sub-btn"
1077
+ );
1078
+ subnavbtnJS.forEach(item => {
1079
+ // Change <a> tag to div since you can't place button into <a> tag
1080
+ const newDiv = document.createElement("div");
1081
+ newDiv.innerHTML = item.innerHTML;
1082
+ newDiv.classList.add("has-sub-btn");
1083
+ item.replaceWith(newDiv);
1084
+ });
1085
+
1086
+ const singleLevel = navigationJS.classList.contains("singleLevel");
1087
+ const setActiveLinkByFolder =
1088
+ navigationJS.classList.contains("auto-highlight");
1089
+
1090
+ const navItemsJS = document.querySelectorAll(".main-navigation .nav-item");
1091
+
1092
+ const navItemsWithSubsJS = /** @type {Element[]} */ (
1093
+ [].slice.call(navItemsJS)
1094
+ ).filter(x => x.querySelector(".sub-nav"));
1095
+
1096
+ navItemsJS.forEach(navItem => {
1097
+ const link = navItem.querySelector(".first-level-btn, .first-level-link");
1098
+
1099
+ if (setActiveLinkByFolder && link.getAttribute("href")) {
1100
+ const arrNavLink = link.getAttribute("href").split("/");
1101
+ const arrCurrentURL = location.href.split("/");
1102
+
1103
+ if (arrNavLink.length > 4 && arrCurrentURL[3] === arrNavLink[3]) {
1104
+ // folder of current URL matches this nav link
1105
+ navItem.classList.add("active");
1106
+ }
1107
+ }
1108
+ });
1109
+
1110
+ // Reset if click outside of nav
1111
+ document.addEventListener("mouseup", e => {
1112
+ const navContainer = document.querySelector(".main-navigation");
1113
+
1114
+ // if the target of the click isn't the navigation container nor a descendant of the navigation
1115
+ if (
1116
+ navContainer !== e.target &&
1117
+ !navContainer.contains(/**@type {Node} */ (e.target))
1118
+ ) {
1119
+ NavReset();
1120
+ }
1121
+ });
1122
+
1123
+ // Nav items with subs
1124
+ navItemsWithSubsJS.forEach(el => {
1125
+ const itemCount = el.querySelectorAll(".second-level-nav > li").length;
1126
+ if (itemCount <= 2) {
1127
+ const subnav = el.querySelector(".sub-nav");
1128
+ subnav.classList.add("with-few-items");
1129
+ }
1130
+ });
1131
+
1132
+ // Add class has-sub, then add carrots
1133
+ if (!singleLevel) {
1134
+ document.querySelectorAll(".first-level-btn").forEach(el => {
1135
+ el.classList.add("has-sub");
1136
+
1137
+ const carrot = document.createElement("span");
1138
+ carrot.classList.add("ca-gov-icon-caret-down", "carrot");
1139
+ carrot.setAttribute("aria-hidden", "true");
1140
+
1141
+ const toggleSubNav = document.createElement("div");
1142
+ toggleSubNav.classList.add("ca-gov-icon-caret-right", "rotate");
1143
+ toggleSubNav.setAttribute("aria-hidden", "true");
1144
+ toggleSubNav.style.display = mobileView() ? "block" : "none";
1145
+
1146
+ el.appendChild(toggleSubNav);
1147
+ el.appendChild(carrot);
1148
+ });
1149
+ }
1150
+ });
1151
+
1152
+ // Do Navigation Reset function on window resize uless it's mobile device.
1153
+ window.addEventListener("resize", () => {
1154
+ document
1155
+ .querySelector(".toggle-menu")
1156
+ .setAttribute("aria-expanded", "false");
1157
+
1158
+ //Collapse the nav when narrow
1159
+ const nav = document.querySelector("#navigation");
1160
+ nav.classList.remove("show");
1161
+ nav.setAttribute("aria-hidden", "true");
1162
+
1163
+ NavReset();
1164
+ });
1165
+
1166
+ // Reset on escape
1167
+ document.addEventListener("keyup", e => {
1168
+ // keyCode has been deprecated
1169
+ // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
1170
+ if (e.key === "Escape") {
1171
+ NavReset();
1172
+ }
1173
+ });
1174
+
1175
+ // Add bold to current subnav link
1176
+ const addActive = () => {
1177
+ /** @type {NodeListOf<HTMLAnchorElement>} */
1178
+ const activeLink = document.querySelectorAll(".second-level-link"),
1179
+ len = activeLink.length,
1180
+ full_path = location.href.split("#")[0]; //Ignore hashes?
1181
+
1182
+ // Loop through each link.
1183
+ for (let i = 0; i < len; i++) {
1184
+ if (activeLink[i].href.split("#")[0] == full_path) {
1185
+ activeLink[i].className += " bold";
1186
+ }
1187
+ }
1188
+ };
1189
+ addActive();
1190
+ })();
1191
+
1192
+ //@ts-check
1193
+ /* -----------------------------------------
1194
+ SEARCH - /source/js/cagov/search.js
1195
+ ----------------------------------------- */
1196
+ (() => {
1197
+ /** @type {HTMLInputElement} */
1198
+ const searchText = document.querySelector(".search-textfield"); // search textfield, unique
1199
+ const searchInput = document.querySelector(
1200
+ "#head-search #Search .search-textfield"
1201
+ ); // search textfield -- same as searchText ?
1202
+
1203
+ const searchSubmit = document.querySelector(
1204
+ "#head-search #Search .gsc-search-button"
1205
+ ); // search button, unique
1206
+
1207
+ const searchReset = document.querySelector(
1208
+ "#head-search #Search .close-search"
1209
+ ); // hide search form on subpages, unique
1210
+
1211
+ const searchContainer = document.querySelector("#head-search"); // contains the search form
1212
+ const featuredsearch = searchContainer?.classList.contains("featured-search"); // only exists on the home page (featured search) layout, and /sample/navigation-full-width-utility.html
1213
+ const searchactive = searchContainer?.classList.contains("active"); // "active" is applied on subpages when search form is visible
1214
+
1215
+ const searchlabel = document.querySelector("#SearchInput"); // label for textfield
1216
+
1217
+ /** @type {HTMLElement} */
1218
+ const searchbox = document.querySelector(
1219
+ ".search-container:not(.featured-search)"
1220
+ ); // only on subpages, unique, same as #head-search
1221
+
1222
+ // header, contains nav, search form, etc, unique
1223
+ const headerHeight = /** @type {HTMLElement} */ (
1224
+ document.querySelector(".global-header")
1225
+ ).offsetHeight; // header height
1226
+
1227
+ /** @type {HTMLElement} */
1228
+ const utility = document.querySelector(".utility-header"); // utility header, unique
1229
+ const utilityHeight = utility?.offsetHeight || 0;
1230
+ // utility header height
1231
+
1232
+ /** @type {NodeListOf<HTMLElement>} */
1233
+ const alertBanner = document.querySelectorAll(".alert-banner"); // page can have multiple
1234
+
1235
+ let alertbannerHeight = 0;
1236
+ // taking into account multiple alert banners
1237
+ alertBanner.forEach(oneBanner => {
1238
+ alertbannerHeight += oneBanner.offsetHeight;
1239
+ });
1240
+
1241
+ //const fullnav = document.querySelector(".top-level-nav"); // navigation ul tag, unique
1242
+
1243
+ // contains navigation and search form, unique
1244
+ // Full width navigation
1245
+ const navigationHeight = document
1246
+ .querySelector(".navigation-search")
1247
+ .classList.contains("full-width-nav")
1248
+ ? 82
1249
+ : 0;
1250
+
1251
+ const body = document.querySelector("body");
1252
+
1253
+ window.addEventListener("load", () => {
1254
+ if (searchText) {
1255
+ // Unfreeze search width when blured.
1256
+ const unfreezeSearchWidth = () => {
1257
+ searchContainer.classList.remove("focus");
1258
+ document.querySelector(".search-container").classList.add("focus"); // search-container is unique
1259
+ };
1260
+ searchText.addEventListener("blur", unfreezeSearchWidth, false);
1261
+ searchText.addEventListener("focus", unfreezeSearchWidth, false);
1262
+ const chgHandler = function () {
1263
+ if (this.value) {
1264
+ body.classList.add("active-search");
1265
+ }
1266
+ };
1267
+ searchText.addEventListener("change", chgHandler, false);
1268
+ searchText.addEventListener("keyup", chgHandler, false);
1269
+ searchText.addEventListener("paste", chgHandler, false);
1270
+ }
1271
+
1272
+ if (!featuredsearch) {
1273
+ // added aria expaned attr for accessibility
1274
+ const firstLevelBtn = document.querySelector("button.first-level-link");
1275
+ if (firstLevelBtn) firstLevelBtn.setAttribute("aria-expanded", "false");
1276
+ }
1277
+
1278
+ // search box top position
1279
+ // TODO: Really close to searchTop() except for top size
1280
+ if (!mobileView_for_search()) {
1281
+ // calulation search box top position
1282
+ const searchtop =
1283
+ headerHeight - utilityHeight - alertbannerHeight - navigationHeight;
1284
+ if (!mobileView_for_search() && searchbox) {
1285
+ searchbox.style.top = `${Math.max(searchtop, 82)}px`;
1286
+ }
1287
+ }
1288
+
1289
+ // have the close button remove search results and the applied classes
1290
+ //resultsContainer.find('.close').on('click', removeSearchResults);
1291
+ const resContainClose = document.querySelector(
1292
+ ".search-results-container .close"
1293
+ );
1294
+ if (resContainClose)
1295
+ resContainClose.addEventListener("click", removeSearchResults, false);
1296
+
1297
+ //searchContainer.find('.close').on('click', removeSearchResults);
1298
+ const hsClose = document.querySelector("#head-search .close");
1299
+ if (hsClose) hsClose.addEventListener("click", removeSearchResults, false);
1300
+
1301
+ // Our special nav icon which we need to hook into for starting the search
1302
+ // $('#nav-item-search')
1303
+
1304
+ // so instead we are binding to what I'm assuming will always be the search
1305
+ const searchButton = document.querySelector("#nav-item-search");
1306
+ if (searchButton) {
1307
+ searchButton.addEventListener(
1308
+ "click",
1309
+ function (e) {
1310
+ e.preventDefault();
1311
+ searchText.focus();
1312
+
1313
+ if (
1314
+ !featuredsearch &&
1315
+ document.querySelector(".search-container:not(.featured-search)")
1316
+ ) {
1317
+ document
1318
+ .querySelector(".search-container:not(.featured-search)")
1319
+ .classList.toggle("active");
1320
+ }
1321
+
1322
+ // hide Search form if it's not active
1323
+ if (searchactive) {
1324
+ // added aria expanded attr for accessibility
1325
+ this.querySelector("button").setAttribute("aria-expanded", "true");
1326
+ removeSearchAttr();
1327
+ } else {
1328
+ // added aria expaned attr for accessibility
1329
+ this.querySelector("button").setAttribute("aria-expanded", "false");
1330
+ setSearchAttr();
1331
+ }
1332
+
1333
+ if (featuredsearch) removeSearchAttr();
1334
+
1335
+ // let the user know the input box is where they should search
1336
+ searchContainer.classList.add("play-animation");
1337
+ searchContainer.addEventListener("animationend", () => {
1338
+ this.classList.remove("play-animation");
1339
+ });
1340
+ },
1341
+ false
1342
+ );
1343
+ }
1344
+
1345
+ // Close search when close icon is clicked
1346
+ if (searchReset) searchReset.addEventListener("click", removeSearchResults);
1347
+
1348
+ function removeSearchResults() {
1349
+ body.classList.remove("active-search");
1350
+ searchText.value = "";
1351
+ searchContainer.classList.remove("active");
1352
+ searchContainer.setAttribute("aria-hidden", "true");
1353
+
1354
+ const resultsContainer = document.querySelector(
1355
+ ".search-results-container"
1356
+ );
1357
+ if (resultsContainer) {
1358
+ resultsContainer.classList.remove("visible");
1359
+ }
1360
+
1361
+ document
1362
+ .querySelectorAll(".ask-group")
1363
+ .forEach(a => a.classList.remove("fade-out"));
1364
+
1365
+ if (!featuredsearch) {
1366
+ // added aria expaned attr for accessibility
1367
+ document
1368
+ .querySelector("button.first-level-link")
1369
+ .setAttribute("aria-expanded", "false");
1370
+ setSearchAttr();
1371
+ }
1372
+ // fire a scroll event to help update headers if need be
1373
+ window.dispatchEvent(new CustomEvent("scroll"));
1374
+
1375
+ // document.dispatchEvent('cagov.searchresults.hide'); // ???
1376
+
1377
+ if (mobileView_for_search()) {
1378
+ ariaHidden();
1379
+ }
1380
+ }
1381
+
1382
+ function removeSearchAttr() {
1383
+ if (searchInput) {
1384
+ searchInput.removeAttribute("tabindex");
1385
+ searchInput.removeAttribute("aria-hidden");
1386
+ }
1387
+ if (searchSubmit) {
1388
+ searchSubmit.removeAttribute("tabindex");
1389
+ searchSubmit.removeAttribute("aria-hidden");
1390
+ }
1391
+ if (searchReset) {
1392
+ searchReset.removeAttribute("tabindex");
1393
+ searchReset.removeAttribute("aria-hidden");
1394
+ }
1395
+ if (searchlabel) searchlabel.removeAttribute("aria-hidden");
1396
+
1397
+ if (searchContainer) searchContainer.removeAttribute("aria-hidden");
1398
+ }
1399
+
1400
+ function setSearchAttr() {
1401
+ if (searchInput) {
1402
+ searchInput.setAttribute("tabindex", "-1");
1403
+ searchInput.setAttribute("aria-hidden", "true");
1404
+ }
1405
+ if (searchSubmit) {
1406
+ searchSubmit.setAttribute("tabindex", "-1");
1407
+ searchSubmit.setAttribute("aria-hidden", "true");
1408
+ }
1409
+ if (searchReset) {
1410
+ searchReset.setAttribute("tabindex", "-1");
1411
+ searchReset.setAttribute("aria-hidden", "true");
1412
+ }
1413
+ if (searchlabel) searchlabel.setAttribute("aria-hidden", "true");
1414
+
1415
+ if (searchContainer) searchContainer.setAttribute("aria-hidden", "true");
1416
+ }
1417
+
1418
+ // Make Search form tabable if it's featured
1419
+ if (searchContainer) {
1420
+ if (searchContainer.classList.contains("featured-search")) {
1421
+ removeSearchAttr();
1422
+ } else {
1423
+ setSearchAttr();
1424
+ }
1425
+ }
1426
+
1427
+ // on alert close event
1428
+ document.querySelectorAll(".alert-banner .close").forEach(oneClose => {
1429
+ oneClose.addEventListener("click", searchTop);
1430
+ });
1431
+
1432
+ ariaHidden();
1433
+ });
1434
+
1435
+ // Calculation search box top property on the scroll for the fixed nav
1436
+ window.addEventListener("scroll", () => {
1437
+ if (!mobileView_for_search()) {
1438
+ // setting timeout before calculating the search box top property otherwise it can take into account transitional values.
1439
+ setTimeout(searchTop, 400);
1440
+
1441
+ // remove featured search on scroll in desktop
1442
+ const FeaturedSearch = document.querySelector("nav ~ #head-search");
1443
+ if (
1444
+ document.body.scrollTop >= 100 ||
1445
+ document.documentElement.scrollTop >= 100
1446
+ ) {
1447
+ if (FeaturedSearch) {
1448
+ FeaturedSearch.classList.add("hidden-up");
1449
+ }
1450
+ } else if (FeaturedSearch) {
1451
+ FeaturedSearch.classList.remove("hidden-up");
1452
+ }
1453
+ }
1454
+ });
1455
+
1456
+ // search box top position if browser window is resized
1457
+ window.addEventListener("resize", () => {
1458
+ searchTop();
1459
+ ariaHidden();
1460
+ });
1461
+
1462
+ function searchTop() {
1463
+ // calulation search box top position
1464
+ const searchtop =
1465
+ headerHeight - utilityHeight - alertbannerHeight - navigationHeight;
1466
+ if (!mobileView_for_search() && searchbox) {
1467
+ searchbox.style.top = `${Math.max(searchtop, 55)}px`;
1468
+ }
1469
+ }
1470
+
1471
+ function ariaHidden() {
1472
+ if (searchContainer) {
1473
+ if (featuredsearch) {
1474
+ searchContainer.removeAttribute("aria-hidden");
1475
+ document.querySelector("[name='q']").removeAttribute("tabindex");
1476
+ document
1477
+ .querySelector(".gsc-search-button")
1478
+ .removeAttribute("tabindex");
1479
+ } else {
1480
+ searchContainer.setAttribute("aria-hidden", "true");
1481
+ }
1482
+ }
1483
+ }
1484
+
1485
+ const mobileView_for_search = () => {
1486
+ const mobileElement = document.querySelector(
1487
+ ".global-header .mobile-controls"
1488
+ );
1489
+
1490
+ if (mobileElement) {
1491
+ return getComputedStyle(mobileElement)["display"] !== "none";
1492
+ } else {
1493
+ return false; // or whatever is supposed to be returned when there is no header
1494
+ }
1495
+ };
1496
+ })(); // call out the function on the page load
1497
+
1498
+ //@ts-check
1499
+ /* -----------------------------------------
1500
+ SOURCE CODE
1501
+ /source/js/cagov/sourcecode.js
1502
+ ----------------------------------------- */
1503
+
1504
+ // Displaying HTML Source code in HTML Page
1505
+
1506
+ const entityMap = {
1507
+ "&": "&amp;",
1508
+ "<": "&lt;",
1509
+ ">": "&gt;",
1510
+ '"': "&quot;",
1511
+ "'": "&#39;",
1512
+ "/": "&#x2F;"
1513
+ };
1514
+
1515
+ const escapeHtml = (/** @type {string} */ string) =>
1516
+ string.replace(/[&<>"'/]/g, s => entityMap[s]);
1517
+
1518
+ function copyCode(/** @type {Element} */ btnElem) {
1519
+ const codeblock = btnElem.previousElementSibling;
1520
+ if (codeblock) {
1521
+ // copy the text
1522
+ if (codeblock.tagName.toLowerCase() == "pre") {
1523
+ navigator.clipboard.writeText(codeblock.querySelector("code").innerText);
1524
+ } else {
1525
+ //TextArea
1526
+ navigator.clipboard.writeText(
1527
+ /** @type { HTMLTextAreaElement} */ (codeblock).value
1528
+ );
1529
+ }
1530
+ // select the text
1531
+ const range = document.createRange();
1532
+ range.selectNode(codeblock);
1533
+ window.getSelection().removeAllRanges();
1534
+ window.getSelection().addRange(range);
1535
+ // replace the button icon
1536
+ //btnElem.querySelector("span").classList.remove("ca-gov-icon-copy");
1537
+ //btnElem.querySelector("span").classList.add("ca-gov-icon-check-mark");
1538
+ btnElem.innerHTML =
1539
+ '<span class="ca-gov-icon-check-mark"></span> Code copied';
1540
+ }
1541
+ }
1542
+
1543
+ window.addEventListener("load", () => {
1544
+ const codeblock = document.querySelectorAll("pre code, textarea.sourcecode");
1545
+
1546
+ for (let i = 0, len = codeblock.length; i < len; i++) {
1547
+ const dom = codeblock[i];
1548
+ if (dom.tagName.toLowerCase() == "code") {
1549
+ let html = dom.innerHTML;
1550
+ html = escapeHtml(html);
1551
+ dom.innerHTML = html;
1552
+ }
1553
+ // Create a 'copy code' button, insert it after the <pre> tag
1554
+ const newDiv = document.createElement("button");
1555
+ newDiv.onclick = function () {
1556
+ copyCode(/** @type {HTMLElement} */ (this));
1557
+ };
1558
+ newDiv.classList.add("btn", "btn-outline-primary");
1559
+ newDiv.innerHTML = "<span class='ca-gov-icon-copy'></span> Copy code";
1560
+ if (dom.tagName.toLowerCase() == "code") {
1561
+ dom.parentElement.after(newDiv);
1562
+ } else {
1563
+ dom.after(newDiv);
1564
+ }
1565
+ }
1566
+ });
1567
+
1568
+ //@ts-check
1569
+
1570
+ /* -----------------------------------------
1571
+ TABS -- custom accessible tabs
1572
+ ----------------------------------------- */
1573
+
1574
+ (function () {
1575
+ // Get relevant elements and collections
1576
+ const allTabs = document.querySelectorAll(".tabs");
1577
+ allTabs.forEach(tabbed => {
1578
+ const tablist = tabbed.querySelector("ul");
1579
+ const tabs = tablist.querySelectorAll("a");
1580
+ /** @type {NodeListOf<HTMLElement>} */
1581
+ const panels = tabbed.querySelectorAll('[id^="section"]');
1582
+
1583
+ // The tab switching function
1584
+ /**
1585
+ *
1586
+ * @param {Element} oldTab
1587
+ * @param {HTMLElement} newTab
1588
+ */
1589
+ const switchTab = (oldTab, newTab) => {
1590
+ newTab.focus();
1591
+ // Make the active tab focusable by the user (Tab key)
1592
+ newTab.removeAttribute("tabindex");
1593
+ // Set the selected state
1594
+ newTab.setAttribute("aria-selected", "true");
1595
+ oldTab.removeAttribute("aria-selected");
1596
+ oldTab.setAttribute("tabindex", "-1");
1597
+ // Get the indices of the new and old tabs to find the correct
1598
+ // tab panels to show and hide
1599
+ const index = Array.prototype.indexOf.call(tabs, newTab);
1600
+ const oldIndex = Array.prototype.indexOf.call(tabs, oldTab);
1601
+ panels[oldIndex].hidden = true;
1602
+ panels[index].hidden = false;
1603
+ };
1604
+
1605
+ // Add the tablist role to the first <ul> in the .tabbed container
1606
+ tablist.setAttribute("role", "tablist");
1607
+
1608
+ // Add semantics are remove user focusability for each tab
1609
+
1610
+ tabs.forEach((tab, i) => {
1611
+ tab.setAttribute("role", "tab");
1612
+ tab.setAttribute("tabindex", "-1");
1613
+ /** @type {Element} */ (tab.parentNode).setAttribute(
1614
+ "role",
1615
+ "presentation"
1616
+ );
1617
+
1618
+ // Handle clicking of tabs for mouse users
1619
+ tab.addEventListener("click", e => {
1620
+ e.preventDefault();
1621
+ const currentTab = tablist.querySelector("[aria-selected]");
1622
+ if (e.currentTarget !== currentTab) {
1623
+ switchTab(currentTab, /** @type {HTMLElement} */ (e.currentTarget));
1624
+ }
1625
+ });
1626
+
1627
+ // Handle keydown events for keyboard users
1628
+ tab.addEventListener("keydown", e => {
1629
+ // Get the index of the current tab in the tabs node list
1630
+ const index = Array.prototype.indexOf.call(tabs, e.currentTarget);
1631
+ // Work out which key the user is pressing and
1632
+ // Calculate the new tab's index where appropriate
1633
+ const dir = ["ArrowLeft", "Left"].includes(e.key)
1634
+ ? index - 1
1635
+ : ["ArrowRight", "Right"].includes(e.key)
1636
+ ? index + 1
1637
+ : ["ArrowDown", "Down"].includes(e.key)
1638
+ ? "down"
1639
+ : null;
1640
+ if (dir !== null) {
1641
+ e.preventDefault();
1642
+ // If the down key is pressed, move focus to the open panel,
1643
+ // otherwise switch to the adjacent tab
1644
+ dir === "down"
1645
+ ? panels[i].focus()
1646
+ : tabs[dir]
1647
+ ? switchTab(/** @type {Element} */ (e.currentTarget), tabs[dir])
1648
+ : void 0;
1649
+ }
1650
+ });
1651
+ });
1652
+
1653
+ // Add tab panel semantics and hide them all
1654
+ panels.forEach((panel, i) => {
1655
+ panel.setAttribute("role", "tabpanel");
1656
+ panel.setAttribute("tabindex", "-1");
1657
+ panel.setAttribute("aria-label", tabs[i].innerText);
1658
+ panel.hidden = true;
1659
+ });
1660
+
1661
+ // Initially activate the first tab and reveal the first tab panel
1662
+ tabs[0].removeAttribute("tabindex");
1663
+ tabs[0].setAttribute("aria-selected", "true");
1664
+ panels[0].hidden = false;
1665
+ });
1666
+ })();
1667
+
1668
+ //@ts-check
1669
+
1670
+ /**
1671
+ * @typedef {Object} ScrollCounter_Properties
1672
+ * @property {boolean} counterAlreadyFired
1673
+ * @property {number} counterSpeed
1674
+ * @property {number} counterTarget
1675
+ * @property {number} counterCount
1676
+ * @property {number} counterStep
1677
+ * @property {()=>void} updateCounter
1678
+ * @typedef {HTMLElement & ScrollCounter_Properties} ScrollCounter
1679
+ */
1680
+
1681
+ document.addEventListener("DOMContentLoaded", () => {
1682
+ // You can change this class to specify which elements are going to behave as counters.
1683
+ /** @type {NodeListOf<ScrollCounter>} */
1684
+ const elements = document.querySelectorAll(".scroll-counter");
1685
+
1686
+ elements.forEach(item => {
1687
+ // Add new attributes to the elements with the '.scroll-counter' HTML class
1688
+ item.counterAlreadyFired = false;
1689
+ item.counterSpeed = Number(item.getAttribute("data-counter-time")) / 45;
1690
+ item.counterTarget = +item.innerText;
1691
+ item.counterCount = 0;
1692
+ item.counterStep = item.counterTarget / item.counterSpeed;
1693
+
1694
+ item.updateCounter = () => {
1695
+ item.counterCount += item.counterStep;
1696
+ item.innerText = Math.ceil(item.counterCount).toString();
1697
+
1698
+ if (item.counterCount < item.counterTarget) {
1699
+ window.setTimeout(item.updateCounter, item.counterSpeed);
1700
+ } else {
1701
+ item.innerText = item.counterTarget.toString();
1702
+ }
1703
+ };
1704
+ });
1705
+
1706
+ // Function to determine if an element is visible in the web page
1707
+ const isElementVisible = (/** @type {Element} */ el) => {
1708
+ const scroll = window.scrollY || window.pageYOffset;
1709
+ const boundsTop = el.getBoundingClientRect().top + scroll;
1710
+ const viewport = {
1711
+ top: scroll,
1712
+ bottom: scroll + window.innerHeight
1713
+ };
1714
+ const bounds = {
1715
+ top: boundsTop,
1716
+ bottom: boundsTop + el.clientHeight
1717
+ };
1718
+ return (
1719
+ (bounds.bottom >= viewport.top && bounds.bottom <= viewport.bottom) ||
1720
+ (bounds.top <= viewport.bottom && bounds.top >= viewport.top)
1721
+ );
1722
+ };
1723
+
1724
+ // Funciton that will get fired uppon scrolling
1725
+ const handleScroll = () => {
1726
+ elements.forEach(item => {
1727
+ if (item.counterAlreadyFired) return;
1728
+ if (!isElementVisible(item)) return;
1729
+ item.updateCounter();
1730
+ item.counterAlreadyFired = true;
1731
+ });
1732
+ };
1733
+
1734
+ // Fire the function on load and scroll
1735
+ window.addEventListener("load", handleScroll);
1736
+ window.addEventListener("scroll", handleScroll);
1737
+ });
1738
+
1739
+ //@ts-check
1740
+ const returnTop = document.querySelector(".return-top");
1741
+
1742
+ // Add on-click event
1743
+ returnTop.addEventListener("click", goToTopFunction);
1744
+
1745
+ function goToTopFunction() {
1746
+ document.body.scrollTop = 0; // For Safari
1747
+ document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
1748
+ }
1749
+
1750
+ // If an user scrolls down the page for more than 400px activate back to top button
1751
+ // othervise keep it invisible
1752
+ let timer = 0;
1753
+
1754
+ let lastScrollTop = 0;
1755
+
1756
+ window.addEventListener(
1757
+ "scroll",
1758
+ () => {
1759
+ const returnTopButton = document.querySelector(".return-top");
1760
+ const st = window.pageYOffset || document.documentElement.scrollTop;
1761
+ if (st > lastScrollTop) {
1762
+ // downscroll code
1763
+ returnTopButton.classList.remove("is-visible");
1764
+ } else if (
1765
+ document.body.scrollTop >= 400 ||
1766
+ document.documentElement.scrollTop >= 400
1767
+ ) {
1768
+ // upscroll code
1769
+
1770
+ if (timer) {
1771
+ window.clearTimeout(timer);
1772
+ }
1773
+ returnTopButton.classList.add("is-visible");
1774
+
1775
+ timer = window.setTimeout(() => {
1776
+ returnTopButton.classList.remove("is-visible");
1777
+ }, 2000); //Back to top removes itself after 2 sec of inactivity
1778
+ }
1779
+ // bottom of the page
1780
+ else {
1781
+ returnTopButton.classList.remove("is-visible");
1782
+ }
1783
+
1784
+ lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
1785
+ },
1786
+ false
1787
+ );
1788
+
1789
+ // Hittin' rock bottom
1790
+ window.onscroll = () => {
1791
+ const returnTopButton = document.querySelector(".return-top");
1792
+ if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
1793
+ returnTopButton.classList.add("is-visible");
1794
+ }
1795
+ };
1796
+
1797
+ // Back to top link in the global footer
1798
+ const backToTop = document.querySelector("a[href='#skip-to-content']");
1799
+ if (backToTop) {
1800
+ backToTop.addEventListener("click", backToTopFunction);
1801
+ }
1802
+
1803
+ /**
1804
+ * @param {Event} event
1805
+ */
1806
+ function backToTopFunction(event) {
1807
+ event.preventDefault();
1808
+ document.body.scrollTop = 0; // For Safari
1809
+ document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
1810
+ }
1811
+
1812
+ //@ts-check
1813
+
1814
+ /* -----------------------------------------
1815
+ SIDE NAVIGATION - /source/js/cagov/side-navigation.js
1816
+ ----------------------------------------- */
1817
+
1818
+ (() => {
1819
+ const siteHeader = document.querySelector("header");
1820
+ const sidenavigation = document.querySelector(".side-navigation");
1821
+ let allSidenavLinks = sidenavigation?.querySelectorAll(".side-navigation a");
1822
+ const mainContentSideNavCont = sidenavigation?.closest("div");
1823
+ sidenavigation?.setAttribute("id", "side-navigation");
1824
+ const topposition = localStorage.getItem("sidebar-scroll");
1825
+ const mobileCntls = document.querySelector(".global-header .mobile-controls");
1826
+ let mobileControlsDisplay = getComputedStyle(mobileCntls).display; // Side nav height vs viewport
1827
+ const siteHeaderHeight = siteHeader ? siteHeader.clientHeight : 0;
1828
+ const mobileView$3 = () =>
1829
+ getComputedStyle(document.querySelector(".global-header .mobile-controls"))[
1830
+ "display"
1831
+ ] !== "none";
1832
+ let timeout = 0;
1833
+ const delay = 250; // delay between calls
1834
+ let mobileSideNavDiv;
1835
+ let mobileSideNavCont;
1836
+ let sidenavToggleBtn;
1837
+
1838
+ function createMobileSideNavButton() {
1839
+ // get first side nav element
1840
+ /** @type {HTMLAnchorElement} */
1841
+ const sidenavTItle = document.querySelector(".side-navigation a, .sidenav");
1842
+
1843
+ if (sidenavTItle) {
1844
+ // get text for the button for first side nav element
1845
+ let btnText = sidenavTItle.innerText;
1846
+ const btnTextSpan = sidenavTItle.querySelector("span")?.innerText; // removing the sr-only span and it's content
1847
+ btnText = btnText.replace(btnTextSpan, "").trim();
1848
+ // create button container
1849
+ const sidenavMobile = document.createElement("aside");
1850
+ sidenavMobile.setAttribute("class", "sidenav-mobile-btn");
1851
+ const sidenavMobileCont = document.createElement("div");
1852
+ sidenavMobileCont.setAttribute("class", "container");
1853
+ sidenavMobile.append(sidenavMobileCont);
1854
+ // create button
1855
+ sidenavToggleBtn = document.createElement("button");
1856
+ sidenavToggleBtn.setAttribute("class", "sidenav-toggle");
1857
+ sidenavToggleBtn.setAttribute("aria-expanded", "false");
1858
+ sidenavToggleBtn.setAttribute("aria-controls", "side-navigation");
1859
+ sidenavToggleBtn.innerText = btnText;
1860
+ // create icon
1861
+ const arrowIcon = document.createElement("span");
1862
+ arrowIcon.setAttribute("aria-hidden", "true");
1863
+ arrowIcon.setAttribute("class", "ca-gov-icon-caret-down");
1864
+ sidenavToggleBtn.append(arrowIcon);
1865
+ // append button into the header
1866
+ sidenavMobileCont.append(sidenavToggleBtn);
1867
+ siteHeader.after(sidenavMobile);
1868
+ // add click event
1869
+ sidenavToggleBtn.addEventListener("click", toggleSideNav);
1870
+ }
1871
+ }
1872
+
1873
+ function createmobileSideNavDiv() {
1874
+ mobileSideNavDiv = document.createElement("aside");
1875
+ mobileSideNavDiv.setAttribute("class", "mobile-sidenav");
1876
+ mobileSideNavCont = document.createElement("div");
1877
+ mobileSideNavCont.setAttribute("class", "container");
1878
+ mobileSideNavDiv.append(mobileSideNavCont);
1879
+ siteHeader.after(mobileSideNavDiv);
1880
+ }
1881
+
1882
+ // MOBILE Side nav
1883
+ function moveSideNavToHeader() {
1884
+ mobileSideNavCont?.append(sidenavigation);
1885
+ sidenavigation.setAttribute("aria-hidden", "true");
1886
+ allSidenavLinks?.forEach(el => {
1887
+ el.setAttribute("tabindex", "-1");
1888
+ });
1889
+ }
1890
+
1891
+ // DESKTOP Side nav
1892
+ function moveSideNavToMainContent() {
1893
+ mainContentSideNavCont?.append(sidenavigation);
1894
+ sidenavigation.removeAttribute("aria-hidden");
1895
+ allSidenavLinks?.forEach(el => {
1896
+ el.removeAttribute("tabindex");
1897
+ });
1898
+ }
1899
+
1900
+ // Mobile Side Nav Button click function
1901
+ function toggleSideNav() {
1902
+ mobileSideNavDiv.classList.toggle("visible");
1903
+ // Open
1904
+ if (mobileSideNavDiv.classList.contains("visible")) {
1905
+ sidenavigation.removeAttribute("aria-hidden");
1906
+ sidenavToggleBtn.setAttribute("aria-expanded", "true");
1907
+ allSidenavLinks?.forEach(el => {
1908
+ el.removeAttribute("tabindex");
1909
+ });
1910
+
1911
+ // Closed
1912
+ } else {
1913
+ sidenavToggleBtn.setAttribute("aria-expanded", "false");
1914
+ sidenavigation.setAttribute("aria-hidden", "true");
1915
+ allSidenavLinks?.forEach(el => {
1916
+ el.setAttribute("tabindex", "-1");
1917
+ });
1918
+ }
1919
+ }
1920
+
1921
+ // Set active class on nav-heading links
1922
+ function addActiveClass() {
1923
+ /** @type {NodeListOf<HTMLAnchorElement>} */
1924
+ const active_link = document.querySelectorAll("a.nav-heading"),
1925
+ len = active_link.length,
1926
+ full_path = location.href.split("#")[0]; //Ignore hashes? // Loop through each link.
1927
+ for (let i = 0; i < len; i++)
1928
+ if (active_link[i].href.split("#")[0] == full_path)
1929
+ active_link[i].className += " active";
1930
+ }
1931
+
1932
+ function sidenavOverflow() {
1933
+ if (!mobileView$3()) {
1934
+ const viewportheight = document.documentElement.clientHeight;
1935
+ const viewportMinusHeader = viewportheight - siteHeaderHeight - 100;
1936
+
1937
+ if (
1938
+ viewportMinusHeader <=
1939
+ document.querySelector(".side-navigation").clientHeight
1940
+ ) {
1941
+ sidenavigation.classList.add("overflow-auto"); // sidenavigation.setAttribute("style", "max-height:" + viewportMinusHeader + "px")
1942
+ } else {
1943
+ sidenavigation.classList.remove("overflow-auto");
1944
+ sidenavigation.removeAttribute("style");
1945
+ }
1946
+
1947
+ if ([...sidenavigation.classList].includes("overflow-auto")) {
1948
+ sidenavigation.setAttribute(
1949
+ "style",
1950
+ `max-height:${viewportMinusHeader}px`
1951
+ );
1952
+ }
1953
+ } else {
1954
+ sidenavigation.classList.remove("overflow-auto");
1955
+ sidenavigation.removeAttribute("style");
1956
+ } // Remebemering scrolling position
1957
+ if (topposition !== null) {
1958
+ sidenavigation.scrollTop = parseInt(topposition, 10);
1959
+ }
1960
+ window.addEventListener("beforeunload", () => {
1961
+ localStorage.setItem(
1962
+ "sidebar-scroll",
1963
+ sidenavigation.scrollTop.toString()
1964
+ );
1965
+ });
1966
+ }
1967
+
1968
+ if (sidenavigation) {
1969
+ // ONLOAD
1970
+ addActiveClass();
1971
+ createmobileSideNavDiv();
1972
+ createMobileSideNavButton();
1973
+
1974
+ if (mobileControlsDisplay == "block") {
1975
+ moveSideNavToHeader();
1976
+ }
1977
+ // on resize
1978
+ window.addEventListener("resize", () => {
1979
+ mobileControlsDisplay = getComputedStyle(mobileCntls).display; // clear the timeout
1980
+
1981
+ window.clearTimeout(timeout); // start timing for event "completion"
1982
+ timeout = window.setTimeout(sidenavOverflow, delay); // if mobile
1983
+ if (mobileControlsDisplay == "block") {
1984
+ moveSideNavToHeader(); // if desctop
1985
+ } else {
1986
+ moveSideNavToMainContent();
1987
+ }
1988
+ });
1989
+ sidenavOverflow();
1990
+ }
1991
+ })();
1992
+
1993
+ //@ts-check
1994
+
1995
+ /* EXTERNAL LINK ICON */
1996
+ function linkAnnotator() {
1997
+ const ext = '<span class="external-link-icon" aria-hidden="true"></span>';
1998
+
1999
+ // Check if link is external function
2000
+ /**
2001
+ * @param {HTMLAnchorElement} linkElement
2002
+ */
2003
+ function linkIsExternal(linkElement) {
2004
+ return window.location.host.indexOf(linkElement.host) > -1;
2005
+ }
2006
+
2007
+ // Add any exceptions to not render here
2008
+ const cssExceptions = `:not(code *):not(.cagov-logo)`;
2009
+
2010
+ // Looping thru all links inside of the main content body, agency footer and statewide footer
2011
+ /** @type {NodeListOf<HTMLAnchorElement>} */
2012
+ const externalLink = document.querySelectorAll(
2013
+ `main a${cssExceptions}, .agency-footer a${cssExceptions}, .site-footer a${cssExceptions}, footer a${cssExceptions}`
2014
+ );
2015
+ externalLink.forEach(element => {
2016
+ const anchorLink = element.href.indexOf("#") === 0;
2017
+ const localHost = element.href.indexOf("localhost") > -1;
2018
+ const localEmail = element.href.indexOf("@") > -1;
2019
+ const linkElement = element;
2020
+ if (
2021
+ linkIsExternal(linkElement) === false &&
2022
+ !anchorLink &&
2023
+ !localEmail &&
2024
+ !localHost
2025
+ ) {
2026
+ linkElement.innerHTML += ext; // += concatenates to external links
2027
+ }
2028
+ });
2029
+ }
2030
+
2031
+ linkAnnotator();
2032
+
2033
+ //@ts-check
2034
+ /* -----------------------------------------
2035
+ PAGE NAVIGATION - /source/js/cagov/page-navigation.js
2036
+ ----------------------------------------- */
2037
+ (() => {
2038
+ const headings = document.querySelectorAll("h2");
2039
+ const h2heading = document.querySelector("h2");
2040
+ const pagenav = document.querySelector(".page-navigation");
2041
+ // check if page navigation is empty and page has h2 headings
2042
+ if (pagenav && pagenav.childNodes.length === 0 && h2heading) {
2043
+ const pagenavUL = document.createElement("ul");
2044
+
2045
+ headings.forEach(h2 => {
2046
+ // find each h2 and their innter text
2047
+ const innertext = h2.innerHTML;
2048
+
2049
+ // add dashes for inner text for IDs
2050
+ const innertextID = h2.innerHTML.replace(/\s+/g, "-");
2051
+
2052
+ // set ID for each h2 based on inner taxt
2053
+ h2.setAttribute("id", innertextID);
2054
+
2055
+ // Create anchor links
2056
+ const anchorlinks = `<a href="#${innertextID}">${innertext}</a>`;
2057
+
2058
+ // create li element
2059
+ const listnav = document.createElement("li");
2060
+
2061
+ // Add achor links into list item
2062
+ listnav.innerHTML = anchorlinks;
2063
+
2064
+ // appned list item to the UL
2065
+ pagenavUL.appendChild(listnav);
2066
+
2067
+ // count number of h2 and add columns class to the ul if there are too many list items
2068
+ const h2number = headings.length;
2069
+ if (h2number > 8) {
2070
+ pagenavUL.classList.add("columns-3");
2071
+ } else if (h2number > 5) {
2072
+ pagenavUL.classList.add("columns-2");
2073
+ }
2074
+ });
2075
+
2076
+ // create on this page label
2077
+ const onthispage =
2078
+ '<div id="on-this-page-navigation-label" class="label">On this page</div>';
2079
+ pagenav.innerHTML = onthispage;
2080
+
2081
+ // add ul item to the nav and set aria labelledby
2082
+ pagenav.appendChild(pagenavUL);
2083
+ pagenav.setAttribute("aria-labelledby", "on-this-page-navigation-label");
2084
+ }
2085
+ })(); // call out the function on the page load
2086
+
2087
+ //@ts-check
2088
+ /* -----------------------------------------
2089
+ PAGINATION - /src/js/cagov/pagination.js
2090
+ ----------------------------------------- */
2091
+
2092
+ /**
2093
+ * @param {string} label
2094
+ * @param {number} number
2095
+ */
2096
+ function pageListItem(label, number) {
2097
+ return `<li class="cagov-pagination__item">
2098
+ <a
2099
+ href="javascript:void(0);"
2100
+ class="cagov-pagination__button"
2101
+ aria-label="${label} ${number}"
2102
+ data-page-num="${number}"
2103
+ >
2104
+ ${number}
2105
+ </a>
2106
+ </li>`;
2107
+ }
2108
+
2109
+ function pageOverflow() {
2110
+ return `<li
2111
+ class="cagov-pagination__item cagov-pagination__overflow"
2112
+ role="presentation"
2113
+ >
2114
+ <span> … </span>
2115
+ </li>`;
2116
+ }
2117
+
2118
+ /**
2119
+ * @param {string} next
2120
+ * @param {string} previous
2121
+ * @param {string} page
2122
+ * @param {number} currentPage
2123
+ * @param {number} totalPages
2124
+ */
2125
+ function templateHTML(next, previous, page, currentPage, totalPages) {
2126
+ const unbounded = totalPages == -1;
2127
+ return `<nav aria-label="Pagination" class="cagov-pagination">
2128
+ <ul class="cagov-pagination__list">
2129
+ <li class="cagov-pagination__item">
2130
+ <a
2131
+ href="javascript:void(0);"
2132
+ class="cagov-pagination__link cagov-pagination__previous-page"
2133
+ aria-label="previous page"
2134
+ >
2135
+ <span class="cagov-pagination__link-text ${
2136
+ currentPage > 1 ? "" : "cagov-pagination__link-inactive"
2137
+ }"> ${previous} </span>
2138
+ </a>
2139
+ </li>
2140
+ ${currentPage > 2 ? pageListItem(page, 1) : ""}
2141
+
2142
+ ${currentPage == 4 ? pageListItem(page, 2) : ""}
2143
+ ${currentPage > 4 ? pageOverflow() : ""}
2144
+
2145
+ ${currentPage > 1 ? pageListItem(page, currentPage - 1) : ""}
2146
+
2147
+ <li class="cagov-pagination__item cagov-pagination-current">
2148
+ <a
2149
+ href="javascript:void(0);"
2150
+ class="cagov-pagination__button"
2151
+ aria-label="Page ${currentPage}"
2152
+ aria-current="page"
2153
+ data-page-num="${currentPage}"
2154
+ >
2155
+ ${currentPage}
2156
+ </a>
2157
+ </li>
2158
+
2159
+ ${
2160
+ unbounded || currentPage < totalPages
2161
+ ? pageListItem(page, currentPage + 1)
2162
+ : ""
2163
+ }
2164
+
2165
+ ${!unbounded && currentPage < totalPages - 2 ? pageOverflow() : ""}
2166
+ ${unbounded ? pageListItem(page, currentPage + 2) : ""}
2167
+
2168
+ ${currentPage < totalPages - 1 ? pageListItem(page, totalPages) : ""}
2169
+ ${unbounded ? pageOverflow() : ""}
2170
+
2171
+ <li class="cagov-pagination__item">
2172
+ <a
2173
+ href="javascript:void(0);"
2174
+ class="cagov-pagination__link cagov-pagination__next-page"
2175
+ aria-label="next page"
2176
+ >
2177
+ <span class="cagov-pagination__link-text ${
2178
+ !unbounded && currentPage > totalPages - 1
2179
+ ? "cagov-pagination__link-inactive"
2180
+ : ""
2181
+ }"> ${next} </span>
2182
+ </a>
2183
+ </li>
2184
+ </ul>
2185
+ </nav>`;
2186
+ }
2187
+
2188
+ const styles = `
2189
+ cagov-pagination {
2190
+ white-space: nowrap;
2191
+ font-size: .9rem;
2192
+ }
2193
+ cagov-pagination a {
2194
+ text-decoration: none !important;
2195
+ }
2196
+ cagov-pagination .cagov-pagination__list {
2197
+ list-style: none;
2198
+ margin: 0;
2199
+ padding: 0 !important;
2200
+ display: flex;
2201
+ overflow-x: scroll;
2202
+ }
2203
+ cagov-pagination .cagov-pagination__item {
2204
+ margin: var(--s-sm, 0.25rem);
2205
+ }
2206
+ cagov-pagination .cagov-pagination__item a {
2207
+ padding: 6px 14px;
2208
+ display: inline-block;
2209
+ color: #4a4958;
2210
+ }
2211
+ cagov-pagination .cagov-pagination__item a:hover, cagov-pagination .cagov-pagination__item a:focus {
2212
+ box-shadow: inset 0 0 0 3px #d4d4d7;
2213
+ }
2214
+ cagov-pagination .cagov-pagination__item.cagov-pagination-current {
2215
+ font-weight:700;
2216
+ }
2217
+ cagov-pagination .cagov-pagination__item.cagov-pagination-current a {
2218
+ box-shadow: inset 0 0 0 1px #d4d4d7;
2219
+ }
2220
+ cagov-pagination .cagov-pagination__item.cagov-pagination__overflow {
2221
+ border: none;
2222
+ padding: 0.875rem 0;
2223
+ }
2224
+ cagov-pagination .cagov-pagination__item:has(.cagov-pagination__link-inactive) {
2225
+ display:none;
2226
+ }
2227
+ .ca-gov-icon-arrow-prev, .ca-gov-icon-arrow-next {
2228
+ font-size: 0.86em;
2229
+ }
2230
+ `;
2231
+
2232
+ /**
2233
+ * Pagination web component
2234
+ *
2235
+ * @element cagov-pagination
2236
+ *
2237
+ * @fires paginationClick - custom event with object with detail value of current page: {detail: 1}
2238
+ *
2239
+ * @attr {string} [data-yes] - "Yes";
2240
+ * @attr {string} [data-no] - "No";
2241
+ *
2242
+ * @cssprop --primary-700 - Default value of #165ac2, used for text, border color
2243
+ */
2244
+ class CAGovPagination extends HTMLElement {
2245
+ constructor() {
2246
+ super();
2247
+
2248
+ if (!document.querySelector("#cagov-pagination-styles")) {
2249
+ const style = document.createElement("style");
2250
+ style.id = "cagov-pagination-styles";
2251
+ style.textContent = styles;
2252
+ document.querySelector("head").appendChild(style);
2253
+ }
2254
+ }
2255
+
2256
+ connectedCallback() {
2257
+ this.currentPage = parseInt(
2258
+ this.dataset.currentPage ? this.dataset.currentPage : "1",
2259
+ 10
2260
+ );
2261
+ this.render();
2262
+ }
2263
+
2264
+ render() {
2265
+ //console.log(this.dataset);
2266
+ const previous = this.dataset.previous
2267
+ ? this.dataset.previous
2268
+ : '<span class="ca-gov-icon-arrow-prev" aria-hidden="true"></span> Previous';
2269
+ const next = this.dataset.next
2270
+ ? this.dataset.next
2271
+ : 'Next <span class="ca-gov-icon-arrow-next" aria-hidden="true"></span>';
2272
+ const page = this.dataset.page ? this.dataset.page : "Page";
2273
+ this.totalPages = this.dataset.totalPages
2274
+ ? Number(this.dataset.totalPages)
2275
+ : 1;
2276
+ if (this.totalPages < 0 || this.totalPages > 1) {
2277
+ const html = templateHTML(
2278
+ next,
2279
+ previous,
2280
+ page,
2281
+ this.currentPage,
2282
+ this.totalPages
2283
+ );
2284
+ this.innerHTML = html;
2285
+ this.applyListeners();
2286
+ } else {
2287
+ this.innerHTML = "";
2288
+ }
2289
+ }
2290
+
2291
+ static get observedAttributes() {
2292
+ return ["data-current-page", "data-total-pages"];
2293
+ }
2294
+
2295
+ attributeChangedCallback(name, oldValue, newValue) {
2296
+ if (name === "data-current-page") {
2297
+ this.currentPage = parseInt(newValue, 10);
2298
+ this.render();
2299
+ }
2300
+ if (name === "data-total-pages") {
2301
+ this.totalPages = parseInt(newValue, 10);
2302
+ this.render();
2303
+ }
2304
+ }
2305
+
2306
+ applyListeners() {
2307
+ const pageLinks = this.querySelectorAll(".cagov-pagination__button");
2308
+ pageLinks.forEach(pl => {
2309
+ pl.addEventListener("click", event => {
2310
+ this.currentPage = parseInt(
2311
+ /** @type {CAGovPagination} */ (event.target).dataset.pageNum,
2312
+ 10
2313
+ );
2314
+ this.dispatchEvent(
2315
+ new CustomEvent("paginationClick", {
2316
+ detail: this.currentPage
2317
+ })
2318
+ );
2319
+ this.dataset.currentPage = this.currentPage.toString();
2320
+ });
2321
+ });
2322
+ this.querySelector(".cagov-pagination__previous-page").addEventListener(
2323
+ "click",
2324
+ event => {
2325
+ if (
2326
+ !(
2327
+ /** @type {Element} */ (event.target).classList.contains(
2328
+ "cagov-pagination__link-inactive"
2329
+ )
2330
+ )
2331
+ ) {
2332
+ this.currentPage -= 1;
2333
+ if (this.currentPage < 1) {
2334
+ this.currentPage = 1;
2335
+ }
2336
+ this.dispatchEvent(
2337
+ new CustomEvent("paginationClick", {
2338
+ detail: this.currentPage
2339
+ })
2340
+ );
2341
+ this.dataset.currentPage = this.currentPage.toString();
2342
+ }
2343
+ }
2344
+ );
2345
+ this.querySelector(".cagov-pagination__next-page").addEventListener(
2346
+ "click",
2347
+ event => {
2348
+ if (
2349
+ !(
2350
+ /** @type {Element} */ (event.target).classList.contains(
2351
+ "cagov-pagination__link-inactive"
2352
+ )
2353
+ )
2354
+ ) {
2355
+ this.currentPage += 1;
2356
+ if (this.totalPages != -1 && this.currentPage > this.totalPages) {
2357
+ this.currentPage = this.totalPages;
2358
+ }
2359
+ this.dispatchEvent(
2360
+ new CustomEvent("paginationClick", {
2361
+ detail: this.currentPage
2362
+ })
2363
+ );
2364
+ this.dataset.currentPage = this.currentPage.toString();
2365
+ }
2366
+ }
2367
+ );
2368
+ }
2369
+ }
2370
+
2371
+ window.customElements.define("cagov-pagination", CAGovPagination);
2372
+
2373
+ //export { CAGovPagination };
2374
+
2375
+ //@ts-check
2376
+
2377
+ (() => {
2378
+ // VARIABLES
2379
+ const bodyCont = document.querySelector("body");
2380
+ const mainNav = document.querySelector(".main-navigation");
2381
+ const navButton = document.querySelector(".toggle-menu");
2382
+ const navSearchCont = document.querySelector(".navigation-search");
2383
+ const mobileCntls = document.querySelector(".global-header .mobile-controls");
2384
+ const mainCont = document.querySelector(".main-content");
2385
+ const footerGlobal = document.querySelector("footer");
2386
+ const footerSite = document.querySelector(".site-footer");
2387
+ const headerutility = document.querySelector(".utility-header");
2388
+ const regularHeader = document.querySelector("header");
2389
+ const headerutilityLinksCont = document.querySelector(
2390
+ ".utility-header .container .flex-row"
2391
+ );
2392
+ const navButtonCont = document.querySelector(
2393
+ ".mobile-controls .main-nav-icons"
2394
+ );
2395
+ const siteBranding = document.querySelector(".branding");
2396
+ const utilityLinks = document.querySelector(".settings-links");
2397
+ let mobileControlsDisplay = getComputedStyle(mobileCntls).display;
2398
+ let allNavLinks;
2399
+ let allUtilityLinks;
2400
+ // We need timeout here to make sure navigation is created first (becasue naviagion.js is creating button elements dynamicaly) and then we can assign all thise links to our variable
2401
+ setTimeout(() => {
2402
+ allNavLinks = document.querySelectorAll(
2403
+ '.navigation-search a.first-level-link, .navigation-search button.first-level-btn, .navigation-search input, .navigation-search button, .navigation-search [tabindex]:not([tabindex="-1"])'
2404
+ );
2405
+ allUtilityLinks = document.querySelectorAll(
2406
+ '.settings-links a, .settings-links button, .settings-links input, .settings-links select, .settings-links [tabindex]:not([tabindex="-1"])'
2407
+ );
2408
+ }, 100);
2409
+
2410
+ // all focusable elements other than navigation
2411
+ const allBodyLinks = document.querySelectorAll(
2412
+ '.utility-header .social-media-links a, .utility-header .social-media-links input, .utility-header .social-media-links button, .utility-header .social-media-links [tabindex]:not([tabindex="-1"]), .branding a, .branding button, .branding input, .branding select, .main-content a[href], .main-content button, .main-content input, .main-content textarea, .main-content select, .main-content details, .main-content [tabindex]:not([tabindex="-1"]), .site-footer a[href], .site-footer button, .site-footer input, .site-footer textarea, .site-footer select, .site-footer details, .site-footer [tabindex]:not([tabindex="-1"]), footer a[href], footer button, footer input, footer textarea, footer select, footer details, footer [tabindex]:not([tabindex="-1"])'
2413
+ );
2414
+
2415
+ // create container for drawer mobile nav items
2416
+ const mobileItemsCont = document.createElement("div");
2417
+ mobileItemsCont.setAttribute("class", "nav-drawer");
2418
+
2419
+ // move mobile navigation toggle button back into mobile controls container
2420
+ function moveNavToggleButtonToMobileControlsContainer() {
2421
+ setTimeout(() => {
2422
+ navButton.setAttribute("aria-expanded", "false");
2423
+ navButtonCont?.append(navButton);
2424
+ }, 300);
2425
+ }
2426
+
2427
+ // ONLOAD
2428
+ window.onload = function () {
2429
+ // move duplicated logo to navigation drawer section
2430
+ navSearchCont?.prepend(mobileItemsCont);
2431
+
2432
+ // if mobile
2433
+ if (mobileControlsDisplay == "block") {
2434
+ mobileNavDefault();
2435
+ // if desktop
2436
+ } else {
2437
+ desktopNavDefault();
2438
+ }
2439
+ };
2440
+
2441
+ // Button click open and close menu function
2442
+ function openMenu() {
2443
+ mobileItemsCont.append(navButton);
2444
+ navSearchCont?.classList.toggle("visible");
2445
+ navSearchCont?.classList.toggle("not-visible");
2446
+ // Open
2447
+ if (navSearchCont?.classList.contains("visible")) {
2448
+ navButton.setAttribute("aria-expanded", "true");
2449
+ bodyCont?.classList.add("overflow-hidden");
2450
+ navSearchCont?.setAttribute("aria-hidden", "false");
2451
+ // make links focusable
2452
+ allNavLinks?.forEach(el => {
2453
+ el.removeAttribute("tabindex");
2454
+ });
2455
+ allUtilityLinks?.forEach(el => {
2456
+ el.removeAttribute("tabindex");
2457
+ });
2458
+ // make all the rest of the links not focusable
2459
+ allBodyLinks?.forEach(el => {
2460
+ el.setAttribute("tabindex", "-1");
2461
+ });
2462
+ // Hide all the website areas (add aria-hidden)
2463
+ mainCont?.setAttribute("aria-hidden", "true");
2464
+ footerGlobal?.setAttribute("aria-hidden", "true");
2465
+ footerSite?.setAttribute("aria-hidden", "true");
2466
+ headerutility?.setAttribute("aria-hidden", "true");
2467
+ siteBranding?.setAttribute("aria-hidden", "true");
2468
+ regularHeader?.classList.add("nav-overlay");
2469
+ // Close
2470
+ } else {
2471
+ navButton.setAttribute("aria-expanded", "false");
2472
+ bodyCont?.classList.remove("overflow-hidden");
2473
+ navSearchCont?.setAttribute("aria-hidden", "true");
2474
+ // removing focus
2475
+ allNavLinks?.forEach(el => {
2476
+ el.setAttribute("tabindex", "-1");
2477
+ });
2478
+ allUtilityLinks?.forEach(el => {
2479
+ el.setAttribute("tabindex", "-1");
2480
+ });
2481
+ allBodyLinks?.forEach(el => {
2482
+ el.removeAttribute("tabindex");
2483
+ });
2484
+ // remove aria hidden for the rest of the site
2485
+ mainCont?.removeAttribute("aria-hidden");
2486
+ footerGlobal?.removeAttribute("aria-hidden");
2487
+ footerSite?.removeAttribute("aria-hidden");
2488
+ headerutility?.removeAttribute("aria-hidden");
2489
+ siteBranding?.removeAttribute("aria-hidden");
2490
+ regularHeader?.classList.remove("nav-overlay");
2491
+ moveNavToggleButtonToMobileControlsContainer();
2492
+ }
2493
+ }
2494
+
2495
+ // Default state for mobile
2496
+ function mobileNavDefault() {
2497
+ moveNavToggleButtonToMobileControlsContainer();
2498
+ mainNav?.before(utilityLinks);
2499
+ bodyCont?.classList.remove("overflow-hidden");
2500
+ navSearchCont?.classList.add("not-visible");
2501
+ navSearchCont?.classList.remove("visible");
2502
+ navSearchCont?.setAttribute("aria-hidden", "true");
2503
+ // removing focus
2504
+ allNavLinks?.forEach(el => {
2505
+ el.setAttribute("tabindex", "-1");
2506
+ });
2507
+ allUtilityLinks?.forEach(el => {
2508
+ el.setAttribute("tabindex", "-1");
2509
+ });
2510
+ allBodyLinks?.forEach(el => {
2511
+ el.removeAttribute("tabindex");
2512
+ });
2513
+ // remove aria hidden for the rest of the site
2514
+ mainCont?.removeAttribute("aria-hidden");
2515
+ footerGlobal?.removeAttribute("aria-hidden");
2516
+ footerSite?.removeAttribute("aria-hidden");
2517
+ headerutility?.removeAttribute("aria-hidden");
2518
+ siteBranding?.removeAttribute("aria-hidden");
2519
+ regularHeader?.classList.remove("nav-overlay");
2520
+ }
2521
+
2522
+ // Default state for desktop
2523
+ function desktopNavDefault() {
2524
+ moveNavToggleButtonToMobileControlsContainer();
2525
+ headerutilityLinksCont?.append(utilityLinks);
2526
+ bodyCont?.classList.remove("overflow-hidden");
2527
+ navSearchCont?.classList.remove("visible");
2528
+ navSearchCont?.classList.remove("not-visible");
2529
+ navSearchCont?.setAttribute("aria-hidden", "false");
2530
+ allNavLinks?.forEach(el => {
2531
+ el.removeAttribute("tabindex");
2532
+ });
2533
+ allUtilityLinks?.forEach(el => {
2534
+ el.removeAttribute("tabindex");
2535
+ });
2536
+ allBodyLinks?.forEach(el => {
2537
+ el.removeAttribute("tabindex");
2538
+ });
2539
+ // remove aria hidden for the rest of the site
2540
+ mainCont?.removeAttribute("aria-hidden");
2541
+ footerGlobal?.removeAttribute("aria-hidden");
2542
+ footerSite?.removeAttribute("aria-hidden");
2543
+ headerutility?.removeAttribute("aria-hidden");
2544
+ siteBranding?.removeAttribute("aria-hidden");
2545
+ regularHeader?.classList.remove("nav-overlay");
2546
+ }
2547
+
2548
+ // Button Click event
2549
+ navButton.addEventListener("click", openMenu);
2550
+
2551
+ // on resize function (hide mobile nav)
2552
+ window.addEventListener("resize", () => {
2553
+ // set changing wariable in here
2554
+ mobileControlsDisplay = getComputedStyle(mobileCntls).display;
2555
+ // if mobile
2556
+ if (mobileControlsDisplay == "block") {
2557
+ mobileNavDefault();
2558
+ // if desctop
2559
+ } else {
2560
+ desktopNavDefault();
2561
+ }
2562
+ });
2563
+ })();