PromoCursed/node_modules/.cache/babel-loader/d37be72d41bf373a518d2e24062e445c8b2226e1445a0810abb3c947f68134ac.json

1 line
5.3 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\n/**\n * Cache `value` related LabeledValue & options.\n */\nexport default (function (labeledValues, valueOptions) {\n var cacheRef = React.useRef({\n values: new Map(),\n options: new Map()\n });\n var filledLabeledValues = React.useMemo(function () {\n var _cacheRef$current = cacheRef.current,\n prevValueCache = _cacheRef$current.values,\n prevOptionCache = _cacheRef$current.options;\n\n // Fill label by cache\n var patchedValues = labeledValues.map(function (item) {\n if (item.label === undefined) {\n var _prevValueCache$get;\n return _objectSpread(_objectSpread({}, item), {}, {\n label: (_prevValueCache$get = prevValueCache.get(item.value)) === null || _prevValueCache$get === void 0 ? void 0 : _prevValueCache$get.label\n });\n }\n return item;\n });\n\n // Refresh cache\n var valueCache = new Map();\n var optionCache = new Map();\n patchedValues.forEach(function (item) {\n valueCache.set(item.value, item);\n optionCache.set(item.value, valueOptions.get(item.value) || prevOptionCache.get(item.value));\n });\n cacheRef.current.values = valueCache;\n cacheRef.current.options = optionCache;\n return patchedValues;\n }, [labeledValues, valueOptions]);\n var getOption = React.useCallback(function (val) {\n return valueOptions.get(val) || cacheRef.current.options.get(val);\n }, [valueOptions]);\n return [filledLabeledValues, getOption];\n});","map":{"version":3,"names":["_objectSpread","React","labeledValues","valueOptions","cacheRef","useRef","values","Map","options","filledLabeledValues","useMemo","_cacheRef$current","current","prevValueCache","prevOptionCache","patchedValues","map","item","label","undefined","_prevValueCache$get","get","value","valueCache","optionCache","forEach","set","getOption","useCallback","val"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-select/es/hooks/useCache.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\n/**\n * Cache `value` related LabeledValue & options.\n */\nexport default (function (labeledValues, valueOptions) {\n var cacheRef = React.useRef({\n values: new Map(),\n options: new Map()\n });\n var filledLabeledValues = React.useMemo(function () {\n var _cacheRef$current = cacheRef.current,\n prevValueCache = _cacheRef$current.values,\n prevOptionCache = _cacheRef$current.options;\n\n // Fill label by cache\n var patchedValues = labeledValues.map(function (item) {\n if (item.label === undefined) {\n var _prevValueCache$get;\n return _objectSpread(_objectSpread({}, item), {}, {\n label: (_prevValueCache$get = prevValueCache.get(item.value)) === null || _prevValueCache$get === void 0 ? void 0 : _prevValueCache$get.label\n });\n }\n return item;\n });\n\n // Refresh cache\n var valueCache = new Map();\n var optionCache = new Map();\n patchedValues.forEach(function (item) {\n valueCache.set(item.value, item);\n optionCache.set(item.value, valueOptions.get(item.value) || prevOptionCache.get(item.value));\n });\n cacheRef.current.values = valueCache;\n cacheRef.current.options = optionCache;\n return patchedValues;\n }, [labeledValues, valueOptions]);\n var getOption = React.useCallback(function (val) {\n return valueOptions.get(val) || cacheRef.current.options.get(val);\n }, [valueOptions]);\n return [filledLabeledValues, getOption];\n});"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B;AACA;AACA;AACA,gBAAgB,UAAUC,aAAa,EAAEC,YAAY,EAAE;EACrD,IAAIC,QAAQ,GAAGH,KAAK,CAACI,MAAM,CAAC;IAC1BC,MAAM,EAAE,IAAIC,GAAG,CAAC,CAAC;IACjBC,OAAO,EAAE,IAAID,GAAG,CAAC;EACnB,CAAC,CAAC;EACF,IAAIE,mBAAmB,GAAGR,KAAK,CAACS,OAAO,CAAC,YAAY;IAClD,IAAIC,iBAAiB,GAAGP,QAAQ,CAACQ,OAAO;MACtCC,cAAc,GAAGF,iBAAiB,CAACL,MAAM;MACzCQ,eAAe,GAAGH