(()=>{"use strict";const t=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},n=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},e=function(e,o){return function(r,i,s){let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;const l=e[o];if(!n(r))return;if(!t(i))return;if("function"!=typeof s)return void console.error("The hook callback must be a function.");if("number"!=typeof c)return void console.error("If specified, the hook priority must be a number.");const a={callback:s,priority:c,namespace:i};if(l[r]){const t=l[r].handlers;let n;for(n=t.length;n>0&&!(c>=t[n-1].priority);n--);n===t.length?t[n]=a:t.splice(n,0,a),l.__current.forEach((t=>{t.name===r&&t.currentIndex>=n&&t.currentIndex++}))}else l[r]={handlers:[a],runs:0};"hookAdded"!==r&&e.doAction("hookAdded",r,i,s,c)}},o=function(e,o){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,s){const c=e[o];if(!n(i))return;if(!r&&!t(s))return;if(!c[i])return 0;let l=0;if(r)l=c[i].handlers.length,c[i]={runs:c[i].runs,handlers:[]};else{const t=c[i].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===i&&t.currentIndex>=n&&t.currentIndex--})))}return"hookRemoved"!==i&&e.doAction("hookRemoved",i,s),l}},r=function(t,n){return function(e,o){const r=t[n];return void 0!==o?e in r&&r[e].handlers.some((t=>t.namespace===o)):e in r}},i=function(t,n){let e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(o){const r=t[n];r[o]||(r[o]={handlers:[],runs:0}),r[o].runs++;const i=r[o].handlers;for(var s=arguments.length,c=new Array(s>1?s-1:0),l=1;l