{"ast":null,"code":"import * as React from 'react';\nconst EMPTY_KEYS = [];\nfunction filterKeys(keys, dataKeys) {\n const filteredKeys = keys.filter(key => dataKeys.has(key));\n return keys.length === filteredKeys.length ? keys : filteredKeys;\n}\nfunction flattenKeys(keys) {\n return Array.from(keys).join(';');\n}\nexport default function useSelection(leftDataSource, rightDataSource) {\n let selectedKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_KEYS;\n // Prepare `dataSource` keys\n const [leftKeys, rightKeys] = React.useMemo(() => [new Set(leftDataSource.map(src => src.key)), new Set(rightDataSource.map(src => src.key))], [leftDataSource, rightDataSource]);\n // Selected Keys\n const [sourceSelectedKeys, setSourceSelectedKeys] = React.useState(() => filterKeys(selectedKeys, leftKeys));\n const [targetSelectedKeys, setTargetSelectedKeys] = React.useState(() => filterKeys(selectedKeys, rightKeys));\n // Fill selected keys\n React.useEffect(() => {\n setSourceSelectedKeys(filterKeys(selectedKeys, leftKeys));\n setTargetSelectedKeys(filterKeys(selectedKeys, rightKeys));\n }, [selectedKeys]);\n // Reset when data changed\n React.useEffect(() => {\n setSourceSelectedKeys(filterKeys(sourceSelectedKeys, leftKeys));\n setTargetSelectedKeys(filterKeys(targetSelectedKeys, rightKeys));\n }, [flattenKeys(leftKeys), flattenKeys(rightKeys)]);\n return [\n // Keys\n sourceSelectedKeys, targetSelectedKeys,\n // Updater\n setSourceSelectedKeys, setTargetSelectedKeys];\n}","map":{"version":3,"names":["React","EMPTY_KEYS","filterKeys","keys","dataKeys","filteredKeys","filter","key","has","length","flattenKeys","Array","from","join","useSelection","leftDataSource","rightDataSource","selectedKeys","arguments","undefined","leftKeys","rightKeys","useMemo","Set","map","src","sourceSelectedKeys","setSourceSelectedKeys","useState","targetSelectedKeys","setTargetSelectedKeys","useEffect"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/transfer/hooks/useSelection.js"],"sourcesContent":["import * as React from 'react';\nconst EMPTY_KEYS = [];\nfunction filterKeys(keys, dataKeys) {\n const filteredKeys = keys.filter(key => dataKeys.has(key));\n return keys.length === filteredKeys.length ? keys : filteredKeys;\n}\nfunction flattenKeys(keys) {\n return Array.from(keys).join(';');\n}\nexport default function useSelection(leftDataSource, rightDataSource) {\n let selectedKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_KEYS;\n // Prepare `dataSource` keys\n const [leftKeys, rightKeys] = React.useMemo(() => [new Set(leftDataSource.map(src => src.key)), new Set(rightDataSource.map(src => src.key))], [leftDataSource, rightDataSource]);\n // Selected Keys\n const [sourceSelectedKeys, setSourceSelectedKeys] = React.useState(() => filterKeys(selectedKeys, leftKeys));\n const [targetSelectedKeys, setTargetSelectedKeys] = React.useState(() => filterKeys(selectedKeys, rightKeys));\n // Fill selected keys\n React.useEffect(() => {\n setSourceSelectedKeys(filterKeys(selectedKeys, leftKeys));\n setTargetSelectedKeys(filterKeys(selectedKeys, rightKeys));\n }, [selectedKeys]);\n // Reset when data changed\n React.useEffect(() => {\n setSourceSelectedKeys(filterKeys(sourceSelectedKeys, leftKeys));\n setTargetSelectedKeys(filterKeys(targetSelectedKeys, rightKeys));\n }, [flattenKeys(leftKeys), flattenKeys(rightKeys)]);\n return [\n // Keys\n sourceSelectedKeys, targetSelectedKeys,\n // Updater\n setSourceSelectedKeys, setTargetSelectedKeys];\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,MAAMC,UAAU,GAAG,EAAE;AACrB,SAASC,UAAUA,CAACC,IAAI,EAAEC,QAAQ,EAAE;EAClC,MAAMC,YAAY,GAAGF,IAAI,CAACG,MAAM,CAACC,GAAG,IAAIH,QAAQ,CAACI,GAAG,CAACD,GAAG,CAAC,CAAC;EAC1D,OAAOJ,IAAI,CAACM,MAAM,KAAKJ,YAAY,CAACI,MAAM,GAAGN,IAAI,GAAGE,YAAY;AAClE;AACA,SAASK,WAAWA,CAACP,IAAI,EAAE;EACzB,OAAOQ,KAAK,CAACC,IAAI,CAACT,I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