PromoCursed/node_modules/.cache/babel-loader/81bf1910aa693aec1d873e999023b7181017fb0f1e0323ee24d7a46ac5ab2777.json

1 line
8.7 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { ATTR_MARK } from \"../StyleContext\";\nexport var ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';\n\n/**\n * This marks style from the css file.\n * Which means not exist in `<style />` tag.\n */\nexport var CSS_FILE_STYLE = '_FILE_STYLE__';\nexport function serialize(cachePathMap) {\n return Object.keys(cachePathMap).map(function (path) {\n var hash = cachePathMap[path];\n return \"\".concat(path, \":\").concat(hash);\n }).join(';');\n}\nvar cachePathMap;\nvar fromCSSFile = true;\n\n/**\n * @private Test usage only. Can save remove if no need.\n */\nexport function reset(mockCache) {\n var fromFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n cachePathMap = mockCache;\n fromCSSFile = fromFile;\n}\nexport function prepare() {\n if (!cachePathMap) {\n cachePathMap = {};\n if (canUseDom()) {\n var div = document.createElement('div');\n div.className = ATTR_CACHE_MAP;\n div.style.position = 'fixed';\n div.style.visibility = 'hidden';\n div.style.top = '-9999px';\n document.body.appendChild(div);\n var content = getComputedStyle(div).content || '';\n content = content.replace(/^\"/, '').replace(/\"$/, '');\n\n // Fill data\n content.split(';').forEach(function (item) {\n var _item$split = item.split(':'),\n _item$split2 = _slicedToArray(_item$split, 2),\n path = _item$split2[0],\n hash = _item$split2[1];\n cachePathMap[path] = hash;\n });\n\n // Remove inline record style\n var inlineMapStyle = document.querySelector(\"style[\".concat(ATTR_CACHE_MAP, \"]\"));\n if (inlineMapStyle) {\n var _inlineMapStyle$paren;\n fromCSSFile = false;\n (_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);\n }\n document.body.removeChild(div);\n }\n }\n}\nexport function existPath(path) {\n prepare();\n return !!cachePathMap[path];\n}\nexport function getStyleAndHash(path) {\n var hash = cachePathMap[path];\n var styleStr = null;\n if (hash && canUseDom()) {\n if (fromCSSFile) {\n styleStr = CSS_FILE_STYLE;\n } else {\n var _style = document.querySelector(\"style[\".concat(ATTR_MARK, \"=\\\"\").concat(cachePathMap[path], \"\\\"]\"));\n if (_style) {\n styleStr = _style.innerHTML;\n } else {\n // Clean up since not exist anymore\n delete cachePathMap[path];\n }\n }\n }\n return [styleStr, hash];\n}","map":{"version":3,"names":["_slicedToArray","canUseDom","ATTR_MARK","ATTR_CACHE_MAP","CSS_FILE_STYLE","serialize","cachePathMap","Object","keys","map","path","hash","concat","join","fromCSSFile","reset","mockCache","fromFile","arguments","length","undefined","prepare","div","document","createElement","className","style","position","visibility","top","body","appendChild","content","getComputedStyle","replace","split","forEach","item","_item$split","_item$split2","inlineMapStyle","querySelector","_inlineMapStyle$paren","parentNode","removeChild","existPath","getStyleAndHash","styleStr","_style","innerHTML"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@ant-design/cssinjs/es/util/cacheMapUtil.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { ATTR_MARK } from \"../StyleContext\";\nexport var ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';\n\n/**\n * This marks style from the css file.\n * Which means not exist in `<style />` tag.\n */\nexport var CSS_FILE_STYLE = '_FILE_STYLE__';\nexport function serialize(cachePathMap) {\n return Object.keys(cachePathMap).map(function (path) {\n var hash = cachePathMap[path];\n return \"\".concat(path, \":\").concat(hash);\n }).join(';');\n}\nvar cachePathMap;\nvar fro