text: var decompile = require('../script').decompile;
  var multisig = require('./multisig');
  var nullData = require('./nulldata');
  var pubKey = require('./pubkey');
  var pubKeyHash = require('./pubkeyhash');
  var scriptHash = require('./scripthash');
  var witnessPubKeyHash = require('./witnesspubkeyhash');
  var witnessScriptHash = require('./witnessscripthash');
  var witnessCommitment = require('./witnesscommitment');
  var types = {
      MULTISIG: 'multisig',
      NONSTANDARD: 'nonstandard',
      NULLDATA: 'nulldata',
      P2PK: 'pubkey',
      P2PKH: 'pubkeyhash',
      P2SH: 'scripthash',
      P2WPKH: 'witnesspubkeyhash',
      P2WSH: 'witnessscripthash',
      WITNESS_COMMITMENT: 'witnesscommitment'
  };
  function classifyOutput(script) {
      if (witnessPubKeyHash.output.check(script))
          return types.P2WPKH;
      if (witnessScriptHash.output.check(script))
          return types.P2WSH;
      if (pubKeyHash.output.check(script))
          return types.P2PKH;
      if (scriptHash.output.check(script))
          return types.P2SH;
      // XXX: optimization, below functions .decompile before use
      var chunks = decompile(script);
      if (multisig.output.check(chunks))
          return types.MULTISIG;
      if (pubKey.output.check(chunks))
          return types.P2PK;
      if (witnessCommitment.output.check(chunks))
          return types.WITNESS_COMMITMENT;
      if (nullData.output.check(chunks))
          return types.NULLDATA;
      return types.NONSTANDARD;
  }
  function classifyInput(script, allowIncomplete) {
      // XXX: optimization, below functions .decompile before use
      var chunks = decompile(script);
      if (pubKeyHash.input.check(chunks))
          return types.P2PKH;
      if (scriptHash.input.check(chunks, allowIncomplete))
          return types.P2SH;
      if (multisig.input.check(chunks, allowIncomplete))
          return types.MULTISIG;
      if (pubKey.input.check(chunks))
          return types.P2PK;
      return types.NONSTANDARD;
  }
  function classifyWitness(script, allowIncomplete) {
      // XXX: optimization, below functions .decompile before use
      var chunks = decompile(script);
      if (witnessPubKeyHash.input.check(chunks))
          return types.P2WPKH;
      if (witnessScriptHash.input.check(chunks, allowIncomplete))
          return types.P2WSH;
      return types.NONSTANDARD;
  }
  module.exports = {
      classifyInput: classifyInput,
      classifyOutput: classifyOutput,
      classifyWitness: classifyWitness,
      multisig: multisig,
      nullData: nullData,
      pubKey: pubKey,
      pubKeyHash: pubKeyHash,
      scriptHash: scriptHash,
      witnessPubKeyHash: witnessPubKeyHash,
      witnessScriptHash: witnessScriptHash,
      witnessCommitment: witnessCommitment,
      types: types
  };
  