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

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, _cc, _dec, _class, _crd, cc, ccclass, property, FriendItem;

  return {
    setters: [function (_cc2) {
      _cclegacy = _cc2.cclegacy;
      __checkObsolete__ = _cc2.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc2.__checkObsoleteInNamespace__;
      _decorator = _cc2._decorator;
      _cc = _cc2;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "85e3b6z/2VDzLyHqC08Oqs2", "FriendItem", undefined);

      __checkObsolete__(['_decorator']);

      cc = __checkObsoleteInNamespace__(_cc);
      ({
        ccclass,
        property
      } = _decorator);

      _export("FriendItem", FriendItem = (_dec = ccclass('FriendItem'), _dec(_class = class FriendItem extends cc.Component {
        constructor() {
          super(...arguments);
          this.moreBtn = void 0;
          this.sIcon = void 0;
          this.moreCon = void 0;
          this.moreCon2 = void 0;
          this.moreCloseBtn = void 0;
        }

        onLoad() {
          this.partAdded(this.node);
          this.addBtnEvent(this.moreCloseBtn, () => {
            var w = this.moreCon.node.getComponent(cc.UITransform).contentSize.width;
            var wid = this.moreCon.node.getComponent(cc.Widget);
            this.moreCon.node.active = false;
            return;
            cc.tween(wid).to(0.1, {
              right: -w
            }).call(() => {//this.moreCon.node.active = false;
            }).start();
          });
          this.addBtnEvent(this.sIcon, () => {
            console.log("sIcon"); //拜访
          });
          this.addBtnEvent(this.moreBtn, this.showMore);
        }

        partAdded(node) {
          var instance;
          node.children.map(item => {
            var name = item.name;
            if (!name) return; // console.warn(item.name, item);

            instance = false;

            if (!instance) {
              this.partAdded(item); //带空格、带-号 的name不赋值

              if (name.indexOf(" ") > -1 || name.indexOf("-") > -1) return;
              instance = item.getComponent(cc.Label) || item.getComponent(cc.RichText) || item.getComponent(cc.Toggle) || item.getComponent(cc.Button) || item.getComponent(cc.EditBox) || item.getComponent(cc.Graphics) || item.getComponent(cc.Sprite); //顺序不能变
            }

            this[name] = instance || item;
          });
        }

        addBtnEvent(btnObj, fun, thisObject, noPlaySound, btnEffect) {
          if (btnEffect === void 0) {
            btnEffect = 0;
          }

          var btn = btnObj instanceof cc.Component ? btnObj.node : btnObj;
          if (!btn) return;
          thisObject = thisObject || this;
          btn.on(cc.Node.EventType.TOUCH_END, fun, thisObject);
        }

        dataChanged() {
          /*
          super.dataChanged();
          var type = this.data.type;
          this.moreCon2.removeAllChildren();
          let mArr = [];
            this.chatBtn.active = type == 1;
          this.lvBg.node.setPosition(cc.v3(105, 0, 1))
          this.lvBg2.node.active = true;
          this.nameTxt.node.setPosition(cc.v3(143, 0, 1))
          this.loginTxt.string = ""
          this.nameTxt.color.fromHEX(0x4C5155);
          this.lvTxt.color.fromHEX(0x1D5445);
          this.addIcon.node.active = this.followBtn.node.active = this.refollowBtn.node.active = false;
            var vo: FriendVO = this.data.vo;
          this.mc.source = vo.avatar
          this.nameTxt.string = vo.nick
          this.lvTxt.string = "Lv." + vo.level;
          if (type == 1)//好友
          {
              this.fIcon.node.active = this.sIcon.node.active = this.moreCon.node.active = false;
              mArr = [1, 2, 3]
                if (Math.abs(DateUtil.getDayDes(vo.lastlogintime)) > 60) {
                  this.loginTxt.string = "长时间没登录"
                    this.lvBg.node.setPosition(cc.v3(105, 8, 1))
                  this.nameTxt.node.setPosition(cc.v3(143, 8, 1))
              }
          }
          else if (type == 2)//我关注的人
          {
              this.moreCon.node.active = false;
                let isFriend = vo.stat == 1
              this.chatBtn.active = this.fIcon.node.active = isFriend;
              this.sIcon.node.active = !isFriend && vo.follow == 1;
                if (isFriend) {
                  this.lvBg2.node.active = false;
                  this.lvTxt.color.fromHEX(0x638a2b)
                  this.nameTxt.color.fromHEX(0x6c9b3d)
              }
                mArr = [1, 2, 3];
              let log = this.data.log;
              // &&  非好友且互关
              if (!isFriend && vo.follow == 1 && log) {
                  mArr.unshift(0)
                    if (log.isTop) {
                      this.addIcon.node.active = true;
                        var t = TM.now() - vo.followtime
                      if (t < 5 * 60)
                          this.loginTxt.string = Lang.g("刚刚与你互相关注")
                      else
                          this.loginTxt.string = Lang.g("$1前与你互相关注", DateUtil.getStringBySeconds(t, true))
                      this.loginTxt.color.fromHEX(0xdd6d45)
                        this.lvBg.node.setPosition(cc.v3(105, 8, 1))
                      this.nameTxt.node.setPosition(cc.v3(143, 8, 1))
                  }
              }
                // if (Math.abs(DateUtil.getDayDes(vo.lastlogintime)) > 60) {
              //     this.loginTxt.string = "长时间没登录"
              //     this.lvBg.node.setPosition(cc.v3(105, 8))
              //     this.nameTxt.node.setPosition(cc.v3(143, 8))
              // }
          }
          else if (type == 3)//粉丝
          {
              this.lvBg2.node.active = true;
              this.moreCon.node.active = false;
              let isFriend = vo.stat == 1
              this.chatBtn.active = this.fIcon.node.active = isFriend;
              this.sIcon.node.active = !isFriend && vo.follow == 1;
                if (isFriend) {
                  this.lvBg2.node.active = false;
                  this.lvTxt.color.fromHEX(0x638a2b)
                  this.nameTxt.color.fromHEX(0x6c9b3d)
              }
              else if (!vo.follow)
                  this.refollowBtn.node.active = true;
                mArr = [1, 2, 3]
                if (Math.abs(DateUtil.getDayDes(vo.lastlogintime)) > 60) {
                  this.loginTxt.string = "长时间没登录"
                    this.lvBg.node.setPosition(cc.v3(105, 8, 1))
                  this.nameTxt.node.setPosition(cc.v3(143, 8, 1))
              }
          }
          */
          var mArr = [1, 2, 3];
          this.moreCon.node.active = false; // let btns = [this.addBtn.node, this.visitBtn.node, this.giftBtn.node, this.inviteBtn.node]
          // for (var i = 0; i < mArr.length; i++) {
          //     egretUtil.addChild(btns[mArr[i]], this.moreCon2);
          // }

          this.moreCon.node.getComponent(cc.UITransform).setContentSize(new cc.Size(59 + mArr.length * 44 + (mArr.length - 1) * 20, 89));
        }

        showMore() {
          // this.addIcon.node.active = false;
          this.moreCon.node.active = true;
          var w = this.moreCon.node.getComponent(cc.UITransform).contentSize.width;
          var wid = this.moreCon.node.getComponent(cc.Widget);
          return;
          wid.right = -w;
          this.fan_item_more_close.node.setScale(-1, 1, 1);
          cc.tween(wid).to(0.2, {
            right: 0
          }).call(() => {
            this.fan_item_more_close.node.setScale(1, 1, 1);
          }).start();
        }

      }) || _class));

      _cclegacy._RF.pop();

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