<commit_before>import { Position, Tooltip } from '@blueprintjs/core'
import _ from 'lodash'
import find from 'lodash/find'
import React from 'react'

import { ERROR_FLOW_ICON, FLOW_ICON, FOLDER_ICON, MAIN_FLOW_ICON, TIMEOUT_ICON } from './FlowsList'

/**
 *  Returns a different display for special flows.
 * @param flowId The full path of the flow (including folders)
 * @param flowName The display name of the flow (only filename)
 */
const getFlowInfo = (flowId: string, flowName: string) => {
  if (flowId === 'main') {
    return {
      icon: MAIN_FLOW_ICON,
      label: (
        <Tooltip content={<span>Every user session starts here</span>} hoverOpenDelay={500} position={Position.BOTTOM}>
          <strong>Main</strong>
        </Tooltip>
      )
    }
  } else if (flowId === 'error') {
    return {
      icon: ERROR_FLOW_ICON,
      label: (
        <Tooltip
          content={
            <span>
              When an error is encountered in the flow,
              <br /> the user is redirected here
            </span>
          }
          hoverOpenDelay={500}
          position={Position.BOTTOM}
        >
          <strong>Error handling</strong>
        </Tooltip>
      )
    }
  } else if (flowId === 'timeout') {
    return {
      icon: TIMEOUT_ICON,
      label: (
        <Tooltip
          content={
            <span>
              When a discussion timeouts (user doesn't answer in
              <br />
              the configured timeframe) he will be redirected here.
            </span>
          }
          hoverOpenDelay={500}
          position={Position.BOTTOM}
        >
          <strong>Timeout</strong>
        </Tooltip>
      )
    }
  }
  return {
    icon: FLOW_ICON,
    label: flowName
  }
}

const reorderFlows = flows => {
  return [
    flows.find(x => x.id === 'main'),
    flows.find(x => x.id === 'error'),
    flows.find(x => x.id === 'timeout'),
    ...flows.filter(x => !['main', 'error', 'timeout'].contains(x.id))
  ].filter(x => Boolean(x))
}

const addNode = (tree, folders, flowDesc, data) => {
  for (const folderDesc of folders) {
    let folder = find(tree.childNodes, folderDesc)
    if (!folder) {
      folder = { ...folderDesc, parent: tree, childNodes: [] }<commit_msg>minor fix<commit_after>import { Position, Tooltip } from '@blueprintjs/core'
import _ from 'lodash'
import find from 'lodash/find'
import React from 'react'

import { ERROR_FLOW_ICON, FLOW_ICON, FOLDER_ICON, MAIN_FLOW_ICON, TIMEOUT_ICON } from './FlowsList'

/**
 *  Returns a different display for special flows.
 * @param flowId The full path of the flow (including folders)
 * @param flowName The display name of the flow (only filename)
 */
const getFlowInfo = (flowId: string, flowName: string) => {
  if (flowId === 'main') {
    return {
      icon: MAIN_FLOW_ICON,
      label: (
        <Tooltip content={<span>Every user session starts here</span>} hoverOpenDelay={500} position={Position.BOTTOM}>
          <strong>Main</strong>
        </Tooltip>
      )
    }
  } else if (flowId === 'error') {
    return {
      icon: ERROR_FLOW_ICON,
      label: (
        <Tooltip
          content={
            <span>
              When an error is encountered in the flow,
              <br /> the user is redirected here
            </span>
          }
          hoverOpenDelay={500}
          position={Position.BOTTOM}
        >
          <strong>Error handling</strong>
        </Tooltip>
      )
    }
  } else if (flowId === 'timeout') {
    return {
      icon: TIMEOUT_ICON,
      label: (
        <Tooltip
          content={
            <span>
              When a discussion timeouts (user doesn't answer in
              <br />
              the configured timeframe) he will be redirected here.
            </span>
          }
          hoverOpenDelay={500}
          position={Position.BOTTOM}
        >
          <strong>Timeout</strong>
        </Tooltip>
      )
    }
  }
  return {
    icon: FLOW_ICON,
    label: flowName
  }
}

const reorderFlows = flows => {
  return [
    flows.find(x => x.id === 'main'),
    flows.find(x => x.id === 'error'),
    flows.find(x => x.id === 'timeout'),
    ...flows.filter(x => !['main', 'error', 'timeout'].includes(x.id))
  ].filter(x => Boolean(x))
}

const addNode = (tree, folders, flowDesc, data) => {
  for (const folderDesc of folders) {
    let folder = find(tree.childNodes, folderDesc)
    if (!folder) {
      folder = { ...folderDesc, parent: tree, childNodes: [] }
{'fraction_non_alphanumeric': 0.13253012048192772, 'fraction_numerical': 0.004016064257028112, 'mean_word_length': 2.0959944751381214, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6646030', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1393, 'n_words': 369}