<commit_before>/**
 * @flow
 *
 * @Author: <NAME> <guiguan>
 * @Date:   2017-12-14T12:22:05+11:00
 * @Email:  <EMAIL>
 * @Last modified by:   guiguan
 * @Last modified time: 2018-02-14T14:55:30+11:00
 *
 * dbKoda - a modern, open source code editor, for MongoDB.
 * Copyright (C) 2017-2018 Southbank Software
 *
 * This file is part of dbKoda.
 *
 * dbKoda is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * dbKoda is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with dbKoda.  If not, see <http://www.gnu.org/licenses/>.
 */

import * as React from 'react';
import { action } from 'mobx';
import { observer } from 'mobx-react';
import type { WidgetState } from '~/api/Widget';
import ErrorView from '#/common/ErrorView';
import _ from 'lodash';
import ReactResizeDetector from 'react-resize-detector';
import { Tooltip, Position } from '@blueprintjs/core';
// $FlowFixMe
import { Popover2 } from '@blueprintjs/labs';
import InfoIcon from '../../../../styles/icons/explain-query-icon.svg';
// $FlowFixMe
import { Broker, EventType } from '~/helpers/broker';
import type { WidgetValue } from '~/api/Widget';
import HistoryView from './HistoryView';
import './Widget.scss';

const DEBOUNCE_DELAY = 100;
const MAX_HISTORY_SIZE = 720; // 1h with 5s sampling rate
const HISTORY_VIEW_WIDTH = 537;
const HISTORY_VIEW_HEIGHT = 257;

export type Projection = { [string]: (value: WidgetValue) => number };

type Props = {
  widget: WidgetState,
  widgetStyle: *,
  children: *,
  className?: string,
  onResize?: (width: number, height: number) => void,
  projection?: Projection
};

type State = {
  projection: Projection
};

@observer
export default class Widget extends React.Component<Props, State> {
  constructor(props: Props) {<commit_msg>Fixed Linting Error.<commit_after>/**
 * @flow
 *
 * @Author: <NAME> <guiguan>
 * @Date:   2017-12-14T12:22:05+11:00
 * @Email:  <EMAIL>
 * @Last modified by:   guiguan
 * @Last modified time: 2018-02-14T14:55:30+11:00
 *
 * dbKoda - a modern, open source code editor, for MongoDB.
 * Copyright (C) 2017-2018 Southbank Software
 *
 * This file is part of dbKoda.
 *
 * dbKoda is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * dbKoda is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with dbKoda.  If not, see <http://www.gnu.org/licenses/>.
 */

import * as React from 'react';
import { action } from 'mobx';
import { observer } from 'mobx-react';
import type { WidgetState } from '~/api/Widget';
import ErrorView from '#/common/ErrorView';
import _ from 'lodash';
import ReactResizeDetector from 'react-resize-detector';
import { Tooltip, Position } from '@blueprintjs/core';
// $FlowFixMe
import { Popover2 } from '@blueprintjs/labs';
// $FlowFixMe
import { Broker, EventType } from '~/helpers/broker';
import type { WidgetValue } from '~/api/Widget';
import InfoIcon from '../../../../styles/icons/explain-query-icon.svg';
import HistoryView from './HistoryView';
import './Widget.scss';

const DEBOUNCE_DELAY = 100;
const MAX_HISTORY_SIZE = 720; // 1h with 5s sampling rate
const HISTORY_VIEW_WIDTH = 537;
const HISTORY_VIEW_HEIGHT = 257;

export type Projection = { [string]: (value: WidgetValue) => number };

type Props = {
  widget: WidgetState,
  widgetStyle: *,
  children: *,
  className?: string,
  onResize?: (width: number, height: number) => void,
  projection?: Projection
};

type State = {
  projection: Projection
};

@observer
export default class Widget extends React.Component<Props, State> {
  constructor(props: Props) {
{'fraction_non_alphanumeric': 0.118988484985324, 'fraction_numerical': 0.027094152178821405, 'mean_word_length': 4.091954022988506, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '370899', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1364, 'n_words': 502}