shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$utils$bitmapTextSplit = function(global, require, module, exports) {
  var Container = require("module$node_modules$pixi_DOT_js$lib$scene$container$Container"), CanvasTextMetrics = require("module$node_modules$pixi_DOT_js$lib$scene$text$canvas$CanvasTextMetrics"), BitmapFontManager = require("module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapFontManager"), BitmapText = require("module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapText"), getBitmapTextLayout = require("module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$utils$getBitmapTextLayout");
  "use strict";
  exports.bitmapTextSplit = function(options) {
    const {text, style, chars:existingChars} = options;
    options = BitmapFontManager.BitmapFontManager.getFont(text, style);
    var segments = CanvasTextMetrics.CanvasTextMetrics.graphemeSegmenter(text), layout = getBitmapTextLayout.getBitmapTextLayout(segments, style, options, !0);
    segments = layout.scale;
    const chars = [], words = [], lines = [], lineHeight = style.lineHeight ? style.lineHeight : options.lineHeight * segments;
    let yOffset = 0;
    for (const line of layout.lines) {
      if (0 === line.chars.length) {
        continue;
      }
      layout = new Container.Container({label:"line"});
      layout.y = yOffset;
      lines.push(layout);
      let currentWordContainer = new Container.Container({label:"word"}), currentWordStartIndex = 0;
      for (let i = 0; i < line.chars.length; i++) {
        const char = line.chars[i];
        if (!char) {
          continue;
        }
        if (!options.chars[char]) {
          continue;
        }
        const isSpace = " " === char, isLastChar = i === line.chars.length - 1;
        let charInstance;
        0 < existingChars.length ? (charInstance = existingChars.shift(), charInstance.text = char, charInstance.style = style, charInstance.label = `char-${char}`, charInstance.x = line.charPositions[i] * segments - line.charPositions[currentWordStartIndex] * segments) : charInstance = new BitmapText.BitmapText({text:char, style, label:`char-${char}`, x:line.charPositions[i] * segments - line.charPositions[currentWordStartIndex] * segments});
        isSpace || (chars.push(charInstance), currentWordContainer.addChild(charInstance));
        (isSpace || isLastChar) && 0 < currentWordContainer.children.length && (currentWordContainer.x = line.charPositions[currentWordStartIndex] * segments, words.push(currentWordContainer), layout.addChild(currentWordContainer), currentWordContainer = new Container.Container({label:"word"}), currentWordStartIndex = i + 1);
      }
      yOffset += lineHeight;
    }
    return {chars, lines, words};
  };
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$utils$bitmapTextSplit.js.map
