/*
 =======================================================================*\
|| ###################################################################### ||
|| # vBulletin 6.2.3
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2026 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};
$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f<e.length-1;f++){var g=e[f];if(!(g in d))return;d=d[g]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&(c=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.initSymbol=function(){};$jscomp.iteratorPrototype=function(a){a={next:a};a[Symbol.iterator]=function(){return this};return a};
$jscomp.polyfill("String.prototype.matchAll",function(a){return a?a:function(b){if(b instanceof RegExp&&!b.global)throw new TypeError("RegExp passed into String.prototype.matchAll() must have global tag.");var c=new RegExp(b,b instanceof RegExp?void 0:"g"),d=this,e=!1,f={next:function(){if(e)return{value:void 0,done:!0};var g=c.exec(d);if(!g)return e=!0,{value:void 0,done:!0};""===g[0]&&(c.lastIndex+=1);return{value:g,done:!1}}};f[Symbol.iterator]=function(){return f};return f}},"es_2020","es3");
const SITEURLOBJ=(()=>{let a=new URL(self.location.href);a.search="";a.hash="";return new URL(a.href+"/..")})(),SITEURL=SITEURLOBJ.href.replace(/\/+$/,""),NOTIFICATION_TYPE_PRIVATEMESSAGE="SHOW_PM_ACTION",NOTIFICATION_TYPE_KILL="kill";self.addEventListener("install",a=>{self.skipWaiting();a.waitUntil(fetchServiceworkerInfo())});const CACHE_PERIOD=36E5;let lastChecktime=0,cachedData={};
function fetchServiceworkerInfo(){return Date.now()-lastChecktime<CACHE_PERIOD?Promise.resolve(cachedData):getvBOption(["push_publickey","bbtitle","frontendurl","optionsdate","cachebuster"]).then(a=>{lastChecktime=Date.now();cachedData=a;cachedData.cached_at=Date().toString();return a})}function ensureArray(a){return Array.isArray(a)?a:"undefined"==typeof a?[]:[a]}function getvBOption(a){return getvBDataInternal(a).then(b=>b.options||{})}
function getvBPhrase(a){return getvBDataInternal([],a).then(b=>b.phrases||{})}function getvBDataInternal(a,b){a=ensureArray(a);b=ensureArray(b);return vBPOST("/ajax/loaddata",{options:a,phrases:b})}function vBPOST(a,b){return fetchSecurityToken().then(c=>{b=b||{};b.securitytoken=c;return fetch(SITEURL+a,{method:"POST",credentials:"same-origin",body:objectToUrlSearchParams(b)}).then(d=>d.json())})}
function objectToUrlSearchParams(a,b=""){let c=new URLSearchParams;Object.entries(a).forEach(([d,e])=>{d=b?`${b}[${d}]`:d;e&&"object"==typeof e?objectToUrlSearchParams(e,d).forEach((f,g)=>{c.append(g,f)}):c.append(d,e)});return c}function fetchSecurityToken(){return fetch(SITEURL+"/json/getsecuritytoken",{method:"GET",credentials:"same-origin"}).then(a=>a.json()).then(a=>a.securitytoken)}
const convArrayBufferToBase64=a=>btoa(String.fromCharCode.apply(null,new Uint8Array(a))),convArrayBufferToBase64URL=a=>convArrayBufferToBase64(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),getPushSubscriptionPayload=a=>({endpoint:a.endpoint,keys:{p256dh:convArrayBufferToBase64URL(a.getKey("p256dh")),auth:convArrayBufferToBase64URL(a.getKey("auth"))},expiration:Number.parseInt(a.expirationTime/1E3,10)});
async function checkCurrentVapid(){const a=await fetchServiceworkerInfo();await self.registration.pushManager.getSubscription().then(async b=>{const c=convArrayBufferToBase64URL(b&&b.options.applicationServerKey||""),d=a.push_publickey||"",e=a.bbtitle||"vBulletin",f=(a.frontendurl||SITEURL)+"/settings/notifications";if(!d||c!=d)throw await (b&&b.unsubscribe()||Promise.resolve()).then(self.registration.showNotification(e,{body:`Your device has been unsubscribed from push notifications from ${e}.`+
`Please go to your User Notification Settings (${f}) if you wish to re-enable Push Notifications.`,tag:"push-unsubscribed",renotify:!0,data:{url:f}})),Error("vapid_key_changed");})}
self.addEventListener("push",a=>{let b=Promise.resolve();if(a.data)try{const c=a.data.json(),d=c.type||"notification",e=c.title||"untitled notification",f=c.body||"",g=c.actions||[];if(d==NOTIFICATION_TYPE_KILL){(new BroadcastChannel("vb_push_settings")).postMessage(c);a.waitUntil(Promise.all([self.registration.pushManager.getSubscription().then(h=>h?h.unsubscribe():Promise.resolve()),self.registration.showNotification(e,{body:f,tag:d,renotify:!0,actions:g,data:c})]));return}b=checkCurrentVapid().then(h=>
{d==NOTIFICATION_TYPE_PRIVATEMESSAGE&&(new BroadcastChannel("vb_push_privatemessage")).postMessage(c);return self.registration.showNotification(e,{body:f,tag:d,renotify:!0,actions:g,data:c,icon:c.avatarurl||""})}).catch(h=>{console.error("checkCurrentVapid() error: ",h)})}catch(c){console.error("Error parsing push data: ",c),console.log("Push data: ",a.data)}else console.log("This push event has no data.",a),b=checkCurrentVapid().then(c=>{}).catch(c=>{console.error("checkCurrentVapid() error: ",c)});
a.waitUntil(Promise.all([b]))});function isUrlSameOrigin(a){return"string"==typeof a&&(new URL(a)).hostname===SITEURLOBJ.hostname&&a.startsWith(SITEURL)?!0:!1}
self.addEventListener("notificationclick",a=>{var b=a.notification;const c=b.data,d=a.action||"";b.close();let e=c.url||"";d&&c.action_urls&&c.action_urls[d]&&(e=c.action_urls[d]);e&&isUrlSameOrigin(e)?(b=getRelaventClientWindowPromise(e).then(f=>{f.focus();return f}).catch(f=>{if("no_matching_client"==f){if(clients.openWindow)return clients.openWindow(e)}else Promise.reject(f)}),a.waitUntil(b)):a.waitUntil(Promise.resolve())});
function getRelaventClientWindowPromise(a){let b=null;return new Promise((c,d)=>{clients.matchAll({type:"window"}).then(e=>{for(const f of e)if(f.url.startsWith(SITEURL)&&f.url.startsWith(a)){if(!b||f.focused)b=f;if(f.focused)break}b?c(b):d("no_matching_client")})})};
