/*
function config_index_html() {
const HtmlWebpackPlugin = require('html-webpack-plugin');
return {
plugins.html_webpack_plugin: new HtmlWebpackPlugin(),
};
}
194383
function config_resolve({context}) {
    return () => {
        let config_part = {
            /*
            resolveLoader: {modules: [
             // __dirname+'/',
                pathModule.join(__dirname, "../node_modules"),
            ]},
            */
            context,
        };
        const extra_paths = (process.env['NODE_PATH']||'').split(':').filter(Boolean);
        if( extra_paths.length > 0 ) {
            config_part = {
                ...config_part,
                resolve: {modules: [
                    "node_modules",
                    ...extra_paths,
                ]},
            };
        }
        return config_part;
    };
}
1044776
function addSearchHeaderRenderHtml( divId, type , params, config ) {
	log( "PoNG-Search", "add content " );
	if ( ! config.page ) return;
	var html = [];		
	var lang = '';
  html.push( '<div class="pongSearch" id="'+divId+'">' );
  html.push( '<form id="'+divId+'Form">' );
  html.push( '<input type="hidden" name="layout" value="'+ config.page + '"/>' ); 
  if ( getParam( 'lang' ) != '' ) {
    html.push( '<input type="hidden" name="lang" value="'+ getParam( 'lang' ) + '"/>' ); 
  } 
  var role = '';
  if ( userRole != '' ) {
    html.push( '<input type="hidden" name="role" value="'+ getParam( 'role' ) + '"/>' ); 
  } 
  var title = ( config.title ? config.title : '' );
  var name = ( config.name ? config.name : 'search' );
  if ( config.label ) {
    html.push( '<label class="pongSearchLabel" for="'+divId+'Input">'+$.i18n( config.label )+'</label>' )
  }
  html.push( '<input id="'+divId+'Input" class="pongSearchInput" title="'+title+'" name="'+name+'" accessKey="s"></input>' )
  html.push( '</form>' )
  html.push( '<script>' )
  //html.push( '  $( function(){ alert("yepp") } );' )
  html.push( '  $( "#'+divId+'Form" ).submit( function(event){   } );' )
  html.push( '</script>' )
  html.push( '</div>' )
	$( "#"+divId ).html( html.join( "\n" ) );
}
564579
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    var md = new MarkdownIt(options);
    Object.keys(files).forEach(function(file){
      if (!markdown(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      var str = md.render(data.contents.toString());
      data.contents = new Buffer(str);
      keys.forEach(function(key) {
        data[key] = md.render(data[key]);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
1322017
function html(opts) {
  opts = opts || {}
  var parent = opts.target =  createElement();
  parent.innerHTML = opts.content;
  Splitting(opts)
  return parent.outerHTML
}
521092
function (type) {
            var confs = type ? _.pick(this.config, type) : this.config;
            each(confs, function (config) {
                this.parent.$(config.location).html('');
            }, this);
            return this;
        }
530993
function configFactory(filename, options) {
    if (!_.isObject(options)) {
        options = {};
    }

    var config = WebpackConfig.loader.loadConfig(filename),
        isArray = _.isArray(config);

    if (!isArray) {
        config = [config];
    }

    config = _.map(config, function(x) {
        x.merge(options);
        x.defaults({
            output: {
                path: path.dirname(filename)
            }
        });

        return x;
    });

    return isArray ? config : _.first(config);
}
1352507
function getHTMLWH(html) {
  const temp = document.createElement('template');
  const span = document.createElement('span');
  temp.innerHTML = html;
  document.body.appendChild(span);
  if (temp.content) {
    span.appendChild(temp.content, span.lastElementChild);
  } else {
    span.insertAdjacentHTML('beforeend', html);
  }
  span.style.position = 'absolute';
  span.style.zIndex = '-1';
  span.style.display = 'block';
  const whArray = getDomWH(span);
  const result = {
    width: whArray[0],
    height: whArray[1],
  };
  span.parentNode.removeChild(span);
  return result;
}
1000535
function tweakWebpackConfig(module) {
  const { default: webpackConfig = module } = module;

  const config = handleWebpackConfig(webpackConfig);

  if (!config) {
    throw new Error(
      'Not found webpack configuration. For multiple configurations in single file you must provide config with target "node".'
    );
  }

  const hmrClientEntry = require.resolve('./HmrClient');

  const addHmrClientEntry = (entry, entryOwner) => {
    const owner = entryOwner;
    if (Array.isArray(owner[entry])) {
      owner[entry].splice(-1, 0, hmrClientEntry);
    } else if (typeof owner[entry] === 'string') {
      owner[entry] = [hmrClientEntry, owner[entry]];
    } else if (typeof owner[entry] === 'function') {
      // Call function and try again with function result.
      owner[entry] = owner[entry]();
      addHmrClientEntry(entry, owner);
    } else if (typeof owner[entry] === 'object') {
      Object.getOwnPropertyNames(owner[entry]).forEach(name =>
        addHmrClientEntry(name, owner[entry])
      );
    }
  };

  // Add HmrClient to every entries.
  addHmrClientEntry('entry', config);

  if (!config.plugins) {
    config.plugins = [];
  }

  // Add source-map support if configured.
  if (config.devtool && config.devtool.indexOf('source-map') >= 0) {
    config.plugins.push(
      new webpack.BannerPlugin({
        banner: `;require('${require
          .resolve('source-map-support')
          .replace(/\\/g, '/')}').install();`,
        raw: true,
        entryOnly: false,
      })
    );
  }

  // Enable HMR globally if not.
  if (!config.plugins.find(p => p instanceof webpack.HotModuleReplacementPlugin)) {
    config.plugins.push(new webpack.HotModuleReplacementPlugin());
  }

  return config;
}
1210727
function getWebpackConfig(skyPagesConfig, argv) {
  const common = require('./common.webpack.config');

  return webpackMerge(common.getWebpackConfig(skyPagesConfig, argv), {
    devtool: 'source-map',
    module: {
      rules: [
        {
          test: /\.ts$/,
          use: [
            {
              loader: 'awesome-typescript-loader',
              options: {
                // Ignore the "Cannot find module" error that occurs when referencing
                // an aliased file.  Webpack will still throw an error when a module
                // cannot be resolved via a file path or alias.
                ignoreDiagnostics: [2307],
                transpileOnly: true
              }
            },
            {
              loader: 'angular2-template-loader'
            }
          ]
        }
      ]
    },
    plugins: [
      SaveMetadata,
      new webpack.optimize.UglifyJsPlugin({
        beautify: false,
        comments: false,
        mangle: { screw_ie8: true, keep_fnames: true },
        sourceMap: true
      })
    ]
  });
}
1344954
function webpackBuild(config, callback, options) {
    options = typeof options !== 'undefined' && options !== null ? options : {};

    // Clone configuration
    config = merge(true, {
        plugins: []
    }, config);

    // Process options
    if(options.minify) {
        // Enable uglify plugin
        config.plugins.push(new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            sourceMap: true
        }));

        // Update destination directory
        config.output.path += '/minified';

        // Update filename
        config.output.filename = 'listenbrainz.min.js';
    } else {
        config.output.path += '/normal';
    }

    // Build module
    webpack(config, function(err, stats) {
        if(err) {
            throw new gutil.PluginError("webpack", err);
        }

        gutil.log("[webpack]", stats.toString({}));
        callback();
    });
}
151442
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!isHtml(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('Encoding html entities in file: %s', file);

      var reg = /\`\`\`([\s\S]+?)\`\`\`/gi;
      var rep = function(match, group) {
        if (group) {
          return he.encode(group, {useNamedReferences: true});
        }
        else {
          return "";
        }
      };
      var encoded = data.contents.toString().replace(reg, rep);
      data.contents = new Buffer(encoded);

      keys.forEach(function(key) {
        data[key] = data[key].replace(reg, rep);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
128892
function getWebpackStats(config) {

    let statsPaths = config.testPathDirs.map(testPathDir => {
        return path.join(testPathDir, 'stats.json');
    });

    statsPaths.some(statsPath => {
        try {
            webpackStats = require(statsPath);
        } catch (oh) {
            // not found
        }
        return !!webpackStats;
    });

    if (!webpackStats) {
        throw new Error('Cannot find Webpack stats in: \n' + statsPaths.join('\n'));
    }

    return webpackStats;
}
157155
function getWebpackConfig(skyPagesConfig, argv = {}) {
  const resolves = [
    process.cwd(),
    spaPath('node_modules'),
    outPath('node_modules')
  ];

  let alias = aliasBuilder.buildAliasList(skyPagesConfig);

  const outConfigMode = skyPagesConfig && skyPagesConfig.skyux && skyPagesConfig.skyux.mode;
  const logFormat = getLogFormat(skyPagesConfig, argv);

  let appPath;

  switch (outConfigMode) {
    case 'advanced':
      appPath = spaPath('src', 'main.ts');
      break;

    default:
      appPath = outPath('src', 'main-internal.ts');
      break;
  }

  let plugins = [
    // Some properties are required on the root object passed to HtmlWebpackPlugin
    new HtmlWebpackPlugin({
      template: skyPagesConfig.runtime.app.template,
      inject: skyPagesConfig.runtime.app.inject,
      runtime: skyPagesConfig.runtime,
      skyux: skyPagesConfig.skyux
    }),

    new CommonsChunkPlugin({
      name: ['skyux', 'vendor', 'polyfills']
    }),

    new webpack.DefinePlugin({
      'skyPagesConfig': JSON.stringify(skyPagesConfig)
    }),

    new LoaderOptionsPlugin({
      options: {
        context: __dirname,
        skyPagesConfig: skyPagesConfig
      }
    }),

    new ContextReplacementPlugin(
      // The (\\|\/) piece accounts for path separators in *nix and Windows
      /angular(\\|\/)core(\\|\/)@angular/,
      spaPath('src'),
      {}
    ),

    new OutputKeepAlivePlugin({
      enabled: argv['output-keep-alive']
    })
  ];

  // Supporting a custom logging type of none
  if (logFormat !== 'none') {
    plugins.push(new SimpleProgressWebpackPlugin({
      format: logFormat,
      color: logger.logColor
    }));
  }

  return {
    entry: {
      polyfills: [outPath('src', 'polyfills.ts')],
      vendor: [outPath('src', 'vendor.ts')],
      skyux: [outPath('src', 'skyux.ts')],
      app: [appPath]
    },
    output: {
      filename: '[name].js',
      chunkFilename: '[id].chunk.js',
      path: spaPath('dist'),
    },
    resolveLoader: {
      modules: resolves
    },
    resolve: {
      alias: alias,
      modules: resolves,
      extensions: [
        '.js',
        '.ts'
      ]
    },
    module: {
      rules: [
        {
          enforce: 'pre',
          test: /config\.ts$/,
          loader: outPath('loader', 'sky-app-config'),
          include: outPath('runtime')
        },
        {
          enforce: 'pre',
          test: [
            /\.(html|s?css)$/,
            /sky-pages\.module\.ts/
          ],
          loader: outPath('loader', 'sky-assets')
        },
        {
          enforce: 'pre',
          test: /sky-pages\.module\.ts$/,
          loader: outPath('loader', 'sky-pages-module')
        },
        {
          enforce: 'pre',
          loader: outPath('loader', 'sky-processor', 'preload'),
          include: spaPath('src'),
          exclude: /node_modules/
        },
        {
          test: /\.s?css$/,
          use: [
            'raw-loader',
            'sass-loader'
          ]
        },
        {
          test: /\.html$/,
          loader: 'raw-loader'
        },
        {
          test: /\.json$/,
          loader: 'json-loader'
        }
      ]
    },
    plugins
  };
}
876143
async function createDispatcher(options={}){

    // merge options
    const opt = {
        template: options.template || _path.join(__dirname, '../assets/template.ejs'),
        css: options.css || _path.join(__dirname, '../assets/layout.css'),
        lang: options.lang || 'en_US',
        footer: options.footer || null
    };

    // load page template
    const tpl = await _fs.readFile(opt.template, 'utf8');

    // load styles
    const css = await _fs.readFile(opt.css, 'utf8');
    
    // load page definitions
    const pages = await _jsonReader(_path.join(__dirname, '../i18n/pages-' + opt.lang + '.json'));

    // multi-type support
    // @see https://github.com/koajs/koa/blob/master/docs/api/response.md#responseistypes
    return function dispatchRequest(page, httpStatusCode, ctx){
        // page available ?
        if (!pages[page]){
            // use "internal server error" as default
            page = '500';
            httpStatusCode = null;
        }

        // set http status code
        ctx.status = httpStatusCode || 500;

        // extract page date
        const pageData = pages[page];

        // multiple response formats
        switch (ctx.accepts('json', 'html', 'text')){

            // jsonn response
            case 'json':
                ctx.type = 'json';
                ctx.body = {
                    error: pageData.title + ' - ' + pageData.message
                }
                break;

            // html response
            case 'html':
                ctx.type = 'html';
                ctx.body = _render(tpl, css, {
                    code: httpStatusCode,
                    title: pageData.title,
                    message: pageData.message,
                    footer: opt.footer
                });
                break;
            
            // default: text response
            default:
                ctx.type = 'text/plain';
                ctx.body = pageData.title + ' - ' + pageData.message;
          }
    }
}
311323
function createWebpack1ResolveSync(webpackRequire, resolveConfig, plugins) {
  var Resolver = webpackRequire('enhanced-resolve/lib/Resolver')
  var SyncNodeJsInputFileSystem = webpackRequire('enhanced-resolve/lib/SyncNodeJsInputFileSystem')

  var ModuleAliasPlugin = webpackRequire('enhanced-resolve/lib/ModuleAliasPlugin')
  var ModulesInDirectoriesPlugin =
    webpackRequire('enhanced-resolve/lib/ModulesInDirectoriesPlugin')
  var ModulesInRootPlugin = webpackRequire('enhanced-resolve/lib/ModulesInRootPlugin')
  var ModuleAsFilePlugin = webpackRequire('enhanced-resolve/lib/ModuleAsFilePlugin')
  var ModuleAsDirectoryPlugin = webpackRequire('enhanced-resolve/lib/ModuleAsDirectoryPlugin')
  var DirectoryDescriptionFilePlugin =
    webpackRequire('enhanced-resolve/lib/DirectoryDescriptionFilePlugin')
  var DirectoryDefaultFilePlugin =
    webpackRequire('enhanced-resolve/lib/DirectoryDefaultFilePlugin')
  var FileAppendPlugin = webpackRequire('enhanced-resolve/lib/FileAppendPlugin')
  var ResultSymlinkPlugin = webpackRequire('enhanced-resolve/lib/ResultSymlinkPlugin')
  var DirectoryDescriptionFileFieldAliasPlugin =
    webpackRequire('enhanced-resolve/lib/DirectoryDescriptionFileFieldAliasPlugin')

  var resolver = new Resolver(new SyncNodeJsInputFileSystem())

  resolver.apply(
    resolveConfig.packageAlias
      ? new DirectoryDescriptionFileFieldAliasPlugin('package.json', resolveConfig.packageAlias)
      : function() {},
    new ModuleAliasPlugin(resolveConfig.alias || {}),
    makeRootPlugin(ModulesInRootPlugin, 'module', resolveConfig.root),
    new ModulesInDirectoriesPlugin(
      'module',
      resolveConfig.modulesDirectories || resolveConfig.modules || ['web_modules', 'node_modules']
    ),
    makeRootPlugin(ModulesInRootPlugin, 'module', resolveConfig.fallback),
    new ModuleAsFilePlugin('module'),
    new ModuleAsDirectoryPlugin('module'),
    new DirectoryDescriptionFilePlugin(
      'package.json',
      ['module', 'jsnext:main'].concat(resolveConfig.packageMains || webpack1DefaultMains)
    ),
    new DirectoryDefaultFilePlugin(['index']),
    new FileAppendPlugin(resolveConfig.extensions || ['', '.webpack.js', '.web.js', '.js']),
    new ResultSymlinkPlugin()
  )


  var resolvePlugins = []

  // support webpack.ResolverPlugin
  if (plugins) {
    plugins.forEach(function (plugin) {
      if (
        plugin.constructor &&
        plugin.constructor.name === 'ResolverPlugin' &&
        Array.isArray(plugin.plugins)
      ) {
        resolvePlugins.push.apply(resolvePlugins, plugin.plugins)
      }
    })
  }

  resolver.apply.apply(resolver, resolvePlugins)

  return function() {
    return resolver.resolveSync.apply(resolver, arguments)
  }
}
1309816
function overrideWebpack({ plugin, options }, cracoConfig, webpackConfig, context) {
    if (isFunction(plugin.overrideWebpackConfig)) {
        const resultingConfig = plugin.overrideWebpackConfig({
            cracoConfig: cracoConfig,
            webpackConfig: webpackConfig,
            pluginOptions: options,
            context: context
        });

        if (!resultingConfig) {
            throw new Error("craco: Plugin returned an undefined webpack config.");
        }
    }

    log("Overrided webpack config with plugin.");

    return webpackConfig;
}
1205924
function configGen() {
  return {
    input: 'src/index.ts',
    moduleContext: {
      [require.resolve('@tweenjs/tween.js')]: 'window'
    },
    output: {
      file: 'dist/web/buttplug.devtools.js',
      format: 'iife',
      name: "ButtplugDevTools",
      globals: { "buttplug": "Buttplug" }
    },
    plugins: [
      nodeResolve({
        jsnext: true,
        main: true,
        extensions: [ '.ts', '.js', '.json' ],
        browser: true
      }),
      postCss(),
      typescript({ tsconfigOverride: { compilerOptions: { module: "ES2015" } } }),
      json(),
      nodeBuiltins(),
      nodeGlobals(),
      commonjs({
        include: ['../../node_modules/**', './node_modules/**', "../buttplug/dist/main/src/**"],
        namedExports: {
          '../buttplug/dist/main/src/index.js': [ 'ButtplugLogger', 'ButtplugLogLevel', 'TestDeviceSubtypeManager' ],
          '../../node_modules/@tweenjs/tween.js/src/Tween.js': [ 'TWEEN', 'Tween' ]
        }
      }),
      autoExternal({
        dependencies: false,
        peerDependencies: true
      }),
      rollupHtml()
    ]
  };
}