!function(){"use strict";function t(){let t;try{t=new URL(window.location.href)}catch(t){return null}if("1"!==t.searchParams.get("puffergo_preview_mode"))return null;const e=[];t.searchParams.forEach(function(t,n){0===n.indexOf("puffergo_preview[")&&e.push([n,t])});const n=t.searchParams.get("puffergo_preview_session")||"";return 0!==e.length||n?{pairs:e,sessionId:n}:null}function e(e){const n=t();if(!n)return null;if(!e||"#"===e.charAt(0)||0===e.indexOf("javascript:"))return null;let r,o;try{r=new URL(e,window.location.origin)}catch(t){return null}if(r.origin!==window.location.origin)return null;if("mailto:"===r.protocol||"tel:"===r.protocol)return null;for(r.searchParams.set("puffergo_preview_mode","1"),o=0;o<n.pairs.length;o++)r.searchParams.set(n.pairs[o][0],n.pairs[o][1]);return n.sessionId&&r.searchParams.set("puffergo_preview_session",n.sessionId),r}function n(t){const n=e(String(t));return n?n.pathname+n.search+n.hash:t}function r(t){if("1"===t.getAttribute("data-pg-preview-skip")||"true"===t.getAttribute("data-pg-preview-skip"))return;const n=t.getAttribute("href");if(!n)return;const r=e(n);if(!r)return;const o=r.pathname+r.search+r.hash;let i;try{i=new URL(t.href)}catch(t){return}i.pathname+i.search+i.hash!==o&&t.setAttribute("href",o)}function o(t){const e=t.target;if(!e||!e.closest)return;const n=e.closest("a[href]");n&&r(n)}function i(){const t=document.querySelectorAll("a[href]"),e=t.length;let n;for(n=0;n<e;n++)r(t[n])}t()&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),document.addEventListener("mousedown",o,!0),document.addEventListener("click",o,!0),document.addEventListener("focusin",function(t){const e=t.target;if(!e||!e.closest)return;const n=e.closest("a[href]");n&&r(n)},!0),document.addEventListener("submit",function(t){const n=t.target;if(!n||"FORM"!==n.nodeName)return;if("1"===n.getAttribute("data-pg-preview-skip")||"true"===n.getAttribute("data-pg-preview-skip"))return;if("get"!==(n.getAttribute("method")||"get").toLowerCase())return;let r=n.getAttribute("action");r&&""!==r||(r=window.location.pathname+(window.location.search||""));const o=e(r);if(!o)return;const i=o.pathname+o.search;n.getAttribute("action")!==i&&n.setAttribute("action",i)},!0),function(){const t=window.history.pushState,e=window.history.replaceState;window.history.pushState=function(e,r,o){const i="string"==typeof o||o instanceof URL?n(o):o;return t.call(window.history,e,r,i)},window.history.replaceState=function(t,r,o){const i="string"==typeof o||o instanceof URL?n(o):o;return e.call(window.history,t,r,i)}}())}();