function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React, { useEffect } from 'react';
import useAccessNavigationManager from '@zohodesk/hooks/es/accessiblity/useAccessNavigationManager';
import useFocusVisible from '@zohodesk/hooks/es/accessiblity/useFocusVisible';
let rootElementProps1, getItemProps1, focusFirst1;

function TreeViewerSkeleton(props) {
  let {
    rootElementProps,
    getItemProps,
    focusFirst
  } = useAccessNavigationManager({
    focus: true,
    activecss: 'qwertyuiop123',
    keyName: {
      left: ['arrowleft'],
      right: ['arrowright'],
      up: ['arrowup'],
      down: ['arrowdown']
    }
  });
  rootElementProps1 = rootElementProps;
  getItemProps1 = getItemProps;
  focusFirst1 = focusFirst;
  let {
    children
  } = props;
  return /*#__PURE__*/React.createElement("div", rootElementProps1, children);
}

export function TreeItemSkeleton(props) {
  let {
    dataAriaItem,
    itemId
  } = getItemProps1();
  let {
    focusProps
  } = useFocusVisible({
    onFocus: () => {
      focusFirst1(itemId);
    }
  });
  let {
    children,
    heading,
    treeUIState,
    handleChange,
    id,
    status
  } = props;

  let handleKeydown = e => {
    if (e.keycode === 38) {
      up(-1);
    } else if (e.keycode === 40) {
      down(+1);
    }
  };

  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", _extends({
    onKeyDown: handleKeydown
  }, focusProps, dataAriaItem, {
    "data-aria-shortcut": !status ? 'click:arrowright-enter' : 'click:arrowleft-enter',
    tabIndex: '0',
    onClick: () => {
      handleChange(id, !status);
    }
  }), heading()), status ? /*#__PURE__*/React.createElement("div", null, children) : null);
}
export default TreeViewerSkeleton;