{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["\r\nimport { getDocument } from \"ssr-window\";\r\n\r\nexport type TRemoveCSSVarArgs = Parameters<typeof removeCSSVar>;\r\n\r\nexport type TRemoveCSSVarReturn = ReturnType<typeof removeCSSVar>;\r\n\r\n/**\r\n * Removes CSS3 variable from specific DOM node\r\n * @param el{HTMLElement|Node|Element|Document=} DOM element\r\n * @param variable{string} variable name\r\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties\r\n * @throws {TypeError} removeCSSVar: el must be an HTMLElement\r\n * @throws {TypeError} removeCSSVar: variable must be a non-empty string\r\n * @example\r\n * // How to remove CSS variable from div?\r\n * // <div id=\"myBlock\" style=\"--myVar: 10;\"></div>\r\n * const block = document.getElementById(\"myBlock\");\r\n * removeCSSVar(block, \"myVar\");\n * // <div id=\"myBlock\" style=\"\"></div>\n * @example\n * // Remove an inline theme override and fall back to the stylesheet value\n * removeCSSVar(document.documentElement, \"accent-color\");\n */\nexport const removeCSSVar = (el: HTMLElement = getDocument().documentElement, variable: string) => {\r\n  if (!el || typeof (el as any).style !== \"object\") {\r\n    throw new TypeError(\"removeCSSVar: el must be an HTMLElement\");\r\n  }\r\n  if (typeof variable !== \"string\" || variable.length === 0) {\r\n    throw new TypeError(\"removeCSSVar: variable must be a non-empty string\");\r\n  }\r\n  el.style.removeProperty(variable.startsWith(\"--\") ? variable : `--${variable}`);\r\n};\r\n"],"names":["removeCSSVar","el","getDocument","documentElement","variable","style","TypeError","length","removeProperty","startsWith"],"mappings":"6FAwBO,MAAMA,aAAe,CAACC,GAAkBC,UAAAA,cAAcC,gBAAiBC,YAC5E,IAAKH,WAAcA,GAAWI,QAAU,SACtC,MAAM,IAAIC,UAAU,2CAEtB,UAAWF,WAAa,UAAYA,SAASG,SAAW,EACtD,MAAM,IAAID,UAAU,qDAEtBL,GAAGI,MAAMG,eAAeJ,SAASK,WAAW,MAAQL,SAAW,KAAKA"}