<commit_before>/**
* @ngdoc module
* @name infowrapFilepicker
* @description
*
* The primary module which needs to be injected into your application to provide filepicker services and directives.
*
*/

var infowrapFilepicker;

infowrapFilepicker = angular.module("infowrapFilepicker", []);

infowrapFilepicker.config([
  '$provide', function($provide) {
    return $provide.decorator('$rootScope', [
      '$delegate', function($delegate) {
        $delegate.safeApply = function(fn) {
          var phase;
          phase = $delegate.$$phase;
          if (phase === "$apply" || phase === "$digest") {
            if (fn && typeof fn === 'function') {
              return fn();
            }
          } else {
            return $delegate.$apply(fn);
          }
        };
        return $delegate;
      }
    ]);
  }
]);

infowrapFilepicker.provider("fpConfig", function() {
  var _apiKey, _debug, _options, _security;
  _apiKey = void 0;
  _debug = false;
  _security = false;
  _options = {};
  return {
    setApiKey: function(apiKey) {
      return _apiKey = apiKey;
    },
    setDebug: function(enable) {
      return _debug = enable;
    },
    setSecurity: function(enable) {
      return _security = enable;
    },
    setOptions: function(options) {
      return _options = options || {};
    },
    $get: function() {
      var api;
      api = {};
      api.apiKey = function() {
        return _apiKey;
      };
      api.debug = function() {
        return _debug;
      };
      api.security = function() {
        return _security;
      };
      api.options = function() {
        return _options;
      };
      return api;
    }
  };
});

/**
* @ngdoc object
* @name infowrapFilepicker.service:infowrapFilepickerService
* @requires $log
* @requires $window
* @requires $q
* @requires $rootScope
* @requires $timeout
* @description
*
* FilepickerService is responsible for exposing filepicker's api to your angular app.
*
* Currently, only a basic subset of their api is implemented.
* However, in the future we would like for this service to be configurable to implement only the api's you need/use.
*
* Feel free to issue a pull request if you find yourself motivated to flush out all the implementations.
* For a complete list of filepicker api calls, see <a href="https://developers.inkfilepicker.com/docs/web/" target="_blank">filepicker's documentation</a>.
*
*/


infowrapFilepicker.provider("infowrapFilepickerService", function() {
  return {
    $get: [
      "fpConfig", "infowrapFilepickerSecurity", "$log", "$window", "$q", "$rootScope", "$timeout", function(config, fps, $log, $window, $q, $rootScope, $timeout) {
        var allEvents, api, apiMethods, defaultPickOptions, eventPrefix, helperEvents, modalEvents, pickOptions, preparePickOptions;
        api = {};
        /**
        * @doc method
        * @name infowrapFilepicker.service:infowrapFilepickerService#loadFilepicker
        * @methodOf infowrapFilepicker.service:infowrapFilepickerService
        * @description
        *
        * Loads the filepicker javascript library.
        *
        * @returns {object} promise - gets resolved when filepicker library is loaded
        *
        */

        api.loadFilepicker = function() {
          var checkIfLoaded, configuredProtocol, defer;
          defer = $q.defer();
          configuredProtocol = config.options().loadProtocol || "";
          $('body').append("<script type=\"text/javascript\" src=\"" + configuredProtocol + "//api.filepicker.io/v2/filepicker.js\"></script>");
          checkIfLoaded = function() {
            if (_.isUndefined($window.filepicker)) {
              return $timeout(function() {
                return checkIfLoaded();
              }, 50);
            } else {
              return defer.resolve();
            }
          };
          checkIfLoaded();
          return defer.promise;
        };
        /**
        * @doc method
        * @name infowrapFilepicker.service:infowrapFilepickerService#log
        * @methodOf infowrapFilepicker.service:infowrapFilepickerService
        * @description
        *
        * Basic utility to provide debug logging for the module.
        *
        * @param {string} message - the message to log to output
        * @param {string} type (error, info, etc)
        *
        */

        api.log = function(msg, type) {
          if (config.debug()) {
            if (type) {
              return $log[type](msg);
            } else {
              return $log.log(msg);
            }
          }
        };
        api.events = {};
        eventPrefix = "infowrapFilepicker";
        apiMethods = ["pick", "pickAndStore", "exportFile", "read", "stat", "write", "writeUrl", "store", "convert", "remove"];
        helperEvents = ["pickedFiles", "error", "readingFiles", "readingFilesComplete", "readVCard", "readProgress", "resetFilesUploading", "progress", "storeProgress", "writeUrlProgress", "uploadProgress", "uploadsComplete"];
        allEvents = apiMethods.concat(helperEvents);
        modalEvents = ["close"];
        api.events.modal = {};
        _.forEach(modalEvents, function(event) {
          return api.events.modal[event] = ("" + eventPrefix + ":modal:") + event;
        });
        _.forEach(allEvents, function(event) {
          api.events[event] = ("" + eventPrefix + ":") + event;
          if (_.contains(apiMethods, event)) {
            return api[event] = function() {
              return api.log("" + event + " needs implementation!", "error");
            };
          }
        });
        defaultPickOptions = {
          container: "modal",
          maxSize: 5 * 1024 * 1024
        };
        pickOptions = _.extend(defaultPickOptions, config.options().pickOptions);
        preparePickOptions = function(opt) {
          var options;
          opt = opt || {};
          opt.multiple = opt.hasOwnProperty('multiple') ? opt.multiple : true;
          options = _.clone(pickOptions, true);
          _.extend(options, opt);
          return options;
        };
        /**
        * @doc method<commit_msg>Set default multiple setting to false<commit_after>/**
* @ngdoc module
* @name infowrapFilepicker
* @description
*
* The primary module which needs to be injected into your application to provide filepicker services and directives.
*
*/

var infowrapFilepicker;

infowrapFilepicker = angular.module("infowrapFilepicker", []);

infowrapFilepicker.config([
  '$provide', function($provide) {
    return $provide.decorator('$rootScope', [
      '$delegate', function($delegate) {
        $delegate.safeApply = function(fn) {
          var phase;
          phase = $delegate.$$phase;
          if (phase === "$apply" || phase === "$digest") {
            if (fn && typeof fn === 'function') {
              return fn();
            }
          } else {
            return $delegate.$apply(fn);
          }
        };
        return $delegate;
      }
    ]);
  }
]);

infowrapFilepicker.provider("fpConfig", function() {
  var _apiKey, _debug, _options, _security;
  _apiKey = void 0;
  _debug = false;
  _security = false;
  _options = {};
  return {
    setApiKey: function(apiKey) {
      return _apiKey = apiKey;
    },
    setDebug: function(enable) {
      return _debug = enable;
    },
    setSecurity: function(enable) {
      return _security = enable;
    },
    setOptions: function(options) {
      return _options = options || {};
    },
    $get: function() {
      var api;
      api = {};
      api.apiKey = function() {
        return _apiKey;
      };
      api.debug = function() {
        return _debug;
      };
      api.security = function() {
        return _security;
      };
      api.options = function() {
        return _options;
      };
      return api;
    }
  };
});

/**
* @ngdoc object
* @name infowrapFilepicker.service:infowrapFilepickerService
* @requires $log
* @requires $window
* @requires $q
* @requires $rootScope
* @requires $timeout
* @description
*
* FilepickerService is responsible for exposing filepicker's api to your angular app.
*
* Currently, only a basic subset of their api is implemented.
* However, in the future we would like for this service to be configurable to implement only the api's you need/use.
*
* Feel free to issue a pull request if you find yourself motivated to flush out all the implementations.
* For a complete list of filepicker api calls, see <a href="https://developers.inkfilepicker.com/docs/web/" target="_blank">filepicker's documentation</a>.
*
*/


infowrapFilepicker.provider("infowrapFilepickerService", function() {
  return {
    $get: [
      "fpConfig", "infowrapFilepickerSecurity", "$log", "$window", "$q", "$rootScope", "$timeout", function(config, fps, $log, $window, $q, $rootScope, $timeout) {
        var allEvents, api, apiMethods, defaultPickOptions, eventPrefix, helperEvents, modalEvents, pickOptions, preparePickOptions;
        api = {};
        /**
        * @doc method
        * @name infowrapFilepicker.service:infowrapFilepickerService#loadFilepicker
        * @methodOf infowrapFilepicker.service:infowrapFilepickerService
        * @description
        *
        * Loads the filepicker javascript library.
        *
        * @returns {object} promise - gets resolved when filepicker library is loaded
        *
        */

        api.loadFilepicker = function() {
          var checkIfLoaded, configuredProtocol, defer;
          defer = $q.defer();
          configuredProtocol = config.options().loadProtocol || "";
          $('body').append("<script type=\"text/javascript\" src=\"" + configuredProtocol + "//api.filepicker.io/v2/filepicker.js\"></script>");
          checkIfLoaded = function() {
            if (_.isUndefined($window.filepicker)) {
              return $timeout(function() {
                return checkIfLoaded();
              }, 50);
            } else {
              return defer.resolve();
            }
          };
          checkIfLoaded();
          return defer.promise;
        };
        /**
        * @doc method
        * @name infowrapFilepicker.service:infowrapFilepickerService#log
        * @methodOf infowrapFilepicker.service:infowrapFilepickerService
        * @description
        *
        * Basic utility to provide debug logging for the module.
        *
        * @param {string} message - the message to log to output
        * @param {string} type (error, info, etc)
        *
        */

        api.log = function(msg, type) {
          if (config.debug()) {
            if (type) {
              return $log[type](msg);
            } else {
              return $log.log(msg);
            }
          }
        };
        api.events = {};
        eventPrefix = "infowrapFilepicker";
        apiMethods = ["pick", "pickAndStore", "exportFile", "read", "stat", "write", "writeUrl", "store", "convert", "remove"];
        helperEvents = ["pickedFiles", "error", "readingFiles", "readingFilesComplete", "readVCard", "readProgress", "resetFilesUploading", "progress", "storeProgress", "writeUrlProgress", "uploadProgress", "uploadsComplete"];
        allEvents = apiMethods.concat(helperEvents);
        modalEvents = ["close"];
        api.events.modal = {};
        _.forEach(modalEvents, function(event) {
          return api.events.modal[event] = ("" + eventPrefix + ":modal:") + event;
        });
        _.forEach(allEvents, function(event) {
          api.events[event] = ("" + eventPrefix + ":") + event;
          if (_.contains(apiMethods, event)) {
            return api[event] = function() {
              return api.log("" + event + " needs implementation!", "error");
            };
          }
        });
        defaultPickOptions = {
          container: "modal",
          maxSize: 5 * 1024 * 1024
        };
        pickOptions = _.extend(defaultPickOptions, config.options().pickOptions);
        preparePickOptions = function(opt) {
          var options;
          opt = opt || {};
          opt.multiple = opt.hasOwnProperty('multiple') ? opt.multiple : false;
          options = _.clone(pickOptions, true);
          _.extend(options, opt);
          return options;
        };
        /**
        * @doc method
{'fraction_non_alphanumeric': 0.13141683778234087, 'fraction_numerical': 0.002135523613963039, 'mean_word_length': 2.3140990745781167, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '4525638', 'n_tokens_mistral': 3388, 'n_tokens_neox': 3295, 'n_words': 828}