/*! For license information please see centennial.bundle.min.js.LICENSE.txt */ (()=>{var t={239(t){t.exports=function(t,e){var n,i,s=0;function r(){var r,o,a=n,l=arguments.length;t:for(;a;){if(a.args.length===arguments.length){for(o=0;o=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}s.json.test(a.type)?f+=n:(!s.number.test(a.type)||u&&!a.sign?d="":(d=u?"+":"-",n=n.toString().replace(s.sign,"")),h=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",c=a.width-(d+n).length,l=a.width&&c>0?h.repeat(c):"",f+=a.align?d+n+l:"0"===h?d+l+n:l+d+n)}return f}(function(t){if(a[t])return a[t];for(var e,n=t,i=[],r=0;n;){if(null!==(e=s.text.exec(n)))i.push(e[0]);else if(null!==(e=s.modulo.exec(n)))i.push("%");else{if(null===(e=s.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){r|=1;var o=[],l=e[2],h=[];if(null===(h=s.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(h[1]);""!==(l=l.substring(h[0].length));)if(null!==(h=s.key_access.exec(l)))o.push(h[1]);else{if(null===(h=s.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(h[1])}e[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}n=n.substring(e[0].length)}return a[t]=i}(t),arguments)}function o(t,e){return r.apply(null,[t].concat(e||[]))}var a=Object.create(null);"undefined"!=typeof window&&(window.sprintf=r,window.vsprintf=o,void 0===(i=function(){return{sprintf:r,vsprintf:o}}.call(e,n,e,t))||(t.exports=i))}()}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={exports:{}};return t[i](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";const t=function(t){"complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()};function e(e){const{component:n,load:i,name:s,querySelector:r={},querySelectorAll:o={},options:a={}}=e;if("function"!=typeof n)return;const l=()=>{(()=>{const t=void 0===s?null==e?void 0:e.root:`[data-component='${s}']`;let n;try{n=document.querySelectorAll(t)}catch(t){return console.error(t),[]}return n.length<1?(console.log(`No elements found for ${t}`),[]):Array.from(n).map(t=>{const e={};return Object.keys(r).forEach(n=>{e[n]=t.querySelector(r[n])}),Object.keys(o).forEach(n=>{const i=t.querySelectorAll(o[n]);e[n]=Array.from(i)}),{element:t,children:e,options:a}})})().forEach(t=>new n(t))};if(!1===i)return l;!0!==i?function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(e)if("function"==typeof n)n(e);else if(Array.isArray(n)){const[t,i]=n;null==t||t.addEventListener(i,e)}}(l,i):l()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n0?(this.downIntent+=e,this.upIntent=0,this.downIntent>this.THRESHOLD&&(this.element.classList.add("scroll-down"),this.element.classList.remove("scroll-up"))):e<0&&(this.upIntent-=e,this.downIntent=0,this.upIntent>this.THRESHOLD&&(this.element.classList.add("scroll-up"),this.element.classList.remove("scroll-down")))),this.lastY=t}},{key:"destroy",value:function(){var t;this.scrollAttached&&(window.removeEventListener("scroll",this.onScroll),this.scrollAttached=!1),this.observer&&(this.observer.disconnect(),this.observer=null),null!=d&&null!==(t=d.lgMax)&&void 0!==t&&t.removeListener&&d.lgMax.removeListener(this.handleBreakpoints),this.onScroll=null}}])}()});var m,f,v,y,b=n(239),g=n.n(b);n(471),g()(console.error),m={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},f=["(","?"],v={")":["("],":":["?","?:"]},y=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var w={"!":function(t){return!t},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},"?:":function(t,e,n){if(t)throw e;return n}};var k={contextDelimiter:"",onMissingKey:null};function E(t,e){var n;for(n in this.data=t,this.pluralForms={},this.options={},k)this.options[n]=void 0!==e&&n in e?e[n]:k[n]}function I(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function S(t){for(var e=1;e=0||m[s]3&&void 0!==arguments[3]?arguments[3]:10,o=t[e];if(M(n)&&C(i))if("function"==typeof s)if("number"==typeof r){var a={callback:s,priority:r,namespace:i};if(o[n]){var l,h=o[n].handlers;for(l=h.length;l>0&&!(r>=h[l-1].priority);l--);l===h.length?h[l]=a:h.splice(l,0,a),o.__current.forEach(function(t){t.name===n&&t.currentIndex>=l&&t.currentIndex++})}else o[n]={handlers:[a],runs:0};"hookAdded"!==n&&t.doAction("hookAdded",n,i,s,r)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}},B=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,s){var r=t[e];if(M(i)&&(n||C(s))){if(!r[i])return 0;var o=0;if(n)o=r[i].handlers.length,r[i]={runs:r[i].runs,handlers:[]};else for(var a=r[i].handlers,l=function(t){a[t].namespace===s&&(a.splice(t,1),o++,r.__current.forEach(function(e){e.name===i&&e.currentIndex>=t&&e.currentIndex--}))},h=a.length-1;h>=0;h--)l(h);return"hookRemoved"!==i&&t.doAction("hookRemoved",i,s),o}}},L=function(t,e){return function(n,i){var s=t[e];return void 0!==i?n in s&&s[n].handlers.some(function(t){return t.namespace===i}):n in s}},D=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i){var s=t[e];s[i]||(s[i]={handlers:[],runs:0}),s[i].runs++;for(var r=s[i].handlers,o=arguments.length,a=new Array(o>1?o-1:0),l=1;l1&&void 0!==arguments[1]?arguments[1]:"default";i.data[e]=S(S(S({},x),i.data[e]),t),i.data[e][""]=S(S({},x[""]),i.data[e][""])},a=function(t,e){o(t,e),r()},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return i.data[t]||o(void 0,t),i.dcnpgettext(t,e,n,s,r)},h=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default"},c=function(t,e,i){var s=l(i,e,t);return n?(s=n.applyFilters("i18n.gettext_with_context",s,t,e,i),n.applyFilters("i18n.gettext_with_context_"+h(i),s,t,e,i)):s};if(n){var u=function(t){A.test(t)&&r()};n.addAction("hookAdded","core/i18n",u),n.addAction("hookRemoved","core/i18n",u)}return{getLocaleData:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return i.data[t]},setLocaleData:a,resetLocaleData:function(t,e){i.data={},i.pluralForms={},a(t,e)},subscribe:function(t){return s.add(t),function(){return s.delete(t)}},__:function(t,e){var i=l(e,void 0,t);return n?(i=n.applyFilters("i18n.gettext",i,t,e),n.applyFilters("i18n.gettext_"+h(e),i,t,e)):i},_x:c,_n:function(t,e,i,s){var r=l(s,void 0,t,e,i);return n?(r=n.applyFilters("i18n.ngettext",r,t,e,i,s),n.applyFilters("i18n.ngettext_"+h(s),r,t,e,i,s)):r},_nx:function(t,e,i,s,r){var o=l(r,s,t,e,i);return n?(o=n.applyFilters("i18n.ngettext_with_context",o,t,e,i,s,r),n.applyFilters("i18n.ngettext_with_context_"+h(r),o,t,e,i,s,r)):o},isRTL:function(){return"rtl"===c("ltr","text direction")},hasTranslation:function(t,e,s){var r,o,a=e?e+""+t:t,l=!(null===(r=i.data)||void 0===r||null===(o=r[null!=s?s:"default"])||void 0===o||!o[a]);return n&&(l=n.applyFilters("i18n.has_translation",l,t,e,s),l=n.applyFilters("i18n.has_translation_"+h(s),l,t,e,s)),l}}}(0,0,K));U.getLocaleData.bind(U);var j=U.setLocaleData.bind(U),N=(U.resetLocaleData.bind(U),U.subscribe.bind(U),U.__.bind(U));function F(t){var e=['a[href]:not([aria-hidden="true"])',"area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(","),n=t.querySelectorAll(e);return Array.prototype.slice.call(n)}U._x.bind(U),U._n.bind(U),U._nx.bind(U),U.isRTL.bind(U),U.hasTranslation.bind(U);var R=function(){return c(function t(e){o(this,t),this.stringDescription="Disclosure",Object.assign(this,{controller:null,target:null,loadOpen:!1,allowOutsideClick:!0,onOpen:function(){},onClose:function(){}},e),this.state={expanded:this.loadOpen},this.interactiveChildElements=F(this.target),this.setup=this.setup.bind(this),this.destroy=this.destroy.bind(this),this.toggleExpandedState=this.toggleExpandedState.bind(this),this.setExpandedState=this.setExpandedState.bind(this),this.rovingTabIndex=this.rovingTabIndex.bind(this),this.closeOnOutsideClick=this.closeOnOutsideClick.bind(this),this.setup(),this.rovingTabIndex(!1)},[{key:"setExpandedState",value:function(t){this.controller.setAttribute("aria-expanded","".concat(t)),this.target.setAttribute("aria-hidden","".concat(!t)),this.rovingTabIndex(t),this.state.expanded=t,t?this.onOpen.call(this):this.onClose.call(this)}},{key:Symbol.toStringTag,get:function(){return this.stringDescription}},{key:"setup",value:function(){var t=this.state.expanded;[this.controller,this.target].forEach(function(t){""===t.id&&t.setAttribute("id",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:36,e=r(Math.random().toString(t).split("."),2)[1];return"id_".concat(e)}())}),this.controller.disclosure=this,this.target.disclosure=this,this.controller.setAttribute("aria-expanded","".concat(t)),this.controller.setAttribute("aria-controls",this.target.id),this.target!==this.controller.nextElementSibling&&this.controller.setAttribute("aria-owns",this.target.id),this.target.setAttribute("aria-hidden","".concat(!t)),this.controller.addEventListener("click",this.toggleExpandedState),this.allowOutsideClick||document.body.addEventListener("click",this.closeOnOutsideClick)}},{key:"destroy",value:function(){this.controller.disclosure=null,this.target.disclosure=null,this.controller.removeAttribute("aria-expanded"),this.controller.removeAttribute("aria-controls"),this.controller.removeAttribute("aria-owns"),this.target.removeAttribute("aria-hidden"),this.controller.removeEventListener("click",this.toggleExpandedState),document.body.removeEventListener("click",this.closeOnOutsideClick),this.state={expanded:this.loadOpen}}},{key:"toggleExpandedState",value:function(t){t.preventDefault(),this.state.expanded?this.setExpandedState(!1):this.setExpandedState(!0)}},{key:"closeOnOutsideClick",value:function(t){this.state.expanded&&t.target!==this.controller&&!this.target.contains(t.target)&&this.setExpandedState(!1)}},{key:"rovingTabIndex",value:function(t){this.interactiveChildElements.forEach(function(e){t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1")})}}])}();function H(t,e){var n=t.split("-").map(function(t,e){return 0===e?t:t.charAt(0).toUpperCase()+t.slice(1)}).join(""),i=p(sciencenewsClassnames[e]);return void 0!==i[n]&&i[n]}function W(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=H(t,e);return i?n?document.querySelectorAll(i):document.querySelector(i):null}var q=function(){return c(function t(e){var n=e.element,i=e.children,s=e.options;o(this,t),this.element=n,this.children=i,this.options=s,j({"":{}},"sciencenews"),this.moveComponent=this.moveComponent.bind(this),this.updateControllerText=this.updateControllerText.bind(this),this.navBarWrapper=W("wrapper","nav-bar"),this.navBar=W("nav-bar","nav-bar"),this.actionsList=W("actions","nav-bar"),this.moveComponent(),d.lgMin.addListener(this.moveComponent),this.init(),this.updateControllerText()},[{key:"moveComponent",value:function(){var t=this.children.controller;if(null!==this.navBarWrapper&&null!==this.navBar&&null!==this.actionsList){var e=t.parentElement,n=this.element.parentElement;d.lgMin.matches?e!==this.navBar&&n!==this.navBar&&this.navBar.insertBefore(this.element,this.actionsList):e!==this.navBarWrapper&&n!==this.navBarWrapper&&this.navBarWrapper.appendChild(this.element)}}},{key:"init",value:function(){var t=this,e=this.children,n=e.controller,i=e.target;this.disclosure=new R({controller:n,target:i,onOpen:this.updateControllerText,onClose:this.updateControllerText});var s,r,o=(s=N("Use the Shift key with the Tab key to tab back to the search input.","sciencenews"),(r=document.createElement("span")).classList.add("screen-reader-text"),Object.assign(r,{id:"header-search-help",innerText:s}),r);document.body.appendChild(o),i.style.clip="rect(0, 0, 0, 0)",i.addEventListener("transitionend",function(){t.disclosure.state.expanded||(i.style.clip="rect(0, 0, 0, 0)")})}},{key:"updateControllerText",value:function(){var t=this.children,e=t.controller,n=t.target,i=t.openText,s=t.closeText,r=t.input,o=this.disclosure.state.expanded;i.setAttribute("aria-hidden","".concat(o)),s.setAttribute("aria-hidden","".concat(!o)),o?(n.style.clip="auto",e.setAttribute("aria-describedby","header-search-help"),r.focus()):e.removeAttribute("aria-describedby")}}])}(),z=p(sciencenewsClassnames["header-search"]);e({name:"header-search",component:q,querySelector:{target:z.wrapper,controller:z.toggle,openText:z.open,closeText:z.close,input:"input"}});var $=function(){return c(function t(e){if(o(this,t),null==e||!(e instanceof HTMLFormElement))throw new Error("Invalid form element.");this.form=e,this.validateEmailInput=this.validateEmailInput.bind(this),this.formSubmit=this.formSubmit.bind(this),this.checkEmailInput=this.checkEmailInput.bind(this),this.updateState=this.updateState.bind(this),this.updateReadyState=this.updateReadyState.bind(this),this.init()},[{key:"updateState",value:function(t){var e=new CustomEvent("sn.formstatechange",{bubbles:!0,composed:!0,detail:{status:t}});this.form.dispatchEvent(e)}},{key:"updateReadyState",value:function(){Object.defineProperty(this.form,"faReadyState",{value:"ready",configurable:!0});var t=new CustomEvent("sn.formready",{bubbles:!0,composed:!0,detail:{}});this.form.dispatchEvent(t)}},{key:"init",value:function(){this.emailInput=this.form.querySelector('[name="email"]'),this.nonceInput=this.form.querySelector('[name="nonce"]'),this.submit=this.form.querySelector('[type="submit"]'),this.honeyPot=this.form.querySelector('[name="client_key"]'),this.formId=this.form.querySelector('[name="form_id"]'),this.control=this.form.querySelector('[name="control"]'),null!=this.emailInput&&(this.form.addEventListener("submit",this.formSubmit),this.emailInput.addEventListener("input",this.checkEmailInput),this.updateReadyState())}},{key:"checkEmailInput",value:function(){null!==this.emailInput.getAttribute("aria-invalid")&&this.emailInput.removeAttribute("aria-invalid")}},{key:"validateEmailInput",value:function(){var t=this.emailInput,e=t.value,n=t.pattern,i=new RegExp(n),s=e.trim();return e.trim().length>0&&i.test(s)}},{key:"formSubmit",value:function(t){var e,n=this;if(t.preventDefault(),!this.validateEmailInput())return this.emailInput.setAttribute("aria-invalid","true"),!1;var i=window.location,s=i.pathname,r=i.search,o=null!==(e=this.honeyPot)&&void 0!==e&&e.value?this.honeyPot.value:"",a=this.nonceInput.value,l=this.formId.value,h=this.control.value,c=encodeURIComponent(this.emailInput.value);this.emailInput.removeAttribute("aria-invalid"),this.updateState("loading");var u=["client_key=".concat(o),"control=".concat(h),"email=".concat(c),"form_id=".concat(l),"page=".concat(s)],d="".concat(u.join("&")).concat(r),p=new XMLHttpRequest;p.open("POST",this.form.action,!0),p.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),p.setRequestHeader("X-WP-Nonce",a),p.send(encodeURI(d)),p.onreadystatechange=function(){if(p.readyState===XMLHttpRequest.DONE){var t=p.status;0===t||t>=200&&t<400?n.updateState("success"):n.updateState("error")}}}}])}();function G(t){for(var e=1;e0){var n=r(this.interactiveChildElements,1)[0];this.firstItem=n,this.lastItem=this.interactiveChildElements[this.interactiveChildElements.length-1]}this.state={expanded:!1},this.setup=this.setup.bind(this),this.destroy=this.destroy.bind(this),this.manageExpandedState=this.manageExpandedState.bind(this),this.setExpandedState=this.setExpandedState.bind(this),this.controllerKeyDownHandler=this.controllerKeyDownHandler.bind(this),this.targetKeyDownHandler=this.targetKeyDownHandler.bind(this),this.closeOnTabOut=this.closeOnTabOut.bind(this),this.closeOnOutsideClick=this.closeOnOutsideClick.bind(this),this.setup()},[{key:"setExpandedState",value:function(t){this.controller.setAttribute("aria-expanded","".concat(t)),this.target.setAttribute("aria-hidden","".concat(!t)),this.state.expanded=t}},{key:Symbol.toStringTag,get:function(){return this.stringDescription}},{key:"setup",value:function(){var t=this.state.expanded;this.controller.popup=this,this.target.popup=this,this.controller.setAttribute("aria-haspopup","menu"),this.controller.setAttribute("aria-expanded","".concat(t)),this.controller.setAttribute("aria-controls",this.target.id),this.target!==this.controller.nextElementSibling&&this.controller.setAttribute("aria-owns",this.target.id),this.target.setAttribute("aria-hidden","".concat(!t)),this.controller.addEventListener("click",this.manageExpandedState),this.controller.addEventListener("keydown",this.controllerKeyDownHandler),this.target.addEventListener("keydown",this.targetKeyDownHandler),document.body.addEventListener("click",this.closeOnOutsideClick)}},{key:"destroy",value:function(){this.controller.popup=null,this.target.popup=null,this.controller.removeAttribute("aria-haspopup"),this.controller.removeAttribute("aria-expanded"),this.controller.removeAttribute("aria-controls"),this.target!==this.controller.nextElementSibling&&this.controller.removeAttribute("aria-owns"),this.target.removeAttribute("aria-hidden"),this.controller.removeEventListener("click",this.manageExpandedState),this.controller.removeEventListener("keydown",this.controllerKeyDownHandler),this.target.removeEventListener("keydown",this.targetKeyDownHandler),document.body.removeEventListener("click",this.closeOnOutsideClick),this.state={expanded:!1}}},{key:"controllerKeyDownHandler",value:function(t){if(this.state.expanded){var e=X.ESC,n=X.TAB,i=t.keyCode;e===i?(t.stopPropagation(),t.preventDefault(),this.setExpandedState(!1)):n===i&&(t.preventDefault(),this.firstItem.focus())}}},{key:"targetKeyDownHandler",value:function(t){var e=X.ESC,n=X.TAB,i=t.keyCode,s=this.state.expanded,r=document.activeElement;e===i&&s?(t.stopPropagation(),t.preventDefault(),this.setExpandedState(!1),this.controller.focus()):n===i&&(!t.shiftKey||this.firstItem!==r&&this.target!==r?this.lastChild===r&&this.setExpandedState(!1):(t.preventDefault(),this.controller.focus()))}},{key:"manageExpandedState",value:function(t){t.preventDefault(),this.state.expanded?this.setExpandedState(!1):this.setExpandedState(!0)}},{key:"closeOnTabOut",value:function(t){X.TAB===t.keyCode&&!t.shiftKey&&this.state.expanded&&this.setExpandedState(!1)}},{key:"closeOnOutsideClick",value:function(t){this.state.expanded&&t.target!==this.controller&&!this.target.contains(t.target)&&this.setExpandedState(!1)}}])}();function J(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Q=function(){function t(e){o(this,t),this.stringDescription="MenuItem",this.list=e,Object.assign(e,{menuItem:this}),this.listItems=Array.prototype.slice.call(e.children),this.handleListKeydown=this.handleListKeydown.bind(this),this.destroy=this.destroy.bind(this),this.init()}return c(t,[{key:Symbol.toStringTag,get:function(){return this.stringDescription}},{key:"init",value:function(){var e=this;this.menuItems=this.listItems.reduce(function(t,e){var n=e.firstElementChild;return null!==n&&"A"===n.nodeName?[].concat(J(t),[n]):t},[]),this.menuItemsLength=this.menuItems.length,this.menuItems.forEach(function(n){n.addEventListener("keydown",e.handleListKeydown);var i=e.constructor.nextElementIsUl(n);i&&(new t(i).previousSibling=n)});var n=r(this.menuItems,1);this.firstItem=n[0],this.lastItem=this.menuItems[this.menuItemsLength-1]}},{key:"handleListKeydown",value:function(t){var e=t.keyCode,n=X.UP,i=X.DOWN,s=X.LEFT,r=X.RIGHT,o=document.activeElement,a=this.list.contains(o)?o:this.menuItems[0],l=this.menuItems.length-1,h=this.menuItems.indexOf(a);if([n,i].includes(e)){t.stopPropagation(),t.preventDefault();var c=e===n?h-1:h+1;n===e&&c<0&&(c=l),i===e&&l0&&this.popups.forEach(function(t){var e;void 0!==t.target.menuItem&&"[object MenuItem]"===(null==t||null===(e=t.target)||void 0===e||null===(e=e.menuItem)||void 0===e?void 0:e.toString())&&t.target.menuItem.destroy(),t.destroy()})}}])}(),tt=function(){return c(function t(e){var n=e.element,i=e.children,s=e.options;o(this,t),this.element=n,this.children=i,this.options=s;var r=this.options,a=r.menuStylesheet,l=r.persist;this.persistMenuButton=!0===l,this.primaryMenu={},this.topicsMenu={},this.topicsSubMenu={};var h=void 0!==a?a:"primary-menu",c=this.children,u=c.toggle,p=c.navBar,m=c.actions,f=W("menu",h),v=H("has-children",h),y=f.querySelectorAll("".concat(v," > a")),b=W("topics-menu",h),g=W("topics-menu__list",h),w=W("list","topics-megamenu");Object.assign(this,{toggle:u,navBar:p,menu:f,topics:b,topicsList:g,actions:m,topicsMegaMenu:w,submenuLinks:y,menuButton:{}}),this.handleBreakpointChanges=this.handleBreakpointChanges.bind(this),this.setUpMenuButton=this.setUpMenuButton.bind(this),this.useHamburgerMenu=this.useHamburgerMenu.bind(this),this.setUpPrimaryMenu=this.setUpPrimaryMenu.bind(this),this.setUpPrimaryMenuItem=this.setUpPrimaryMenuItem.bind(this),this.setUpSecondaryMenuItems=this.setUpSecondaryMenuItems.bind(this),this.setUpSecondaryMenu=this.setUpSecondaryMenu.bind(this),this.addKeydownPatches=this.addKeydownPatches.bind(this),this.removeKeydownPatches=this.removeKeydownPatches.bind(this),this.patchTopLevelKeydown=this.patchTopLevelKeydown.bind(this),this.patchNavBarKeydown=this.patchNavBarKeydown.bind(this),this.patchMenuButtonKeydown=this.patchMenuButtonKeydown.bind(this),this.patchPrimaryMenuFirstItem=this.patchPrimaryMenuFirstItem.bind(this),this.patchTopicsMenuFirstItem=this.patchTopicsMenuFirstItem.bind(this),this.persistMenuButton?this.useHamburgerMenu():(this.handleBreakpointChanges(),d.lgMin.addListener(this.handleBreakpointChanges))},[{key:"handleBreakpointChanges",value:function(){d.lgMin.matches?(this.setUpPrimaryMenu(),this.topicsMenu instanceof Q&&this.topicsMenu.destroy(),this.menuButton instanceof Z&&this.menuButton.destroy(),this.removeKeydownPatches(),null!==this.topics&&this.topics.contains(document.activeElement)&&this.topicsMegaMenu.menu.firstItem.focus()):this.useHamburgerMenu()}},{key:"setUpMenuButton",value:function(){this.menuButton instanceof Z?this.menuButton.setup():this.menuButton=new Z({controller:this.toggle,target:this.navBar}),this.menuButton.controller.addEventListener("keydown",this.patchMenuButtonKeydown)}},{key:"setUpPrimaryMenu",value:function(){this.primaryMenu instanceof Q&&this.primaryMenu.destroy(),this.primaryMenu instanceof V?this.primaryMenu.init():this.primaryMenu=new V(this.menu)}},{key:"setUpPrimaryMenuItem",value:function(){this.primaryMenu instanceof V&&this.primaryMenu.destroy(),this.primaryMenu instanceof Q?this.primaryMenu.init():this.primaryMenu=new Q(this.menu)}},{key:"setUpSecondaryMenuItems",value:function(){null!==this.topics&&(this.topicsMenu instanceof Q?this.topicsMenu.init():this.topicsMenu=new Q(this.topics))}},{key:"setUpSecondaryMenu",value:function(){this.topicsMenu instanceof Q&&this.topicsMenu.destroy(),null!==this.topicsList&&(this.topicsSubMenu instanceof V?this.topicsSubMenu.init():this.topicsSubMenu=new V(this.topicsList))}},{key:"useHamburgerMenu",value:function(){this.setUpMenuButton(),this.setUpPrimaryMenuItem(),this.setUpSecondaryMenuItems(),this.setUpSecondaryMenu(),this.addKeydownPatches(),(this.navBar.contains(document.activeElement)||null!==this.topics&&this.topics.contains(document.activeElement))&&this.menuButton.controller.focus()}},{key:"removeKeydownPatches",value:function(){(this.primaryMenu instanceof Q||this.primaryMenu instanceof V)&&this.primaryMenu.firstItem.removeEventListener("keydown",this.patchPrimaryMenuFirstItem),this.topicsMenu instanceof Q&&this.topicsMenu.firstItem.removeEventListener("keydown",this.patchTopicsMenuFirstItem),this.menu.removeEventListener("keydown",this.patchTopLevelKeydown),null!==this.topics&&this.topics.removeEventListener("keydown",this.patchTopLevelKeydown),this.navBar.removeEventListener("keydown",this.patchNavBarKeydown)}},{key:"addKeydownPatches",value:function(){this.primaryMenu.firstItem.addEventListener("keydown",this.patchPrimaryMenuFirstItem),null!==this.topics&&this.topicsMenu.firstItem.addEventListener("keydown",this.patchTopicsMenuFirstItem),this.menu.addEventListener("keydown",this.patchTopLevelKeydown),null!==this.topics&&this.topics.addEventListener("keydown",this.patchTopLevelKeydown),this.navBar.addEventListener("keydown",this.patchNavBarKeydown)}},{key:"patchTopLevelKeydown",value:function(t){var e=t.keyCode,n=t.target;X.LEFT!==e||void 0!==n.menuItem&&void 0!==n.menuItem.previousSibling||(this.menuButton.setExpandedState(!1),this.menuButton.controller.focus())}},{key:"patchNavBarKeydown",value:function(t){var e=t.keyCode,n=X.HOME,i=X.END;n===e?(t.preventDefault(),this.menuButton.firstItem.focus()):i===e&&(t.preventDefault(),this.menuButton.lastItem.focus())}},{key:"patchTopicsMenuFirstItem",value:function(t){var e=t.keyCode,n=X.UP;X.DOWN===e&&void 0!==this.primaryMenu.firstItem?(t.preventDefault(),this.primaryMenu.firstItem.focus()):n===e&&(t.preventDefault(),this.menuButton.lastItem.focus())}},{key:"patchPrimaryMenuFirstItem",value:function(t){var e=t.keyCode;X.UP===e&&void 0!==this.topicsMenu.firstItem&&(t.preventDefault(),this.topicsMenu.firstItem.focus())}},{key:"patchMenuButtonKeydown",value:function(t){var e=t.keyCode,n=X.UP;[n,X.DOWN].includes(e)&&(t.preventDefault(),this.menuButton.state.expanded||this.menuButton.setExpandedState(!0),n===e?this.menuButton.lastItem.focus():this.menuButton.firstItem.focus())}}])}(),et=p(sciencenewsClassnames["nav-bar-collapsed"]);e({name:"nav-bar-collapsed",component:tt,querySelector:{toggle:et.toggle,navBar:et.navBar,actions:et.actions},querySelectorAll:{},options:{menuStylesheet:"primary-menu-collapsed",persist:!0}});var nt=function(){return c(function t(e,n,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:250;o(this,t),Object.assign(this,{callback:i,event:n,element:e,frequency:s,timeout:!1}),this.requestTick=this.requestTick.bind(this),this.update=this.update.bind(this),this.callback?this.element.addEventListener(this.event,this.requestTick):console.error("Throttle error: you must specify a callback.")},[{key:"update",value:function(){this.callback(),window.clearTimeout(this.timeout),this.timeout=!1}},{key:"requestTick",value:function(){var t=this;this.timeout||(this.timeout=window.setTimeout(function(){window.requestAnimationFrame(t.update)},this.frequency))}},{key:"destroy",value:function(){this.element.removeEventListener(this.event,this.requestTick)}}])}(),it=function(){return c(function t(e){o(this,t),this.init=this.init.bind(this),this.handleResize=this.handleResize.bind(this),this.destroy=this.destroy.bind(this),0===Object.keys(e).filter(function(t){return!e[t]}).length&&(Object.assign(this,{wrapper:null,menu:null,button:null,overflow:null,onOverflowUpdate:function(){}},e),this.init())},[{key:"init",value:function(){this.breakWidths=[],this.overflowWrapper=this.button.parentElement,this.overflow.setAttribute("hidden",""),this.handleResize(),this.resize=new nt(window,"resize",this.handleResize)}},{key:"handleResize",value:function(){var t=this.overflowWrapper.hasAttribute("hidden")?this.wrapper.offsetWidth:this.wrapper.offsetWidth-this.button.offsetWidth;if(this.menu.offsetWidth>t){var e=this.overflowWrapper.previousElementSibling;null!==e&&(this.breakWidths.push(this.menu.offsetWidth),this.overflow.insertBefore(e,this.overflow.firstElementChild),this.overflowWrapper.removeAttribute("hidden"))}else t>this.breakWidths[this.breakWidths.length-1]&&(this.menu.insertBefore(this.overflow.firstElementChild,this.overflowWrapper),this.breakWidths.pop()),0!==this.breakWidths.length&&null!==this.overflow.firstElementChild||this.overflowWrapper.setAttribute("hidden","");this.menu.offsetWidth>t?this.handleResize():this.onOverflowUpdate.call(this,this.overflow.children.length)}},{key:"destroy",value:function(){var t=this;this.breakWidths=[],this.resize instanceof nt&&this.resize.destroy(),this.overflowWrapper.setAttribute("hidden",""),Array.from(this.overflow.children).forEach(function(e){t.menu.insertBefore(e,t.overflowWrapper)})}}])}();class st{constructor(){this.state={},this.searchString="",this.referenceElements=[],this.setState=this.setState.bind(this),this.getState=this.getState.bind(this),this.setSelfReference=this.setSelfReference.bind(this),this.warnDeprecated=this.warnDeprecated.bind(this)}setState(t){Object.assign(this.state,t),"function"==typeof this.stateWasUpdated&&this.stateWasUpdated()}setSelfReference(t){const e=[...t].map(t=>(Object.defineProperty(t,this.componentName.toLowerCase(),{value:this,configurable:!0}),t));this.referenceElements=[...this.referenceElements,...e]}deleteSelfReferences(){this.referenceElements.forEach(t=>{delete t[this.componentName.toLowerCase()]})}getState(){return this.state}warnDeprecated(t,e=!1){const n=e?`Use ${e} instead.`:"";console.warn(`${this.componentName}:`,`${t} is deprecated.`,`${n}`)}}const rt=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40}),ot=function(t){const e=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(","),n=t.querySelectorAll(e);return Array.prototype.slice.call(n)};function at(t){if(Array.isArray(t))return t;let e=[];return t instanceof HTMLElement?e=new Array(t):(t instanceof NodeList||t instanceof HTMLCollection)&&(e=Array.prototype.slice.call(t,0)),e}function lt(t){(Array.isArray(t)?t:at(t)).forEach(t=>{t.removeAttribute("tabindex")})}function ht(t){(Array.isArray(t)?t:at(t)).forEach(t=>{t.setAttribute("tabindex","-1")})}function ct(t,e){const n=Array.isArray(e)?e:at(e),i=Array.isArray(t)?t:at(t);lt(n),0!n.includes(t)))}function ut(t){null!==t&&""===t.id&&t.setAttribute("id",function(t=36){const[,e]=Math.random().toString(t).split(".");return`id_${e}`}())}function dt(t){const e=at(t),n=e.length-1,{0:i,[n]:s}=e;return[i,s]}class pt extends st{constructor(t){super(t),this.componentName="Popup",Object.assign(this,{controller:null,target:null,type:"true",onInit:()=>{},onStateChange:()=>{},onDestroy:()=>{}},t),this.state={expanded:!1},this.init=this.init.bind(this),this.setInteractiveChildren=this.setInteractiveChildren.bind(this),this.stateWasUpdated=this.stateWasUpdated.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.controllerClickHandler=this.controllerClickHandler.bind(this),this.controllerKeyDownHandler=this.controllerKeyDownHandler.bind(this),this.targetKeyDownHandler=this.targetKeyDownHandler.bind(this),this.hideOnTabOut=this.hideOnTabOut.bind(this),this.hideOnOutsideClick=this.hideOnOutsideClick.bind(this),this.destroy=this.destroy.bind(this),this.controllerIsNotAButton="BUTTON"!==this.controller.nodeName&&null===this.controller.getAttribute("role"),null!==this.controller&&null!==this.target&&this.init()}setInteractiveChildren(){const{expanded:t}=this.state;if(this.interactiveChildElements=ot(this.target),t?lt(this.interactiveChildElements):ht(this.interactiveChildElements),0{t.getAttribute("id").includes("id_")&&t.removeAttribute("id")}),this.controller.removeAttribute("aria-haspopup"),this.controller.removeAttribute("aria-expanded"),this.controller.removeAttribute("aria-controls"),this.controller.removeAttribute("aria-owns"),this.controllerIsNotAButton&&(this.controller.removeAttribute("role"),this.controller.removeAttribute("tabindex")),this.target.removeAttribute("aria-hidden"),this.target.removeAttribute("hidden"),lt(this.interactiveChildElements),this.controller.removeEventListener("click",this.controllerClickHandler),this.controller.removeEventListener("keydown",this.controllerKeyDownHandler),this.target.removeEventListener("keydown",this.targetKeyDownHandler),document.body.removeEventListener("click",this.hideOnOutsideClick),this.state={expanded:!1},this.onDestroy.call(this)}show(){this.setState({expanded:!0})}hide(){this.setState({expanded:!1})}}class mt{constructor(t){switch(this.searchString="",this.clearSearch=null,!0){case Array.isArray(t):this.items=t;break;case t instanceof NodeList:this.items=Array.prototype.slice.call(t,0);break;case null!==t&&"UL"===t.nodeName:this.items=Array.prototype.slice.call(t.children,0);break;default:this.items=null}}getItem(t){if(null!==this.items){const e=String.fromCharCode(t);this.searchString+=e,null!==this.clearSearch&&(clearTimeout(this.clearSearch),this.clearSearch=null),this.clearSearch=setTimeout(()=>{this.searchString="",this.clearSearch=null},500);const n=this.items.filter(t=>0===t.textContent.toLowerCase().indexOf(this.searchString.toLowerCase()));return n.length?n[0]:null}return null}}class ft extends st{constructor(t){super(t),this.componentName="Disclosure",Object.assign(this,{controller:null,target:null,loadOpen:!1,allowOutsideClick:!0,onInit:()=>{},onStateChange:()=>{},onDestroy:()=>{}},t),this.state={expanded:this.loadOpen},this.setInteractiveChildren=this.setInteractiveChildren.bind(this),this.init=this.init.bind(this),this.destroy=this.destroy.bind(this),this.open=this.open.bind(this),this.close=this.close.bind(this),this.handleControllerKeydown=this.handleControllerKeydown.bind(this),this.toggleExpandedState=this.toggleExpandedState.bind(this),this.closeOnOutsideClick=this.closeOnOutsideClick.bind(this),this.stateWasUpdated=this.stateWasUpdated.bind(this),null!==this.controller&&null!==this.target&&this.init()}setInteractiveChildren(){const{expanded:t}=this.state;this.interactiveChildElements=ot(this.target),t?lt(this.interactiveChildElements):ht(this.interactiveChildElements)}init(){super.setSelfReference([this.controller,this.target]);const{expanded:t}=this.state;[this.controller,this.target].forEach(t=>{ut(t)}),this.controller.setAttribute("aria-expanded",`${t}`),this.controller.setAttribute("aria-controls",this.target.id),"BUTTON"!==this.controller.nodeName&&(this.controller.setAttribute("role","button"),"A"!==this.controller.nodeName&&null===this.controller.getAttribute("tabindex")&&this.controller.setAttribute("tabindex","0")),this.target!==this.controller.nextElementSibling&&this.controller.setAttribute("aria-owns",this.target.id),t||(this.target.setAttribute("aria-hidden","true"),this.target.setAttribute("hidden","")),this.controller.addEventListener("click",this.toggleExpandedState),this.controller.addEventListener("keydown",this.handleControllerKeydown),this.allowOutsideClick||document.body.addEventListener("click",this.closeOnOutsideClick),this.setInteractiveChildren(),this.onInit.call(this)}stateWasUpdated(){const{expanded:t}=this.state;this.controller.setAttribute("aria-expanded",`${t}`),t?(this.target.setAttribute("aria-hidden","false"),this.target.removeAttribute("hidden")):(this.target.setAttribute("aria-hidden","true"),this.target.setAttribute("hidden","")),t?lt(this.interactiveChildElements):ht(this.interactiveChildElements),this.onStateChange.call(this,this.state)}handleControllerKeydown(t){const{SPACE:e,RETURN:n}=rt,{keyCode:i}=t;[e,n].includes(i)&&this.toggleExpandedState(t)}toggleExpandedState(t){t.preventDefault(),this.state.expanded?this.close():this.open()}closeOnOutsideClick(t){this.state.expanded&&t.target!==this.controller&&!this.target.contains(t.target)&&this.close()}destroy(){this.deleteSelfReferences(),[this.controller,this.target].forEach(t=>{t.getAttribute("id").includes("id_")&&t.removeAttribute("id")}),this.controller.removeAttribute("aria-expanded"),this.controller.removeAttribute("aria-controls"),this.controller.removeAttribute("aria-owns"),this.controller.removeAttribute("tabindex"),"BUTTON"!==this.controller.nodeName&&this.controller.removeAttribute("role"),this.target.removeAttribute("aria-hidden"),this.target.removeAttribute("hidden"),lt(this.interactiveChildElements),this.controller.removeEventListener("click",this.toggleExpandedState),this.controller.removeEventListener("keydown",this.handleControllerKeydown),document.body.removeEventListener("click",this.closeOnOutsideClick),this.state={expanded:this.loadOpen},this.onDestroy.call(this)}open(){this.setState({expanded:!0})}close(){this.setState({expanded:!1})}}function vt(t,e){return null!=t&&t instanceof e}function yt(t,e,n,i){const{next:s,previous:r}=i,o=n.indexOf(e),a=n.length-1;let l=t===r?o-1:o+1;return r===t&&0>l&&(l=a),s===t&&a{},onDestroy:()=>{}},t),this.setMenuItems=this.setMenuItems.bind(this),this.handleListKeydown=this.handleListKeydown.bind(this),this.destroy=this.destroy.bind(this),null!==this.list&&"UL"===this.list.nodeName&&this.init()}setMenuItems(){this.disclosures=[],this.menuItems=Array.from(this.list.children).reduce((t,e)=>{const[n,...i]=Array.from(e.children);let s=n;return null!==s&&s.matches("a,button")||([s]=Array.from(i).filter(t=>t.matches("a,button"))),void 0!==s&&s.matches(this.itemMatches)?[...t,s]:t},[]),this.search=new mt(this.menuItems),this.menuItems.forEach((t,e)=>{t.parentElement.setAttribute("role","presentation"),t.setAttribute("role","menuitem"),t.setAttribute("aria-setsize",this.menuItems.length),t.setAttribute("aria-posinset",e+1);const n=this.constructor.nextElementIsUl(t);if(n){if(this.collapse){const e=new ft({controller:t,target:n});this.disclosures.push(e)}new bt({list:n,itemMatches:this.itemMatches}).previousSibling=t}});const[t,e]=dt(this.menuItems);Object.assign(this,{firstItem:t,lastItem:e})}init(){super.setSelfReference([this.list]),this.list.setAttribute("role","menu"),this.setMenuItems(),this.list.addEventListener("keydown",this.handleListKeydown),this.onInit.call(this)}handleListKeydown(t){const{keyCode:e}=t,{UP:n,DOWN:i,LEFT:s,RIGHT:r,HOME:o,END:a,ESC:l}=rt,{activeElement:h}=document,c=this.list.contains(h)?h:this.menuItems[0];switch(e){case n:case i:{const n=function(t,e,n){const{UP:i,DOWN:s}=rt;return yt(t,e,n,{previous:i,next:s})}(e,c,this.menuItems);n&&(t.stopPropagation(),t.preventDefault(),n.focus());break}case o:t.preventDefault(),this.firstItem.focus();break;case a:t.preventDefault(),this.lastItem.focus();break;case r:{const e=this.constructor.nextElementIsUl(c);if(e&&vt(e.menu,bt)){t.stopPropagation(),t.preventDefault(),vt(c.disclosure,ft)&&c.disclosure.open();const{menu:n}=e;n.firstItem.focus()}break}case s:void 0===this.previousSibling||this.previousSibling.hasAttribute("aria-haspopup")||(t.preventDefault(),t.stopPropagation(),vt(this.previousSibling.disclosure,ft)&&this.previousSibling.disclosure.close(),this.previousSibling.focus());break;case l:break;default:{t.stopPropagation();const n=this.search.getItem(e);null!==n&&n.focus();break}}}destroy(){this.deleteSelfReferences(),this.list.removeAttribute("role"),this.list.removeEventListener("keydown",this.handleListKeydown),this.menuItems.forEach(t=>{t.parentElement.removeAttribute("role"),t.removeAttribute("role"),t.removeAttribute("aria-setsize"),t.removeAttribute("aria-posinset");const e=this.constructor.nextElementIsUl(t);e&&vt(e.menu,bt)&&e.menu.destroy()}),this.disclosures.forEach(t=>{t.destroy()}),this.onDestroy.call(this)}}class gt extends st{static getPopupFromMenubarItem(t){return!!vt(t.popup,pt)&&t.popup}constructor(t){super(t),this.componentName="MenuBar",Object.keys(t).forEach(e=>{if("menu"===e){const{menu:e}=t;Object.assign(t,{list:e,menu:void 0}),this.warnDeprecated("config.menu","config.list")}["onPopupDestroy","onPopupStateChange"].includes(e)&&this.warnDeprecated(`config.${e}`)}),Object.assign(this,{list:null,itemMatches:"*",onInit:()=>{},onStateChange:()=>{},onDestroy:()=>{},onPopupInit:()=>{}},t),this.setMenuBarItems=this.setMenuBarItems.bind(this),this.setMenuBarSubMenuItems=this.setMenuBarSubMenuItems.bind(this),this.handleMenuBarKeydown=this.handleMenuBarKeydown.bind(this),this.handleMenuBarClick=this.handleMenuBarClick.bind(this),this.handleMenuItemKeydown=this.handleMenuItemKeydown.bind(this),this.stateWasUpdated=this.stateWasUpdated.bind(this),this.onPopupStateChange=this.onPopupStateChange.bind(this),this.destroy=this.destroy.bind(this),null!==this.list&&"UL"===this.list.nodeName&&this.init()}setMenuBarItems(){this.menuBarItems=Array.from(this.list.children).reduce((t,e)=>{const[n,...i]=Array.from(e.children);let s=n;return null!==s&&s.matches("a,button")||([s]=Array.from(i).filter(t=>t.matches("a,button"))),void 0!==s&&s.matches(this.itemMatches)?[...t,s]:t},[]),this.search=new mt(this.menuBarItems),this.menuBarItems.forEach((t,e)=>{t.setAttribute("role","menuitem"),t.setAttribute("aria-setsize",this.menuBarItems.length),t.setAttribute("aria-posinset",e+1),t.parentElement.setAttribute("role","presentation"),t.parentElement.addEventListener("keydown",this.handleMenuBarKeydown),t.addEventListener("click",this.handleMenuBarClick)});const[t,e]=dt(this.menuBarItems);Object.assign(this,{firstItem:t,lastItem:e});const n=this.menuBarItems.includes(document.activeElement)?document.activeElement:this.firstItem;ct(this.menuBarItems,n)}setMenuBarSubMenuItems(){const{popups:t,subMenus:e}=this.menuBarItems.reduce((t,e)=>{const n=e.nextElementSibling;if(null===n)return t;const i=new pt({controller:e,target:n,onInit:this.onPopupInit,onStateChange:this.onPopupStateChange,type:"menu"});t.popups.push(i);const s="UL"===n.nodeName?n:n.querySelector("ul");if(null===s)return t;const r=new bt({list:s,itemMatches:this.itemMatches});return n.addEventListener("keydown",this.handleMenuItemKeydown),r.previousSibling=e,t.subMenus.push(r),t},{popups:[],subMenus:[]});Object.assign(this,{popups:t,subMenus:e})}init(){super.setSelfReference([this.list]),this.list.setAttribute("role","menubar"),this.setMenuBarItems(),this.clickEvent=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}),this.setMenuBarSubMenuItems(),this.state={menubarItem:this.firstItem,popup:this.constructor.getPopupFromMenubarItem(this.firstItem),expanded:!1},this.onInit.call(this)}stateWasUpdated(){const{menubarItem:t}=this.state;ct(this.menuBarItems,t),t.focus(),this.onStateChange.call(this,this.state)}onPopupStateChange({expanded:t}){this.setState({expanded:t})}handleMenuBarKeydown(t){const{LEFT:e,RIGHT:n,DOWN:i,HOME:s,END:r,SPACE:o,RETURN:a}=rt,{keyCode:l}=t,{menubarItem:h}=this.state,c=this.constructor.getPopupFromMenubarItem(h);switch(l){case e:case n:{const e=function(t,e,n){const{LEFT:i,RIGHT:s}=rt;return yt(t,e,n,{previous:i,next:s})}(l,h,this.menuBarItems);e&&(t.stopPropagation(),t.preventDefault(),!1!==c&&c.hide(),this.setState({menubarItem:e}));break}case o:case a:case i:!1!==c&&t.target===c.controller&&(t.stopPropagation(),t.preventDefault(),c.state.expanded||c.show(),c.firstInteractiveChild.focus());break;case s:{t.preventDefault();const[e]=this.menuBarItems;this.setState({menubarItem:e});break}case r:t.preventDefault(),this.setState({menubarItem:this.lastItem});break;default:{const t=this.search.getItem(l);null!==t&&this.setState({menubarItem:t});break}}}handleMenuBarClick(t){this.setState({menubarItem:t.target})}handleMenuItemKeydown(t){const{SPACE:e,RETURN:n}=rt,{keyCode:i,target:s}=t;[e,n].includes(i)&&"A"===s.nodeName&&(t.stopPropagation(),t.preventDefault(),s.dispatchEvent(this.clickEvent))}destroy(){this.deleteSelfReferences(),this.list.removeAttribute("role"),this.menuBarItems.forEach(t=>{t.parentElement.removeAttribute("role"),t.removeAttribute("aria-setsize"),t.removeAttribute("aria-posinset"),t.removeAttribute("role"),t.parentElement.removeEventListener("keydown",this.handleMenuBarKeydown),t.removeEventListener("click",this.handleMenuBarClick)}),lt(this.menuBarItems),this.popups.forEach(t=>{t.target.removeEventListener("keydown",this.handleMenuItemKeydown),t.destroy()}),this.subMenus.forEach(t=>{t.destroy()}),this.onDestroy.call(this)}}var wt=function(){return c(function t(e){var n=e.element,i=e.children,s=e.options;o(this,t),this.element=n,this.children=i,this.options=s,this.init=this.init.bind(this),this.setPriorityNav=this.setPriorityNav.bind(this),this.setMenuBar=this.setMenuBar.bind(this),this.handleMenuBarStateChanges=this.handleMenuBarStateChanges.bind(this);var r=this.options.selectors.more;this.notMoreSelector=":not(".concat(r,")"),this.init()},[{key:"handleMenuBarStateChanges",value:function(t){var e=t.menubarItem,n=t.expanded,i=this.options.classnames,s=i.more,r=i.active,o=i.activeOverflow,a=this.children,l=a.overflow,h=a.priority;this.menuBar.popups.forEach(function(t){var e=t.controller.parentElement;!0!==t.getState().expanded||t.controller.classList.contains(s)?e.classList.remove(r):e.classList.add(r)}),n&&l.contains(e)?h.classList.add(o):h.classList.remove(o)}},{key:"setPriorityNav",value:function(){if(d.lgMin.matches)this.priorityNav instanceof it&&this.priorityNav.destroy(),this.menuBar.itemMatches=this.notMoreSelector,this.menuBar.setMenuBarItems();else{var t=this.children,e=t.menu,n=t.overflow,i=t.more;this.priorityNav=new it({wrapper:this.element,menu:e,overflow:n,button:i,onOverflowUpdate:this.setMenuBar})}}},{key:"setMenuBar",value:function(t){var e=this.children.overflow;this.menuBar.itemMatches=t>0?"*":this.notMoreSelector,this.menuBar.setMenuBarItems();var n=e.menu,i=e.popup;void 0!==n&&n.setMenuItems(),void 0!==i&&i.setInteractiveChildren()}},{key:"init",value:function(){var t=this.children.menu,e=this.options.selectors.close;this.menuBar=new gt({list:t,itemMatches:d.lgMin.matches?this.notMoreSelector:"*",onStateChange:this.handleMenuBarStateChanges}),this.menuBar.popups.forEach(function(t){var n=t.controller,i=t.target.querySelector(e);null!==i&&i.addEventListener("click",function(){t.hide(),n.focus()})}),this.setPriorityNav(),d.lgMin.addListener(this.setPriorityNav)}}])}(),kt=sciencenewsClassnames["snc-menu"],Et=p(kt),It=Et.more,St=Et.overflow;e({name:"snc-menu",component:wt,querySelector:{menu:Et.menu,more:It,overflow:St,priority:Et.priority},options:{classnames:kt,selectors:Et}})})()})(); //# sourceMappingURL=centennial.bundle.min.js.map; (()=>{var e={510(e,t,i){var s;!function(t){"use strict";var r=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){return setTimeout(e,16)};function n(){var e=this;e.reads=[],e.writes=[],e.raf=r.bind(t)}function a(e){e.scheduled||(e.scheduled=!0,e.raf(o.bind(null,e)))}function o(e){var t,i=e.writes,s=e.reads;try{s.length,e.runTasks(s),i.length,e.runTasks(i)}catch(e){t=e}if(e.scheduled=!1,(s.length||i.length)&&a(e),t){if(t.message,!e.catch)throw t;e.catch(t)}}function l(e,t){var i=e.indexOf(t);return!!~i&&!!e.splice(i,1)}n.prototype={constructor:n,runTasks:function(e){for(var t;t=e.shift();)t()},measure:function(e,t){var i=t?e.bind(t):e;return this.reads.push(i),a(this),i},mutate:function(e,t){var i=t?e.bind(t):e;return this.writes.push(i),a(this),i},clear:function(e){return l(this.reads,e)||l(this.writes,e)},extend:function(e){if("object"!=typeof e)throw new Error("expected object");var t=Object.create(this);return function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}(t,e),t.fastdom=this,t.initialize&&t.initialize(),t},catch:null};var h=t.fastdom=t.fastdom||new n;void 0===(s=function(){return h}.call(h,i,h,e))||(e.exports=s)}("undefined"!=typeof window?window:void 0!==this?this:globalThis)}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var i=function(t){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,"string");if("object"!=e(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(i)?i:i+""}function s(e,i){for(var s=0;s=t&&(this.perPage=this.config.perPage[t])}},{key:"prev",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop)if(this.currentSlide-e<0){this.disableTransition();var s=this.currentSlide+this.innerElements.length,r=s+this.perPage,n=(this.config.rtl?1:-1)*r*(this.selectorWidth/this.perPage),a=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d(".concat(n+a,"px, 0, 0)"),this.currentSlide=s-e}else this.currentSlide=this.currentSlide-e;else this.currentSlide=Math.max(this.currentSlide-e,0);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop)if(this.currentSlide+e>this.innerElements.length-this.perPage){this.disableTransition();var s=this.currentSlide-this.innerElements.length,r=s+this.perPage,n=(this.config.rtl?1:-1)*r*(this.selectorWidth/this.perPage),a=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d(".concat(n+a,"px, 0, 0)"),this.currentSlide=s+e}else this.currentSlide=this.currentSlide+e;else this.currentSlide=Math.min(this.currentSlide+e,this.innerElements.length-this.perPage);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"disableTransition",value:function(){this.sliderFrame.style.webkitTransition="all 0ms ".concat(this.config.easing),this.sliderFrame.style.transition="all 0ms ".concat(this.config.easing)}},{key:"enableTransition",value:function(){this.sliderFrame.style.webkitTransition="all ".concat(this.config.duration,"ms ").concat(this.config.easing),this.sliderFrame.style.transition="all ".concat(this.config.duration,"ms ").concat(this.config.easing)}},{key:"goTo",value:function(e,t){if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;this.currentSlide=this.config.loop?e%this.innerElements.length:Math.min(Math.max(e,0),this.innerElements.length-this.perPage),i!==this.currentSlide&&(this.slideToCurrent(),this.config.onChange.call(this),t&&t.call(this))}}},{key:"slideToCurrent",value:function(e){var t=this,i=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,s=(this.config.rtl?1:-1)*i*(this.selectorWidth/this.perPage);e?requestAnimationFrame(function(){requestAnimationFrame(function(){t.enableTransition(),t.sliderFrame.style[t.transformProperty]="translate3d(".concat(s,"px, 0, 0)")})}):this.sliderFrame.style[this.transformProperty]="translate3d(".concat(s,"px, 0, 0)")}},{key:"updateAfterDrag",value:function(){var e=(this.config.rtl?-1:1)*(this.drag.endX-this.drag.startX),t=Math.abs(e),i=this.config.multipleDrag?Math.ceil(t/(this.selectorWidth/this.perPage)):1,s=e>0&&this.currentSlide-i<0,r=e<0&&this.currentSlide+i>this.innerElements.length-this.perPage;e>0&&t>this.config.threshold&&this.innerElements.length>this.perPage?this.prev(i):e<0&&t>this.config.threshold&&this.innerElements.length>this.perPage&&this.next(i),this.slideToCurrent(s||r)}},{key:"resizeHandler",value:function(){this.resolveSlidesNumber(),this.currentSlide+this.perPage>this.innerElements.length&&(this.currentSlide=this.innerElements.length<=this.perPage?0:this.innerElements.length-this.perPage),this.selectorWidth=this.selector.offsetWidth,this.buildSliderFrame()}},{key:"clearDrag",value:function(){this.drag={startX:0,endX:0,startY:0,letItGo:null,preventClick:this.drag.preventClick}}},{key:"touchstartHandler",value:function(e){-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)||(e.stopPropagation(),this.pointerDown=!0,this.drag.startX=e.touches[0].pageX,this.drag.startY=e.touches[0].pageY)}},{key:"touchendHandler",value:function(e){e.stopPropagation(),this.pointerDown=!1,this.enableTransition(),this.drag.endX&&this.updateAfterDrag(),this.clearDrag()}},{key:"touchmoveHandler",value:function(e){if(e.stopPropagation(),null===this.drag.letItGo&&(this.drag.letItGo=Math.abs(this.drag.startY-e.touches[0].pageY)=this.innerElements.length)throw new Error("Item to remove doesn't exist 😭");var i=ethis.innerElements.length+1)throw new Error("Unable to inset it at this index 😭");if(-1!==this.innerElements.indexOf(e))throw new Error("The same item in a carousel? Really? Nope 😭");var s=t<=this.currentSlide>0&&this.innerElements.length;this.currentSlide=s?this.currentSlide+1:this.currentSlide,this.innerElements.splice(t,0,e),this.buildSliderFrame(),i&&i.call(this)}},{key:"prepend",value:function(e,t){this.insert(e,0),t&&t.call(this)}},{key:"append",value:function(e,t){this.insert(e,this.innerElements.length+1),t&&t.call(this)}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if(this.detachEvents(),this.selector.style.cursor="auto",e){for(var i=document.createDocumentFragment(),s=0;s{a().mutate(()=>{this.carousel.resizeHandler()})},{once:!0}),a().mutate(()=>{this.classList.add(this.initializedClass)}),this.previousSlide=this.carousel.currentSlide,this.prev=document.getElementById(this.getAttribute("control-previous")),null!=this.prev&&(a().mutate(()=>{this.prev.classList.add("control-previous--initialized")}),this.prev.addEventListener("click",this.onPrevClick),this.prev.setAttribute("aria-disabled","true")),this.next=document.getElementById(this.getAttribute("control-next")),null!=this.next&&(a().mutate(()=>{this.next.classList.add("control-next--initialized")}),this.next.addEventListener("click",this.onNextClick)),this.ariaLiveRegion=this.getAriaLiveRegion(),this.setAttribute("role","region"),this.tabIndex=0,this.updateSlideAttributes(),this.updateAriaLiveRegion(0)}updateSlideAttributes(){const e=Array.from(this.carousel.innerElements),t=e.splice(this.carousel.currentSlide,this.carousel.perPage);e.forEach(e=>{e.setAttribute("tabindex","-1"),e.setAttribute("aria-hidden",!0),o(e).forEach(e=>{e.setAttribute("tabindex","-1")})}),t.forEach(e=>{e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden"),o(e).forEach(e=>{e.removeAttribute("tabindex")})})}updateCarouselButtons(){const{currentSlide:e}=this.carousel,t=0===e,i=e===this.slideCount+1||e+this.carousel.perPage>=this.slideCount;null!=this.prev&&this.prev.setAttribute("aria-disabled",`${t}`),null!=this.next&&this.next.setAttribute("aria-disabled",`${i}`)}getAriaLiveRegion(){const e=document.createElement("div");return e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.classList.add("screen-reader-text"),this.parentNode.insertBefore(e,this.nextSibling),e}updateAriaLiveRegion(e){const t=e+1,i=this.slideCount>e+this.carousel.perPage?e+this.carousel.perPage:this.slideCount,s=this.carousel.perPage>1?`Items ${t} through ${i} of ${this.slideCount}`:`Item ${t} of ${this.slideCount}`;this.ariaLiveRegion.textContent=s}cleanup(){this.ariaLiveRegion.remove(),null!=this.prev&&(this.prev.removeEventListener("click",this.onPrevClick),this.prev.classList.remove("control-previous--initialized")),null!=this.next&&(this.next.removeEventListener("click",this.onNextClick),this.next.classList.remove("control-next--initialized"))}disconnectedCallback(){this.cleanup()}destroy(){this.carousel.destroy(!0,()=>{a().mutate(()=>{this.classList.remove(this.initializedClass)})}),Array.from(this.carousel.innerElements).forEach(e=>{e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden"),o(e).forEach(e=>{e.removeAttribute("tabindex")})}),this.removeAttribute("tabindex"),this.cleanup()}}customElements.define("ai-carousel",c)})()})(); //# sourceMappingURL=centennial-landing.bundle.min.js.map;