<commit_before>'use strict';
var $ = require("jquery"),
	utils = require('./utils.js'),
	yUtils = require('yasgui-utils'),
	imgs = require('./imgs.js');
require('jquery-ui/sortable');
require('pivottable');


var root = module.exports = function(yasr) {
	var drawOnGChartCallback = false;
	var loadingGChart = false;
	var renderers = $.pivotUtilities.renderers;
	var plugin = {};
	var options = $.extend(true, {}, root.defaults);
	
	if (options.useD3Chart) {
		try {
			var d3 = require('d3');
			require('../node_modules/pivottable/dist/d3_renderers.js');
		} catch (e) {
			//do nothing. just make sure we don't use this renderer
		}
		if ($.pivotUtilities.d3_renderers) $.extend(true, renderers, $.pivotUtilities.d3_renderers);
	}
	
	var loadGoogleApi = function() {
		var finishAjax = function() {
			try {
				require('../node_modules/pivottable/dist/gchart_renderers.js');
				$.extend(true, renderers, $.pivotUtilities.gchart_renderers);
			} catch (e) {
				//hmm, something went wrong. forget about it;
			}
			loadingGChart = false;
			if (drawOnGChartCallback) draw();
			drawOnGChartCallback = false;
		};
		<commit_msg>made dependencies of pivot plugin a bit more robust<commit_after>'use strict';
var $ = require("jquery"),
	utils = require('./utils.js'),
	yUtils = require('yasgui-utils'),
	imgs = require('./imgs.js');
require('jquery-ui/sortable');
require('pivottable');

if (!$.fn.pivotUI) throw new Error("Pivot lib not loaded");
var root = module.exports = function(yasr) {
	var drawOnGChartCallback = false;
	var loadingGChart = false;
	var renderers = $.pivotUtilities.renderers;
	var plugin = {};
	var options = $.extend(true, {}, root.defaults);
	
	if (options.useD3Chart) {
		try {
			var d3 = require('d3');
			if (d3) require('../node_modules/pivottable/dist/d3_renderers.js');
		} catch (e) {
			//do nothing. just make sure we don't use this renderer
		}
		if ($.pivotUtilities.d3_renderers) $.extend(true, renderers, $.pivotUtilities.d3_renderers);
	}
	
	var loadGoogleApi = function() {
		var finishAjax = function() {
			try {
				require('../node_modules/pivottable/dist/gchart_renderers.js');
				$.extend(true, renderers, $.pivotUtilities.gchart_renderers);
			} catch (e) {
				//hmm, something went wrong. forget about it;
			}
			loadingGChart = false;
			if (drawOnGChartCallback) draw();
			drawOnGChartCallback = false;
		};
		
{'fraction_non_alphanumeric': 0.1574504010130857, 'fraction_numerical': 0.005487547488391726, 'mean_word_length': 3.9789915966386555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5122518', 'n_tokens_mistral': 888, 'n_tokens_neox': 818, 'n_words': 182}