/*!#if ($TemplateOptions.KTypeGeneric) !
17578
public <T> T [] toArray(Class<T> componentClass) {
    final int size = size();
    final T[] array = (T[]) java.lang.reflect.Array.newInstance(componentClass, size);
    int i = 0;
    for (KTypeCursor<KType> c : this) {
      array[i++] = (T) c.value;
    }
    return array;
  }
810640
function isType(type, val) {
  if (Struct.typeChecker[type]) {
    return Struct.typeChecker[type](val);
  }
  return false;
}
998628
public function replaceTemplateTypesWithStandins(
        array &$template_types,
        array &$generic_params,
        Codebase $codebase = null,
        Atomic $input_type = null,
        bool $replace = true,
        bool $add_upper_bound = false,
        int $depth = 0
    ) {
        if ($this->params) {
            foreach ($this->params as $offset => $param) {
                $input_param_type = null;

                if (($input_type instanceof Atomic\Fn || $input_type instanceof Atomic\TCallable)
                    && isset($input_type->params[$offset])
                ) {
                    $input_param_type = $input_type->params[$offset]->type;
                }

                if (!$param->type) {
                    continue;
                }

                $param->type->replaceTemplateTypesWithStandins(
                    $template_types,
                    $generic_params,
                    $codebase,
                    $input_param_type,
                    $replace,
                    !$add_upper_bound,
                    $depth
                );
            }
        }

        if (($input_type instanceof Atomic\TCallable || $input_type instanceof Atomic\Fn)
            && $this->return_type
            && $input_type->return_type
        ) {
            $this->return_type->replaceTemplateTypesWithStandins(
                $template_types,
                $generic_params,
                $codebase,
                $input_type->return_type,
                $replace,
                $add_upper_bound
            );
        }
    }
469818
static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
    {
        $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->ext->_inheritance->init(\$_smarty_tpl, " .
            var_export($initChildSequence, true) . ");\n?>\n";
    }
11960
private void checkStrictParamType(
      final TemplateNode node, final TemplateParam param, @Nullable SoyValueProvider paramValue) {
    Kind kind = param.type().getKind();
    if (kind == Kind.ANY || kind == Kind.UNKNOWN) {
      // Nothing to check.  ANY and UKNOWN match all types.
      return;
    }
    if (paramValue == null) {
      paramValue = NullData.INSTANCE;
    } else if (paramValue instanceof SoyAbstractCachingValueProvider) {
      SoyAbstractCachingValueProvider typedValue = (SoyAbstractCachingValueProvider) paramValue;
      if (!typedValue.isComputed()) {
        // in order to preserve laziness we tell the value provider to assert the type when
        // computation is triggered
        typedValue.addValueAssertion(
            new ValueAssertion() {
              @Override
              public void check(SoyValue value) {
                checkValueType(param, value, node);
              }
            });
        return;
      }
    } else if (param.hasDefault() && paramValue.resolve() instanceof UndefinedData) {
      // Default parameters are undefined if they're unset.
      return;
    }
    checkValueType(param, paramValue.resolve(), node);
  }
164979
function validateDomainType() {
			if (!parent._domainType.hasOwnProperty(options.domain) || options.domain === "min" || options.domain.substring(0, 2) === "x_") {
				throw new Error("The domain '" + options.domain + "' is not valid");
			}

			if (!parent._domainType.hasOwnProperty(options.subDomain) || options.subDomain === "year") {
				throw new Error("The subDomain '" + options.subDomain + "' is not valid");
			}

			if (parent._domainType[options.domain].level <= parent._domainType[options.subDomain].level) {
				throw new Error("'" + options.subDomain + "' is not a valid subDomain to '" + options.domain +  "'");
			}

			return true;
		}
361252
function onParsingComplete ()
  {
    // Validate defaultParam's value.
    $def = isset($this->props->defaultParam) ? $this->props->defaultParam : null;
    if (!empty($def)) {
      if (!$this->props->defines ($def))
        throw new ComponentException($this,
          "Invalid value for <kbd>defaultParam</kbd> on <b>&lt;{$this->getTagName()}></b>; parameter <kbd>$def</kbd> does not exist");

      // Move children to default parameter.
      if ($this->hasChildren ()) {
        $type = $this->props->getTypeOf ($def);
        if ($type != type::content && $type != type::metadata)
          throw new ComponentException($this, sprintf (
            "The macro's default parameter <kbd>$def</kbd> can't hold content because its type is <kbd>%s</kbd>.",
            type::getNameOf ($type)));

        $param = new Metadata($this->context, ucfirst ($def), $type);
        $this->props->set ($def, $param);
        $param->attachTo ($this);
        $param->setChildren ($this->getChildren ());
      }
    }
    elseif ($this->hasChildren ())
      throw new ComponentException ($this,
        'You may not specify content for this tag because it has no default property');
  }
439482
function(x){
      if(!x || x.type !== type){
        return false;
      }
      if(value){
        return x.src === value;
      }
      return true;
    }
213246
function isType(type, input) {
	if (input === null) {
		return type.toLowerCase() === 'null';
	}

	return typeof input === type.toLowerCase() || Type.is(type, input);
}
617266
function hasTextMimetype(types) {
      if (!types) return true;
      for (var i = 0; i < types.length; i++) {
        if (types[i] === 'Text' || types[i] === 'text/plain') return true;
      }
      return false;
    }
405657
function checkCyclicPrototype(key) {
	var slow = key;
	var fast = key;
	while (true) {
		fast = getPrototype(fast)
		if (!fast)
			return false;
		fast = getPrototype(fast)
		if (!fast)
			return false;
		slow = getPrototype(slow)
		if (slow === fast)
			return true;
	}
}
408412
function checkValue(typeVarMap, index, k, x) {
        var propPath = [k];
        var t = expType.types[k];
        return (
          t.type === VARIABLE ?
            Z.chain (
              function(typeVarMap) {
                return isEmpty (typeVarMap[t.name].types) ?
                  Left (function() {
                    return typeVarConstraintViolation (
                      env,
                      typeInfo,
                      index,
                      propPath,
                      typeVarMap[t.name].valuesByPath
                    );
                  }) :
                  Right (typeVarMap);
              },
              Right (updateTypeVarMap (env,
                                       typeVarMap,
                                       t,
                                       index,
                                       propPath,
                                       [x]))
            ) :
          // else
            Z.map (
              function(r) { return r.typeVarMap; },
              satisfactoryTypes (env,
                                 typeInfo,
                                 typeVarMap,
                                 t,
                                 index,
                                 propPath,
                                 [x])
            )
        );
      }
94938
private void renderTemplate(TemplateNode template, Predicate<String> paramsToTypeCheck) {
    env = Environment.create(template, data, ijData);
    checkStrictParamTypes(template, paramsToTypeCheck);
    visitChildren(template);
    env = null; // unpin for gc
  }
1240562
function Templater(options) {
  if (options == null) {
    options = { allowEval: true };
  }
  this.options = options;
  if (options.stack && Array.isArray(options.stack)) {
    this.stack = options.stack;
  }
  else if (typeof options.stack === 'string') {
    this.stack = [ options.stack ];
  }
  else {
    this.stack = [];
  }
  this.nodes = [];
}
1195278
function it_tokenize_templates()
    {
        $this->tokenize(new Cursor("TEXT <{ ... . keyword 'string' \"string\" 3.14 var null true false }> TEXT"))->shouldBeLike([
            new Token(Token::TYPE_TEXT, 'TEXT ', 1),
            new Token(Token::TYPE_OPEN_TAG | Token::TYPE_SYMBOL, '<{', 1),
            new Token(Token::TYPE_SYMBOL, '...', 1),
            new Token(Token::TYPE_SYMBOL, '.', 1),
            new Token(Token::TYPE_KEYWORD | Token::TYPE_IDENTIFIER, 'keyword', 1),
            new Token(Token::TYPE_STRING | Token::TYPE_SINGLE_QUOTED, 'string', 1),
            new Token(Token::TYPE_STRING | Token::TYPE_DOUBLE_QUOTED, 'string', 1),
            new Token(Token::TYPE_NUMBER, '3.14', 1),
            new Token(Token::TYPE_IDENTIFIER, 'var', 1),
            new Token(Token::TYPE_CONSTANT, 'null', 1),
            new Token(Token::TYPE_CONSTANT, 'true', 1),
            new Token(Token::TYPE_CONSTANT, 'false', 1),
            new Token(Token::TYPE_CLOSE_TAG | Token::TYPE_SYMBOL, '}>', 1),
            new Token(Token::TYPE_TEXT, ' TEXT', 1),
            new Token(Token::TYPE_EOF, null, 1),
        ]);
    }
451242
function tryConvertType(typeToConvert, value) {
  if (typeToConvert === 'string') {
    return value && value.toString();
  } else if (typeToConvert === 'number') {
    return Number(value);
  } else {
    return value;
  }
}
802825
private void processElseIfCmd(String parms, int cmdTPosBegin, int cmdTPosEnd)
            throws MiniTemplator.TemplateSyntaxException {
        excludeTemplateRange(cmdTPosBegin, cmdTPosEnd);
        if (condLevel < 0) {
            throw new MiniTemplator.TemplateSyntaxException("$elseIf without matching $if.");
        }
        boolean enabled = isCondEnabled(condLevel - 1) && !condPassed[condLevel] && evaluateConditionFlags(parms);
        condEnabled[condLevel] = enabled;
        if (enabled) {
            condPassed[condLevel] = true;
        }
    }