(function(){function ENUM(namesArray,lookupModifierFunction){if(!Array.isArray(namesArray))throw new Error("First argument of ENUM must be an array");const lookupHash={};const ENUMERATION=function(lookupValue){if(lookupModifierFunction)lookupValue=lookupModifierFunction(lookupValue);lookupValue=lookupHash[lookupValue];return ENUMERATION[lookupValue]};Object.defineProperty(ENUMERATION,"lookupHash",{enumerable:false,value:lookupHash});namesArray.forEach(((names,i)=>{if(!Array.isArray(names))names=[names];const value=Math.pow(2,i);const baseName=names[0];lookupHash[baseName]=baseName;lookupHash[value]=baseName;const entry=new Number(value);entry.toString=()=>entry.asString;entry.asString=baseName;entry.asLowerCase=baseName.toLowerCase();entry.asUpperCase=baseName.toUpperCase();entry.asInteger=value;entry.ENUM=ENUMERATION;names.forEach(((name,n)=>{Object.defineProperty(ENUMERATION,name,{enumerable:n===0,value:entry});lookupHash[name]=baseName}))}));if(Object.freeze)Object.freeze(ENUMERATION);return ENUMERATION}window.ENUM=ENUM})();