System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, _decorator, Component, Node, resources, macro, dynamicAtlasManager, SpriteFrame, Sprite, _dec, _dec2, _class, _class2, _descriptor, _temp, _crd, ccclass, property, Test;

  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }

  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      Node = _cc.Node;
      resources = _cc.resources;
      macro = _cc.macro;
      dynamicAtlasManager = _cc.dynamicAtlasManager;
      SpriteFrame = _cc.SpriteFrame;
      Sprite = _cc.Sprite;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "bf77cF5LZ1F6o1C7CB8H+Ie", "Test", undefined);

      ccclass = _decorator.ccclass;
      property = _decorator.property;

      _export("Test", Test = (_dec = ccclass('Test'), _dec2 = property(Node), _dec(_class = (_class2 = (_temp = /*#__PURE__*/function (_Component) {
        _inheritsLoose(Test, _Component);

        function Test() {
          var _this;

          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }

          _this = _Component.call.apply(_Component, [this].concat(args)) || this;

          _defineProperty(_assertThisInitialized(_this), "skeletonData", null);

          _defineProperty(_assertThisInitialized(_this), "skNode", null);

          _initializerDefineProperty(_assertThisInitialized(_this), "container", _descriptor, _assertThisInitialized(_this));

          _defineProperty(_assertThisInitialized(_this), "timer", 0);

          _defineProperty(_assertThisInitialized(_this), "dstrd", false);

          _defineProperty(_assertThisInitialized(_this), "assets", []);

          _defineProperty(_assertThisInitialized(_this), "index", 0);

          return _this;
        }

        var _proto = Test.prototype;

        _proto.onLoad = function onLoad() {
          macro.CLEANUP_IMAGE_CACHE = true;
          dynamicAtlasManager.enabled = false;
        };

        _proto.start = function start() {// this.onAdd();
        };

        _proto.onAdd = function onAdd(evt, data) {
          var _this2 = this;

          // resources.loadDir('1', (err, assets) => {
          //     assets.forEach((asset, index, arr) => {
          //         asset.addRef();
          //     });
          //     this.assets = assets;
          //     let skJson = JSON.parse(resources.get('1/all_json', TextAsset)!.text);
          //     skJson.skeleton.hash = '1';
          //     let atlas = resources.get('1/all_atlas', TextAsset)!.text;
          //     let imgs: ImageAsset[] = [
          //         resources.get('1/Cboy_atk', ImageAsset)!,
          //         resources.get('1/texiao', ImageAsset)!,
          //         resources.get('1/2700_0_acc', ImageAsset)!,
          //         resources.get('1/biaoqing_0_acc', ImageAsset)!,
          //         resources.get('1/tou_0_acc', ImageAsset)!,
          //         resources.get('1/2600_0_acc', ImageAsset)!
          //     ];
          //     let textureNames = [
          //         "Cboy_atk.png",
          //         "texiao.png",
          //         "2700_0_acc.png",
          //         "biaoqing_0_acc.png",
          //         "tou_0_acc.png",
          //         "2600_0_acc.png"
          //     ];
          //     this.skeletonData = new sp.SkeletonData();
          //     this.skeletonData.skeletonJson = skJson;
          //     this.skeletonData.atlasText = atlas;
          //     this.skeletonData.textures = imgs;
          //     this.skeletonData.textureNames = textureNames;
          //     let node = new Node();
          //     node.setScale(0.35, 0.35);
          //     this.node.addChild(node);
          //     let skeleton = node.addComponent(sp.Skeleton);
          //     skeleton.premultipliedAlpha = false;
          //     skeleton.skeletonData = this.skeletonData;
          //     skeleton.setSkin('2700');
          //     skeleton.setAnimation(0, 'stand_F', true);
          //     this.skNode = node;
          // });
          // let img = this.index++ % 2 == 0 ? 'test111' : 'tongyong';
          resources.load("2/test111/spriteFrame", SpriteFrame, function (err, sf) {
            _this2.assets.push(sf);

            sf.addRef();

            for (var i = 0; i < 5; ++i) {
              var node = new Node();
              var sprite = node.addComponent(Sprite);
              sprite.spriteFrame = sf;

              _this2.container.addChild(node);
            }
          });
          resources.load("2/tongyong/spriteFrame", SpriteFrame, function (err, sf) {
            _this2.assets.push(sf);

            sf.addRef();

            for (var i = 0; i < 5; ++i) {
              var node = new Node();
              var sprite = node.addComponent(Sprite);
              sprite.spriteFrame = sf;

              _this2.container.addChild(node);
            }
          });
        };

        _proto.onRelease = function onRelease(evt, data) {
          var _this$assets;

          // this.skNode?.removeFromParent();
          // if (this.skeletonData) {
          //     this.skeletonData.destroy();
          //     this.skeletonData = null;
          // }
          this.container.destroyAllChildren();
          (_this$assets = this.assets) === null || _this$assets === void 0 ? void 0 : _this$assets.forEach(function (asset, index, arr) {
            asset.decRef();
          });
          this.assets = []; // assetManager.releaseAll();
        };

        _proto.update = function update(dt) {
          this.timer += dt;

          if (this.timer >= 1) {
            this.timer = 0;

            if (!this.dstrd) {
              this.dstrd = true;
              this.onAdd();
            } else {
              this.dstrd = false;
              this.onRelease();
            }
          }
        };

        return Test;
      }(Component), _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "container", [_dec2], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function initializer() {
          return null;
        }
      })), _class2)) || _class));
      /**
       * [1] Class member could be defined like this.
       * [2] Use `property` decorator if your want the member to be serializable.
       * [3] Your initialization goes here.
       * [4] Your update function goes here.
       *
       * Learn more about scripting: https://docs.cocos.com/creator/3.0/manual/en/scripting/
       * Learn more about CCClass: https://docs.cocos.com/creator/3.0/manual/en/scripting/ccclass.html
       * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.0/manual/en/scripting/life-cycle-callbacks.html
       */


      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=Test.js.map