(()=>{"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();const n=function(t){return"string"==typeof t&&""!==t&&!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)};const r=function(t){return"string"==typeof t&&""!==t&&(!/^__/.test(t)&&!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t))};const e=function(t,e){return function(i,s,o,c=10){const u=t[e];if(!r(i))return;if(!n(s))return;if("function"!=typeof o)return;if("number"!=typeof c)return;const l={callback:o,priority:c,namespace:s};if(u[i]){const t=u[i].handlers;let n;for(n=t.length;n>0&&!(c>=t[n-1].priority);n--);n===t.length?t[n]=l:t.splice(n,0,l),u.__current.forEach((t=>{t.name===i&&t.currentIndex>=n&&t.currentIndex++}))}else u[i]={handlers:[l],runs:0};"hookAdded"!==i&&t.doAction("hookAdded",i,s,o,c)}};const i=function(t,e,i=!1){return function(s,o){const c=t[e];if(!r(s))return;if(!i&&!n(o))return;if(!c[s])return 0;let u=0;if(i)u=c[s].handlers.length,c[s]={runs:c[s].runs,handlers:[]};else{const t=c[s].handlers;for(let n=t.length-1;n>=0;n--)t[n].namespace===o&&(t.splice(n,1),u++,c.__current.forEach((t=>{t.name===s&&t.currentIndex>=n&&t.currentIndex--})))}return"hookRemoved"!==s&&t.doAction("hookRemoved",s,o),u}};const s=function(t,n){return function(r,e){const i=t[n];return void 0!==e?r in i&&i[r].handlers.some((t=>t.namespace===e)):r in i}};const o=function(t,n,r=!1){return function(e,...i){const s=t[n];s[e]||(s[e]={handlers:[],runs:0}),s[e].runs++;const o=s[e].handlers;if(!o||!o.length)return r?i[0]:void 0;const c={name:e,currentIndex:0};for(s.__current.push(c);c.currentIndex<o.length;){const t=o[c.currentIndex].callback.apply(null,i);r&&(i[0]=t),c.currentIndex++}return s.__current.pop(),r?i[0]:void 0}};const c=function(t,n){return function(){var r;const e=t[n];return null!==(r=e.__current[e.__current.length-1]?.name)&&void 0!==r?r:null}};const u=function(t,n){return function(r){const e=t[n];return void 0===r?void 0!==e.__current[0]:!!e.__current[0]&&r===e.__current[0].name}};const l=function(t,n){return function(e){const i=t[n];if(r(e))return i[e]&&i[e].runs?i[e].runs:0}};class h{constructor(){this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=e(this,"actions"),this.addFilter=e(this,"filters"),this.removeAction=i(this,"actions"),this.removeFilter=i(this,"filters"),this.hasAction=s(this,"actions"),this.hasFilter=s(this,"filters"),this.removeAllActions=i(this,"actions",!0),this.removeAllFilters=i(this,"filters",!0),this.doAction=o(this,"actions"),this.applyFilters=o(this,"filters",!0),this.currentAction=c(this,"actions"),this.currentFilter=c(this,"filters"),this.doingAction=u(this,"actions"),this.doingFilter=u(this,"filters"),this.didAction=l(this,"actions"),this.didFilter=l(this,"filters")}}const a=function(){return new h},d=a(),{addAction:f,addFilter:A,removeAction:_,removeFilter:p,hasAction:m,hasFilter:g,removeAllActions:v,removeAllFilters:F,doAction:y,applyFilters:b,currentAction:x,currentFilter:I,doingAction:k,doingFilter:w,didAction:j,didFilter:z,actions:Z,filters:E}=d;t.g.AgeGateHooks=a()})();