/*
cssnano will look for configuration firstly as options passed
directly to it, and failing this it will use cosmiconfig to
load an external file.
429779
function resolveConfig(css, result, options) {
  if (options.preset) {
    return resolvePreset(options.preset);
  }

  const inputFile = css.source && css.source.input && css.source.input.file;
  let searchPath = inputFile ? path.dirname(inputFile) : process.cwd();
  let configPath = null;

  if (options.configFile) {
    searchPath = null;
    configPath = path.resolve(process.cwd(), options.configFile);
  }

  const configExplorer = cosmiconfig(cssnano);
  const searchForConfig = configPath
    ? configExplorer.load(configPath)
    : configExplorer.search(searchPath);

  return searchForConfig.then((config) => {
    if (config === null) {
      return resolvePreset('default');
    }

    return resolvePreset(config.config.preset || config.config);
  });
}
361255
function loadFromIndividualConfigFile(key) {
    key = _.replace(key, /\/|\\/g, ''); //forward and backslashes are unsafe when resolving filenames

    if (individualKeyCache[key]) {
        return individualKeyCache[key];
    } else {
        var toLoad = path.resolve(global.__appDir, 'config/' + key + '.json');

        var content = '{}';
        try {
            content = fs.readFileSync(toLoad);
        } catch (err) {
            //file must not exists
        }

        var json = {};
        try {
            json = JSON.parse(stripJsonComments(content.toString()));
        } catch (err) {
            console.warn('Error parsing JSON for %s', toLoad);
        }

        security.decryptObject(json, function (str) {
            //Decryption function
            return security.decrypt(str, process.env.decryptionKey);
        });
        individualKeyCache[key] = json;

        return individualKeyCache[key];
    }
}
1310198
function setOptions(config) {
    // We expect config at `config.plugins.fbFlo`.
    var cfg = config && config.plugins && config.plugins.fbFlo || {};

    this.config = defaults(pick(cfg, OPTIONS), FbFloBrunch.DEFAULTS);

    // We're using the configuration's public path, or its Brunch default,
    // to know what directory fb-flo should watch.
    this.config.publicPath = config && config.paths && config.paths.public ||
      path.join(process.cwd(), 'public');

    // Allow for basic, fb-flo supported true/false values for the resolver's
    // `reload` setting, but also allow anymatch sets (way more flexible).
    if (this.config.resolverReload) {
      if (true === this.config.resolverReload) {
        this.config.resolverReload = function alwaysReload() { return true; };
      } else {
        this.config.resolverReload = anymatch(this.config.resolverReload);
      }
    }

    // If a client-side message is defined, build the `update` resolver method.
    if (this.config.message) {
      var msg = this.config.message.toString().replace(/"/g, '\\"');
      var suffix = ['_resourceURL'];
      // We allow custom colors for the resource name and overall text
      // (this currently only works in Chrome DevTools; but so does fb-flo…).
      // Any valid CSS color syntax is usable.
      if (this.config.messageResourceColor) {
        msg = msg.replace('%s', '%c%s%c');
        suffix.unshift('"color: ' + this.config.messageResourceColor + '"');
        suffix.push('"color: ' + (this.config.messageColor || 'black') + '"');
      }
      if (this.config.messageColor) {
        msg = '%c' + msg;
        suffix.unshift('"color: ' + this.config.messageColor + '"');
      }
      suffix = suffix.join(', ');
      var level = this.config.messageLevel;
      var code = 'console.' + level + '("' + msg + '", ' + suffix + ');';
      // Closures won't marshal over to the browser, hence the autonomous
      // function code generation.
      /* jshint evil:true */
      this.update = new Function('_window', '_resourceURL', code);
    }
  }
329404
function () {
            config = scope.getConfig();
            api = config.api;

            // create a unique CSS namespace for this viewer instance
            config.namespace = CSS_CLASS_VIEWER + '-' + config.id;

            // Setup container
            $el = config.$el;

            // add crocodoc viewer and namespace classes
            $el.addClass(CSS_CLASS_VIEWER);
            $el.addClass(config.namespace);

            // add a / to the end of the base url if necessary
            if (config.url) {
                if (!/\/$/.test(config.url)) {
                    config.url += '/';
                }
            } else {
                throw new Error('no URL given for viewer assets');
            }

            // make the url absolute
            config.url = scope.getUtility('url').makeAbsolute(config.url);

            //if useSVG hasn't been set, default to true
            if (config.useSVG === undefined) {
                config.useSVG = true;
            }

            validateQueryParams();
            initViewerHTML();
            initPlugins();
        }
1064244
function (options) {
  var userOptions = options || {};
  var configFile = userOptions.configFile;

  var compile = through.obj(function (file, encoding, cb) {

    if (file.isNull()) {
      return cb();
    }
    if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    }

    // load our config from sassLint and the user provided options if available
    file.sassConfig = lint.getConfig(userOptions, configFile);
    // save the config file within the file object for access when this file is piped around
    file.userOptions = userOptions;
    file.configFile = configFile;

    // lint the file and pass the user defined options and config path to sass lint to handle
    try {
      file.sassLint = [
        lint.lintFileText({
          'text': file.contents,
          'format': path.extname(file.path).replace('.', ''),
          'filename': path.relative(process.cwd(), file.path)
        }, userOptions, configFile)];
    } catch(e) {
      this.emit('error', new PluginError(PLUGIN_NAME, e.message));
    }

    this.push(file);
    cb();
  });
  return compile;
}
716435
function readConfig(configFileLocationIn = '', optionsIn = null) {

		var tmpCONFIG = '';
		if (configFileLocationIn == '') {
			readStream = fs.createReadStream(configFileLocation, 'utf8');
		} else {

			if (configFileLocationIn == 'cmd_default') {

				CONFIG = {};
				CONFIG.options = optionsIn;
				if (CONFIG.options.trim) {
					OPTIONS.trim_removed_rules_previous_comment = CONFIG.options.trim;
					OPTIONS.trim_comments = CONFIG.options.trim;
					OPTIONS.trim_whitespace = CONFIG.options.trim;
					OPTIONS.trim_breaklines = CONFIG.options.trim;
					OPTIONS.trim_last_semicolon = CONFIG.options.trim;
				}
				if (CONFIG.options.shorten) {
					OPTIONS.shorten_zero = CONFIG.options.shorten;
					OPTIONS.shorten_hexcolor = CONFIG.options.shorten;
					OPTIONS.shorten_hexcolor_extended_names = CONFIG.options.shorten;
					OPTIONS.shorten_font = CONFIG.options.shorten;
					OPTIONS.shorten_background = CONFIG.options.shorten;
					OPTIONS.shorten_margin = CONFIG.options.shorten;
					OPTIONS.shorten_padding = CONFIG.options.shorten;
					OPTIONS.shorten_list_style = CONFIG.options.shorten;
					OPTIONS.shorten_outline = CONFIG.options.shorten;
					OPTIONS.shorten_border = CONFIG.options.shorten;
					OPTIONS.shorten_border_top = CONFIG.options.shorten;
					OPTIONS.shorten_border_right = CONFIG.options.shorten;
					OPTIONS.shorten_border_bottom = CONFIG.options.shorten;
					OPTIONS.shorten_border_left = CONFIG.options.shorten;
					OPTIONS.shorten_border_radius = CONFIG.options.shorten;
				}
				if (CONFIG.options.special_reduce_with_html) {
					OPTIONS.special_reduce_with_html = CONFIG.special_reduce_with_html;
				}
				if (CONFIG.options.css_output) {
					OPTIONS.css_output = CONFIG.options.css_output;
				}
				if (CONFIG.options.verbose) {
					OPTIONS.verbose = CONFIG.options.verbose;
				}

				summary.files.output.push(CONFIG.options.css_output);
				REPORT_DUPLICATE_CSS = OPTIONS.report_file_location;
				CONFIG_REDUCE_DECLARATIONS = OPTIONS.reduce_declarations_file_location;
				summary.options_used = OPTIONS;

				CPEVENTS.emit('CONFIG_READ_END', OPTIONS);

				return true;
			} else { //custom
				readStream = fs.createReadStream(configFileLocationIn, 'utf8');	
			}
			
		}

		readStream.on('data', function(chunk) {  
			tmpCONFIG += chunk;
		}).on('end', function() {

			if (tmpCONFIG !== '') {
				try {
					CONFIG = JSON.parse(tmpCONFIG);	
				} catch(err) {
					console.log(error("Config File read error: " + configFileLocation + ", check your syntax, especially commas, then please try again."));
					console.log(err);
					process.exit(1);
				}
				summary.files.output.push(CONFIG.options.css_output);
				REPORT_DUPLICATE_CSS = CONFIG.options.report_file_location;
				CONFIG_REDUCE_DECLARATIONS = CONFIG.options.reduce_declarations_file_location;

				if (CONFIG.options.trim) {
					CONFIG.options.trim_removed_rules_previous_comment = CONFIG.options.trim;
					CONFIG.options.trim_comments = CONFIG.options.trim;
					CONFIG.options.trim_whitespace = CONFIG.options.trim;
					CONFIG.options.trim_breaklines = CONFIG.options.trim;
					CONFIG.options.trim_last_semicolon = CONFIG.options.trim;
				}
				if (CONFIG.options.shorten) {
					CONFIG.options.shorten_zero = CONFIG.options.shorten;
					CONFIG.options.shorten_hexcolor = CONFIG.options.shorten;
					CONFIG.options.shorten_hexcolor_extended_names = CONFIG.options.shorten;
					CONFIG.options.shorten_font = CONFIG.options.shorten;
					CONFIG.options.shorten_background = CONFIG.options.shorten;
					CONFIG.options.shorten_margin = CONFIG.options.shorten;
					CONFIG.options.shorten_padding = CONFIG.options.shorten;
					CONFIG.options.shorten_list_style = CONFIG.options.shorten;
					CONFIG.options.shorten_outline = CONFIG.options.shorten;
					CONFIG.options.shorten_border = CONFIG.options.shorten;
					CONFIG.options.shorten_border_top = CONFIG.options.shorten;
					CONFIG.options.shorten_border_right = CONFIG.options.shorten;
					CONFIG.options.shorten_border_bottom = CONFIG.options.shorten;
					CONFIG.options.shorten_border_left = CONFIG.options.shorten;
					CONFIG.options.shorten_border_radius = CONFIG.options.shorten;
				}
				OPTIONS = CONFIG.options;
				summary.options_used = OPTIONS;
			}

			CPEVENTS.emit('CONFIG_READ_END', OPTIONS);

		}).on('error', function(e) {
			CPEVENTS.emit('CONFIG_READ_ERROR');
			console.log(error("Config File read error: Something went wrong while reading the file, check your " + configFileLocation + " and please try again."));
			console.log(e);
			process.exit(1);

		});

		return readStream;
	}
711175
function( fileName ) {
        // console.log('Read configuration from ' + fileName);
        var pathSep = require('path').sep;
        var inFileName = process.cwd() + pathSep + fileName;

        var config = require( inFileName );

        // TODO: validate config

        for ( var procs in config ) {
            if ( config.hasOwnProperty(procs) ) {
                config[procs].forEach(function(proc){
                    if ( proc.hasOwnProperty('fileName') ) {
                        proc.fileName = process.cwd() + pathSep + proc.fileName;
                    }
                });
            }
        }
        return config;
    }
754199
function loadFromDisk(configInfo, configContext) {
    const config = loadConfigFile(configInfo);

    // loadConfigFile will return null for a `package.json` file that does not have an `eslintConfig` property.
    if (config) {
        return loadObject(configContext, { config, filePath: configInfo.filePath, configFullName: configInfo.configFullName });
    }

    return null;
}
707183
function mergeOptions(pluginOptions) {
  const defaultOptions = {
    config: null,
    debug: false,
    css: {
      file_types: ['.css', '.less', '.sass', '.scss'],
    },
    html: {
      file_types: ['.html'],
    },
    js: {
      file_types: ['.js', '.json'],
    },
  };

  // Load 'file options'
  const explorer = cosmiconfig('jsbeautify');
  let explorerResult;

  if (pluginOptions && pluginOptions.config) {
    explorerResult = explorer.loadSync(path.resolve(pluginOptions.config));
  } else {
    explorerResult = explorer.searchSync();
  }

  let fileOptions;
  if (explorerResult) {
    fileOptions = explorerResult.config;
  }

  // Merge options
  const finalOptions = mergeWith({}, defaultOptions, fileOptions, pluginOptions, (objValue, srcValue) => {
    if (Array.isArray(objValue)) {
      return objValue.concat(srcValue);
    }

    return undefined;
  });

  // Show debug messages
  if (finalOptions.debug) {
    if (fileOptions) {
      log(`File options:\n${JSON.stringify(fileOptions, null, 2)}`);
    }

    log(`Final options:\n${JSON.stringify(finalOptions, null, 2)}`);
  }

  // Delete properties not used
  delete finalOptions.config;
  delete finalOptions.debug;

  return finalOptions;
}
897709
function fromConfigFile(config) {
  var sharedFileConfig;
  try {
    var configFile = AWS.util.iniLoader.loadFrom({
      isConfig: true,
      filename: process.env[AWS.util.sharedConfigFileEnv]
    });
    var sharedFileConfig = configFile[
      process.env.AWS_PROFILE || AWS.util.defaultProfile
    ];
  } catch (err) {
    return false;
  }
  if (!sharedFileConfig) return config;
  config.port = config.port || sharedFileConfig.csm_port;
  config.enabled = config.enabled || sharedFileConfig.csm_enabled;
  config.clientId = config.clientId || sharedFileConfig.csm_client_id;
  return config.port && config.enabled && config.clientId;
}
1243370
function configuration(self, name) {
  if (!self.__configurations__[name]) {
    throw new Error('Unknown configuration: ' + name);
  }

  return self.__configurations__[name];
}
1366591
function createConfig(target /*: Target */, dev /*: boolean */,
        minimize /*: boolean */) /*: Object */ {
    const cssLoaders /*: Array<Object> */ = [{loader: 'css-loader'}];
    if (minimize) {
        cssLoaders[0].options = {importLoaders: 1};
        cssLoaders.push({
            loader: 'postcss-loader',
            options: {plugins: [require('cssnano')()]},
        });
    }

    const lessOptions = {modifyVars: {
        version: `"${version}"`,
    }};

    // use only necessary fonts, overridable by environment variables
    let isCovered = false;
    for (const font of fonts) {
        const override = process.env[`USE_${font.toUpperCase()}`];
        const useFont = override === "true" || override !== "false" && !isCovered;
        lessOptions.modifyVars[`use-${font}`] = useFont;

        const support = caniuse.feature(caniuse.features[font]).stats;
        isCovered = isCovered || useFont && browserslist.every(browser => {
            const [name, version] = browser.split(' ');
            return !support[name] || support[name][version] === 'y';
        });
    }

    return {
        mode: dev ? 'development' : 'production',
        context: __dirname,
        entry: {
            [target.name]: target.entry,
        },
        output: {
            filename: minimize ? '[name].min.js' : '[name].js',
            library: target.library,
            libraryTarget: 'umd',
            libraryExport: 'default',
            // Enable output modules to be used in browser or Node.
            // See: https://github.com/webpack/webpack/issues/6522
            globalObject: "(typeof self !== 'undefined' ? self : this)",
            path: path.resolve(__dirname, 'dist'),
            publicPath: dev ? '/' : '',
        },
        module: {
            rules: [
                {
                    test: /\.js$/,
                    exclude: /node_modules/,
                    use: 'babel-loader',
                },
                {
                    test: /\.css$/,
                    use: [
                        dev ? 'style-loader' : MiniCssExtractPlugin.loader,
                        ...cssLoaders,
                    ],
                },
                {
                    test: /\.less$/,
                    use: [
                        dev ? 'style-loader' : MiniCssExtractPlugin.loader,
                        ...cssLoaders,
                        {
                            loader: 'less-loader',
                            options: lessOptions,
                        },
                    ],
                },
                {
                    test: /\.(ttf|woff|woff2)$/,
                    use: [{
                        loader: 'file-loader',
                        options: {
                            name: 'fonts/[name].[ext]',
                        },
                    }],
                },
            ],
        },
        externals: 'katex',
        plugins: [
            !dev && new MiniCssExtractPlugin({
                filename: minimize ? '[name].min.css' : '[name].css',
            }),
        ].filter(Boolean),
        devtool: dev && 'inline-source-map',
        optimization: {
            minimize,
            minimizer: [
                new TerserPlugin({
                    terserOptions: {
                        output: {
                            ascii_only: true,
                        },
                    },
                }),
            ],
        },
        performance: {
            hints: false,
        },
    };
}
520874
function loadPageCss(cssFile) {
    var cssFileName;

    // Eliminate the ./ on the file if present so that we can add the full path
    if (cssFile.startsWith("./")) {
        cssFile = cssFile.substring(2);
    }

    if (cssFile.startsWith(UpdaterSingleton.currentAppPath())) {
        cssFileName = cssFile;
    } else {
        cssFileName = fs.path.join(UpdaterSingleton.currentAppPath(), cssFile);
    }

    var applicationCss;
    if (FSA.fileExists(cssFileName)) {
        FSA.readText(cssFileName, function (r) { applicationCss = r; });

        // Add New CSS to Current Page
        var f = frameCommon.topmost();
        if (f && f.currentPage) {
            f.currentPage._resetCssValues();
            f.currentPage._styleScope = new styleScope.StyleScope();
            //noinspection JSUnusedAssignment
            f.currentPage._addCssInternal(applicationCss, cssFileName);
            f.currentPage._refreshCss();
        }
    }
}
1030082
function locateConfig(url) {
  let configpath = '';

  function check(dir) {
    // Support js, json, and package.json
    const urljs = path.join(dir, DEFAULT_MANIFEST.js);
    const urljson = path.join(dir, DEFAULT_MANIFEST.json);
    const urlpkgjson = path.join(dir, DEFAULT_MANIFEST.pkgjson);
    let urlFinal;

    if (exists((urlFinal = urljs)) || exists((urlFinal = urljson)) || exists((urlFinal = urlpkgjson))) {
      return urlFinal;
    }
    return '';
  }

  if (url) {
    configpath = path.resolve(url);

    try {
      // Try default file name if passed directory
      if (!path.extname(configpath).length || fs.statSync(configpath).isDirectory()) {
        configpath = check(configpath);
        if (!configpath) throw Error('no default found');
      }
    } catch (err) {
      throw Error(strong('buddy') + ' config not found in ' + strong(path.dirname(url)));
    }

    // No url specified
  } else {
    try {
      // Find the first instance of a DEFAULT file based on the current working directory
      configpath = hunt(
        process.cwd(),
        (resource, stat) => {
          if (stat.isFile()) {
            const basename = path.basename(resource);

            return basename == DEFAULT_MANIFEST.js ||
              basename == DEFAULT_MANIFEST.json ||
              basename == DEFAULT_MANIFEST.pkgjson;
          }
        },
        true
      );
    } catch (err) {
      if (!configpath) throw Error(strong('buddy') + ' config not found');
    }
  }

  return configpath;
}
976124
function cssobj$1 (obj, config, state) {
  config = config || {};

  var local = config.local;
  config.local = !local
    ? {space: ''}
  : local && typeof local === 'object' ? local : {};

  config.plugins = [].concat(
    config.plugins || [],
    cssobj_plugin_selector_localize(config.local),
    cssobj_plugin_post_cssom(config.cssom)
  );

  return cssobj(config)(obj, state)
}
259110
function loadStyles(css, doc) {
            // default to the global `document` object
            if (!doc) doc = document;

            var head = doc.head || doc.getElementsByTagName('head')[0];

            // no <head> node? create one...
            if (!head) {
                head = doc.createElement('head');
                var body = doc.body || doc.getElementsByTagName('body')[0];
                if (body) {
                    body.parentNode.insertBefore(head, body);
                } else {
                    doc.documentElement.appendChild(head);
                }
            }

            var style = doc.createElement('style');
            style.type = 'text/css';
            if (style.styleSheet) {
                // IE
                style.styleSheet.cssText = css;
            } else {
                // the world
                style.appendChild(doc.createTextNode(css));
            }
            head.appendChild(style);

            return style;
        }
13155
function getConfig(macro, filename, source) {
  if (macro.options.configName) {
    try {
      // lazy-loading it here to avoid perf issues of loading it up front.
      // No I did not measure. Yes I'm a bad person.
      // FWIW, this thing told me that cosmiconfig is 227.1 kb of minified JS
      // so that's probably significant... https://bundlephobia.com/result?p=cosmiconfig@3.1.0
      // Note that cosmiconfig will cache the babel-plugin-macros config 👍
      const explorer = require('cosmiconfig')('babel-plugin-macros', {
        searchPlaces: [
          'package.json',
          `.babel-plugin-macrosrc`,
          `.babel-plugin-macrosrc.json`,
          `.babel-plugin-macrosrc.yaml`,
          `.babel-plugin-macrosrc.yml`,
          `.babel-plugin-macrosrc.js`,
          `babel-plugin-macros.config.js`,
        ],
        packageProp: 'babelMacros',
        sync: true,
      })
      const loaded = explorer.searchSync(filename)
      if (loaded) {
        return loaded.config[macro.options.configName]
      }
    } catch (error) {
      // eslint-disable-next-line no-console
      console.error(
        `There was an error trying to load the config "${
          macro.options.configName
        }" ` +
          `for the macro imported from "${source}. ` +
          `Please see the error thrown for more information.`,
      )
      throw error
    }
  }
}