docs: function generateMappingInstructions(tmplIndex, partIndex, translationParts, instructions, elements, expressions, templateRoots, lastChildIndex) {
      var tmplInstructions = [];
      var phVisited = [];
      var openedTagCount = 0;
      var maxIndex = 0;
      var currentElements = elements && elements[tmplIndex] ? elements[tmplIndex] : null;
      var currentExpressions = expressions && expressions[tmplIndex] ? expressions[tmplIndex] : null;
      instructions[tmplIndex] = tmplInstructions;
      for (; partIndex < translationParts.length; partIndex++) {
          // The value can either be text or the name of a placeholder (element/template root/expression)
          var value = translationParts[partIndex];
          // Odd indexes are placeholders
          if (partIndex & 1) {
              var phIndex = void 0;
              if (currentElements && currentElements[value] !== undefined) {
                  phIndex = currentElements[value];
                  // The placeholder represents a DOM element, add an instruction to move it
                  var templateRootIndex = templateRoots ? templateRoots.indexOf(value) : -1;
                  if (templateRootIndex !== -1 && (templateRootIndex + 1) !== tmplIndex) {
                      // This is a template root, it has no closing tag, not treating it as an element
                      tmplInstructions.push(phIndex | -2147483648 /* TemplateRoot */);
                  }
                  else {
                      tmplInstructions.push(phIndex | 1073741824 /* Element */);
                      openedTagCount++;
                  }
                  phVisited.push(value);
              }
              else if (currentExpressions && currentExpressions[value] !== undefined) {
                  phIndex = currentExpressions[value];
                  // The placeholder represents an expression, add an instruction to move it
                  tmplInstructions.push(phIndex | 1610612736 /* Expression */);
                  phVisited.push(value);
              }
              else {
                  // It is a closing tag
                  tmplInstructions.push(-1073741824 /* CloseNode */);
                  if (tmplIndex > 0) {
                      openedTagCount--;
                      // If we have reached the closing tag for this template, exit the loop
                      if (openedTagCount === 0) {
                          break;
                      }
                  }
              }
              if (phIndex !== undefined && phIndex > maxIndex) {
                  maxIndex = phIndex;
              }
              if (templateRoots) {
                  var newTmplIndex = templateRoots.indexOf(value) + 1;
                  if (newTmplIndex !== 0 && newTmplIndex !== tmplIndex) {
                      partIndex = generateMappingInstructions(newTmplIndex, partIndex, translationParts, instructions, elements, expressions, templateRoots, lastChildIndex);
                  }
              }
          }
          else if (value) {
              // It's a non-empty string, create a text node
              tmplInstructions.push(536870912 /* Text */, value);
          }
      }
      // Add instructions to remove elements that are not used in the translation
      if (elements) {
          var tmplElements = elements[tmplIndex];
          if (tmplElements) {
              var phKeys = Object.keys(tmplElements);
              for (var i = 0; i < phKeys.length; i++) {
                  var ph = phKeys[i];
                  if (phVisited.indexOf(ph) === -1) {
                      var index = tmplElements[ph];
                      // Add an instruction to remove the element
                      tmplInstructions.push(index | -536870912 /* RemoveNode */);
                      if (index > maxIndex) {
                          maxIndex = index;
                      }
                  }
              }
          }
      }
      // Add instructions to remove expressions that are not used in the translation
      if (expressions) {
          var tmplExpressions = expressions[tmplIndex];
          if (tmplExpressions) {
              var phKeys = Object.keys(tmplExpressions);
              for (var i = 0; i < phKeys.length; i++) {
                  var ph = phKeys[i];
                  if (phVisited.indexOf(ph) === -1) {
                      var index = tmplExpressions[ph];
                      if (ngDevMode) {
                          assertLessThan(index.toString(2).length, 28, "Index " + index + " is too big and will overflow");
                      }
                      // Add an instruction to remove the expression
                      tmplInstructions.push(index | -536870912 /* RemoveNode */);
                      if (index > maxIndex) {
                          maxIndex = index;
                      }
                  }
              }
          }
      }
      if (tmplIndex === 0 && typeof lastChildIndex === 'number') {
          // The current parent is an ng-container and it has more children after the translation that we
          // need to append to keep the order of the DOM nodes correct
          for (var i = maxIndex + 1; i <= lastChildIndex; i++) {
              if (ngDevMode) {
                  assertLessThan(i.toString(2).length, 28, "Index " + i + " is too big and will overflow");
              }
              tmplInstructions.push(i | -1610612736 /* Any */);
          }
      }
      return partIndex;
  }