{"version":3,"sources":["ma11yc.js"],"names":["_apply","MA11YC","document","elements","element","enhance","arguments","args","observe","changesArray","changes","observer","mutationsList","attr","mutation","forEach","change","falseVal","MutationObserver","callback","attributes","childList","subtree"],"mappings":"aAAA,KAAA,CAAA,MAAa,CACC,MAANA,CAAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAA4B,CAD1C,KAAMC,CAAAA,CAAO,CAAA,CAAA,GAAAC,QAAA,CAAAA,gBAAAA,CAAb,CAAaA,CAAA,CAAb,CAEEC,CAAMA,CAANA,OAAAA,CAAcC,CAAA,EAAOF,CAErBC,CAAAA,CAAAA,YAAAA,CAAkBC,GAAlBD,CAAAA,CAFAA,CAAAA,CAIC,CAGY,MAAPE,CAAAA,OAAO,EAAG,CAAH,GAAA,QAAA,QAAPA,CAAAA,SAAU,CAAH,CAAG,CAAH,CACb,IAAI,KAAJ,CAAA,CAAA,GAAWC,CAAAA,MAAP,CAAOA,OAAAA,CAAiBA,SAAU,CAAtC,CAAsC,CAA3BA,CAAX,CACCL,MAAA,CAAAA,MAAAA,CAAWM,GAAXN,CAAAA,EAFY,IAKZA,CAAAA,MAJD,CAICA,MAAAA,CAAM,GAANA,SAAAA,CAEA,CAGY,MAAPO,CAAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAmB,MAAnBC,CAAAA,CAACL,CAAAA,KAASM,CAATN,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAkB,CAAnB,CAAmB,CAAA,CA6B1BO,CAAQ,CAAG,GAAjB,CAAA,gBAAiB,CA1BCC,CAAD,EAAmB,CAApC,IAAA,KAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAoC,CACnC,KAAAC,CAAAA,CAAK,CAAMC,CAAX,CAAWA,aAAAA,CAAX,WAAWA,EAAX,CAGCL,CAAAA,CAAAA,OAAAA,CAAaM,CAAAA,EAAQ,CACpB,GAAAF,CAAA,GAAQG,CAAKA,CAAb,IAAA,CAAoBH,CACnB,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAA2BI,CAAYD,CAAvC,MAAA,CAEA,OAAAH,GAAAA,CAHmBA,EAIlBT,CAAAA,CAAAA,YAAAA,CAAAA,CAAAA,CAYDS,OAAAA,GAAAA,CAAA,CAjBFT,CAAA,CAAAA,SAAAA,CAAAA,QAAAA,CAAAY,CAAA,CAAAZ,KAAAA,EAAAA,CAAAA,CAiBES,CAAA,CANKT,CAAO,CAAPA,YAAAA,CAAqBY,CAAM,CAA3BZ,IAAAA,GAWHO,CAAQ,CAARA,YAAAA,CAAeO,CAAAA,CAAfP,IAAAA,IAAgCQ,CAAtC,CAXSf,KAAAA,CAAAA,CAAAA,CANJA,CAAAA,CAkBL,CAvBEK,CAAAA,CAmBA,CAvBF,CA0BiB,CA7Be,CA8BhCE,CAAQ,CAARA,OAAAA,CAAAA,CAAAA,CAA0B,CACzBS,UADyB,GAAA,CAEzBC,SAFyB,GAAA,CAGzBC,OAAO,GAHkB,CAA1BX,CAKA,CAtDW","file":"ma11yc.js","sourcesContent":["class MA11YC {\n\tstatic _apply(selector, attributesArray) {\n\t\tconst elements = [...document.querySelectorAll(selector)];\n\n\t\telements.forEach((element) => {\n\t\t\telement.setAttribute(...attributesArray);\n\t\t});\n\t}\n\n\tstatic enhance() {\n\t\tif (typeof arguments[0] === \"object\") {\n\t\t\tfor (const args of Object.entries(arguments[0])) {\n\t\t\t\tMA11YC._apply(...args);\n\t\t\t}\n\t\t} else {\n\t\t\tMA11YC._apply(...arguments);\n\t\t}\n\t}\n\n\tstatic observe(element, changes) {\n\t\tconst changesArray = Array.isArray(changes) ? changes : [changes];\n\n\t\tconst callback = (mutationsList) => {\n\t\t\tfor (const mutation of mutationsList) {\n\t\t\t\tconst attr = mutation.attributeName.toLowerCase();\n\n\t\t\t\tchangesArray.forEach((change) => {\n\t\t\t\t\tif (attr === change.attr) {\n\t\t\t\t\t\tconst [attribute, trueVal, falseVal] = change.toggle;\n\n\t\t\t\t\t\tif (attr === \"class\") {\n\t\t\t\t\t\t\telement.setAttribute(\n\t\t\t\t\t\t\t\tattribute,\n\t\t\t\t\t\t\t\tattr === \"class\"\n\t\t\t\t\t\t\t\t\t? element.classList.contains(change.value)\n\t\t\t\t\t\t\t\t\t\t? trueVal\n\t\t\t\t\t\t\t\t\t\t: falseVal\n\t\t\t\t\t\t\t\t\t: element.hasAttribute(change.attr) &&\n\t\t\t\t\t\t\t\t\t element.getAttribute(change.attr) === change.value\n\t\t\t\t\t\t\t\t\t? trueVal\n\t\t\t\t\t\t\t\t\t: falseVal\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst observer = new MutationObserver(callback);\n\t\tobserver.observe(element, {\n\t\t\tattributes: true,\n\t\t\tchildList: false,\n\t\t\tsubtree: false,\n\t\t});\n\t}\n}\n"]}