'use strict';
const escapeStringRegexp = require('escape-string-regexp');

const platform = process.platform;

const main = {
	tick: '鉁�',
	cross: '鉁�',
	star: '鈽�',
	square: '鈻�',
	squareSmall: '鈼�',
	squareSmallFilled: '鈼�',
	play: '鈻�',
	circle: '鈼�',
	circleFilled: '鈼�',
	circleDotted: '鈼�',
	circleDouble: '鈼�',
	circleCircle: '鈸�',
	circleCross: '鈸�',
	circlePipe: '鈷�',
	circleQuestionMark: '?鈨�',
	bullet: '鈼�',
	dot: '鈥�',
	line: '鈹€',
	ellipsis: '鈥�',
	pointer: '鉂�',
	pointerSmall: '鈥�',
	info: '鈩�',
	warning: '鈿�',
	hamburger: '鈽�',
	smiley: '銒�',
	mustache: '喾�',
	heart: '鈾�',
	arrowUp: '鈫�',
	arrowDown: '鈫�',
	arrowLeft: '鈫�',
	arrowRight: '鈫�',
	radioOn: '鈼�',
	radioOff: '鈼�',
	checkboxOn: '鈽�',
	checkboxOff: '鈽�',
	checkboxCircleOn: '鈸�',
	checkboxCircleOff: '鈷�',
	questionMarkPrefix: '?鈨�',
	oneHalf: '陆',
	oneThird: '鈪�',
	oneQuarter: '录',
	oneFifth: '鈪�',
	oneSixth: '鈪�',
	oneSeventh: '鈪�',
	oneEighth: '鈪�',
	oneNinth: '鈪�',
	oneTenth: '鈪�',
	twoThirds: '鈪�',
	twoFifths: '鈪�',
	threeQuarters: '戮',
	threeFifths: '鈪�',
	threeEighths: '鈪�',
	fourFifths: '鈪�',
	fiveSixths: '鈪�',
	fiveEighths: '鈪�',
	sevenEighths: '鈪�'
};

const win = {
	tick: '鈭�',
	cross: '脳',
	star: '*',
	square: '鈻�',
	squareSmall: '[ ]',
	squareSmallFilled: '[鈻圿',
	play: '鈻�',
	circle: '( )',
	circleFilled: '(*)',
	circleDotted: '( )',
	circleDouble: '( )',
	circleCircle: '(鈼�)',
	circleCross: '(脳)',
	circlePipe: '(鈹�)',
	circleQuestionMark: '(?)',
	bullet: '*',
	dot: '.',
	line: '鈹€',
	ellipsis: '...',
	pointer: '>',
	pointerSmall: '禄',
	info: 'i',
	warning: '鈥�',
	hamburger: '鈮�',
	smiley: '鈽�',
	mustache: '鈹屸攢鈹�',
	heart: main.heart,
	arrowUp: main.arrowUp,
	arrowDown: main.arrowDown,
	arrowLeft: main.arrowLeft,
	arrowRight: main.arrowRight,
	radioOn: '(*)',
	radioOff: '( )',
	checkboxOn: '[脳]',
	checkboxOff: '[ ]',
	checkboxCircleOn: '(脳)',
	checkboxCircleOff: '( )',
	questionMarkPrefix: '锛�',
	oneHalf: '1/2',
	oneThird: '1/3',
	oneQuarter: '1/4',
	oneFifth: '1/5',
	oneSixth: '1/6',
	oneSeventh: '1/7',
	oneEighth: '1/8',
	oneNinth: '1/9',
	oneTenth: '1/10',
	twoThirds: '2/3',
	twoFifths: '2/5',
	threeQuarters: '3/4',
	threeFifths: '3/5',
	threeEighths: '3/8',
	fourFifths: '4/5',
	fiveSixths: '5/6',
	fiveEighths: '5/8',
	sevenEighths: '7/8'
};

if (platform === 'linux') {
	// the main one doesn't look that good on Ubuntu
	main.questionMarkPrefix = '?';
}

const figures = platform === 'win32' ? win : main;

const fn = str => {
	if (figures === main) {
		return str;
	}

	Object.keys(main).forEach(key => {
		if (main[key] === figures[key]) {
			return;
		}

		str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]);
	});

	return str;
};

module.exports = Object.assign(fn, figures);