(()=>{"use strict";var e,t,r={162(e,t,r){r.d(t,{J:()=>o,b:()=>i});const n={headers:{"Content-Type":"application/json",Accept:"application/json"}};function a(e){return`https://api.rushmypassport.com/api/${e.startsWith("/")?e.slice(1):e}`}async function o(e){const t=a(e),r=await fetch(t,{method:"GET",...n});if(!r.ok){const e=await r.text();throw new Error(`API ${r.status}: ${e||r.statusText}`)}const o=await r.json();return o&&"object"==typeof o&&"data"in o?o.data:o}async function i(e,t={}){const r=a(e),o=await fetch(r,{method:"POST",...n,body:JSON.stringify(t)});if(!o.ok){const e=await o.text();throw new Error(`API ${o.status}: ${e||o.statusText}`)}const i=await o.json();return i&&"object"==typeof i&&"data"in i?i.data:i}}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.m=r,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>"assets/js/"+e+"."+{131:"fffef984",192:"635a9e6c"}[e]+".js",a.miniCssF=e=>{},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="rmp-web:",a.l=(r,n,o,i)=>{if(e[r])e[r].push(n);else{var s,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+o){s=u;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",t+o),s.src=r),e[r]=[n];var f=(t,n)=>{s.onerror=s.onload=null,clearTimeout(p);var a=e[r];if(delete e[r],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach(e=>e(n)),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.p="/newlp/",(()=>{var e={792:0};a.f.j=(t,r)=>{var n=a.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,a)=>n=e[t]=[r,a]);r.push(n[2]=o);var i=a.p+a.u(t),s=new Error;a.l(i,r=>{if(a.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",s.name="ChunkLoadError",s.type=o,s.request=i,n[1](s)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,o,[i,s,c]=r,l=0;if(i.some(t=>0!==e[t])){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);if(c)c(a)}for(t&&t(r);l<i.length;l++)o=i[l],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=self.webpackChunkrmp_web=self.webpackChunkrmp_web||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();async function o(){window.location.pathname.replace(/\/$/,"")}var i=a(162);let s=null,c=null;function l(e){if(!Array.isArray(e))return e;const t=["CA-N","CA-S","DC","MNP","VIR","PR","ASM","GUM","XMI","PRI"];return[...e.filter(e=>!t.includes(e.value)),{value:"CA",label:"California"}].sort((e,t)=>e.label.localeCompare(t.label))}function d(e,t,r=""){if(!e||!Array.isArray(t))return;const n=e.querySelector('option[value=""]'),a=document.createDocumentFragment();t.forEach(({value:e,label:t})=>{const r=document.createElement("option");r.value=e,r.textContent=t,a.appendChild(r)}),e.replaceChildren(a),n&&e.insertBefore(n,e.firstChild),r&&e.querySelector(`option[value="${r}"]`)&&(e.value=r)}async function u(){if(window.location.pathname.includes("services/travel-visa"))try{const[e,t]=await Promise.all([(null===s&&(s=(0,i.J)("populate/countries").catch(e=>{throw s=null,e})),s),(null===c&&(c=(0,i.J)("populate/states").then(l).catch(e=>{throw c=null,e})),c)]);!function(e,t){const r=document.getElementById("services-visa-citizen-of"),n=document.getElementById("services-visa-traveling-to"),a=document.getElementById("services-visa-residing-in");r&&d(r,e??[],"US"),n&&d(n,e??[],"CN"),a&&d(a,t??[],"CO")}(e,t)}catch(e){console.error("Error loading countries and/or states",e)}}function f(){const e=document.querySelector(".nav-toggle"),t=document.querySelector("#primary-nav"),r=t?.querySelector(".site-nav__close"),n=t?.querySelector(".site-nav__actions--mobile");if(!e||!t||!n)return;const a=window.matchMedia("(min-width: 1200px)"),o=e=>{document.documentElement.classList.toggle("nav-open",e)},i=()=>{const e=t.querySelector(".site-nav__mobile-body"),r=t.querySelector(".site-nav__list");e&&r&&e.appendChild(n)},s=()=>{t.querySelectorAll(".site-nav__item--has-submenu > .site-nav__link[aria-expanded]").forEach(e=>e.setAttribute("aria-expanded","false"))},c=r=>{t.dataset.open=r?"true":"false",e.setAttribute("aria-expanded",r?"true":"false"),o(r),r||(s(),i())};e.addEventListener("click",()=>{const e="true"===t.dataset.open;c(!e)}),r?.addEventListener("click",()=>c(!1)),document.addEventListener("keydown",e=>{"Escape"===e.key&&c(!1)}),t.querySelectorAll(".site-nav__item--has-submenu").forEach(e=>{const r=e.querySelector(":scope > .site-nav__link"),o=e.querySelector(":scope > .site-nav__submenu");r&&o&&r.addEventListener("click",e=>{if(a.matches)return;e.preventDefault();const s="true"===r.getAttribute("aria-expanded");var c;t.querySelectorAll(".site-nav__item--has-submenu > .site-nav__link[aria-expanded='true']").forEach(e=>{e!==r&&e.setAttribute("aria-expanded","false")}),s?(r.setAttribute("aria-expanded","false"),i()):(r.setAttribute("aria-expanded","true"),(c=o)&&c.appendChild(n))})}),a.addEventListener("change",r=>{r.matches&&(i(),s(),o(!1),t.dataset.open="false",e.setAttribute("aria-expanded","false"))})}function p({rootSelector:e,carouselSelector:t,cardSelector:r,indicatorsSelector:n,activeClass:a="active",rectOpacity:o=!0,onIndicatorUpdate:i=null,drag:s={enabled:!0,desktopOnly:!0,thresholdPx:140,thresholdRatio:.12,draggingClass:"is-dragging"},autoplay:c={enabled:!0,delay:4500,pauseOnInteraction:!0,resumeAfter:4500}}={}){const l=document.querySelector(e);if(!l)return null;const d=l.querySelector(t);if(!d)return null;const u=Array.from(l.querySelectorAll(r)),f=Array.from(l.querySelectorAll(n));if(!u.length||!f.length)return null;d.querySelectorAll("img").forEach(e=>e.draggable=!1);let p=null,v=!1,h=0;const m=e=>{f.forEach((t,r)=>{const n=r===e;if(t.classList.toggle(a,n),o){const e=t.querySelector("rect");e&&e.setAttribute("opacity",n?"1":"0.1")}"function"==typeof i&&i(t,n,r)})},y=()=>{const e=d.scrollLeft+d.clientWidth/2;let t=0,r=1/0;for(let n=0;n<u.length;n++){const a=u[n],o=a.offsetLeft+a.offsetWidth/2,i=Math.abs(o-e);i<r&&(r=i,t=n)}return t},g=e=>{h=Math.max(0,Math.min(e,u.length-1)),v=!0,m(h),d.scrollTo({left:u[h].offsetLeft,behavior:"smooth"})},b=()=>{p||(p=requestAnimationFrame(()=>{if(p=null,v)return m(h),void((e=>{const t=u[e]?.offsetLeft??0;return Math.abs(d.scrollLeft-t)<2})(h)&&(v=!1));const e=y();h=e,m(e)}))};d.addEventListener("scroll",b,{passive:!0}),f.forEach((e,t)=>{e.addEventListener("click",()=>g(t))});let S=!1,_=0,E=0;const A=e=>{s.enabled&&(s.desktopOnly&&!window.matchMedia("(pointer: fine)").matches||(v=!1,S=!0,d.classList.add(s.draggingClass),_=e,E=y()))};s.enabled&&(d.addEventListener("mousedown",e=>{0===e.button&&(e.preventDefault(),A(e.clientX))}),window.addEventListener("mouseup",e=>{S&&(e=>{if(!S)return;S=!1,d.classList.remove(s.draggingClass);const t=e-_,r=Math.min(s.thresholdPx,d.clientWidth*s.thresholdRatio);if(Math.abs(t)<r)return void g(E);const n=t<0?Math.min(E+1,u.length-1):Math.max(E-1,0);g(n)})(e.clientX)}));let q=null;const w=()=>{q&&(clearInterval(q),q=null)},L=()=>{c.enabled&&(w(),q=setInterval(()=>{const e=(h+1)%u.length;g(e)},c.delay))};let x=null;if(c.enabled&&c.pauseOnInteraction){const e=()=>{w(),c.enabled&&(x&&clearTimeout(x),x=setTimeout(()=>{L()},c.resumeAfter))};d.addEventListener("mousedown",e),d.addEventListener("touchstart",e,{passive:!0}),d.addEventListener("wheel",e,{passive:!0}),f.forEach(t=>t.addEventListener("click",e))}return window.addEventListener("resize",()=>{v=!1,b()},{passive:!0}),m(0),b(),L(),{goTo:g,startAutoplay:L,stopAutoplay:w}}function v(e,t,r){t.style.height=`${t.scrollHeight}px`,requestAnimationFrame(()=>{t.style.height="0px"}),e.classList.remove("faqs__accordion-item--active"),r.setAttribute("aria-expanded","false")}document.addEventListener("DOMContentLoaded",()=>{f(),function(){const e=document.querySelectorAll(".faqs__accordion-item");if(!e.length)return;e.forEach(t=>{const r=t.querySelector(".faqs__accordion-button"),n=t.querySelector(".faqs__accordion-content");if(!r||!n)return;const a=t.classList.contains("faqs__accordion-item--active");r.setAttribute("aria-expanded",a?"true":"false"),n.style.height=a?"auto":"0px",r.addEventListener("click",()=>{const a=t.classList.contains("faqs__accordion-item--active");e.forEach(e=>{if(e!==t){const t=e.querySelector(".faqs__accordion-button"),r=e.querySelector(".faqs__accordion-content");if(!t||!r)return;e.classList.contains("faqs__accordion-item--active")&&v(e,r,t)}}),a?v(t,n,r):function(e,t,r){t.style.height=`${t.scrollHeight}px`,e.classList.add("faqs__accordion-item--active"),r.setAttribute("aria-expanded","true"),t.addEventListener("transitionend",()=>{t.style.height="auto"},{once:!0})}(t,n,r)})})}(),function(e=document){const t=e.querySelector("[data-select]");if(!t)return;const r=t.querySelector("[data-trigger]"),n=t.querySelector("[data-menu]"),a=t.querySelector("[data-label]"),o=t.querySelector("[data-input]"),i=Array.from(t.querySelectorAll(".service-select__option"));if(!(r&&n&&a&&o&&i.length))return;let s=!1,c=-1;const l=e=>{s=e,t.dataset.open=s?"true":"false",r.setAttribute("aria-expanded",s?"true":"false"),s?(n.focus(),d()):d()},d=()=>{i.forEach(e=>e.classList.remove("is-active")),c=-1},u=e=>{d(),c=Math.max(0,Math.min(e,i.length-1)),i[c].classList.add("is-active"),i[c].scrollIntoView({block:"nearest"})},f=e=>{const t=i[e];if(!t)return;i.forEach(e=>e.setAttribute("aria-selected","false")),t.setAttribute("aria-selected","true");const r=t.querySelector(".service-option__text")?.textContent.trim()??t.textContent.trim(),n=t.dataset.value??r;a.textContent=r,o.value=n,l(!1)};r.addEventListener("click",()=>l(!s)),i.forEach((e,t)=>{e.addEventListener("click",()=>f(t))}),document.addEventListener("click",e=>{s&&(t.contains(e.target)||l(!1))}),document.addEventListener("keydown",e=>{s&&("Escape"===e.key&&(e.preventDefault(),l(!1),r.focus()),"ArrowDown"===e.key&&(e.preventDefault(),u(c<0?0:c+1)),"ArrowUp"===e.key&&(e.preventDefault(),u(c<0?0:c-1)),"Enter"===e.key&&(e.preventDefault(),c>=0&&f(c)))})}(),function(){const e=document.querySelector(".hero-services__select");e&&e.addEventListener("change",()=>{const t=e.value;t&&(window.location.href=t)})}(),function(e=".help-accordion__list"){const t=document.querySelector(e);if(!t)return;const r=Array.from(t.querySelectorAll(".help-accordion__item")),n=e=>{const t=e.querySelector(".help-accordion__trigger"),r=e.querySelector(".help-accordion__panel");t&&r&&(t.classList.remove("is-active"),t.setAttribute("aria-expanded","false"),r.hidden=!0)},a=e=>{const t=e.querySelector(".help-accordion__trigger"),r=e.querySelector(".help-accordion__panel");t&&r&&(t.classList.add("is-active"),t.setAttribute("aria-expanded","true"),r.hidden=!1)};r.forEach(e=>{const t=e.querySelector(".help-accordion__trigger"),o=e.querySelector(".help-accordion__panel");if(!t||!o)return;"true"===t.getAttribute("aria-expanded")||(o.hidden=!0),t.addEventListener("click",()=>{const o="true"===t.getAttribute("aria-expanded");r.forEach(n),o||a(e)})});const o=t.getAttribute("data-accordion-target");if(o){const e=t.querySelector(`[data-accordion-id="${o}"]`);e&&(r.forEach(n),a(e),setTimeout(()=>{const t=100,r=e.getBoundingClientRect().top+window.pageYOffset-t;window.scrollTo({top:r,behavior:"smooth"})},100))}}(),o(),u(),document.getElementById("individualOfficeMap")&&document.getElementById("individualOfficeMapPlaceholder")&&Promise.all([a.e(131),a.e(192)]).then(a.bind(a,192)),p({rootSelector:".reviews",carouselSelector:".carousel",cardSelector:".carousel .card",indicatorsSelector:".indicators .indicator",rectOpacity:!0,drag:{enabled:!0,desktopOnly:!0},autoplay:{enabled:!0,delay:3e3,pauseOnInteraction:!0,resumeAfter:3e3}}),p({rootSelector:"#service-section",carouselSelector:".services-carousel",cardSelector:".services-carousel .services-card",indicatorsSelector:".indicators .indicator",activeClass:"active",rectOpacity:!0,drag:{enabled:!1},autoplay:{enabled:!1}}),p({rootSelector:".travel-essentials",carouselSelector:".travel-essentials__cards",cardSelector:".travel-essentials__cards .travel-essentials__card",indicatorsSelector:".travel-essentials__indicator",activeClass:"active",rectOpacity:!1,onIndicatorUpdate:(e,t)=>{const r=e.querySelector("use");if(!r)return;const n=t?"progress-indicator-active":"progress-indicator-inactive";r.setAttribute("href",`/newlp/assets/img/icons/sprite.svg#${n}`),r.setAttribute("xlink:href",`/newlp/assets/img/icons/sprite.svg#${n}`)},drag:{enabled:!1},autoplay:{enabled:!1}}),p({rootSelector:".services-visa-simplicity",carouselSelector:".services-visa-simplicity__cards",cardSelector:".services-visa-simplicity__cards .services-visa-simplicity__card",indicatorsSelector:".services-visa-simplicity__indicator",activeClass:"active",rectOpacity:!1,onIndicatorUpdate:(e,t)=>{const r=e.querySelector("use");if(!r)return;const n=t?"progress-indicator-active":"progress-indicator-inactive";r.setAttribute("href",`/newlp/assets/img/icons/sprite.svg#${n}`),r.setAttribute("xlink:href",`/newlp/assets/img/icons/sprite.svg#${n}`)},drag:{enabled:!1},autoplay:{enabled:!1}}),function({sectionSelector:e="#expediting-options-section",wrapSelector:t=".expedite-wrap",cardSelector:r=".expedite-card",indicatorsSelector:n=".indicators",indicatorSelector:a=".indicator",activeClass:o="active",desktopMediaQuery:i="(min-width: 1024px)"}={}){const s=document.querySelector(e);if(!s)return;const c=s.querySelector(t),l=Array.from(s.querySelectorAll(r)),d=s.querySelector(n),u=d?Array.from(d.querySelectorAll(a)):[];if(!c||0===l.length||0===u.length)return;const f=window.matchMedia(i);let p=null,v=!1;function h(e,t,r){return Math.max(t,Math.min(e,r))}function m(e){u.forEach((t,r)=>{const n=r===e;t.classList.toggle(o,n);const a=t.querySelector("rect");a&&a.setAttribute("opacity",n?"1":"0.1")})}function y(){l.forEach(e=>{e.classList.remove("is-selected","is-adjacent","is-back"),e.setAttribute("aria-selected","false")})}function g(){const e=c.scrollLeft+c.clientWidth/2;let t=0,r=1/0;for(let n=0;n<l.length;n++){const a=l[n],o=a.offsetLeft+a.offsetWidth/2,i=Math.abs(o-e);i<r&&(r=i,t=n)}return t}function b(e,t="smooth"){const r=h(e,0,l.length-1),n=l[r],a=n.offsetLeft-(c.clientWidth-n.offsetWidth)/2;c.scrollTo({left:a,behavior:t}),m(r)}function S(){p||(p=requestAnimationFrame(()=>{p=null;m(g())}))}function _(){v||(v=!0,y(),u.forEach((e,t)=>{e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>b(t)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(t))})}),l.forEach((e,t)=>{e.addEventListener("click",()=>b(t))}),c.addEventListener("scroll",S,{passive:!0}),requestAnimationFrame(()=>{m(g())}))}function E(){}function A(){f.matches?E():_()}A(),f.addEventListener("change",A)}({desktopMediaQuery:"(min-width: 1024px)"})}),function(e=".expedite-wrap"){const t=document.querySelector(e);if(!t)return;const r=Array.from(t.querySelectorAll(".expedite-card"));if(!r.length)return;let n=r.findIndex(e=>e.classList.contains("is-selected"));function a(e,t){e.length;e.forEach((e,r)=>{const n=Math.abs(r-t),a=r===t,o=1===n;e.classList.toggle("is-selected",a),e.classList.toggle("is-adjacent",!a&&o),e.classList.toggle("is-back",!a&&!o),e.setAttribute("aria-selected",a?"true":"false");e.style.zIndex=100-n})}n<0&&(n=Math.floor(r.length/2)),a(r,n),r.forEach((e,t)=>{e.addEventListener("mouseenter",()=>{n=t,a(r,n)}),e.addEventListener("focusin",()=>{n=t,a(r,n)}),e.addEventListener("click",e=>{e.target.closest("a")||(n=t,a(r,n))}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n=t,a(r,n))})})}(),document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('.text-with-image[data-hover-preview="true"]').forEach(e=>{const t=e.querySelector(".image img");if(!t)return;const r=e.querySelector("ul");if(!r)return;const n=t.getAttribute("src");r.addEventListener("mouseover",n=>{const a=n.target.closest("li[data-image]");a&&r.contains(a)&&(r=>{const n=r?.dataset?.image;n&&(t.setAttribute("src",`/newlp/assets/img/id-proof/${n}`),e.querySelectorAll("li.is-hovered").forEach(e=>e.classList.remove("is-hovered")),r.classList.add("is-hovered"))})(a)}),e.addEventListener("mouseleave",()=>{t.setAttribute("src",n),e.querySelectorAll("li.is-hovered").forEach(e=>e.classList.remove("is-hovered"))})})})})();
function initLiveChatTriggers(){
function openEmbeddedLiveChat(){
const w=window.LiveChatWidget;
if(w&&typeof w.call==="function"){
try {
w.call("show");
} catch (_){
}
try {
w.call("maximize");
} catch (_){
}
if(typeof w.once==="function"){
try {
w.once("ready", ()=> {
try {
w.call("show");
w.call("maximize");
} catch (_){
}});
} catch (_){
}}
}
const api=window.LC_API;
if(api&&typeof api.open_chat_window==="function"){
try {
api.open_chat_window();
} catch (_){
}}
}
document.addEventListener("click", (e)=> {
const a=e.target.closest("a");
if(!a) return;
const href=(a.getAttribute("href")||"").toLowerCase();
const isChatPath =
href.includes("help-center/chat")||href.includes("livechat.com/chat-with");
const hasBlueBalloon=Boolean(
a.querySelector('img[src*="blue_baloon"], img[src*="blue_baloon.webp"]'),
);
const explicit=a.hasAttribute("data-livechat-open");
const aria=(a.getAttribute("aria-label")||"").toLowerCase();
const byAria=aria.includes("chat with us");
const txt=(a.textContent||"")
.replace(/\s+/g, " ")
.trim()
.toLowerCase();
const byText =
txt==="chat with us" ||
txt==="live chat" ||
txt==="start chat" ||
txt==="open chat";
if(!explicit&&!hasBlueBalloon&&!isChatPath&&!byAria&&!byText) return;
e.preventDefault();
openEmbeddedLiveChat();
window.setTimeout(openEmbeddedLiveChat, 400);
window.setTimeout(openEmbeddedLiveChat, 1200);
});
}
initLiveChatTriggers();
function initNeedHelpDropdown(){
const mq=window.matchMedia("(min-width: 1280px)");
const root=document.querySelector(".site-nav__need-help");
const trigger=document.getElementById("site-nav-need-help-trigger");
if(!root||!trigger){
return;
}
function setExpanded(open){
trigger.setAttribute("aria-expanded", open ? "true":"false");
}
function pointerCollapseIfNoFocus(){
if(!mq.matches){
return;
}
if(!root.contains(document.activeElement)){
setExpanded(false);
}}
root.addEventListener("mouseenter", ()=> {
if(mq.matches){
setExpanded(true);
}});
root.addEventListener("mouseleave", pointerCollapseIfNoFocus);
root.addEventListener("focusin", ()=> setExpanded(true));
root.addEventListener("focusout", ()=> {
requestAnimationFrame(()=> {
if(!root.contains(document.activeElement)){
setExpanded(false);
}});
});
mq.addEventListener("change", (ev)=> {
if(!ev.matches){
setExpanded(false);
}});
}
initNeedHelpDropdown();
(function (){
"use strict";
function initMobileSubmenuPanels(){
const nav=document.querySelector("#primary-nav");
if(!nav) return;
const mqDesktop=window.matchMedia("(min-width: 1280px)");
function clearMobilePanels(){
nav
.querySelectorAll(".site-nav__submenu--mobile-active")
.forEach(function (sub){
sub.classList.remove("site-nav__submenu--mobile-active");
});
nav
.querySelectorAll(".site-nav__item--has-submenu > .site-nav__link[aria-expanded]",
)
.forEach(function (a){
a.setAttribute("aria-expanded", "false");
});
}
function closePanel(item){
const link=item.querySelector(":scope > .site-nav__link");
const submenu=item.querySelector(":scope > .site-nav__submenu");
if(link) link.setAttribute("aria-expanded", "false");
if(submenu) submenu.classList.remove("site-nav__submenu--mobile-active");
}
function openPanel(item){
const link=item.querySelector(":scope > .site-nav__link");
const submenu=item.querySelector(":scope > .site-nav__submenu");
if(!link||!submenu) return;
nav.querySelectorAll(".site-nav__item--has-submenu").forEach(function (other){
if(other===item) return;
closePanel(other);
});
link.setAttribute("aria-expanded", "true");
submenu.classList.add("site-nav__submenu--mobile-active");
}
document.addEventListener("click",
function (e){
if(mqDesktop.matches) return;
if(!nav.contains(e.target)) return;
var back=e.target.closest(".site-nav__submenu-mobile-back");
if(back){
var itemBack=back.closest(".site-nav__item--has-submenu");
if(itemBack&&nav.contains(itemBack)){
e.preventDefault();
e.stopPropagation();
if(typeof e.stopImmediatePropagation==="function"){
e.stopImmediatePropagation();
}
closePanel(itemBack);
}
return;
}
var link=e.target.closest(".site-nav__item--has-submenu > .site-nav__link");
if(!link||!nav.contains(link)) return;
e.preventDefault();
e.stopPropagation();
if(typeof e.stopImmediatePropagation==="function"){
e.stopImmediatePropagation();
}
var item=link.closest(".site-nav__item--has-submenu");
if(!item) return;
var submenu=item.querySelector(":scope > .site-nav__submenu");
var expanded=link.getAttribute("aria-expanded")==="true";
var active=submenu&&submenu.classList.contains("site-nav__submenu--mobile-active");
if(expanded&&active){
closePanel(item);
}else{
openPanel(item);
}},
true,
);
new MutationObserver(function (){
if(nav.dataset.open==="false"){
clearMobilePanels();
}}).observe(nav, { attributes: true, attributeFilter: ["data-open"] });
mqDesktop.addEventListener("change", function (ev){
if(ev.matches){
clearMobilePanels();
}});
}
if(document.readyState==="loading"){
document.addEventListener("DOMContentLoaded", initMobileSubmenuPanels);
}else{
initMobileSubmenuPanels();
}})();
(function (){
'use strict';
var cfg=typeof rmpBlogBanner!=='undefined' ? rmpBlogBanner:{ blogUrl: '/' };
var blogUrl=cfg.blogUrl||'/';
function originOf(url){
try {
return new URL(url, window.location.href).origin;
} catch (e){
return null;
}}
function goBlogBack(){
var myOrigin=window.location.origin;
var nav=window.navigation;
if(nav&&typeof nav.entries==='function'){
try {
var entries=nav.entries();
if(!entries||entries.length===0){
window.location.href=blogUrl;
return;
}
var cur=nav.currentEntry;
var idx=-1;
for (var i=0; i < entries.length; i++){
if(entries[i].id===cur.id||entries[i].key===cur.key){
idx=i;
break;
}}
if(idx < 0&&typeof cur.index==='number'){
idx=cur.index;
}
if(idx <=0){
window.location.href=blogUrl;
return;
}
var prev=entries[idx - 1];
var prevUrl=prev&&prev.url;
if(!prevUrl){
window.location.href=blogUrl;
return;
}
if(originOf(prevUrl)!==myOrigin){
window.location.href=blogUrl;
return;
}
window.history.back();
return;
} catch (err){
}}
var ref=document.referrer;
if(ref){
try {
if(new URL(ref).origin!==myOrigin){
window.location.href=blogUrl;
return;
}} catch (e){
window.location.href=blogUrl;
return;
}}
if(window.history.length <=1){
window.location.href=blogUrl;
return;
}
window.history.back();
}
function init(){
var btn=document.querySelector('.blog-page-banner__back');
if(!btn){
return;
}
btn.addEventListener('click', function (e){
e.preventDefault();
goBlogBack();
});
}
if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', init);
}else{
init();
}})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
initCommentsSeeMore();
});
var TOP_VISIBLE=3;
var NEST_VISIBLE=2;
var BATCH_SIZE=10;
function makeSeeMoreBtn(count, label){
var btn=document.createElement('button');
btn.type='button';
btn.className='comments-see-more';
btn.innerHTML =
'<span class="comments-see-more__icon">+</span>' +
'<span class="comments-see-more__text">' + count + ' more ' + label + '</span>';
return btn;
}
function updateBtn(btn, remaining, label){
btn.querySelector('.comments-see-more__text').textContent=remaining + ' more ' + label;
}
function collapseList(list, visibleCount, label){
var items=Array.from(list.querySelectorAll(':scope > li.comment'));
if(items.length <=visibleCount) return;
var hidden=items.slice(visibleCount);
hidden.forEach(function (li){ li.classList.add('comment--hidden'); });
var btn=makeSeeMoreBtn(hidden.length, label);
list.after(btn);
btn.addEventListener('click', function (){
var stillHidden=hidden.filter(function (li){
return li.classList.contains('comment--hidden');
});
var batch=stillHidden.slice(0, BATCH_SIZE);
batch.forEach(function (li){ li.classList.remove('comment--hidden'); });
var remaining=stillHidden.length - batch.length;
if(remaining > 0){
updateBtn(btn, remaining, label);
}else{
btn.remove();
}});
}
function initCommentsSeeMore(){
var wrapper=document.querySelector('.single-post__comments');
if(!wrapper) return;
var topList=wrapper.querySelector('.comment-list');
if(topList){
collapseList(topList, TOP_VISIBLE, 'comments');
}
var childLists=wrapper.querySelectorAll('.children');
childLists.forEach(function (ol){
collapseList(ol, NEST_VISIBLE, 'replies');
});
}})();
(function (){
'use strict';
function getCfg(){
if(!window.rmpNewsletter){
return null;
}
var url=window.rmpNewsletter.subscribeUrl||window.rmpNewsletter.restUrl;
if(!url){
return null;
}
return {
url: url,
configured: window.rmpNewsletter.configured!==false,
};}
function setStatus(form, message, isError){
var el=form.querySelector('.blog-newsletter-signup__status');
var input=form.querySelector('input[type="email"]');
if(el){
el.textContent=message||'';
el.hidden = !message;
el.classList.toggle('blog-newsletter-signup__status--error', !!isError);
}
if(!input){
return;
}
if(!message||!isError){
input.setCustomValidity('');
return;
}
if(!el){
input.setCustomValidity(message);
input.reportValidity();
if(!input.dataset.rmpNlVBound){
input.dataset.rmpNlVBound='1';
input.addEventListener('input', function (){
input.setCustomValidity('');
});
}}
}
function onSubmit(event){
var form=event.target;
if(!form||!form.classList.contains('blog-newsletter-signup__form')){
return;
}
var cfg=getCfg();
if(!cfg||!cfg.url){
return;
}
event.preventDefault();
if(!cfg.configured){
setStatus(
form,
(window.rmpNewsletterStrings&&window.rmpNewsletterStrings.unavailable)||'Newsletter signup is temporarily unavailable.',
true
);
return;
}
var input=form.querySelector('input[type="email"]');
var btn=form.querySelector('button[type="submit"]');
var email=input ? String(input.value||'').trim():'';
if(!email){
setStatus(form, (window.rmpNewsletterStrings&&window.rmpNewsletterStrings.invalid)||'Please enter a valid email address.', true);
return;
}
setStatus(form, '', false);
if(btn){
btn.disabled=true;
}
window
.fetch(cfg.url, {
method: 'POST',
credentials: 'omit',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({ email: email }),
})
.then(function (res){
return res
.json()
.catch(function (){
return {};})
.then(function (data){
return { ok: res.ok, status: res.status, data: data };});
})
.then(function (result){
if(result.ok&&result.data&&result.data.message){
setStatus(form, result.data.message, false);
form.reset();
return;
}
var msg;
if(result.status===429&&window.rmpNewsletterStrings&&window.rmpNewsletterStrings.rate_limited){
msg=window.rmpNewsletterStrings.rate_limited;
}else{
msg =
(result.data&&result.data.message) ||
(window.rmpNewsletterStrings&&window.rmpNewsletterStrings.error) ||
'Something went wrong. Please try again.';
}
setStatus(form, msg, true);
})
.catch(function (){
setStatus(
form,
(window.rmpNewsletterStrings&&window.rmpNewsletterStrings.error)||'Something went wrong. Please try again.',
true
);
})
.finally(function (){
if(btn){
btn.disabled=false;
}});
}
document.addEventListener('submit', onSubmit, true);
})();