shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$sprite_nine_slice$canvas$CanvasNineSliceSpritePipe = function(global, require, module, exports) {
  global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
  var canvasUtils = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$canvas$utils$canvasUtils"), getGlobalMixin = require("module$node_modules$pixi_DOT_js$lib$scene$container$container_mixins$getGlobalMixin"), multiplyHexColors = require("module$node_modules$pixi_DOT_js$lib$scene$container$utils$multiplyHexColors");
  "use strict";
  class CanvasNineSliceSpritePipe {
    constructor(renderer) {
      this._renderer = renderer;
    }
    validateRenderable(_sprite) {
      return !1;
    }
    addRenderable(sprite, instructionSet) {
      this._renderer.renderPipes.batch.break(instructionSet);
      instructionSet.add(sprite);
    }
    updateRenderable(_sprite) {
    }
    execute(sprite) {
      var renderer = this._renderer, contextSystem = renderer.canvasContext;
      const context = contextSystem.activeContext;
      context.save();
      contextSystem.setContextTransform(sprite.groupTransform, 1 === (renderer._roundPixels | sprite._roundPixels));
      contextSystem.setBlendMode(sprite.groupBlendMode);
      var globalColor = renderer.globalUniforms.globalUniformData?.worldColor ?? 4294967295, groupColorAlpha = sprite.groupColorAlpha;
      renderer = (globalColor >>> 24 & 255) / 255 * ((groupColorAlpha >>> 24 & 255) / 255) * (renderer.filter?.alphaMultiplier ?? 1);
      if (!(0 >= renderer) && (context.globalAlpha = renderer, groupColorAlpha = getGlobalMixin.bgr2rgb(multiplyHexColors.multiplyHexColors(groupColorAlpha & 16777215, globalColor & 16777215)), globalColor = sprite.texture, renderer = canvasUtils.canvasUtils.getCanvasSource(globalColor))) {
        contextSystem = contextSystem.smoothProperty;
        var shouldSmooth = "nearest" !== globalColor.source.style.scaleMode;
        context[contextSystem] !== shouldSmooth && (context[contextSystem] = shouldSmooth);
        groupColorAlpha = (contextSystem = 16777215 !== groupColorAlpha || 0 !== globalColor.rotate) ? canvasUtils.canvasUtils.getTintedCanvas({texture:globalColor}, groupColorAlpha) : renderer;
        var {leftWidth, topHeight, rightWidth, bottomHeight, width, height} = sprite;
        renderer = leftWidth + rightWidth;
        shouldSmooth = topHeight + bottomHeight;
        var scale = Math.min(renderer > width ? width / renderer : 1, shouldSmooth > height ? height / shouldSmooth : 1, 1);
        renderer = leftWidth * scale;
        shouldSmooth = rightWidth * scale;
        var destTopHeight = topHeight * scale;
        scale *= bottomHeight;
        var destCenterWidth = Math.max(0, width - renderer - shouldSmooth), destCenterHeight = Math.max(0, height - destTopHeight - scale), anchor = sprite.anchor, resolution = globalColor.source._resolution ?? globalColor.source.resolution ?? 1;
        sprite = globalColor.frame.x * resolution;
        var sy = globalColor.frame.y * resolution, dx = -anchor.x * width;
        anchor = -anchor.y * height;
        var lw = leftWidth * resolution, tw = topHeight * resolution, rw = rightWidth * resolution, bw = bottomHeight * resolution, sw = globalColor.frame.width * resolution;
        globalColor = globalColor.frame.height * resolution;
        contextSystem && (sy = sprite = 0, sw = groupColorAlpha.width, globalColor = groupColorAlpha.height);
        context.drawImage(groupColorAlpha, sprite, sy, lw, tw, dx, anchor, renderer, destTopHeight);
        context.drawImage(groupColorAlpha, sprite + lw, sy, sw - lw - rw, tw, dx + renderer, anchor, destCenterWidth, destTopHeight);
        context.drawImage(groupColorAlpha, sprite + sw - rw, sy, rw, tw, dx + width - shouldSmooth, anchor, shouldSmooth, destTopHeight);
        context.drawImage(groupColorAlpha, sprite, sy + tw, lw, globalColor - tw - bw, dx, anchor + destTopHeight, renderer, destCenterHeight);
        context.drawImage(groupColorAlpha, sprite + lw, sy + tw, sw - lw - rw, globalColor - tw - bw, dx + renderer, anchor + destTopHeight, destCenterWidth, destCenterHeight);
        context.drawImage(groupColorAlpha, sprite + sw - rw, sy + tw, rw, globalColor - tw - bw, dx + width - shouldSmooth, anchor + destTopHeight, shouldSmooth, destCenterHeight);
        context.drawImage(groupColorAlpha, sprite, sy + globalColor - bw, lw, bw, dx, anchor + height - scale, renderer, scale);
        context.drawImage(groupColorAlpha, sprite + lw, sy + globalColor - bw, sw - lw - rw, bw, dx + renderer, anchor + height - scale, destCenterWidth, scale);
        context.drawImage(groupColorAlpha, sprite + sw - rw, sy + globalColor - bw, rw, bw, dx + width - shouldSmooth, anchor + height - scale, shouldSmooth, scale);
      }
      context.restore();
    }
    destroy() {
      this._renderer = null;
    }
  }
  CanvasNineSliceSpritePipe.extension = {type:[global.ExtensionType.CanvasPipes], name:"nineSliceSprite"};
  exports.CanvasNineSliceSpritePipe = CanvasNineSliceSpritePipe;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$sprite_nine_slice$canvas$CanvasNineSliceSpritePipe.js.map
