// File has been copied to packages/editor/editor-plugin-ai/src/provider/prosemirror-transformer/utils/list.ts
// If changes are made to this file, please make the same update in the linked file.

import { resolveOrder } from './resolveOrder';
export const DEFAULT_ORDER = 1;
export const getOrderFromOrderedListNode = orderedListNode => {
  var _orderedListNode$attr, _resolveOrder;
  const order = orderedListNode === null || orderedListNode === void 0 ? void 0 : (_orderedListNode$attr = orderedListNode.attrs) === null || _orderedListNode$attr === void 0 ? void 0 : _orderedListNode$attr.order;
  return (_resolveOrder = resolveOrder(order)) !== null && _resolveOrder !== void 0 ? _resolveOrder : DEFAULT_ORDER;
};
export const getItemCounterDigitsSize = options => {
  var _resolveOrder2, _String, _String$split, _String$split$;
  const order = (_resolveOrder2 = resolveOrder(options.order)) !== null && _resolveOrder2 !== void 0 ? _resolveOrder2 : DEFAULT_ORDER;
  const itemsCount = typeof options.itemsCount === 'number' ? options.itemsCount : 0;
  const largestCounter = order + (itemsCount - 1);
  return (_String = String(largestCounter)) === null || _String === void 0 ? void 0 : (_String$split = _String.split('.')) === null || _String$split === void 0 ? void 0 : (_String$split$ = _String$split[0]) === null || _String$split$ === void 0 ? void 0 : _String$split$.length;
};
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { resolveOrder } from './resolveOrder';
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { isListNode } from './isListNode';
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { isParagraphNode } from './isParagraphNode';
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { isListItemNode } from './isListItemNode';
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { isBulletList } from './isBulletList';