{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport var SEARCH_MARK = '__rc_cascader_search_mark__';\nvar defaultFilter = function defaultFilter(search, options, _ref) {\n var _ref$label = _ref.label,\n label = _ref$label === void 0 ? '' : _ref$label;\n return options.some(function (opt) {\n return String(opt[label]).toLowerCase().includes(search.toLowerCase());\n });\n};\nvar defaultRender = function defaultRender(inputValue, path, prefixCls, fieldNames) {\n return path.map(function (opt) {\n return opt[fieldNames.label];\n }).join(' / ');\n};\nexport default (function (search, options, fieldNames, prefixCls, config, changeOnSelect) {\n var _config$filter = config.filter,\n filter = _config$filter === void 0 ? defaultFilter : _config$filter,\n _config$render = config.render,\n render = _config$render === void 0 ? defaultRender : _config$render,\n _config$limit = config.limit,\n limit = _config$limit === void 0 ? 50 : _config$limit,\n sort = config.sort;\n return React.useMemo(function () {\n var filteredOptions = [];\n if (!search) {\n return [];\n }\n function dig(list, pathOptions) {\n var parentDisabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n list.forEach(function (option) {\n // Perf saving when `sort` is disabled and `limit` is provided\n if (!sort && limit !== false && limit > 0 && filteredOptions.length >= limit) {\n return;\n }\n var connectedPathOptions = [].concat(_toConsumableArray(pathOptions), [option]);\n var children = option[fieldNames.children];\n var mergedDisabled = parentDisabled || option.disabled;\n\n // If current option is filterable\n if (\n // If is leaf option\n !children || children.length === 0 ||\n // If is changeOnSelect\n changeOnSelect) {\n if (filter(search, connectedPathOptions, {\n label: fieldNames.label\n })) {\n filteredOptions.push(_objectSpread(_objectSpread({}, option), {}, _defineProperty(_defineProperty(_defineProperty({\n disabled: mergedDisabled\n }, fieldNames.label, render(search, connectedPathOptions, prefixCls, fieldNames)), SEARCH_MARK, connectedPathOptions), fieldNames.children, undefined)));\n }\n }\n if (children) {\n dig(option[fieldNames.children], connectedPathOptions, mergedDisabled);\n }\n });\n }\n dig(options, []);\n\n // Do sort\n if (sort) {\n filteredOptions.sort(function (a, b) {\n return sort(a[SEARCH_MARK], b[SEARCH_MARK], search, fieldNames);\n });\n }\n return limit !== false && limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;\n }, [search, options, fieldNames, prefixCls, render, changeOnSelect, filter, sort, limit]);\n});","map":{"version":3,"names":["_defineProperty","_objectSpread","_toConsumableArray","React","SEARCH_MARK","defaultFilter","search","options","_ref","_ref$label","label","some","opt","String","toLowerCase","includes","defaultRender","inputValue","path","prefixCls","fieldNames","map","join","config","changeOnSelect","_config$filter","filter","_config$render","render","_config$limit","limit","sort","useMemo","filteredOptions","dig","list","pathOptions","parentDisabled","arguments","length","undefined","forEach","option","connectedPathOptions","concat","children","mergedDisabled","disabled","push","a","b","slice"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-cascader/es/hooks/useSearchOptions.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport var SEARCH_MARK = '__rc_cascader_search_mark__';\nvar defaultFilter = function defaultFilter(search, options, _ref) {\n var _ref$label = _ref.label,\n label = _ref$label === void 0 ? '' : _ref$label;\n return options.some(function (opt) {\n return String(opt[label]).toLowerCase().includes(search.toLowerCase());\n });\n};\nvar defaultRender = function defaultRender(inputValue, path, prefixCls, fieldNames) {\n return path.map(function (opt) {\n return opt[fieldNames.label];\n }).join(' / ');\n};\nexport default (function (search, options, fieldNames, prefixCls, config, changeOnSelect) {\n var _config$filter = config.filter,\n filter = _config$filter === void 0 ? defaultFilter : _config$filter,\n _config$render = config.render,\n render = _config$render === void 0 ? defaultRender : _config$render,\n _config$limit = config.limit,\n limit = _config$limit === void 0 ? 50 : _config$limit,\n sort = config.sort;\n return React.useMemo(function () {\n var filteredOptions = [];\n if (!search) {\n return [];\n }\n function dig(list, pathOptions) {\n var parentDisabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n list.forEach(function (option) {\n // Perf saving when `sort` is disabled and `limit` is provided\n if (!sort && limit !== false && limit > 0 && filteredOptions.length >= limit) {\n return;\n }\n var connectedPathOptions = [].concat(_toConsumableArray(pathOptions), [option]);\n var children = option[fieldNames.children];\n var mergedDisabled = parentDisabled || option.disabled;\n\n // If current option is filterable\n if (\n // If is leaf option\n !children || children.length === 0 ||\n // If is changeOnSelect\n changeOnSelect) {\n if (filter(search, connectedPathOptions, {\n label: fieldNames.label\n })) {\n filteredOptions.push(_objectSpread(_objectSpread({}, option), {}, _defineProperty(_defineProperty(_defineProperty({\n disabled: mergedDisabled\n }, fieldNames.label, render(search, connectedPathOptions, prefixCls, fieldNames)), SEARCH_MARK, connectedPathOptions), fieldNames.children, undefined)));\n }\n }\n if (children) {\n dig(option[fieldNames.children], connectedPathOptions, mergedDisabled);\n }\n });\n }\n dig(options, []);\n\n // Do sort\n if (sort) {\n filteredOptions.sort(function (a, b) {\n return sort(a[SEARCH_MARK], b[SEARCH_MARK], search, fieldNames);\n });\n }\n return limit !== false && limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;\n }, [search, options, fieldNames, prefixCls, render, changeOnSelect, filter, sort, limit]);\n});"],"mappings":"AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAO,IAAIC,WAAW,GAAG,6BAA6B;AACtD,IAAIC,aAAa,GAAG,SAASA,aAAaA,CAACC,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAE;EAChE,IAAIC,UAAU,GAAGD,IAAI,CAACE,KAAK;IACzBA,KAAK,GAAGD,UAAU,KAAK,KAAK,CAAC,GAAG,EAAE,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