{"ast":null,"code":"import React from 'react';\nimport useToken from '../../theme/useToken';\nimport zIndexContext from '../zindexContext';\n// Z-Index control range\n// Container: 1000 + offset 100 (max base + 10 * offset = 2000)\n// Popover: offset 50\n// Notification: Container Max zIndex + componentOffset\nconst CONTAINER_OFFSET = 100;\nconst CONTAINER_OFFSET_MAX_COUNT = 10;\nexport const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;\nexport const containerBaseZIndexOffset = {\n  Modal: CONTAINER_OFFSET,\n  Drawer: CONTAINER_OFFSET,\n  Popover: CONTAINER_OFFSET,\n  Popconfirm: CONTAINER_OFFSET,\n  Tooltip: CONTAINER_OFFSET,\n  Tour: CONTAINER_OFFSET\n};\nexport const consumerBaseZIndexOffset = {\n  SelectLike: 50,\n  Dropdown: 50,\n  DatePicker: 50,\n  Menu: 50,\n  ImagePreview: 1\n};\nfunction isContainerType(type) {\n  return type in containerBaseZIndexOffset;\n}\nexport function useZIndex(componentType, customZIndex) {\n  const [, token] = useToken();\n  const parentZIndex = React.useContext(zIndexContext);\n  const isContainer = isContainerType(componentType);\n  if (customZIndex !== undefined) {\n    return [customZIndex, customZIndex];\n  }\n  let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;\n  if (isContainer) {\n    zIndex +=\n    // Use preset token zIndex by default but not stack when has parent container\n    (parentZIndex ? 0 : token.zIndexPopupBase) +\n    // Container offset\n    containerBaseZIndexOffset[componentType];\n    zIndex = Math.min(zIndex, token.zIndexPopupBase + CONTAINER_MAX_OFFSET);\n  } else {\n    zIndex += consumerBaseZIndexOffset[componentType];\n  }\n  return [parentZIndex === undefined ? customZIndex : zIndex, zIndex];\n}","map":{"version":3,"names":["React","useToken","zIndexContext","CONTAINER_OFFSET","CONTAINER_OFFSET_MAX_COUNT","CONTAINER_MAX_OFFSET","containerBaseZIndexOffset","Modal","Drawer","Popover","Popconfirm","Tooltip","Tour","consumerBaseZIndexOffset","SelectLike","Dropdown","DatePicker","Menu","ImagePreview","isContainerType","type","useZIndex","componentType","customZIndex","token","parentZIndex","useContext","isContainer","undefined","zIndex","zIndexPopupBase","Math","min"],"sources":["/var/www/gavt/react-demo/node_modules/antd/es/_util/hooks/useZIndex.js"],"sourcesContent":["import React from 'react';\nimport useToken from '../../theme/useToken';\nimport zIndexContext from '../zindexContext';\n// Z-Index control range\n// Container: 1000 + offset 100 (max base + 10 * offset = 2000)\n// Popover: offset 50\n// Notification: Container Max zIndex + componentOffset\nconst CONTAINER_OFFSET = 100;\nconst CONTAINER_OFFSET_MAX_COUNT = 10;\nexport const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;\nexport const containerBaseZIndexOffset = {\n  Modal: CONTAINER_OFFSET,\n  Drawer: CONTAINER_OFFSET,\n  Popover: CONTAINER_OFFSET,\n  Popconfirm: CONTAINER_OFFSET,\n  Tooltip: CONTAINER_OFFSET,\n  Tour: CONTAINER_OFFSET\n};\nexport const consumerBaseZIndexOffset = {\n  SelectLike: 50,\n  Dropdown: 50,\n  DatePicker: 50,\n  Menu: 50,\n  ImagePreview: 1\n};\nfunction isContainerType(type) {\n  return type in containerBaseZIndexOffset;\n}\nexport function useZIndex(componentType, customZIndex) {\n  const [, token] = useToken();\n  const parentZIndex = React.useContext(zIndexContext);\n  const isContainer = isContainerType(componentType);\n  if (customZIndex !== undefined) {\n    return [customZIndex, customZIndex];\n  }\n  let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;\n  if (isContainer) {\n    zIndex +=\n    // Use preset token zIndex by default but not stack when has parent container\n    (parentZIndex ? 0 : token.zIndexPopupBase) +\n    // Container offset\n    containerBaseZIndexOffset[componentType];\n    zIndex = Math.min(zIndex, token.zIndexPopupBase + CONTAINER_MAX_OFFSET);\n  } else {\n    zIndex += consumerBaseZIndexOffset[componentType];\n  }\n  return [parentZIndex === undefined ? customZIndex : zIndex, zIndex];\n}"],"mappings":"AAAA,OAAOA,K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