(()=>{"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,o,s){let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;const l=t[e];if(!r(i))return;if(!n(o))return;if("function"!=typeof s)return;if("number"!=typeof c)return;const u={callback:s,priority:c,namespace:o};if(l[i]){const t=l[i].handlers;let n;for(n=t.length;n>0&&!(c>=t[n-1].priority);n--);n===t.length?t[n]=u:t.splice(n,0,u),l.__current.forEach((t=>{t.name===i&&t.currentIndex>=n&&t.currentIndex++}))}else l[i]={handlers:[u],runs:0};"hookAdded"!==i&&t.doAction("hookAdded",i,o,s,c)}};const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(o,s){const c=t[e];if(!r(o))return;if(!i&&!n(s))return;if(!c[o])return 0;let l=0;if(i)l=c[o].handlers.length,c[o]={runs:c[o].runs,handlers:[]};else{const t=c[o].handlers;for(let n=t.length-1;n>=0;n--)t[n].namespace===s&&(t.splice(n,1),l++,c.__current.forEach((t=>{t.name===o&&t.currentIndex>=n&&t.currentIndex--})))}return"hookRemoved"!==o&&t.doAction("hookRemoved",o,s),l}};const o=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 s=function(t,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(e){const i=t[n];i[e]||(i[e]={handlers:[],runs:0}),i[e].runs++;const o=i[e].handlers;for(var s=arguments.length,c=new Array(s>1?s-1:0),l=1;l<s;l++)c[l-1]=arguments[l];if(!o||!o.length)return r?c[0]:void 0;const u={name:e,currentIndex:0};for(i.__current.push(u);u.currentIndex<o.length;){const t=o[u.currentIndex].callback.apply(null,c);r&&(c[0]=t),u.currentIndex++}return i.__current.pop(),r?c[0]:void 0}};const c=function(t,n){return function(){var r,e;const i=t[n];return null!==(r=null===(e=i.__current[i.__current.length-1])||void 0===e?void 0:e.name)&&void 0!==r?r:null}};const l=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 u=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=o(this,"actions"),this.hasFilter=o(this,"filters"),this.removeAllActions=i(this,"actions",!0),this.removeAllFilters=i(this,"filters",!0),this.doAction=s(this,"actions"),this.applyFilters=s(this,"filters",!0),this.currentAction=c(this,"actions"),this.currentFilter=c(this,"filters"),this.doingAction=l(this,"actions"),this.doingFilter=l(this,"filters"),this.didAction=u(this,"actions"),this.didFilter=u(this,"filters")}}const a=function(){return new h},d=a(),{addAction:f,addFilter:A,removeAction:_,removeFilter:v,hasAction:g,hasFilter:p,removeAllActions:m,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()})();