/ provides the async helper functionality
160184
function Waiter() {
    if (!(this instanceof Waiter)) {
        return new Waiter();
    }

    var self = this;

    // found values
    self.values = {};

    // callback when done
    self.callback = null;

    self.resolved = false;

    self.count = 0;
}
194065
function async(f, args) {
    return new Promise(
      function(resolve, reject) {
        try {
          var r = f.apply(undefined, args);
          resolve(r);
        } catch(e) {
          reject(e);
        }
      }
    );
  }
938306
async function(program) {
        let filesToParse = [];
        let folderStat = '';
        if(program.in) {
            filesToParse.push(program.in);
        }
        // do we have a folder passed in?
        if(program.lu_folder) {
            try
            {
                folderStat = fs.statSync(program.lu_folder);
            } catch (err) {
                throw(new exception(retCode.errorCode.OUTPUT_FOLDER_INVALID, 'Sorry, ' + program.lu_folder + ' is not a folder or does not exist'));
            }
            if(!folderStat.isDirectory()) {
                throw(new exception(retCode.errorCode.OUTPUT_FOLDER_INVALID, 'Sorry, ' + program.lu_folder + ' is not a folder or does not exist'));
            }
            if(program.subfolder) {
                filesToParse = helpers.findLUFiles(program.lu_folder, true); 
            } else {
                filesToParse = helpers.findLUFiles(program.lu_folder, false); 
            }
            if(filesToParse.length === 0) {
                throw(new exception(retCode.errorCode.NO_LU_FILES_FOUND, 'Sorry, no .lu files found in the specified folder.'));
            }
        }
        // is there an output folder?
        let outFolder = process.cwd();
        if(program.out_folder) {
            if(path.isAbsolute(program.out_folder)) {
                outFolder = program.out_folder;
            } else {
                outFolder = path.resolve('', program.out_folder);
            }
            if(!fs.existsSync(outFolder)) {
                throw(new exception(retCode.errorCode.OUTPUT_FOLDER_INVALID, 'Output folder ' + outFolder + ' does not exist'));
            }
        }
        while(filesToParse.length > 0) {
            let file = filesToParse[0];
            try {
                await parseFile(file, outFolder, program.translate_key, program.to_lang, program.src_lang, program.translate_comments, program.translate_link_text, program.verbose, program.batch_translate);
            } catch (err) {
                throw(err);
            }
            filesToParse.splice(0,1);
         }
    }
326633
async function run() {
  console.log(`\u{1f52c}  Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
  const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
  const typings = files.map(file => createIconTyping(file));
  await Promise.all([...typings, createIndexTyping(files)]);
  console.log(`\u{1F5C4}  Written typings to ${chalk.dim(TARGET_DIR)}.`);
}
365751
function(asyncFunc, callback) {
  asyncFunc(function(err, buffer) {
    if(callback) {
      callback(err, buffer.toHex().toString());
    }
  });
}
752494
async function () {
    const oThis = this
    ;

    // validations
    if (!basicHelper.isUuidValid(oThis.uuid)) {
      let errObj = responseHelper.error({
        internal_error_identifier: 's_u_gbtd_1',
        api_error_identifier: 'invalid_branded_token_uuid',
        error_config: basicHelper.fetchErrorConfig()
      });
      return Promise.resolve(errObj);
    }

    var tokenDetails = await openSTValue.utilityTokens(oThis.uuid);

    return tokenDetails;
  }
941098
function onComplete (err) {
    if (err) {
      console.log('interpolation encountered an error: ', err)
      return callback(err)
    }
    // set is complete and create a queue drain function
    // however, a feed may not have any interpolated times, so
    // `isComplete` is set in case nothing is pushed to the queue
    isComplete = true
    updateQueue.drain = () => {
      console.log('interpolation completed successfully')
      callback(err)
    }
  }
82169
async function main() {
  let state = {};
  const setState = stateUpdates => {
    state = { ...state, ...stateUpdates };
  };
  addEventListener("fetch", event => {
    console.debug("webworker fetch event", event);
    try {
      event.respondWith(handleRequest(event.request));
    } catch (error) {
      return new Response(
        "Something didn’t quite work. Error message: " + error.message,
        {
          status: 500
        }
      );
    }
  });
  addEventListener("install", onInstall);
  addEventListener("message", onMessage);

  async function handleRequest(request) {
    console.log("in handleRequest");
    const url = new URL(request.url);
    let testPubcontrolError;
    let testPubControlResult;
    try {
      testPubControlResult = url.searchParams.get("testPubControl")
        ? await testPubcontrol({
            uri: url.searchParams.get("epcp.uri"),
            defaultChannel: url.searchParams.get("epcp.defaultChannel")
          })
        : {
            message:
              "No ?testPubControl, so I didn't run anything related to epcp"
          };
    } catch (error) {
      testPubcontrolError = error;
    }

    let formattedTestPubControlResult;
    try {
      formattedTestPubControlResult = JSON.stringify(testPubControlResult);
    } catch (error) {
      formattedTestPubControlResult = `ERROR WITH IT!! ${error.message} ${
        error.stack
      }`;
    }
    let formattedTestPubControlError;
    try {
      formattedTestPubControlError =
        testPubcontrolError &&
        String(
          testPubcontrolError.message ||
            ".message was falsy so we used this text"
        );
    } catch (error) {
      formattedTestPubControlError =
        "Error getting this error.message as string";
    }
    const body = `
      <h1>npm pubcontrol browser-demo: webworker</h1>
      <p>It works!</p>
      <p>
      cpcp.url: ${url.searchParams.get("epcp.uri")}
      </p>
      <p>formattedTestPubControlResult ${formattedTestPubControlResult}</p>
      <p>formattedTestPubControlError ${formattedTestPubControlError}</p>
    `.trim();

    return new Response(body, {
      headers: { "Content-Type": "text/html" }
    });
  }

  async function onInstall(event) {
    consoe.debug("webworker onInstall", event);
  }

  async function onMessage(event) {
    console.debug("Message received from main script", event.data.type, event);
    switch (event.data.type) {
      case "Hello":
        postMessage({
          type: "HelloResponse",
          content: `And hello to you, ${event.data.from}`
        });
        break;
      case "EPCPConfiguration":
        setState({
          epcp: event.data
        });
        await testPubcontrol(event.data);
        break;
      default:
        console.debug(
          "Encountered unexpected event type",
          event.data.type,
          event
        );
    }
  }
}
721957
function async(makeGenerator, callback) {
  return function() {
    const generator = makeGenerator.apply(this, arguments);
    const handle = getHandle(generator, callback);
    try {
      return handle(generator.next());
    } catch(err) {
      return Promise.reject(err);
    }
  };
}
72601
async function runExample() {
	try {

		// Test http://example.com/
		const result = await pa11y('http://example.com/', {

			// Run some actions before the tests
			actions: [
				'set field #username to exampleUser',
				'set field #password to password1234',
				'click element #submit',
				'wait for url to be http://example.com/myaccount'
			],

			// Log what's happening to the console
			log: {
				debug: console.log,
				error: console.error,
				info: console.log
			}

		});

		// Output the raw result object
		console.log(result);

	} catch (error) {

		// Output an error if it occurred
		console.error(error.message);

	}
}
1334659
function(helpers, options) {
      if (typeof helpers === 'object') {
        this.visit('helper', helpers);
        return this;
      }

      if (lazy.isGlob(helpers)) {
        this.loader('helpers-glob', ['base-glob'], function (files) {
          return files.map(function (fp) {
            return require(path.resolve(fp));
          });
        });

        var res = this.compose('helpers-glob')(helpers, options);
        this.visit('helper', res);
        return this;
      }

      if (typeof helpers === 'string') {
        console.log('loading helpers from a string is not implemented yet.');
      }
      return this;
    }
765448
function asyncMap(array, iterator, done) {
  if (!array || !array.length) {
    return done(null, [])
  }

  var error
    , out = []
    , todo = array.length

  array.forEach(exec)

  function exec(item) {
    process.nextTick(function tick() {
      iterator(item, add)
    })
  }

  function add(err, data) {
    if (error) {
      return
    }
    else if (err) {
      error = true
      return done(err)
    }

    out.push(data)

    if (--todo === 0) {
      done(null, out)
    }
  }
}
926172
function asyncCall(method, params) {
    if (!Array.isArray(params))
        params = [params]; // cast to array for apply
    log_1.logger.info(`[${method}] Calling (async): ${JSON.stringify(params)}`);
    return Promise.resolve(exports.asteroid.apply(method, params).result)
        .catch((err) => {
        log_1.logger.error(`[${method}] Error:`, err);
        throw err; // throw after log to stop async chain
    })
        .then((result) => {
        (result)
            ? log_1.logger.debug(`[${method}] Success: ${JSON.stringify(result)}`)
            : log_1.logger.debug(`[${method}] Success`);
        return result;
    });
}
1284829
function wrapAsyncMethod(fn, ctx) {
    return function() {
        // Obtain function arguments
        var args = [].slice.call(arguments);

        // Return a thunkified function that receives a done callback
        return new Promise(function(resolve, reject) {
            // Add a custom callback to provided args
            args.push(function(err, result) {
                // Failed?
                if (err) {
                    return reject(err);
                }

                // Success
                resolve(result);
            });

            // Call original function
            fn.apply(ctx, args);
        });
    };
}
784826
async function () {
    const oThis = this
    ;

    try {
      //validations
      if (!basicHelper.isBTNameValid(oThis.name)) {
        let errObj = responseHelper.error({
          internal_error_identifier: 's_ob_pbt_1',
          api_error_identifier: 'invalid_branded_token_name',
          error_config: basicHelper.fetchErrorConfig()
        });

        return Promise.resolve(errObj);
      }
      if (!basicHelper.isBTSymbolValid(oThis.symbol)) {
        let errObj = responseHelper.error({
          internal_error_identifier: 's_ob_pbt_2',
          api_error_identifier: 'invalid_branded_token_symbol',
          error_config: basicHelper.fetchErrorConfig()
        });

        return Promise.resolve(errObj);
      }
      if (!basicHelper.isBTConversionFactorValid(oThis.conversionFactor)) {
        let errObj = responseHelper.error({
          internal_error_identifier: 's_ob_pbt_3',
          api_error_identifier: 'invalid_conversion_factor',
          error_config: basicHelper.fetchErrorConfig()
        });

        return Promise.resolve(errObj);
      }

      const conversionRateConversionResponse = basicHelper.convertConversionFactorToConversionRate(oThis.conversionFactor);

      if (conversionRateConversionResponse.isSuccess()) {

        oThis.conversionRate = conversionRateConversionResponse.data.conversionRate;
        oThis.conversionRateDecimals = conversionRateConversionResponse.data.conversionRateDecimals;

        const proposalRsp = await openSTUtility.proposeBrandedToken(stakerAddr, stakerPassphrase, oThis.symbol,
          oThis.name, oThis.conversionRate, oThis.conversionRateDecimals);

        if (proposalRsp.isSuccess()) {
          proposalRsp.data.transaction_uuid = uuid.v4();
        }

        return Promise.resolve(proposalRsp);

      } else {
        return Promise.resolve(conversionRateConversionResponse);
      }

    } catch (err) {
      let errObj = responseHelper.error({
        internal_error_identifier: 's_ob_pbt_4',
        api_error_identifier: 'something_went_wrong',
        error_config: basicHelper.fetchErrorConfig()
      });

      return Promise.resolve(errObj);
    }
  }
1118486
async function () {

    const oThis = this
      , statusResponse = {chain: {value: false, utility: false}};

    // check geth status
    for (var chainName in statusResponse.chain) {
      var response = await oThis._gethStatus(chainName);
      if (response.isSuccess()) {
        statusResponse.chain[chainName] = true;
      } else {
        return Promise.resolve(response);
      }
    }

    return Promise.resolve(responseHelper.successWithData(statusResponse));

  }
489051
async function setupServer() {
  return new Promise(async (resolve, reject) => {
    config = config || (await getConfig());
    config.components.individual = [];
    config.prod = true;
    config.enableCache = true;
    config.mode = 'server';
    config.env = 'pwa';
    config.sourceMaps = false;
    config.copy = [];
    config.webpackDevServer = false;
    config.buildDir = path.join(config.wwwDir, 'build-ssr');
    config.dataDir = path.join(config.wwwDir, 'build-ssr', 'data');

    app.use(express.static(path.relative(process.cwd(), config.wwwDir)));

    // generate a fresh webpack build + pass along asset data to dynamic HTML template rendered
    server = await app.listen(port);

    app.get('/ssr', function(req, res) {
      res.send(template(html || '', port, webpackStatsGenerated || []));
    });

    // handle cleaning up + shutting down the server instance
    process.on('SIGTERM', shutDownSSRServer);
    process.on('SIGINT', shutDownSSRServer);

    server.on('connection', connection => {
      connections.push(connection);
      connection.on(
        'close',
        // eslint-disable-next-line no-return-assign
        () => (connections = connections.filter(curr => curr !== connection)),
      );
    });

    resolve();
  });
}