diff --git a/README.md b/README.md index 82dd5a0..14e684a 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,13 @@ _(how input delay roughly works)_ _(how rollback-and-chase in this project roughly works)_ ![rollback_and_chase_intro](./charts/RollbackAndChase.jpg) +![floating_point_accumulation_err](./charts/AvoidingFloatingPointAccumulationErr.jpg) _(in game screenshot)_ ![screenshot-1](./charts/screenshot-1.png) -Please checkout [this demo video](https://pan.baidu.com/s/123LlWcT9X-wbcYybqYnvmA?pwd=qrlw) to see whether the source codes are doing what you expect for synchronization. +Please checkout [this demo video](https://pan.baidu.com/s/1YkfuHjNLzlFVnKiEj6wrDQ?pwd=tkr5) to see whether the source codes are doing what you expect for synchronization. The video mainly shows the following features. - The backend receives inputs from frontend peers and [by a GGPO-alike manner](https://github.com/pond3r/ggpo/blob/master/doc/README.md) broadcasts back for synchronization. diff --git a/battle_srv/api/v1/player.go b/battle_srv/api/v1/player.go index 2636826..180f62a 100644 --- a/battle_srv/api/v1/player.go +++ b/battle_srv/api/v1/player.go @@ -1,6 +1,11 @@ package v1 import ( + "battle_srv/api" + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" "bytes" "crypto/sha256" "encoding/hex" @@ -10,11 +15,6 @@ import ( "go.uber.org/zap" "io/ioutil" "net/http" - "server/api" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" "strconv" . "dnmshared" @@ -79,7 +79,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { c.Set(api.RET, Constants.RetCode.UnknownError) return } - // Redis剩余时长校验 if ttl >= ConstVals.Player.CaptchaMaxTTL { Logger.Info("There's an existing SmsCaptcha record in Redis-server: ", zap.String("key", redisKey), zap.Duration("ttl", ttl)) c.Set(api.RET, Constants.RetCode.SmsCaptchaRequestedTooFrequently) @@ -89,7 +88,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { pass := false var succRet int if Conf.General.ServerEnv == SERVER_ENV_TEST { - // 测试环境,优先从数据库校验`player.name`,不通过再走机器人magic name校验 player, err := models.GetPlayerByName(req.Num) if nil == err && nil != player { pass = true @@ -98,7 +96,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { } if !pass { - // 机器人magic name校验,不通过再走手机号校验 player, err := models.GetPlayerByName(req.Num) if nil == err && nil != player { pass = true @@ -111,7 +108,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { succRet = Constants.RetCode.Ok pass = true } - // Hardecoded 只验证国内手机号格式 if req.CountryCode == "86" { if RE_CHINA_PHONE_NUM.MatchString(req.Num) { succRet = Constants.RetCode.Ok @@ -133,7 +129,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { }{Ret: succRet} var captcha string if ttl >= 0 { - // 已有未过期的旧验证码记录,续验证码有效期。 storage.RedisManagerIns.Expire(redisKey, ConstVals.Player.CaptchaExpire) captcha = storage.RedisManagerIns.Get(redisKey).Val() if ttl >= ConstVals.Player.CaptchaExpire/4 { @@ -147,7 +142,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { } Logger.Info("Extended ttl of existing SMSCaptcha record in Redis:", zap.String("key", redisKey), zap.String("captcha", captcha)) } else { - // 校验通过,进行验证码生成处理 captcha = strconv.Itoa(utils.Rand.Number(1000, 9999)) if succRet == Constants.RetCode.Ok { getSmsCaptchaRespErrorCode := sendSMSViaVendor(req.Num, req.CountryCode, captcha) @@ -234,7 +228,6 @@ func (p *playerController) WechatLogin(c *gin.Context) { return } - //baseInfo ResAccessToken 获取用户授权access_token的返回结果 baseInfo, err := utils.WechatIns.GetOauth2Basic(req.Authcode) if err != nil { @@ -250,7 +243,6 @@ func (p *playerController) WechatLogin(c *gin.Context) { c.Set(api.RET, Constants.RetCode.WechatServerError) return } - //fserver不会返回openId userInfo.OpenID = baseInfo.OpenID player, err := p.maybeCreatePlayerWechatAuthBinding(userInfo) @@ -316,7 +308,6 @@ func (p *playerController) WechatGameLogin(c *gin.Context) { return } - //baseInfo ResAccessToken 获取用户授权access_token的返回结果 baseInfo, err := utils.WechatGameIns.GetOauth2Basic(req.Authcode) if err != nil { @@ -337,7 +328,6 @@ func (p *playerController) WechatGameLogin(c *gin.Context) { c.Set(api.RET, Constants.RetCode.WechatServerError) return } - //fserver不会返回openId userInfo.OpenID = baseInfo.OpenID player, err := p.maybeCreatePlayerWechatGameAuthBinding(userInfo) @@ -395,7 +385,6 @@ func (p *playerController) IntAuthTokenLogin(c *gin.Context) { return } - //kobako: 从player获取display name等 player, err := models.GetPlayerById(playerLogin.PlayerID) if err != nil { Logger.Error("Get player by id in IntAuthTokenLogin function error: ", zap.Error(err)) @@ -479,7 +468,6 @@ func (p *playerController) TokenAuth(c *gin.Context) { c.Abort() } -// 以下是内部私有函数 func (p *playerController) maybeCreateNewPlayer(req smsCaptchaReq) (*models.Player, error) { extAuthID := req.extAuthID() if Conf.General.ServerEnv == SERVER_ENV_TEST { @@ -492,7 +480,7 @@ func (p *playerController) maybeCreateNewPlayer(req smsCaptchaReq) (*models.Play Logger.Info("Got a test env player:", zap.Any("phonenum", req.Num), zap.Any("playerId", player.Id)) return player, nil } - } else { //正式环境检查是否为bot用户 + } else { botPlayer, err := models.GetPlayerByName(req.Num) if err != nil { Logger.Error("Seeking bot player error:", zap.Error(err)) @@ -537,19 +525,17 @@ func (p *playerController) maybeCreatePlayerWechatAuthBinding(userInfo utils.Use return nil, err } if player != nil { - { //更新玩家姓名及头像 - updateInfo := models.Player{ - Avatar: userInfo.HeadImgURL, - DisplayName: userInfo.Nickname, - } - tx := storage.MySQLManagerIns.MustBegin() - defer tx.Rollback() - ok, err := models.Update(tx, player.Id, &updateInfo) - if err != nil && ok != true { - return nil, err - } else { - tx.Commit() - } + updateInfo := models.Player{ + Avatar: userInfo.HeadImgURL, + DisplayName: userInfo.Nickname, + } + tx := storage.MySQLManagerIns.MustBegin() + defer tx.Rollback() + ok, err := models.Update(tx, player.Id, &updateInfo) + if err != nil && ok != true { + return nil, err + } else { + tx.Commit() } return player, nil } @@ -575,19 +561,17 @@ func (p *playerController) maybeCreatePlayerWechatGameAuthBinding(userInfo utils return nil, err } if player != nil { - { //更新玩家姓名及头像 - updateInfo := models.Player{ - Avatar: userInfo.HeadImgURL, - DisplayName: userInfo.Nickname, - } - tx := storage.MySQLManagerIns.MustBegin() - defer tx.Rollback() - ok, err := models.Update(tx, player.Id, &updateInfo) - if err != nil && ok != true { - return nil, err - } else { - tx.Commit() - } + updateInfo := models.Player{ + Avatar: userInfo.HeadImgURL, + DisplayName: userInfo.Nickname, + } + tx := storage.MySQLManagerIns.MustBegin() + defer tx.Rollback() + ok, err := models.Update(tx, player.Id, &updateInfo) + if err != nil && ok != true { + return nil, err + } else { + tx.Commit() } return player, nil } @@ -672,15 +656,13 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Nationcode: nationcode, } var captchaExpireMin string - //短信有效期hardcode if Conf.General.ServerEnv == SERVER_ENV_TEST { - //测试环境下有效期为20秒 先hardcode了 - captchaExpireMin = "0.5" + captchaExpireMin = "0.5" // Hardcoded } else { captchaExpireMin = strconv.Itoa(int(ConstVals.Player.CaptchaExpire) / 60000000000) } params := [2]string{captchaCode, captchaExpireMin} - appkey := "41a5142feff0b38ade02ea12deee9741" // TODO: Should read from config file! + appkey := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // TODO: Should read from config file! rand := strconv.Itoa(utils.Rand.Number(1000, 9999)) now := utils.UnixtimeSec() @@ -694,7 +676,7 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Extend: "", Params: ¶ms, Sig: sig, - Sign: "洛克互娱", + Sign: "YYYYYYYYYYYYYYYYY", Tel: tel, Time: now, Tpl_id: 207399, @@ -705,7 +687,7 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Logger.Info("json marshal", zap.Any("err:", err)) return -1 } - resp, err := http.Post("https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=1400150185&random="+rand, + resp, err := http.Post("https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=uuuuuuuuuuuuuuuuuuuuuuuu&random="+rand, "application/json", req) if err != nil { diff --git a/battle_srv/common/utils/wechat.go b/battle_srv/common/utils/wechat.go index fc72524..e8c59b6 100644 --- a/battle_srv/common/utils/wechat.go +++ b/battle_srv/common/utils/wechat.go @@ -1,6 +1,8 @@ package utils import ( + . "battle_srv/common" + . "battle_srv/configs" "bytes" "crypto/sha1" . "dnmshared" @@ -11,8 +13,6 @@ import ( "io/ioutil" "math/rand" "net/http" - . "server/common" - . "server/configs" "sort" "time" ) @@ -250,10 +250,6 @@ func (w *wechat) getTicketFromServer() (ticket resTicket, err error) { return } - //jsAPITicketCacheKey := fmt.Sprintf("jsapi_ticket_%s", w.config.AppID) - //expires := ticket.ExpiresIn - 1500 - //set - //err = js.Cache.Set(jsAPITicketCacheKey, ticket.Ticket, time.Duration(expires)*time.Second) return } @@ -276,9 +272,6 @@ func (w *wechat) getAccessTokenFromServer() (accessToken string, err error) { return } - //accessTokenCacheKey := fmt.Sprintf("access_token_%s", w.config.AppID) - //expires := r.ExpiresIn - 1500 - //set to redis err = ctx.Cache.Set(accessTokenCacheKey, r.AccessToken, time.Duration(expires)*time.Second) accessToken = r.AccessToken return } diff --git a/battle_srv/env_tools/load_pre_conf.go b/battle_srv/env_tools/load_pre_conf.go index f64b0a0..fec7eb7 100644 --- a/battle_srv/env_tools/load_pre_conf.go +++ b/battle_srv/env_tools/load_pre_conf.go @@ -1,15 +1,15 @@ package env_tools import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" . "dnmshared" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" "go.uber.org/zap" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" ) func LoadPreConf() { diff --git a/battle_srv/env_tools/test_env_db.go b/battle_srv/env_tools/test_env_db.go index df1bcaf..152f244 100644 --- a/battle_srv/env_tools/test_env_db.go +++ b/battle_srv/env_tools/test_env_db.go @@ -1,11 +1,11 @@ package env_tools import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" . "dnmshared" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" diff --git a/battle_srv/go.mod b/battle_srv/go.mod index 9bcd700..71dab42 100644 --- a/battle_srv/go.mod +++ b/battle_srv/go.mod @@ -1,4 +1,4 @@ -module server +module battle_srv go 1.19 diff --git a/battle_srv/main.go b/battle_srv/main.go index 81e4348..25653ed 100644 --- a/battle_srv/main.go +++ b/battle_srv/main.go @@ -1,19 +1,19 @@ package main import ( + "battle_srv/api" + "battle_srv/api/v1" + . "battle_srv/common" + "battle_srv/env_tools" + "battle_srv/models" + "battle_srv/storage" + "battle_srv/ws" "context" "fmt" "net/http" "os" "os/signal" "path/filepath" - "server/api" - "server/api/v1" - . "server/common" - "server/env_tools" - "server/models" - "server/storage" - "server/ws" "syscall" "time" diff --git a/battle_srv/models/barrier.go b/battle_srv/models/barrier.go index 7df588e..ec3b062 100644 --- a/battle_srv/models/barrier.go +++ b/battle_srv/models/barrier.go @@ -1,7 +1,7 @@ package models import ( - . "dnmshared" + . "dnmshared/sharedprotos" ) type Barrier struct { diff --git a/battle_srv/models/pb_type_convert.go b/battle_srv/models/pb_type_convert.go index d460097..7686d81 100644 --- a/battle_srv/models/pb_type_convert.go +++ b/battle_srv/models/pb_type_convert.go @@ -1,77 +1,22 @@ package models import ( - . "dnmshared" - pb "server/pb_output" + . "battle_srv/protos" + . "dnmshared/sharedprotos" ) -func toPbVec2D(modelInstance *Vec2D) *pb.Vec2D { - toRet := &pb.Vec2D{ - X: modelInstance.X, - Y: modelInstance.Y, - } - return toRet -} - -func toPbPolygon2D(modelInstance *Polygon2D) *pb.Polygon2D { - toRet := &pb.Polygon2D{ - Anchor: toPbVec2D(modelInstance.Anchor), - Points: make([]*pb.Vec2D, len(modelInstance.Points)), - } - for index, p := range modelInstance.Points { - toRet.Points[index] = toPbVec2D(p) - } - return toRet -} - -func toPbVec2DList(modelInstance *Vec2DList) *pb.Vec2DList { - toRet := &pb.Vec2DList{ - Vec2DList: make([]*pb.Vec2D, len(*modelInstance)), - } - for k, v := range *modelInstance { - toRet.Vec2DList[k] = toPbVec2D(v) - } - return toRet -} - -func ToPbVec2DListMap(modelInstances map[string]*Vec2DList) map[string]*pb.Vec2DList { - toRet := make(map[string]*pb.Vec2DList, len(modelInstances)) - for k, v := range modelInstances { - toRet[k] = toPbVec2DList(v) - } - return toRet -} - -func toPbPolygon2DList(modelInstance *Polygon2DList) *pb.Polygon2DList { - toRet := &pb.Polygon2DList{ - Polygon2DList: make([]*pb.Polygon2D, len(*modelInstance)), - } - for k, v := range *modelInstance { - toRet.Polygon2DList[k] = toPbPolygon2D(v) - } - return toRet -} - -func ToPbPolygon2DListMap(modelInstances map[string]*Polygon2DList) map[string]*pb.Polygon2DList { - toRet := make(map[string]*pb.Polygon2DList, len(modelInstances)) - for k, v := range modelInstances { - toRet[k] = toPbPolygon2DList(v) - } - return toRet -} - -func toPbPlayers(modelInstances map[int32]*Player) map[int32]*pb.Player { - toRet := make(map[int32]*pb.Player, 0) +func toPbPlayers(modelInstances map[int32]*Player) map[int32]*PlayerDownsync { + toRet := make(map[int32]*PlayerDownsync, 0) if nil == modelInstances { return toRet } for k, last := range modelInstances { - toRet[k] = &pb.Player{ - Id: last.Id, - X: last.X, - Y: last.Y, - Dir: &pb.Direction{ + toRet[k] = &PlayerDownsync{ + Id: last.Id, + VirtualGridX: last.VirtualGridX, + VirtualGridY: last.VirtualGridY, + Dir: &Direction{ Dx: last.Dir.Dx, Dy: last.Dir.Dy, }, diff --git a/battle_srv/models/player.go b/battle_srv/models/player.go index f2ce027..92110d7 100644 --- a/battle_srv/models/player.go +++ b/battle_srv/models/player.go @@ -2,7 +2,7 @@ package models import ( "database/sql" - . "dnmshared" + . "dnmshared/sharedprotos" "fmt" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" @@ -33,30 +33,32 @@ func InitPlayerBattleStateIns() { } type Player struct { - Id int32 `json:"id,omitempty" db:"id"` - X float64 `json:"x,omitempty"` - Y float64 `json:"y,omitempty"` - Dir *Direction `json:"dir,omitempty"` - Speed float64 `json:"speed,omitempty"` - BattleState int32 `json:"battleState,omitempty"` - LastMoveGmtMillis int32 `json:"lastMoveGmtMillis,omitempty"` - Score int32 `json:"score,omitempty"` - Removed bool `json:"removed,omitempty"` - JoinIndex int32 + // Meta info fields + Id int32 `json:"id,omitempty" db:"id"` + Name string `json:"name,omitempty" db:"name"` + DisplayName string `json:"displayName,omitempty" db:"display_name"` + Avatar string `json:"avatar,omitempty"` + ColliderRadius float64 `json:"-"` - Name string `json:"name,omitempty" db:"name"` - DisplayName string `json:"displayName,omitempty" db:"display_name"` - Avatar string `json:"avatar,omitempty"` + // DB only fields + CreatedAt int64 `db:"created_at"` + UpdatedAt int64 `db:"updated_at"` + DeletedAt NullInt64 `db:"deleted_at"` + TutorialStage int `db:"tutorial_stage"` - FrozenAtGmtMillis int64 `json:"-" db:"-"` - AddSpeedAtGmtMillis int64 `json:"-" db:"-"` - CreatedAt int64 `json:"-" db:"created_at"` - UpdatedAt int64 `json:"-" db:"updated_at"` - DeletedAt NullInt64 `json:"-" db:"deleted_at"` - TutorialStage int `json:"-" db:"tutorial_stage"` - AckingFrameId int32 `json:"ackingFrameId"` - AckingInputFrameId int32 `json:"-"` - LastSentInputFrameId int32 `json:"-"` + // in-battle info fields + VirtualGridX int32 + VirtualGridY int32 + Dir *Direction + Speed int32 + BattleState int32 + LastMoveGmtMillis int32 + Score int32 + Removed bool + JoinIndex int32 + AckingFrameId int32 + AckingInputFrameId int32 + LastSentInputFrameId int32 } func ExistPlayerByName(name string) (bool, error) { diff --git a/battle_srv/models/player_dao_helper.go b/battle_srv/models/player_dao_helper.go index c09a257..ca3bbe1 100644 --- a/battle_srv/models/player_dao_helper.go +++ b/battle_srv/models/player_dao_helper.go @@ -1,9 +1,9 @@ package models import ( + "battle_srv/storage" "database/sql" . "dnmshared" - "server/storage" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" diff --git a/battle_srv/models/player_login.go b/battle_srv/models/player_login.go index 96f4ea8..1039a02 100644 --- a/battle_srv/models/player_login.go +++ b/battle_srv/models/player_login.go @@ -1,10 +1,10 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/storage" "database/sql" - . "server/common" - "server/common/utils" - "server/storage" sq "github.com/Masterminds/squirrel" ) diff --git a/battle_srv/models/player_wallet.go b/battle_srv/models/player_wallet.go index 48c3425..ca4cef0 100644 --- a/battle_srv/models/player_wallet.go +++ b/battle_srv/models/player_wallet.go @@ -1,11 +1,11 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" "database/sql" . "dnmshared" "errors" - . "server/common" - "server/common/utils" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" diff --git a/battle_srv/models/room.go b/battle_srv/models/room.go index b84b8ee..8259456 100644 --- a/battle_srv/models/room.go +++ b/battle_srv/models/room.go @@ -1,7 +1,11 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" + . "battle_srv/protos" . "dnmshared" + . "dnmshared/sharedprotos" "encoding/xml" "fmt" "github.com/golang/protobuf/proto" @@ -13,9 +17,6 @@ import ( "math/rand" "os" "path/filepath" - . "server/common" - "server/common/utils" - pb "server/pb_output" "strings" "sync" "sync/atomic" @@ -60,36 +61,17 @@ const ( MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED = -2 ) +// These directions are chosen such that when speed is changed to "(speedX+delta, speedY+delta)" for any of them, the direction is unchanged. var DIRECTION_DECODER = [][]int32{ {0, 0}, - {0, +1}, - {0, -1}, + {0, +2}, + {0, -2}, {+2, 0}, {-2, 0}, - {+2, +1}, - {-2, -1}, - {+2, -1}, - {-2, +1}, - {+2, 0}, - {-2, 0}, - {0, +1}, - {0, -1}, -} - -var DIRECTION_DECODER_INVERSE_LENGTH = []float64{ - 0.0, - 1.0, - 1.0, - 0.5, - 0.5, - 0.4472, - 0.4472, - 0.4472, - 0.4472, - 0.5, - 0.5, - 1.0, - 1.0, + {+1, +1}, + {-1, -1}, + {+1, -1}, + {-1, +1}, } type RoomBattleState struct { @@ -128,12 +110,13 @@ func calRoomScore(inRoomPlayerCount int32, roomPlayerCnt int, currentRoomBattleS } type Room struct { - Id int32 - Capacity int - playerColliderRadius float64 - Players map[int32]*Player - PlayersArr []*Player // ordered by joinIndex - CollisionSysMap map[int32]*resolv.Object + Id int32 + Capacity int + collisionSpaceOffsetX float64 + collisionSpaceOffsetY float64 + Players map[int32]*Player + PlayersArr []*Player // ordered by joinIndex + CollisionSysMap map[int32]*resolv.Object /** * The following `PlayerDownsyncSessionDict` is NOT individually put * under `type Player struct` for a reason. @@ -177,11 +160,15 @@ type Room struct { NstDelayFrames int32 // network-single-trip delay in the count of render frames, proposed to be (InputDelayFrames >> 1) because we expect a round-trip delay to be exactly "InputDelayFrames" InputScaleFrames uint32 // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames) JoinIndexBooleanArr []bool - RollbackEstimatedDt float64 RollbackEstimatedDtMillis float64 RollbackEstimatedDtNanos int64 LastRenderFrameIdTriggeredAt int64 + WorldToVirtualGridRatio float64 + VirtualGridToWorldRatio float64 + + PlayerDefaultSpeed int32 + StageName string StageDiscreteW int32 StageDiscreteH int32 @@ -192,11 +179,6 @@ type Room struct { BackendDynamicsEnabled bool } -const ( - PLAYER_DEFAULT_SPEED = float64(200) // Hardcoded - ADD_SPEED = float64(100) // Hardcoded -) - func (pR *Room) updateScore() { pR.Score = calRoomScore(pR.EffectivePlayerCount, pR.Capacity, pR.State) } @@ -218,9 +200,8 @@ func (pR *Room) AddPlayerIfPossible(pPlayerFromDbInit *Player, session *websocke pPlayerFromDbInit.AckingInputFrameId = -1 pPlayerFromDbInit.LastSentInputFrameId = MAGIC_LAST_SENT_INPUT_FRAME_ID_NORMAL_ADDED pPlayerFromDbInit.BattleState = PlayerBattleStateIns.ADDED_PENDING_BATTLE_COLLIDER_ACK - pPlayerFromDbInit.FrozenAtGmtMillis = -1 // Hardcoded temporarily. - pPlayerFromDbInit.Speed = PLAYER_DEFAULT_SPEED // Hardcoded temporarily. - pPlayerFromDbInit.AddSpeedAtGmtMillis = -1 // Hardcoded temporarily. + pPlayerFromDbInit.Speed = pR.PlayerDefaultSpeed // Hardcoded + pPlayerFromDbInit.ColliderRadius = float64(24) // Hardcoded pR.Players[playerId] = pPlayerFromDbInit pR.PlayerDownsyncSessionDict[playerId] = session @@ -252,6 +233,8 @@ func (pR *Room) ReAddPlayerIfPossible(pTmpPlayerInstance *Player, session *webso pEffectiveInRoomPlayerInstance.AckingInputFrameId = -1 pEffectiveInRoomPlayerInstance.LastSentInputFrameId = MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED pEffectiveInRoomPlayerInstance.BattleState = PlayerBattleStateIns.READDED_PENDING_BATTLE_COLLIDER_ACK + pEffectiveInRoomPlayerInstance.Speed = pR.PlayerDefaultSpeed // Hardcoded + pEffectiveInRoomPlayerInstance.ColliderRadius = float64(16) // Hardcoded Logger.Warn("ReAddPlayerIfPossible finished.", zap.Any("roomId", pR.Id), zap.Any("playerId", playerId), zap.Any("joinIndex", pEffectiveInRoomPlayerInstance.JoinIndex), zap.Any("playerBattleState", pEffectiveInRoomPlayerInstance.BattleState), zap.Any("roomState", pR.State), zap.Any("roomEffectivePlayerCount", pR.EffectivePlayerCount), zap.Any("AckingFrameId", pEffectiveInRoomPlayerInstance.AckingFrameId), zap.Any("AckingInputFrameId", pEffectiveInRoomPlayerInstance.AckingInputFrameId), zap.Any("LastSentInputFrameId", pEffectiveInRoomPlayerInstance.LastSentInputFrameId)) return true @@ -269,7 +252,7 @@ func (pR *Room) ChooseStage() error { } rand.Seed(time.Now().Unix()) - stageNameList := []string{ /*"simple" ,*/ "richsoil"} + stageNameList := []string{"simple" /* "richsoil" */} chosenStageIndex := rand.Int() % len(stageNameList) // Hardcoded temporarily. -- YFLu pR.StageName = stageNameList[chosenStageIndex] @@ -329,7 +312,7 @@ func (pR *Room) ChooseStage() error { barrierPolygon2DList := *(toRetStrToPolygon2DListMap["Barrier"]) var barrierLocalIdInBattle int32 = 0 - for _, polygon2DUnaligned := range barrierPolygon2DList { + for _, polygon2DUnaligned := range barrierPolygon2DList.Eles { polygon2D := AlignPolygon2DToBoundingBox(polygon2DUnaligned) /* // For debug-printing only. @@ -362,7 +345,7 @@ func (pR *Room) ConvertToLastUsedRenderFrameId(inputFrameId int32, inputDelayFra return ((inputFrameId << pR.InputScaleFrames) + inputDelayFrames + (1 << pR.InputScaleFrames) - 1) } -func (pR *Room) EncodeUpsyncCmd(upsyncCmd *pb.InputFrameUpsync) uint64 { +func (pR *Room) EncodeUpsyncCmd(upsyncCmd *InputFrameUpsync) uint64 { var ret uint64 = 0 // There're 13 possible directions, occupying the first 4 bits, no need to shift ret += uint64(upsyncCmd.EncodedDir) @@ -386,7 +369,7 @@ func (pR *Room) InputsBufferString(allDetails bool) string { if nil == tmp { break } - f := tmp.(*pb.InputFrameDownsync) + f := tmp.(*InputFrameDownsync) s = append(s, fmt.Sprintf("{inputFrameId: %v, inputList: %v, confirmedList: %v}", f.InputFrameId, f.InputList, f.ConfirmedList)) } @@ -408,7 +391,7 @@ func (pR *Room) StartBattle() { // Initialize the "collisionSys" as well as "RenderFrameBuffer" pR.CurDynamicsRenderFrameId = 0 - kickoffFrame := &pb.RoomDownsyncFrame{ + kickoffFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), CountdownNanos: pR.BattleDurationNanos, @@ -419,9 +402,8 @@ func (pR *Room) StartBattle() { spaceW := pR.StageDiscreteW * pR.StageTileW spaceH := pR.StageDiscreteH * pR.StageTileH - spaceOffsetX := float64(spaceW) * 0.5 - spaceOffsetY := float64(spaceH) * 0.5 - pR.refreshColliders(spaceW, spaceH, spaceOffsetX, spaceOffsetY) + pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY = float64(spaceW)*0.5, float64(spaceH)*0.5 + pR.refreshColliders(spaceW, spaceH) /** * Will be triggered from a goroutine which executes the critical `Room.AddPlayerIfPossible`, thus the `battleMainLoop` should be detached. @@ -465,12 +447,11 @@ func (pR *Room) StartBattle() { pR.prefabInputFrameDownsync(noDelayInputFrameId) } + pR.markConfirmationIfApplicable() unconfirmedMask := uint64(0) if pR.BackendDynamicsEnabled { // Force setting all-confirmed of buffered inputFrames periodically unconfirmedMask = pR.forceConfirmationIfApplicable() - } else { - pR.markConfirmationIfApplicable() } upperToSendInputFrameId := atomic.LoadInt32(&(pR.LastAllConfirmedInputFrameId)) @@ -494,7 +475,7 @@ func (pR *Room) StartBattle() { // Apply "all-confirmed inputFrames" to move forward "pR.CurDynamicsRenderFrameId" nextDynamicsRenderFrameId := pR.ConvertToLastUsedRenderFrameId(pR.LastAllConfirmedInputFrameId, pR.InputDelayFrames) Logger.Debug(fmt.Sprintf("roomId=%v, room.RenderFrameId=%v, LastAllConfirmedInputFrameId=%v, InputDelayFrames=%v, nextDynamicsRenderFrameId=%v", pR.Id, pR.RenderFrameId, pR.LastAllConfirmedInputFrameId, pR.InputDelayFrames, nextDynamicsRenderFrameId)) - pR.applyInputFrameDownsyncDynamics(pR.CurDynamicsRenderFrameId, nextDynamicsRenderFrameId, spaceOffsetX, spaceOffsetY) + pR.applyInputFrameDownsyncDynamics(pR.CurDynamicsRenderFrameId, nextDynamicsRenderFrameId, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY) dynamicsDuration = utils.UnixtimeNano() - dynamicsStartedAt } @@ -503,21 +484,22 @@ func (pR *Room) StartBattle() { refRenderFrameId = pR.CurDynamicsRenderFrameId } } + for playerId, player := range pR.Players { if swapped := atomic.CompareAndSwapInt32(&player.BattleState, PlayerBattleStateIns.ACTIVE, PlayerBattleStateIns.ACTIVE); !swapped { // [WARNING] DON'T send anything if the player is disconnected, because it could jam the channel and cause significant delay upon "battle recovery for reconnected player". continue } if 0 == pR.RenderFrameId { - kickoffFrame := pR.RenderFrameBuffer.GetByFrameId(0).(*pb.RoomDownsyncFrame) + kickoffFrame := pR.RenderFrameBuffer.GetByFrameId(0).(*RoomDownsyncFrame) pR.sendSafely(kickoffFrame, nil, DOWNSYNC_MSG_ACT_BATTLE_START, playerId) } else { // [WARNING] Websocket is TCP-based, thus no need to re-send a previously sent inputFrame to a same player! - toSendInputFrames := make([]*pb.InputFrameDownsync, 0, pR.InputsBuffer.Cnt) + toSendInputFrames := make([]*InputFrameDownsync, 0, pR.InputsBuffer.Cnt) candidateToSendInputFrameId := pR.Players[playerId].LastSentInputFrameId + 1 if candidateToSendInputFrameId < pR.InputsBuffer.StFrameId { // [WARNING] As "player.LastSentInputFrameId <= lastAllConfirmedInputFrameIdWithChange" for each iteration, and "lastAllConfirmedInputFrameIdWithChange <= lastAllConfirmedInputFrameId" where the latter is used to "applyInputFrameDownsyncDynamics" and then evict "pR.InputsBuffer", thus there's a very high possibility that "player.LastSentInputFrameId" is already evicted. - // Logger.Debug(fmt.Sprintf("LastSentInputFrameId already popped: roomId=%v, playerId=%v, lastSentInputFrameId=%v, playerAckingInputFrameId=%v, InputsBuffer=%v", pR.Id, playerId, candidateToSendInputFrameId-1, player.AckingInputFrameId, pR.InputsBufferString(false))) + Logger.Warn(fmt.Sprintf("LastSentInputFrameId already popped: roomId=%v, playerId=%v, lastSentInputFrameId=%v, playerAckingInputFrameId=%v, InputsBuffer=%v", pR.Id, playerId, candidateToSendInputFrameId-1, player.AckingInputFrameId, pR.InputsBufferString(false))) candidateToSendInputFrameId = pR.InputsBuffer.StFrameId } @@ -533,7 +515,7 @@ func (pR *Room) StartBattle() { if nil == tmp { panic(fmt.Sprintf("Required inputFrameId=%v for roomId=%v, playerId=%v doesn't exist! InputsBuffer=%v", candidateToSendInputFrameId, pR.Id, playerId, pR.InputsBufferString(false))) } - f := tmp.(*pb.InputFrameDownsync) + f := tmp.(*InputFrameDownsync) if pR.inputFrameIdDebuggable(candidateToSendInputFrameId) { Logger.Debug("inputFrame lifecycle#3[sending]:", zap.Any("roomId", pR.Id), zap.Any("playerId", playerId), zap.Any("playerAckingInputFrameId", player.AckingInputFrameId), zap.Any("inputFrameId", candidateToSendInputFrameId), zap.Any("inputFrameId-doublecheck", f.InputFrameId), zap.Any("InputsBuffer", pR.InputsBufferString(false)), zap.Any("ConfirmedList", f.ConfirmedList)) } @@ -543,22 +525,26 @@ func (pR *Room) StartBattle() { if 0 >= len(toSendInputFrames) { // [WARNING] When sending DOWNSYNC_MSG_ACT_FORCED_RESYNC, there MUST BE accompanying "toSendInputFrames" for calculating "refRenderFrameId"! - if MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED == player.LastSentInputFrameId { Logger.Warn(fmt.Sprintf("Not sending due to empty toSendInputFrames: roomId=%v, playerId=%v, refRenderFrameId=%v, upperToSendInputFrameId=%v, lastSentInputFrameId=%v, playerAckingInputFrameId=%v", pR.Id, playerId, refRenderFrameId, upperToSendInputFrameId, player.LastSentInputFrameId, player.AckingInputFrameId)) } continue } - indiceInJoinIndexBooleanArr := uint32(player.JoinIndex - 1) - var joinMask uint64 = (1 << indiceInJoinIndexBooleanArr) - if pR.BackendDynamicsEnabled && (MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED == player.LastSentInputFrameId || 0 < (unconfirmedMask&joinMask)) { - // [WARNING] Even upon "MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED", it could be true that "0 == (unconfirmedMask & joinMask)"! + /* + Resync helps + 1. when player with a slower frontend clock lags significantly behind and thus wouldn't get its inputUpsync recognized due to faster "forceConfirmation" + 2. reconnection + */ + shouldResync1 := (MAGIC_LAST_SENT_INPUT_FRAME_ID_READDED == player.LastSentInputFrameId) + // shouldResync2 := (0 < (unconfirmedMask & uint64(1 << uint32(player.JoinIndex-1)))) // This condition is critical, if we don't send resync upon this condition, the "reconnected or slowly-clocking player" might never get its input synced + shouldResync2 := (0 < unconfirmedMask) // An easier version of the above, might keep sending "refRenderFrame"s to still connected players when any player is disconnected + if pR.BackendDynamicsEnabled && (shouldResync1 || shouldResync2) { tmp := pR.RenderFrameBuffer.GetByFrameId(refRenderFrameId) if nil == tmp { panic(fmt.Sprintf("Required refRenderFrameId=%v for roomId=%v, playerId=%v, candidateToSendInputFrameId=%v doesn't exist! InputsBuffer=%v, RenderFrameBuffer=%v", refRenderFrameId, pR.Id, playerId, candidateToSendInputFrameId, pR.InputsBufferString(false), pR.RenderFrameBufferString())) } - refRenderFrame := tmp.(*pb.RoomDownsyncFrame) + refRenderFrame := tmp.(*RoomDownsyncFrame) pR.sendSafely(refRenderFrame, toSendInputFrames, DOWNSYNC_MSG_ACT_FORCED_RESYNC, playerId) } else { pR.sendSafely(nil, toSendInputFrames, DOWNSYNC_MSG_ACT_INPUT_BATCH, playerId) @@ -567,35 +553,40 @@ func (pR *Room) StartBattle() { } } - // Evict no longer required "RenderFrameBuffer" - for pR.RenderFrameBuffer.N < pR.RenderFrameBuffer.Cnt || (0 < pR.RenderFrameBuffer.Cnt && pR.RenderFrameBuffer.StFrameId < refRenderFrameId) { - _ = pR.RenderFrameBuffer.Pop() + if pR.BackendDynamicsEnabled { + // Evict no longer required "RenderFrameBuffer" + for pR.RenderFrameBuffer.N < pR.RenderFrameBuffer.Cnt || (0 < pR.RenderFrameBuffer.Cnt && pR.RenderFrameBuffer.StFrameId < refRenderFrameId) { + _ = pR.RenderFrameBuffer.Pop() + } } toApplyInputFrameId := pR.ConvertToInputFrameId(refRenderFrameId, pR.InputDelayFrames) - if false == pR.BackendDynamicsEnabled { - // When "false == pR.BackendDynamicsEnabled", the variable "refRenderFrameId" is not well defined - minLastSentInputFrameId := int32(math.MaxInt32) - for _, player := range pR.Players { - if player.LastSentInputFrameId >= minLastSentInputFrameId { - continue - } - minLastSentInputFrameId = player.LastSentInputFrameId + /* + [WARNING] + The following updates to "toApplyInputFrameId" is necessary because when "false == pR.BackendDynamicsEnabled", the variable "refRenderFrameId" is not well defined. + */ + minLastSentInputFrameId := int32(math.MaxInt32) + for _, player := range pR.Players { + if player.LastSentInputFrameId >= minLastSentInputFrameId { + continue } + minLastSentInputFrameId = player.LastSentInputFrameId + } + if minLastSentInputFrameId < toApplyInputFrameId { toApplyInputFrameId = minLastSentInputFrameId } for pR.InputsBuffer.N < pR.InputsBuffer.Cnt || (0 < pR.InputsBuffer.Cnt && pR.InputsBuffer.StFrameId < toApplyInputFrameId) { - f := pR.InputsBuffer.Pop().(*pb.InputFrameDownsync) + f := pR.InputsBuffer.Pop().(*InputFrameDownsync) if pR.inputFrameIdDebuggable(f.InputFrameId) { // Popping of an "inputFrame" would be AFTER its being all being confirmed, because it requires the "inputFrame" to be all acked - Logger.Debug("inputFrame lifecycle#4[popped]:", zap.Any("roomId", pR.Id), zap.Any("inputFrameId", f.InputFrameId), zap.Any("InputsBuffer", pR.InputsBufferString(false))) + Logger.Debug("inputFrame lifecycle#4[popped]:", zap.Any("roomId", pR.Id), zap.Any("inputFrameId", f.InputFrameId), zap.Any("toApplyInputFrameId", toApplyInputFrameId), zap.Any("InputsBuffer", pR.InputsBufferString(false))) } } pR.RenderFrameId++ elapsedInCalculation := (utils.UnixtimeNano() - stCalculation) if elapsedInCalculation > nanosPerFrame { - Logger.Warn(fmt.Sprintf("SLOW FRAME! Elapsed time statistics: roomId=%v, room.RenderFrameId=%v, elapsedInCalculation=%v, dynamicsDuration=%v, nanosPerFrame=%v", pR.Id, pR.RenderFrameId, elapsedInCalculation, dynamicsDuration, nanosPerFrame)) + Logger.Warn(fmt.Sprintf("SLOW FRAME! Elapsed time statistics: roomId=%v, room.RenderFrameId=%v, elapsedInCalculation=%v ns, dynamicsDuration=%v ns, expected nanosPerFrame=%v", pR.Id, pR.RenderFrameId, elapsedInCalculation, dynamicsDuration, nanosPerFrame)) } time.Sleep(time.Duration(nanosPerFrame - elapsedInCalculation)) } @@ -611,7 +602,7 @@ func (pR *Room) toDiscreteInputsBufferIndex(inputFrameId int32, joinIndex int32) return (inputFrameId << 2) + joinIndex // allowing joinIndex upto 15 } -func (pR *Room) OnBattleCmdReceived(pReq *pb.WsReq) { +func (pR *Room) OnBattleCmdReceived(pReq *WsReq) { if swapped := atomic.CompareAndSwapInt32(&pR.State, RoomBattleStateIns.IN_BATTLE, RoomBattleStateIns.IN_BATTLE); !swapped { return } @@ -649,7 +640,7 @@ func (pR *Room) OnBattleCmdReceived(pReq *pb.WsReq) { } } -func (pR *Room) onInputFrameDownsyncAllConfirmed(inputFrameDownsync *pb.InputFrameDownsync, playerId int32) { +func (pR *Room) onInputFrameDownsyncAllConfirmed(inputFrameDownsync *InputFrameDownsync, playerId int32) { inputFrameId := inputFrameDownsync.InputFrameId if -1 == pR.LastAllConfirmedInputFrameIdWithChange || false == pR.equalInputLists(inputFrameDownsync.InputList, pR.LastAllConfirmedInputList) { if -1 == playerId { @@ -691,7 +682,7 @@ func (pR *Room) StopBattleForSettlement() { Logger.Info("Stopping the `battleMainLoop` for:", zap.Any("roomId", pR.Id)) pR.RenderFrameId++ for playerId, _ := range pR.Players { - assembledFrame := pb.RoomDownsyncFrame{ + assembledFrame := RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), CountdownNanos: -1, // TODO: Replace this magic constant! @@ -717,18 +708,19 @@ func (pR *Room) onBattlePrepare(cb BattleStartCbType) { pR.State = RoomBattleStateIns.PREPARE Logger.Info("Battle state transitted to RoomBattleStateIns.PREPARE for:", zap.Any("roomId", pR.Id)) - playerMetas := make(map[int32]*pb.PlayerMeta, 0) + playerMetas := make(map[int32]*PlayerDownsyncMeta, 0) for _, player := range pR.Players { - playerMetas[player.Id] = &pb.PlayerMeta{ - Id: player.Id, - Name: player.Name, - DisplayName: player.DisplayName, - Avatar: player.Avatar, - JoinIndex: player.JoinIndex, + playerMetas[player.Id] = &PlayerDownsyncMeta{ + Id: player.Id, + Name: player.Name, + DisplayName: player.DisplayName, + Avatar: player.Avatar, + ColliderRadius: player.ColliderRadius, // hardcoded for now + JoinIndex: player.JoinIndex, } } - battleReadyToStartFrame := &pb.RoomDownsyncFrame{ + battleReadyToStartFrame := &RoomDownsyncFrame{ Id: DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, @@ -798,7 +790,9 @@ func (pR *Room) Dismiss() { func (pR *Room) OnDismissed() { // Always instantiates new HeapRAM blocks and let the old blocks die out due to not being retained by any root reference. - pR.playerColliderRadius = float64(12) // hardcoded + pR.WorldToVirtualGridRatio = float64(1000) + pR.VirtualGridToWorldRatio = float64(1.0) / pR.WorldToVirtualGridRatio // this is a one-off computation, should avoid division in iterations + pR.PlayerDefaultSpeed = int32(float64(2) * pR.WorldToVirtualGridRatio) // in virtual grids per frame pR.Players = make(map[int32]*Player) pR.PlayersArr = make([]*Player, pR.Capacity) pR.CollisionSysMap = make(map[int32]*resolv.Object) @@ -820,13 +814,12 @@ func (pR *Room) OnDismissed() { pR.NstDelayFrames = 8 pR.InputScaleFrames = uint32(2) pR.ServerFps = 60 - pR.RollbackEstimatedDt = 0.016667 // Use fixed-and-low-precision to mitigate the inconsistent floating-point-number issue between Golang and JavaScript pR.RollbackEstimatedDtMillis = 16.667 // Use fixed-and-low-precision to mitigate the inconsistent floating-point-number issue between Golang and JavaScript pR.RollbackEstimatedDtNanos = 16666666 // A little smaller than the actual per frame time, just for preventing FAST FRAME pR.BattleDurationFrames = 30 * pR.ServerFps pR.BattleDurationNanos = int64(pR.BattleDurationFrames) * (pR.RollbackEstimatedDtNanos + 1) pR.InputFrameUpsyncDelayTolerance = 2 - pR.MaxChasingRenderFramesPerUpdate = 10 + pR.MaxChasingRenderFramesPerUpdate = 5 pR.BackendDynamicsEnabled = true // [WARNING] When "false", recovery upon reconnection wouldn't work! @@ -939,16 +932,15 @@ func (pR *Room) onPlayerAdded(playerId int32) { // Lazily assign the initial position of "Player" for "RoomDownsyncFrame". playerPosList := *(pR.RawBattleStrToVec2DListMap["PlayerStartingPos"]) - if index > len(playerPosList) { + if index > len(playerPosList.Eles) { panic(fmt.Sprintf("onPlayerAdded error, index >= len(playerPosList), roomId=%v, playerId=%v, roomState=%v, roomEffectivePlayerCount=%v", pR.Id, playerId, pR.State, pR.EffectivePlayerCount)) } - playerPos := playerPosList[index] + playerPos := playerPosList.Eles[index] if nil == playerPos { panic(fmt.Sprintf("onPlayerAdded error, nil == playerPos, roomId=%v, playerId=%v, roomState=%v, roomEffectivePlayerCount=%v", pR.Id, playerId, pR.State, pR.EffectivePlayerCount)) } - pR.Players[playerId].X = playerPos.X - pR.Players[playerId].Y = playerPos.Y + pR.Players[playerId].VirtualGridX, pR.Players[playerId].VirtualGridY = WorldToVirtualGridPos(playerPos.X, playerPos.Y, pR.WorldToVirtualGridRatio) break } @@ -976,14 +968,15 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { return false } - playerMetas := make(map[int32]*pb.PlayerMeta, 0) + playerMetas := make(map[int32]*PlayerDownsyncMeta, 0) for _, eachPlayer := range pR.Players { - playerMetas[eachPlayer.Id] = &pb.PlayerMeta{ - Id: eachPlayer.Id, - Name: eachPlayer.Name, - DisplayName: eachPlayer.DisplayName, - Avatar: eachPlayer.Avatar, - JoinIndex: eachPlayer.JoinIndex, + playerMetas[eachPlayer.Id] = &PlayerDownsyncMeta{ + Id: eachPlayer.Id, + Name: eachPlayer.Name, + DisplayName: eachPlayer.DisplayName, + Avatar: eachPlayer.Avatar, + JoinIndex: eachPlayer.JoinIndex, + ColliderRadius: eachPlayer.ColliderRadius, } } @@ -999,14 +992,14 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { */ switch targetPlayer.BattleState { case PlayerBattleStateIns.ADDED_PENDING_BATTLE_COLLIDER_ACK: - playerAckedFrame := &pb.RoomDownsyncFrame{ + playerAckedFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, } pR.sendSafely(playerAckedFrame, nil, DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED, eachPlayer.Id) case PlayerBattleStateIns.READDED_PENDING_BATTLE_COLLIDER_ACK: - playerAckedFrame := &pb.RoomDownsyncFrame{ + playerAckedFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, @@ -1037,14 +1030,14 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { return true } -func (pR *Room) sendSafely(roomDownsyncFrame *pb.RoomDownsyncFrame, toSendFrames []*pb.InputFrameDownsync, act int32, playerId int32) { +func (pR *Room) sendSafely(roomDownsyncFrame *RoomDownsyncFrame, toSendFrames []*InputFrameDownsync, act int32, playerId int32) { defer func() { if r := recover(); r != nil { pR.PlayerSignalToCloseDict[playerId](Constants.RetCode.UnknownError, fmt.Sprintf("%v", r)) } }() - pResp := &pb.WsResp{ + pResp := &WsResp{ Ret: int32(Constants.RetCode.Ok), Act: act, Rdf: roomDownsyncFrame, @@ -1065,16 +1058,16 @@ func (pR *Room) shouldPrefabInputFrameDownsync(renderFrameId int32) bool { return ((renderFrameId & ((1 << pR.InputScaleFrames) - 1)) == 0) } -func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *pb.InputFrameDownsync { +func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *InputFrameDownsync { /* Kindly note that on backend the prefab is much simpler than its frontend counterpart, because frontend will upsync its latest command immediately if there's any change w.r.t. its own prev cmd, thus if no upsync received from a frontend, - EITHER it's due to local lag and bad network, - OR there's no change w.r.t. to its prev cmd. */ - var currInputFrameDownsync *pb.InputFrameDownsync = nil + var currInputFrameDownsync *InputFrameDownsync = nil if 0 == inputFrameId && 0 == pR.InputsBuffer.Cnt { - currInputFrameDownsync = &pb.InputFrameDownsync{ + currInputFrameDownsync = &InputFrameDownsync{ InputFrameId: 0, InputList: make([]uint64, pR.Capacity), ConfirmedList: uint64(0), @@ -1084,9 +1077,9 @@ func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *pb.InputFrameDowns if nil == tmp { panic(fmt.Sprintf("Error prefabbing inputFrameDownsync: roomId=%v, InputsBuffer=%v", pR.Id, pR.InputsBufferString(false))) } - prevInputFrameDownsync := tmp.(*pb.InputFrameDownsync) + prevInputFrameDownsync := tmp.(*InputFrameDownsync) currInputList := prevInputFrameDownsync.InputList // Would be a clone of the values - currInputFrameDownsync = &pb.InputFrameDownsync{ + currInputFrameDownsync = &InputFrameDownsync{ InputFrameId: inputFrameId, InputList: currInputList, ConfirmedList: uint64(0), @@ -1112,20 +1105,19 @@ func (pR *Room) markConfirmationIfApplicable() { if nil == tmp { panic(fmt.Sprintf("inputFrameId=%v doesn't exist for roomId=%v, this is abnormal because the server should prefab inputFrameDownsync in a most advanced pace, check the prefab logic! InputsBuffer=%v", inputFrameId, pR.Id, pR.InputsBufferString(false))) } - inputFrameDownsync := tmp.(*pb.InputFrameDownsync) + inputFrameDownsync := tmp.(*InputFrameDownsync) for _, player := range pR.Players { bufIndex := pR.toDiscreteInputsBufferIndex(inputFrameId, player.JoinIndex) tmp, loaded := pR.DiscreteInputsBuffer.LoadAndDelete(bufIndex) // It's safe to "LoadAndDelete" here because the "inputFrameUpsync" of this player is already remembered by the corresponding "inputFrameDown". if !loaded { continue } - inputFrameUpsync := tmp.(*pb.InputFrameUpsync) + inputFrameUpsync := tmp.(*InputFrameUpsync) indiceInJoinIndexBooleanArr := uint32(player.JoinIndex - 1) inputFrameDownsync.InputList[indiceInJoinIndexBooleanArr] = pR.EncodeUpsyncCmd(inputFrameUpsync) inputFrameDownsync.ConfirmedList |= (1 << indiceInJoinIndexBooleanArr) } - // Force confirmation of "inputFrame2" if allConfirmedMask == inputFrameDownsync.ConfirmedList { pR.onInputFrameDownsyncAllConfirmed(inputFrameDownsync, -1) } else { @@ -1156,24 +1148,12 @@ func (pR *Room) forceConfirmationIfApplicable() uint64 { if nil == tmp { panic(fmt.Sprintf("inputFrameId2=%v doesn't exist for roomId=%v, this is abnormal because the server should prefab inputFrameDownsync in a most advanced pace, check the prefab logic! InputsBuffer=%v", inputFrameId2, pR.Id, pR.InputsBufferString(false))) } - inputFrame2 := tmp.(*pb.InputFrameDownsync) - for _, player := range pR.Players { - // Enrich by already arrived player upsync commands - bufIndex := pR.toDiscreteInputsBufferIndex(inputFrame2.InputFrameId, player.JoinIndex) - tmp, loaded := pR.DiscreteInputsBuffer.LoadAndDelete(bufIndex) - if !loaded { - continue - } - inputFrameUpsync := tmp.(*pb.InputFrameUpsync) - indiceInJoinIndexBooleanArr := uint32(player.JoinIndex - 1) - inputFrame2.InputList[indiceInJoinIndexBooleanArr] = pR.EncodeUpsyncCmd(inputFrameUpsync) - inputFrame2.ConfirmedList |= (1 << indiceInJoinIndexBooleanArr) - } totPlayerCnt := uint32(pR.Capacity) allConfirmedMask := uint64((1 << totPlayerCnt) - 1) // Force confirmation of "inputFrame2" + inputFrame2 := tmp.(*InputFrameDownsync) oldConfirmedList := inputFrame2.ConfirmedList unconfirmedMask := (oldConfirmedList ^ allConfirmedMask) inputFrame2.ConfirmedList = allConfirmedMask @@ -1192,7 +1172,13 @@ func (pR *Room) applyInputFrameDownsyncDynamics(fromRenderFrameId int32, toRende allConfirmedMask := uint64((1 << totPlayerCnt) - 1) for collisionSysRenderFrameId := fromRenderFrameId; collisionSysRenderFrameId < toRenderFrameId; collisionSysRenderFrameId++ { + currRenderFrameTmp := pR.RenderFrameBuffer.GetByFrameId(collisionSysRenderFrameId) + if nil == currRenderFrameTmp { + panic(fmt.Sprintf("collisionSysRenderFrameId=%v doesn't exist for roomId=%v, this is abnormal because it's to be used for applying dynamics to [fromRenderFrameId:%v, toRenderFrameId:%v)! RenderFrameBuffer=%v", collisionSysRenderFrameId, pR.Id, fromRenderFrameId, toRenderFrameId, pR.RenderFrameBufferString())) + } + currRenderFrame := currRenderFrameTmp.(*RoomDownsyncFrame) delayedInputFrameId := pR.ConvertToInputFrameId(collisionSysRenderFrameId, pR.InputDelayFrames) + var delayedInputFrame *InputFrameDownsync = nil if 0 <= delayedInputFrameId { if delayedInputFrameId > pR.LastAllConfirmedInputFrameId { panic(fmt.Sprintf("delayedInputFrameId=%v is not yet all-confirmed for roomId=%v, this is abnormal because it's to be used for applying dynamics to [fromRenderFrameId:%v, toRenderFrameId:%v) @ collisionSysRenderFrameId=%v! InputsBuffer=%v", delayedInputFrameId, pR.Id, fromRenderFrameId, toRenderFrameId, collisionSysRenderFrameId, pR.InputsBufferString(false))) @@ -1201,73 +1187,126 @@ func (pR *Room) applyInputFrameDownsyncDynamics(fromRenderFrameId int32, toRende if nil == tmp { panic(fmt.Sprintf("delayedInputFrameId=%v doesn't exist for roomId=%v, this is abnormal because it's to be used for applying dynamics to [fromRenderFrameId:%v, toRenderFrameId:%v) @ collisionSysRenderFrameId=%v! InputsBuffer=%v", delayedInputFrameId, pR.Id, fromRenderFrameId, toRenderFrameId, collisionSysRenderFrameId, pR.InputsBufferString(false))) } - delayedInputFrame := tmp.(*pb.InputFrameDownsync) + delayedInputFrame = tmp.(*InputFrameDownsync) // [WARNING] It's possible that by now "allConfirmedMask != delayedInputFrame.ConfirmedList && delayedInputFrameId <= pR.LastAllConfirmedInputFrameId", we trust "pR.LastAllConfirmedInputFrameId" as the TOP AUTHORITY. atomic.StoreUint64(&(delayedInputFrame.ConfirmedList), allConfirmedMask) + } - inputList := delayedInputFrame.InputList - // Ordered by joinIndex to guarantee determinism - for _, player := range pR.PlayersArr { - joinIndex := player.JoinIndex - encodedInput := inputList[joinIndex-1] - decodedInput := DIRECTION_DECODER[encodedInput] - decodedInputSpeedFactor := DIRECTION_DECODER_INVERSE_LENGTH[encodedInput] - if 0.0 == decodedInputSpeedFactor { - continue - } - baseChange := player.Speed * pR.RollbackEstimatedDt * decodedInputSpeedFactor - oldDx, oldDy := baseChange*float64(decodedInput[0]), baseChange*float64(decodedInput[1]) - dx, dy := oldDx, oldDy + nextRenderFrame := pR.applyInputFrameDownsyncDynamicsOnSingleRenderFrame(delayedInputFrame, currRenderFrame, pR.CollisionSysMap) + // Update in the latest player pointers + for playerId, playerDownsync := range nextRenderFrame.Players { + pR.Players[playerId].VirtualGridX = playerDownsync.VirtualGridX + pR.Players[playerId].VirtualGridY = playerDownsync.VirtualGridY + pR.Players[playerId].Dir.Dx = playerDownsync.Dir.Dx + pR.Players[playerId].Dir.Dy = playerDownsync.Dir.Dy + } + pR.RenderFrameBuffer.Put(nextRenderFrame) + pR.CurDynamicsRenderFrameId++ + } +} - collisionPlayerIndex := COLLISION_PLAYER_INDEX_PREFIX + joinIndex - playerCollider := pR.CollisionSysMap[collisionPlayerIndex] - if collision := playerCollider.Check(oldDx, oldDy, "Barrier"); collision != nil { - playerShape := playerCollider.Shape.(*resolv.ConvexPolygon) - for _, obj := range collision.Objects { - barrierShape := obj.Shape.(*resolv.ConvexPolygon) - if overlapped, pushbackX, pushbackY := CalcPushbacks(oldDx, oldDy, playerShape, barrierShape); overlapped { - Logger.Debug(fmt.Sprintf("Collided & overlapped: player.X=%v, player.Y=%v, oldDx=%v, oldDy=%v, playerShape=%v, toCheckBarrier=%v, pushbackX=%v, pushbackY=%v", playerCollider.X, playerCollider.Y, oldDx, oldDy, ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY)) - dx -= pushbackX - dy -= pushbackY - } else { - Logger.Debug(fmt.Sprintf("Collided BUT not overlapped: player.X=%v, player.Y=%v, oldDx=%v, oldDy=%v, playerShape=%v, toCheckBarrier=%v", playerCollider.X, playerCollider.Y, oldDx, oldDy, ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape))) - } - } - } - playerCollider.X += dx - playerCollider.Y += dy +// TODO: Write unit-test for this function to compare with its frontend counter part +func (pR *Room) applyInputFrameDownsyncDynamicsOnSingleRenderFrame(delayedInputFrame *InputFrameDownsync, currRenderFrame *RoomDownsyncFrame, collisionSysMap map[int32]*resolv.Object) *RoomDownsyncFrame { + nextRenderFramePlayers := make(map[int32]*PlayerDownsync, pR.Capacity) + // Make a copy first + for playerId, currPlayerDownsync := range currRenderFrame.Players { + nextRenderFramePlayers[playerId] = &PlayerDownsync{ + Id: playerId, + VirtualGridX: currPlayerDownsync.VirtualGridX, + VirtualGridY: currPlayerDownsync.VirtualGridY, + Dir: &Direction{ + Dx: currPlayerDownsync.Dir.Dx, + Dy: currPlayerDownsync.Dir.Dy, + }, + Speed: currPlayerDownsync.Speed, + BattleState: currPlayerDownsync.BattleState, + Score: currPlayerDownsync.Score, + Removed: currPlayerDownsync.Removed, + JoinIndex: currPlayerDownsync.JoinIndex, + } + } - // Update in "collision space" - playerCollider.Update() + toRet := &RoomDownsyncFrame{ + Id: currRenderFrame.Id + 1, + Players: nextRenderFramePlayers, + CountdownNanos: (pR.BattleDurationNanos - int64(currRenderFrame.Id)*pR.RollbackEstimatedDtNanos), + } - player.Dir.Dx = decodedInput[0] - player.Dir.Dy = decodedInput[1] - player.X = playerCollider.X + pR.playerColliderRadius - spaceOffsetX - player.Y = playerCollider.Y + pR.playerColliderRadius - spaceOffsetY + if nil != delayedInputFrame { + inputList := delayedInputFrame.InputList + effPushbacks := make([]Vec2D, pR.Capacity) // Guaranteed determinism regardless of traversal order + for playerId, player := range pR.Players { + joinIndex := player.JoinIndex + effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y = float64(0), float64(0) + currPlayerDownsync := currRenderFrame.Players[playerId] + encodedInput := inputList[joinIndex-1] + decodedInput := DIRECTION_DECODER[encodedInput] + proposedVirtualGridDx, proposedVirtualGridDy := (decodedInput[0] + decodedInput[0]*currPlayerDownsync.Speed), (decodedInput[1] + decodedInput[1]*currPlayerDownsync.Speed) + newVx, newVy := (currPlayerDownsync.VirtualGridX + proposedVirtualGridDx), (currPlayerDownsync.VirtualGridY + proposedVirtualGridDy) + // Reset playerCollider position from the "virtual grid position" + collisionPlayerIndex := COLLISION_PLAYER_INDEX_PREFIX + joinIndex + playerCollider := collisionSysMap[collisionPlayerIndex] + playerCollider.X, playerCollider.Y = VirtualGridToPolygonColliderAnchorPos(newVx, newVy, player.ColliderRadius, player.ColliderRadius, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY, pR.VirtualGridToWorldRatio) + + // Update in the collision system + playerCollider.Update() + + if 0 < encodedInput { + Logger.Debug(fmt.Sprintf("Checking collision for playerId=%v: virtual (%d, %d) -> (%d, %d), now playerShape=%v", playerId, currPlayerDownsync.VirtualGridX, currPlayerDownsync.VirtualGridY, newVx, newVy, ConvexPolygonStr(playerCollider.Shape.(*resolv.ConvexPolygon)))) + nextRenderFramePlayers[playerId].Dir.Dx = decodedInput[0] + nextRenderFramePlayers[playerId].Dir.Dy = decodedInput[1] } } - newRenderFrame := pb.RoomDownsyncFrame{ - Id: collisionSysRenderFrameId + 1, - Players: toPbPlayers(pR.Players), - CountdownNanos: (pR.BattleDurationNanos - int64(collisionSysRenderFrameId)*pR.RollbackEstimatedDtNanos), + // handle pushbacks upon collision after all movements treated as simultaneous + for _, player := range pR.Players { + joinIndex := player.JoinIndex + collisionPlayerIndex := COLLISION_PLAYER_INDEX_PREFIX + joinIndex + playerCollider := collisionSysMap[collisionPlayerIndex] + if collision := playerCollider.Check(0, 0); collision != nil { + playerShape := playerCollider.Shape.(*resolv.ConvexPolygon) + for _, obj := range collision.Objects { + barrierShape := obj.Shape.(*resolv.ConvexPolygon) + if overlapped, pushbackX, pushbackY, overlapResult := CalcPushbacks(0, 0, playerShape, barrierShape); overlapped { + Logger.Debug(fmt.Sprintf("Overlapped: a=%v, b=%v, pushbackX=%v, pushbackY=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY)) + effPushbacks[joinIndex-1].X += pushbackX + effPushbacks[joinIndex-1].Y += pushbackY + } else { + Logger.Debug(fmt.Sprintf("Collided BUT not overlapped: a=%v, b=%v, overlapResult=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), overlapResult)) + } + } + } } - pR.RenderFrameBuffer.Put(&newRenderFrame) - pR.CurDynamicsRenderFrameId++ + + for playerId, player := range pR.Players { + joinIndex := player.JoinIndex + collisionPlayerIndex := COLLISION_PLAYER_INDEX_PREFIX + joinIndex + playerCollider := collisionSysMap[collisionPlayerIndex] + + // Update "virtual grid position" + newVx, newVy := PolygonColliderAnchorToVirtualGridPos(playerCollider.X-effPushbacks[joinIndex-1].X, playerCollider.Y-effPushbacks[joinIndex-1].Y, player.ColliderRadius, player.ColliderRadius, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY, pR.WorldToVirtualGridRatio) + nextRenderFramePlayers[playerId].VirtualGridX = newVx + nextRenderFramePlayers[playerId].VirtualGridY = newVy + } + + Logger.Debug(fmt.Sprintf("After applyInputFrameDownsyncDynamicsOnSingleRenderFrame: currRenderFrame.Id=%v, inputList=%v, currRenderFrame.Players=%v, nextRenderFramePlayers=%v, toRet.Players=%v", currRenderFrame.Id, inputList, currRenderFrame.Players, nextRenderFramePlayers, toRet.Players)) } + + return toRet } func (pR *Room) inputFrameIdDebuggable(inputFrameId int32) bool { return 0 == (inputFrameId % 10) } -func (pR *Room) refreshColliders(spaceW, spaceH int32, spaceOffsetX, spaceOffsetY float64) { +func (pR *Room) refreshColliders(spaceW, spaceH int32) { // Kindly note that by now, we've already got all the shapes in the tmx file into "pR.(Players | Barriers)" from "ParseTmxLayersAndGroups" - minStep := int(3) // the approx minimum distance a player can move per frame - space := resolv.NewSpace(int(spaceW), int(spaceH), minStep, minStep) // allocate a new collision space everytime after a battle is settled + minStep := (int(float64(pR.PlayerDefaultSpeed)*pR.VirtualGridToWorldRatio) << 2) // the approx minimum distance a player can move per frame in world coordinate + space := resolv.NewSpace(int(spaceW), int(spaceH), minStep, minStep) // allocate a new collision space everytime after a battle is settled for _, player := range pR.Players { - playerCollider := GenerateRectCollider(player.X, player.Y, pR.playerColliderRadius*2, pR.playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") + wx, wy := VirtualGridToWorldPos(player.VirtualGridX, player.VirtualGridY, pR.VirtualGridToWorldRatio) + playerCollider := GenerateRectCollider(wx, wy, player.ColliderRadius*2, player.ColliderRadius*2, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY, "Player") space.Add(playerCollider) // Keep track of the collider in "pR.CollisionSysMap" joinIndex := player.JoinIndex @@ -1278,7 +1317,7 @@ func (pR *Room) refreshColliders(spaceW, spaceH int32, spaceOffsetX, spaceOffset for _, barrier := range pR.Barriers { boundaryUnaligned := barrier.Boundary - barrierCollider := GenerateConvexPolygonCollider(boundaryUnaligned, spaceOffsetX, spaceOffsetY, "Barrier") + barrierCollider := GenerateConvexPolygonCollider(boundaryUnaligned, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY, "Barrier") space.Add(barrierCollider) } } diff --git a/battle_srv/pb_output/room_downsync_frame.pb.go b/battle_srv/pb_output/room_downsync_frame.pb.go deleted file mode 100644 index 19395b1..0000000 --- a/battle_srv/pb_output/room_downsync_frame.pb.go +++ /dev/null @@ -1,1587 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.4 -// source: room_downsync_frame.proto - -package __ - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Direction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Dx int32 `protobuf:"varint,1,opt,name=dx,proto3" json:"dx,omitempty"` - Dy int32 `protobuf:"varint,2,opt,name=dy,proto3" json:"dy,omitempty"` -} - -func (x *Direction) Reset() { - *x = Direction{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Direction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Direction) ProtoMessage() {} - -func (x *Direction) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Direction.ProtoReflect.Descriptor instead. -func (*Direction) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{0} -} - -func (x *Direction) GetDx() int32 { - if x != nil { - return x.Dx - } - return 0 -} - -func (x *Direction) GetDy() int32 { - if x != nil { - return x.Dy - } - return 0 -} - -type Vec2D struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - X float64 `protobuf:"fixed64,1,opt,name=x,proto3" json:"x,omitempty"` - Y float64 `protobuf:"fixed64,2,opt,name=y,proto3" json:"y,omitempty"` -} - -func (x *Vec2D) Reset() { - *x = Vec2D{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Vec2D) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Vec2D) ProtoMessage() {} - -func (x *Vec2D) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Vec2D.ProtoReflect.Descriptor instead. -func (*Vec2D) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{1} -} - -func (x *Vec2D) GetX() float64 { - if x != nil { - return x.X - } - return 0 -} - -func (x *Vec2D) GetY() float64 { - if x != nil { - return x.Y - } - return 0 -} - -type Polygon2D struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Anchor *Vec2D `protobuf:"bytes,1,opt,name=Anchor,proto3" json:"Anchor,omitempty"` - Points []*Vec2D `protobuf:"bytes,2,rep,name=Points,proto3" json:"Points,omitempty"` -} - -func (x *Polygon2D) Reset() { - *x = Polygon2D{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Polygon2D) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Polygon2D) ProtoMessage() {} - -func (x *Polygon2D) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Polygon2D.ProtoReflect.Descriptor instead. -func (*Polygon2D) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{2} -} - -func (x *Polygon2D) GetAnchor() *Vec2D { - if x != nil { - return x.Anchor - } - return nil -} - -func (x *Polygon2D) GetPoints() []*Vec2D { - if x != nil { - return x.Points - } - return nil -} - -type Vec2DList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Vec2DList []*Vec2D `protobuf:"bytes,1,rep,name=vec2DList,proto3" json:"vec2DList,omitempty"` -} - -func (x *Vec2DList) Reset() { - *x = Vec2DList{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Vec2DList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Vec2DList) ProtoMessage() {} - -func (x *Vec2DList) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Vec2DList.ProtoReflect.Descriptor instead. -func (*Vec2DList) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{3} -} - -func (x *Vec2DList) GetVec2DList() []*Vec2D { - if x != nil { - return x.Vec2DList - } - return nil -} - -type Polygon2DList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Polygon2DList []*Polygon2D `protobuf:"bytes,1,rep,name=polygon2DList,proto3" json:"polygon2DList,omitempty"` -} - -func (x *Polygon2DList) Reset() { - *x = Polygon2DList{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Polygon2DList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Polygon2DList) ProtoMessage() {} - -func (x *Polygon2DList) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Polygon2DList.ProtoReflect.Descriptor instead. -func (*Polygon2DList) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{4} -} - -func (x *Polygon2DList) GetPolygon2DList() []*Polygon2D { - if x != nil { - return x.Polygon2DList - } - return nil -} - -type BattleColliderInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StageName string `protobuf:"bytes,1,opt,name=stageName,proto3" json:"stageName,omitempty"` - StrToVec2DListMap map[string]*Vec2DList `protobuf:"bytes,2,rep,name=strToVec2DListMap,proto3" json:"strToVec2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StrToPolygon2DListMap map[string]*Polygon2DList `protobuf:"bytes,3,rep,name=strToPolygon2DListMap,proto3" json:"strToPolygon2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StageDiscreteW int32 `protobuf:"varint,4,opt,name=stageDiscreteW,proto3" json:"stageDiscreteW,omitempty"` - StageDiscreteH int32 `protobuf:"varint,5,opt,name=stageDiscreteH,proto3" json:"stageDiscreteH,omitempty"` - StageTileW int32 `protobuf:"varint,6,opt,name=stageTileW,proto3" json:"stageTileW,omitempty"` - StageTileH int32 `protobuf:"varint,7,opt,name=stageTileH,proto3" json:"stageTileH,omitempty"` - IntervalToPing int32 `protobuf:"varint,8,opt,name=intervalToPing,proto3" json:"intervalToPing,omitempty"` - WillKickIfInactiveFor int32 `protobuf:"varint,9,opt,name=willKickIfInactiveFor,proto3" json:"willKickIfInactiveFor,omitempty"` - BoundRoomId int32 `protobuf:"varint,10,opt,name=boundRoomId,proto3" json:"boundRoomId,omitempty"` - BattleDurationNanos int64 `protobuf:"varint,11,opt,name=battleDurationNanos,proto3" json:"battleDurationNanos,omitempty"` - ServerFps int32 `protobuf:"varint,12,opt,name=serverFps,proto3" json:"serverFps,omitempty"` - InputDelayFrames int32 `protobuf:"varint,13,opt,name=inputDelayFrames,proto3" json:"inputDelayFrames,omitempty"` - InputScaleFrames uint32 `protobuf:"varint,14,opt,name=inputScaleFrames,proto3" json:"inputScaleFrames,omitempty"` - NstDelayFrames int32 `protobuf:"varint,15,opt,name=nstDelayFrames,proto3" json:"nstDelayFrames,omitempty"` - InputFrameUpsyncDelayTolerance int32 `protobuf:"varint,16,opt,name=inputFrameUpsyncDelayTolerance,proto3" json:"inputFrameUpsyncDelayTolerance,omitempty"` - MaxChasingRenderFramesPerUpdate int32 `protobuf:"varint,17,opt,name=maxChasingRenderFramesPerUpdate,proto3" json:"maxChasingRenderFramesPerUpdate,omitempty"` - PlayerBattleState int32 `protobuf:"varint,18,opt,name=playerBattleState,proto3" json:"playerBattleState,omitempty"` - RollbackEstimatedDt float64 `protobuf:"fixed64,19,opt,name=rollbackEstimatedDt,proto3" json:"rollbackEstimatedDt,omitempty"` - RollbackEstimatedDtMillis float64 `protobuf:"fixed64,20,opt,name=rollbackEstimatedDtMillis,proto3" json:"rollbackEstimatedDtMillis,omitempty"` - RollbackEstimatedDtNanos int64 `protobuf:"varint,21,opt,name=rollbackEstimatedDtNanos,proto3" json:"rollbackEstimatedDtNanos,omitempty"` -} - -func (x *BattleColliderInfo) Reset() { - *x = BattleColliderInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BattleColliderInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BattleColliderInfo) ProtoMessage() {} - -func (x *BattleColliderInfo) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BattleColliderInfo.ProtoReflect.Descriptor instead. -func (*BattleColliderInfo) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{5} -} - -func (x *BattleColliderInfo) GetStageName() string { - if x != nil { - return x.StageName - } - return "" -} - -func (x *BattleColliderInfo) GetStrToVec2DListMap() map[string]*Vec2DList { - if x != nil { - return x.StrToVec2DListMap - } - return nil -} - -func (x *BattleColliderInfo) GetStrToPolygon2DListMap() map[string]*Polygon2DList { - if x != nil { - return x.StrToPolygon2DListMap - } - return nil -} - -func (x *BattleColliderInfo) GetStageDiscreteW() int32 { - if x != nil { - return x.StageDiscreteW - } - return 0 -} - -func (x *BattleColliderInfo) GetStageDiscreteH() int32 { - if x != nil { - return x.StageDiscreteH - } - return 0 -} - -func (x *BattleColliderInfo) GetStageTileW() int32 { - if x != nil { - return x.StageTileW - } - return 0 -} - -func (x *BattleColliderInfo) GetStageTileH() int32 { - if x != nil { - return x.StageTileH - } - return 0 -} - -func (x *BattleColliderInfo) GetIntervalToPing() int32 { - if x != nil { - return x.IntervalToPing - } - return 0 -} - -func (x *BattleColliderInfo) GetWillKickIfInactiveFor() int32 { - if x != nil { - return x.WillKickIfInactiveFor - } - return 0 -} - -func (x *BattleColliderInfo) GetBoundRoomId() int32 { - if x != nil { - return x.BoundRoomId - } - return 0 -} - -func (x *BattleColliderInfo) GetBattleDurationNanos() int64 { - if x != nil { - return x.BattleDurationNanos - } - return 0 -} - -func (x *BattleColliderInfo) GetServerFps() int32 { - if x != nil { - return x.ServerFps - } - return 0 -} - -func (x *BattleColliderInfo) GetInputDelayFrames() int32 { - if x != nil { - return x.InputDelayFrames - } - return 0 -} - -func (x *BattleColliderInfo) GetInputScaleFrames() uint32 { - if x != nil { - return x.InputScaleFrames - } - return 0 -} - -func (x *BattleColliderInfo) GetNstDelayFrames() int32 { - if x != nil { - return x.NstDelayFrames - } - return 0 -} - -func (x *BattleColliderInfo) GetInputFrameUpsyncDelayTolerance() int32 { - if x != nil { - return x.InputFrameUpsyncDelayTolerance - } - return 0 -} - -func (x *BattleColliderInfo) GetMaxChasingRenderFramesPerUpdate() int32 { - if x != nil { - return x.MaxChasingRenderFramesPerUpdate - } - return 0 -} - -func (x *BattleColliderInfo) GetPlayerBattleState() int32 { - if x != nil { - return x.PlayerBattleState - } - return 0 -} - -func (x *BattleColliderInfo) GetRollbackEstimatedDt() float64 { - if x != nil { - return x.RollbackEstimatedDt - } - return 0 -} - -func (x *BattleColliderInfo) GetRollbackEstimatedDtMillis() float64 { - if x != nil { - return x.RollbackEstimatedDtMillis - } - return 0 -} - -func (x *BattleColliderInfo) GetRollbackEstimatedDtNanos() int64 { - if x != nil { - return x.RollbackEstimatedDtNanos - } - return 0 -} - -type Player struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - X float64 `protobuf:"fixed64,2,opt,name=x,proto3" json:"x,omitempty"` - Y float64 `protobuf:"fixed64,3,opt,name=y,proto3" json:"y,omitempty"` - Dir *Direction `protobuf:"bytes,4,opt,name=dir,proto3" json:"dir,omitempty"` - Speed float64 `protobuf:"fixed64,5,opt,name=speed,proto3" json:"speed,omitempty"` - BattleState int32 `protobuf:"varint,6,opt,name=battleState,proto3" json:"battleState,omitempty"` - LastMoveGmtMillis int32 `protobuf:"varint,7,opt,name=lastMoveGmtMillis,proto3" json:"lastMoveGmtMillis,omitempty"` - Score int32 `protobuf:"varint,10,opt,name=score,proto3" json:"score,omitempty"` - Removed bool `protobuf:"varint,11,opt,name=removed,proto3" json:"removed,omitempty"` - JoinIndex int32 `protobuf:"varint,12,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` -} - -func (x *Player) Reset() { - *x = Player{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Player) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Player) ProtoMessage() {} - -func (x *Player) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Player.ProtoReflect.Descriptor instead. -func (*Player) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{6} -} - -func (x *Player) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Player) GetX() float64 { - if x != nil { - return x.X - } - return 0 -} - -func (x *Player) GetY() float64 { - if x != nil { - return x.Y - } - return 0 -} - -func (x *Player) GetDir() *Direction { - if x != nil { - return x.Dir - } - return nil -} - -func (x *Player) GetSpeed() float64 { - if x != nil { - return x.Speed - } - return 0 -} - -func (x *Player) GetBattleState() int32 { - if x != nil { - return x.BattleState - } - return 0 -} - -func (x *Player) GetLastMoveGmtMillis() int32 { - if x != nil { - return x.LastMoveGmtMillis - } - return 0 -} - -func (x *Player) GetScore() int32 { - if x != nil { - return x.Score - } - return 0 -} - -func (x *Player) GetRemoved() bool { - if x != nil { - return x.Removed - } - return false -} - -func (x *Player) GetJoinIndex() int32 { - if x != nil { - return x.JoinIndex - } - return 0 -} - -type PlayerMeta struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - DisplayName string `protobuf:"bytes,3,opt,name=displayName,proto3" json:"displayName,omitempty"` - Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` - JoinIndex int32 `protobuf:"varint,5,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` -} - -func (x *PlayerMeta) Reset() { - *x = PlayerMeta{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlayerMeta) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlayerMeta) ProtoMessage() {} - -func (x *PlayerMeta) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlayerMeta.ProtoReflect.Descriptor instead. -func (*PlayerMeta) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{7} -} - -func (x *PlayerMeta) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *PlayerMeta) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PlayerMeta) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" -} - -func (x *PlayerMeta) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *PlayerMeta) GetJoinIndex() int32 { - if x != nil { - return x.JoinIndex - } - return 0 -} - -type InputFrameUpsync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - InputFrameId int32 `protobuf:"varint,1,opt,name=inputFrameId,proto3" json:"inputFrameId,omitempty"` - EncodedDir int32 `protobuf:"varint,6,opt,name=encodedDir,proto3" json:"encodedDir,omitempty"` -} - -func (x *InputFrameUpsync) Reset() { - *x = InputFrameUpsync{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputFrameUpsync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputFrameUpsync) ProtoMessage() {} - -func (x *InputFrameUpsync) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputFrameUpsync.ProtoReflect.Descriptor instead. -func (*InputFrameUpsync) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{8} -} - -func (x *InputFrameUpsync) GetInputFrameId() int32 { - if x != nil { - return x.InputFrameId - } - return 0 -} - -func (x *InputFrameUpsync) GetEncodedDir() int32 { - if x != nil { - return x.EncodedDir - } - return 0 -} - -type InputFrameDownsync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - InputFrameId int32 `protobuf:"varint,1,opt,name=inputFrameId,proto3" json:"inputFrameId,omitempty"` - InputList []uint64 `protobuf:"varint,2,rep,packed,name=inputList,proto3" json:"inputList,omitempty"` // Indexed by "joinIndex", we try to compress the "single player input" into 1 word (64-bit for 64-bit Golang runtime) because atomic compare-and-swap only works on 1 word. Although CAS on custom struct is possible in Golang 1.19 https://pkg.go.dev/sync/atomic@go1.19.1#Value.CompareAndSwap, using a single word is still faster whenever possible. - ConfirmedList uint64 `protobuf:"varint,3,opt,name=confirmedList,proto3" json:"confirmedList,omitempty"` // Indexed by "joinIndex", same compression concern as above -} - -func (x *InputFrameDownsync) Reset() { - *x = InputFrameDownsync{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputFrameDownsync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputFrameDownsync) ProtoMessage() {} - -func (x *InputFrameDownsync) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputFrameDownsync.ProtoReflect.Descriptor instead. -func (*InputFrameDownsync) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{9} -} - -func (x *InputFrameDownsync) GetInputFrameId() int32 { - if x != nil { - return x.InputFrameId - } - return 0 -} - -func (x *InputFrameDownsync) GetInputList() []uint64 { - if x != nil { - return x.InputList - } - return nil -} - -func (x *InputFrameDownsync) GetConfirmedList() uint64 { - if x != nil { - return x.ConfirmedList - } - return 0 -} - -type HeartbeatUpsync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientTimestamp int64 `protobuf:"varint,1,opt,name=clientTimestamp,proto3" json:"clientTimestamp,omitempty"` -} - -func (x *HeartbeatUpsync) Reset() { - *x = HeartbeatUpsync{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeartbeatUpsync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeartbeatUpsync) ProtoMessage() {} - -func (x *HeartbeatUpsync) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeartbeatUpsync.ProtoReflect.Descriptor instead. -func (*HeartbeatUpsync) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{10} -} - -func (x *HeartbeatUpsync) GetClientTimestamp() int64 { - if x != nil { - return x.ClientTimestamp - } - return 0 -} - -type RoomDownsyncFrame struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Players map[int32]*Player `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - CountdownNanos int64 `protobuf:"varint,3,opt,name=countdownNanos,proto3" json:"countdownNanos,omitempty"` - PlayerMetas map[int32]*PlayerMeta `protobuf:"bytes,4,rep,name=playerMetas,proto3" json:"playerMetas,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *RoomDownsyncFrame) Reset() { - *x = RoomDownsyncFrame{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RoomDownsyncFrame) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RoomDownsyncFrame) ProtoMessage() {} - -func (x *RoomDownsyncFrame) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RoomDownsyncFrame.ProtoReflect.Descriptor instead. -func (*RoomDownsyncFrame) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{11} -} - -func (x *RoomDownsyncFrame) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *RoomDownsyncFrame) GetPlayers() map[int32]*Player { - if x != nil { - return x.Players - } - return nil -} - -func (x *RoomDownsyncFrame) GetCountdownNanos() int64 { - if x != nil { - return x.CountdownNanos - } - return 0 -} - -func (x *RoomDownsyncFrame) GetPlayerMetas() map[int32]*PlayerMeta { - if x != nil { - return x.PlayerMetas - } - return nil -} - -type WsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MsgId int32 `protobuf:"varint,1,opt,name=msgId,proto3" json:"msgId,omitempty"` - PlayerId int32 `protobuf:"varint,2,opt,name=playerId,proto3" json:"playerId,omitempty"` - Act int32 `protobuf:"varint,3,opt,name=act,proto3" json:"act,omitempty"` - JoinIndex int32 `protobuf:"varint,4,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` - AckingFrameId int32 `protobuf:"varint,5,opt,name=ackingFrameId,proto3" json:"ackingFrameId,omitempty"` - AckingInputFrameId int32 `protobuf:"varint,6,opt,name=ackingInputFrameId,proto3" json:"ackingInputFrameId,omitempty"` - InputFrameUpsyncBatch []*InputFrameUpsync `protobuf:"bytes,7,rep,name=inputFrameUpsyncBatch,proto3" json:"inputFrameUpsyncBatch,omitempty"` - Hb *HeartbeatUpsync `protobuf:"bytes,8,opt,name=hb,proto3" json:"hb,omitempty"` -} - -func (x *WsReq) Reset() { - *x = WsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WsReq) ProtoMessage() {} - -func (x *WsReq) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WsReq.ProtoReflect.Descriptor instead. -func (*WsReq) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{12} -} - -func (x *WsReq) GetMsgId() int32 { - if x != nil { - return x.MsgId - } - return 0 -} - -func (x *WsReq) GetPlayerId() int32 { - if x != nil { - return x.PlayerId - } - return 0 -} - -func (x *WsReq) GetAct() int32 { - if x != nil { - return x.Act - } - return 0 -} - -func (x *WsReq) GetJoinIndex() int32 { - if x != nil { - return x.JoinIndex - } - return 0 -} - -func (x *WsReq) GetAckingFrameId() int32 { - if x != nil { - return x.AckingFrameId - } - return 0 -} - -func (x *WsReq) GetAckingInputFrameId() int32 { - if x != nil { - return x.AckingInputFrameId - } - return 0 -} - -func (x *WsReq) GetInputFrameUpsyncBatch() []*InputFrameUpsync { - if x != nil { - return x.InputFrameUpsyncBatch - } - return nil -} - -func (x *WsReq) GetHb() *HeartbeatUpsync { - if x != nil { - return x.Hb - } - return nil -} - -type WsResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ret int32 `protobuf:"varint,1,opt,name=ret,proto3" json:"ret,omitempty"` - EchoedMsgId int32 `protobuf:"varint,2,opt,name=echoedMsgId,proto3" json:"echoedMsgId,omitempty"` - Act int32 `protobuf:"varint,3,opt,name=act,proto3" json:"act,omitempty"` - Rdf *RoomDownsyncFrame `protobuf:"bytes,4,opt,name=rdf,proto3" json:"rdf,omitempty"` - InputFrameDownsyncBatch []*InputFrameDownsync `protobuf:"bytes,5,rep,name=inputFrameDownsyncBatch,proto3" json:"inputFrameDownsyncBatch,omitempty"` - BciFrame *BattleColliderInfo `protobuf:"bytes,6,opt,name=bciFrame,proto3" json:"bciFrame,omitempty"` -} - -func (x *WsResp) Reset() { - *x = WsResp{} - if protoimpl.UnsafeEnabled { - mi := &file_room_downsync_frame_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WsResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WsResp) ProtoMessage() {} - -func (x *WsResp) ProtoReflect() protoreflect.Message { - mi := &file_room_downsync_frame_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WsResp.ProtoReflect.Descriptor instead. -func (*WsResp) Descriptor() ([]byte, []int) { - return file_room_downsync_frame_proto_rawDescGZIP(), []int{13} -} - -func (x *WsResp) GetRet() int32 { - if x != nil { - return x.Ret - } - return 0 -} - -func (x *WsResp) GetEchoedMsgId() int32 { - if x != nil { - return x.EchoedMsgId - } - return 0 -} - -func (x *WsResp) GetAct() int32 { - if x != nil { - return x.Act - } - return 0 -} - -func (x *WsResp) GetRdf() *RoomDownsyncFrame { - if x != nil { - return x.Rdf - } - return nil -} - -func (x *WsResp) GetInputFrameDownsyncBatch() []*InputFrameDownsync { - if x != nil { - return x.InputFrameDownsyncBatch - } - return nil -} - -func (x *WsResp) GetBciFrame() *BattleColliderInfo { - if x != nil { - return x.BciFrame - } - return nil -} - -var File_room_downsync_frame_proto protoreflect.FileDescriptor - -var file_room_downsync_frame_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x5f, - 0x66, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x74, 0x72, 0x65, - 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x22, 0x2b, 0x0a, 0x09, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x79, 0x22, 0x23, 0x0a, 0x05, 0x56, 0x65, 0x63, - 0x32, 0x44, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x78, - 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x79, 0x22, 0x6b, - 0x0a, 0x09, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x12, 0x2e, 0x0a, 0x06, 0x41, - 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, - 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x56, 0x65, - 0x63, 0x32, 0x44, 0x52, 0x06, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x12, 0x2e, 0x0a, 0x06, 0x50, - 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, - 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x56, 0x65, - 0x63, 0x32, 0x44, 0x52, 0x06, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x41, 0x0a, 0x09, 0x56, - 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x65, 0x63, 0x32, - 0x44, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, - 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x56, 0x65, - 0x63, 0x32, 0x44, 0x52, 0x09, 0x76, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x51, - 0x0a, 0x0d, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, - 0x40, 0x0a, 0x0d, 0x70, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, - 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, - 0x32, 0x44, 0x52, 0x0d, 0x70, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0xaa, 0x0a, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, - 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x67, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, - 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x68, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x56, - 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x3a, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x78, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, - 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, 0x32, - 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x73, - 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, - 0x12, 0x74, 0x0a, 0x15, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, - 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x78, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, - 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, - 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x15, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, - 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x57, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, - 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x57, 0x12, 0x26, - 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x48, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, - 0x63, 0x72, 0x65, 0x74, 0x65, 0x48, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x54, - 0x69, 0x6c, 0x65, 0x57, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x67, - 0x65, 0x54, 0x69, 0x6c, 0x65, 0x57, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x54, - 0x69, 0x6c, 0x65, 0x48, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x67, - 0x65, 0x54, 0x69, 0x6c, 0x65, 0x48, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x54, 0x6f, 0x50, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x54, 0x6f, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x34, - 0x0a, 0x15, 0x77, 0x69, 0x6c, 0x6c, 0x4b, 0x69, 0x63, 0x6b, 0x49, 0x66, 0x49, 0x6e, 0x61, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x46, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x77, - 0x69, 0x6c, 0x6c, 0x4b, 0x69, 0x63, 0x6b, 0x49, 0x66, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x46, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x6f, 0x6f, - 0x6d, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x6f, 0x75, 0x6e, 0x64, - 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x13, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x46, 0x70, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x46, 0x70, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x44, - 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, - 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x69, 0x6e, - 0x70, 0x75, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x26, - 0x0a, 0x0e, 0x6e, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, - 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x1e, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, - 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, - 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1e, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, - 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x48, - 0x0a, 0x1f, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x73, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1f, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x73, - 0x69, 0x6e, 0x67, 0x52, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, - 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x12, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x11, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x18, 0x13, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x13, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x45, 0x73, 0x74, - 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x12, 0x3c, 0x0a, 0x19, 0x72, 0x6f, 0x6c, 0x6c, - 0x62, 0x61, 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4d, - 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x01, 0x52, 0x19, 0x72, 0x6f, 0x6c, - 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, - 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x3a, 0x0a, 0x18, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4e, 0x61, 0x6e, - 0x6f, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x03, 0x52, 0x18, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4e, 0x61, 0x6e, - 0x6f, 0x73, 0x1a, 0x60, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, 0x32, 0x44, - 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, - 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x68, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, - 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x96, - 0x02, 0x0a, 0x06, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x01, 0x79, 0x12, 0x2c, 0x0a, 0x03, 0x64, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x78, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, - 0x64, 0x69, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x74, - 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, - 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x6c, - 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x76, 0x65, - 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, - 0x72, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, - 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, - 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x88, 0x01, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, - 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, - 0x61, 0x74, 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, - 0x65, 0x78, 0x22, 0x56, 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, - 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, - 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x22, 0x7c, 0x0a, 0x12, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, - 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, - 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x4c, 0x69, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4c, - 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x72, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x72, - 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x28, 0x0a, 0x0f, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x9f, 0x03, 0x0a, 0x11, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, - 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x49, 0x0a, 0x07, 0x70, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, - 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x52, - 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, - 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x12, 0x55, - 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, - 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, - 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x4d, 0x65, 0x74, 0x61, 0x73, 0x1a, 0x53, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, - 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5b, 0x0a, 0x10, 0x50, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x78, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xca, 0x02, 0x0a, 0x05, 0x57, 0x73, 0x52, 0x65, - 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x61, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, - 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, - 0x6d, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x63, 0x6b, 0x69, - 0x6e, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, 0x6b, - 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x57, 0x0a, 0x15, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, - 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x15, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x30, 0x0a, 0x02, 0x68, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, - 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, - 0x52, 0x02, 0x68, 0x62, 0x22, 0xa4, 0x02, 0x0a, 0x06, 0x57, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x10, 0x0a, 0x03, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x65, - 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, - 0x67, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x61, 0x63, 0x74, 0x12, 0x34, 0x0a, 0x03, 0x72, 0x64, 0x66, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x78, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, - 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x03, 0x72, 0x64, 0x66, 0x12, 0x5d, 0x0a, 0x17, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, - 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, - 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, - 0x63, 0x52, 0x17, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, - 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3f, 0x0a, 0x08, 0x62, 0x63, - 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, - 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x68, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x78, 0x2e, 0x42, - 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x42, 0x03, 0x5a, 0x01, 0x2e, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_room_downsync_frame_proto_rawDescOnce sync.Once - file_room_downsync_frame_proto_rawDescData = file_room_downsync_frame_proto_rawDesc -) - -func file_room_downsync_frame_proto_rawDescGZIP() []byte { - file_room_downsync_frame_proto_rawDescOnce.Do(func() { - file_room_downsync_frame_proto_rawDescData = protoimpl.X.CompressGZIP(file_room_downsync_frame_proto_rawDescData) - }) - return file_room_downsync_frame_proto_rawDescData -} - -var file_room_downsync_frame_proto_msgTypes = make([]protoimpl.MessageInfo, 18) -var file_room_downsync_frame_proto_goTypes = []interface{}{ - (*Direction)(nil), // 0: treasurehunterx.Direction - (*Vec2D)(nil), // 1: treasurehunterx.Vec2D - (*Polygon2D)(nil), // 2: treasurehunterx.Polygon2D - (*Vec2DList)(nil), // 3: treasurehunterx.Vec2DList - (*Polygon2DList)(nil), // 4: treasurehunterx.Polygon2DList - (*BattleColliderInfo)(nil), // 5: treasurehunterx.BattleColliderInfo - (*Player)(nil), // 6: treasurehunterx.Player - (*PlayerMeta)(nil), // 7: treasurehunterx.PlayerMeta - (*InputFrameUpsync)(nil), // 8: treasurehunterx.InputFrameUpsync - (*InputFrameDownsync)(nil), // 9: treasurehunterx.InputFrameDownsync - (*HeartbeatUpsync)(nil), // 10: treasurehunterx.HeartbeatUpsync - (*RoomDownsyncFrame)(nil), // 11: treasurehunterx.RoomDownsyncFrame - (*WsReq)(nil), // 12: treasurehunterx.WsReq - (*WsResp)(nil), // 13: treasurehunterx.WsResp - nil, // 14: treasurehunterx.BattleColliderInfo.StrToVec2DListMapEntry - nil, // 15: treasurehunterx.BattleColliderInfo.StrToPolygon2DListMapEntry - nil, // 16: treasurehunterx.RoomDownsyncFrame.PlayersEntry - nil, // 17: treasurehunterx.RoomDownsyncFrame.PlayerMetasEntry -} -var file_room_downsync_frame_proto_depIdxs = []int32{ - 1, // 0: treasurehunterx.Polygon2D.Anchor:type_name -> treasurehunterx.Vec2D - 1, // 1: treasurehunterx.Polygon2D.Points:type_name -> treasurehunterx.Vec2D - 1, // 2: treasurehunterx.Vec2DList.vec2DList:type_name -> treasurehunterx.Vec2D - 2, // 3: treasurehunterx.Polygon2DList.polygon2DList:type_name -> treasurehunterx.Polygon2D - 14, // 4: treasurehunterx.BattleColliderInfo.strToVec2DListMap:type_name -> treasurehunterx.BattleColliderInfo.StrToVec2DListMapEntry - 15, // 5: treasurehunterx.BattleColliderInfo.strToPolygon2DListMap:type_name -> treasurehunterx.BattleColliderInfo.StrToPolygon2DListMapEntry - 0, // 6: treasurehunterx.Player.dir:type_name -> treasurehunterx.Direction - 16, // 7: treasurehunterx.RoomDownsyncFrame.players:type_name -> treasurehunterx.RoomDownsyncFrame.PlayersEntry - 17, // 8: treasurehunterx.RoomDownsyncFrame.playerMetas:type_name -> treasurehunterx.RoomDownsyncFrame.PlayerMetasEntry - 8, // 9: treasurehunterx.WsReq.inputFrameUpsyncBatch:type_name -> treasurehunterx.InputFrameUpsync - 10, // 10: treasurehunterx.WsReq.hb:type_name -> treasurehunterx.HeartbeatUpsync - 11, // 11: treasurehunterx.WsResp.rdf:type_name -> treasurehunterx.RoomDownsyncFrame - 9, // 12: treasurehunterx.WsResp.inputFrameDownsyncBatch:type_name -> treasurehunterx.InputFrameDownsync - 5, // 13: treasurehunterx.WsResp.bciFrame:type_name -> treasurehunterx.BattleColliderInfo - 3, // 14: treasurehunterx.BattleColliderInfo.StrToVec2DListMapEntry.value:type_name -> treasurehunterx.Vec2DList - 4, // 15: treasurehunterx.BattleColliderInfo.StrToPolygon2DListMapEntry.value:type_name -> treasurehunterx.Polygon2DList - 6, // 16: treasurehunterx.RoomDownsyncFrame.PlayersEntry.value:type_name -> treasurehunterx.Player - 7, // 17: treasurehunterx.RoomDownsyncFrame.PlayerMetasEntry.value:type_name -> treasurehunterx.PlayerMeta - 18, // [18:18] is the sub-list for method output_type - 18, // [18:18] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name -} - -func init() { file_room_downsync_frame_proto_init() } -func file_room_downsync_frame_proto_init() { - if File_room_downsync_frame_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_room_downsync_frame_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Direction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Vec2D); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Polygon2D); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Vec2DList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Polygon2DList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BattleColliderInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Player); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlayerMeta); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputFrameUpsync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputFrameDownsync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeartbeatUpsync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RoomDownsyncFrame); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_room_downsync_frame_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WsResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_room_downsync_frame_proto_rawDesc, - NumEnums: 0, - NumMessages: 18, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_room_downsync_frame_proto_goTypes, - DependencyIndexes: file_room_downsync_frame_proto_depIdxs, - MessageInfos: file_room_downsync_frame_proto_msgTypes, - }.Build() - File_room_downsync_frame_proto = out.File - file_room_downsync_frame_proto_rawDesc = nil - file_room_downsync_frame_proto_goTypes = nil - file_room_downsync_frame_proto_depIdxs = nil -} diff --git a/battle_srv/protos/room_downsync_frame.pb.go b/battle_srv/protos/room_downsync_frame.pb.go new file mode 100644 index 0000000..4d140d5 --- /dev/null +++ b/battle_srv/protos/room_downsync_frame.pb.go @@ -0,0 +1,1264 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.4 +// source: room_downsync_frame.proto + +package protos + +import ( + sharedprotos "dnmshared/sharedprotos" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type BattleColliderInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StageName string `protobuf:"bytes,1,opt,name=stageName,proto3" json:"stageName,omitempty"` + StrToVec2DListMap map[string]*sharedprotos.Vec2DList `protobuf:"bytes,2,rep,name=strToVec2DListMap,proto3" json:"strToVec2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StrToPolygon2DListMap map[string]*sharedprotos.Polygon2DList `protobuf:"bytes,3,rep,name=strToPolygon2DListMap,proto3" json:"strToPolygon2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StageDiscreteW int32 `protobuf:"varint,4,opt,name=stageDiscreteW,proto3" json:"stageDiscreteW,omitempty"` + StageDiscreteH int32 `protobuf:"varint,5,opt,name=stageDiscreteH,proto3" json:"stageDiscreteH,omitempty"` + StageTileW int32 `protobuf:"varint,6,opt,name=stageTileW,proto3" json:"stageTileW,omitempty"` + StageTileH int32 `protobuf:"varint,7,opt,name=stageTileH,proto3" json:"stageTileH,omitempty"` + IntervalToPing int32 `protobuf:"varint,8,opt,name=intervalToPing,proto3" json:"intervalToPing,omitempty"` + WillKickIfInactiveFor int32 `protobuf:"varint,9,opt,name=willKickIfInactiveFor,proto3" json:"willKickIfInactiveFor,omitempty"` + BoundRoomId int32 `protobuf:"varint,10,opt,name=boundRoomId,proto3" json:"boundRoomId,omitempty"` + BattleDurationNanos int64 `protobuf:"varint,11,opt,name=battleDurationNanos,proto3" json:"battleDurationNanos,omitempty"` + ServerFps int32 `protobuf:"varint,12,opt,name=serverFps,proto3" json:"serverFps,omitempty"` + InputDelayFrames int32 `protobuf:"varint,13,opt,name=inputDelayFrames,proto3" json:"inputDelayFrames,omitempty"` + InputScaleFrames uint32 `protobuf:"varint,14,opt,name=inputScaleFrames,proto3" json:"inputScaleFrames,omitempty"` + NstDelayFrames int32 `protobuf:"varint,15,opt,name=nstDelayFrames,proto3" json:"nstDelayFrames,omitempty"` + InputFrameUpsyncDelayTolerance int32 `protobuf:"varint,16,opt,name=inputFrameUpsyncDelayTolerance,proto3" json:"inputFrameUpsyncDelayTolerance,omitempty"` + MaxChasingRenderFramesPerUpdate int32 `protobuf:"varint,17,opt,name=maxChasingRenderFramesPerUpdate,proto3" json:"maxChasingRenderFramesPerUpdate,omitempty"` + PlayerBattleState int32 `protobuf:"varint,18,opt,name=playerBattleState,proto3" json:"playerBattleState,omitempty"` + RollbackEstimatedDtMillis float64 `protobuf:"fixed64,19,opt,name=rollbackEstimatedDtMillis,proto3" json:"rollbackEstimatedDtMillis,omitempty"` + RollbackEstimatedDtNanos int64 `protobuf:"varint,20,opt,name=rollbackEstimatedDtNanos,proto3" json:"rollbackEstimatedDtNanos,omitempty"` + WorldToVirtualGridRatio float64 `protobuf:"fixed64,21,opt,name=worldToVirtualGridRatio,proto3" json:"worldToVirtualGridRatio,omitempty"` + VirtualGridToWorldRatio float64 `protobuf:"fixed64,22,opt,name=virtualGridToWorldRatio,proto3" json:"virtualGridToWorldRatio,omitempty"` +} + +func (x *BattleColliderInfo) Reset() { + *x = BattleColliderInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BattleColliderInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BattleColliderInfo) ProtoMessage() {} + +func (x *BattleColliderInfo) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BattleColliderInfo.ProtoReflect.Descriptor instead. +func (*BattleColliderInfo) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{0} +} + +func (x *BattleColliderInfo) GetStageName() string { + if x != nil { + return x.StageName + } + return "" +} + +func (x *BattleColliderInfo) GetStrToVec2DListMap() map[string]*sharedprotos.Vec2DList { + if x != nil { + return x.StrToVec2DListMap + } + return nil +} + +func (x *BattleColliderInfo) GetStrToPolygon2DListMap() map[string]*sharedprotos.Polygon2DList { + if x != nil { + return x.StrToPolygon2DListMap + } + return nil +} + +func (x *BattleColliderInfo) GetStageDiscreteW() int32 { + if x != nil { + return x.StageDiscreteW + } + return 0 +} + +func (x *BattleColliderInfo) GetStageDiscreteH() int32 { + if x != nil { + return x.StageDiscreteH + } + return 0 +} + +func (x *BattleColliderInfo) GetStageTileW() int32 { + if x != nil { + return x.StageTileW + } + return 0 +} + +func (x *BattleColliderInfo) GetStageTileH() int32 { + if x != nil { + return x.StageTileH + } + return 0 +} + +func (x *BattleColliderInfo) GetIntervalToPing() int32 { + if x != nil { + return x.IntervalToPing + } + return 0 +} + +func (x *BattleColliderInfo) GetWillKickIfInactiveFor() int32 { + if x != nil { + return x.WillKickIfInactiveFor + } + return 0 +} + +func (x *BattleColliderInfo) GetBoundRoomId() int32 { + if x != nil { + return x.BoundRoomId + } + return 0 +} + +func (x *BattleColliderInfo) GetBattleDurationNanos() int64 { + if x != nil { + return x.BattleDurationNanos + } + return 0 +} + +func (x *BattleColliderInfo) GetServerFps() int32 { + if x != nil { + return x.ServerFps + } + return 0 +} + +func (x *BattleColliderInfo) GetInputDelayFrames() int32 { + if x != nil { + return x.InputDelayFrames + } + return 0 +} + +func (x *BattleColliderInfo) GetInputScaleFrames() uint32 { + if x != nil { + return x.InputScaleFrames + } + return 0 +} + +func (x *BattleColliderInfo) GetNstDelayFrames() int32 { + if x != nil { + return x.NstDelayFrames + } + return 0 +} + +func (x *BattleColliderInfo) GetInputFrameUpsyncDelayTolerance() int32 { + if x != nil { + return x.InputFrameUpsyncDelayTolerance + } + return 0 +} + +func (x *BattleColliderInfo) GetMaxChasingRenderFramesPerUpdate() int32 { + if x != nil { + return x.MaxChasingRenderFramesPerUpdate + } + return 0 +} + +func (x *BattleColliderInfo) GetPlayerBattleState() int32 { + if x != nil { + return x.PlayerBattleState + } + return 0 +} + +func (x *BattleColliderInfo) GetRollbackEstimatedDtMillis() float64 { + if x != nil { + return x.RollbackEstimatedDtMillis + } + return 0 +} + +func (x *BattleColliderInfo) GetRollbackEstimatedDtNanos() int64 { + if x != nil { + return x.RollbackEstimatedDtNanos + } + return 0 +} + +func (x *BattleColliderInfo) GetWorldToVirtualGridRatio() float64 { + if x != nil { + return x.WorldToVirtualGridRatio + } + return 0 +} + +func (x *BattleColliderInfo) GetVirtualGridToWorldRatio() float64 { + if x != nil { + return x.VirtualGridToWorldRatio + } + return 0 +} + +type PlayerDownsync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + VirtualGridX int32 `protobuf:"varint,2,opt,name=virtualGridX,proto3" json:"virtualGridX,omitempty"` + VirtualGridY int32 `protobuf:"varint,3,opt,name=virtualGridY,proto3" json:"virtualGridY,omitempty"` + Dir *sharedprotos.Direction `protobuf:"bytes,4,opt,name=dir,proto3" json:"dir,omitempty"` + Speed int32 `protobuf:"varint,5,opt,name=speed,proto3" json:"speed,omitempty"` // in terms of virtual grid units + BattleState int32 `protobuf:"varint,6,opt,name=battleState,proto3" json:"battleState,omitempty"` + LastMoveGmtMillis int32 `protobuf:"varint,7,opt,name=lastMoveGmtMillis,proto3" json:"lastMoveGmtMillis,omitempty"` + Score int32 `protobuf:"varint,10,opt,name=score,proto3" json:"score,omitempty"` + Removed bool `protobuf:"varint,11,opt,name=removed,proto3" json:"removed,omitempty"` + JoinIndex int32 `protobuf:"varint,12,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` +} + +func (x *PlayerDownsync) Reset() { + *x = PlayerDownsync{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PlayerDownsync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlayerDownsync) ProtoMessage() {} + +func (x *PlayerDownsync) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlayerDownsync.ProtoReflect.Descriptor instead. +func (*PlayerDownsync) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{1} +} + +func (x *PlayerDownsync) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *PlayerDownsync) GetVirtualGridX() int32 { + if x != nil { + return x.VirtualGridX + } + return 0 +} + +func (x *PlayerDownsync) GetVirtualGridY() int32 { + if x != nil { + return x.VirtualGridY + } + return 0 +} + +func (x *PlayerDownsync) GetDir() *sharedprotos.Direction { + if x != nil { + return x.Dir + } + return nil +} + +func (x *PlayerDownsync) GetSpeed() int32 { + if x != nil { + return x.Speed + } + return 0 +} + +func (x *PlayerDownsync) GetBattleState() int32 { + if x != nil { + return x.BattleState + } + return 0 +} + +func (x *PlayerDownsync) GetLastMoveGmtMillis() int32 { + if x != nil { + return x.LastMoveGmtMillis + } + return 0 +} + +func (x *PlayerDownsync) GetScore() int32 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *PlayerDownsync) GetRemoved() bool { + if x != nil { + return x.Removed + } + return false +} + +func (x *PlayerDownsync) GetJoinIndex() int32 { + if x != nil { + return x.JoinIndex + } + return 0 +} + +type PlayerDownsyncMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + DisplayName string `protobuf:"bytes,3,opt,name=displayName,proto3" json:"displayName,omitempty"` + Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` + JoinIndex int32 `protobuf:"varint,5,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` + ColliderRadius float64 `protobuf:"fixed64,6,opt,name=colliderRadius,proto3" json:"colliderRadius,omitempty"` +} + +func (x *PlayerDownsyncMeta) Reset() { + *x = PlayerDownsyncMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PlayerDownsyncMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlayerDownsyncMeta) ProtoMessage() {} + +func (x *PlayerDownsyncMeta) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlayerDownsyncMeta.ProtoReflect.Descriptor instead. +func (*PlayerDownsyncMeta) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{2} +} + +func (x *PlayerDownsyncMeta) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *PlayerDownsyncMeta) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PlayerDownsyncMeta) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *PlayerDownsyncMeta) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *PlayerDownsyncMeta) GetJoinIndex() int32 { + if x != nil { + return x.JoinIndex + } + return 0 +} + +func (x *PlayerDownsyncMeta) GetColliderRadius() float64 { + if x != nil { + return x.ColliderRadius + } + return 0 +} + +type InputFrameUpsync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InputFrameId int32 `protobuf:"varint,1,opt,name=inputFrameId,proto3" json:"inputFrameId,omitempty"` + EncodedDir int32 `protobuf:"varint,6,opt,name=encodedDir,proto3" json:"encodedDir,omitempty"` +} + +func (x *InputFrameUpsync) Reset() { + *x = InputFrameUpsync{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InputFrameUpsync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InputFrameUpsync) ProtoMessage() {} + +func (x *InputFrameUpsync) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InputFrameUpsync.ProtoReflect.Descriptor instead. +func (*InputFrameUpsync) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{3} +} + +func (x *InputFrameUpsync) GetInputFrameId() int32 { + if x != nil { + return x.InputFrameId + } + return 0 +} + +func (x *InputFrameUpsync) GetEncodedDir() int32 { + if x != nil { + return x.EncodedDir + } + return 0 +} + +type InputFrameDownsync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InputFrameId int32 `protobuf:"varint,1,opt,name=inputFrameId,proto3" json:"inputFrameId,omitempty"` + InputList []uint64 `protobuf:"varint,2,rep,packed,name=inputList,proto3" json:"inputList,omitempty"` // Indexed by "joinIndex", we try to compress the "single player input" into 1 word (64-bit for 64-bit Golang runtime) because atomic compare-and-swap only works on 1 word. Although CAS on custom struct is possible in Golang 1.19 https://pkg.go.dev/sync/atomic@go1.19.1#Value.CompareAndSwap, using a single word is still faster whenever possible. + ConfirmedList uint64 `protobuf:"varint,3,opt,name=confirmedList,proto3" json:"confirmedList,omitempty"` // Indexed by "joinIndex", same compression concern as above +} + +func (x *InputFrameDownsync) Reset() { + *x = InputFrameDownsync{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InputFrameDownsync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InputFrameDownsync) ProtoMessage() {} + +func (x *InputFrameDownsync) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InputFrameDownsync.ProtoReflect.Descriptor instead. +func (*InputFrameDownsync) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{4} +} + +func (x *InputFrameDownsync) GetInputFrameId() int32 { + if x != nil { + return x.InputFrameId + } + return 0 +} + +func (x *InputFrameDownsync) GetInputList() []uint64 { + if x != nil { + return x.InputList + } + return nil +} + +func (x *InputFrameDownsync) GetConfirmedList() uint64 { + if x != nil { + return x.ConfirmedList + } + return 0 +} + +type HeartbeatUpsync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientTimestamp int64 `protobuf:"varint,1,opt,name=clientTimestamp,proto3" json:"clientTimestamp,omitempty"` +} + +func (x *HeartbeatUpsync) Reset() { + *x = HeartbeatUpsync{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeartbeatUpsync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatUpsync) ProtoMessage() {} + +func (x *HeartbeatUpsync) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeartbeatUpsync.ProtoReflect.Descriptor instead. +func (*HeartbeatUpsync) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{5} +} + +func (x *HeartbeatUpsync) GetClientTimestamp() int64 { + if x != nil { + return x.ClientTimestamp + } + return 0 +} + +type RoomDownsyncFrame struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Players map[int32]*PlayerDownsync `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CountdownNanos int64 `protobuf:"varint,3,opt,name=countdownNanos,proto3" json:"countdownNanos,omitempty"` + PlayerMetas map[int32]*PlayerDownsyncMeta `protobuf:"bytes,4,rep,name=playerMetas,proto3" json:"playerMetas,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *RoomDownsyncFrame) Reset() { + *x = RoomDownsyncFrame{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoomDownsyncFrame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoomDownsyncFrame) ProtoMessage() {} + +func (x *RoomDownsyncFrame) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RoomDownsyncFrame.ProtoReflect.Descriptor instead. +func (*RoomDownsyncFrame) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{6} +} + +func (x *RoomDownsyncFrame) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *RoomDownsyncFrame) GetPlayers() map[int32]*PlayerDownsync { + if x != nil { + return x.Players + } + return nil +} + +func (x *RoomDownsyncFrame) GetCountdownNanos() int64 { + if x != nil { + return x.CountdownNanos + } + return 0 +} + +func (x *RoomDownsyncFrame) GetPlayerMetas() map[int32]*PlayerDownsyncMeta { + if x != nil { + return x.PlayerMetas + } + return nil +} + +type WsReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MsgId int32 `protobuf:"varint,1,opt,name=msgId,proto3" json:"msgId,omitempty"` + PlayerId int32 `protobuf:"varint,2,opt,name=playerId,proto3" json:"playerId,omitempty"` + Act int32 `protobuf:"varint,3,opt,name=act,proto3" json:"act,omitempty"` + JoinIndex int32 `protobuf:"varint,4,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` + AckingFrameId int32 `protobuf:"varint,5,opt,name=ackingFrameId,proto3" json:"ackingFrameId,omitempty"` + AckingInputFrameId int32 `protobuf:"varint,6,opt,name=ackingInputFrameId,proto3" json:"ackingInputFrameId,omitempty"` + InputFrameUpsyncBatch []*InputFrameUpsync `protobuf:"bytes,7,rep,name=inputFrameUpsyncBatch,proto3" json:"inputFrameUpsyncBatch,omitempty"` + Hb *HeartbeatUpsync `protobuf:"bytes,8,opt,name=hb,proto3" json:"hb,omitempty"` +} + +func (x *WsReq) Reset() { + *x = WsReq{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WsReq) ProtoMessage() {} + +func (x *WsReq) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WsReq.ProtoReflect.Descriptor instead. +func (*WsReq) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{7} +} + +func (x *WsReq) GetMsgId() int32 { + if x != nil { + return x.MsgId + } + return 0 +} + +func (x *WsReq) GetPlayerId() int32 { + if x != nil { + return x.PlayerId + } + return 0 +} + +func (x *WsReq) GetAct() int32 { + if x != nil { + return x.Act + } + return 0 +} + +func (x *WsReq) GetJoinIndex() int32 { + if x != nil { + return x.JoinIndex + } + return 0 +} + +func (x *WsReq) GetAckingFrameId() int32 { + if x != nil { + return x.AckingFrameId + } + return 0 +} + +func (x *WsReq) GetAckingInputFrameId() int32 { + if x != nil { + return x.AckingInputFrameId + } + return 0 +} + +func (x *WsReq) GetInputFrameUpsyncBatch() []*InputFrameUpsync { + if x != nil { + return x.InputFrameUpsyncBatch + } + return nil +} + +func (x *WsReq) GetHb() *HeartbeatUpsync { + if x != nil { + return x.Hb + } + return nil +} + +type WsResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ret int32 `protobuf:"varint,1,opt,name=ret,proto3" json:"ret,omitempty"` + EchoedMsgId int32 `protobuf:"varint,2,opt,name=echoedMsgId,proto3" json:"echoedMsgId,omitempty"` + Act int32 `protobuf:"varint,3,opt,name=act,proto3" json:"act,omitempty"` + Rdf *RoomDownsyncFrame `protobuf:"bytes,4,opt,name=rdf,proto3" json:"rdf,omitempty"` + InputFrameDownsyncBatch []*InputFrameDownsync `protobuf:"bytes,5,rep,name=inputFrameDownsyncBatch,proto3" json:"inputFrameDownsyncBatch,omitempty"` + BciFrame *BattleColliderInfo `protobuf:"bytes,6,opt,name=bciFrame,proto3" json:"bciFrame,omitempty"` +} + +func (x *WsResp) Reset() { + *x = WsResp{} + if protoimpl.UnsafeEnabled { + mi := &file_room_downsync_frame_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WsResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WsResp) ProtoMessage() {} + +func (x *WsResp) ProtoReflect() protoreflect.Message { + mi := &file_room_downsync_frame_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WsResp.ProtoReflect.Descriptor instead. +func (*WsResp) Descriptor() ([]byte, []int) { + return file_room_downsync_frame_proto_rawDescGZIP(), []int{8} +} + +func (x *WsResp) GetRet() int32 { + if x != nil { + return x.Ret + } + return 0 +} + +func (x *WsResp) GetEchoedMsgId() int32 { + if x != nil { + return x.EchoedMsgId + } + return 0 +} + +func (x *WsResp) GetAct() int32 { + if x != nil { + return x.Act + } + return 0 +} + +func (x *WsResp) GetRdf() *RoomDownsyncFrame { + if x != nil { + return x.Rdf + } + return nil +} + +func (x *WsResp) GetInputFrameDownsyncBatch() []*InputFrameDownsync { + if x != nil { + return x.InputFrameDownsyncBatch + } + return nil +} + +func (x *WsResp) GetBciFrame() *BattleColliderInfo { + if x != nil { + return x.BciFrame + } + return nil +} + +var File_room_downsync_frame_proto protoreflect.FileDescriptor + +var file_room_downsync_frame_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x5f, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x1a, 0x0e, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xd4, 0x0a, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, + 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, + 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x74, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5f, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x54, + 0x6f, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x74, + 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x2e, + 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, + 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x6b, 0x0a, 0x15, 0x73, 0x74, 0x72, + 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, + 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, + 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x15, 0x73, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, + 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, + 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x57, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, + 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x57, 0x12, 0x26, + 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, 0x63, 0x72, 0x65, 0x74, 0x65, 0x48, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x67, 0x65, 0x44, 0x69, 0x73, + 0x63, 0x72, 0x65, 0x74, 0x65, 0x48, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x54, + 0x69, 0x6c, 0x65, 0x57, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x67, + 0x65, 0x54, 0x69, 0x6c, 0x65, 0x57, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x54, + 0x69, 0x6c, 0x65, 0x48, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x67, + 0x65, 0x54, 0x69, 0x6c, 0x65, 0x48, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x54, 0x6f, 0x50, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x54, 0x6f, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x34, + 0x0a, 0x15, 0x77, 0x69, 0x6c, 0x6c, 0x4b, 0x69, 0x63, 0x6b, 0x49, 0x66, 0x49, 0x6e, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x46, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x77, + 0x69, 0x6c, 0x6c, 0x4b, 0x69, 0x63, 0x6b, 0x49, 0x66, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x46, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x6f, 0x6f, + 0x6d, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x6f, 0x75, 0x6e, 0x64, + 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x13, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x44, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x46, 0x70, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x46, 0x70, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x44, + 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, + 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x26, + 0x0a, 0x0e, 0x6e, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, + 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x1e, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, + 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1e, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, + 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x48, + 0x0a, 0x1f, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x73, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1f, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x73, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, + 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x11, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x19, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, + 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4d, 0x69, 0x6c, + 0x6c, 0x69, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x01, 0x52, 0x19, 0x72, 0x6f, 0x6c, 0x6c, 0x62, + 0x61, 0x63, 0x6b, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4d, 0x69, + 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x3a, 0x0a, 0x18, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4e, 0x61, 0x6e, 0x6f, 0x73, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x18, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x44, 0x74, 0x4e, 0x61, 0x6e, 0x6f, 0x73, + 0x12, 0x38, 0x0a, 0x17, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x54, 0x6f, 0x56, 0x69, 0x72, 0x74, 0x75, + 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x15, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x17, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x54, 0x6f, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, + 0x6c, 0x47, 0x72, 0x69, 0x64, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x38, 0x0a, 0x17, 0x76, 0x69, + 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x54, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, + 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x17, 0x76, 0x69, 0x72, + 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x54, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x52, + 0x61, 0x74, 0x69, 0x6f, 0x1a, 0x5d, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, + 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, + 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x65, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, + 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc7, 0x02, 0x0a, 0x0e, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, + 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x58, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, + 0x58, 0x12, 0x22, 0x0a, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, + 0x59, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, + 0x47, 0x72, 0x69, 0x64, 0x59, 0x12, 0x29, 0x0a, 0x03, 0x64, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x69, 0x72, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x61, 0x74, + 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, + 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, + 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0xb8, 0x01, 0x0a, 0x12, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, + 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, + 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, + 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6c, 0x6c, 0x69, + 0x64, 0x65, 0x72, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x0e, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, + 0x56, 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, + 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, + 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x64, 0x44, 0x69, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x65, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x22, 0x7c, 0x0a, 0x12, 0x49, 0x6e, 0x70, 0x75, 0x74, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, + 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x04, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, + 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, + 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, + 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, + 0x6f, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, + 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, + 0x1a, 0x52, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5a, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, + 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, + 0x63, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0xb8, 0x02, 0x0a, 0x05, 0x57, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, + 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x63, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x24, 0x0a, 0x0d, + 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, + 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, + 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x12, 0x4e, 0x0a, 0x15, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, + 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x15, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x12, 0x27, 0x0a, 0x02, 0x68, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, + 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x02, 0x68, 0x62, 0x22, 0x89, 0x02, 0x0a, 0x06, + 0x57, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x63, 0x68, 0x6f, + 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x65, + 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x63, 0x74, 0x12, 0x2b, 0x0a, 0x03, + 0x72, 0x64, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x52, 0x03, 0x72, 0x64, 0x66, 0x12, 0x54, 0x0a, 0x17, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, + 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x17, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, + 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, + 0x36, 0x0a, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, + 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x62, + 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x42, 0x13, 0x5a, 0x11, 0x62, 0x61, 0x74, 0x74, 0x6c, + 0x65, 0x5f, 0x73, 0x72, 0x76, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_room_downsync_frame_proto_rawDescOnce sync.Once + file_room_downsync_frame_proto_rawDescData = file_room_downsync_frame_proto_rawDesc +) + +func file_room_downsync_frame_proto_rawDescGZIP() []byte { + file_room_downsync_frame_proto_rawDescOnce.Do(func() { + file_room_downsync_frame_proto_rawDescData = protoimpl.X.CompressGZIP(file_room_downsync_frame_proto_rawDescData) + }) + return file_room_downsync_frame_proto_rawDescData +} + +var file_room_downsync_frame_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_room_downsync_frame_proto_goTypes = []interface{}{ + (*BattleColliderInfo)(nil), // 0: protos.BattleColliderInfo + (*PlayerDownsync)(nil), // 1: protos.PlayerDownsync + (*PlayerDownsyncMeta)(nil), // 2: protos.PlayerDownsyncMeta + (*InputFrameUpsync)(nil), // 3: protos.InputFrameUpsync + (*InputFrameDownsync)(nil), // 4: protos.InputFrameDownsync + (*HeartbeatUpsync)(nil), // 5: protos.HeartbeatUpsync + (*RoomDownsyncFrame)(nil), // 6: protos.RoomDownsyncFrame + (*WsReq)(nil), // 7: protos.WsReq + (*WsResp)(nil), // 8: protos.WsResp + nil, // 9: protos.BattleColliderInfo.StrToVec2DListMapEntry + nil, // 10: protos.BattleColliderInfo.StrToPolygon2DListMapEntry + nil, // 11: protos.RoomDownsyncFrame.PlayersEntry + nil, // 12: protos.RoomDownsyncFrame.PlayerMetasEntry + (*sharedprotos.Direction)(nil), // 13: sharedprotos.Direction + (*sharedprotos.Vec2DList)(nil), // 14: sharedprotos.Vec2DList + (*sharedprotos.Polygon2DList)(nil), // 15: sharedprotos.Polygon2DList +} +var file_room_downsync_frame_proto_depIdxs = []int32{ + 9, // 0: protos.BattleColliderInfo.strToVec2DListMap:type_name -> protos.BattleColliderInfo.StrToVec2DListMapEntry + 10, // 1: protos.BattleColliderInfo.strToPolygon2DListMap:type_name -> protos.BattleColliderInfo.StrToPolygon2DListMapEntry + 13, // 2: protos.PlayerDownsync.dir:type_name -> sharedprotos.Direction + 11, // 3: protos.RoomDownsyncFrame.players:type_name -> protos.RoomDownsyncFrame.PlayersEntry + 12, // 4: protos.RoomDownsyncFrame.playerMetas:type_name -> protos.RoomDownsyncFrame.PlayerMetasEntry + 3, // 5: protos.WsReq.inputFrameUpsyncBatch:type_name -> protos.InputFrameUpsync + 5, // 6: protos.WsReq.hb:type_name -> protos.HeartbeatUpsync + 6, // 7: protos.WsResp.rdf:type_name -> protos.RoomDownsyncFrame + 4, // 8: protos.WsResp.inputFrameDownsyncBatch:type_name -> protos.InputFrameDownsync + 0, // 9: protos.WsResp.bciFrame:type_name -> protos.BattleColliderInfo + 14, // 10: protos.BattleColliderInfo.StrToVec2DListMapEntry.value:type_name -> sharedprotos.Vec2DList + 15, // 11: protos.BattleColliderInfo.StrToPolygon2DListMapEntry.value:type_name -> sharedprotos.Polygon2DList + 1, // 12: protos.RoomDownsyncFrame.PlayersEntry.value:type_name -> protos.PlayerDownsync + 2, // 13: protos.RoomDownsyncFrame.PlayerMetasEntry.value:type_name -> protos.PlayerDownsyncMeta + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_room_downsync_frame_proto_init() } +func file_room_downsync_frame_proto_init() { + if File_room_downsync_frame_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_room_downsync_frame_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BattleColliderInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlayerDownsync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlayerDownsyncMeta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InputFrameUpsync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InputFrameDownsync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeartbeatUpsync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoomDownsyncFrame); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WsReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_downsync_frame_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WsResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_room_downsync_frame_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_room_downsync_frame_proto_goTypes, + DependencyIndexes: file_room_downsync_frame_proto_depIdxs, + MessageInfos: file_room_downsync_frame_proto_msgTypes, + }.Build() + File_room_downsync_frame_proto = out.File + file_room_downsync_frame_proto_rawDesc = nil + file_room_downsync_frame_proto_goTypes = nil + file_room_downsync_frame_proto_depIdxs = nil +} diff --git a/battle_srv/storage/mysql_manager.go b/battle_srv/storage/mysql_manager.go index bfc8175..fe64b62 100644 --- a/battle_srv/storage/mysql_manager.go +++ b/battle_srv/storage/mysql_manager.go @@ -1,7 +1,7 @@ package storage import ( - . "server/common" + . "battle_srv/common" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" diff --git a/battle_srv/storage/redis_manager.go b/battle_srv/storage/redis_manager.go index b977abf..cc67b8b 100644 --- a/battle_srv/storage/redis_manager.go +++ b/battle_srv/storage/redis_manager.go @@ -1,8 +1,8 @@ package storage import ( + . "battle_srv/common" "fmt" - . "server/common" "github.com/go-redis/redis" _ "github.com/go-sql-driver/mysql" diff --git a/battle_srv/ws/serve.go b/battle_srv/ws/serve.go index 0830d2c..c45d3cd 100644 --- a/battle_srv/ws/serve.go +++ b/battle_srv/ws/serve.go @@ -1,6 +1,9 @@ package ws import ( + . "battle_srv/common" + "battle_srv/models" + pb "battle_srv/protos" "container/heap" "fmt" "github.com/gin-gonic/gin" @@ -8,14 +11,12 @@ import ( "github.com/gorilla/websocket" "go.uber.org/zap" "net/http" - . "server/common" - "server/models" - pb "server/pb_output" "strconv" "sync/atomic" "time" . "dnmshared" + "runtime/debug" ) const ( @@ -104,7 +105,7 @@ func Serve(c *gin.Context) { } defer func() { if r := recover(); r != nil { - Logger.Warn("Recovered from: ", zap.Any("panic", r)) + Logger.Error("Recovered from: ", zap.Any("panic", r)) } }() /** @@ -246,8 +247,8 @@ func Serve(c *gin.Context) { bciFrame := &pb.BattleColliderInfo{ BoundRoomId: pRoom.Id, StageName: pRoom.StageName, - StrToVec2DListMap: models.ToPbVec2DListMap(pRoom.RawBattleStrToVec2DListMap), - StrToPolygon2DListMap: models.ToPbPolygon2DListMap(pRoom.RawBattleStrToPolygon2DListMap), + StrToVec2DListMap: pRoom.RawBattleStrToVec2DListMap, + StrToPolygon2DListMap: pRoom.RawBattleStrToPolygon2DListMap, StageDiscreteW: pRoom.StageDiscreteW, StageDiscreteH: pRoom.StageDiscreteH, StageTileW: pRoom.StageTileW, @@ -263,9 +264,11 @@ func Serve(c *gin.Context) { InputFrameUpsyncDelayTolerance: pRoom.InputFrameUpsyncDelayTolerance, MaxChasingRenderFramesPerUpdate: pRoom.MaxChasingRenderFramesPerUpdate, PlayerBattleState: pThePlayer.BattleState, // For frontend to know whether it's rejoining - RollbackEstimatedDt: pRoom.RollbackEstimatedDt, RollbackEstimatedDtMillis: pRoom.RollbackEstimatedDtMillis, RollbackEstimatedDtNanos: pRoom.RollbackEstimatedDtNanos, + + WorldToVirtualGridRatio: pRoom.WorldToVirtualGridRatio, + VirtualGridToWorldRatio: pRoom.VirtualGridToWorldRatio, } resp := &pb.WsResp{ @@ -354,7 +357,7 @@ func Serve(c *gin.Context) { receivingLoopAgainstPlayer := func() error { defer func() { if r := recover(); r != nil { - Logger.Warn("Goroutine `receivingLoopAgainstPlayer`, recovery spot#1, recovered from: ", zap.Any("panic", r)) + Logger.Error("Goroutine `receivingLoopAgainstPlayer`, recovery spot#1, recovered from: ", zap.Any("panic", r), zap.Any("callstack", debug.Stack())) } Logger.Info("Goroutine `receivingLoopAgainstPlayer` is stopped for:", zap.Any("playerId", playerId), zap.Any("roomId", pRoom.Id)) }() diff --git a/charts/AvoidingFloatingPointAccumulationErr.jpg b/charts/AvoidingFloatingPointAccumulationErr.jpg new file mode 100644 index 0000000..961c652 Binary files /dev/null and b/charts/AvoidingFloatingPointAccumulationErr.jpg differ diff --git a/charts/DelayNoMore.drawio b/charts/DelayNoMore.drawio index 9b88a81..0dbdfe1 100644 --- a/charts/DelayNoMore.drawio +++ b/charts/DelayNoMore.drawio @@ -1 +1 @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/collider_visualizer/go.mod b/collider_visualizer/go.mod index e05463a..9d2c1eb 100644 --- a/collider_visualizer/go.mod +++ b/collider_visualizer/go.mod @@ -3,11 +3,11 @@ module viscol go 1.19 require ( + dnmshared v0.0.0 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/hajimehoshi/ebiten/v2 v2.4.7 github.com/solarlune/resolv v0.5.1 golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 - dnmshared v0.0.0 ) require ( @@ -22,6 +22,7 @@ require ( golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105 // indirect golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect + google.golang.org/protobuf v1.28.1 // indirect ) replace dnmshared => ../dnmshared diff --git a/collider_visualizer/go.sum b/collider_visualizer/go.sum index 3eb8bba..376124f 100644 --- a/collider_visualizer/go.sum +++ b/collider_visualizer/go.sum @@ -7,6 +7,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220806181222-55e207c401ad h1:kX51IjbsJP github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220806181222-55e207c401ad/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hajimehoshi/bitmapfont/v2 v2.2.1 h1:y7zcy02/UgO24IL3COqYtrRZzhRucNBtmCo/SNU648k= github.com/hajimehoshi/bitmapfont/v2 v2.2.1/go.mod h1:wjrYAy8vKgj9JsFgnYAOK346/uvE22TlmqouzdnYIs0= github.com/hajimehoshi/ebiten/v2 v2.4.7 h1:XuvB7R0Rbw/O7g6vNU8gqr5b9e7MNhhAONMSsyreLDI= @@ -93,4 +95,8 @@ golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/collider_visualizer/worldColliderDisplay.go b/collider_visualizer/worldColliderDisplay.go index 21f301a..1d7a2db 100644 --- a/collider_visualizer/worldColliderDisplay.go +++ b/collider_visualizer/worldColliderDisplay.go @@ -2,6 +2,7 @@ package main import ( . "dnmshared" + . "dnmshared/sharedprotos" "fmt" "github.com/hajimehoshi/ebiten/v2" "github.com/solarlune/resolv" @@ -19,7 +20,7 @@ func (world *WorldColliderDisplay) Init() { func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTileW, stageTileH int32, playerPosMap StrToVec2DListMap, barrierMap StrToPolygon2DListMap) *WorldColliderDisplay { - playerList := *(playerPosMap["PlayerStartingPos"]) + playerPosList := *(playerPosMap["PlayerStartingPos"]) barrierList := *(barrierMap["Barrier"]) world := &WorldColliderDisplay{Game: game} @@ -32,20 +33,23 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi spaceOffsetX := float64(spaceW) * 0.5 spaceOffsetY := float64(spaceH) * 0.5 - playerColliderRadius := float64(32) - playerColliders := make([]*resolv.Object, len(playerList)) - space := resolv.NewSpace(int(spaceW), int(spaceH), 16, 16) - for i, player := range playerList { - playerCollider := GenerateRectCollider(player.X, player.Y, playerColliderRadius*2, playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset" - Logger.Info(fmt.Sprintf("Player Collider#%d: player.X=%v, player.Y=%v, radius=%v, spaceOffsetX=%v, spaceOffsetY=%v, shape=%v; calibrationCheckX=player.X-radius+spaceOffsetX=%v", i, player.X, player.Y, playerColliderRadius, spaceOffsetX, spaceOffsetY, playerCollider.Shape, player.X-playerColliderRadius+spaceOffsetX)) + virtualGridToWorldRatio := 0.1 + playerDefaultSpeed := 20 + minStep := (int(float64(playerDefaultSpeed)*virtualGridToWorldRatio) << 2) + playerColliderRadius := float64(24) + playerColliders := make([]*resolv.Object, len(playerPosList.Eles)) + space := resolv.NewSpace(int(spaceW), int(spaceH), minStep, minStep) + for i, playerPos := range playerPosList.Eles { + playerCollider := GenerateRectCollider(playerPos.X, playerPos.Y, playerColliderRadius*2, playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset" + Logger.Info(fmt.Sprintf("Player Collider#%d: player world pos =(%.2f, %.2f), shape=%v", i, playerPos.X, playerPos.Y, ConvexPolygonStr(playerCollider.Shape.(*resolv.ConvexPolygon)))) playerColliders[i] = playerCollider space.Add(playerCollider) } barrierLocalId := 0 - for _, barrierUnaligned := range barrierList { + for _, barrierUnaligned := range barrierList.Eles { barrierCollider := GenerateConvexPolygonCollider(barrierUnaligned, spaceOffsetX, spaceOffsetY, "Barrier") - Logger.Info(fmt.Sprintf("Added barrier: shape=%v", barrierCollider.Shape)) + Logger.Info(fmt.Sprintf("Added barrier: shape=%v", ConvexPolygonStr(barrierCollider.Shape.(*resolv.ConvexPolygon)))) space.Add(barrierCollider) barrierLocalId++ } @@ -54,24 +58,31 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi moveToCollide := true if moveToCollide { + newVx, newVy := int32(-2959), int32(-2261) + effPushback := Vec2D{X: float64(0), Y: float64(0)} toTestPlayerCollider := playerColliders[0] - oldDx, oldDy := -2.98, -50.0 - dx, dy := oldDx, oldDy - if collision := toTestPlayerCollider.Check(oldDx, oldDy, "Barrier"); collision != nil { - playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon) - barrierShape := collision.Objects[0].Shape.(*resolv.ConvexPolygon) - if overlapped, pushbackX, pushbackY := CalcPushbacks(oldDx, oldDy, playerShape, barrierShape); overlapped { - Logger.Info(fmt.Sprintf("Collided & overlapped: player.X=%v, player.Y=%v, oldDx=%v, oldDy=%v, playerShape=%v, toCheckBarrier=%v, pushbackX=%v, pushbackY=%v", toTestPlayerCollider.X, toTestPlayerCollider.Y, oldDx, oldDy, ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY)) - dx -= pushbackX - dy -= pushbackY - } else { - Logger.Info(fmt.Sprintf("Collider BUT not overlapped: player.X=%v, player.Y=%v, oldDx=%v, oldDy=%v, playerShape=%v, toCheckBarrier=%v", toTestPlayerCollider.X, toTestPlayerCollider.Y, oldDx, oldDy, ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape))) - } - } + toTestPlayerCollider.X, toTestPlayerCollider.Y = VirtualGridToPolygonColliderAnchorPos(newVx, newVy, playerColliderRadius, playerColliderRadius, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio) + + Logger.Info(fmt.Sprintf("Checking collision for virtual (%d, %d), now playerShape=%v", newVx, newVy, ConvexPolygonStr(toTestPlayerCollider.Shape.(*resolv.ConvexPolygon)))) - toTestPlayerCollider.X += dx - toTestPlayerCollider.Y += dy toTestPlayerCollider.Update() + if collision := toTestPlayerCollider.Check(0, 0); collision != nil { + playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon) + for _, obj := range collision.Objects { + barrierShape := obj.Shape.(*resolv.ConvexPolygon) + if overlapped, pushbackX, pushbackY, overlapResult := CalcPushbacks(0, 0, playerShape, barrierShape); overlapped { + Logger.Warn(fmt.Sprintf("Overlapped: a=%v, b=%v, pushbackX=%v, pushbackY=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY)) + effPushback.X += pushbackX + effPushback.Y += pushbackY + } else { + Logger.Warn(fmt.Sprintf("Collided BUT not overlapped: a=%v, b=%v, overlapResult=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), overlapResult)) + } + } + toTestPlayerCollider.X -= effPushback.X + toTestPlayerCollider.Y -= effPushback.Y + toTestPlayerCollider.Update() + Logger.Info(fmt.Sprintf("effPushback={%v, %v}", effPushback.X, effPushback.Y)) + } } return world diff --git a/dnmshared/geometry.go b/dnmshared/geometry.go index 638d8b6..a084208 100644 --- a/dnmshared/geometry.go +++ b/dnmshared/geometry.go @@ -1,47 +1,46 @@ package dnmshared import ( + . "dnmshared/sharedprotos" "math" ) -// Use type `float64` for json unmarshalling of numbers. -type Direction struct { - Dx int32 `json:"dx,omitempty"` - Dy int32 `json:"dy,omitempty"` -} - -type Vec2D struct { - X float64 `json:"x,omitempty"` - Y float64 `json:"y,omitempty"` -} - func NormVec2D(dx, dy float64) Vec2D { - return Vec2D{dy, -dx} + return Vec2D{X: dy, Y: -dx} } -type Polygon2D struct { - Anchor *Vec2D `json:"-"` // This "Polygon2D.Anchor" is used to be assigned to "B2BodyDef.Position", which in turn is used as the position of the FIRST POINT of the polygon. - Points []*Vec2D `json:"-"` +func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D { + // Transform again to put "anchor" at the top-left point of the bounding box for "resolv" + boundingBoxTL := &Vec2D{ + X: math.MaxFloat64, + Y: math.MaxFloat64, + } + for _, p := range input.Points { + if p.X < boundingBoxTL.X { + boundingBoxTL.X = p.X + } + if p.Y < boundingBoxTL.Y { + boundingBoxTL.Y = p.Y + } + } - /* - When used to represent a "polyline directly drawn in a `Tmx file`", we can initialize both "Anchor" and "Points" simultaneously. + // Now "input.Anchor" should move to "input.Anchor+boundingBoxTL", thus "boundingBoxTL" is also the value of the negative diff for all "input.Points" + output := &Polygon2D{ + Anchor: &Vec2D{ + X: input.Anchor.X + boundingBoxTL.X, + Y: input.Anchor.Y + boundingBoxTL.Y, + }, + Points: make([]*Vec2D, len(input.Points)), + } - Yet when used to represent a "polyline drawn in a `Tsx file`", we have to first initialize "Points w.r.t. center of the tile-rectangle", and then "Anchor(initially nil) of the tile positioned in the `Tmx file`". + for i, p := range input.Points { + output.Points[i] = &Vec2D{ + X: p.X - boundingBoxTL.X, + Y: p.Y - boundingBoxTL.Y, + } + } - Refer to https://shimo.im/docs/SmLJJhXm2C8XMzZT for more information. - */ - - /* - [WARNING] Used to cache "`TileWidth & TileHeight` of a Tsx file" only. - */ - TileWidth int - TileHeight int - - /* - [WARNING] Used to cache "`Width & TileHeight` of an object in Tmx file" only. - */ - TmxObjectWidth float64 - TmxObjectHeight float64 + return output } func Distance(pt1 *Vec2D, pt2 *Vec2D) float64 { diff --git a/dnmshared/go.mod b/dnmshared/go.mod index 5d40f79..919ac63 100644 --- a/dnmshared/go.mod +++ b/dnmshared/go.mod @@ -1,3 +1,3 @@ -module tiled +module dnmshared go 1.19 diff --git a/dnmshared/resolv_helper.go b/dnmshared/resolv_helper.go index f4b5d28..306d654 100644 --- a/dnmshared/resolv_helper.go +++ b/dnmshared/resolv_helper.go @@ -1,6 +1,7 @@ package dnmshared import ( + . "dnmshared/sharedprotos" "fmt" "github.com/kvartborg/vector" "github.com/solarlune/resolv" @@ -11,14 +12,15 @@ import ( func ConvexPolygonStr(body *resolv.ConvexPolygon) string { var s []string = make([]string, len(body.Points)) for i, p := range body.Points { - s[i] = fmt.Sprintf("[%v, %v]", p[0]+body.X, p[1]+body.Y) + s[i] = fmt.Sprintf("[%.2f, %.2f]", p[0]+body.X, p[1]+body.Y) } - return fmt.Sprintf("[%s]", strings.Join(s, ", ")) + return fmt.Sprintf("{\n%s\n}", strings.Join(s, ",\n")) } func GenerateRectCollider(origX, origY, w, h, spaceOffsetX, spaceOffsetY float64, tag string) *resolv.Object { - collider := resolv.NewObject(origX-w*0.5+spaceOffsetX, origY-h*0.5+spaceOffsetY, w, h, tag) + cx, cy := WorldToPolygonColliderAnchorPos(origX, origY, w*0.5, h*0.5, spaceOffsetX, spaceOffsetY) + collider := resolv.NewObject(cx, cy, w, h, tag) shape := resolv.NewRectangle(0, 0, w, h) collider.SetShape(shape) return collider @@ -54,7 +56,7 @@ func GenerateConvexPolygonCollider(unalignedSrc *Polygon2D, spaceOffsetX, spaceO return collider } -func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.ConvexPolygon) (bool, float64, float64) { +func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.ConvexPolygon) (bool, float64, float64, *SatResult) { origX, origY := playerShape.Position() defer func() { playerShape.SetPosition(origX, origY) @@ -70,9 +72,9 @@ func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.Conve } if overlapped := IsPolygonPairOverlapped(playerShape, barrierShape, overlapResult); overlapped { pushbackX, pushbackY := overlapResult.Overlap*overlapResult.OverlapX, overlapResult.Overlap*overlapResult.OverlapY - return true, pushbackX, pushbackY + return true, pushbackX, pushbackY, overlapResult } else { - return false, 0, 0 + return false, 0, 0, overlapResult } } @@ -218,3 +220,36 @@ func isPolygonPairSeparatedByDir(a, b *resolv.ConvexPolygon, e vector.Vector, re // the specified unit vector "e" doesn't separate "a" and "b", overlap result is generated return false } + +func WorldToVirtualGridPos(wx, wy, worldToVirtualGridRatio float64) (int32, int32) { + // [WARNING] Introduces loss of precision! + // In JavaScript floating numbers suffer from seemingly non-deterministic arithmetics, and even if certain libs solved this issue by approaches such as fixed-point-number, they might not be used in other libs -- e.g. the "collision libs" we're interested in -- thus couldn't kill all pains. + var virtualGridX int32 = int32(math.Round(wx * worldToVirtualGridRatio)) + var virtualGridY int32 = int32(math.Round(wy * worldToVirtualGridRatio)) + return virtualGridX, virtualGridY +} + +func VirtualGridToWorldPos(vx, vy int32, virtualGridToWorldRatio float64) (float64, float64) { + // No loss of precision + var wx float64 = float64(vx) * virtualGridToWorldRatio + var wy float64 = float64(vy) * virtualGridToWorldRatio + return wx, wy +} + +func WorldToPolygonColliderAnchorPos(wx, wy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) { + return wx - halfBoundingW + collisionSpaceOffsetX, wy - halfBoundingH + collisionSpaceOffsetY +} + +func PolygonColliderAnchorToWorldPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) { + return cx + halfBoundingW - collisionSpaceOffsetX, cy + halfBoundingH - collisionSpaceOffsetY +} + +func PolygonColliderAnchorToVirtualGridPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64, worldToVirtualGridRatio float64) (int32, int32) { + wx, wy := PolygonColliderAnchorToWorldPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY) + return WorldToVirtualGridPos(wx, wy, worldToVirtualGridRatio) +} + +func VirtualGridToPolygonColliderAnchorPos(vx, vy int32, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64, virtualGridToWorldRatio float64) (float64, float64) { + wx, wy := VirtualGridToWorldPos(vx, vy, virtualGridToWorldRatio) + return WorldToPolygonColliderAnchorPos(wx, wy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY) +} diff --git a/dnmshared/sharedprotos/geometry.pb.go b/dnmshared/sharedprotos/geometry.pb.go new file mode 100644 index 0000000..b96f64b --- /dev/null +++ b/dnmshared/sharedprotos/geometry.pb.go @@ -0,0 +1,427 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.4 +// source: geometry.proto + +package sharedprotos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Direction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Dx int32 `protobuf:"varint,1,opt,name=dx,proto3" json:"dx,omitempty"` + Dy int32 `protobuf:"varint,2,opt,name=dy,proto3" json:"dy,omitempty"` +} + +func (x *Direction) Reset() { + *x = Direction{} + if protoimpl.UnsafeEnabled { + mi := &file_geometry_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Direction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Direction) ProtoMessage() {} + +func (x *Direction) ProtoReflect() protoreflect.Message { + mi := &file_geometry_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Direction.ProtoReflect.Descriptor instead. +func (*Direction) Descriptor() ([]byte, []int) { + return file_geometry_proto_rawDescGZIP(), []int{0} +} + +func (x *Direction) GetDx() int32 { + if x != nil { + return x.Dx + } + return 0 +} + +func (x *Direction) GetDy() int32 { + if x != nil { + return x.Dy + } + return 0 +} + +type Vec2D struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + X float64 `protobuf:"fixed64,1,opt,name=x,proto3" json:"x,omitempty"` + Y float64 `protobuf:"fixed64,2,opt,name=y,proto3" json:"y,omitempty"` +} + +func (x *Vec2D) Reset() { + *x = Vec2D{} + if protoimpl.UnsafeEnabled { + mi := &file_geometry_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Vec2D) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vec2D) ProtoMessage() {} + +func (x *Vec2D) ProtoReflect() protoreflect.Message { + mi := &file_geometry_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Vec2D.ProtoReflect.Descriptor instead. +func (*Vec2D) Descriptor() ([]byte, []int) { + return file_geometry_proto_rawDescGZIP(), []int{1} +} + +func (x *Vec2D) GetX() float64 { + if x != nil { + return x.X + } + return 0 +} + +func (x *Vec2D) GetY() float64 { + if x != nil { + return x.Y + } + return 0 +} + +type Polygon2D struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Anchor *Vec2D `protobuf:"bytes,1,opt,name=anchor,proto3" json:"anchor,omitempty"` + Points []*Vec2D `protobuf:"bytes,2,rep,name=points,proto3" json:"points,omitempty"` +} + +func (x *Polygon2D) Reset() { + *x = Polygon2D{} + if protoimpl.UnsafeEnabled { + mi := &file_geometry_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Polygon2D) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Polygon2D) ProtoMessage() {} + +func (x *Polygon2D) ProtoReflect() protoreflect.Message { + mi := &file_geometry_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Polygon2D.ProtoReflect.Descriptor instead. +func (*Polygon2D) Descriptor() ([]byte, []int) { + return file_geometry_proto_rawDescGZIP(), []int{2} +} + +func (x *Polygon2D) GetAnchor() *Vec2D { + if x != nil { + return x.Anchor + } + return nil +} + +func (x *Polygon2D) GetPoints() []*Vec2D { + if x != nil { + return x.Points + } + return nil +} + +type Vec2DList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Eles []*Vec2D `protobuf:"bytes,1,rep,name=eles,proto3" json:"eles,omitempty"` +} + +func (x *Vec2DList) Reset() { + *x = Vec2DList{} + if protoimpl.UnsafeEnabled { + mi := &file_geometry_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Vec2DList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vec2DList) ProtoMessage() {} + +func (x *Vec2DList) ProtoReflect() protoreflect.Message { + mi := &file_geometry_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Vec2DList.ProtoReflect.Descriptor instead. +func (*Vec2DList) Descriptor() ([]byte, []int) { + return file_geometry_proto_rawDescGZIP(), []int{3} +} + +func (x *Vec2DList) GetEles() []*Vec2D { + if x != nil { + return x.Eles + } + return nil +} + +type Polygon2DList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Eles []*Polygon2D `protobuf:"bytes,1,rep,name=eles,proto3" json:"eles,omitempty"` +} + +func (x *Polygon2DList) Reset() { + *x = Polygon2DList{} + if protoimpl.UnsafeEnabled { + mi := &file_geometry_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Polygon2DList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Polygon2DList) ProtoMessage() {} + +func (x *Polygon2DList) ProtoReflect() protoreflect.Message { + mi := &file_geometry_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Polygon2DList.ProtoReflect.Descriptor instead. +func (*Polygon2DList) Descriptor() ([]byte, []int) { + return file_geometry_proto_rawDescGZIP(), []int{4} +} + +func (x *Polygon2DList) GetEles() []*Polygon2D { + if x != nil { + return x.Eles + } + return nil +} + +var File_geometry_proto protoreflect.FileDescriptor + +var file_geometry_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x2b, + 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x64, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x79, 0x22, 0x23, 0x0a, 0x05, 0x56, + 0x65, 0x63, 0x32, 0x44, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x79, + 0x22, 0x65, 0x0a, 0x09, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x12, 0x2b, 0x0a, + 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, + 0x32, 0x44, 0x52, 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, + 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x34, 0x0a, 0x09, 0x56, 0x65, 0x63, 0x32, 0x44, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x22, 0x3c, 0x0a, + 0x0d, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, + 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x79, + 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x52, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x42, 0x18, 0x5a, 0x16, 0x64, + 0x6e, 0x6d, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_geometry_proto_rawDescOnce sync.Once + file_geometry_proto_rawDescData = file_geometry_proto_rawDesc +) + +func file_geometry_proto_rawDescGZIP() []byte { + file_geometry_proto_rawDescOnce.Do(func() { + file_geometry_proto_rawDescData = protoimpl.X.CompressGZIP(file_geometry_proto_rawDescData) + }) + return file_geometry_proto_rawDescData +} + +var file_geometry_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_geometry_proto_goTypes = []interface{}{ + (*Direction)(nil), // 0: sharedprotos.Direction + (*Vec2D)(nil), // 1: sharedprotos.Vec2D + (*Polygon2D)(nil), // 2: sharedprotos.Polygon2D + (*Vec2DList)(nil), // 3: sharedprotos.Vec2DList + (*Polygon2DList)(nil), // 4: sharedprotos.Polygon2DList +} +var file_geometry_proto_depIdxs = []int32{ + 1, // 0: sharedprotos.Polygon2D.anchor:type_name -> sharedprotos.Vec2D + 1, // 1: sharedprotos.Polygon2D.points:type_name -> sharedprotos.Vec2D + 1, // 2: sharedprotos.Vec2DList.eles:type_name -> sharedprotos.Vec2D + 2, // 3: sharedprotos.Polygon2DList.eles:type_name -> sharedprotos.Polygon2D + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_geometry_proto_init() } +func file_geometry_proto_init() { + if File_geometry_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_geometry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Direction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_geometry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Vec2D); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_geometry_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Polygon2D); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_geometry_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Vec2DList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_geometry_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Polygon2DList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_geometry_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_geometry_proto_goTypes, + DependencyIndexes: file_geometry_proto_depIdxs, + MessageInfos: file_geometry_proto_msgTypes, + }.Build() + File_geometry_proto = out.File + file_geometry_proto_rawDesc = nil + file_geometry_proto_goTypes = nil + file_geometry_proto_depIdxs = nil +} diff --git a/dnmshared/tmx_parser.go b/dnmshared/tmx_parser.go index dccb287..0477567 100644 --- a/dnmshared/tmx_parser.go +++ b/dnmshared/tmx_parser.go @@ -3,6 +3,7 @@ package dnmshared import ( "bytes" "compress/zlib" + . "dnmshared/sharedprotos" "encoding/base64" "encoding/xml" "errors" @@ -173,8 +174,6 @@ func (l *TmxLayer) decodeBase64() ([]uint32, error) { return gids, nil } -type Vec2DList []*Vec2D -type Polygon2DList []*Polygon2D type StrToVec2DListMap map[string]*Vec2DList type StrToPolygon2DListMap map[string]*Polygon2DList @@ -233,10 +232,8 @@ func tsxPolylineToOffsetsWrtTileCenter(pTmxMapIns *TmxMap, singleObjInTsxFile *T pointsCount := len(singleValueArray) thePolygon2DFromPolyline := &Polygon2D{ - Anchor: nil, - Points: make([]*Vec2D, pointsCount), - TileWidth: pTsxIns.TileWidth, - TileHeight: pTsxIns.TileHeight, + Anchor: nil, + Points: make([]*Vec2D, pointsCount), } /* @@ -327,16 +324,17 @@ func DeserializeTsxToColliderDict(pTmxMapIns *TmxMap, byteArrOfTsxFile []byte, f if _, ok := theStrToPolygon2DListMap[key]; ok { pThePolygon2DList = theStrToPolygon2DListMap[key] } else { - thePolygon2DList := make(Polygon2DList, 0) - theStrToPolygon2DListMap[key] = &thePolygon2DList - pThePolygon2DList = theStrToPolygon2DListMap[key] + pThePolygon2DList = &Polygon2DList{ + Eles: make([]*Polygon2D, 0), + } + theStrToPolygon2DListMap[key] = pThePolygon2DList } thePolygon2DFromPolyline, err := tsxPolylineToOffsetsWrtTileCenter(pTmxMapIns, singleObj, singleObj.Polyline, pTsxIns) if nil != err { panic(err) } - *pThePolygon2DList = append(*pThePolygon2DList, thePolygon2DFromPolyline) + pThePolygon2DList.Eles = append(pThePolygon2DList.Eles, thePolygon2DFromPolyline) } } return nil @@ -352,8 +350,10 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP var pTheVec2DListToCache *Vec2DList _, ok := toRetStrToVec2DListMap[objGroup.Name] if false == ok { - theVec2DListToCache := make(Vec2DList, 0) - toRetStrToVec2DListMap[objGroup.Name] = &theVec2DListToCache + pTheVec2DListToCache = &Vec2DList{ + Eles: make([]*Vec2D, 0), + } + toRetStrToVec2DListMap[objGroup.Name] = pTheVec2DListToCache } pTheVec2DListToCache = toRetStrToVec2DListMap[objGroup.Name] for _, singleObjInTmxFile := range objGroup.Objects { @@ -362,17 +362,18 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP Y: singleObjInTmxFile.Y, } thePosInWorld := pTmxMapIns.continuousObjLayerOffsetToContinuousMapNodePos(theUntransformedPos) - *pTheVec2DListToCache = append(*pTheVec2DListToCache, &thePosInWorld) + pTheVec2DListToCache.Eles = append(pTheVec2DListToCache.Eles, &thePosInWorld) } case "Barrier": // Note that in this case, the "Polygon2D.Anchor" of each "TmxOrTsxObject" is exactly overlapping with "Polygon2D.Points[0]". var pThePolygon2DListToCache *Polygon2DList _, ok := toRetStrToPolygon2DListMap[objGroup.Name] if false == ok { - thePolygon2DListToCache := make(Polygon2DList, 0) - toRetStrToPolygon2DListMap[objGroup.Name] = &thePolygon2DListToCache + pThePolygon2DListToCache = &Polygon2DList{ + Eles: make([]*Polygon2D, 0), + } + toRetStrToPolygon2DListMap[objGroup.Name] = pThePolygon2DListToCache } - pThePolygon2DListToCache = toRetStrToPolygon2DListMap[objGroup.Name] for _, singleObjInTmxFile := range objGroup.Objects { if nil == singleObjInTmxFile.Polyline { @@ -386,7 +387,7 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP if nil != err { panic(err) } - *pThePolygon2DListToCache = append(*pThePolygon2DListToCache, thePolygon2DInWorld) + pThePolygon2DListToCache.Eles = append(pThePolygon2DListToCache.Eles, thePolygon2DInWorld) } default: } @@ -442,40 +443,3 @@ func (pTmxMapIns *TmxMap) continuousObjLayerOffsetToContinuousMapNodePos(continu return toRet } - -func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D { - // Transform again to put "anchor" at the top-left point of the bounding box for "resolv" - float64Max := float64(99999999999999.9) - boundingBoxTL := &Vec2D{ - X: float64Max, - Y: float64Max, - } - for _, p := range input.Points { - if p.X < boundingBoxTL.X { - boundingBoxTL.X = p.X - } - if p.Y < boundingBoxTL.Y { - boundingBoxTL.Y = p.Y - } - } - - // Now "input.Anchor" should move to "input.Anchor+boundingBoxTL", thus "boundingBoxTL" is also the value of the negative diff for all "input.Points" - output := &Polygon2D{ - Anchor: &Vec2D{ - X: input.Anchor.X + boundingBoxTL.X, - Y: input.Anchor.Y + boundingBoxTL.Y, - }, - Points: make([]*Vec2D, len(input.Points)), - TileWidth: input.TileWidth, - TileHeight: input.TileHeight, - } - - for i, p := range input.Points { - output.Points[i] = &Vec2D{ - X: p.X - boundingBoxTL.X, - Y: p.Y - boundingBoxTL.Y, - } - } - - return output -} diff --git a/frontend/assets/plugin_scripts/protobuf.js b/frontend/assets/plugin_scripts/protobuf.js deleted file mode 100644 index c3e1c02..0000000 --- a/frontend/assets/plugin_scripts/protobuf.js +++ /dev/null @@ -1,8726 +0,0 @@ -/*! - * protobuf.js v6.8.8 (c) 2016, daniel wirtz - * compiled thu, 19 jul 2018 00:33:25 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -(function(undefined){"use strict";(function prelude(modules, cache, entries) { - - // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS - // sources through a conflict-free require shim and is again wrapped within an iife that - // provides a minification-friendly `undefined` var plus a global "use strict" directive - // so that minification can remove the directives of each module. - - function $require(name) { - var $module = cache[name]; - if (!$module) - modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports); - return $module.exports; - } - - var protobuf = $require(entries[0]); - - // Expose globally - protobuf.util.global.protobuf = protobuf; - - // Be nice to AMD - if (typeof define === "function" && define.amd) - define(["long"], function(Long) { - if (Long && Long.isLong) { - protobuf.util.Long = Long; - protobuf.configure(); - } - return protobuf; - }); - - // Be nice to CommonJS - if (typeof module === "object" && module && module.exports) - module.exports = protobuf; - -})/* end of prelude */({1:[function(require,module,exports){ -"use strict"; -module.exports = asPromise; - -/** - * Callback as used by {@link util.asPromise}. - * @typedef asPromiseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {...*} params Additional arguments - * @returns {undefined} - */ - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -function asPromise(fn, ctx/*, varargs */) { - var params = new Array(arguments.length - 1), - offset = 0, - index = 2, - pending = true; - while (index < arguments.length) - params[offset++] = arguments[index++]; - return new Promise(function executor(resolve, reject) { - params[offset] = function callback(err/*, varargs */) { - if (pending) { - pending = false; - if (err) - reject(err); - else { - var params = new Array(arguments.length - 1), - offset = 0; - while (offset < params.length) - params[offset++] = arguments[offset]; - resolve.apply(null, params); - } - } - }; - try { - fn.apply(ctx || null, params); - } catch (err) { - if (pending) { - pending = false; - reject(err); - } - } - }); -} - -},{}],2:[function(require,module,exports){ -"use strict"; - -/** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace - */ -var base64 = exports; - -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -base64.length = function length(string) { - var p = string.length; - if (!p) - return 0; - var n = 0; - while (--p % 4 > 1 && string.charAt(p) === "=") - ++n; - return Math.ceil(string.length * 3) / 4 - n; -}; - -// Base64 encoding table -var b64 = new Array(64); - -// Base64 decoding table -var s64 = new Array(123); - -// 65..90, 97..122, 48..57, 43, 47 -for (var i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -base64.encode = function encode(buffer, start, end) { - var parts = null, - chunk = []; - var i = 0, // output index - j = 0, // goto index - t; // temporary - while (start < end) { - var b = buffer[start++]; - switch (j) { - case 0: - chunk[i++] = b64[b >> 2]; - t = (b & 3) << 4; - j = 1; - break; - case 1: - chunk[i++] = b64[t | b >> 4]; - t = (b & 15) << 2; - j = 2; - break; - case 2: - chunk[i++] = b64[t | b >> 6]; - chunk[i++] = b64[b & 63]; - j = 0; - break; - } - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (j) { - chunk[i++] = b64[t]; - chunk[i++] = 61; - if (j === 1) - chunk[i++] = 61; - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -var invalidEncoding = "invalid encoding"; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -base64.decode = function decode(string, buffer, offset) { - var start = offset; - var j = 0, // goto index - t; // temporary - for (var i = 0; i < string.length;) { - var c = string.charCodeAt(i++); - if (c === 61 && j > 1) - break; - if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); - switch (j) { - case 0: - t = c; - j = 1; - break; - case 1: - buffer[offset++] = t << 2 | (c & 48) >> 4; - t = c; - j = 2; - break; - case 2: - buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; - t = c; - j = 3; - break; - case 3: - buffer[offset++] = (t & 3) << 6 | c; - j = 0; - break; - } - } - if (j === 1) - throw Error(invalidEncoding); - return offset - start; -}; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if probably base64 encoded, otherwise false - */ -base64.test = function test(string) { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); -}; - -},{}],3:[function(require,module,exports){ -"use strict"; -module.exports = codegen; - -/** - * Begins generating a function. - * @memberof util - * @param {string[]} functionParams Function parameter names - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - */ -function codegen(functionParams, functionName) { - - /* istanbul ignore if */ - if (typeof functionParams === "string") { - functionName = functionParams; - functionParams = undefined; - } - - var body = []; - - /** - * Appends code to the function's body or finishes generation. - * @typedef Codegen - * @type {function} - * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param {...*} [formatParams] Format parameters - * @returns {Codegen|Function} Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ - - function Codegen(formatStringOrScope) { - // note that explicit array handling below makes this ~50% faster - - // finish the function - if (typeof formatStringOrScope !== "string") { - var source = toString(); - if (codegen.verbose) - console.log("codegen: " + source); // eslint-disable-line no-console - source = "return " + source; - if (formatStringOrScope) { - var scopeKeys = Object.keys(formatStringOrScope), - scopeParams = new Array(scopeKeys.length + 1), - scopeValues = new Array(scopeKeys.length), - scopeOffset = 0; - while (scopeOffset < scopeKeys.length) { - scopeParams[scopeOffset] = scopeKeys[scopeOffset]; - scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; - } - scopeParams[scopeOffset] = source; - return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func - } - return Function(source)(); // eslint-disable-line no-new-func - } - - // otherwise append to body - var formatParams = new Array(arguments.length - 1), - formatOffset = 0; - while (formatOffset < formatParams.length) - formatParams[formatOffset] = arguments[++formatOffset]; - formatOffset = 0; - formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { - var value = formatParams[formatOffset++]; - switch ($1) { - case "d": case "f": return String(Number(value)); - case "i": return String(Math.floor(value)); - case "j": return JSON.stringify(value); - case "s": return String(value); - } - return "%"; - }); - if (formatOffset !== formatParams.length) - throw Error("parameter count mismatch"); - body.push(formatStringOrScope); - return Codegen; - } - - function toString(functionNameOverride) { - return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; - } - - Codegen.toString = toString; - return Codegen; -} - -/** - * Begins generating a function. - * @memberof util - * @function codegen - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - * @variation 2 - */ - -/** - * When set to `true`, codegen will log generated code to console. Useful for debugging. - * @name util.codegen.verbose - * @type {boolean} - */ -codegen.verbose = false; - -},{}],4:[function(require,module,exports){ -"use strict"; -module.exports = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -function EventEmitter() { - - /** - * Registered listeners. - * @type {Object.} - * @private - */ - this._listeners = {}; -} - -/** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.on = function on(evt, fn, ctx) { - (this._listeners[evt] || (this._listeners[evt] = [])).push({ - fn : fn, - ctx : ctx || this - }); - return this; -}; - -/** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.off = function off(evt, fn) { - if (evt === undefined) - this._listeners = {}; - else { - if (fn === undefined) - this._listeners[evt] = []; - else { - var listeners = this._listeners[evt]; - for (var i = 0; i < listeners.length;) - if (listeners[i].fn === fn) - listeners.splice(i, 1); - else - ++i; - } - } - return this; -}; - -/** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.emit = function emit(evt) { - var listeners = this._listeners[evt]; - if (listeners) { - var args = [], - i = 1; - for (; i < arguments.length;) - args.push(arguments[i++]); - for (i = 0; i < listeners.length;) - listeners[i].fn.apply(listeners[i++].ctx, args); - } - return this; -}; - -},{}],5:[function(require,module,exports){ -"use strict"; -module.exports = fetch; - -var asPromise = require(1), - inquire = require(7); - -var fs = inquire("fs"); - -/** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Options as used by {@link util.fetch}. - * @typedef FetchOptions - * @type {Object} - * @property {boolean} [binary=false] Whether expecting a binary response - * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest - */ - -/** - * Fetches the contents of a file. - * @memberof util - * @param {string} filename File path or url - * @param {FetchOptions} options Fetch options - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -function fetch(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = {}; - } else if (!options) - options = {}; - - if (!callback) - return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this - - // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. - if (!options.xhr && fs && fs.readFile) - return fs.readFile(filename, function fetchReadFileCallback(err, contents) { - return err && typeof XMLHttpRequest !== "undefined" - ? fetch.xhr(filename, options, callback) - : err - ? callback(err) - : callback(null, options.binary ? contents : contents.toString("utf8")); - }); - - // use the XHR version otherwise. - return fetch.xhr(filename, options, callback); -} - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchOptions} [options] Fetch options - * @returns {Promise} Promise - * @variation 3 - */ - -/**/ -fetch.xhr = function fetch_xhr(filename, options, callback) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { - - if (xhr.readyState !== 4) - return undefined; - - // local cors security errors return status 0 / empty string, too. afaik this cannot be - // reliably distinguished from an actually empty file for security reasons. feel free - // to send a pull request if you are aware of a solution. - if (xhr.status !== 0 && xhr.status !== 200) - return callback(Error("status " + xhr.status)); - - // if binary data is expected, make sure that some sort of array is returned, even if - // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. - if (options.binary) { - var buffer = xhr.response; - if (!buffer) { - buffer = []; - for (var i = 0; i < xhr.responseText.length; ++i) - buffer.push(xhr.responseText.charCodeAt(i) & 255); - } - return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); - } - return callback(null, xhr.responseText); - }; - - if (options.binary) { - // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers - if ("overrideMimeType" in xhr) - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - xhr.responseType = "arraybuffer"; - } - - xhr.open("GET", filename); - xhr.send(); -}; - -},{"1":1,"7":7}],6:[function(require,module,exports){ -"use strict"; - -module.exports = factory(factory); - -/** - * Reads / writes floats / doubles from / to buffers. - * @name util.float - * @namespace - */ - -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name util.float.writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name util.float.writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name util.float.readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name util.float.readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name util.float.writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name util.float.writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name util.float.readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name util.float.readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -// Factory function for the purpose of node-based testing in modified global environments -function factory(exports) { - - // float: typed array - if (typeof Float32Array !== "undefined") (function() { - - var f32 = new Float32Array([ -0 ]), - f8b = new Uint8Array(f32.buffer), - le = f8b[3] === 128; - - function writeFloat_f32_cpy(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - } - - function writeFloat_f32_rev(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[3]; - buf[pos + 1] = f8b[2]; - buf[pos + 2] = f8b[1]; - buf[pos + 3] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; - /* istanbul ignore next */ - exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; - - function readFloat_f32_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - return f32[0]; - } - - function readFloat_f32_rev(buf, pos) { - f8b[3] = buf[pos ]; - f8b[2] = buf[pos + 1]; - f8b[1] = buf[pos + 2]; - f8b[0] = buf[pos + 3]; - return f32[0]; - } - - /* istanbul ignore next */ - exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; - /* istanbul ignore next */ - exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; - - // float: ieee754 - })(); else (function() { - - function writeFloat_ieee754(writeUint, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); - else if (isNaN(val)) - writeUint(2143289344, buf, pos); - else if (val > 3.4028234663852886e+38) // +-Infinity - writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); - else if (val < 1.1754943508222875e-38) // denormal - writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); - else { - var exponent = Math.floor(Math.log(val) / Math.LN2), - mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; - writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); - } - } - - exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); - exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); - - function readFloat_ieee754(readUint, buf, pos) { - var uint = readUint(buf, pos), - sign = (uint >> 31) * 2 + 1, - exponent = uint >>> 23 & 255, - mantissa = uint & 8388607; - return exponent === 255 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 1.401298464324817e-45 * mantissa - : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); - } - - exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); - exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); - - })(); - - // double: typed array - if (typeof Float64Array !== "undefined") (function() { - - var f64 = new Float64Array([-0]), - f8b = new Uint8Array(f64.buffer), - le = f8b[7] === 128; - - function writeDouble_f64_cpy(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - buf[pos + 4] = f8b[4]; - buf[pos + 5] = f8b[5]; - buf[pos + 6] = f8b[6]; - buf[pos + 7] = f8b[7]; - } - - function writeDouble_f64_rev(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[7]; - buf[pos + 1] = f8b[6]; - buf[pos + 2] = f8b[5]; - buf[pos + 3] = f8b[4]; - buf[pos + 4] = f8b[3]; - buf[pos + 5] = f8b[2]; - buf[pos + 6] = f8b[1]; - buf[pos + 7] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; - /* istanbul ignore next */ - exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; - - function readDouble_f64_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - f8b[4] = buf[pos + 4]; - f8b[5] = buf[pos + 5]; - f8b[6] = buf[pos + 6]; - f8b[7] = buf[pos + 7]; - return f64[0]; - } - - function readDouble_f64_rev(buf, pos) { - f8b[7] = buf[pos ]; - f8b[6] = buf[pos + 1]; - f8b[5] = buf[pos + 2]; - f8b[4] = buf[pos + 3]; - f8b[3] = buf[pos + 4]; - f8b[2] = buf[pos + 5]; - f8b[1] = buf[pos + 6]; - f8b[0] = buf[pos + 7]; - return f64[0]; - } - - /* istanbul ignore next */ - exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; - /* istanbul ignore next */ - exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; - - // double: ieee754 - })(); else (function() { - - function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) { - writeUint(0, buf, pos + off0); - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); - } else if (isNaN(val)) { - writeUint(0, buf, pos + off0); - writeUint(2146959360, buf, pos + off1); - } else if (val > 1.7976931348623157e+308) { // +-Infinity - writeUint(0, buf, pos + off0); - writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); - } else { - var mantissa; - if (val < 2.2250738585072014e-308) { // denormal - mantissa = val / 5e-324; - writeUint(mantissa >>> 0, buf, pos + off0); - writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); - } else { - var exponent = Math.floor(Math.log(val) / Math.LN2); - if (exponent === 1024) - exponent = 1023; - mantissa = val * Math.pow(2, -exponent); - writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); - writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); - } - } - } - - exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); - exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); - - function readDouble_ieee754(readUint, off0, off1, buf, pos) { - var lo = readUint(buf, pos + off0), - hi = readUint(buf, pos + off1); - var sign = (hi >> 31) * 2 + 1, - exponent = hi >>> 20 & 2047, - mantissa = 4294967296 * (hi & 1048575) + lo; - return exponent === 2047 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 5e-324 * mantissa - : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); - } - - exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); - exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); - - })(); - - return exports; -} - -// uint helpers - -function writeUintLE(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -function writeUintBE(val, buf, pos) { - buf[pos ] = val >>> 24; - buf[pos + 1] = val >>> 16 & 255; - buf[pos + 2] = val >>> 8 & 255; - buf[pos + 3] = val & 255; -} - -function readUintLE(buf, pos) { - return (buf[pos ] - | buf[pos + 1] << 8 - | buf[pos + 2] << 16 - | buf[pos + 3] << 24) >>> 0; -} - -function readUintBE(buf, pos) { - return (buf[pos ] << 24 - | buf[pos + 1] << 16 - | buf[pos + 2] << 8 - | buf[pos + 3]) >>> 0; -} - -},{}],7:[function(require,module,exports){ -"use strict"; -module.exports = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -function inquire(moduleName) { - try { - var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval - if (mod && (mod.length || Object.keys(mod).length)) - return mod; - } catch (e) {} // eslint-disable-line no-empty - return null; -} - -},{}],8:[function(require,module,exports){ -"use strict"; - -/** - * A minimal path module to resolve Unix, Windows and URL paths alike. - * @memberof util - * @namespace - */ -var path = exports; - -var isAbsolute = -/** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ -path.isAbsolute = function isAbsolute(path) { - return /^(?:\/|\w+:)/.test(path); -}; - -var normalize = -/** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ -path.normalize = function normalize(path) { - path = path.replace(/\\/g, "/") - .replace(/\/{2,}/g, "/"); - var parts = path.split("/"), - absolute = isAbsolute(path), - prefix = ""; - if (absolute) - prefix = parts.shift() + "/"; - for (var i = 0; i < parts.length;) { - if (parts[i] === "..") { - if (i > 0 && parts[i - 1] !== "..") - parts.splice(--i, 2); - else if (absolute) - parts.splice(i, 1); - else - ++i; - } else if (parts[i] === ".") - parts.splice(i, 1); - else - ++i; - } - return prefix + parts.join("/"); -}; - -/** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ -path.resolve = function resolve(originPath, includePath, alreadyNormalized) { - if (!alreadyNormalized) - includePath = normalize(includePath); - if (isAbsolute(includePath)) - return includePath; - if (!alreadyNormalized) - originPath = normalize(originPath); - return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; -}; - -},{}],9:[function(require,module,exports){ -"use strict"; -module.exports = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -function pool(alloc, slice, size) { - var SIZE = size || 8192; - var MAX = SIZE >>> 1; - var slab = null; - var offset = SIZE; - return function pool_alloc(size) { - if (size < 1 || size > MAX) - return alloc(size); - if (offset + size > SIZE) { - slab = alloc(SIZE); - offset = 0; - } - var buf = slice.call(slab, offset, offset += size); - if (offset & 7) // align to 32 bit - offset = (offset | 7) + 1; - return buf; - }; -} - -},{}],10:[function(require,module,exports){ -"use strict"; - -/** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ -var utf8 = exports; - -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0; i < string.length; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; -}; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } - } - return offset - start; -}; - -},{}],11:[function(require,module,exports){ -"use strict"; -module.exports = common; - -var commonRe = /\/|\./; - -/** - * Provides common type definitions. - * Can also be used to provide additional google types or your own custom types. - * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name - * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition - * @returns {undefined} - * @property {INamespace} google/protobuf/any.proto Any - * @property {INamespace} google/protobuf/duration.proto Duration - * @property {INamespace} google/protobuf/empty.proto Empty - * @property {INamespace} google/protobuf/field_mask.proto FieldMask - * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue - * @property {INamespace} google/protobuf/timestamp.proto Timestamp - * @property {INamespace} google/protobuf/wrappers.proto Wrappers - * @example - * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension) - * protobuf.common("descriptor", descriptorJson); - * - * // manually provides a custom definition (uses my.foo namespace) - * protobuf.common("my/foo/bar.proto", myFooBarJson); - */ -function common(name, json) { - if (!commonRe.test(name)) { - name = "google/protobuf/" + name + ".proto"; - json = { nested: { google: { nested: { protobuf: { nested: json } } } } }; - } - common[name] = json; -} - -// Not provided because of limited use (feel free to discuss or to provide yourself): -// -// google/protobuf/descriptor.proto -// google/protobuf/source_context.proto -// google/protobuf/type.proto -// -// Stripped and pre-parsed versions of these non-bundled files are instead available as part of -// the repository or package within the google/protobuf directory. - -common("any", { - - /** - * Properties of a google.protobuf.Any message. - * @interface IAny - * @type {Object} - * @property {string} [typeUrl] - * @property {Uint8Array} [bytes] - * @memberof common - */ - Any: { - fields: { - type_url: { - type: "string", - id: 1 - }, - value: { - type: "bytes", - id: 2 - } - } - } -}); - -var timeType; - -common("duration", { - - /** - * Properties of a google.protobuf.Duration message. - * @interface IDuration - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Duration: timeType = { - fields: { - seconds: { - type: "int64", - id: 1 - }, - nanos: { - type: "int32", - id: 2 - } - } - } -}); - -common("timestamp", { - - /** - * Properties of a google.protobuf.Timestamp message. - * @interface ITimestamp - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Timestamp: timeType -}); - -common("empty", { - - /** - * Properties of a google.protobuf.Empty message. - * @interface IEmpty - * @memberof common - */ - Empty: { - fields: {} - } -}); - -common("struct", { - - /** - * Properties of a google.protobuf.Struct message. - * @interface IStruct - * @type {Object} - * @property {Object.} [fields] - * @memberof common - */ - Struct: { - fields: { - fields: { - keyType: "string", - type: "Value", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Value message. - * @interface IValue - * @type {Object} - * @property {string} [kind] - * @property {0} [nullValue] - * @property {number} [numberValue] - * @property {string} [stringValue] - * @property {boolean} [boolValue] - * @property {IStruct} [structValue] - * @property {IListValue} [listValue] - * @memberof common - */ - Value: { - oneofs: { - kind: { - oneof: [ - "nullValue", - "numberValue", - "stringValue", - "boolValue", - "structValue", - "listValue" - ] - } - }, - fields: { - nullValue: { - type: "NullValue", - id: 1 - }, - numberValue: { - type: "double", - id: 2 - }, - stringValue: { - type: "string", - id: 3 - }, - boolValue: { - type: "bool", - id: 4 - }, - structValue: { - type: "Struct", - id: 5 - }, - listValue: { - type: "ListValue", - id: 6 - } - } - }, - - NullValue: { - values: { - NULL_VALUE: 0 - } - }, - - /** - * Properties of a google.protobuf.ListValue message. - * @interface IListValue - * @type {Object} - * @property {Array.} [values] - * @memberof common - */ - ListValue: { - fields: { - values: { - rule: "repeated", - type: "Value", - id: 1 - } - } - } -}); - -common("wrappers", { - - /** - * Properties of a google.protobuf.DoubleValue message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - DoubleValue: { - fields: { - value: { - type: "double", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.FloatValue message. - * @interface IFloatValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FloatValue: { - fields: { - value: { - type: "float", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int64Value message. - * @interface IInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - Int64Value: { - fields: { - value: { - type: "int64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt64Value message. - * @interface IUInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - UInt64Value: { - fields: { - value: { - type: "uint64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int32Value message. - * @interface IInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - Int32Value: { - fields: { - value: { - type: "int32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt32Value message. - * @interface IUInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - UInt32Value: { - fields: { - value: { - type: "uint32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BoolValue message. - * @interface IBoolValue - * @type {Object} - * @property {boolean} [value] - * @memberof common - */ - BoolValue: { - fields: { - value: { - type: "bool", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.StringValue message. - * @interface IStringValue - * @type {Object} - * @property {string} [value] - * @memberof common - */ - StringValue: { - fields: { - value: { - type: "string", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BytesValue message. - * @interface IBytesValue - * @type {Object} - * @property {Uint8Array} [value] - * @memberof common - */ - BytesValue: { - fields: { - value: { - type: "bytes", - id: 1 - } - } - } -}); - -common("field_mask", { - - /** - * Properties of a google.protobuf.FieldMask message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FieldMask: { - fields: { - paths: { - rule: "repeated", - type: "string", - id: 1 - } - } - } -}); - -/** - * Gets the root definition of the specified common proto file. - * - * Bundled definitions are: - * - google/protobuf/any.proto - * - google/protobuf/duration.proto - * - google/protobuf/empty.proto - * - google/protobuf/field_mask.proto - * - google/protobuf/struct.proto - * - google/protobuf/timestamp.proto - * - google/protobuf/wrappers.proto - * - * @param {string} file Proto file name - * @returns {INamespace|null} Root definition or `null` if not defined - */ -common.get = function get(file) { - return common[file] || null; -}; - -},{}],12:[function(require,module,exports){ -"use strict"; -/** - * Runtime message from/to plain object converters. - * @namespace - */ -var converter = exports; - -var Enum = require(15), - util = require(37); - -/** - * Generates a partial value fromObject conveter. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} prop Property reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genValuePartial_fromObject(gen, field, fieldIndex, prop) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(d%s){", prop); - for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) { - if (field.repeated && values[keys[i]] === field.typeDefault) gen - ("default:"); - gen - ("case%j:", keys[i]) - ("case %i:", values[keys[i]]) - ("m%s=%j", prop, values[keys[i]]) - ("break"); - } gen - ("}"); - } else gen - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop); - } else { - var isUnsigned = false; - switch (field.type) { - case "double": - case "float": gen - ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity" - break; - case "uint32": - case "fixed32": gen - ("m%s=d%s>>>0", prop, prop); - break; - case "int32": - case "sint32": - case "sfixed32": gen - ("m%s=d%s|0", prop, prop); - break; - case "uint64": - isUnsigned = true; - // eslint-disable-line no-fallthrough - case "int64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(util.Long)") - ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned) - ("else if(typeof d%s===\"string\")", prop) - ("m%s=parseInt(d%s,10)", prop, prop) - ("else if(typeof d%s===\"number\")", prop) - ("m%s=d%s", prop, prop) - ("else if(typeof d%s===\"object\")", prop) - ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); - break; - case "bytes": gen - ("if(typeof d%s===\"string\")", prop) - ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop) - ("else if(d%s.length)", prop) - ("m%s=d%s", prop, prop); - break; - case "string": gen - ("m%s=String(d%s)", prop, prop); - break; - case "bool": gen - ("m%s=Boolean(d%s)", prop, prop); - break; - /* default: gen - ("m%s=d%s", prop, prop); - break; */ - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a plain object to runtime message converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.fromObject = function fromObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray; - var gen = util.codegen(["d"], mtype.name + "$fromObject") - ("if(d instanceof this.ctor)") - ("return d"); - if (!fields.length) return gen - ("return new this.ctor"); - gen - ("var m=new this.ctor"); - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - prop = util.safeProp(field.name); - - // Map fields - if (field.map) { gen - ("if(d%s){", prop) - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s={}", prop) - ("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop); - break; - case "bytes": gen - ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); - break; - default: gen - ("d%s=m%s", prop, prop); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a runtime message to plain object converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.toObject = function toObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); - if (!fields.length) - return util.codegen()("return {}"); - var gen = util.codegen(["m", "o"], mtype.name + "$toObject") - ("if(!o)") - ("o={}") - ("var d={}"); - - var repeatedFields = [], - mapFields = [], - normalFields = [], - i = 0; - for (; i < fields.length; ++i) - if (!fields[i].partOf) - ( fields[i].resolve().repeated ? repeatedFields - : fields[i].map ? mapFields - : normalFields).push(fields[i]); - - if (repeatedFields.length) { gen - ("if(o.arrays||o.defaults){"); - for (i = 0; i < repeatedFields.length; ++i) gen - ("d%s=[]", util.safeProp(repeatedFields[i].name)); - gen - ("}"); - } - - if (mapFields.length) { gen - ("if(o.objects||o.defaults){"); - for (i = 0; i < mapFields.length; ++i) gen - ("d%s={}", util.safeProp(mapFields[i].name)); - gen - ("}"); - } - - if (normalFields.length) { gen - ("if(o.defaults){"); - for (i = 0; i < normalFields.length; ++i) { - var field = normalFields[i], - prop = util.safeProp(field.name); - if (field.resolvedType instanceof Enum) gen - ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); - else if (field.long) gen - ("if(util.Long){") - ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned) - ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop) - ("}else") - ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); - else if (field.bytes) { - var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; - gen - ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault)) - ("else{") - ("d%s=%s", prop, arrayDefault) - ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop) - ("}"); - } else gen - ("d%s=%j", prop, field.typeDefault); // also messages (=null) - } gen - ("}"); - } - var hasKs2 = false; - for (i = 0; i < fields.length; ++i) { - var field = fields[i], - index = mtype._fieldsArray.indexOf(field), - prop = util.safeProp(field.name); - if (field.map) { - if (!hasKs2) { hasKs2 = true; gen - ("var ks2"); - } gen - ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop) - ("d%s={}", prop) - ("for(var j=0;j>>3){"); - - var i = 0; - for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - ref = "m" + util.safeProp(field.name); gen - ("case %i:", field.id); - - // Map fields - if (field.map) { gen - ("r.skip().pos++") // assumes id 1 + key wireType - ("if(%s===util.emptyObject)", ref) - ("%s={}", ref) - ("k=r.%s()", field.keyType) - ("r.pos++"); // assumes id 2 + value wireType - if (types.long[field.keyType] !== undefined) { - if (types.basic[type] === undefined) gen - ("%s[typeof k===\"object\"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())", ref, i); // can't be groups - else gen - ("%s[typeof k===\"object\"?util.longToHash(k):k]=r.%s()", ref, type); - } else { - if (types.basic[type] === undefined) gen - ("%s[k]=types[%i].decode(r,r.uint32())", ref, i); // can't be groups - else gen - ("%s[k]=r.%s()", ref, type); - } - - // Repeated fields - } else if (field.repeated) { gen - - ("if(!(%s&&%s.length))", ref, ref) - ("%s=[]", ref); - - // Packable (always check for forward and backward compatiblity) - if (types.packed[type] !== undefined) gen - ("if((t&7)===2){") - ("var c2=r.uint32()+r.pos") - ("while(r.pos>> 0, (field.id << 3 | 4) >>> 0) - : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); -} - -/** - * Generates an encoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function encoder(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var gen = util.codegen(["m", "w"], mtype.name + "$encode") - ("if(!w)") - ("w=Writer.create()"); - - var i, ref; - - // "when a message is serialized its known fields should be written sequentially by field number" - var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById); - - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - index = mtype._fieldsArray.indexOf(field), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - wireType = types.basic[type]; - ref = "m" + util.safeProp(field.name); - - // Map fields - if (field.map) { - gen - ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name) // !== undefined && !== null - ("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); - if (wireType === undefined) gen - ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups - else gen - (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); - gen - ("}") - ("}"); - - // Repeated fields - } else if (field.repeated) { gen - ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null - - // Packed repeated - if (field.packed && types.packed[type] !== undefined) { gen - - ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0) - ("for(var i=0;i<%s.length;++i)", ref) - ("w.%s(%s[i])", type, ref) - ("w.ldelim()"); - - // Non-packed - } else { gen - - ("for(var i=0;i<%s.length;++i)", ref); - if (wireType === undefined) - genTypePartial(gen, field, index, ref + "[i]"); - else gen - ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); - - } gen - ("}"); - - // Non-repeated - } else { - if (field.optional) gen - ("if(%s!=null&&m.hasOwnProperty(%j))", ref, field.name); // !== undefined && !== null - - if (wireType === undefined) - genTypePartial(gen, field, index, ref); - else gen - ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); - - } - } - - return gen - ("return w"); - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} -},{"15":15,"36":36,"37":37}],15:[function(require,module,exports){ -"use strict"; -module.exports = Enum; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; - -var Namespace = require(23), - util = require(37); - -/** - * Constructs a new enum instance. - * @classdesc Reflected enum. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {Object.} [values] Enum values as an object, by name - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this enum - * @param {Object.} [comments] The value comments for this enum - */ -function Enum(name, values, options, comment, comments) { - ReflectionObject.call(this, name, options); - - if (values && typeof values !== "object") - throw TypeError("values must be an object"); - - /** - * Enum values by id. - * @type {Object.} - */ - this.valuesById = {}; - - /** - * Enum values by name. - * @type {Object.} - */ - this.values = Object.create(this.valuesById); // toJSON, marker - - /** - * Enum comment text. - * @type {string|null} - */ - this.comment = comment; - - /** - * Value comment texts, if any. - * @type {Object.} - */ - this.comments = comments || {}; - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - // Note that values inherit valuesById on their prototype which makes them a TypeScript- - // compatible enum. This is used by pbts to write actual enum definitions that work for - // static and reflection code alike instead of emitting generic object definitions. - - if (values) - for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) - if (typeof values[keys[i]] === "number") // use forward entries only - this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i]; -} - -/** - * Enum descriptor. - * @interface IEnum - * @property {Object.} values Enum values - * @property {Object.} [options] Enum options - */ - -/** - * Constructs an enum from an enum descriptor. - * @param {string} name Enum name - * @param {IEnum} json Enum descriptor - * @returns {Enum} Created enum - * @throws {TypeError} If arguments are invalid - */ -Enum.fromJSON = function fromJSON(name, json) { - var enm = new Enum(name, json.values, json.options, json.comment, json.comments); - enm.reserved = json.reserved; - return enm; -}; - -/** - * Converts this enum to an enum descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IEnum} Enum descriptor - */ -Enum.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "values" , this.values, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "comment" , keepComments ? this.comment : undefined, - "comments" , keepComments ? this.comments : undefined - ]); -}; - -/** - * Adds a value to this enum. - * @param {string} name Value name - * @param {number} id Value id - * @param {string} [comment] Comment, if any - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ -Enum.prototype.add = function add(name, id, comment) { - // utilized by the parser but not by .fromJSON - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (!util.isInteger(id)) - throw TypeError("id must be an integer"); - - if (this.values[name] !== undefined) - throw Error("duplicate name '" + name + "' in " + this); - - if (this.isReservedId(id)) - throw Error("id " + id + " is reserved in " + this); - - if (this.isReservedName(name)) - throw Error("name '" + name + "' is reserved in " + this); - - if (this.valuesById[id] !== undefined) { - if (!(this.options && this.options.allow_alias)) - throw Error("duplicate id " + id + " in " + this); - this.values[name] = id; - } else - this.valuesById[this.values[name] = id] = name; - - this.comments[name] = comment || null; - return this; -}; - -/** - * Removes a value from this enum - * @param {string} name Value name - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ -Enum.prototype.remove = function remove(name) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - var val = this.values[name]; - if (val == null) - throw Error("name '" + name + "' does not exist in " + this); - - delete this.valuesById[val]; - delete this.values[name]; - delete this.comments[name]; - - return this; -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -},{"23":23,"24":24,"37":37}],16:[function(require,module,exports){ -"use strict"; -module.exports = Field; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; - -var Enum = require(15), - types = require(36), - util = require(37); - -var Type; // cyclic - -var ruleRe = /^required|optional|repeated$/; - -/** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @name Field - * @classdesc Reflected message field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a field from a field descriptor. - * @param {string} name Field name - * @param {IField} json Field descriptor - * @returns {Field} Created field - * @throws {TypeError} If arguments are invalid - */ -Field.fromJSON = function fromJSON(name, json) { - return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); -}; - -/** - * Not an actual constructor. Use {@link Field} instead. - * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. - * @exports FieldBase - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function Field(name, id, type, rule, extend, options, comment) { - - if (util.isObject(rule)) { - comment = extend; - options = rule; - rule = extend = undefined; - } else if (util.isObject(extend)) { - comment = options; - options = extend; - extend = undefined; - } - - ReflectionObject.call(this, name, options); - - if (!util.isInteger(id) || id < 0) - throw TypeError("id must be a non-negative integer"); - - if (!util.isString(type)) - throw TypeError("type must be a string"); - - if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase())) - throw TypeError("rule must be a string rule"); - - if (extend !== undefined && !util.isString(extend)) - throw TypeError("extend must be a string"); - - /** - * Field rule, if any. - * @type {string|undefined} - */ - this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON - - /** - * Field type. - * @type {string} - */ - this.type = type; // toJSON - - /** - * Unique field id. - * @type {number} - */ - this.id = id; // toJSON, marker - - /** - * Extended type if different from parent. - * @type {string|undefined} - */ - this.extend = extend || undefined; // toJSON - - /** - * Whether this field is required. - * @type {boolean} - */ - this.required = rule === "required"; - - /** - * Whether this field is optional. - * @type {boolean} - */ - this.optional = !this.required; - - /** - * Whether this field is repeated. - * @type {boolean} - */ - this.repeated = rule === "repeated"; - - /** - * Whether this field is a map or not. - * @type {boolean} - */ - this.map = false; - - /** - * Message this field belongs to. - * @type {Type|null} - */ - this.message = null; - - /** - * OneOf this field belongs to, if any, - * @type {OneOf|null} - */ - this.partOf = null; - - /** - * The field type's default value. - * @type {*} - */ - this.typeDefault = null; - - /** - * The field's default value on prototypes. - * @type {*} - */ - this.defaultValue = null; - - /** - * Whether this field's value should be treated as a long. - * @type {boolean} - */ - this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false; - - /** - * Whether this field's value is a buffer. - * @type {boolean} - */ - this.bytes = type === "bytes"; - - /** - * Resolved type if not a basic type. - * @type {Type|Enum|null} - */ - this.resolvedType = null; - - /** - * Sister-field within the extended type if a declaring extension field. - * @type {Field|null} - */ - this.extensionField = null; - - /** - * Sister-field within the declaring namespace if an extended field. - * @type {Field|null} - */ - this.declaringField = null; - - /** - * Internally remembers whether this field is packed. - * @type {boolean|null} - * @private - */ - this._packed = null; - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Determines whether this field is packed. Only relevant when repeated and working with proto2. - * @name Field#packed - * @type {boolean} - * @readonly - */ -Object.defineProperty(Field.prototype, "packed", { - get: function() { - // defaults to packed=true if not explicity set to false - if (this._packed === null) - this._packed = this.getOption("packed") !== false; - return this._packed; - } -}); - -/** - * @override - */ -Field.prototype.setOption = function setOption(name, value, ifNotSet) { - if (name === "packed") // clear cached before setting - this._packed = null; - return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); -}; - -/** - * Field descriptor. - * @interface IField - * @property {string} [rule="optional"] Field rule - * @property {string} type Field type - * @property {number} id Field id - * @property {Object.} [options] Field options - */ - -/** - * Extension field descriptor. - * @interface IExtensionField - * @extends IField - * @property {string} extend Extended type - */ - -/** - * Converts this field to a field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IField} Field descriptor - */ -Field.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "rule" , this.rule !== "optional" && this.rule || undefined, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Resolves this field's type references. - * @returns {Field} `this` - * @throws {Error} If any reference cannot be resolved - */ -Field.prototype.resolve = function resolve() { - - if (this.resolved) - return this; - - if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it - this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); - if (this.resolvedType instanceof Type) - this.typeDefault = null; - else // instanceof Enum - this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined - } - - // use explicitly set default value if present - if (this.options && this.options["default"] != null) { - this.typeDefault = this.options["default"]; - if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") - this.typeDefault = this.resolvedType.values[this.typeDefault]; - } - - // remove unnecessary options - if (this.options) { - if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum)) - delete this.options.packed; - if (!Object.keys(this.options).length) - this.options = undefined; - } - - // convert to internal data type if necesssary - if (this.long) { - this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); - - /* istanbul ignore else */ - if (Object.freeze) - Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) - - } else if (this.bytes && typeof this.typeDefault === "string") { - var buf; - if (util.base64.test(this.typeDefault)) - util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); - else - util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); - this.typeDefault = buf; - } - - // take special care of maps and repeated fields - if (this.map) - this.defaultValue = util.emptyObject; - else if (this.repeated) - this.defaultValue = util.emptyArray; - else - this.defaultValue = this.typeDefault; - - // ensure proper value on prototype - if (this.parent instanceof Type) - this.parent.ctor.prototype[this.name] = this.defaultValue; - - return ReflectionObject.prototype.resolve.call(this); -}; - -/** - * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). - * @typedef FieldDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} fieldName Field name - * @returns {undefined} - */ - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @param {T} [defaultValue] Default value - * @returns {FieldDecorator} Decorator function - * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[] - */ -Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { - - // submessage: decorate the submessage and use its name as the type - if (typeof fieldType === "function") - fieldType = util.decorateType(fieldType).name; - - // enum reference: create a reflected copy of the enum and keep reuseing it - else if (fieldType && typeof fieldType === "object") - fieldType = util.decorateEnum(fieldType).name; - - return function fieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); - }; -}; - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {Constructor|string} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @returns {FieldDecorator} Decorator function - * @template T extends Message - * @variation 2 - */ -// like Field.d but without a default value - -// Sets up cyclic dependencies (called in index-light) -Field._configure = function configure(Type_) { - Type = Type_; -}; - -},{"15":15,"24":24,"36":36,"37":37}],17:[function(require,module,exports){ -"use strict"; -var protobuf = module.exports = require(18); - -protobuf.build = "light"; - -/** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @typedef LoadCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Root} [root] Root, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param {string|string[]} filename One or multiple files to load - * @param {Root} root Root namespace, defaults to create a new one if omitted. - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - */ -function load(filename, root, callback) { - if (typeof root === "function") { - callback = root; - root = new protobuf.Root(); - } else if (!root) - root = new protobuf.Root(); - return root.load(filename, callback); -} - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Promise} Promise - * @see {@link Root#load} - * @variation 3 - */ -// function load(filename:string, [root:Root]):Promise - -protobuf.load = load; - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - * @see {@link Root#loadSync} - */ -function loadSync(filename, root) { - if (!root) - root = new protobuf.Root(); - return root.loadSync(filename); -} - -protobuf.loadSync = loadSync; - -// Serialization -protobuf.encoder = require(14); -protobuf.decoder = require(13); -protobuf.verifier = require(40); -protobuf.converter = require(12); - -// Reflection -protobuf.ReflectionObject = require(24); -protobuf.Namespace = require(23); -protobuf.Root = require(29); -protobuf.Enum = require(15); -protobuf.Type = require(35); -protobuf.Field = require(16); -protobuf.OneOf = require(25); -protobuf.MapField = require(20); -protobuf.Service = require(33); -protobuf.Method = require(22); - -// Runtime -protobuf.Message = require(21); -protobuf.wrappers = require(41); - -// Utility -protobuf.types = require(36); -protobuf.util = require(37); - -// Set up possibly cyclic reflection dependencies -protobuf.ReflectionObject._configure(protobuf.Root); -protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); -protobuf.Root._configure(protobuf.Type); -protobuf.Field._configure(protobuf.Type); - -},{"12":12,"13":13,"14":14,"15":15,"16":16,"18":18,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"29":29,"33":33,"35":35,"36":36,"37":37,"40":40,"41":41}],18:[function(require,module,exports){ -"use strict"; -var protobuf = exports; - -/** - * Build type, one of `"full"`, `"light"` or `"minimal"`. - * @name build - * @type {string} - * @const - */ -protobuf.build = "minimal"; - -// Serialization -protobuf.Writer = require(42); -protobuf.BufferWriter = require(43); -protobuf.Reader = require(27); -protobuf.BufferReader = require(28); - -// Utility -protobuf.util = require(39); -protobuf.rpc = require(31); -protobuf.roots = require(30); -protobuf.configure = configure; - -/* istanbul ignore next */ -/** - * Reconfigures the library according to the environment. - * @returns {undefined} - */ -function configure() { - protobuf.Reader._configure(protobuf.BufferReader); - protobuf.util._configure(); -} - -// Set up buffer utility according to the environment -protobuf.Writer._configure(protobuf.BufferWriter); -configure(); - -},{"27":27,"28":28,"30":30,"31":31,"39":39,"42":42,"43":43}],19:[function(require,module,exports){ -"use strict"; -var protobuf = module.exports = require(17); - -protobuf.build = "full"; - -// Parser -protobuf.tokenize = require(34); -protobuf.parse = require(26); -protobuf.common = require(11); - -// Configure parser -protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common); - -},{"11":11,"17":17,"26":26,"34":34}],20:[function(require,module,exports){ -"use strict"; -module.exports = MapField; - -// extends Field -var Field = require(16); -((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; - -var types = require(36), - util = require(37); - -/** - * Constructs a new map field instance. - * @classdesc Reflected map field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} keyType Key type - * @param {string} type Value type - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function MapField(name, id, keyType, type, options, comment) { - Field.call(this, name, id, type, undefined, undefined, options, comment); - - /* istanbul ignore if */ - if (!util.isString(keyType)) - throw TypeError("keyType must be a string"); - - /** - * Key type. - * @type {string} - */ - this.keyType = keyType; // toJSON, marker - - /** - * Resolved key type if not a basic type. - * @type {ReflectionObject|null} - */ - this.resolvedKeyType = null; - - // Overrides Field#map - this.map = true; -} - -/** - * Map field descriptor. - * @interface IMapField - * @extends {IField} - * @property {string} keyType Key type - */ - -/** - * Extension map field descriptor. - * @interface IExtensionMapField - * @extends IMapField - * @property {string} extend Extended type - */ - -/** - * Constructs a map field from a map field descriptor. - * @param {string} name Field name - * @param {IMapField} json Map field descriptor - * @returns {MapField} Created map field - * @throws {TypeError} If arguments are invalid - */ -MapField.fromJSON = function fromJSON(name, json) { - return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); -}; - -/** - * Converts this map field to a map field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMapField} Map field descriptor - */ -MapField.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "keyType" , this.keyType, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -MapField.prototype.resolve = function resolve() { - if (this.resolved) - return this; - - // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" - if (types.mapKey[this.keyType] === undefined) - throw Error("invalid key type: " + this.keyType); - - return Field.prototype.resolve.call(this); -}; - -/** - * Map field decorator (TypeScript). - * @name MapField.d - * @function - * @param {number} fieldId Field id - * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type - * @returns {FieldDecorator} Decorator function - * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } - */ -MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { - - // submessage value: decorate the submessage and use its name as the type - if (typeof fieldValueType === "function") - fieldValueType = util.decorateType(fieldValueType).name; - - // enum reference value: create a reflected copy of the enum and keep reuseing it - else if (fieldValueType && typeof fieldValueType === "object") - fieldValueType = util.decorateEnum(fieldValueType).name; - - return function mapFieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); - }; -}; - -},{"16":16,"36":36,"37":37}],21:[function(require,module,exports){ -"use strict"; -module.exports = Message; - -var util = require(39); - -/** - * Constructs a new message instance. - * @classdesc Abstract runtime message. - * @constructor - * @param {Properties} [properties] Properties to set - * @template T extends object = object - */ -function Message(properties) { - // not used internally - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; -} - -/** - * Reference to the reflected type. - * @name Message.$type - * @type {Type} - * @readonly - */ - -/** - * Reference to the reflected type. - * @name Message#$type - * @type {Type} - * @readonly - */ - -/*eslint-disable valid-jsdoc*/ - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message} Message instance - * @template T extends Message - * @this Constructor - */ -Message.create = function create(properties) { - return this.$type.create(properties); -}; - -/** - * Encodes a message of this type. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encode = function encode(message, writer) { - return this.$type.encode(message, writer); -}; - -/** - * Encodes a message of this type preceeded by its length as a varint. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.$type.encodeDelimited(message, writer); -}; - -/** - * Decodes a message of this type. - * @name Message.decode - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decode = function decode(reader) { - return this.$type.decode(reader); -}; - -/** - * Decodes a message of this type preceeded by its length as a varint. - * @name Message.decodeDelimited - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decodeDelimited = function decodeDelimited(reader) { - return this.$type.decodeDelimited(reader); -}; - -/** - * Verifies a message of this type. - * @name Message.verify - * @function - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ -Message.verify = function verify(message) { - return this.$type.verify(message); -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object - * @returns {T} Message instance - * @template T extends Message - * @this Constructor - */ -Message.fromObject = function fromObject(object) { - return this.$type.fromObject(object); -}; - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {T} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @template T extends Message - * @this Constructor - */ -Message.toObject = function toObject(message, options) { - return this.$type.toObject(message, options); -}; - -/** - * Converts this message to JSON. - * @returns {Object.} JSON object - */ -Message.prototype.toJSON = function toJSON() { - return this.$type.toObject(this, util.toJSONOptions); -}; - -/*eslint-enable valid-jsdoc*/ -},{"39":39}],22:[function(require,module,exports){ -"use strict"; -module.exports = Method; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; - -var util = require(37); - -/** - * Constructs a new service method instance. - * @classdesc Reflected service method. - * @extends ReflectionObject - * @constructor - * @param {string} name Method name - * @param {string|undefined} type Method type, usually `"rpc"` - * @param {string} requestType Request message type - * @param {string} responseType Response message type - * @param {boolean|Object.} [requestStream] Whether the request is streamed - * @param {boolean|Object.} [responseStream] Whether the response is streamed - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this method - */ -function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) { - - /* istanbul ignore next */ - if (util.isObject(requestStream)) { - options = requestStream; - requestStream = responseStream = undefined; - } else if (util.isObject(responseStream)) { - options = responseStream; - responseStream = undefined; - } - - /* istanbul ignore if */ - if (!(type === undefined || util.isString(type))) - throw TypeError("type must be a string"); - - /* istanbul ignore if */ - if (!util.isString(requestType)) - throw TypeError("requestType must be a string"); - - /* istanbul ignore if */ - if (!util.isString(responseType)) - throw TypeError("responseType must be a string"); - - ReflectionObject.call(this, name, options); - - /** - * Method type. - * @type {string} - */ - this.type = type || "rpc"; // toJSON - - /** - * Request type. - * @type {string} - */ - this.requestType = requestType; // toJSON, marker - - /** - * Whether requests are streamed or not. - * @type {boolean|undefined} - */ - this.requestStream = requestStream ? true : undefined; // toJSON - - /** - * Response type. - * @type {string} - */ - this.responseType = responseType; // toJSON - - /** - * Whether responses are streamed or not. - * @type {boolean|undefined} - */ - this.responseStream = responseStream ? true : undefined; // toJSON - - /** - * Resolved request type. - * @type {Type|null} - */ - this.resolvedRequestType = null; - - /** - * Resolved response type. - * @type {Type|null} - */ - this.resolvedResponseType = null; - - /** - * Comment for this method - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Method descriptor. - * @interface IMethod - * @property {string} [type="rpc"] Method type - * @property {string} requestType Request type - * @property {string} responseType Response type - * @property {boolean} [requestStream=false] Whether requests are streamed - * @property {boolean} [responseStream=false] Whether responses are streamed - * @property {Object.} [options] Method options - */ - -/** - * Constructs a method from a method descriptor. - * @param {string} name Method name - * @param {IMethod} json Method descriptor - * @returns {Method} Created method - * @throws {TypeError} If arguments are invalid - */ -Method.fromJSON = function fromJSON(name, json) { - return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment); -}; - -/** - * Converts this method to a method descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMethod} Method descriptor - */ -Method.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined, - "requestType" , this.requestType, - "requestStream" , this.requestStream, - "responseType" , this.responseType, - "responseStream" , this.responseStream, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Method.prototype.resolve = function resolve() { - - /* istanbul ignore if */ - if (this.resolved) - return this; - - this.resolvedRequestType = this.parent.lookupType(this.requestType); - this.resolvedResponseType = this.parent.lookupType(this.responseType); - - return ReflectionObject.prototype.resolve.call(this); -}; - -},{"24":24,"37":37}],23:[function(require,module,exports){ -"use strict"; -module.exports = Namespace; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; - -var Field = require(16), - util = require(37); - -var Type, // cyclic - Service, - Enum; - -/** - * Constructs a new namespace instance. - * @name Namespace - * @classdesc Reflected namespace. - * @extends NamespaceBase - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a namespace from JSON. - * @memberof Namespace - * @function - * @param {string} name Namespace name - * @param {Object.} json JSON object - * @returns {Namespace} Created namespace - * @throws {TypeError} If arguments are invalid - */ -Namespace.fromJSON = function fromJSON(name, json) { - return new Namespace(name, json.options).addJSON(json.nested); -}; - -/** - * Converts an array of reflection objects to JSON. - * @memberof Namespace - * @param {ReflectionObject[]} array Object array - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {Object.|undefined} JSON object or `undefined` when array is empty - */ -function arrayToJSON(array, toJSONOptions) { - if (!(array && array.length)) - return undefined; - var obj = {}; - for (var i = 0; i < array.length; ++i) - obj[array[i].name] = array[i].toJSON(toJSONOptions); - return obj; -} - -Namespace.arrayToJSON = arrayToJSON; - -/** - * Tests if the specified id is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedId = function isReservedId(reserved, id) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] >= id) - return true; - return false; -}; - -/** - * Tests if the specified name is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedName = function isReservedName(reserved, name) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (reserved[i] === name) - return true; - return false; -}; - -/** - * Not an actual constructor. Use {@link Namespace} instead. - * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. - * @exports NamespaceBase - * @extends ReflectionObject - * @abstract - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - * @see {@link Namespace} - */ -function Namespace(name, options) { - ReflectionObject.call(this, name, options); - - /** - * Nested objects by name. - * @type {Object.|undefined} - */ - this.nested = undefined; // toJSON - - /** - * Cached nested objects as an array. - * @type {ReflectionObject[]|null} - * @private - */ - this._nestedArray = null; -} - -function clearCache(namespace) { - namespace._nestedArray = null; - return namespace; -} - -/** - * Nested objects of this namespace as an array for iteration. - * @name NamespaceBase#nestedArray - * @type {ReflectionObject[]} - * @readonly - */ -Object.defineProperty(Namespace.prototype, "nestedArray", { - get: function() { - return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); - } -}); - -/** - * Namespace descriptor. - * @interface INamespace - * @property {Object.} [options] Namespace options - * @property {Object.} [nested] Nested object descriptors - */ - -/** - * Any extension field descriptor. - * @typedef AnyExtensionField - * @type {IExtensionField|IExtensionMapField} - */ - -/** - * Any nested object descriptor. - * @typedef AnyNestedObject - * @type {IEnum|IType|IService|AnyExtensionField|INamespace} - */ -// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place) - -/** - * Converts this namespace to a namespace descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {INamespace} Namespace descriptor - */ -Namespace.prototype.toJSON = function toJSON(toJSONOptions) { - return util.toObject([ - "options" , this.options, - "nested" , arrayToJSON(this.nestedArray, toJSONOptions) - ]); -}; - -/** - * Adds nested objects to this namespace from nested object descriptors. - * @param {Object.} nestedJson Any nested object descriptors - * @returns {Namespace} `this` - */ -Namespace.prototype.addJSON = function addJSON(nestedJson) { - var ns = this; - /* istanbul ignore else */ - if (nestedJson) { - for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { - nested = nestedJson[names[i]]; - ns.add( // most to least likely - ( nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : nested.id !== undefined - ? Field.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - } - return this; -}; - -/** - * Gets the nested object of the specified name. - * @param {string} name Nested object name - * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist - */ -Namespace.prototype.get = function get(name) { - return this.nested && this.nested[name] - || null; -}; - -/** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param {string} name Nested enum name - * @returns {Object.} Enum values - * @throws {Error} If there is no such enum - */ -Namespace.prototype.getEnum = function getEnum(name) { - if (this.nested && this.nested[name] instanceof Enum) - return this.nested[name].values; - throw Error("no such enum: " + name); -}; - -/** - * Adds a nested object to this namespace. - * @param {ReflectionObject} object Nested object to add - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ -Namespace.prototype.add = function add(object) { - - if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace)) - throw TypeError("object must be a valid nested object"); - - if (!this.nested) - this.nested = {}; - else { - var prev = this.get(object.name); - if (prev) { - if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) { - // replace plain namespace but keep existing nested elements and options - var nested = prev.nestedArray; - for (var i = 0; i < nested.length; ++i) - object.add(nested[i]); - this.remove(prev); - if (!this.nested) - this.nested = {}; - object.setOptions(prev.options, true); - - } else - throw Error("duplicate name '" + object.name + "' in " + this); - } - } - this.nested[object.name] = object; - object.onAdd(this); - return clearCache(this); -}; - -/** - * Removes a nested object from this namespace. - * @param {ReflectionObject} object Nested object to remove - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ -Namespace.prototype.remove = function remove(object) { - - if (!(object instanceof ReflectionObject)) - throw TypeError("object must be a ReflectionObject"); - if (object.parent !== this) - throw Error(object + " is not a member of " + this); - - delete this.nested[object.name]; - if (!Object.keys(this.nested).length) - this.nested = undefined; - - object.onRemove(this); - return clearCache(this); -}; - -/** - * Defines additial namespaces within this one if not yet existing. - * @param {string|string[]} path Path to create - * @param {*} [json] Nested types to create from JSON - * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty - */ -Namespace.prototype.define = function define(path, json) { - - if (util.isString(path)) - path = path.split("."); - else if (!Array.isArray(path)) - throw TypeError("illegal path"); - if (path && path.length && path[0] === "") - throw Error("path must be relative"); - - var ptr = this; - while (path.length > 0) { - var part = path.shift(); - if (ptr.nested && ptr.nested[part]) { - ptr = ptr.nested[part]; - if (!(ptr instanceof Namespace)) - throw Error("path conflicts with non-namespace objects"); - } else - ptr.add(ptr = new Namespace(part)); - } - if (json) - ptr.addJSON(json); - return ptr; -}; - -/** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. - * @returns {Namespace} `this` - */ -Namespace.prototype.resolveAll = function resolveAll() { - var nested = this.nestedArray, i = 0; - while (i < nested.length) - if (nested[i] instanceof Namespace) - nested[i++].resolveAll(); - else - nested[i++].resolve(); - return this.resolve(); -}; - -/** - * Recursively looks up the reflection object matching the specified path in the scope of this namespace. - * @param {string|string[]} path Path to look up - * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - */ -Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { - - /* istanbul ignore next */ - if (typeof filterTypes === "boolean") { - parentAlreadyChecked = filterTypes; - filterTypes = undefined; - } else if (filterTypes && !Array.isArray(filterTypes)) - filterTypes = [ filterTypes ]; - - if (util.isString(path) && path.length) { - if (path === ".") - return this.root; - path = path.split("."); - } else if (!path.length) - return this; - - // Start at root if path is absolute - if (path[0] === "") - return this.root.lookup(path.slice(1), filterTypes); - - // Test if the first part matches any nested object, and if so, traverse if path contains more - var found = this.get(path[0]); - if (found) { - if (path.length === 1) { - if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) - return found; - } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) - return found; - - // Otherwise try each nested namespace - } else - for (var i = 0; i < this.nestedArray.length; ++i) - if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) - return found; - - // If there hasn't been a match, try again at the parent - if (this.parent === null || parentAlreadyChecked) - return null; - return this.parent.lookup(path, filterTypes); -}; - -/** - * Looks up the reflection object at the specified path, relative to this namespace. - * @name NamespaceBase#lookup - * @function - * @param {string|string[]} path Path to look up - * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - * @variation 2 - */ -// lookup(path: string, [parentAlreadyChecked: boolean]) - -/** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type - * @throws {Error} If `path` does not point to a type - */ -Namespace.prototype.lookupType = function lookupType(path) { - var found = this.lookup(path, [ Type ]); - if (!found) - throw Error("no such type: " + path); - return found; -}; - -/** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Enum} Looked up enum - * @throws {Error} If `path` does not point to an enum - */ -Namespace.prototype.lookupEnum = function lookupEnum(path) { - var found = this.lookup(path, [ Enum ]); - if (!found) - throw Error("no such Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type or enum - * @throws {Error} If `path` does not point to a type or enum - */ -Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { - var found = this.lookup(path, [ Type, Enum ]); - if (!found) - throw Error("no such Type or Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Service} Looked up service - * @throws {Error} If `path` does not point to a service - */ -Namespace.prototype.lookupService = function lookupService(path) { - var found = this.lookup(path, [ Service ]); - if (!found) - throw Error("no such Service '" + path + "' in " + this); - return found; -}; - -// Sets up cyclic dependencies (called in index-light) -Namespace._configure = function(Type_, Service_, Enum_) { - Type = Type_; - Service = Service_; - Enum = Enum_; -}; - -},{"16":16,"24":24,"37":37}],24:[function(require,module,exports){ -"use strict"; -module.exports = ReflectionObject; - -ReflectionObject.className = "ReflectionObject"; - -var util = require(37); - -var Root; // cyclic - -/** - * Constructs a new reflection object instance. - * @classdesc Base class of all reflection objects. - * @constructor - * @param {string} name Object name - * @param {Object.} [options] Declared options - * @abstract - */ -function ReflectionObject(name, options) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (options && !util.isObject(options)) - throw TypeError("options must be an object"); - - /** - * Options. - * @type {Object.|undefined} - */ - this.options = options; // toJSON - - /** - * Unique name within its namespace. - * @type {string} - */ - this.name = name; - - /** - * Parent namespace. - * @type {Namespace|null} - */ - this.parent = null; - - /** - * Whether already resolved or not. - * @type {boolean} - */ - this.resolved = false; - - /** - * Comment text, if any. - * @type {string|null} - */ - this.comment = null; - - /** - * Defining file name. - * @type {string|null} - */ - this.filename = null; -} - -Object.defineProperties(ReflectionObject.prototype, { - - /** - * Reference to the root namespace. - * @name ReflectionObject#root - * @type {Root} - * @readonly - */ - root: { - get: function() { - var ptr = this; - while (ptr.parent !== null) - ptr = ptr.parent; - return ptr; - } - }, - - /** - * Full name including leading dot. - * @name ReflectionObject#fullName - * @type {string} - * @readonly - */ - fullName: { - get: function() { - var path = [ this.name ], - ptr = this.parent; - while (ptr) { - path.unshift(ptr.name); - ptr = ptr.parent; - } - return path.join("."); - } - } -}); - -/** - * Converts this reflection object to its descriptor representation. - * @returns {Object.} Descriptor - * @abstract - */ -ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { - throw Error(); // not implemented, shouldn't happen -}; - -/** - * Called when this object is added to a parent. - * @param {ReflectionObject} parent Parent added to - * @returns {undefined} - */ -ReflectionObject.prototype.onAdd = function onAdd(parent) { - if (this.parent && this.parent !== parent) - this.parent.remove(this); - this.parent = parent; - this.resolved = false; - var root = parent.root; - if (root instanceof Root) - root._handleAdd(this); -}; - -/** - * Called when this object is removed from a parent. - * @param {ReflectionObject} parent Parent removed from - * @returns {undefined} - */ -ReflectionObject.prototype.onRemove = function onRemove(parent) { - var root = parent.root; - if (root instanceof Root) - root._handleRemove(this); - this.parent = null; - this.resolved = false; -}; - -/** - * Resolves this objects type references. - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.resolve = function resolve() { - if (this.resolved) - return this; - if (this.root instanceof Root) - this.resolved = true; // only if part of a root - return this; -}; - -/** - * Gets an option value. - * @param {string} name Option name - * @returns {*} Option value or `undefined` if not set - */ -ReflectionObject.prototype.getOption = function getOption(name) { - if (this.options) - return this.options[name]; - return undefined; -}; - -/** - * Sets an option. - * @param {string} name Option name - * @param {*} value Option value - * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { - if (!ifNotSet || !this.options || this.options[name] === undefined) - (this.options || (this.options = {}))[name] = value; - return this; -}; - -/** - * Sets multiple options. - * @param {Object.} options Options to set - * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { - if (options) - for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) - this.setOption(keys[i], options[keys[i]], ifNotSet); - return this; -}; - -/** - * Converts this instance to its string representation. - * @returns {string} Class name[, space, full name] - */ -ReflectionObject.prototype.toString = function toString() { - var className = this.constructor.className, - fullName = this.fullName; - if (fullName.length) - return className + " " + fullName; - return className; -}; - -// Sets up cyclic dependencies (called in index-light) -ReflectionObject._configure = function(Root_) { - Root = Root_; -}; - -},{"37":37}],25:[function(require,module,exports){ -"use strict"; -module.exports = OneOf; - -// extends ReflectionObject -var ReflectionObject = require(24); -((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; - -var Field = require(16), - util = require(37); - -/** - * Constructs a new oneof instance. - * @classdesc Reflected oneof. - * @extends ReflectionObject - * @constructor - * @param {string} name Oneof name - * @param {string[]|Object.} [fieldNames] Field names - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function OneOf(name, fieldNames, options, comment) { - if (!Array.isArray(fieldNames)) { - options = fieldNames; - fieldNames = undefined; - } - ReflectionObject.call(this, name, options); - - /* istanbul ignore if */ - if (!(fieldNames === undefined || Array.isArray(fieldNames))) - throw TypeError("fieldNames must be an Array"); - - /** - * Field names that belong to this oneof. - * @type {string[]} - */ - this.oneof = fieldNames || []; // toJSON, marker - - /** - * Fields that belong to this oneof as an array for iteration. - * @type {Field[]} - * @readonly - */ - this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Oneof descriptor. - * @interface IOneOf - * @property {Array.} oneof Oneof field names - * @property {Object.} [options] Oneof options - */ - -/** - * Constructs a oneof from a oneof descriptor. - * @param {string} name Oneof name - * @param {IOneOf} json Oneof descriptor - * @returns {OneOf} Created oneof - * @throws {TypeError} If arguments are invalid - */ -OneOf.fromJSON = function fromJSON(name, json) { - return new OneOf(name, json.oneof, json.options, json.comment); -}; - -/** - * Converts this oneof to a oneof descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IOneOf} Oneof descriptor - */ -OneOf.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "oneof" , this.oneof, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Adds the fields of the specified oneof to the parent if not already done so. - * @param {OneOf} oneof The oneof - * @returns {undefined} - * @inner - * @ignore - */ -function addFieldsToParent(oneof) { - if (oneof.parent) - for (var i = 0; i < oneof.fieldsArray.length; ++i) - if (!oneof.fieldsArray[i].parent) - oneof.parent.add(oneof.fieldsArray[i]); -} - -/** - * Adds a field to this oneof and removes it from its current parent, if any. - * @param {Field} field Field to add - * @returns {OneOf} `this` - */ -OneOf.prototype.add = function add(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - if (field.parent && field.parent !== this.parent) - field.parent.remove(field); - this.oneof.push(field.name); - this.fieldsArray.push(field); - field.partOf = this; // field.parent remains null - addFieldsToParent(this); - return this; -}; - -/** - * Removes a field from this oneof and puts it back to the oneof's parent. - * @param {Field} field Field to remove - * @returns {OneOf} `this` - */ -OneOf.prototype.remove = function remove(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - var index = this.fieldsArray.indexOf(field); - - /* istanbul ignore if */ - if (index < 0) - throw Error(field + " is not a member of " + this); - - this.fieldsArray.splice(index, 1); - index = this.oneof.indexOf(field.name); - - /* istanbul ignore else */ - if (index > -1) // theoretical - this.oneof.splice(index, 1); - - field.partOf = null; - return this; -}; - -/** - * @override - */ -OneOf.prototype.onAdd = function onAdd(parent) { - ReflectionObject.prototype.onAdd.call(this, parent); - var self = this; - // Collect present fields - for (var i = 0; i < this.oneof.length; ++i) { - var field = parent.get(this.oneof[i]); - if (field && !field.partOf) { - field.partOf = self; - self.fieldsArray.push(field); - } - } - // Add not yet present fields - addFieldsToParent(this); -}; - -/** - * @override - */ -OneOf.prototype.onRemove = function onRemove(parent) { - for (var i = 0, field; i < this.fieldsArray.length; ++i) - if ((field = this.fieldsArray[i]).parent) - field.parent.remove(field); - ReflectionObject.prototype.onRemove.call(this, parent); -}; - -/** - * Decorator function as returned by {@link OneOf.d} (TypeScript). - * @typedef OneOfDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} oneofName OneOf name - * @returns {undefined} - */ - -/** - * OneOf decorator (TypeScript). - * @function - * @param {...string} fieldNames Field names - * @returns {OneOfDecorator} Decorator function - * @template T extends string - */ -OneOf.d = function decorateOneOf() { - var fieldNames = new Array(arguments.length), - index = 0; - while (index < arguments.length) - fieldNames[index] = arguments[index++]; - return function oneOfDecorator(prototype, oneofName) { - util.decorateType(prototype.constructor) - .add(new OneOf(oneofName, fieldNames)); - Object.defineProperty(prototype, oneofName, { - get: util.oneOfGetter(fieldNames), - set: util.oneOfSetter(fieldNames) - }); - }; -}; - -},{"16":16,"24":24,"37":37}],26:[function(require,module,exports){ -"use strict"; -module.exports = parse; - -parse.filename = null; -parse.defaults = { keepCase: false }; - -var tokenize = require(34), - Root = require(29), - Type = require(35), - Field = require(16), - MapField = require(20), - OneOf = require(25), - Enum = require(15), - Service = require(33), - Method = require(22), - types = require(36), - util = require(37); - -var base10Re = /^[1-9][0-9]*$/, - base10NegRe = /^-?[1-9][0-9]*$/, - base16Re = /^0[x][0-9a-fA-F]+$/, - base16NegRe = /^-?0[x][0-9a-fA-F]+$/, - base8Re = /^0[0-7]+$/, - base8NegRe = /^-?0[0-7]+$/, - numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, - nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, - typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, - fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/; - -/** - * Result object returned from {@link parse}. - * @interface IParserResult - * @property {string|undefined} package Package name, if declared - * @property {string[]|undefined} imports Imports, if any - * @property {string[]|undefined} weakImports Weak imports, if any - * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`) - * @property {Root} root Populated root instance - */ - -/** - * Options modifying the behavior of {@link parse}. - * @interface IParseOptions - * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case - * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments. - */ - -/** - * Options modifying the behavior of JSON serialization. - * @interface IToJSONOptions - * @property {boolean} [keepComments=false] Serializes comments. - */ - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @param {string} source Source contents - * @param {Root} root Root to populate - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - */ -function parse(source, root, options) { - /* eslint-disable callback-return */ - if (!(root instanceof Root)) { - options = root; - root = new Root(); - } - if (!options) - options = parse.defaults; - - var tn = tokenize(source, options.alternateCommentMode || false), - next = tn.next, - push = tn.push, - peek = tn.peek, - skip = tn.skip, - cmnt = tn.cmnt; - - var head = true, - pkg, - imports, - weakImports, - syntax, - isProto3 = false; - - var ptr = root; - - var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase; - - /* istanbul ignore next */ - function illegal(token, name, insideTryCatch) { - var filename = parse.filename; - if (!insideTryCatch) - parse.filename = null; - return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")"); - } - - function readString() { - var values = [], - token; - do { - /* istanbul ignore if */ - if ((token = next()) !== "\"" && token !== "'") - throw illegal(token); - - values.push(next()); - skip(token); - token = peek(); - } while (token === "\"" || token === "'"); - return values.join(""); - } - - function readValue(acceptTypeRef) { - var token = next(); - switch (token) { - case "'": - case "\"": - push(token); - return readString(); - case "true": case "TRUE": - return true; - case "false": case "FALSE": - return false; - } - try { - return parseNumber(token, /* insideTryCatch */ true); - } catch (e) { - - /* istanbul ignore else */ - if (acceptTypeRef && typeRefRe.test(token)) - return token; - - /* istanbul ignore next */ - throw illegal(token, "value"); - } - } - - function readRanges(target, acceptStrings) { - var token, start; - do { - if (acceptStrings && ((token = peek()) === "\"" || token === "'")) - target.push(readString()); - else - target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]); - } while (skip(",", true)); - skip(";"); - } - - function parseNumber(token, insideTryCatch) { - var sign = 1; - if (token.charAt(0) === "-") { - sign = -1; - token = token.substring(1); - } - switch (token) { - case "inf": case "INF": case "Inf": - return sign * Infinity; - case "nan": case "NAN": case "Nan": case "NaN": - return NaN; - case "0": - return 0; - } - if (base10Re.test(token)) - return sign * parseInt(token, 10); - if (base16Re.test(token)) - return sign * parseInt(token, 16); - if (base8Re.test(token)) - return sign * parseInt(token, 8); - - /* istanbul ignore else */ - if (numberRe.test(token)) - return sign * parseFloat(token); - - /* istanbul ignore next */ - throw illegal(token, "number", insideTryCatch); - } - - function parseId(token, acceptNegative) { - switch (token) { - case "max": case "MAX": case "Max": - return 536870911; - case "0": - return 0; - } - - /* istanbul ignore if */ - if (!acceptNegative && token.charAt(0) === "-") - throw illegal(token, "id"); - - if (base10NegRe.test(token)) - return parseInt(token, 10); - if (base16NegRe.test(token)) - return parseInt(token, 16); - - /* istanbul ignore else */ - if (base8NegRe.test(token)) - return parseInt(token, 8); - - /* istanbul ignore next */ - throw illegal(token, "id"); - } - - function parsePackage() { - - /* istanbul ignore if */ - if (pkg !== undefined) - throw illegal("package"); - - pkg = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(pkg)) - throw illegal(pkg, "name"); - - ptr = ptr.define(pkg); - skip(";"); - } - - function parseImport() { - var token = peek(); - var whichImports; - switch (token) { - case "weak": - whichImports = weakImports || (weakImports = []); - next(); - break; - case "public": - next(); - // eslint-disable-line no-fallthrough - default: - whichImports = imports || (imports = []); - break; - } - token = readString(); - skip(";"); - whichImports.push(token); - } - - function parseSyntax() { - skip("="); - syntax = readString(); - isProto3 = syntax === "proto3"; - - /* istanbul ignore if */ - if (!isProto3 && syntax !== "proto2") - throw illegal(syntax, "syntax"); - - skip(";"); - } - - function parseCommon(parent, token) { - switch (token) { - - case "option": - parseOption(parent, token); - skip(";"); - return true; - - case "message": - parseType(parent, token); - return true; - - case "enum": - parseEnum(parent, token); - return true; - - case "service": - parseService(parent, token); - return true; - - case "extend": - parseExtension(parent, token); - return true; - } - return false; - } - - function ifBlock(obj, fnIf, fnElse) { - var trailingLine = tn.line; - if (obj) { - obj.comment = cmnt(); // try block-type comment - obj.filename = parse.filename; - } - if (skip("{", true)) { - var token; - while ((token = next()) !== "}") - fnIf(token); - skip(";", true); - } else { - if (fnElse) - fnElse(); - skip(";"); - if (obj && typeof obj.comment !== "string") - obj.comment = cmnt(trailingLine); // try line-type comment if no block - } - } - - function parseType(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "type name"); - - var type = new Type(token); - ifBlock(type, function parseType_block(token) { - if (parseCommon(type, token)) - return; - - switch (token) { - - case "map": - parseMapField(type, token); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - case "oneof": - parseOneOf(type, token); - break; - - case "extensions": - readRanges(type.extensions || (type.extensions = [])); - break; - - case "reserved": - readRanges(type.reserved || (type.reserved = []), true); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - - push(token); - parseField(type, "optional"); - break; - } - }); - parent.add(type); - } - - function parseField(parent, rule, extend) { - var type = next(); - if (type === "group") { - parseGroup(parent, rule); - return; - } - - /* istanbul ignore if */ - if (!typeRefRe.test(type)) - throw illegal(type, "type"); - - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - name = applyCase(name); - skip("="); - - var field = new Field(name, parseId(next()), type, rule, extend); - ifBlock(field, function parseField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseField_line() { - parseInlineOptions(field); - }); - parent.add(field); - - // JSON defaults to packed=true if not set so we have to set packed=false explicity when - // parsing proto2 descriptors without the option, where applicable. This must be done for - // all known packable types and anything that could be an enum (= is not a basic type). - if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined)) - field.setOption("packed", false, /* ifNotSet */ true); - } - - function parseGroup(parent, rule) { - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - var fieldName = util.lcFirst(name); - if (name === fieldName) - name = util.ucFirst(name); - skip("="); - var id = parseId(next()); - var type = new Type(name); - type.group = true; - var field = new Field(fieldName, id, name, rule); - field.filename = parse.filename; - ifBlock(type, function parseGroup_block(token) { - switch (token) { - - case "option": - parseOption(type, token); - skip(";"); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - /* istanbul ignore next */ - default: - throw illegal(token); // there are no groups with proto3 semantics - } - }); - parent.add(type) - .add(field); - } - - function parseMapField(parent) { - skip("<"); - var keyType = next(); - - /* istanbul ignore if */ - if (types.mapKey[keyType] === undefined) - throw illegal(keyType, "type"); - - skip(","); - var valueType = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(valueType)) - throw illegal(valueType, "type"); - - skip(">"); - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - skip("="); - var field = new MapField(applyCase(name), parseId(next()), keyType, valueType); - ifBlock(field, function parseMapField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseMapField_line() { - parseInlineOptions(field); - }); - parent.add(field); - } - - function parseOneOf(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var oneof = new OneOf(applyCase(token)); - ifBlock(oneof, function parseOneOf_block(token) { - if (token === "option") { - parseOption(oneof, token); - skip(";"); - } else { - push(token); - parseField(oneof, "optional"); - } - }); - parent.add(oneof); - } - - function parseEnum(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var enm = new Enum(token); - ifBlock(enm, function parseEnum_block(token) { - switch(token) { - case "option": - parseOption(enm, token); - skip(";"); - break; - - case "reserved": - readRanges(enm.reserved || (enm.reserved = []), true); - break; - - default: - parseEnumValue(enm, token); - } - }); - parent.add(enm); - } - - function parseEnumValue(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token)) - throw illegal(token, "name"); - - skip("="); - var value = parseId(next(), true), - dummy = {}; - ifBlock(dummy, function parseEnumValue_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(dummy, token); // skip - skip(";"); - } else - throw illegal(token); - - }, function parseEnumValue_line() { - parseInlineOptions(dummy); // skip - }); - parent.add(token, value, dummy.comment); - } - - function parseOption(parent, token) { - var isCustom = skip("(", true); - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "name"); - - var name = token; - if (isCustom) { - skip(")"); - name = "(" + name + ")"; - token = peek(); - if (fqTypeRefRe.test(token)) { - name += token; - next(); - } - } - skip("="); - parseOptionValue(parent, name); - } - - function parseOptionValue(parent, name) { - if (skip("{", true)) { // { a: "foo" b { c: "bar" } } - do { - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - if (peek() === "{") - parseOptionValue(parent, name + "." + token); - else { - skip(":"); - if (peek() === "{") - parseOptionValue(parent, name + "." + token); - else - setOption(parent, name + "." + token, readValue(true)); - } - skip(",", true); - } while (!skip("}", true)); - } else - setOption(parent, name, readValue(true)); - // Does not enforce a delimiter to be universal - } - - function setOption(parent, name, value) { - if (parent.setOption) - parent.setOption(name, value); - } - - function parseInlineOptions(parent) { - if (skip("[", true)) { - do { - parseOption(parent, "option"); - } while (skip(",", true)); - skip("]"); - } - return parent; - } - - function parseService(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "service name"); - - var service = new Service(token); - ifBlock(service, function parseService_block(token) { - if (parseCommon(service, token)) - return; - - /* istanbul ignore else */ - if (token === "rpc") - parseMethod(service, token); - else - throw illegal(token); - }); - parent.add(service); - } - - function parseMethod(parent, token) { - var type = token; - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var name = token, - requestType, requestStream, - responseType, responseStream; - - skip("("); - if (skip("stream", true)) - requestStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - requestType = token; - skip(")"); skip("returns"); skip("("); - if (skip("stream", true)) - responseStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - responseType = token; - skip(")"); - - var method = new Method(name, type, requestType, responseType, requestStream, responseStream); - ifBlock(method, function parseMethod_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(method, token); - skip(";"); - } else - throw illegal(token); - - }); - parent.add(method); - } - - function parseExtension(parent, token) { - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "reference"); - - var reference = token; - ifBlock(null, function parseExtension_block(token) { - switch (token) { - - case "required": - case "repeated": - case "optional": - parseField(parent, token, reference); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - push(token); - parseField(parent, "optional", reference); - break; - } - }); - } - - var token; - while ((token = next()) !== null) { - switch (token) { - - case "package": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parsePackage(); - break; - - case "import": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseImport(); - break; - - case "syntax": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseSyntax(); - break; - - case "option": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseOption(ptr, token); - skip(";"); - break; - - default: - - /* istanbul ignore else */ - if (parseCommon(ptr, token)) { - head = false; - continue; - } - - /* istanbul ignore next */ - throw illegal(token); - } - } - - parse.filename = null; - return { - "package" : pkg, - "imports" : imports, - weakImports : weakImports, - syntax : syntax, - root : root - }; -} - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @name parse - * @function - * @param {string} source Source contents - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - * @variation 2 - */ - -},{"15":15,"16":16,"20":20,"22":22,"25":25,"29":29,"33":33,"34":34,"35":35,"36":36,"37":37}],27:[function(require,module,exports){ -"use strict"; -module.exports = Reader; - -var util = require(39); - -var BufferReader; // cyclic - -var LongBits = util.LongBits, - utf8 = util.utf8; - -/* istanbul ignore next */ -function indexOutOfRange(reader, writeLength) { - return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); -} - -/** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ -function Reader(buffer) { - - /** - * Read buffer. - * @type {Uint8Array} - */ - this.buf = buffer; - - /** - * Read buffer position. - * @type {number} - */ - this.pos = 0; - - /** - * Read buffer length. - * @type {number} - */ - this.len = buffer.length; -} - -var create_array = typeof Uint8Array !== "undefined" - ? function create_typed_array(buffer) { - if (buffer instanceof Uint8Array || Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - } - /* istanbul ignore next */ - : function create_array(buffer) { - if (Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - }; - -/** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array|Buffer} buffer Buffer to read from - * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ -Reader.create = util.Buffer - ? function create_buffer_setup(buffer) { - return (Reader.create = function create_buffer(buffer) { - return util.Buffer.isBuffer(buffer) - ? new BufferReader(buffer) - /* istanbul ignore next */ - : create_array(buffer); - })(buffer); - } - /* istanbul ignore next */ - : create_array; - -Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; - -/** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ -Reader.prototype.uint32 = (function read_uint32_setup() { - var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) - return function read_uint32() { - value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; - - /* istanbul ignore if */ - if ((this.pos += 5) > this.len) { - this.pos = this.len; - throw indexOutOfRange(this, 10); - } - return value; - }; -})(); - -/** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.int32 = function read_int32() { - return this.uint32() | 0; -}; - -/** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.sint32 = function read_sint32() { - var value = this.uint32(); - return value >>> 1 ^ -(value & 1) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readLongVarint() { - // tends to deopt with local vars for octet etc. - var bits = new LongBits(0, 0); - var i = 0; - if (this.len - this.pos > 4) { // fast route (lo) - for (; i < 4; ++i) { - // 1st..4th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 5th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; - bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - i = 0; - } else { - for (; i < 3; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 1st..3th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 4th - bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; - return bits; - } - if (this.len - this.pos > 4) { // fast route (hi) - for (; i < 5; ++i) { - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } else { - for (; i < 5; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } - /* istanbul ignore next */ - throw Error("invalid varint encoding"); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ -Reader.prototype.bool = function read_bool() { - return this.uint32() !== 0; -}; - -function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` - return (buf[end - 4] - | buf[end - 3] << 8 - | buf[end - 2] << 16 - | buf[end - 1] << 24) >>> 0; -} - -/** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.fixed32 = function read_fixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4); -}; - -/** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.sfixed32 = function read_sfixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readFixed64(/* this: Reader */) { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 8); - - return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.float = function read_float() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readFloatLE(this.buf, this.pos); - this.pos += 4; - return value; -}; - -/** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.double = function read_double() { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readDoubleLE(this.buf, this.pos); - this.pos += 8; - return value; -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ -Reader.prototype.bytes = function read_bytes() { - var length = this.uint32(), - start = this.pos, - end = this.pos + length; - - /* istanbul ignore if */ - if (end > this.len) - throw indexOutOfRange(this, length); - - this.pos += length; - if (Array.isArray(this.buf)) // plain array - return this.buf.slice(start, end); - return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1 - ? new this.buf.constructor(0) - : this._slice.call(this.buf, start, end); -}; - -/** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ -Reader.prototype.string = function read_string() { - var bytes = this.bytes(); - return utf8.read(bytes, 0, bytes.length); -}; - -/** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ -Reader.prototype.skip = function skip(length) { - if (typeof length === "number") { - /* istanbul ignore if */ - if (this.pos + length > this.len) - throw indexOutOfRange(this, length); - this.pos += length; - } else { - do { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - } while (this.buf[this.pos++] & 128); - } - return this; -}; - -/** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ -Reader.prototype.skipType = function(wireType) { - switch (wireType) { - case 0: - this.skip(); - break; - case 1: - this.skip(8); - break; - case 2: - this.skip(this.uint32()); - break; - case 3: - while ((wireType = this.uint32() & 7) !== 4) { - this.skipType(wireType); - } - break; - case 5: - this.skip(4); - break; - - /* istanbul ignore next */ - default: - throw Error("invalid wire type " + wireType + " at offset " + this.pos); - } - return this; -}; - -Reader._configure = function(BufferReader_) { - BufferReader = BufferReader_; - - var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; - util.merge(Reader.prototype, { - - int64: function read_int64() { - return readLongVarint.call(this)[fn](false); - }, - - uint64: function read_uint64() { - return readLongVarint.call(this)[fn](true); - }, - - sint64: function read_sint64() { - return readLongVarint.call(this).zzDecode()[fn](false); - }, - - fixed64: function read_fixed64() { - return readFixed64.call(this)[fn](true); - }, - - sfixed64: function read_sfixed64() { - return readFixed64.call(this)[fn](false); - } - - }); -}; - -},{"39":39}],28:[function(require,module,exports){ -"use strict"; -module.exports = BufferReader; - -// extends Reader -var Reader = require(27); -(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; - -var util = require(39); - -/** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ -function BufferReader(buffer) { - Reader.call(this, buffer); - - /** - * Read buffer. - * @name BufferReader#buf - * @type {Buffer} - */ -} - -/* istanbul ignore else */ -if (util.Buffer) - BufferReader.prototype._slice = util.Buffer.prototype.slice; - -/** - * @override - */ -BufferReader.prototype.string = function read_string_buffer() { - var len = this.uint32(); // modifies pos - return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)); -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @name BufferReader#bytes - * @function - * @returns {Buffer} Value read - */ - -},{"27":27,"39":39}],29:[function(require,module,exports){ -"use strict"; -module.exports = Root; - -// extends Namespace -var Namespace = require(23); -((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root"; - -var Field = require(16), - Enum = require(15), - OneOf = require(25), - util = require(37); - -var Type, // cyclic - parse, // might be excluded - common; // " - -/** - * Constructs a new root namespace instance. - * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. - * @extends NamespaceBase - * @constructor - * @param {Object.} [options] Top level options - */ -function Root(options) { - Namespace.call(this, "", options); - - /** - * Deferred extension fields. - * @type {Field[]} - */ - this.deferred = []; - - /** - * Resolved file names of loaded files. - * @type {string[]} - */ - this.files = []; -} - -/** - * Loads a namespace descriptor into a root namespace. - * @param {INamespace} json Nameespace descriptor - * @param {Root} [root] Root namespace, defaults to create a new one if omitted - * @returns {Root} Root namespace - */ -Root.fromJSON = function fromJSON(json, root) { - if (!root) - root = new Root(); - if (json.options) - root.setOptions(json.options); - return root.addJSON(json.nested); -}; - -/** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @function - * @param {string} origin The file name of the importing file - * @param {string} target The file name being imported - * @returns {string|null} Resolved path to `target` or `null` to skip the file - */ -Root.prototype.resolvePath = util.path.resolve; - -// A symbol-like function to safely signal synchronous loading -/* istanbul ignore next */ -function SYNC() {} // eslint-disable-line no-empty-function - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} options Parse options - * @param {LoadCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.load = function load(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - var self = this; - if (!callback) - return util.asPromise(load, self, filename, options); - - var sync = callback === SYNC; // undocumented - - // Finishes loading by calling the callback (exactly once) - function finish(err, root) { - /* istanbul ignore if */ - if (!callback) - return; - var cb = callback; - callback = null; - if (sync) - throw err; - cb(err, root); - } - - // Processes a single file - function process(filename, source) { - try { - if (util.isString(source) && source.charAt(0) === "{") - source = JSON.parse(source); - if (!util.isString(source)) - self.setOptions(source.options).addJSON(source.nested); - else { - parse.filename = filename; - var parsed = parse(source, self, options), - resolved, - i = 0; - if (parsed.imports) - for (; i < parsed.imports.length; ++i) - if (resolved = self.resolvePath(filename, parsed.imports[i])) - fetch(resolved); - if (parsed.weakImports) - for (i = 0; i < parsed.weakImports.length; ++i) - if (resolved = self.resolvePath(filename, parsed.weakImports[i])) - fetch(resolved, true); - } - } catch (err) { - finish(err); - } - if (!sync && !queued) - finish(null, self); // only once anyway - } - - // Fetches a single file - function fetch(filename, weak) { - - // Strip path if this file references a bundled definition - var idx = filename.lastIndexOf("google/protobuf/"); - if (idx > -1) { - var altname = filename.substring(idx); - if (altname in common) - filename = altname; - } - - // Skip if already loaded / attempted - if (self.files.indexOf(filename) > -1) - return; - self.files.push(filename); - - // Shortcut bundled definitions - if (filename in common) { - if (sync) - process(filename, common[filename]); - else { - ++queued; - setTimeout(function() { - --queued; - process(filename, common[filename]); - }); - } - return; - } - - // Otherwise fetch from disk or network - if (sync) { - var source; - try { - source = util.fs.readFileSync(filename).toString("utf8"); - } catch (err) { - if (!weak) - finish(err); - return; - } - process(filename, source); - } else { - ++queued; - util.fetch(filename, function(err, source) { - --queued; - /* istanbul ignore if */ - if (!callback) - return; // terminated meanwhile - if (err) { - /* istanbul ignore else */ - if (!weak) - finish(err); - else if (!queued) // can't be covered reliably - finish(null, self); - return; - } - process(filename, source); - }); - } - } - var queued = 0; - - // Assembling the root namespace doesn't require working type - // references anymore, so we can load everything in parallel - if (util.isString(filename)) - filename = [ filename ]; - for (var i = 0, resolved; i < filename.length; ++i) - if (resolved = self.resolvePath("", filename[i])) - fetch(resolved); - - if (sync) - return self; - if (!queued) - finish(null, self); - return undefined; -}; -// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Promise} Promise - * @variation 3 - */ -// function load(filename:string, [options:IParseOptions]):Promise - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). - * @function Root#loadSync - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ -Root.prototype.loadSync = function loadSync(filename, options) { - if (!util.isNode) - throw Error("not supported"); - return this.load(filename, options, SYNC); -}; - -/** - * @override - */ -Root.prototype.resolveAll = function resolveAll() { - if (this.deferred.length) - throw Error("unresolvable extensions: " + this.deferred.map(function(field) { - return "'extend " + field.extend + "' in " + field.parent.fullName; - }).join(", ")); - return Namespace.prototype.resolveAll.call(this); -}; - -// only uppercased (and thus conflict-free) children are exposed, see below -var exposeRe = /^[A-Z]/; - -/** - * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. - * @param {Root} root Root instance - * @param {Field} field Declaring extension field witin the declaring type - * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise - * @inner - * @ignore - */ -function tryHandleExtension(root, field) { - var extendedType = field.parent.lookup(field.extend); - if (extendedType) { - var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); - sisterField.declaringField = field; - field.extensionField = sisterField; - extendedType.add(sisterField); - return true; - } - return false; -} - -/** - * Called when any object is added to this root or its sub-namespaces. - * @param {ReflectionObject} object Object added - * @returns {undefined} - * @private - */ -Root.prototype._handleAdd = function _handleAdd(object) { - if (object instanceof Field) { - - if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField) - if (!tryHandleExtension(this, object)) - this.deferred.push(object); - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - object.parent[object.name] = object.values; // expose enum values as property of its parent - - } else if (!(object instanceof OneOf)) /* everything else is a namespace */ { - - if (object instanceof Type) // Try to handle any deferred extensions - for (var i = 0; i < this.deferred.length;) - if (tryHandleExtension(this, this.deferred[i])) - this.deferred.splice(i, 1); - else - ++i; - for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace - this._handleAdd(object._nestedArray[j]); - if (exposeRe.test(object.name)) - object.parent[object.name] = object; // expose namespace as property of its parent - } - - // The above also adds uppercased (and thus conflict-free) nested types, services and enums as - // properties of namespaces just like static code does. This allows using a .d.ts generated for - // a static module with reflection-based solutions where the condition is met. -}; - -/** - * Called when any object is removed from this root or its sub-namespaces. - * @param {ReflectionObject} object Object removed - * @returns {undefined} - * @private - */ -Root.prototype._handleRemove = function _handleRemove(object) { - if (object instanceof Field) { - - if (/* an extension field */ object.extend !== undefined) { - if (/* already handled */ object.extensionField) { // remove its sister field - object.extensionField.parent.remove(object.extensionField); - object.extensionField = null; - } else { // cancel the extension - var index = this.deferred.indexOf(object); - /* istanbul ignore else */ - if (index > -1) - this.deferred.splice(index, 1); - } - } - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose enum values - - } else if (object instanceof Namespace) { - - for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace - this._handleRemove(object._nestedArray[i]); - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose namespaces - - } -}; - -// Sets up cyclic dependencies (called in index-light) -Root._configure = function(Type_, parse_, common_) { - Type = Type_; - parse = parse_; - common = common_; -}; - -},{"15":15,"16":16,"23":23,"25":25,"37":37}],30:[function(require,module,exports){ -"use strict"; -module.exports = {}; - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} - * @example - * // pbjs -r myroot -o compiled.js ... - * - * // in another module: - * require("./compiled.js"); - * - * // in any subsequent module: - * var root = protobuf.roots["myroot"]; - */ - -},{}],31:[function(require,module,exports){ -"use strict"; - -/** - * Streaming RPC helpers. - * @namespace - */ -var rpc = exports; - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called - * @param {Uint8Array} requestData Request data - * @param {RPCImplCallback} callback Callback function - * @returns {undefined} - * @example - * function rpcImpl(method, requestData, callback) { - * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code - * throw Error("no such method"); - * asynchronouslyObtainAResponse(requestData, function(err, responseData) { - * callback(err, responseData); - * }); - * } - */ - -/** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCImplCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} - */ - -rpc.Service = require(32); - -},{"32":32}],32:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -var util = require(39); - -// Extends EventEmitter -(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; - -/** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @typedef rpc.ServiceMethodCallback - * @template TRes extends Message - * @type {function} - * @param {Error|null} error Error, if any - * @param {TRes} [response] Response message - * @returns {undefined} - */ - -/** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @typedef rpc.ServiceMethod - * @template TReq extends Message - * @template TRes extends Message - * @type {function} - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message - * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` - */ - -/** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @exports rpc.Service - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ -function Service(rpcImpl, requestDelimited, responseDelimited) { - - if (typeof rpcImpl !== "function") - throw TypeError("rpcImpl must be a function"); - - util.EventEmitter.call(this); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {RPCImpl|null} - */ - this.rpcImpl = rpcImpl; - - /** - * Whether requests are length-delimited. - * @type {boolean} - */ - this.requestDelimited = Boolean(requestDelimited); - - /** - * Whether responses are length-delimited. - * @type {boolean} - */ - this.responseDelimited = Boolean(responseDelimited); -} - -/** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param {Method|rpc.ServiceMethod} method Reflected or static method - * @param {Constructor} requestCtor Request constructor - * @param {Constructor} responseCtor Response constructor - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} callback Service callback - * @returns {undefined} - * @template TReq extends Message - * @template TRes extends Message - */ -Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { - - if (!request) - throw TypeError("request must be specified"); - - var self = this; - if (!callback) - return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); - - if (!self.rpcImpl) { - setTimeout(function() { callback(Error("already ended")); }, 0); - return undefined; - } - - try { - return self.rpcImpl( - method, - requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), - function rpcCallback(err, response) { - - if (err) { - self.emit("error", err, method); - return callback(err); - } - - if (response === null) { - self.end(/* endedByRPC */ true); - return undefined; - } - - if (!(response instanceof responseCtor)) { - try { - response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); - } catch (err) { - self.emit("error", err, method); - return callback(err); - } - } - - self.emit("data", response, method); - return callback(null, response); - } - ); - } catch (err) { - self.emit("error", err, method); - setTimeout(function() { callback(err); }, 0); - return undefined; - } -}; - -/** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ -Service.prototype.end = function end(endedByRPC) { - if (this.rpcImpl) { - if (!endedByRPC) // signal end to rpcImpl - this.rpcImpl(null, null, null); - this.rpcImpl = null; - this.emit("end").off(); - } - return this; -}; - -},{"39":39}],33:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -// extends Namespace -var Namespace = require(23); -((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; - -var Method = require(22), - util = require(37), - rpc = require(31); - -/** - * Constructs a new service instance. - * @classdesc Reflected service. - * @extends NamespaceBase - * @constructor - * @param {string} name Service name - * @param {Object.} [options] Service options - * @throws {TypeError} If arguments are invalid - */ -function Service(name, options) { - Namespace.call(this, name, options); - - /** - * Service methods. - * @type {Object.} - */ - this.methods = {}; // toJSON, marker - - /** - * Cached methods as an array. - * @type {Method[]|null} - * @private - */ - this._methodsArray = null; -} - -/** - * Service descriptor. - * @interface IService - * @extends INamespace - * @property {Object.} methods Method descriptors - */ - -/** - * Constructs a service from a service descriptor. - * @param {string} name Service name - * @param {IService} json Service descriptor - * @returns {Service} Created service - * @throws {TypeError} If arguments are invalid - */ -Service.fromJSON = function fromJSON(name, json) { - var service = new Service(name, json.options); - /* istanbul ignore else */ - if (json.methods) - for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) - service.add(Method.fromJSON(names[i], json.methods[names[i]])); - if (json.nested) - service.addJSON(json.nested); - service.comment = json.comment; - return service; -}; - -/** - * Converts this service to a service descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IService} Service descriptor - */ -Service.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Methods of this service as an array for iteration. - * @name Service#methodsArray - * @type {Method[]} - * @readonly - */ -Object.defineProperty(Service.prototype, "methodsArray", { - get: function() { - return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); - } -}); - -function clearCache(service) { - service._methodsArray = null; - return service; -} - -/** - * @override - */ -Service.prototype.get = function get(name) { - return this.methods[name] - || Namespace.prototype.get.call(this, name); -}; - -/** - * @override - */ -Service.prototype.resolveAll = function resolveAll() { - var methods = this.methodsArray; - for (var i = 0; i < methods.length; ++i) - methods[i].resolve(); - return Namespace.prototype.resolve.call(this); -}; - -/** - * @override - */ -Service.prototype.add = function add(object) { - - /* istanbul ignore if */ - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Method) { - this.methods[object.name] = object; - object.parent = this; - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * @override - */ -Service.prototype.remove = function remove(object) { - if (object instanceof Method) { - - /* istanbul ignore if */ - if (this.methods[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.methods[object.name]; - object.parent = null; - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Creates a runtime service using the specified rpc implementation. - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed. - */ -Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { - var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); - for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { - var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, ""); - rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ - m: method, - q: method.resolvedRequestType.ctor, - s: method.resolvedResponseType.ctor - }); - } - return rpcService; -}; - -},{"22":22,"23":23,"31":31,"37":37}],34:[function(require,module,exports){ -"use strict"; -module.exports = tokenize; - -var delimRe = /[\s{}=;:[\],'"()<>]/g, - stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, - stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g; - -var setCommentRe = /^ *[*/]+ */, - setCommentAltRe = /^\s*\*?\/*/, - setCommentSplitRe = /\n/g, - whitespaceRe = /\s/, - unescapeRe = /\\(.?)/g; - -var unescapeMap = { - "0": "\0", - "r": "\r", - "n": "\n", - "t": "\t" -}; - -/** - * Unescapes a string. - * @param {string} str String to unescape - * @returns {string} Unescaped string - * @property {Object.} map Special characters map - * @memberof tokenize - */ -function unescape(str) { - return str.replace(unescapeRe, function($0, $1) { - switch ($1) { - case "\\": - case "": - return $1; - default: - return unescapeMap[$1] || ""; - } - }); -} - -tokenize.unescape = unescape; - -/** - * Gets the next token and advances. - * @typedef TokenizerHandleNext - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Peeks for the next token. - * @typedef TokenizerHandlePeek - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Pushes a token back to the stack. - * @typedef TokenizerHandlePush - * @type {function} - * @param {string} token Token - * @returns {undefined} - */ - -/** - * Skips the next token. - * @typedef TokenizerHandleSkip - * @type {function} - * @param {string} expected Expected token - * @param {boolean} [optional=false] If optional - * @returns {boolean} Whether the token matched - * @throws {Error} If the token didn't match and is not optional - */ - -/** - * Gets the comment on the previous line or, alternatively, the line comment on the specified line. - * @typedef TokenizerHandleCmnt - * @type {function} - * @param {number} [line] Line number - * @returns {string|null} Comment text or `null` if none - */ - -/** - * Handle object returned from {@link tokenize}. - * @interface ITokenizerHandle - * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof) - * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof) - * @property {TokenizerHandlePush} push Pushes a token back to the stack - * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws - * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any - * @property {number} line Current line number - */ - -/** - * Tokenizes the given .proto source and returns an object with useful utility functions. - * @param {string} source Source contents - * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode. - * @returns {ITokenizerHandle} Tokenizer handle - */ -function tokenize(source, alternateCommentMode) { - /* eslint-disable callback-return */ - source = source.toString(); - - var offset = 0, - length = source.length, - line = 1, - commentType = null, - commentText = null, - commentLine = 0, - commentLineEmpty = false; - - var stack = []; - - var stringDelim = null; - - /* istanbul ignore next */ - /** - * Creates an error for illegal syntax. - * @param {string} subject Subject - * @returns {Error} Error created - * @inner - */ - function illegal(subject) { - return Error("illegal " + subject + " (line " + line + ")"); - } - - /** - * Reads a string till its end. - * @returns {string} String read - * @inner - */ - function readString() { - var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe; - re.lastIndex = offset - 1; - var match = re.exec(source); - if (!match) - throw illegal("string"); - offset = re.lastIndex; - push(stringDelim); - stringDelim = null; - return unescape(match[1]); - } - - /** - * Gets the character at `pos` within the source. - * @param {number} pos Position - * @returns {string} Character - * @inner - */ - function charAt(pos) { - return source.charAt(pos); - } - - /** - * Sets the current comment text. - * @param {number} start Start offset - * @param {number} end End offset - * @returns {undefined} - * @inner - */ - function setComment(start, end) { - commentType = source.charAt(start++); - commentLine = line; - commentLineEmpty = false; - var lookback; - if (alternateCommentMode) { - lookback = 2; // alternate comment parsing: "//" or "/*" - } else { - lookback = 3; // "///" or "/**" - } - var commentOffset = start - lookback, - c; - do { - if (--commentOffset < 0 || - (c = source.charAt(commentOffset)) === "\n") { - commentLineEmpty = true; - break; - } - } while (c === " " || c === "\t"); - var lines = source - .substring(start, end) - .split(setCommentSplitRe); - for (var i = 0; i < lines.length; ++i) - lines[i] = lines[i] - .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "") - .trim(); - commentText = lines - .join("\n") - .trim(); - } - - function isDoubleSlashCommentLine(startOffset) { - var endOffset = findEndOfLine(startOffset); - - // see if remaining line matches comment pattern - var lineText = source.substring(startOffset, endOffset); - // look for 1 or 2 slashes since startOffset would already point past - // the first slash that started the comment. - var isComment = /^\s*\/{1,2}/.test(lineText); - return isComment; - } - - function findEndOfLine(cursor) { - // find end of cursor's line - var endOffset = cursor; - while (endOffset < length && charAt(endOffset) !== "\n") { - endOffset++; - } - return endOffset; - } - - /** - * Obtains the next token. - * @returns {string|null} Next token or `null` on eof - * @inner - */ - function next() { - if (stack.length > 0) - return stack.shift(); - if (stringDelim) - return readString(); - var repeat, - prev, - curr, - start, - isDoc; - do { - if (offset === length) - return null; - repeat = false; - while (whitespaceRe.test(curr = charAt(offset))) { - if (curr === "\n") - ++line; - if (++offset === length) - return null; - } - - if (charAt(offset) === "/") { - if (++offset === length) { - throw illegal("comment"); - } - if (charAt(offset) === "/") { // Line - if (!alternateCommentMode) { - // check for triple-slash comment - isDoc = charAt(start = offset + 1) === "/"; - - while (charAt(++offset) !== "\n") { - if (offset === length) { - return null; - } - } - ++offset; - if (isDoc) { - setComment(start, offset - 1); - } - ++line; - repeat = true; - } else { - // check for double-slash comments, consolidating consecutive lines - start = offset; - isDoc = false; - if (isDoubleSlashCommentLine(offset)) { - isDoc = true; - do { - offset = findEndOfLine(offset); - if (offset === length) { - break; - } - offset++; - } while (isDoubleSlashCommentLine(offset)); - } else { - offset = Math.min(length, findEndOfLine(offset) + 1); - } - if (isDoc) { - setComment(start, offset); - } - line++; - repeat = true; - } - } else if ((curr = charAt(offset)) === "*") { /* Block */ - // check for /** (regular comment mode) or /* (alternate comment mode) - start = offset + 1; - isDoc = alternateCommentMode || charAt(start) === "*"; - do { - if (curr === "\n") { - ++line; - } - if (++offset === length) { - throw illegal("comment"); - } - prev = curr; - curr = charAt(offset); - } while (prev !== "*" || curr !== "/"); - ++offset; - if (isDoc) { - setComment(start, offset - 2); - } - repeat = true; - } else { - return "/"; - } - } - } while (repeat); - - // offset !== length if we got here - - var end = offset; - delimRe.lastIndex = 0; - var delim = delimRe.test(charAt(end++)); - if (!delim) - while (end < length && !delimRe.test(charAt(end))) - ++end; - var token = source.substring(offset, offset = end); - if (token === "\"" || token === "'") - stringDelim = token; - return token; - } - - /** - * Pushes a token back to the stack. - * @param {string} token Token - * @returns {undefined} - * @inner - */ - function push(token) { - stack.push(token); - } - - /** - * Peeks for the next token. - * @returns {string|null} Token or `null` on eof - * @inner - */ - function peek() { - if (!stack.length) { - var token = next(); - if (token === null) - return null; - push(token); - } - return stack[0]; - } - - /** - * Skips a token. - * @param {string} expected Expected token - * @param {boolean} [optional=false] Whether the token is optional - * @returns {boolean} `true` when skipped, `false` if not - * @throws {Error} When a required token is not present - * @inner - */ - function skip(expected, optional) { - var actual = peek(), - equals = actual === expected; - if (equals) { - next(); - return true; - } - if (!optional) - throw illegal("token '" + actual + "', '" + expected + "' expected"); - return false; - } - - /** - * Gets a comment. - * @param {number} [trailingLine] Line number if looking for a trailing comment - * @returns {string|null} Comment text - * @inner - */ - function cmnt(trailingLine) { - var ret = null; - if (trailingLine === undefined) { - if (commentLine === line - 1 && (alternateCommentMode || commentType === "*" || commentLineEmpty)) { - ret = commentText; - } - } else { - /* istanbul ignore else */ - if (commentLine < trailingLine) { - peek(); - } - if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === "/")) { - ret = commentText; - } - } - return ret; - } - - return Object.defineProperty({ - next: next, - peek: peek, - push: push, - skip: skip, - cmnt: cmnt - }, "line", { - get: function() { return line; } - }); - /* eslint-enable callback-return */ -} - -},{}],35:[function(require,module,exports){ -"use strict"; -module.exports = Type; - -// extends Namespace -var Namespace = require(23); -((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type"; - -var Enum = require(15), - OneOf = require(25), - Field = require(16), - MapField = require(20), - Service = require(33), - Message = require(21), - Reader = require(27), - Writer = require(42), - util = require(37), - encoder = require(14), - decoder = require(13), - verifier = require(40), - converter = require(12), - wrappers = require(41); - -/** - * Constructs a new reflected message type instance. - * @classdesc Reflected message type. - * @extends NamespaceBase - * @constructor - * @param {string} name Message name - * @param {Object.} [options] Declared options - */ -function Type(name, options) { - Namespace.call(this, name, options); - - /** - * Message fields. - * @type {Object.} - */ - this.fields = {}; // toJSON, marker - - /** - * Oneofs declared within this namespace, if any. - * @type {Object.} - */ - this.oneofs = undefined; // toJSON - - /** - * Extension ranges, if any. - * @type {number[][]} - */ - this.extensions = undefined; // toJSON - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - /*? - * Whether this type is a legacy group. - * @type {boolean|undefined} - */ - this.group = undefined; // toJSON - - /** - * Cached fields by id. - * @type {Object.|null} - * @private - */ - this._fieldsById = null; - - /** - * Cached fields as an array. - * @type {Field[]|null} - * @private - */ - this._fieldsArray = null; - - /** - * Cached oneofs as an array. - * @type {OneOf[]|null} - * @private - */ - this._oneofsArray = null; - - /** - * Cached constructor. - * @type {Constructor<{}>} - * @private - */ - this._ctor = null; -} - -Object.defineProperties(Type.prototype, { - - /** - * Message fields by id. - * @name Type#fieldsById - * @type {Object.} - * @readonly - */ - fieldsById: { - get: function() { - - /* istanbul ignore if */ - if (this._fieldsById) - return this._fieldsById; - - this._fieldsById = {}; - for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { - var field = this.fields[names[i]], - id = field.id; - - /* istanbul ignore if */ - if (this._fieldsById[id]) - throw Error("duplicate id " + id + " in " + this); - - this._fieldsById[id] = field; - } - return this._fieldsById; - } - }, - - /** - * Fields of this message as an array for iteration. - * @name Type#fieldsArray - * @type {Field[]} - * @readonly - */ - fieldsArray: { - get: function() { - return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); - } - }, - - /** - * Oneofs of this message as an array for iteration. - * @name Type#oneofsArray - * @type {OneOf[]} - * @readonly - */ - oneofsArray: { - get: function() { - return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); - } - }, - - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. - * @name Type#ctor - * @type {Constructor<{}>} - */ - ctor: { - get: function() { - return this._ctor || (this.ctor = Type.generateConstructor(this)()); - }, - set: function(ctor) { - - // Ensure proper prototype - var prototype = ctor.prototype; - if (!(prototype instanceof Message)) { - (ctor.prototype = new Message()).constructor = ctor; - util.merge(ctor.prototype, prototype); - } - - // Classes and messages reference their reflected type - ctor.$type = ctor.prototype.$type = this; - - // Mix in static methods - util.merge(ctor, Message, true); - - this._ctor = ctor; - - // Messages have non-enumerable default values on their prototype - var i = 0; - for (; i < /* initializes */ this.fieldsArray.length; ++i) - this._fieldsArray[i].resolve(); // ensures a proper value - - // Messages have non-enumerable getters and setters for each virtual oneof field - var ctorProperties = {}; - for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) - ctorProperties[this._oneofsArray[i].resolve().name] = { - get: util.oneOfGetter(this._oneofsArray[i].oneof), - set: util.oneOfSetter(this._oneofsArray[i].oneof) - }; - if (i) - Object.defineProperties(ctor.prototype, ctorProperties); - } - } -}); - -/** - * Generates a constructor function for the specified type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -Type.generateConstructor = function generateConstructor(mtype) { - /* eslint-disable no-unexpected-multiline */ - var gen = util.codegen(["p"], mtype.name); - // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype - for (var i = 0, field; i < mtype.fieldsArray.length; ++i) - if ((field = mtype._fieldsArray[i]).map) gen - ("this%s={}", util.safeProp(field.name)); - else if (field.repeated) gen - ("this%s=[]", util.safeProp(field.name)); - return gen - ("if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors - * @property {Object.} fields Field descriptors - * @property {number[][]} [extensions] Extension ranges - * @property {number[][]} [reserved] Reserved ranges - * @property {boolean} [group=false] Whether a legacy group or not - */ - -/** - * Creates a message type from a message type descriptor. - * @param {string} name Message name - * @param {IType} json Message type descriptor - * @returns {Type} Created message type - */ -Type.fromJSON = function fromJSON(name, json) { - var type = new Type(name, json.options); - type.extensions = json.extensions; - type.reserved = json.reserved; - var names = Object.keys(json.fields), - i = 0; - for (; i < names.length; ++i) - type.add( - ( typeof json.fields[names[i]].keyType !== "undefined" - ? MapField.fromJSON - : Field.fromJSON )(names[i], json.fields[names[i]]) - ); - if (json.oneofs) - for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i) - type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]])); - if (json.nested) - for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) { - var nested = json.nested[names[i]]; - type.add( // most to least likely - ( nested.id !== undefined - ? Field.fromJSON - : nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - if (json.extensions && json.extensions.length) - type.extensions = json.extensions; - if (json.reserved && json.reserved.length) - type.reserved = json.reserved; - if (json.group) - type.group = true; - if (json.comment) - type.comment = json.comment; - return type; -}; - -/** - * Converts this message type to a message type descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IType} Message type descriptor - */ -Type.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions), - "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {}, - "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "group" , this.group || undefined, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Type.prototype.resolveAll = function resolveAll() { - var fields = this.fieldsArray, i = 0; - while (i < fields.length) - fields[i++].resolve(); - var oneofs = this.oneofsArray; i = 0; - while (i < oneofs.length) - oneofs[i++].resolve(); - return Namespace.prototype.resolveAll.call(this); -}; - -/** - * @override - */ -Type.prototype.get = function get(name) { - return this.fields[name] - || this.oneofs && this.oneofs[name] - || this.nested && this.nested[name] - || null; -}; - -/** - * Adds a nested object to this type. - * @param {ReflectionObject} object Nested object to add - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ -Type.prototype.add = function add(object) { - - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Field && object.extend === undefined) { - // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects. - // The root object takes care of adding distinct sister-fields to the respective extended - // type instead. - - // avoids calling the getter if not absolutely necessary because it's called quite frequently - if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id]) - throw Error("duplicate id " + object.id + " in " + this); - if (this.isReservedId(object.id)) - throw Error("id " + object.id + " is reserved in " + this); - if (this.isReservedName(object.name)) - throw Error("name '" + object.name + "' is reserved in " + this); - - if (object.parent) - object.parent.remove(object); - this.fields[object.name] = object; - object.message = this; - object.onAdd(this); - return clearCache(this); - } - if (object instanceof OneOf) { - if (!this.oneofs) - this.oneofs = {}; - this.oneofs[object.name] = object; - object.onAdd(this); - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * Removes a nested object from this type. - * @param {ReflectionObject} object Nested object to remove - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ -Type.prototype.remove = function remove(object) { - if (object instanceof Field && object.extend === undefined) { - // See Type#add for the reason why extension fields are excluded here. - - /* istanbul ignore if */ - if (!this.fields || this.fields[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.fields[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - if (object instanceof OneOf) { - - /* istanbul ignore if */ - if (!this.oneofs || this.oneofs[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.oneofs[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message<{}>} Message instance - */ -Type.prototype.create = function create(properties) { - return new this.ctor(properties); -}; - -/** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns {Type} `this` - */ -Type.prototype.setup = function setup() { - // Sets up everything at once so that the prototype chain does not have to be re-evaluated - // multiple times (V8, soft-deopt prototype-check). - - var fullName = this.fullName, - types = []; - for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i) - types.push(this._fieldsArray[i].resolve().resolvedType); - - // Replace setup methods with type-specific generated functions - this.encode = encoder(this)({ - Writer : Writer, - types : types, - util : util - }); - this.decode = decoder(this)({ - Reader : Reader, - types : types, - util : util - }); - this.verify = verifier(this)({ - types : types, - util : util - }); - this.fromObject = converter.fromObject(this)({ - types : types, - util : util - }); - this.toObject = converter.toObject(this)({ - types : types, - util : util - }); - - // Inject custom wrappers for common types - var wrapper = wrappers[fullName]; - if (wrapper) { - var originalThis = Object.create(this); - // if (wrapper.fromObject) { - originalThis.fromObject = this.fromObject; - this.fromObject = wrapper.fromObject.bind(originalThis); - // } - // if (wrapper.toObject) { - originalThis.toObject = this.toObject; - this.toObject = wrapper.toObject.bind(originalThis); - // } - } - - return this; -}; - -/** - * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encode = function encode_setup(message, writer) { - return this.setup().encode(message, writer); // overrides this method -}; - -/** - * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); -}; - -/** - * Decodes a message of this type. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Length of the message, if known beforehand - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError<{}>} If required fields are missing - */ -Type.prototype.decode = function decode_setup(reader, length) { - return this.setup().decode(reader, length); // overrides this method -}; - -/** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError} If required fields are missing - */ -Type.prototype.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof Reader)) - reader = Reader.create(reader); - return this.decode(reader, reader.uint32()); -}; - -/** - * Verifies that field values are valid and that required fields are present. - * @param {Object.} message Plain object to verify - * @returns {null|string} `null` if valid, otherwise the reason why it is not - */ -Type.prototype.verify = function verify_setup(message) { - return this.setup().verify(message); // overrides this method -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object to convert - * @returns {Message<{}>} Message instance - */ -Type.prototype.fromObject = function fromObject(object) { - return this.setup().fromObject(object); -}; - -/** - * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. - * @interface IConversionOptions - * @property {Function} [longs] Long conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. - * @property {Function} [enums] Enum value conversion type. - * Only valid value is `String` (the global type). - * Defaults to copy the present value, which is the numeric id. - * @property {Function} [bytes] Bytes value conversion type. - * Valid values are `Array` and (a base64 encoded) `String` (the global types). - * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. - * @property {boolean} [defaults=false] Also sets default values on the resulting object - * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` - * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false` - * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any - * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings - */ - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ -Type.prototype.toObject = function toObject(message, options) { - return this.setup().toObject(message, options); -}; - -/** - * Decorator function as returned by {@link Type.d} (TypeScript). - * @typedef TypeDecorator - * @type {function} - * @param {Constructor} target Target constructor - * @returns {undefined} - * @template T extends Message - */ - -/** - * Type decorator (TypeScript). - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {TypeDecorator} Decorator function - * @template T extends Message - */ -Type.d = function decorateType(typeName) { - return function typeDecorator(target) { - util.decorateType(target, typeName); - }; -}; - -},{"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"21":21,"23":23,"25":25,"27":27,"33":33,"37":37,"40":40,"41":41,"42":42}],36:[function(require,module,exports){ -"use strict"; - -/** - * Common type constants. - * @namespace - */ -var types = exports; - -var util = require(37); - -var s = [ - "double", // 0 - "float", // 1 - "int32", // 2 - "uint32", // 3 - "sint32", // 4 - "fixed32", // 5 - "sfixed32", // 6 - "int64", // 7 - "uint64", // 8 - "sint64", // 9 - "fixed64", // 10 - "sfixed64", // 11 - "bool", // 12 - "string", // 13 - "bytes" // 14 -]; - -function bake(values, offset) { - var i = 0, o = {}; - offset |= 0; - while (i < values.length) o[s[i + offset]] = values[i++]; - return o; -} - -/** - * Basic type wire types. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - * @property {number} bytes=2 Ldelim wire type - */ -types.basic = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2, - /* bytes */ 2 -]); - -/** - * Basic type defaults. - * @type {Object.} - * @const - * @property {number} double=0 Double default - * @property {number} float=0 Float default - * @property {number} int32=0 Int32 default - * @property {number} uint32=0 Uint32 default - * @property {number} sint32=0 Sint32 default - * @property {number} fixed32=0 Fixed32 default - * @property {number} sfixed32=0 Sfixed32 default - * @property {number} int64=0 Int64 default - * @property {number} uint64=0 Uint64 default - * @property {number} sint64=0 Sint32 default - * @property {number} fixed64=0 Fixed64 default - * @property {number} sfixed64=0 Sfixed64 default - * @property {boolean} bool=false Bool default - * @property {string} string="" String default - * @property {Array.} bytes=Array(0) Bytes default - * @property {null} message=null Message default - */ -types.defaults = bake([ - /* double */ 0, - /* float */ 0, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 0, - /* sfixed32 */ 0, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 0, - /* sfixed64 */ 0, - /* bool */ false, - /* string */ "", - /* bytes */ util.emptyArray, - /* message */ null -]); - -/** - * Basic long type wire types. - * @type {Object.} - * @const - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - */ -types.long = bake([ - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1 -], 7); - -/** - * Allowed types for map keys with their associated wire type. - * @type {Object.} - * @const - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - */ -types.mapKey = bake([ - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2 -], 2); - -/** - * Allowed types for packed repeated fields with their associated wire type. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - */ -types.packed = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0 -]); - -},{"37":37}],37:[function(require,module,exports){ -"use strict"; - -/** - * Various utility functions. - * @namespace - */ -var util = module.exports = require(39); - -var roots = require(30); - -var Type, // cyclic - Enum; - -util.codegen = require(3); -util.fetch = require(5); -util.path = require(8); - -/** - * Node's fs module if available. - * @type {Object.} - */ -util.fs = util.inquire("fs"); - -/** - * Converts an object's values to an array. - * @param {Object.} object Object to convert - * @returns {Array.<*>} Converted array - */ -util.toArray = function toArray(object) { - if (object) { - var keys = Object.keys(object), - array = new Array(keys.length), - index = 0; - while (index < keys.length) - array[index] = object[keys[index++]]; - return array; - } - return []; -}; - -/** - * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. - * @param {Array.<*>} array Array to convert - * @returns {Object.} Converted object - */ -util.toObject = function toObject(array) { - var object = {}, - index = 0; - while (index < array.length) { - var key = array[index++], - val = array[index++]; - if (val !== undefined) - object[key] = val; - } - return object; -}; - -var safePropBackslashRe = /\\/g, - safePropQuoteRe = /"/g; - -/** - * Tests whether the specified name is a reserved word in JS. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -util.isReserved = function isReserved(name) { - return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); -}; - -/** - * Returns a safe property accessor for the specified property name. - * @param {string} prop Property name - * @returns {string} Safe accessor - */ -util.safeProp = function safeProp(prop) { - if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop)) - return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]"; - return "." + prop; -}; - -/** - * Converts the first character of a string to upper case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.ucFirst = function ucFirst(str) { - return str.charAt(0).toUpperCase() + str.substring(1); -}; - -var camelCaseRe = /_([a-z])/g; - -/** - * Converts a string to camel case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.camelCase = function camelCase(str) { - return str.substring(0, 1) - + str.substring(1) - .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); }); -}; - -/** - * Compares reflected fields by id. - * @param {Field} a First field - * @param {Field} b Second field - * @returns {number} Comparison value - */ -util.compareFieldsById = function compareFieldsById(a, b) { - return a.id - b.id; -}; - -/** - * Decorator helper for types (TypeScript). - * @param {Constructor} ctor Constructor function - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {Type} Reflected type - * @template T extends Message - * @property {Root} root Decorators root - */ -util.decorateType = function decorateType(ctor, typeName) { - - /* istanbul ignore if */ - if (ctor.$type) { - if (typeName && ctor.$type.name !== typeName) { - util.decorateRoot.remove(ctor.$type); - ctor.$type.name = typeName; - util.decorateRoot.add(ctor.$type); - } - return ctor.$type; - } - - /* istanbul ignore next */ - if (!Type) - Type = require(35); - - var type = new Type(typeName || ctor.name); - util.decorateRoot.add(type); - type.ctor = ctor; // sets up .encode, .decode etc. - Object.defineProperty(ctor, "$type", { value: type, enumerable: false }); - Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false }); - return type; -}; - -var decorateEnumIndex = 0; - -/** - * Decorator helper for enums (TypeScript). - * @param {Object} object Enum object - * @returns {Enum} Reflected enum - */ -util.decorateEnum = function decorateEnum(object) { - - /* istanbul ignore if */ - if (object.$type) - return object.$type; - - /* istanbul ignore next */ - if (!Enum) - Enum = require(15); - - var enm = new Enum("Enum" + decorateEnumIndex++, object); - util.decorateRoot.add(enm); - Object.defineProperty(object, "$type", { value: enm, enumerable: false }); - return enm; -}; - -/** - * Decorator root (TypeScript). - * @name util.decorateRoot - * @type {Root} - * @readonly - */ -Object.defineProperty(util, "decorateRoot", { - get: function() { - return roots["decorated"] || (roots["decorated"] = new (require(29))()); - } -}); - -},{"15":15,"29":29,"3":3,"30":30,"35":35,"39":39,"5":5,"8":8}],38:[function(require,module,exports){ -"use strict"; -module.exports = LongBits; - -var util = require(39); - -/** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low 32 bits, unsigned - * @param {number} hi High 32 bits, unsigned - */ -function LongBits(lo, hi) { - - // note that the casts below are theoretically unnecessary as of today, but older statically - // generated converter code might still call the ctor with signed 32bits. kept for compat. - - /** - * Low bits. - * @type {number} - */ - this.lo = lo >>> 0; - - /** - * High bits. - * @type {number} - */ - this.hi = hi >>> 0; -} - -/** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ -var zero = LongBits.zero = new LongBits(0, 0); - -zero.toNumber = function() { return 0; }; -zero.zzEncode = zero.zzDecode = function() { return this; }; -zero.length = function() { return 1; }; - -/** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ -var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; - -/** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ -LongBits.fromNumber = function fromNumber(value) { - if (value === 0) - return zero; - var sign = value < 0; - if (sign) - value = -value; - var lo = value >>> 0, - hi = (value - lo) / 4294967296 >>> 0; - if (sign) { - hi = ~hi >>> 0; - lo = ~lo >>> 0; - if (++lo > 4294967295) { - lo = 0; - if (++hi > 4294967295) - hi = 0; - } - } - return new LongBits(lo, hi); -}; - -/** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ -LongBits.from = function from(value) { - if (typeof value === "number") - return LongBits.fromNumber(value); - if (util.isString(value)) { - /* istanbul ignore else */ - if (util.Long) - value = util.Long.fromString(value); - else - return LongBits.fromNumber(parseInt(value, 10)); - } - return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; -}; - -/** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ -LongBits.prototype.toNumber = function toNumber(unsigned) { - if (!unsigned && this.hi >>> 31) { - var lo = ~this.lo + 1 >>> 0, - hi = ~this.hi >>> 0; - if (!lo) - hi = hi + 1 >>> 0; - return -(lo + hi * 4294967296); - } - return this.lo + this.hi * 4294967296; -}; - -/** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ -LongBits.prototype.toLong = function toLong(unsigned) { - return util.Long - ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) - /* istanbul ignore next */ - : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; -}; - -var charCodeAt = String.prototype.charCodeAt; - -/** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ -LongBits.fromHash = function fromHash(hash) { - if (hash === zeroHash) - return zero; - return new LongBits( - ( charCodeAt.call(hash, 0) - | charCodeAt.call(hash, 1) << 8 - | charCodeAt.call(hash, 2) << 16 - | charCodeAt.call(hash, 3) << 24) >>> 0 - , - ( charCodeAt.call(hash, 4) - | charCodeAt.call(hash, 5) << 8 - | charCodeAt.call(hash, 6) << 16 - | charCodeAt.call(hash, 7) << 24) >>> 0 - ); -}; - -/** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ -LongBits.prototype.toHash = function toHash() { - return String.fromCharCode( - this.lo & 255, - this.lo >>> 8 & 255, - this.lo >>> 16 & 255, - this.lo >>> 24 , - this.hi & 255, - this.hi >>> 8 & 255, - this.hi >>> 16 & 255, - this.hi >>> 24 - ); -}; - -/** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzEncode = function zzEncode() { - var mask = this.hi >> 31; - this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; - this.lo = ( this.lo << 1 ^ mask) >>> 0; - return this; -}; - -/** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzDecode = function zzDecode() { - var mask = -(this.lo & 1); - this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; - this.hi = ( this.hi >>> 1 ^ mask) >>> 0; - return this; -}; - -/** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ -LongBits.prototype.length = function length() { - var part0 = this.lo, - part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, - part2 = this.hi >>> 24; - return part2 === 0 - ? part1 === 0 - ? part0 < 16384 - ? part0 < 128 ? 1 : 2 - : part0 < 2097152 ? 3 : 4 - : part1 < 16384 - ? part1 < 128 ? 5 : 6 - : part1 < 2097152 ? 7 : 8 - : part2 < 128 ? 9 : 10; -}; - -},{"39":39}],39:[function(require,module,exports){ -"use strict"; -var util = exports; - -// used to return a Promise where callback is omitted -util.asPromise = require(1); - -// converts to / from base64 encoded strings -util.base64 = require(2); - -// base class of rpc.Service -util.EventEmitter = require(4); - -// float handling accross browsers -util.float = require(6); - -// requires modules optionally and hides the call from bundlers -util.inquire = require(7); - -// converts to / from utf8 encoded strings -util.utf8 = require(10); - -// provides a node-like buffer pool in the browser -util.pool = require(9); - -// utility to work with the low and high bits of a 64 bit value -util.LongBits = require(38); - -// global object reference -util.global = typeof window !== "undefined" && window - || typeof global !== "undefined" && global - || typeof self !== "undefined" && self - || this; // eslint-disable-line no-invalid-this - -/** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} - * @const - */ -util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes - -/** - * An immutable empty object. - * @type {Object} - * @const - */ -util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes - -/** - * Whether running within node or not. - * @memberof util - * @type {boolean} - * @const - */ -util.isNode = Boolean(util.global.process && util.global.process.versions && util.global.process.versions.node); - -/** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer - */ -util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; -}; - -/** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string - */ -util.isString = function isString(value) { - return typeof value === "string" || value instanceof String; -}; - -/** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object - */ -util.isObject = function isObject(value) { - return value && typeof value === "object"; -}; - -/** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @function - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isset = - -/** - * Checks if a property on a message is considered to be present. - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isSet = function isSet(obj, prop) { - var value = obj[prop]; - if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins - return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; - return false; -}; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - * @interface Buffer - * @extends Uint8Array - */ - -/** - * Node's Buffer class if available. - * @type {Constructor} - */ -util.Buffer = (function() { - try { - var Buffer = util.inquire("buffer").Buffer; - // refuse to use non-node buffers if not explicitly assigned (perf reasons): - return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; - } catch (e) { - /* istanbul ignore next */ - return null; - } -})(); - -// Internal alias of or polyfull for Buffer.from. -util._Buffer_from = null; - -// Internal alias of or polyfill for Buffer.allocUnsafe. -util._Buffer_allocUnsafe = null; - -/** - * Creates a new buffer of whatever type supported by the environment. - * @param {number|number[]} [sizeOrArray=0] Buffer size or number array - * @returns {Uint8Array|Buffer} Buffer - */ -util.newBuffer = function newBuffer(sizeOrArray) { - /* istanbul ignore next */ - return typeof sizeOrArray === "number" - ? util.Buffer - ? util._Buffer_allocUnsafe(sizeOrArray) - : new util.Array(sizeOrArray) - : util.Buffer - ? util._Buffer_from(sizeOrArray) - : typeof Uint8Array === "undefined" - ? sizeOrArray - : new Uint8Array(sizeOrArray); -}; - -/** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {Constructor} - */ -util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - * @interface Long - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - -/** - * Long.js's Long class if available. - * @type {Constructor} - */ -util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long - || /* istanbul ignore next */ util.global.Long - || util.inquire("long"); - -/** - * Regular expression used to verify 2 bit (`bool`) map keys. - * @type {RegExp} - * @const - */ -util.key2Re = /^true|false|0|1$/; - -/** - * Regular expression used to verify 32 bit (`int32` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; - -/** - * Regular expression used to verify 64 bit (`int64` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; - -/** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert - * @returns {string} Hash - */ -util.longToHash = function longToHash(value) { - return value - ? util.LongBits.from(value).toHash() - : util.LongBits.zeroHash; -}; - -/** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value - */ -util.longFromHash = function longFromHash(hash, unsigned) { - var bits = util.LongBits.fromHash(hash); - if (util.Long) - return util.Long.fromBits(bits.lo, bits.hi, unsigned); - return bits.toNumber(Boolean(unsigned)); -}; - -/** - * Merges the properties of the source object into the destination object. - * @memberof util - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ -function merge(dst, src, ifNotSet) { // used by converters - for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) - if (dst[keys[i]] === undefined || !ifNotSet) - dst[keys[i]] = src[keys[i]]; - return dst; -} - -util.merge = merge; - -/** - * Converts the first character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.lcFirst = function lcFirst(str) { - return str.charAt(0).toLowerCase() + str.substring(1); -}; - -/** - * Creates a custom error constructor. - * @memberof util - * @param {string} name Error name - * @returns {Constructor} Custom error constructor - */ -function newError(name) { - - function CustomError(message, properties) { - - if (!(this instanceof CustomError)) - return new CustomError(message, properties); - - // Error.call(this, message); - // ^ just returns a new error instance because the ctor can be called as a function - - Object.defineProperty(this, "message", { get: function() { return message; } }); - - /* istanbul ignore next */ - if (Error.captureStackTrace) // node - Error.captureStackTrace(this, CustomError); - else - Object.defineProperty(this, "stack", { value: (new Error()).stack || "" }); - - if (properties) - merge(this, properties); - } - - (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; - - Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); - - CustomError.prototype.toString = function toString() { - return this.name + ": " + this.message; - }; - - return CustomError; -} - -util.newError = newError; - -/** - * Constructs a new protocol error. - * @classdesc Error subclass indicating a protocol specifc error. - * @memberof util - * @extends Error - * @template T extends Message - * @constructor - * @param {string} message Error message - * @param {Object.} [properties] Additional properties - * @example - * try { - * MyMessage.decode(someBuffer); // throws if required fields are missing - * } catch (e) { - * if (e instanceof ProtocolError && e.instance) - * console.log("decoded so far: " + JSON.stringify(e.instance)); - * } - */ -util.ProtocolError = newError("ProtocolError"); - -/** - * So far decoded message instance. - * @name util.ProtocolError#instance - * @type {Message} - */ - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @typedef OneOfGetter - * @type {function} - * @returns {string|undefined} Set field name, if any - */ - -/** - * Builds a getter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfGetter} Unbound getter - */ -util.oneOfGetter = function getOneOf(fieldNames) { - var fieldMap = {}; - for (var i = 0; i < fieldNames.length; ++i) - fieldMap[fieldNames[i]] = 1; - - /** - * @returns {string|undefined} Set field name, if any - * @this Object - * @ignore - */ - return function() { // eslint-disable-line consistent-return - for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) - if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) - return keys[i]; - }; -}; - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @typedef OneOfSetter - * @type {function} - * @param {string|undefined} value Field name - * @returns {undefined} - */ - -/** - * Builds a setter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfSetter} Unbound setter - */ -util.oneOfSetter = function setOneOf(fieldNames) { - - /** - * @param {string} name Field name - * @returns {undefined} - * @this Object - * @ignore - */ - return function(name) { - for (var i = 0; i < fieldNames.length; ++i) - if (fieldNames[i] !== name) - delete this[fieldNames[i]]; - }; -}; - -/** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @type {IConversionOptions} - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ -util.toJSONOptions = { - longs: String, - enums: String, - bytes: String, - json: true -}; - -// Sets up buffer utility according to the environment (called in index-minimal) -util._configure = function() { - var Buffer = util.Buffer; - /* istanbul ignore if */ - if (!Buffer) { - util._Buffer_from = util._Buffer_allocUnsafe = null; - return; - } - // because node 4.x buffers are incompatible & immutable - // see: https://github.com/dcodeIO/protobuf.js/pull/665 - util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || - /* istanbul ignore next */ - function Buffer_from(value, encoding) { - return new Buffer(value, encoding); - }; - util._Buffer_allocUnsafe = Buffer.allocUnsafe || - /* istanbul ignore next */ - function Buffer_allocUnsafe(size) { - return new Buffer(size); - }; -}; - -},{"1":1,"10":10,"2":2,"38":38,"4":4,"6":6,"7":7,"9":9}],40:[function(require,module,exports){ -"use strict"; -module.exports = verifier; - -var Enum = require(15), - util = require(37); - -function invalid(field, expected) { - return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; -} - -/** - * Generates a partial value verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyValue(gen, field, fieldIndex, ref) { - /* eslint-disable no-unexpected-multiline */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(%s){", ref) - ("default:") - ("return%j", invalid(field, "enum value")); - for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen - ("case %i:", field.resolvedType.values[keys[j]]); - gen - ("break") - ("}"); - } else { - gen - ("{") - ("var e=types[%i].verify(%s);", fieldIndex, ref) - ("if(e)") - ("return%j+e", field.name + ".") - ("}"); - } - } else { - switch (field.type) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.isInteger(%s))", ref) - ("return%j", invalid(field, "integer")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref) - ("return%j", invalid(field, "integer|Long")); - break; - case "float": - case "double": gen - ("if(typeof %s!==\"number\")", ref) - ("return%j", invalid(field, "number")); - break; - case "bool": gen - ("if(typeof %s!==\"boolean\")", ref) - ("return%j", invalid(field, "boolean")); - break; - case "string": gen - ("if(!util.isString(%s))", ref) - ("return%j", invalid(field, "string")); - break; - case "bytes": gen - ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref) - ("return%j", invalid(field, "buffer")); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a partial key verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyKey(gen, field, ref) { - /* eslint-disable no-unexpected-multiline */ - switch (field.keyType) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.key32Re.test(%s))", ref) - ("return%j", invalid(field, "integer key")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not - ("return%j", invalid(field, "integer|Long key")); - break; - case "bool": gen - ("if(!util.key2Re.test(%s))", ref) - ("return%j", invalid(field, "boolean key")); - break; - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a verifier specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function verifier(mtype) { - /* eslint-disable no-unexpected-multiline */ - - var gen = util.codegen(["m"], mtype.name + "$verify") - ("if(typeof m!==\"object\"||m===null)") - ("return%j", "object expected"); - var oneofs = mtype.oneofsArray, - seenFirstField = {}; - if (oneofs.length) gen - ("var p={}"); - - for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - ref = "m" + util.safeProp(field.name); - - if (field.optional) gen - ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null - - // map fields - if (field.map) { gen - ("if(!util.isObject(%s))", ref) - ("return%j", invalid(field, "object")) - ("var k=Object.keys(%s)", ref) - ("for(var i=0;i} - * @const - */ -var wrappers = exports; - -var Message = require(21); - -/** - * From object converter part of an {@link IWrapper}. - * @typedef WrapperFromObjectConverter - * @type {function} - * @param {Object.} object Plain object - * @returns {Message<{}>} Message instance - * @this Type - */ - -/** - * To object converter part of an {@link IWrapper}. - * @typedef WrapperToObjectConverter - * @type {function} - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @this Type - */ - -/** - * Common type wrapper part of {@link wrappers}. - * @interface IWrapper - * @property {WrapperFromObjectConverter} [fromObject] From object converter - * @property {WrapperToObjectConverter} [toObject] To object converter - */ - -// Custom wrapper for Any -wrappers[".google.protobuf.Any"] = { - - fromObject: function(object) { - - // unwrap value type if mapped - if (object && object["@type"]) { - var type = this.lookup(object["@type"]); - /* istanbul ignore else */ - if (type) { - // type_url does not accept leading "." - var type_url = object["@type"].charAt(0) === "." ? - object["@type"].substr(1) : object["@type"]; - // type_url prefix is optional, but path seperator is required - return this.create({ - type_url: "/" + type_url, - value: type.encode(type.fromObject(object)).finish() - }); - } - } - - return this.fromObject(object); - }, - - toObject: function(message, options) { - - // decode value if requested and unmapped - if (options && options.json && message.type_url && message.value) { - // Only use fully qualified type name after the last '/' - var name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) - message = type.decode(message.value); - } - - // wrap value if unmapped - if (!(message instanceof this.ctor) && message instanceof Message) { - var object = message.$type.toObject(message, options); - object["@type"] = message.$type.fullName; - return object; - } - - return this.toObject(message, options); - } -}; - -},{"21":21}],42:[function(require,module,exports){ -"use strict"; -module.exports = Writer; - -var util = require(39); - -var BufferWriter; // cyclic - -var LongBits = util.LongBits, - base64 = util.base64, - utf8 = util.utf8; - -/** - * Constructs a new writer operation instance. - * @classdesc Scheduled writer operation. - * @constructor - * @param {function(*, Uint8Array, number)} fn Function to call - * @param {number} len Value byte length - * @param {*} val Value to write - * @ignore - */ -function Op(fn, len, val) { - - /** - * Function to call. - * @type {function(Uint8Array, number, *)} - */ - this.fn = fn; - - /** - * Value byte length. - * @type {number} - */ - this.len = len; - - /** - * Next operation. - * @type {Writer.Op|undefined} - */ - this.next = undefined; - - /** - * Value to write. - * @type {*} - */ - this.val = val; // type varies -} - -/* istanbul ignore next */ -function noop() {} // eslint-disable-line no-empty-function - -/** - * Constructs a new writer state instance. - * @classdesc Copied writer state. - * @memberof Writer - * @constructor - * @param {Writer} writer Writer to copy state from - * @ignore - */ -function State(writer) { - - /** - * Current head. - * @type {Writer.Op} - */ - this.head = writer.head; - - /** - * Current tail. - * @type {Writer.Op} - */ - this.tail = writer.tail; - - /** - * Current buffer length. - * @type {number} - */ - this.len = writer.len; - - /** - * Next state. - * @type {State|null} - */ - this.next = writer.states; -} - -/** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ -function Writer() { - - /** - * Current length. - * @type {number} - */ - this.len = 0; - - /** - * Operations head. - * @type {Object} - */ - this.head = new Op(noop, 0, 0); - - /** - * Operations tail - * @type {Object} - */ - this.tail = this.head; - - /** - * Linked forked states. - * @type {Object|null} - */ - this.states = null; - - // When a value is written, the writer calculates its byte length and puts it into a linked - // list of operations to perform when finish() is called. This both allows us to allocate - // buffers of the exact required size and reduces the amount of work we have to do compared - // to first calculating over objects and then encoding over objects. In our case, the encoding - // part is just a linked list walk calling operations with already prepared values. -} - -/** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ -Writer.create = util.Buffer - ? function create_buffer_setup() { - return (Writer.create = function create_buffer() { - return new BufferWriter(); - })(); - } - /* istanbul ignore next */ - : function create_array() { - return new Writer(); - }; - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -Writer.alloc = function alloc(size) { - return new util.Array(size); -}; - -// Use Uint8Array buffer pool in the browser, just like node does with buffers -/* istanbul ignore else */ -if (util.Array !== Array) - Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); - -/** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - * @private - */ -Writer.prototype._push = function push(fn, len, val) { - this.tail = this.tail.next = new Op(fn, len, val); - this.len += len; - return this; -}; - -function writeByte(val, buf, pos) { - buf[pos] = val & 255; -} - -function writeVarint32(val, buf, pos) { - while (val > 127) { - buf[pos++] = val & 127 | 128; - val >>>= 7; - } - buf[pos] = val; -} - -/** - * Constructs a new varint writer operation instance. - * @classdesc Scheduled varint writer operation. - * @extends Op - * @constructor - * @param {number} len Value byte length - * @param {number} val Value to write - * @ignore - */ -function VarintOp(len, val) { - this.len = len; - this.next = undefined; - this.val = val; -} - -VarintOp.prototype = Object.create(Op.prototype); -VarintOp.prototype.fn = writeVarint32; - -/** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.uint32 = function write_uint32(value) { - // here, the call to this.push has been inlined and a varint specific Op subclass is used. - // uint32 is by far the most frequently used operation and benefits significantly from this. - this.len += (this.tail = this.tail.next = new VarintOp( - (value = value >>> 0) - < 128 ? 1 - : value < 16384 ? 2 - : value < 2097152 ? 3 - : value < 268435456 ? 4 - : 5, - value)).len; - return this; -}; - -/** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.int32 = function write_int32(value) { - return value < 0 - ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec - : this.uint32(value); -}; - -/** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sint32 = function write_sint32(value) { - return this.uint32((value << 1 ^ value >> 31) >>> 0); -}; - -function writeVarint64(val, buf, pos) { - while (val.hi) { - buf[pos++] = val.lo & 127 | 128; - val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; - val.hi >>>= 7; - } - while (val.lo > 127) { - buf[pos++] = val.lo & 127 | 128; - val.lo = val.lo >>> 7; - } - buf[pos++] = val.lo; -} - -/** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.uint64 = function write_uint64(value) { - var bits = LongBits.from(value); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.int64 = Writer.prototype.uint64; - -/** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sint64 = function write_sint64(value) { - var bits = LongBits.from(value).zzEncode(); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.bool = function write_bool(value) { - return this._push(writeByte, 1, value ? 1 : 0); -}; - -function writeFixed32(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -/** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.fixed32 = function write_fixed32(value) { - return this._push(writeFixed32, 4, value >>> 0); -}; - -/** - * Writes a signed 32 bit value as fixed 32 bits. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sfixed32 = Writer.prototype.fixed32; - -/** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.fixed64 = function write_fixed64(value) { - var bits = LongBits.from(value); - return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); -}; - -/** - * Writes a signed 64 bit value as fixed 64 bits. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sfixed64 = Writer.prototype.fixed64; - -/** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.float = function write_float(value) { - return this._push(util.float.writeFloatLE, 4, value); -}; - -/** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.double = function write_double(value) { - return this._push(util.float.writeDoubleLE, 8, value); -}; - -var writeBytes = util.Array.prototype.set - ? function writeBytes_set(val, buf, pos) { - buf.set(val, pos); // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytes_for(val, buf, pos) { - for (var i = 0; i < val.length; ++i) - buf[pos + i] = val[i]; - }; - -/** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ -Writer.prototype.bytes = function write_bytes(value) { - var len = value.length >>> 0; - if (!len) - return this._push(writeByte, 1, 0); - if (util.isString(value)) { - var buf = Writer.alloc(len = base64.length(value)); - base64.decode(value, buf, 0); - value = buf; - } - return this.uint32(len)._push(writeBytes, len, value); -}; - -/** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.string = function write_string(value) { - var len = utf8.length(value); - return len - ? this.uint32(len)._push(utf8.write, len, value) - : this._push(writeByte, 1, 0); -}; - -/** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ -Writer.prototype.fork = function fork() { - this.states = new State(this); - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - return this; -}; - -/** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ -Writer.prototype.reset = function reset() { - if (this.states) { - this.head = this.states.head; - this.tail = this.states.tail; - this.len = this.states.len; - this.states = this.states.next; - } else { - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - } - return this; -}; - -/** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ -Writer.prototype.ldelim = function ldelim() { - var head = this.head, - tail = this.tail, - len = this.len; - this.reset().uint32(len); - if (len) { - this.tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; - } - return this; -}; - -/** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ -Writer.prototype.finish = function finish() { - var head = this.head.next, // skip noop - buf = this.constructor.alloc(this.len), - pos = 0; - while (head) { - head.fn(head.val, buf, pos); - pos += head.len; - head = head.next; - } - // this.head = this.tail = null; - return buf; -}; - -Writer._configure = function(BufferWriter_) { - BufferWriter = BufferWriter_; -}; - -},{"39":39}],43:[function(require,module,exports){ -"use strict"; -module.exports = BufferWriter; - -// extends Writer -var Writer = require(42); -(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; - -var util = require(39); - -var Buffer = util.Buffer; - -/** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ -function BufferWriter() { - Writer.call(this); -} - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Buffer} Buffer - */ -BufferWriter.alloc = function alloc_buffer(size) { - return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size); -}; - -var writeBytesBuffer = Buffer && Buffer.prototype instanceof Uint8Array && Buffer.prototype.set.name === "set" - ? function writeBytesBuffer_set(val, buf, pos) { - buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) - // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytesBuffer_copy(val, buf, pos) { - if (val.copy) // Buffer values - val.copy(buf, pos, 0, val.length); - else for (var i = 0; i < val.length;) // plain array values - buf[pos++] = val[i++]; - }; - -/** - * @override - */ -BufferWriter.prototype.bytes = function write_bytes_buffer(value) { - if (util.isString(value)) - value = util._Buffer_from(value, "base64"); - var len = value.length >>> 0; - this.uint32(len); - if (len) - this._push(writeBytesBuffer, len, value); - return this; -}; - -function writeStringBuffer(val, buf, pos) { - if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) - util.utf8.write(val, buf, pos); - else - buf.utf8Write(val, pos); -} - -/** - * @override - */ -BufferWriter.prototype.string = function write_string_buffer(value) { - var len = Buffer.byteLength(value); - this.uint32(len); - if (len) - this._push(writeStringBuffer, len, value); - return this; -}; - - -/** - * Finishes the write operation. - * @name BufferWriter#finish - * @function - * @returns {Buffer} Finished buffer - */ - -},{"39":39,"42":42}]},{},[19]) - -})(); -//# sourceMappingURL=protobuf.js.map diff --git a/frontend/assets/plugin_scripts/protobuf.js.meta b/frontend/assets/plugin_scripts/protobuf.js.meta deleted file mode 100644 index 871aec5..0000000 --- a/frontend/assets/plugin_scripts/protobuf.js.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.0.5", - "uuid": "bd514df4-095e-4088-9060-d99397a29a4f", - "isPlugin": true, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file diff --git a/frontend/assets/resources/map/simple/map.tmx b/frontend/assets/resources/map/simple/map.tmx index acd6779..7f28144 100644 --- a/frontend/assets/resources/map/simple/map.tmx +++ b/frontend/assets/resources/map/simple/map.tmx @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ - eJztwQENAAAAwqD3T20ON6AAAAAAAAAAAADg3wAnEAAB + eJzt1jEKgDAQRNE0GtD739fGaQIhqJHdCf81aSz2oyspBQAAAADWcUYPMIEaaugU37TvwbGl9y05tYz2wWFfaMiBhhyNKzRs99n7lzo0SG1OcWqQtsWxQdSwD57L3CCjO4dDg7zd+Yye7nxmajlCp5jD6Y4OAAAA4H8XE6wBrA== @@ -36,5 +36,11 @@ + + + + + + diff --git a/frontend/assets/resources/pbfiles/geometry.proto b/frontend/assets/resources/pbfiles/geometry.proto new file mode 100644 index 0000000..bc0290b --- /dev/null +++ b/frontend/assets/resources/pbfiles/geometry.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +option go_package = "dnmshared/sharedprotos"; // here "./" corresponds to the "--go_out" value in "protoc" command +package sharedprotos; + +message Direction { + int32 dx = 1; + int32 dy = 2; +} + +message Vec2D { + double x = 1; + double y = 2; +} + +message Polygon2D { + Vec2D anchor = 1; + repeated Vec2D points = 2; +} + +message Vec2DList { + repeated Vec2D eles = 1; +} + +message Polygon2DList { + repeated Polygon2D eles = 1; +} diff --git a/frontend/assets/resources/pbfiles/geometry.proto.meta b/frontend/assets/resources/pbfiles/geometry.proto.meta new file mode 100644 index 0000000..696ccb8 --- /dev/null +++ b/frontend/assets/resources/pbfiles/geometry.proto.meta @@ -0,0 +1,5 @@ +{ + "ver": "2.0.0", + "uuid": "2ba698f8-1af7-4c47-9d43-b2730b62c692", + "subMetas": {} +} \ No newline at end of file diff --git a/frontend/assets/resources/pbfiles/room_downsync_frame.proto b/frontend/assets/resources/pbfiles/room_downsync_frame.proto index 5c12b44..310b470 100644 --- a/frontend/assets/resources/pbfiles/room_downsync_frame.proto +++ b/frontend/assets/resources/pbfiles/room_downsync_frame.proto @@ -1,35 +1,13 @@ syntax = "proto3"; -option go_package = "."; // "./" corresponds to the "--go_out" value in "protoc" command +option go_package = "battle_srv/protos"; // here "./" corresponds to the "--go_out" value in "protoc" command -package treasurehunterx; - -message Direction { - int32 dx = 1; - int32 dy = 2; -} - -message Vec2D { - double x = 1; - double y = 2; -} - -message Polygon2D { - Vec2D Anchor = 1; - repeated Vec2D Points = 2; -} - -message Vec2DList { - repeated Vec2D vec2DList = 1; -} - -message Polygon2DList { - repeated Polygon2D polygon2DList = 1; -} +package protos; +import "geometry.proto"; // The import path here is only w.r.t. the proto file, not the Go package. message BattleColliderInfo { string stageName = 1; - map strToVec2DListMap = 2; - map strToPolygon2DListMap = 3; + map strToVec2DListMap = 2; + map strToPolygon2DListMap = 3; int32 stageDiscreteW = 4; int32 stageDiscreteH = 5; int32 stageTileW = 6; @@ -46,17 +24,19 @@ message BattleColliderInfo { int32 inputFrameUpsyncDelayTolerance = 16; int32 maxChasingRenderFramesPerUpdate = 17; int32 playerBattleState = 18; - double rollbackEstimatedDt = 19; - double rollbackEstimatedDtMillis = 20; - int64 rollbackEstimatedDtNanos = 21; + double rollbackEstimatedDtMillis = 19; + int64 rollbackEstimatedDtNanos = 20; + + double worldToVirtualGridRatio = 21; + double virtualGridToWorldRatio = 22; } -message Player { +message PlayerDownsync { int32 id = 1; - double x = 2; - double y = 3; - Direction dir = 4; - double speed = 5; + int32 virtualGridX = 2; + int32 virtualGridY = 3; + sharedprotos.Direction dir = 4; + int32 speed = 5; // in terms of virtual grid units int32 battleState = 6; int32 lastMoveGmtMillis = 7; int32 score = 10; @@ -64,12 +44,13 @@ message Player { int32 joinIndex = 12; } -message PlayerMeta { +message PlayerDownsyncMeta { int32 id = 1; string name = 2; string displayName = 3; string avatar = 4; int32 joinIndex = 5; + double colliderRadius = 6; } message InputFrameUpsync { @@ -89,9 +70,9 @@ message HeartbeatUpsync { message RoomDownsyncFrame { int32 id = 1; - map players = 2; + map players = 2; int64 countdownNanos = 3; - map playerMetas = 4; + map playerMetas = 4; } message WsReq { diff --git a/frontend/assets/resources/prefabs/Pacman1.prefab b/frontend/assets/resources/prefabs/Pacman1.prefab index 7d5723c..bf52f5a 100644 --- a/frontend/assets/resources/prefabs/Pacman1.prefab +++ b/frontend/assets/resources/prefabs/Pacman1.prefab @@ -100,7 +100,7 @@ "__id__": 1 }, "_children": [], - "_active": false, + "_active": true, "_components": [ { "__id__": 3 @@ -119,8 +119,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 93.36, - "height": 40 + "width": 46.68, + "height": 27.72 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -132,7 +132,7 @@ "ctor": "Float64Array", "array": [ -5, - 101, + 50, 0, 0, 0, @@ -164,12 +164,16 @@ "__id__": 2 }, "_enabled": true, - "_materials": [], + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], "_useOriginalSize": false, "_string": "(0, 0)", "_N$string": "(0, 0)", - "_fontSize": 40, - "_lineHeight": 40, + "_fontSize": 20, + "_lineHeight": 22, "_enableWrapText": true, "_N$file": null, "_isSystemFontUsed": true, @@ -557,15 +561,13 @@ }, "_enabled": true, "animComp": null, - "baseSpeed": 50, - "speed": 50, "lastMovedAt": 0, - "eps": 0.1, - "magicLeanLowerBound": 0.414, - "magicLeanUpperBound": 2.414, "arrowTipNode": { "__id__": 8 }, + "coordLabel": { + "__id__": 3 + }, "_id": "" }, { diff --git a/frontend/assets/resources/prefabs/Pacman2.prefab b/frontend/assets/resources/prefabs/Pacman2.prefab index cc5b6c8..b6d4472 100644 --- a/frontend/assets/resources/prefabs/Pacman2.prefab +++ b/frontend/assets/resources/prefabs/Pacman2.prefab @@ -100,7 +100,7 @@ "__id__": 1 }, "_children": [], - "_active": false, + "_active": true, "_components": [ { "__id__": 3 @@ -119,8 +119,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 93.36, - "height": 40 + "width": 46.68, + "height": 27.72 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -132,7 +132,7 @@ "ctor": "Float64Array", "array": [ -5, - 101, + 50, 0, 0, 0, @@ -164,12 +164,16 @@ "__id__": 2 }, "_enabled": true, - "_materials": [], + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], "_useOriginalSize": false, "_string": "(0, 0)", "_N$string": "(0, 0)", - "_fontSize": 40, - "_lineHeight": 40, + "_fontSize": 20, + "_lineHeight": 22, "_enableWrapText": true, "_N$file": null, "_isSystemFontUsed": true, @@ -557,15 +561,13 @@ }, "_enabled": true, "animComp": null, - "baseSpeed": 50, - "speed": 50, "lastMovedAt": 0, - "eps": 0.1, - "magicLeanLowerBound": 0.414, - "magicLeanUpperBound": 2.414, "arrowTipNode": { "__id__": 8 }, + "coordLabel": { + "__id__": 3 + }, "_id": "" }, { diff --git a/frontend/assets/scenes/login.fire b/frontend/assets/scenes/login.fire index 31ccba3..63dcfdb 100644 --- a/frontend/assets/scenes/login.fire +++ b/frontend/assets/scenes/login.fire @@ -440,7 +440,7 @@ "array": [ 0, 0, - 209.73151519075364, + 237.35666382819272, 0, 0, 0, diff --git a/frontend/assets/scripts/BasePlayer.js b/frontend/assets/scripts/BasePlayer.js index 72d2b53..bded266 100644 --- a/frontend/assets/scripts/BasePlayer.js +++ b/frontend/assets/scripts/BasePlayer.js @@ -6,30 +6,10 @@ module.export = cc.Class({ type: cc.Animation, default: null, }, - baseSpeed: { - type: cc.Float, - default: 50, - }, - speed: { - type: cc.Float, - default: 50 - }, lastMovedAt: { type: cc.Float, default: 0 // In "GMT milliseconds" - }, - eps: { - default: 0.10, - type: cc.Float - }, - magicLeanLowerBound: { - default: 0.414, // Tangent of (PI/8). - type: cc.Float - }, - magicLeanUpperBound: { - default: 2.414, // Tangent of (3*PI/8). - type: cc.Float - }, + } }, // LIFE-CYCLE CALLBACKS: @@ -44,14 +24,14 @@ module.export = cc.Class({ onLoad() { const self = this; self.clips = { - '01': 'Top', - '0-1': 'Bottom', + '02': 'Top', + '0-2': 'Bottom', '-20': 'Left', '20': 'Right', - '-21': 'TopLeft', - '21': 'TopRight', - '-2-1': 'BottomLeft', - '2-1': 'BottomRight' + '-11': 'TopLeft', + '11': 'TopRight', + '-1-1': 'BottomLeft', + '1-1': 'BottomRight' }; const canvasNode = self.mapNode.parent; self.mapIns = self.mapNode.getComponent("Map"); @@ -70,7 +50,7 @@ module.export = cc.Class({ this.activeDirection = newScheduledDirection; this.activeDirection = newScheduledDirection; const clipKey = newScheduledDirection.dx.toString() + newScheduledDirection.dy.toString(); - const clips = (this.attacked ? this.attackedClips : this.clips); + const clips = (this.attacked ? this.attackedClips : this.clips); let clip = clips[clipKey]; if (!clip) { // Keep playing the current anim. @@ -86,11 +66,9 @@ module.export = cc.Class({ } }, - update(dt) { - }, + update(dt) {}, - lateUpdate(dt) { - }, + lateUpdate(dt) {}, _generateRandomDirection() { return ALL_DISCRETE_DIRECTIONS_CLOCKWISE[Math.floor(Math.random() * ALL_DISCRETE_DIRECTIONS_CLOCKWISE.length)]; @@ -117,16 +95,16 @@ module.export = cc.Class({ updateSpeed(proposedSpeed) { if (0 == proposedSpeed && 0 < this.speed) { - this.startFrozenDisplay(); - } + this.startFrozenDisplay(); + } if (0 < proposedSpeed && 0 == this.speed) { - this.stopFrozenDisplay(); - } - this.speed = proposedSpeed; + this.stopFrozenDisplay(); + } + this.speed = proposedSpeed; }, startFrozenDisplay() { - const self = this; + const self = this; self.attacked = true; }, diff --git a/frontend/assets/scripts/Login.js b/frontend/assets/scripts/Login.js index 1390183..70958ee 100644 --- a/frontend/assets/scripts/Login.js +++ b/frontend/assets/scripts/Login.js @@ -1,6 +1,8 @@ const i18n = require('LanguageData'); i18n.init(window.language); // languageID should be equal to the one we input in New Language ID input field +window.pb = require("./modules/room_downsync_frame_proto_bundle.forcemsg"); + cc.Class({ extends: cc.Component, @@ -84,8 +86,8 @@ cc.Class({ self.smsLoginCaptchaLabel.active = true; self.loginButton.active = true; - self.onLoginButtonClicked = self.onLoginButtonClicked.bind(self); - self.onSMSCaptchaGetButtonClicked = self.onSMSCaptchaGetButtonClicked.bind(self); + self.onLoginButtonClicked = self.onLoginButtonClicked.bind(self); + self.onSMSCaptchaGetButtonClicked = self.onSMSCaptchaGetButtonClicked.bind(self); self.smsLoginCaptchaButton.on('click', self.onSMSCaptchaGetButtonClicked); self.loadingNode = cc.instantiate(this.loadingPrefab); @@ -97,29 +99,16 @@ cc.Class({ window.clearBoundRoomIdInBothVolatileAndPersistentStorage(); } - cc.loader.loadRes("pbfiles/room_downsync_frame", function(err, textAsset /* cc.TextAsset */ ) { - if (err) { - cc.error(err.message || err); - return; + self.checkIntAuthTokenExpire().then( + (intAuthToken) => { + console.log("Successfully found `intAuthToken` in local cache"); + self.useTokenLogin(intAuthToken); + }, + () => { + console.warn("Failed to find `intAuthToken` in local cache"); + window.clearBoundRoomIdInBothVolatileAndPersistentStorage(); } - // Otherwise, `window.RoomDownsyncFrame` is already assigned. - let protoRoot = new protobuf.Root; - window.protobuf.parse(textAsset.text, protoRoot); - window.RoomDownsyncFrame = protoRoot.lookupType("treasurehunterx.RoomDownsyncFrame"); - window.BattleColliderInfo = protoRoot.lookupType("treasurehunterx.BattleColliderInfo"); - window.WsReq = protoRoot.lookupType("treasurehunterx.WsReq"); - window.WsResp = protoRoot.lookupType("treasurehunterx.WsResp"); - self.checkIntAuthTokenExpire().then( - (intAuthToken) => { - console.log("Successfully found `intAuthToken` in local cache"); - self.useTokenLogin(intAuthToken); - }, - () => { - console.warn("Failed to find `intAuthToken` in local cache"); - window.clearBoundRoomIdInBothVolatileAndPersistentStorage(); - } - ); - }); + ); }, getRetCodeList() { @@ -207,28 +196,28 @@ cc.Class({ checkIntAuthTokenExpire() { return new Promise((resolve, reject) => { if (!cc.sys.localStorage.getItem('selfPlayer')) { - console.warn("Couldn't find selfPlayer key in local cache"); + console.warn("Couldn't find selfPlayer key in local cache"); reject(); return; } const selfPlayer = JSON.parse(cc.sys.localStorage.getItem('selfPlayer')); - if (null == selfPlayer) { - console.warn("Couldn't find selfPlayer object in local cache"); - reject(); - return; - } - - if (null == selfPlayer.intAuthToken) { - console.warn("Couldn't find selfPlayer object with key `intAuthToken` in local cache"); - reject(); - return; - } - if (new Date().getTime() > selfPlayer.expiresAt) { - console.warn("Couldn't find unexpired selfPlayer `intAuthToken` in local cache"); - reject(); - return; + if (null == selfPlayer) { + console.warn("Couldn't find selfPlayer object in local cache"); + reject(); + return; } - resolve(selfPlayer.intAuthToken); + + if (null == selfPlayer.intAuthToken) { + console.warn("Couldn't find selfPlayer object with key `intAuthToken` in local cache"); + reject(); + return; + } + if (new Date().getTime() > selfPlayer.expiresAt) { + console.warn("Couldn't find unexpired selfPlayer `intAuthToken` in local cache"); + reject(); + return; + } + resolve(selfPlayer.intAuthToken); }) }, @@ -365,7 +354,7 @@ cc.Class({ ); cc.director.loadScene('default_map'); } else { - console.log("OnLoggedIn failed, about to remove `selfPlayer` in local cache.") + console.log("OnLoggedIn failed, about to remove `selfPlayer` in local cache.") cc.sys.localStorage.removeItem("selfPlayer"); window.clearBoundRoomIdInBothVolatileAndPersistentStorage(); self.enableInteractiveControls(true); diff --git a/frontend/assets/scripts/Map.js b/frontend/assets/scripts/Map.js index 3cc167d..e3bdf00 100644 --- a/frontend/assets/scripts/Map.js +++ b/frontend/assets/scripts/Map.js @@ -111,7 +111,7 @@ cc.Class({ type: cc.Integer, default: 4 // implies (renderFrameIdLagTolerance >> inputScaleFrames) count of inputFrameIds }, - teleportEps1D: { + jigglingEps1D: { type: cc.Float, default: 1e-3 }, @@ -123,12 +123,6 @@ cc.Class({ dumpToRenderCache: function(rdf) { const self = this; - // round player position to lower precision - for (let playerId in rdf.players) { - const immediatePlayerInfo = rdf.players[playerId]; - rdf.players[playerId].x = parseFloat(parseInt(immediatePlayerInfo.x * 100)) / 100.0; - rdf.players[playerId].y = parseFloat(parseInt(immediatePlayerInfo.y * 100)) / 100.0; - } const minToKeepRenderFrameId = self.lastAllConfirmedRenderFrameId; while (0 < self.recentRenderCache.cnt && self.recentRenderCache.stFrameId < minToKeepRenderFrameId) { self.recentRenderCache.pop(); @@ -180,9 +174,16 @@ cc.Class({ } const joinIndex = self.selfPlayerInfo.joinIndex; - const discreteDir = self.ctrl.getDiscretizedDirection(); const previousInputFrameDownsyncWithPrediction = self.getCachedInputFrameDownsyncWithPrediction(inputFrameId); + const previousSelfInput = (null == previousInputFrameDownsyncWithPrediction ? null : previousInputFrameDownsyncWithPrediction.inputList[joinIndex - 1]); + + // If "forceConfirmation" is active on backend, we shouldn't override the already downsynced "inputFrameDownsync"s. + const existingInputFrame = self.recentInputCache.getByFrameId(inputFrameId); + if (null != existingInputFrame && self._allConfirmed(existingInputFrame.confirmedList)) { + return [previousSelfInput, existingInputFrame.inputList[joinIndex - 1]]; + } const prefabbedInputList = (null == previousInputFrameDownsyncWithPrediction ? new Array(self.playerRichInfoDict.size).fill(0) : previousInputFrameDownsyncWithPrediction.inputList.slice()); + const discreteDir = self.ctrl.getDiscretizedDirection(); prefabbedInputList[(joinIndex - 1)] = discreteDir.encodedIdx; const prefabbedInputFrameDownsync = { inputFrameId: inputFrameId, @@ -192,7 +193,6 @@ cc.Class({ self.dumpToInputCache(prefabbedInputFrameDownsync); // A prefabbed inputFrame, would certainly be adding a new inputFrame to the cache, because server only downsyncs "all-confirmed inputFrames" - const previousSelfInput = (null == previousInputFrameDownsyncWithPrediction ? null : previousInputFrameDownsyncWithPrediction.inputList[joinIndex - 1]); return [previousSelfInput, discreteDir.encodedIdx]; }, @@ -229,7 +229,7 @@ cc.Class({ inputFrameUpsyncBatch.push(inputFrameUpsync); } } - const reqData = window.WsReq.encode({ + const reqData = window.pb.protos.WsReq.encode({ msgId: Date.now(), playerId: self.selfPlayerInfo.id, act: window.UPSYNC_MSG_ACT_PLAYER_CMD, @@ -330,12 +330,10 @@ cc.Class({ self.selfPlayerInfo = null; // This field is kept for distinguishing "self" and "others". self.recentInputCache = new RingBuffer(1024); - self.latestCollisionSys = new collisions.Collisions(); - self.chaserCollisionSys = new collisions.Collisions(); + self.collisionSys = new collisions.Collisions(); self.collisionBarrierIndexPrefix = (1 << 16); // For tracking the movements of barriers, though not yet actually used - self.latestCollisionSysMap = new Map(); - self.chaserCollisionSysMap = new Map(); + self.collisionSysMap = new Map(); self.transitToState(ALL_MAP_STATES.VISUAL); @@ -354,6 +352,8 @@ cc.Class({ window.mapIns = self; window.forceBigEndianFloatingNumDecoding = self.forceBigEndianFloatingNumDecoding; + self.showCriticalCoordinateLabels = false; + console.warn("+++++++ Map onLoad()"); window.handleClientSessionError = function() { console.warn('+++++++ Common handleClientSessionError()'); @@ -428,9 +428,11 @@ cc.Class({ self.rollbackEstimatedDt = parsedBattleColliderInfo.rollbackEstimatedDt; self.rollbackEstimatedDtMillis = parsedBattleColliderInfo.rollbackEstimatedDtMillis; self.rollbackEstimatedDtNanos = parsedBattleColliderInfo.rollbackEstimatedDtNanos; - self.rollbackEstimatedDtToleranceMillis = self.rollbackEstimatedDtMillis / 1000.0; self.maxChasingRenderFramesPerUpdate = parsedBattleColliderInfo.maxChasingRenderFramesPerUpdate; + self.worldToVirtualGridRatio = parsedBattleColliderInfo.worldToVirtualGridRatio; + self.virtualGridToWorldRatio = parsedBattleColliderInfo.virtualGridToWorldRatio; + const tiledMapIns = self.node.getComponent(cc.TiledMap); const fullPathOfTmxFile = cc.js.formatStr("map/%s/map", parsedBattleColliderInfo.stageName); @@ -473,17 +475,44 @@ cc.Class({ const x0 = boundaryObj[0].x, y0 = boundaryObj[0].y; let pts = []; - // TODO: Simplify this redundant coordinate conversion within "extractBoundaryObjects", but since this routine is only called once per battle, not urgent. for (let i = 0; i < boundaryObj.length; ++i) { - pts.push([boundaryObj[i].x - x0, boundaryObj[i].y - y0]); + const dx = boundaryObj[i].x - x0; + const dy = boundaryObj[i].y - y0; + pts.push([dx, dy]); + /* + if (self.showCriticalCoordinateLabels) { + const barrierVertLabelNode = new cc.Node(); + switch (i % 4) { + case 0: + barrierVertLabelNode.color = cc.Color.RED; + break; + case 1: + barrierVertLabelNode.color = cc.Color.GRAY; + break; + case 2: + barrierVertLabelNode.color = cc.Color.BLACK; + break; + default: + barrierVertLabelNode.color = cc.Color.MAGENTA; + break; + } + barrierVertLabelNode.setPosition(cc.v2(x0+0.95*dx, y0+0.5*dy)); + const barrierVertLabel = barrierVertLabelNode.addComponent(cc.Label); + barrierVertLabel.fontSize = 20; + barrierVertLabel.lineHeight = 22; + barrierVertLabel.string = `(${boundaryObj[i].x.toFixed(1)}, ${boundaryObj[i].y.toFixed(1)})`; + safelyAddChild(self.node, barrierVertLabelNode); + setLocalZOrder(barrierVertLabelNode, 5); + + barrierVertLabelNode.active = true; } - const newBarrierLatest = self.latestCollisionSys.createPolygon(x0, y0, pts); - // console.log("Created barrier: ", newBarrierLatest); - const newBarrierChaser = self.chaserCollisionSys.createPolygon(x0, y0, pts); + */ + } + const newBarrier = self.collisionSys.createPolygon(x0, y0, pts); + // console.log("Created barrier: ", newBarrier); ++barrierIdCounter; const collisionBarrierIndex = (self.collisionBarrierIndexPrefix + barrierIdCounter); - self.latestCollisionSysMap.set(collisionBarrierIndex, newBarrierLatest); - self.chaserCollisionSysMap.set(collisionBarrierIndex, newBarrierChaser); + self.collisionSysMap.set(collisionBarrierIndex, newBarrier); } self.selfPlayerInfo = JSON.parse(cc.sys.localStorage.getItem('selfPlayer')); @@ -506,7 +535,7 @@ cc.Class({ self.backgroundMapTiledIns.node.setContentSize(newBackgroundMapSize.width * newBackgroundMapTileSize.width, newBackgroundMapSize.height * newBackgroundMapTileSize.height); self.backgroundMapTiledIns.node.setPosition(cc.v2(0, 0)); - const reqData = window.WsReq.encode({ + const reqData = window.pb.protos.WsReq.encode({ msgId: Date.now(), act: window.UPSYNC_MSG_ACT_PLAYER_COLLIDER_ACK, }).finish(); @@ -589,25 +618,19 @@ cc.Class({ if (window.MAGIC_ROOM_DOWNSYNC_FRAME_ID.BATTLE_START < rdf.id && window.RING_BUFF_CONSECUTIVE_SET == dumpRenderCacheRet) { /* Don't change - - lastAllConfirmedRenderFrameId, it's updated only in "rollbackAndChase > _createRoomDownsyncFrameLocally" (except for when RING_BUFF_NON_CONSECUTIVE_SET) - - chaserRenderFrameId, it's updated only in "onInputFrameDownsyncBatch" (except for when RING_BUFF_NON_CONSECUTIVE_SET) + - lastAllConfirmedRenderFrameId, it's updated only in "rollbackAndChase" (except for when RING_BUFF_NON_CONSECUTIVE_SET) + - chaserRenderFrameId, it's updated only in "rollbackAndChase & onInputFrameDownsyncBatch" (except for when RING_BUFF_NON_CONSECUTIVE_SET) */ return dumpRenderCacheRet; } // The logic below applies to ( || window.RING_BUFF_NON_CONSECUTIVE_SET == dumpRenderCacheRet) if (window.MAGIC_ROOM_DOWNSYNC_FRAME_ID.BATTLE_START == rdf.id) { - console.log('On battle resynced! renderFrameId=', rdf.id); + console.log('On battle started! renderFrameId=', rdf.id); } else { console.log('On battle resynced! renderFrameId=', rdf.id); } - self.renderFrameId = rdf.id; - self.lastRenderFrameIdTriggeredAt = performance.now(); - // In this case it must be true that "rdf.id > chaserRenderFrameId >= lastAllConfirmedRenderFrameId". - self.lastAllConfirmedRenderFrameId = rdf.id; - self.chaserRenderFrameId = rdf.id; - const players = rdf.players; const playerMetas = rdf.playerMetas; self._initPlayerRichInfoDict(players, playerMetas); @@ -619,6 +642,12 @@ cc.Class({ playersInfoScriptIns.updateData(playerMeta); } + self.renderFrameId = rdf.id; + self.lastRenderFrameIdTriggeredAt = performance.now(); + // In this case it must be true that "rdf.id > chaserRenderFrameId >= lastAllConfirmedRenderFrameId". + self.lastAllConfirmedRenderFrameId = rdf.id; + self.chaserRenderFrameId = rdf.id; + if (null != rdf.countdownNanos) { self.countdownNanos = rdf.countdownNanos; } @@ -672,6 +701,8 @@ cc.Class({ firstPredictedYetIncorrectInputFrameId = inputFrameDownsyncId; } self.lastAllConfirmedInputFrameId = inputFrameDownsyncId; + // [WARNING] Take all "inputFrameDownsync" from backend as all-confirmed, it'll be later checked by "rollbackAndChase". + inputFrameDownsync.confirmedList = (1 << self.playerRichInfoDict.size) - 1; self.dumpToInputCache(inputFrameDownsync); } @@ -696,7 +727,7 @@ cc.Class({ -------------------------------------------------------- */ // The actual rollback-and-chase would later be executed in update(dt). - console.warn("Mismatched input detected, resetting chaserRenderFrameId: inputFrameId1:", inputFrameId1, ", renderFrameId1:", renderFrameId1, ", chaserRenderFrameId before reset: ", self.chaserRenderFrameId); + console.warn(`Mismatched input detected, resetting chaserRenderFrameId: ${self.chaserRenderFrameId}->${renderFrameId1} by firstPredictedYetIncorrectInputFrameId: ${inputFrameId1}`); self.chaserRenderFrameId = renderFrameId1; }, @@ -713,7 +744,7 @@ cc.Class({ logBattleStats() { const self = this; let s = []; - s.push("Battle stats: renderFrameId=" + self.renderFrameId + ", lastAllConfirmedRenderFrameId=" + self.lastAllConfirmedRenderFrameId + ", lastUpsyncInputFrameId=" + self.lastUpsyncInputFrameId + ", lastAllConfirmedInputFrameId=" + self.lastAllConfirmedInputFrameId); + s.push(`Battle stats: renderFrameId=${self.renderFrameId}, lastAllConfirmedRenderFrameId=${self.lastAllConfirmedRenderFrameId}, lastUpsyncInputFrameId=${self.lastUpsyncInputFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, chaserRenderFrameId=${self.chaserRenderFrameId}`); for (let i = self.recentInputCache.stFrameId; i < self.recentInputCache.edFrameId; ++i) { const inputFrameDownsync = self.recentInputCache.getByFrameId(i); @@ -745,24 +776,22 @@ cc.Class({ self.playersInfoNode.getComponent("PlayersInfo").clearInfo(); }, - spawnPlayerNode(joinIndex, x, y) { + spawnPlayerNode(joinIndex, vx, vy, playerRichInfo) { const self = this; const newPlayerNode = 1 == joinIndex ? cc.instantiate(self.player1Prefab) : cc.instantiate(self.player2Prefab); // hardcoded for now, car color determined solely by joinIndex - newPlayerNode.setPosition(cc.v2(x, y)); + const wpos = self.virtualGridToWorldPos(vx, vy); + + newPlayerNode.setPosition(cc.v2(wpos[0], wpos[1])); newPlayerNode.getComponent("SelfPlayer").mapNode = self.node; - const currentSelfColliderCircle = newPlayerNode.getComponent(cc.CircleCollider); - const r = currentSelfColliderCircle.radius, - d = 2 * r; - // The collision box of an individual player is a polygon instead of a circle, because the backend collision engine doesn't handle circle alignment well. - const x0 = x - r, - y0 = y - r; + const cpos = self.virtualGridToPlayerColliderPos(vx, vy, playerRichInfo); + const d = playerRichInfo.colliderRadius * 2, + x0 = cpos[0], + y0 = cpos[1]; let pts = [[0, 0], [d, 0], [d, d], [0, d]]; - const newPlayerColliderLatest = self.latestCollisionSys.createPolygon(x0, y0, pts); - const newPlayerColliderChaser = self.chaserCollisionSys.createPolygon(x0, y0, pts); + const newPlayerCollider = self.collisionSys.createPolygon(x0, y0, pts); const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; - self.latestCollisionSysMap.set(collisionPlayerIndex, newPlayerColliderLatest); - self.chaserCollisionSysMap.set(collisionPlayerIndex, newPlayerColliderChaser); + self.collisionSysMap.set(collisionPlayerIndex, newPlayerCollider); safelyAddChild(self.node, newPlayerNode); setLocalZOrder(newPlayerNode, 5); @@ -770,8 +799,8 @@ cc.Class({ newPlayerNode.active = true; const playerScriptIns = newPlayerNode.getComponent("SelfPlayer"); playerScriptIns.scheduleNewDirection({ - dx: 0, - dy: 0 + dx: playerRichInfo.dir.dx, + dy: playerRichInfo.dir.dy }, true); return [newPlayerNode, playerScriptIns]; @@ -809,12 +838,11 @@ cc.Class({ if (nextChaserRenderFrameId > self.renderFrameId) { nextChaserRenderFrameId = self.renderFrameId; } - self.rollbackAndChase(prevChaserRenderFrameId, nextChaserRenderFrameId, self.chaserCollisionSys, self.chaserCollisionSysMap); - self.chaserRenderFrameId = nextChaserRenderFrameId; // Move the cursor "self.chaserRenderFrameId", keep in mind that "self.chaserRenderFrameId" is not monotonic! + self.rollbackAndChase(prevChaserRenderFrameId, nextChaserRenderFrameId, self.collisionSys, self.collisionSysMap, true); let t2 = performance.now(); - // Inside the following "self.rollbackAndChase" (which actually ROLLS FORWARD), the "self.latestCollisionSys" is ALWAYS "ROLLED BACK" to "self.recentRenderCache.get(self.renderFrameId)" before being applied dynamics from corresponding delayedInputFrame, REGARDLESS OF whether or not "self.chaserRenderFrameId == self.renderFrameId" now. - const rdf = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.latestCollisionSys, self.latestCollisionSysMap); + // Inside the following "self.rollbackAndChase" actually ROLLS FORWARD w.r.t. the corresponding delayedInputFrame, REGARDLESS OF whether or not "self.chaserRenderFrameId == self.renderFrameId" now. + const rdf = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.collisionSys, self.collisionSysMap, false); /* const nonTrivialChaseEnded = (prevChaserRenderFrameId < nextChaserRenderFrameId && nextChaserRenderFrameId == self.renderFrameId); if (nonTrivialChaseEnded) { @@ -917,15 +945,28 @@ cc.Class({ setLocalZOrder(toShowNode, 10); }, - hideFindingPlayersGUI() { + hideFindingPlayersGUI(rdf) { const self = this; if (null == self.findingPlayerNode.parent) return; self.findingPlayerNode.parent.removeChild(self.findingPlayerNode); + if (null != rdf) { + self._initPlayerRichInfoDict(rdf.players, rdf.playerMetas); + } }, - onBattleReadyToStart(playerMetas) { - console.log("Calling `onBattleReadyToStart` with:", playerMetas); + onBattleReadyToStart(rdf) { const self = this; + const players = rdf.players; + const playerMetas = rdf.playerMetas; + self._initPlayerRichInfoDict(players, playerMetas); + + // Show the top status indicators for IN_BATTLE + const playersInfoScriptIns = self.playersInfoNode.getComponent("PlayersInfo"); + for (let i in playerMetas) { + const playerMeta = playerMetas[i]; + playersInfoScriptIns.updateData(playerMeta); + } + console.log("Calling `onBattleReadyToStart` with:", playerMetas); const findingPlayerScriptIns = self.findingPlayerNode.getComponent("FindingPlayer"); findingPlayerScriptIns.hideExitButton(); findingPlayerScriptIns.updatePlayersInfo(playerMetas); @@ -939,77 +980,22 @@ cc.Class({ }, 1500); }, - _createRoomDownsyncFrameLocally(renderFrameId, collisionSys, collisionSysMap) { - const self = this; - const prevRenderFrameId = renderFrameId - 1; - const inputFrameAppliedOnPrevRenderFrame = ( - 0 > prevRenderFrameId - ? - null - : - self.getCachedInputFrameDownsyncWithPrediction(self._convertToInputFrameId(prevRenderFrameId, self.inputDelayFrames)) - ); - - // TODO: Find a better way to assign speeds instead of using "speedRefRenderFrameId". - const speedRefRenderFrameId = prevRenderFrameId; - const speedRefRenderFrame = ( - 0 > speedRefRenderFrameId - ? - null - : - self.recentRenderCache.getByFrameId(speedRefRenderFrameId) - ); - - const rdf = { - id: renderFrameId, - refFrameId: renderFrameId, - players: {} - }; - self.playerRichInfoDict.forEach((playerRichInfo, playerId) => { - const joinIndex = playerRichInfo.joinIndex; - const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; - const playerCollider = collisionSysMap.get(collisionPlayerIndex); - const currentSelfColliderCircle = playerRichInfo.node.getComponent(cc.CircleCollider); - const r = currentSelfColliderCircle.radius; - rdf.players[playerRichInfo.id] = { - id: playerRichInfo.id, - x: playerCollider.x + r, // [WARNING] the (x, y) of "playerCollider" is offset to the anchor (i.e. first point of all points) of the polygon shape - y: playerCollider.y + r, - dir: self.ctrl.decodeDirection(null == inputFrameAppliedOnPrevRenderFrame ? 0 : inputFrameAppliedOnPrevRenderFrame.inputList[joinIndex - 1]), - speed: (null == speedRefRenderFrame ? playerRichInfo.speed : speedRefRenderFrame.players[playerRichInfo.id].speed), - joinIndex: joinIndex - }; - }); - if ( - null != inputFrameAppliedOnPrevRenderFrame && self._allConfirmed(inputFrameAppliedOnPrevRenderFrame.confirmedList) - && - rdf.id > self.lastAllConfirmedRenderFrameId - ) { - // We got a more up-to-date "all-confirmed-render-frame". - self.lastAllConfirmedRenderFrameId = rdf.id; - if (rdf.id > self.chaserRenderFrameId) { - // it must be true that "chaserRenderFrameId >= lastAllConfirmedRenderFrameId" - self.chaserRenderFrameId = rdf.id; - } - } - self.dumpToRenderCache(rdf); - return rdf; - }, - applyRoomDownsyncFrameDynamics(rdf) { const self = this; self.playerRichInfoDict.forEach((playerRichInfo, playerId) => { const immediatePlayerInfo = rdf.players[playerId]; - const dx = (immediatePlayerInfo.x - playerRichInfo.node.x); - const dy = (immediatePlayerInfo.y - playerRichInfo.node.y); - const justJiggling = (self.teleportEps1D >= Math.abs(dx) && self.teleportEps1D >= Math.abs(dy)); + const wpos = self.virtualGridToWorldPos(immediatePlayerInfo.virtualGridX, immediatePlayerInfo.virtualGridY); + const dx = (wpos[0] - playerRichInfo.node.x); + const dy = (wpos[1] - playerRichInfo.node.y); + const justJiggling = (self.jigglingEps1D >= Math.abs(dx) && self.jigglingEps1D >= Math.abs(dy)); if (!justJiggling) { - console.log("@renderFrameId=" + self.renderFrameId + ", teleporting playerId=" + playerId + ": '(" + playerRichInfo.node.x + ", " + playerRichInfo.node.y, ")' to '(" + immediatePlayerInfo.x + ", " + immediatePlayerInfo.y + ")'"); - playerRichInfo.node.setPosition(immediatePlayerInfo.x, immediatePlayerInfo.y); + playerRichInfo.node.setPosition(wpos[0], wpos[1]); + playerRichInfo.virtualGridX = immediatePlayerInfo.virtualGridX; + playerRichInfo.virtualGridY = immediatePlayerInfo.virtualGridY; + playerRichInfo.scriptIns.scheduleNewDirection(immediatePlayerInfo.dir, false); + playerRichInfo.scriptIns.updateSpeed(immediatePlayerInfo.speed); } - playerRichInfo.scriptIns.scheduleNewDirection(immediatePlayerInfo.dir, false); - playerRichInfo.scriptIns.updateSpeed(immediatePlayerInfo.speed); }); }, @@ -1027,61 +1013,67 @@ cc.Class({ return inputFrameDownsync; }, - rollbackAndChase(renderFrameIdSt, renderFrameIdEd, collisionSys, collisionSysMap) { + // TODO: Write unit-test for this function to compare with its backend counter part + applyInputFrameDownsyncDynamicsOnSingleRenderFrame(delayedInputFrame, currRenderFrame, collisionSys, collisionSysMap) { const self = this; - let latestRdf = self.recentRenderCache.getByFrameId(renderFrameIdSt); // typed "RoomDownsyncFrame" - if (null == latestRdf) { - console.error("Couldn't find renderFrameId=", renderFrameIdSt, " to rollback, lastAllConfirmedRenderFrameId=", self.lastAllConfirmedRenderFrameId, ", lastAllConfirmedInputFrameId=", self.lastAllConfirmedInputFrameId, ", recentRenderCache=", self._stringifyRecentRenderCache(false), ", recentInputCache=", self._stringifyRecentInputCache(false)); + const nextRenderFramePlayers = {} + for (let playerId in currRenderFrame.players) { + const currPlayerDownsync = currRenderFrame.players[playerId]; + nextRenderFramePlayers[playerId] = { + id: playerId, + virtualGridX: currPlayerDownsync.virtualGridX, + virtualGridY: currPlayerDownsync.virtualGridY, + dir: { + dx: currPlayerDownsync.dir.dx, + dy: currPlayerDownsync.dir.dy, + }, + speed: currPlayerDownsync.speed, + battleState: currPlayerDownsync.battleState, + score: currPlayerDownsync.score, + removed: currPlayerDownsync.removed, + joinIndex: currPlayerDownsync.joinIndex, + }; } - if (renderFrameIdSt >= renderFrameIdEd) { - return latestRdf; - } - /* - Reset "position" of players in "collisionSys" according to "renderFrameIdSt". The easy part is that we don't have path-dependent-integrals to worry about like that of thermal dynamics. - */ - self.playerRichInfoDict.forEach((playerRichInfo, playerId) => { - const joinIndex = playerRichInfo.joinIndex; - const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; - const playerCollider = collisionSysMap.get(collisionPlayerIndex); - const player = latestRdf.players[playerId]; + const toRet = { + id: currRenderFrame.id + 1, + players: nextRenderFramePlayers, + }; - const currentSelfColliderCircle = playerRichInfo.node.getComponent(cc.CircleCollider); - const r = currentSelfColliderCircle.radius; - playerCollider.x = player.x - r; - playerCollider.y = player.y - r; - }); - - /* - This function eventually calculates a "RoomDownsyncFrame" where "RoomDownsyncFrame.id == renderFrameIdEd". - */ - for (let i = renderFrameIdSt; i < renderFrameIdEd; ++i) { - const renderFrame = self.recentRenderCache.getByFrameId(i); // typed "RoomDownsyncFrame" - const j = self._convertToInputFrameId(i, self.inputDelayFrames); - const inputFrameDownsync = self.getCachedInputFrameDownsyncWithPrediction(j); - if (null == inputFrameDownsync) { - console.error("Failed to get cached inputFrameDownsync for renderFrameId=", i, ", inputFrameId=", j, "lastAllConfirmedRenderFrameId=", self.lastAllConfirmedRenderFrameId, ", lastAllConfirmedInputFrameId=", self.lastAllConfirmedInputFrameId, ", recentRenderCache=", self._stringifyRecentRenderCache(false), ", recentInputCache=", self._stringifyRecentInputCache(false)); - } - const inputList = inputFrameDownsync.inputList; - // [WARNING] Traverse in the order of joinIndices to guarantee determinism. + if (null != delayedInputFrame) { + const inputList = delayedInputFrame.inputList; + const effPushbacks = new Array(self.playerRichInfoArr.length); // Guaranteed determinism regardless of traversal order for (let j in self.playerRichInfoArr) { const joinIndex = parseInt(j) + 1; + effPushbacks[joinIndex - 1] = [0.0, 0.0]; const playerId = self.playerRichInfoArr[j].id; const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; const playerCollider = collisionSysMap.get(collisionPlayerIndex); - const player = renderFrame.players[playerId]; + const player = currRenderFrame.players[playerId]; + const encodedInput = inputList[joinIndex - 1]; const decodedInput = self.ctrl.decodeDirection(encodedInput); - const baseChange = player.speed * self.rollbackEstimatedDt * decodedInput.speedFactor; - playerCollider.x += baseChange * decodedInput.dx; - playerCollider.y += baseChange * decodedInput.dy; + + // console.log(`Got non-zero inputs for playerId=${playerId}, decodedInput=${JSON.stringify(decodedInput)} @currRenderFrame.id=${currRenderFrame.id}, delayedInputFrame.id=${delayedInputFrame.id}`); + /* + Reset "position" of players in "collisionSys" according to "virtual grid position". The easy part is that we don't have path-dependent-integrals to worry about like that of thermal dynamics. + */ + const newVx = player.virtualGridX + (decodedInput.dx + player.speed * decodedInput.dx); + const newVy = player.virtualGridY + (decodedInput.dy + player.speed * decodedInput.dy); + const newCpos = self.virtualGridToPlayerColliderPos(newVx, newVy, self.playerRichInfoArr[joinIndex - 1]); + playerCollider.x = newCpos[0]; + playerCollider.y = newCpos[1]; + // Update directions and thus would eventually update moving animation accordingly + nextRenderFramePlayers[playerId].dir.dx = decodedInput.dx; + nextRenderFramePlayers[playerId].dir.dy = decodedInput.dy; } collisionSys.update(); - const result = collisionSys.createResult(); // Can I reuse a "self.latestCollisionSysResult" object throughout the whole battle? + const result = collisionSys.createResult(); // Can I reuse a "self.collisionSysResult" object throughout the whole battle? - for (let i in self.playerRichInfoArr) { - const joinIndex = parseInt(i) + 1; + for (let j in self.playerRichInfoArr) { + const joinIndex = parseInt(j) + 1; + const playerId = self.playerRichInfoArr[j].id; const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; const playerCollider = collisionSysMap.get(collisionPlayerIndex); const potentials = playerCollider.potentials(); @@ -1089,12 +1081,72 @@ cc.Class({ // Test if the player collides with the wall if (!playerCollider.collides(potential, result)) continue; // Push the player out of the wall - playerCollider.x -= result.overlap * result.overlap_x; - playerCollider.y -= result.overlap * result.overlap_y; + effPushbacks[joinIndex - 1][0] += result.overlap * result.overlap_x; + effPushbacks[joinIndex - 1][1] += result.overlap * result.overlap_y; } } - latestRdf = self._createRoomDownsyncFrameLocally(i + 1, collisionSys, collisionSysMap); + for (let j in self.playerRichInfoArr) { + const joinIndex = parseInt(j) + 1; + const playerId = self.playerRichInfoArr[j].id; + const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex; + const playerCollider = collisionSysMap.get(collisionPlayerIndex); + const newVpos = self.playerColliderAnchorToVirtualGridPos(playerCollider.x - effPushbacks[joinIndex - 1][0], playerCollider.y - effPushbacks[joinIndex - 1][1], self.playerRichInfoArr[j]); + nextRenderFramePlayers[playerId].virtualGridX = newVpos[0]; + nextRenderFramePlayers[playerId].virtualGridY = newVpos[1]; + } + } + + return toRet; + }, + + rollbackAndChase(renderFrameIdSt, renderFrameIdEd, collisionSys, collisionSysMap, isChasing) { + /* + This function eventually calculates a "RoomDownsyncFrame" where "RoomDownsyncFrame.id == renderFrameIdEd" if not interruptted. + */ + const self = this; + let latestRdf = self.recentRenderCache.getByFrameId(renderFrameIdSt); // typed "RoomDownsyncFrame" + if (null == latestRdf) { + console.error(`Couldn't find renderFrameId=${renderFrameIdSt}, to rollback, lastAllConfirmedRenderFrameId=${self.lastAllConfirmedRenderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, recentRenderCache=${self._stringifyRecentRenderCache(false)}, recentInputCache=${self._stringifyRecentInputCache(false)}`); + return latestRdf; + } + + if (renderFrameIdSt >= renderFrameIdEd) { + return latestRdf; + } + + for (let i = renderFrameIdSt; i < renderFrameIdEd; ++i) { + const currRenderFrame = self.recentRenderCache.getByFrameId(i); // typed "RoomDownsyncFrame"; [WARNING] When "true == isChasing", this function can be interruptted by "onRoomDownsyncFrame(rdf)" asynchronously anytime, making this line return "null"! + if (null == currRenderFrame) { + console.warn(`Couldn't find renderFrame for i=${i} to rollback, self.renderFrameId=${self.renderFrameId}, lastAllConfirmedRenderFrameId=${self.lastAllConfirmedRenderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, might've been interruptted by onRoomDownsyncFrame`); + return latestRdf; + } + const j = self._convertToInputFrameId(i, self.inputDelayFrames); + const delayedInputFrame = self.getCachedInputFrameDownsyncWithPrediction(j); + if (null == delayedInputFrame) { + console.warn(`Failed to get cached delayedInputFrame for i=${i}, j=${j}, self.renderFrameId=${self.renderFrameId}, lastAllConfirmedRenderFrameId=${self.lastAllConfirmedRenderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}`); + return latestRdf; + } + + latestRdf = self.applyInputFrameDownsyncDynamicsOnSingleRenderFrame(delayedInputFrame, currRenderFrame, collisionSys, collisionSysMap); + if ( + self._allConfirmed(delayedInputFrame.confirmedList) + && + latestRdf.id > self.lastAllConfirmedRenderFrameId + ) { + // We got a more up-to-date "all-confirmed-render-frame". + self.lastAllConfirmedRenderFrameId = latestRdf.id; + if (latestRdf.id > self.chaserRenderFrameId) { + // it must be true that "chaserRenderFrameId >= lastAllConfirmedRenderFrameId", regardeless of the "isChasing" param + self.chaserRenderFrameId = latestRdf.id; + } + } + + if (true == isChasing) { + // Move the cursor "self.chaserRenderFrameId", keep in mind that "self.chaserRenderFrameId" is not monotonic! + self.chaserRenderFrameId = latestRdf.id; + } + self.dumpToRenderCache(latestRdf); } return latestRdf; @@ -1107,8 +1159,10 @@ cc.Class({ if (self.playerRichInfoDict.has(playerId)) continue; // Skip already put keys const immediatePlayerInfo = players[playerId]; const immediatePlayerMeta = playerMetas[playerId]; - const nodeAndScriptIns = self.spawnPlayerNode(immediatePlayerInfo.joinIndex, immediatePlayerInfo.x, immediatePlayerInfo.y); self.playerRichInfoDict.set(playerId, immediatePlayerInfo); + Object.assign(self.playerRichInfoDict.get(playerId), immediatePlayerMeta); + + const nodeAndScriptIns = self.spawnPlayerNode(immediatePlayerInfo.joinIndex, immediatePlayerInfo.virtualGridX, immediatePlayerInfo.virtualGridY, self.playerRichInfoDict.get(playerId)); Object.assign(self.playerRichInfoDict.get(playerId), { node: nodeAndScriptIns[0], @@ -1136,7 +1190,7 @@ cc.Class({ return s.join('\n'); } - return "[stInputFrameId=" + self.recentInputCache.stFrameId + ", edInputFrameId=" + self.recentInputCache.edFrameId + ")"; + return `[stInputFrameId=${self.recentInputCache.stFrameId}, edInputFrameId=${self.recentInputCache.edFrameId})`; }, _stringifyRecentRenderCache(usefullOutput) { @@ -1149,7 +1203,43 @@ cc.Class({ return s.join('\n'); } - return "[stRenderFrameId=" + self.recentRenderCache.stFrameId + ", edRenderFrameId=" + self.recentRenderCache.edFrameId + ")"; + return `[stRenderFrameId=${self.recentRenderCache.stFrameId}, edRenderFrameId=${self.recentRenderCache.edFrameId})`; }, + worldToVirtualGridPos(x, y) { + // [WARNING] Introduces loss of precision! + const self = this; + // In JavaScript floating numbers suffer from seemingly non-deterministic arithmetics, and even if certain libs solved this issue by approaches such as fixed-point-number, they might not be used in other libs -- e.g. the "collision libs" we're interested in -- thus couldn't kill all pains. + let virtualGridX = Math.round(x * self.worldToVirtualGridRatio); + let virtualGridY = Math.round(y * self.worldToVirtualGridRatio); + return [virtualGridX, virtualGridY]; + }, + + virtualGridToWorldPos(vx, vy) { + // No loss of precision + const self = this; + let wx = parseFloat(vx) * self.virtualGridToWorldRatio; + let wy = parseFloat(vy) * self.virtualGridToWorldRatio; + return [wx, wy]; + }, + + playerWorldToCollisionPos(wx, wy, playerRichInfo) { + return [wx - playerRichInfo.colliderRadius, wy - playerRichInfo.colliderRadius]; + }, + + playerColliderAnchorToWorldPos(cx, cy, playerRichInfo) { + return [cx + playerRichInfo.colliderRadius, cy + playerRichInfo.colliderRadius]; + }, + + playerColliderAnchorToVirtualGridPos(cx, cy, playerRichInfo) { + const self = this; + const wpos = self.playerColliderAnchorToWorldPos(cx, cy, playerRichInfo); + return self.worldToVirtualGridPos(wpos[0], wpos[1]) + }, + + virtualGridToPlayerColliderPos(vx, vy, playerRichInfo) { + const self = this; + const wpos = self.virtualGridToWorldPos(vx, vy); + return self.playerWorldToCollisionPos(wpos[0], wpos[1], playerRichInfo) + }, }); diff --git a/frontend/assets/scripts/SelfPlayer.js b/frontend/assets/scripts/SelfPlayer.js index 9025a24..a726ecc 100644 --- a/frontend/assets/scripts/SelfPlayer.js +++ b/frontend/assets/scripts/SelfPlayer.js @@ -1,4 +1,4 @@ -const BasePlayer = require("./BasePlayer"); +const BasePlayer = require("./BasePlayer"); cc.Class({ extends: BasePlayer, @@ -7,6 +7,10 @@ cc.Class({ arrowTipNode: { type: cc.Node, default: null + }, + coordLabel: { + type: cc.Label, + default: null } }, start() { @@ -26,6 +30,10 @@ cc.Class({ '2-1': 'attackedRight' }; this.arrowTipNode.active = false; + + if (!this.mapIns.showCriticalCoordinateLabels) { + this.coordLabel.node.active = false; + } }, showArrowTipNode() { @@ -34,7 +42,7 @@ cc.Class({ return; } self.arrowTipNode.active = true; - window.setTimeout(function(){ + window.setTimeout(function() { if (null == self.arrowTipNode) { return; } @@ -44,6 +52,9 @@ cc.Class({ update(dt) { BasePlayer.prototype.update.call(this, dt); + if (this.mapIns.showCriticalCoordinateLabels) { + this.coordLabel.string = `(${this.node.x.toFixed(2)}, ${this.node.y.toFixed(2)})`; + } }, }); diff --git a/frontend/assets/scripts/TileCollisionManagerSingleton.js b/frontend/assets/scripts/TileCollisionManagerSingleton.js index a37cd25..e8181a0 100644 --- a/frontend/assets/scripts/TileCollisionManagerSingleton.js +++ b/frontend/assets/scripts/TileCollisionManagerSingleton.js @@ -372,7 +372,7 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo for (let tsxFilenameIdx = 0; tsxFilenameIdx < tsxFileNames.length; ++tsxFilenameIdx) { const tsxOrientation = tileSets[tsxFilenameIdx].orientation; if (cc.TiledMap.Orientation.ORTHO == tsxOrientation) { - cc.error("Error at tileset %s: We proceed with ONLY tilesets in ORTHO orientation for all map orientations by now.", tsxFileNames[tsxFilenameIdx]); + cc.error("Error at tileset %s: We don't proceed with tilesets in ORTHO orientation by now.", tsxFileNames[tsxFilenameIdx]); continue; }; diff --git a/frontend/assets/scripts/TouchEventsManager.js b/frontend/assets/scripts/TouchEventsManager.js index 2cbf08f..19617ff 100644 --- a/frontend/assets/scripts/TouchEventsManager.js +++ b/frontend/assets/scripts/TouchEventsManager.js @@ -1,18 +1,14 @@ window.DIRECTION_DECODER = [ - // The 3rd value matches low-precision constants in backend. - [0, 0, 0.0], - [0, +1, 1.0], - [0, -1, 1.0], - [+2, 0, 0.5], - [-2, 0, 0.5], - [+2, +1, 0.4472], - [-2, -1, 0.4472], - [+2, -1, 0.4472], - [-2, +1, 0.4472], - [+2, 0, 0.5], - [-2, 0, 0.5], - [0, +1, 1.0], - [0, -1, 1.0], + // The 3rd value matches low-precision constants in backend. + [0, 0], + [0, +2], + [0, -2], + [+2, 0], + [-2, 0], + [+1, +1], + [-1, -1], + [+1, -1], + [-1, +1], ]; cc.Class({ @@ -40,11 +36,11 @@ cc.Class({ type: cc.Float }, magicLeanLowerBound: { - default: 0.414, // Tangent of (PI/8). + default: 0.1, type: cc.Float }, magicLeanUpperBound: { - default: 2.414, // Tangent of (3*PI/8). + default: 0.9, type: cc.Float }, // For joystick ends. @@ -117,8 +113,8 @@ cc.Class({ _initTouchEvent() { const self = this; - const translationListenerNode = (self.translationListenerNode ? self.translationListenerNode : self.mapNode); - const zoomingListenerNode = (self.zoomingListenerNode ? self.zoomingListenerNode : self.mapNode); + const translationListenerNode = (self.translationListenerNode ? self.translationListenerNode : self.mapNode); + const zoomingListenerNode = (self.zoomingListenerNode ? self.zoomingListenerNode : self.mapNode); translationListenerNode.on(cc.Node.EventType.TOUCH_START, function(event) { self._touchStartEvent(event); @@ -132,7 +128,7 @@ cc.Class({ translationListenerNode.on(cc.Node.EventType.TOUCH_CANCEL, function(event) { self._touchEndEvent(event); }); - translationListenerNode.inTouchPoints = new Map(); + translationListenerNode.inTouchPoints = new Map(); zoomingListenerNode.on(cc.Node.EventType.TOUCH_START, function(event) { self._touchStartEvent(event); @@ -146,7 +142,7 @@ cc.Class({ zoomingListenerNode.on(cc.Node.EventType.TOUCH_CANCEL, function(event) { self._touchEndEvent(event); }); - zoomingListenerNode.inTouchPoints = new Map(); + zoomingListenerNode.inTouchPoints = new Map(); }, _isMapOverMoved(mapTargetPos) { @@ -155,7 +151,7 @@ cc.Class({ }, _touchStartEvent(event) { - const theListenerNode = event.target; + const theListenerNode = event.target; for (let touch of event._touches) { theListenerNode.inTouchPoints.set(touch._id, touch); } @@ -165,12 +161,12 @@ cc.Class({ if (ALL_MAP_STATES.VISUAL != this.mapScriptIns.state) { return; } - const theListenerNode = event.target; + const theListenerNode = event.target; const linearScaleFacBase = this.linearScaleFacBase; // Not used yet. if (1 != theListenerNode.inTouchPoints.size) { return; } - if (!theListenerNode.inTouchPoints.has(event.currentTouch._id)) { + if (!theListenerNode.inTouchPoints.has(event.currentTouch._id)) { return; } const diffVec = event.currentTouch._point.sub(event.currentTouch._startPoint); @@ -189,9 +185,9 @@ cc.Class({ if (ALL_MAP_STATES.VISUAL != this.mapScriptIns.state) { return; } - const theListenerNode = event.target; + const theListenerNode = event.target; if (2 != theListenerNode.inTouchPoints.size) { - return; + return; } if (2 == event._touches.length) { const firstTouch = event._touches[0]; @@ -219,13 +215,13 @@ cc.Class({ } this.mainCamera.zoomRatio = targetScale; for (let child of this.mainCameraNode.children) { - child.setScale(1/targetScale); + child.setScale(1 / targetScale); } } }, _touchEndEvent(event) { - const theListenerNode = event.target; + const theListenerNode = event.target; do { if (!theListenerNode.inTouchPoints.has(event.currentTouch._id)) { break; @@ -241,7 +237,7 @@ cc.Class({ break; } - // TODO: Handle single-finger-click event. + // TODO: Handle single-finger-click event. } while (false); this.cachedStickHeadPosition = cc.v2(0.0, 0.0); for (let touch of event._touches) { @@ -266,19 +262,11 @@ cc.Class({ encodedIdx: 0 }; if (Math.abs(continuousDx) < eps && Math.abs(continuousDy) < eps) { - return ret; + return ret; } - if (Math.abs(continuousDx) < eps) { - ret.dx = 0; - if (0 < continuousDy) { - ret.dy = +1; // up - ret.encodedIdx = 1; - } else { - ret.dy = -1; // down - ret.encodedIdx = 2; - } - } else if (Math.abs(continuousDy) < eps) { + const criticalRatio = continuousDy / continuousDx; + if (Math.abs(criticalRatio) < this.magicLeanLowerBound) { ret.dy = 0; if (0 < continuousDx) { ret.dx = +2; // right @@ -287,66 +275,55 @@ cc.Class({ ret.dx = -2; // left ret.encodedIdx = 4; } + } else if (Math.abs(criticalRatio) > this.magicLeanUpperBound) { + ret.dx = 0; + if (0 < continuousDy) { + ret.dy = +2; // up + ret.encodedIdx = 1; + } else { + ret.dy = -2; // down + ret.encodedIdx = 2; + } } else { - const criticalRatio = continuousDy / continuousDx; - if (criticalRatio > this.magicLeanLowerBound && criticalRatio < this.magicLeanUpperBound) { - if (0 < continuousDx) { - ret.dx = +2; + if (0 < continuousDx) { + if (0 < continuousDy) { + ret.dx = +1; ret.dy = +1; ret.encodedIdx = 5; } else { - ret.dx = -2; + ret.dx = +1; + ret.dy = -1; + ret.encodedIdx = 7; + } + } else { + // 0 >= continuousDx + if (0 < continuousDy) { + ret.dx = -1; + ret.dy = +1; + ret.encodedIdx = 8; + } else { + ret.dx = -1; ret.dy = -1; ret.encodedIdx = 6; } - } else if (criticalRatio > -this.magicLeanUpperBound && criticalRatio < -this.magicLeanLowerBound) { - if (0 < continuousDx) { - ret.dx = +2; - ret.dy = -1; - ret.encodedIdx = 7; - } else { - ret.dx = -2; - ret.dy = +1; - ret.encodedIdx = 8; - } - } else { - if (Math.abs(criticalRatio) < 1) { - ret.dy = 0; - if (0 < continuousDx) { - ret.dx = +2; - ret.encodedIdx = 9; - } else { - ret.dx = -2; - ret.encodedIdx = 10; - } - } else { - ret.dx = 0; - if (0 < continuousDy) { - ret.dy = +1; - ret.encodedIdx = 11; - } else { - ret.dy = -1; - ret.encodedIdx = 12; - } - } } } + return ret; }, decodeDirection(encodedDirection) { const mapped = window.DIRECTION_DECODER[encodedDirection]; if (null == mapped) { - console.error("Unexpected encodedDirection = ", encodedDirection); + console.error("Unexpected encodedDirection = ", encodedDirection); } return { dx: mapped[0], - dy: mapped[1], - speedFactor: mapped[2], - } + dy: mapped[1], + }; }, getDiscretizedDirection() { - return this.discretizeDirection(this.cachedStickHeadPosition.x, this.cachedStickHeadPosition.y, this.joyStickEps); + return this.discretizeDirection(this.cachedStickHeadPosition.x, this.cachedStickHeadPosition.y, this.joyStickEps); } }); diff --git a/frontend/assets/scripts/WsSessionMgr.js b/frontend/assets/scripts/WsSessionMgr.js index ac10b7d..30cb349 100644 --- a/frontend/assets/scripts/WsSessionMgr.js +++ b/frontend/assets/scripts/WsSessionMgr.js @@ -146,7 +146,7 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) { return; } try { - const resp = window.WsResp.decode(new Uint8Array(evt.data)); + const resp = window.pb.protos.WsResp.decode(new Uint8Array(evt.data)); switch (resp.act) { case window.DOWNSYNC_MSG_ACT_HB_REQ: window.handleHbRequirements(resp); // 获取boundRoomId并存储到localStorage @@ -156,10 +156,10 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) { break; case window.DOWNSYNC_MSG_ACT_PLAYER_READDED_AND_ACKED: // Deliberately left blank for now - mapIns.hideFindingPlayersGUI(); + mapIns.hideFindingPlayersGUI(resp.rdf); break; case window.DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START: - mapIns.onBattleReadyToStart(resp.rdf.playerMetas); + mapIns.onBattleReadyToStart(resp.rdf); break; case window.DOWNSYNC_MSG_ACT_BATTLE_START: mapIns.onRoomDownsyncFrame(resp.rdf); @@ -172,22 +172,16 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) { break; case window.DOWNSYNC_MSG_ACT_FORCED_RESYNC: if (null == resp.inputFrameDownsyncBatch || 0 >= resp.inputFrameDownsyncBatch.length) { - console.error("Got empty inputFrameDownsyncBatch upon resync@localRenderFrameId=", mapIns.renderFrameId, ", @lastAllConfirmedRenderFrameId=", mapIns.lastAllConfirmedRenderFrameId, "@lastAllConfirmedInputFrameId=", mapIns.lastAllConfirmedInputFrameId, ", @localRecentInputCache=", mapIns._stringifyRecentInputCache(false), ", the incoming resp=\n", JSON.stringify(resp, null, 2)); + console.error(`Got empty inputFrameDownsyncBatch upon resync@localRenderFrameId=${mapIns.renderFrameId}, @lastAllConfirmedRenderFrameId=${mapIns.lastAllConfirmedRenderFrameId}, @lastAllConfirmedInputFrameId=${mapIns.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${mapIns.chaserRenderFrameId}, @localRecentInputCache=${mapIns._stringifyRecentInputCache(false)}, the incoming resp= +${JSON.stringify(resp, null, 2)}`); return; } - // Unless upon ws session lost and reconnected, it's maintained true that "inputFrameDownsyncBatch[0].inputFrameId == frontend.lastAllConfirmedInputFrameId+1", and in this case we should try to keep frontend moving only by "frontend.recentInputCache" to avoid jiggling of synced positions const inputFrameIdConsecutive = (resp.inputFrameDownsyncBatch[0].inputFrameId == mapIns.lastAllConfirmedInputFrameId + 1); const renderFrameIdConsecutive = (resp.rdf.id <= mapIns.renderFrameId + mapIns.renderFrameIdLagTolerance); - if (inputFrameIdConsecutive && renderFrameIdConsecutive) { - // console.log("Got consecutive resync@localRenderFrameId=", mapIns.renderFrameId, ", @lastAllConfirmedRenderFrameId=", mapIns.lastAllConfirmedRenderFrameId, "@lastAllConfirmedInputFrameId=", mapIns.lastAllConfirmedInputFrameId, ", @localRecentInputCache=", mapIns._stringifyRecentInputCache(false), ", the incoming resp=\n", JSON.stringify(resp)); - mapIns.onInputFrameDownsyncBatch(resp.inputFrameDownsyncBatch); - } else { - // console.warn("Got forced resync@localRenderFrameId=", mapIns.renderFrameId, ", @lastAllConfirmedRenderFrameId=", mapIns.lastAllConfirmedRenderFrameId, "@lastAllConfirmedInputFrameId=", mapIns.lastAllConfirmedInputFrameId, ", @localRecentInputCache=", mapIns._stringifyRecentInputCache(false), ", the incoming resp=\n", JSON.stringify(resp, null, 2)); - console.warn("Got forced resync@localRenderFrameId=", mapIns.renderFrameId, ", @lastAllConfirmedRenderFrameId=", mapIns.lastAllConfirmedRenderFrameId, "@lastAllConfirmedInputFrameId=", mapIns.lastAllConfirmedInputFrameId, ", @localRecentInputCache=", mapIns._stringifyRecentInputCache(false), ", inputFrameIdConsecutive=", inputFrameIdConsecutive, ", renderFrameIdConsecutive=", renderFrameIdConsecutive); - // The following order of execution is important - mapIns.onRoomDownsyncFrame(resp.rdf); - mapIns.onInputFrameDownsyncBatch(resp.inputFrameDownsyncBatch); - } + console.warn(`Got resync@localRenderFrameId=${mapIns.renderFrameId}, @lastAllConfirmedRenderFrameId=${mapIns.lastAllConfirmedRenderFrameId}, @lastAllConfirmedInputFrameId=${mapIns.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${mapIns.chaserRenderFrameId}, @localRecentInputCache=${mapIns._stringifyRecentInputCache(false)}, inputFrameIdConsecutive=${inputFrameIdConsecutive}, renderFrameIdConsecutive=${renderFrameIdConsecutive}`); + // The following order of execution is important + mapIns.onRoomDownsyncFrame(resp.rdf); + mapIns.onInputFrameDownsyncBatch(resp.inputFrameDownsyncBatch); break; default: break; diff --git a/frontend/assets/scripts/collision_test_nodejs.js b/frontend/assets/scripts/collision_test_nodejs.js deleted file mode 100644 index 43ccb40..0000000 --- a/frontend/assets/scripts/collision_test_nodejs.js +++ /dev/null @@ -1,39 +0,0 @@ -const collisions = require('./modules/Collisions'); - -const collisionSys = new collisions.Collisions(); - -/* -Backend result reference - -2022-10-22T12:11:25.156+0800 INFO collider_visualizer/worldColliderDisplay.go:77 Collided: player.X=1257.665, player.Y=1415.335, oldDx=-2.98, oldDy=-50, playerShape=&{[[0 0] [64 0] [64 64] [0 64]] 1254.685 1365.335 true}, toCheckBarrier=&{[[628.626 54.254500000000064] [0 56.03250000000003] [0.42449999999999477 1.1229999999999905] [625.9715000000001 0]] 1289.039 1318.0805 true}, pushbackX=-0.15848054013127655, pushbackY=-56.03205175509715, result=&{56.03227587710039 -0.0028283794946841584 -0.9999960001267175 false false [0.9988052279193613 -0.04886836073527201]} -*/ -function polygonStr(body) { - let coords = []; - let cnt = body._coords.length; - for (let ix = 0, iy = 1; ix < cnt; ix += 2, iy += 2) { - coords.push([body._coords[ix], body._coords[iy]]); - } - return JSON.stringify(coords); -} - -const playerCollider = collisionSys.createPolygon(1257.665, 1415.335, [[0, 0], [64, 0], [64, 64], [0, 64]]); -const barrierCollider = collisionSys.createPolygon(1289.039, 1318.0805, [[628.626, 54.254500000000064], [0, 56.03250000000003], [0.42449999999999477, 1.1229999999999905], [625.9715000000001, 0]]); - -const oldDx = -2.98; -const oldDy = -50.0; - -playerCollider.x += oldDx; -playerCollider.y += oldDy; - -collisionSys.update(); -const result = collisionSys.createResult(); - -const potentials = playerCollider.potentials(); - -let overlapCheckId = 0; -for (const barrier of potentials) { - if (!playerCollider.collides(barrier, result)) continue; - const pushbackX = result.overlap * result.overlap_x; - const pushbackY = result.overlap * result.overlap_y; - console.log("For overlapCheckId=" + overlapCheckId + ", the overlap: a=", polygonStr(result.a), ", b=", polygonStr(result.b), ", pushbackX=", pushbackX, ", pushbackY=", pushbackY); -} diff --git a/frontend/assets/scripts/collision_test_nodejs.js.meta b/frontend/assets/scripts/collision_test_nodejs.js.meta deleted file mode 100644 index a64f7e4..0000000 --- a/frontend/assets/scripts/collision_test_nodejs.js.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.0.5", - "uuid": "fce86138-76fc-44d5-8eac-2731b3b0cefd", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file diff --git a/frontend/assets/scripts/modules/protobuf-with-floating-num-decoding-endianess-toggle.js.meta b/frontend/assets/scripts/modules/protobuf-with-floating-num-decoding-endianess-toggle.js.meta index 1f79d7b..41c975d 100644 --- a/frontend/assets/scripts/modules/protobuf-with-floating-num-decoding-endianess-toggle.js.meta +++ b/frontend/assets/scripts/modules/protobuf-with-floating-num-decoding-endianess-toggle.js.meta @@ -1,6 +1,6 @@ { "ver": "1.0.5", - "uuid": "f9cd97f6-3533-4a27-afc8-cf302da003b2", + "uuid": "1ef4a156-5c54-45b9-85ac-86734985e13a", "isPlugin": false, "loadPluginInWeb": true, "loadPluginInNative": true, diff --git a/frontend/assets/scripts/modules/protobuf.js.map b/frontend/assets/scripts/modules/protobuf.js.map deleted file mode 100644 index d00d017..0000000 --- a/frontend/assets/scripts/modules/protobuf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/codegen/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/fetch/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/path/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/common.js","../src/converter.js","../src/decoder.js","../src/encoder.js","../src/enum.js","../src/field.js","../src/index-light.js","../src/index-minimal.js","../src/index","../src/mapfield.js","../src/message.js","../src/method.js","../src/namespace.js","../src/object.js","../src/oneof.js","../src/parse.js","../src/reader.js","../src/reader_buffer.js","../src/root.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/service.js","../src/tokenize.js","../src/type.js","../src/types.js","../src/util.js","../src/util/longbits.js","../src/util/minimal.js","../src/verifier.js","../src/wrappers.js","../src/writer.js","../src/writer_buffer.js"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3cA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"protobuf.js","sourcesContent":["(function prelude(modules, cache, entries) {\r\n\r\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\r\n // sources through a conflict-free require shim and is again wrapped within an iife that\r\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\r\n // so that minification can remove the directives of each module.\r\n\r\n function $require(name) {\r\n var $module = cache[name];\r\n if (!$module)\r\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\r\n return $module.exports;\r\n }\r\n\r\n var protobuf = $require(entries[0]);\r\n\r\n // Expose globally\r\n protobuf.util.global.protobuf = protobuf;\r\n\r\n // Be nice to AMD\r\n if (typeof define === \"function\" && define.amd)\r\n define([\"long\"], function(Long) {\r\n if (Long && Long.isLong) {\r\n protobuf.util.Long = Long;\r\n protobuf.configure();\r\n }\r\n return protobuf;\r\n });\r\n\r\n // Be nice to CommonJS\r\n if (typeof module === \"object\" && module && module.exports)\r\n module.exports = protobuf;\r\n\r\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(1),\r\n inquire = require(7);\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\r\nmodule.exports = common;\r\n\r\nvar commonRe = /\\/|\\./;\r\n\r\n/**\r\n * Provides common type definitions.\r\n * Can also be used to provide additional google types or your own custom types.\r\n * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name\r\n * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition\r\n * @returns {undefined}\r\n * @property {INamespace} google/protobuf/any.proto Any\r\n * @property {INamespace} google/protobuf/duration.proto Duration\r\n * @property {INamespace} google/protobuf/empty.proto Empty\r\n * @property {INamespace} google/protobuf/field_mask.proto FieldMask\r\n * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue\r\n * @property {INamespace} google/protobuf/timestamp.proto Timestamp\r\n * @property {INamespace} google/protobuf/wrappers.proto Wrappers\r\n * @example\r\n * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension)\r\n * protobuf.common(\"descriptor\", descriptorJson);\r\n *\r\n * // manually provides a custom definition (uses my.foo namespace)\r\n * protobuf.common(\"my/foo/bar.proto\", myFooBarJson);\r\n */\r\nfunction common(name, json) {\r\n if (!commonRe.test(name)) {\r\n name = \"google/protobuf/\" + name + \".proto\";\r\n json = { nested: { google: { nested: { protobuf: { nested: json } } } } };\r\n }\r\n common[name] = json;\r\n}\r\n\r\n// Not provided because of limited use (feel free to discuss or to provide yourself):\r\n//\r\n// google/protobuf/descriptor.proto\r\n// google/protobuf/source_context.proto\r\n// google/protobuf/type.proto\r\n//\r\n// Stripped and pre-parsed versions of these non-bundled files are instead available as part of\r\n// the repository or package within the google/protobuf directory.\r\n\r\ncommon(\"any\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.Any message.\r\n * @interface IAny\r\n * @type {Object}\r\n * @property {string} [typeUrl]\r\n * @property {Uint8Array} [bytes]\r\n * @memberof common\r\n */\r\n Any: {\r\n fields: {\r\n type_url: {\r\n type: \"string\",\r\n id: 1\r\n },\r\n value: {\r\n type: \"bytes\",\r\n id: 2\r\n }\r\n }\r\n }\r\n});\r\n\r\nvar timeType;\r\n\r\ncommon(\"duration\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.Duration message.\r\n * @interface IDuration\r\n * @type {Object}\r\n * @property {number|Long} [seconds]\r\n * @property {number} [nanos]\r\n * @memberof common\r\n */\r\n Duration: timeType = {\r\n fields: {\r\n seconds: {\r\n type: \"int64\",\r\n id: 1\r\n },\r\n nanos: {\r\n type: \"int32\",\r\n id: 2\r\n }\r\n }\r\n }\r\n});\r\n\r\ncommon(\"timestamp\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.Timestamp message.\r\n * @interface ITimestamp\r\n * @type {Object}\r\n * @property {number|Long} [seconds]\r\n * @property {number} [nanos]\r\n * @memberof common\r\n */\r\n Timestamp: timeType\r\n});\r\n\r\ncommon(\"empty\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.Empty message.\r\n * @interface IEmpty\r\n * @memberof common\r\n */\r\n Empty: {\r\n fields: {}\r\n }\r\n});\r\n\r\ncommon(\"struct\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.Struct message.\r\n * @interface IStruct\r\n * @type {Object}\r\n * @property {Object.} [fields]\r\n * @memberof common\r\n */\r\n Struct: {\r\n fields: {\r\n fields: {\r\n keyType: \"string\",\r\n type: \"Value\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.Value message.\r\n * @interface IValue\r\n * @type {Object}\r\n * @property {string} [kind]\r\n * @property {0} [nullValue]\r\n * @property {number} [numberValue]\r\n * @property {string} [stringValue]\r\n * @property {boolean} [boolValue]\r\n * @property {IStruct} [structValue]\r\n * @property {IListValue} [listValue]\r\n * @memberof common\r\n */\r\n Value: {\r\n oneofs: {\r\n kind: {\r\n oneof: [\r\n \"nullValue\",\r\n \"numberValue\",\r\n \"stringValue\",\r\n \"boolValue\",\r\n \"structValue\",\r\n \"listValue\"\r\n ]\r\n }\r\n },\r\n fields: {\r\n nullValue: {\r\n type: \"NullValue\",\r\n id: 1\r\n },\r\n numberValue: {\r\n type: \"double\",\r\n id: 2\r\n },\r\n stringValue: {\r\n type: \"string\",\r\n id: 3\r\n },\r\n boolValue: {\r\n type: \"bool\",\r\n id: 4\r\n },\r\n structValue: {\r\n type: \"Struct\",\r\n id: 5\r\n },\r\n listValue: {\r\n type: \"ListValue\",\r\n id: 6\r\n }\r\n }\r\n },\r\n\r\n NullValue: {\r\n values: {\r\n NULL_VALUE: 0\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.ListValue message.\r\n * @interface IListValue\r\n * @type {Object}\r\n * @property {Array.} [values]\r\n * @memberof common\r\n */\r\n ListValue: {\r\n fields: {\r\n values: {\r\n rule: \"repeated\",\r\n type: \"Value\",\r\n id: 1\r\n }\r\n }\r\n }\r\n});\r\n\r\ncommon(\"wrappers\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.DoubleValue message.\r\n * @interface IDoubleValue\r\n * @type {Object}\r\n * @property {number} [value]\r\n * @memberof common\r\n */\r\n DoubleValue: {\r\n fields: {\r\n value: {\r\n type: \"double\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.FloatValue message.\r\n * @interface IFloatValue\r\n * @type {Object}\r\n * @property {number} [value]\r\n * @memberof common\r\n */\r\n FloatValue: {\r\n fields: {\r\n value: {\r\n type: \"float\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.Int64Value message.\r\n * @interface IInt64Value\r\n * @type {Object}\r\n * @property {number|Long} [value]\r\n * @memberof common\r\n */\r\n Int64Value: {\r\n fields: {\r\n value: {\r\n type: \"int64\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.UInt64Value message.\r\n * @interface IUInt64Value\r\n * @type {Object}\r\n * @property {number|Long} [value]\r\n * @memberof common\r\n */\r\n UInt64Value: {\r\n fields: {\r\n value: {\r\n type: \"uint64\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.Int32Value message.\r\n * @interface IInt32Value\r\n * @type {Object}\r\n * @property {number} [value]\r\n * @memberof common\r\n */\r\n Int32Value: {\r\n fields: {\r\n value: {\r\n type: \"int32\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.UInt32Value message.\r\n * @interface IUInt32Value\r\n * @type {Object}\r\n * @property {number} [value]\r\n * @memberof common\r\n */\r\n UInt32Value: {\r\n fields: {\r\n value: {\r\n type: \"uint32\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.BoolValue message.\r\n * @interface IBoolValue\r\n * @type {Object}\r\n * @property {boolean} [value]\r\n * @memberof common\r\n */\r\n BoolValue: {\r\n fields: {\r\n value: {\r\n type: \"bool\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.StringValue message.\r\n * @interface IStringValue\r\n * @type {Object}\r\n * @property {string} [value]\r\n * @memberof common\r\n */\r\n StringValue: {\r\n fields: {\r\n value: {\r\n type: \"string\",\r\n id: 1\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Properties of a google.protobuf.BytesValue message.\r\n * @interface IBytesValue\r\n * @type {Object}\r\n * @property {Uint8Array} [value]\r\n * @memberof common\r\n */\r\n BytesValue: {\r\n fields: {\r\n value: {\r\n type: \"bytes\",\r\n id: 1\r\n }\r\n }\r\n }\r\n});\r\n\r\ncommon(\"field_mask\", {\r\n\r\n /**\r\n * Properties of a google.protobuf.FieldMask message.\r\n * @interface IDoubleValue\r\n * @type {Object}\r\n * @property {number} [value]\r\n * @memberof common\r\n */\r\n FieldMask: {\r\n fields: {\r\n paths: {\r\n rule: \"repeated\",\r\n type: \"string\",\r\n id: 1\r\n }\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * Gets the root definition of the specified common proto file.\r\n *\r\n * Bundled definitions are:\r\n * - google/protobuf/any.proto\r\n * - google/protobuf/duration.proto\r\n * - google/protobuf/empty.proto\r\n * - google/protobuf/field_mask.proto\r\n * - google/protobuf/struct.proto\r\n * - google/protobuf/timestamp.proto\r\n * - google/protobuf/wrappers.proto\r\n *\r\n * @param {string} file Proto file name\r\n * @returns {INamespace|null} Root definition or `null` if not defined\r\n */\r\ncommon.get = function get(file) {\r\n return common[file] || null;\r\n};\r\n","\"use strict\";\r\n/**\r\n * Runtime message from/to plain object converters.\r\n * @namespace\r\n */\r\nvar converter = exports;\r\n\r\nvar Enum = require(15),\r\n util = require(37);\r\n\r\n/**\r\n * Generates a partial value fromObject conveter.\r\n * @param {Codegen} gen Codegen instance\r\n * @param {Field} field Reflected field\r\n * @param {number} fieldIndex Field index\r\n * @param {string} prop Property reference\r\n * @returns {Codegen} Codegen instance\r\n * @ignore\r\n */\r\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\r\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n if (field.resolvedType) {\r\n if (field.resolvedType instanceof Enum) { gen\r\n (\"switch(d%s){\", prop);\r\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\r\n if (field.repeated && values[keys[i]] === field.typeDefault) gen\r\n (\"default:\");\r\n gen\r\n (\"case%j:\", keys[i])\r\n (\"case %i:\", values[keys[i]])\r\n (\"m%s=%j\", prop, values[keys[i]])\r\n (\"break\");\r\n } gen\r\n (\"}\");\r\n } else gen\r\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\r\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\r\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\r\n } else {\r\n var isUnsigned = false;\r\n switch (field.type) {\r\n case \"double\":\r\n case \"float\": gen\r\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\r\n break;\r\n case \"uint32\":\r\n case \"fixed32\": gen\r\n (\"m%s=d%s>>>0\", prop, prop);\r\n break;\r\n case \"int32\":\r\n case \"sint32\":\r\n case \"sfixed32\": gen\r\n (\"m%s=d%s|0\", prop, prop);\r\n break;\r\n case \"uint64\":\r\n isUnsigned = true;\r\n // eslint-disable-line no-fallthrough\r\n case \"int64\":\r\n case \"sint64\":\r\n case \"fixed64\":\r\n case \"sfixed64\": gen\r\n (\"if(util.Long)\")\r\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\r\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\r\n (\"m%s=parseInt(d%s,10)\", prop, prop)\r\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\r\n (\"m%s=d%s\", prop, prop)\r\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\r\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\r\n break;\r\n case \"bytes\": gen\r\n (\"if(typeof d%s===\\\"string\\\")\", prop)\r\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\r\n (\"else if(d%s.length)\", prop)\r\n (\"m%s=d%s\", prop, prop);\r\n break;\r\n case \"string\": gen\r\n (\"m%s=String(d%s)\", prop, prop);\r\n break;\r\n case \"bool\": gen\r\n (\"m%s=Boolean(d%s)\", prop, prop);\r\n break;\r\n /* default: gen\r\n (\"m%s=d%s\", prop, prop);\r\n break; */\r\n }\r\n }\r\n return gen;\r\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n}\r\n\r\n/**\r\n * Generates a plain object to runtime message converter specific to the specified message type.\r\n * @param {Type} mtype Message type\r\n * @returns {Codegen} Codegen instance\r\n */\r\nconverter.fromObject = function fromObject(mtype) {\r\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n var fields = mtype.fieldsArray;\r\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\r\n (\"if(d instanceof this.ctor)\")\r\n (\"return d\");\r\n if (!fields.length) return gen\r\n (\"return new this.ctor\");\r\n gen\r\n (\"var m=new this.ctor\");\r\n for (var i = 0; i < fields.length; ++i) {\r\n var field = fields[i].resolve(),\r\n prop = util.safeProp(field.name);\r\n\r\n // Map fields\r\n if (field.map) { gen\r\n (\"if(d%s){\", prop)\r\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\r\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\r\n (\"m%s={}\", prop)\r\n (\"for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\r\n break;\r\n case \"bytes\": gen\r\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\r\n break;\r\n default: gen\r\n (\"d%s=m%s\", prop, prop);\r\n break;\r\n }\r\n }\r\n return gen;\r\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n}\r\n\r\n/**\r\n * Generates a runtime message to plain object converter specific to the specified message type.\r\n * @param {Type} mtype Message type\r\n * @returns {Codegen} Codegen instance\r\n */\r\nconverter.toObject = function toObject(mtype) {\r\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\r\n if (!fields.length)\r\n return util.codegen()(\"return {}\");\r\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\r\n (\"if(!o)\")\r\n (\"o={}\")\r\n (\"var d={}\");\r\n\r\n var repeatedFields = [],\r\n mapFields = [],\r\n normalFields = [],\r\n i = 0;\r\n for (; i < fields.length; ++i)\r\n if (!fields[i].partOf)\r\n ( fields[i].resolve().repeated ? repeatedFields\r\n : fields[i].map ? mapFields\r\n : normalFields).push(fields[i]);\r\n\r\n if (repeatedFields.length) { gen\r\n (\"if(o.arrays||o.defaults){\");\r\n for (i = 0; i < repeatedFields.length; ++i) gen\r\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\r\n gen\r\n (\"}\");\r\n }\r\n\r\n if (mapFields.length) { gen\r\n (\"if(o.objects||o.defaults){\");\r\n for (i = 0; i < mapFields.length; ++i) gen\r\n (\"d%s={}\", util.safeProp(mapFields[i].name));\r\n gen\r\n (\"}\");\r\n }\r\n\r\n if (normalFields.length) { gen\r\n (\"if(o.defaults){\");\r\n for (i = 0; i < normalFields.length; ++i) {\r\n var field = normalFields[i],\r\n prop = util.safeProp(field.name);\r\n if (field.resolvedType instanceof Enum) gen\r\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\r\n else if (field.long) gen\r\n (\"if(util.Long){\")\r\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\r\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\r\n (\"}else\")\r\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\r\n else if (field.bytes) {\r\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\r\n gen\r\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\r\n (\"else{\")\r\n (\"d%s=%s\", prop, arrayDefault)\r\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\r\n (\"}\");\r\n } else gen\r\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\r\n } gen\r\n (\"}\");\r\n }\r\n var hasKs2 = false;\r\n for (i = 0; i < fields.length; ++i) {\r\n var field = fields[i],\r\n index = mtype._fieldsArray.indexOf(field),\r\n prop = util.safeProp(field.name);\r\n if (field.map) {\r\n if (!hasKs2) { hasKs2 = true; gen\r\n (\"var ks2\");\r\n } gen\r\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\r\n (\"d%s={}\", prop)\r\n (\"for(var j=0;j>>3){\");\r\n\r\n var i = 0;\r\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\r\n var field = mtype._fieldsArray[i].resolve(),\r\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\r\n ref = \"m\" + util.safeProp(field.name); gen\r\n (\"case %i:\", field.id);\r\n\r\n // Map fields\r\n if (field.map) { gen\r\n (\"r.skip().pos++\") // assumes id 1 + key wireType\r\n (\"if(%s===util.emptyObject)\", ref)\r\n (\"%s={}\", ref)\r\n (\"k=r.%s()\", field.keyType)\r\n (\"r.pos++\"); // assumes id 2 + value wireType\r\n if (types.long[field.keyType] !== undefined) {\r\n if (types.basic[type] === undefined) gen\r\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())\", ref, i); // can't be groups\r\n else gen\r\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=r.%s()\", ref, type);\r\n } else {\r\n if (types.basic[type] === undefined) gen\r\n (\"%s[k]=types[%i].decode(r,r.uint32())\", ref, i); // can't be groups\r\n else gen\r\n (\"%s[k]=r.%s()\", ref, type);\r\n }\r\n\r\n // Repeated fields\r\n } else if (field.repeated) { gen\r\n\r\n (\"if(!(%s&&%s.length))\", ref, ref)\r\n (\"%s=[]\", ref);\r\n\r\n // Packable (always check for forward and backward compatiblity)\r\n if (types.packed[type] !== undefined) gen\r\n (\"if((t&7)===2){\")\r\n (\"var c2=r.uint32()+r.pos\")\r\n (\"while(r.pos>> 0, (field.id << 3 | 4) >>> 0)\r\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\r\n}\r\n\r\n/**\r\n * Generates an encoder specific to the specified message type.\r\n * @param {Type} mtype Message type\r\n * @returns {Codegen} Codegen instance\r\n */\r\nfunction encoder(mtype) {\r\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\r\n (\"if(!w)\")\r\n (\"w=Writer.create()\");\r\n\r\n var i, ref;\r\n\r\n // \"when a message is serialized its known fields should be written sequentially by field number\"\r\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\r\n\r\n for (var i = 0; i < fields.length; ++i) {\r\n var field = fields[i].resolve(),\r\n index = mtype._fieldsArray.indexOf(field),\r\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\r\n wireType = types.basic[type];\r\n ref = \"m\" + util.safeProp(field.name);\r\n\r\n // Map fields\r\n if (field.map) {\r\n gen\r\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name) // !== undefined && !== null\r\n (\"for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType);\r\n if (wireType === undefined) gen\r\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\r\n else gen\r\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\r\n gen\r\n (\"}\")\r\n (\"}\");\r\n\r\n // Repeated fields\r\n } else if (field.repeated) { gen\r\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\r\n\r\n // Packed repeated\r\n if (field.packed && types.packed[type] !== undefined) { gen\r\n\r\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\r\n (\"for(var i=0;i<%s.length;++i)\", ref)\r\n (\"w.%s(%s[i])\", type, ref)\r\n (\"w.ldelim()\");\r\n\r\n // Non-packed\r\n } else { gen\r\n\r\n (\"for(var i=0;i<%s.length;++i)\", ref);\r\n if (wireType === undefined)\r\n genTypePartial(gen, field, index, ref + \"[i]\");\r\n else gen\r\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\r\n\r\n } gen\r\n (\"}\");\r\n\r\n // Non-repeated\r\n } else {\r\n if (field.optional) gen\r\n (\"if(%s!=null&&m.hasOwnProperty(%j))\", ref, field.name); // !== undefined && !== null\r\n\r\n if (wireType === undefined)\r\n genTypePartial(gen, field, index, ref);\r\n else gen\r\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\r\n\r\n }\r\n }\r\n\r\n return gen\r\n (\"return w\");\r\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\r\n}","\"use strict\";\r\nmodule.exports = Enum;\r\n\r\n// extends ReflectionObject\r\nvar ReflectionObject = require(24);\r\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\r\n\r\nvar Namespace = require(23),\r\n util = require(37);\r\n\r\n/**\r\n * Constructs a new enum instance.\r\n * @classdesc Reflected enum.\r\n * @extends ReflectionObject\r\n * @constructor\r\n * @param {string} name Unique name within its namespace\r\n * @param {Object.} [values] Enum values as an object, by name\r\n * @param {Object.} [options] Declared options\r\n * @param {string} [comment] The comment for this enum\r\n * @param {Object.} [comments] The value comments for this enum\r\n */\r\nfunction Enum(name, values, options, comment, comments) {\r\n ReflectionObject.call(this, name, options);\r\n\r\n if (values && typeof values !== \"object\")\r\n throw TypeError(\"values must be an object\");\r\n\r\n /**\r\n * Enum values by id.\r\n * @type {Object.}\r\n */\r\n this.valuesById = {};\r\n\r\n /**\r\n * Enum values by name.\r\n * @type {Object.}\r\n */\r\n this.values = Object.create(this.valuesById); // toJSON, marker\r\n\r\n /**\r\n * Enum comment text.\r\n * @type {string|null}\r\n */\r\n this.comment = comment;\r\n\r\n /**\r\n * Value comment texts, if any.\r\n * @type {Object.}\r\n */\r\n this.comments = comments || {};\r\n\r\n /**\r\n * Reserved ranges, if any.\r\n * @type {Array.}\r\n */\r\n this.reserved = undefined; // toJSON\r\n\r\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\r\n // compatible enum. This is used by pbts to write actual enum definitions that work for\r\n // static and reflection code alike instead of emitting generic object definitions.\r\n\r\n if (values)\r\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\r\n if (typeof values[keys[i]] === \"number\") // use forward entries only\r\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\r\n}\r\n\r\n/**\r\n * Enum descriptor.\r\n * @interface IEnum\r\n * @property {Object.} values Enum values\r\n * @property {Object.} [options] Enum options\r\n */\r\n\r\n/**\r\n * Constructs an enum from an enum descriptor.\r\n * @param {string} name Enum name\r\n * @param {IEnum} json Enum descriptor\r\n * @returns {Enum} Created enum\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nEnum.fromJSON = function fromJSON(name, json) {\r\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\r\n enm.reserved = json.reserved;\r\n return enm;\r\n};\r\n\r\n/**\r\n * Converts this enum to an enum descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IEnum} Enum descriptor\r\n */\r\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"options\" , this.options,\r\n \"values\" , this.values,\r\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\r\n \"comment\" , keepComments ? this.comment : undefined,\r\n \"comments\" , keepComments ? this.comments : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * Adds a value to this enum.\r\n * @param {string} name Value name\r\n * @param {number} id Value id\r\n * @param {string} [comment] Comment, if any\r\n * @returns {Enum} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If there is already a value with this name or id\r\n */\r\nEnum.prototype.add = function add(name, id, comment) {\r\n // utilized by the parser but not by .fromJSON\r\n\r\n if (!util.isString(name))\r\n throw TypeError(\"name must be a string\");\r\n\r\n if (!util.isInteger(id))\r\n throw TypeError(\"id must be an integer\");\r\n\r\n if (this.values[name] !== undefined)\r\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\r\n\r\n if (this.isReservedId(id))\r\n throw Error(\"id \" + id + \" is reserved in \" + this);\r\n\r\n if (this.isReservedName(name))\r\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\r\n\r\n if (this.valuesById[id] !== undefined) {\r\n if (!(this.options && this.options.allow_alias))\r\n throw Error(\"duplicate id \" + id + \" in \" + this);\r\n this.values[name] = id;\r\n } else\r\n this.valuesById[this.values[name] = id] = name;\r\n\r\n this.comments[name] = comment || null;\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes a value from this enum\r\n * @param {string} name Value name\r\n * @returns {Enum} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If `name` is not a name of this enum\r\n */\r\nEnum.prototype.remove = function remove(name) {\r\n\r\n if (!util.isString(name))\r\n throw TypeError(\"name must be a string\");\r\n\r\n var val = this.values[name];\r\n if (val == null)\r\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\r\n\r\n delete this.valuesById[val];\r\n delete this.values[name];\r\n delete this.comments[name];\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Tests if the specified id is reserved.\r\n * @param {number} id Id to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nEnum.prototype.isReservedId = function isReservedId(id) {\r\n return Namespace.isReservedId(this.reserved, id);\r\n};\r\n\r\n/**\r\n * Tests if the specified name is reserved.\r\n * @param {string} name Name to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nEnum.prototype.isReservedName = function isReservedName(name) {\r\n return Namespace.isReservedName(this.reserved, name);\r\n};\r\n","\"use strict\";\r\nmodule.exports = Field;\r\n\r\n// extends ReflectionObject\r\nvar ReflectionObject = require(24);\r\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\r\n\r\nvar Enum = require(15),\r\n types = require(36),\r\n util = require(37);\r\n\r\nvar Type; // cyclic\r\n\r\nvar ruleRe = /^required|optional|repeated$/;\r\n\r\n/**\r\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\r\n * @name Field\r\n * @classdesc Reflected message field.\r\n * @extends FieldBase\r\n * @constructor\r\n * @param {string} name Unique name within its namespace\r\n * @param {number} id Unique id within its namespace\r\n * @param {string} type Value type\r\n * @param {string|Object.} [rule=\"optional\"] Field rule\r\n * @param {string|Object.} [extend] Extended type if different from parent\r\n * @param {Object.} [options] Declared options\r\n */\r\n\r\n/**\r\n * Constructs a field from a field descriptor.\r\n * @param {string} name Field name\r\n * @param {IField} json Field descriptor\r\n * @returns {Field} Created field\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nField.fromJSON = function fromJSON(name, json) {\r\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\r\n};\r\n\r\n/**\r\n * Not an actual constructor. Use {@link Field} instead.\r\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\r\n * @exports FieldBase\r\n * @extends ReflectionObject\r\n * @constructor\r\n * @param {string} name Unique name within its namespace\r\n * @param {number} id Unique id within its namespace\r\n * @param {string} type Value type\r\n * @param {string|Object.} [rule=\"optional\"] Field rule\r\n * @param {string|Object.} [extend] Extended type if different from parent\r\n * @param {Object.} [options] Declared options\r\n * @param {string} [comment] Comment associated with this field\r\n */\r\nfunction Field(name, id, type, rule, extend, options, comment) {\r\n\r\n if (util.isObject(rule)) {\r\n comment = extend;\r\n options = rule;\r\n rule = extend = undefined;\r\n } else if (util.isObject(extend)) {\r\n comment = options;\r\n options = extend;\r\n extend = undefined;\r\n }\r\n\r\n ReflectionObject.call(this, name, options);\r\n\r\n if (!util.isInteger(id) || id < 0)\r\n throw TypeError(\"id must be a non-negative integer\");\r\n\r\n if (!util.isString(type))\r\n throw TypeError(\"type must be a string\");\r\n\r\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\r\n throw TypeError(\"rule must be a string rule\");\r\n\r\n if (extend !== undefined && !util.isString(extend))\r\n throw TypeError(\"extend must be a string\");\r\n\r\n /**\r\n * Field rule, if any.\r\n * @type {string|undefined}\r\n */\r\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\r\n\r\n /**\r\n * Field type.\r\n * @type {string}\r\n */\r\n this.type = type; // toJSON\r\n\r\n /**\r\n * Unique field id.\r\n * @type {number}\r\n */\r\n this.id = id; // toJSON, marker\r\n\r\n /**\r\n * Extended type if different from parent.\r\n * @type {string|undefined}\r\n */\r\n this.extend = extend || undefined; // toJSON\r\n\r\n /**\r\n * Whether this field is required.\r\n * @type {boolean}\r\n */\r\n this.required = rule === \"required\";\r\n\r\n /**\r\n * Whether this field is optional.\r\n * @type {boolean}\r\n */\r\n this.optional = !this.required;\r\n\r\n /**\r\n * Whether this field is repeated.\r\n * @type {boolean}\r\n */\r\n this.repeated = rule === \"repeated\";\r\n\r\n /**\r\n * Whether this field is a map or not.\r\n * @type {boolean}\r\n */\r\n this.map = false;\r\n\r\n /**\r\n * Message this field belongs to.\r\n * @type {Type|null}\r\n */\r\n this.message = null;\r\n\r\n /**\r\n * OneOf this field belongs to, if any,\r\n * @type {OneOf|null}\r\n */\r\n this.partOf = null;\r\n\r\n /**\r\n * The field type's default value.\r\n * @type {*}\r\n */\r\n this.typeDefault = null;\r\n\r\n /**\r\n * The field's default value on prototypes.\r\n * @type {*}\r\n */\r\n this.defaultValue = null;\r\n\r\n /**\r\n * Whether this field's value should be treated as a long.\r\n * @type {boolean}\r\n */\r\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\r\n\r\n /**\r\n * Whether this field's value is a buffer.\r\n * @type {boolean}\r\n */\r\n this.bytes = type === \"bytes\";\r\n\r\n /**\r\n * Resolved type if not a basic type.\r\n * @type {Type|Enum|null}\r\n */\r\n this.resolvedType = null;\r\n\r\n /**\r\n * Sister-field within the extended type if a declaring extension field.\r\n * @type {Field|null}\r\n */\r\n this.extensionField = null;\r\n\r\n /**\r\n * Sister-field within the declaring namespace if an extended field.\r\n * @type {Field|null}\r\n */\r\n this.declaringField = null;\r\n\r\n /**\r\n * Internally remembers whether this field is packed.\r\n * @type {boolean|null}\r\n * @private\r\n */\r\n this._packed = null;\r\n\r\n /**\r\n * Comment for this field.\r\n * @type {string|null}\r\n */\r\n this.comment = comment;\r\n}\r\n\r\n/**\r\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\r\n * @name Field#packed\r\n * @type {boolean}\r\n * @readonly\r\n */\r\nObject.defineProperty(Field.prototype, \"packed\", {\r\n get: function() {\r\n // defaults to packed=true if not explicity set to false\r\n if (this._packed === null)\r\n this._packed = this.getOption(\"packed\") !== false;\r\n return this._packed;\r\n }\r\n});\r\n\r\n/**\r\n * @override\r\n */\r\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\r\n if (name === \"packed\") // clear cached before setting\r\n this._packed = null;\r\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\r\n};\r\n\r\n/**\r\n * Field descriptor.\r\n * @interface IField\r\n * @property {string} [rule=\"optional\"] Field rule\r\n * @property {string} type Field type\r\n * @property {number} id Field id\r\n * @property {Object.} [options] Field options\r\n */\r\n\r\n/**\r\n * Extension field descriptor.\r\n * @interface IExtensionField\r\n * @extends IField\r\n * @property {string} extend Extended type\r\n */\r\n\r\n/**\r\n * Converts this field to a field descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IField} Field descriptor\r\n */\r\nField.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\r\n \"type\" , this.type,\r\n \"id\" , this.id,\r\n \"extend\" , this.extend,\r\n \"options\" , this.options,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * Resolves this field's type references.\r\n * @returns {Field} `this`\r\n * @throws {Error} If any reference cannot be resolved\r\n */\r\nField.prototype.resolve = function resolve() {\r\n\r\n if (this.resolved)\r\n return this;\r\n\r\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\r\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\r\n if (this.resolvedType instanceof Type)\r\n this.typeDefault = null;\r\n else // instanceof Enum\r\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\r\n }\r\n\r\n // use explicitly set default value if present\r\n if (this.options && this.options[\"default\"] != null) {\r\n this.typeDefault = this.options[\"default\"];\r\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\r\n this.typeDefault = this.resolvedType.values[this.typeDefault];\r\n }\r\n\r\n // remove unnecessary options\r\n if (this.options) {\r\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\r\n delete this.options.packed;\r\n if (!Object.keys(this.options).length)\r\n this.options = undefined;\r\n }\r\n\r\n // convert to internal data type if necesssary\r\n if (this.long) {\r\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\r\n\r\n /* istanbul ignore else */\r\n if (Object.freeze)\r\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\r\n\r\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\r\n var buf;\r\n if (util.base64.test(this.typeDefault))\r\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\r\n else\r\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\r\n this.typeDefault = buf;\r\n }\r\n\r\n // take special care of maps and repeated fields\r\n if (this.map)\r\n this.defaultValue = util.emptyObject;\r\n else if (this.repeated)\r\n this.defaultValue = util.emptyArray;\r\n else\r\n this.defaultValue = this.typeDefault;\r\n\r\n // ensure proper value on prototype\r\n if (this.parent instanceof Type)\r\n this.parent.ctor.prototype[this.name] = this.defaultValue;\r\n\r\n return ReflectionObject.prototype.resolve.call(this);\r\n};\r\n\r\n/**\r\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\r\n * @typedef FieldDecorator\r\n * @type {function}\r\n * @param {Object} prototype Target prototype\r\n * @param {string} fieldName Field name\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Field decorator (TypeScript).\r\n * @name Field.d\r\n * @function\r\n * @param {number} fieldId Field id\r\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\r\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\r\n * @param {T} [defaultValue] Default value\r\n * @returns {FieldDecorator} Decorator function\r\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\r\n */\r\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\r\n\r\n // submessage: decorate the submessage and use its name as the type\r\n if (typeof fieldType === \"function\")\r\n fieldType = util.decorateType(fieldType).name;\r\n\r\n // enum reference: create a reflected copy of the enum and keep reuseing it\r\n else if (fieldType && typeof fieldType === \"object\")\r\n fieldType = util.decorateEnum(fieldType).name;\r\n\r\n return function fieldDecorator(prototype, fieldName) {\r\n util.decorateType(prototype.constructor)\r\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\r\n };\r\n};\r\n\r\n/**\r\n * Field decorator (TypeScript).\r\n * @name Field.d\r\n * @function\r\n * @param {number} fieldId Field id\r\n * @param {Constructor|string} fieldType Field type\r\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\r\n * @returns {FieldDecorator} Decorator function\r\n * @template T extends Message\r\n * @variation 2\r\n */\r\n// like Field.d but without a default value\r\n\r\n// Sets up cyclic dependencies (called in index-light)\r\nField._configure = function configure(Type_) {\r\n Type = Type_;\r\n};\r\n","\"use strict\";\r\nvar protobuf = module.exports = require(18);\r\n\r\nprotobuf.build = \"light\";\r\n\r\n/**\r\n * A node-style callback as used by {@link load} and {@link Root#load}.\r\n * @typedef LoadCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any, otherwise `null`\r\n * @param {Root} [root] Root, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\r\n * @param {string|string[]} filename One or multiple files to load\r\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\r\n * @param {LoadCallback} callback Callback function\r\n * @returns {undefined}\r\n * @see {@link Root#load}\r\n */\r\nfunction load(filename, root, callback) {\r\n if (typeof root === \"function\") {\r\n callback = root;\r\n root = new protobuf.Root();\r\n } else if (!root)\r\n root = new protobuf.Root();\r\n return root.load(filename, callback);\r\n}\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\r\n * @name load\r\n * @function\r\n * @param {string|string[]} filename One or multiple files to load\r\n * @param {LoadCallback} callback Callback function\r\n * @returns {undefined}\r\n * @see {@link Root#load}\r\n * @variation 2\r\n */\r\n// function load(filename:string, callback:LoadCallback):undefined\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\r\n * @name load\r\n * @function\r\n * @param {string|string[]} filename One or multiple files to load\r\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\r\n * @returns {Promise} Promise\r\n * @see {@link Root#load}\r\n * @variation 3\r\n */\r\n// function load(filename:string, [root:Root]):Promise\r\n\r\nprotobuf.load = load;\r\n\r\n/**\r\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\r\n * @param {string|string[]} filename One or multiple files to load\r\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\r\n * @returns {Root} Root namespace\r\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\r\n * @see {@link Root#loadSync}\r\n */\r\nfunction loadSync(filename, root) {\r\n if (!root)\r\n root = new protobuf.Root();\r\n return root.loadSync(filename);\r\n}\r\n\r\nprotobuf.loadSync = loadSync;\r\n\r\n// Serialization\r\nprotobuf.encoder = require(14);\r\nprotobuf.decoder = require(13);\r\nprotobuf.verifier = require(40);\r\nprotobuf.converter = require(12);\r\n\r\n// Reflection\r\nprotobuf.ReflectionObject = require(24);\r\nprotobuf.Namespace = require(23);\r\nprotobuf.Root = require(29);\r\nprotobuf.Enum = require(15);\r\nprotobuf.Type = require(35);\r\nprotobuf.Field = require(16);\r\nprotobuf.OneOf = require(25);\r\nprotobuf.MapField = require(20);\r\nprotobuf.Service = require(33);\r\nprotobuf.Method = require(22);\r\n\r\n// Runtime\r\nprotobuf.Message = require(21);\r\nprotobuf.wrappers = require(41);\r\n\r\n// Utility\r\nprotobuf.types = require(36);\r\nprotobuf.util = require(37);\r\n\r\n// Set up possibly cyclic reflection dependencies\r\nprotobuf.ReflectionObject._configure(protobuf.Root);\r\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\r\nprotobuf.Root._configure(protobuf.Type);\r\nprotobuf.Field._configure(protobuf.Type);\r\n","\"use strict\";\r\nvar protobuf = exports;\r\n\r\n/**\r\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\r\n * @name build\r\n * @type {string}\r\n * @const\r\n */\r\nprotobuf.build = \"minimal\";\r\n\r\n// Serialization\r\nprotobuf.Writer = require(42);\r\nprotobuf.BufferWriter = require(43);\r\nprotobuf.Reader = require(27);\r\nprotobuf.BufferReader = require(28);\r\n\r\n// Utility\r\nprotobuf.util = require(39);\r\nprotobuf.rpc = require(31);\r\nprotobuf.roots = require(30);\r\nprotobuf.configure = configure;\r\n\r\n/* istanbul ignore next */\r\n/**\r\n * Reconfigures the library according to the environment.\r\n * @returns {undefined}\r\n */\r\nfunction configure() {\r\n protobuf.Reader._configure(protobuf.BufferReader);\r\n protobuf.util._configure();\r\n}\r\n\r\n// Set up buffer utility according to the environment\r\nprotobuf.Writer._configure(protobuf.BufferWriter);\r\nconfigure();\r\n","\"use strict\";\r\nvar protobuf = module.exports = require(17);\r\n\r\nprotobuf.build = \"full\";\r\n\r\n// Parser\r\nprotobuf.tokenize = require(34);\r\nprotobuf.parse = require(26);\r\nprotobuf.common = require(11);\r\n\r\n// Configure parser\r\nprotobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);\r\n","\"use strict\";\r\nmodule.exports = MapField;\r\n\r\n// extends Field\r\nvar Field = require(16);\r\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\r\n\r\nvar types = require(36),\r\n util = require(37);\r\n\r\n/**\r\n * Constructs a new map field instance.\r\n * @classdesc Reflected map field.\r\n * @extends FieldBase\r\n * @constructor\r\n * @param {string} name Unique name within its namespace\r\n * @param {number} id Unique id within its namespace\r\n * @param {string} keyType Key type\r\n * @param {string} type Value type\r\n * @param {Object.} [options] Declared options\r\n * @param {string} [comment] Comment associated with this field\r\n */\r\nfunction MapField(name, id, keyType, type, options, comment) {\r\n Field.call(this, name, id, type, undefined, undefined, options, comment);\r\n\r\n /* istanbul ignore if */\r\n if (!util.isString(keyType))\r\n throw TypeError(\"keyType must be a string\");\r\n\r\n /**\r\n * Key type.\r\n * @type {string}\r\n */\r\n this.keyType = keyType; // toJSON, marker\r\n\r\n /**\r\n * Resolved key type if not a basic type.\r\n * @type {ReflectionObject|null}\r\n */\r\n this.resolvedKeyType = null;\r\n\r\n // Overrides Field#map\r\n this.map = true;\r\n}\r\n\r\n/**\r\n * Map field descriptor.\r\n * @interface IMapField\r\n * @extends {IField}\r\n * @property {string} keyType Key type\r\n */\r\n\r\n/**\r\n * Extension map field descriptor.\r\n * @interface IExtensionMapField\r\n * @extends IMapField\r\n * @property {string} extend Extended type\r\n */\r\n\r\n/**\r\n * Constructs a map field from a map field descriptor.\r\n * @param {string} name Field name\r\n * @param {IMapField} json Map field descriptor\r\n * @returns {MapField} Created map field\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nMapField.fromJSON = function fromJSON(name, json) {\r\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\r\n};\r\n\r\n/**\r\n * Converts this map field to a map field descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IMapField} Map field descriptor\r\n */\r\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"keyType\" , this.keyType,\r\n \"type\" , this.type,\r\n \"id\" , this.id,\r\n \"extend\" , this.extend,\r\n \"options\" , this.options,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nMapField.prototype.resolve = function resolve() {\r\n if (this.resolved)\r\n return this;\r\n\r\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\r\n if (types.mapKey[this.keyType] === undefined)\r\n throw Error(\"invalid key type: \" + this.keyType);\r\n\r\n return Field.prototype.resolve.call(this);\r\n};\r\n\r\n/**\r\n * Map field decorator (TypeScript).\r\n * @name MapField.d\r\n * @function\r\n * @param {number} fieldId Field id\r\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\r\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\r\n * @returns {FieldDecorator} Decorator function\r\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\r\n */\r\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\r\n\r\n // submessage value: decorate the submessage and use its name as the type\r\n if (typeof fieldValueType === \"function\")\r\n fieldValueType = util.decorateType(fieldValueType).name;\r\n\r\n // enum reference value: create a reflected copy of the enum and keep reuseing it\r\n else if (fieldValueType && typeof fieldValueType === \"object\")\r\n fieldValueType = util.decorateEnum(fieldValueType).name;\r\n\r\n return function mapFieldDecorator(prototype, fieldName) {\r\n util.decorateType(prototype.constructor)\r\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\r\n };\r\n};\r\n","\"use strict\";\r\nmodule.exports = Message;\r\n\r\nvar util = require(39);\r\n\r\n/**\r\n * Constructs a new message instance.\r\n * @classdesc Abstract runtime message.\r\n * @constructor\r\n * @param {Properties} [properties] Properties to set\r\n * @template T extends object = object\r\n */\r\nfunction Message(properties) {\r\n // not used internally\r\n if (properties)\r\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\r\n this[keys[i]] = properties[keys[i]];\r\n}\r\n\r\n/**\r\n * Reference to the reflected type.\r\n * @name Message.$type\r\n * @type {Type}\r\n * @readonly\r\n */\r\n\r\n/**\r\n * Reference to the reflected type.\r\n * @name Message#$type\r\n * @type {Type}\r\n * @readonly\r\n */\r\n\r\n/*eslint-disable valid-jsdoc*/\r\n\r\n/**\r\n * Creates a new message of this type using the specified properties.\r\n * @param {Object.} [properties] Properties to set\r\n * @returns {Message} Message instance\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.create = function create(properties) {\r\n return this.$type.create(properties);\r\n};\r\n\r\n/**\r\n * Encodes a message of this type.\r\n * @param {T|Object.} message Message to encode\r\n * @param {Writer} [writer] Writer to use\r\n * @returns {Writer} Writer\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.encode = function encode(message, writer) {\r\n return this.$type.encode(message, writer);\r\n};\r\n\r\n/**\r\n * Encodes a message of this type preceeded by its length as a varint.\r\n * @param {T|Object.} message Message to encode\r\n * @param {Writer} [writer] Writer to use\r\n * @returns {Writer} Writer\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\r\n return this.$type.encodeDelimited(message, writer);\r\n};\r\n\r\n/**\r\n * Decodes a message of this type.\r\n * @name Message.decode\r\n * @function\r\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\r\n * @returns {T} Decoded message\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.decode = function decode(reader) {\r\n return this.$type.decode(reader);\r\n};\r\n\r\n/**\r\n * Decodes a message of this type preceeded by its length as a varint.\r\n * @name Message.decodeDelimited\r\n * @function\r\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\r\n * @returns {T} Decoded message\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.decodeDelimited = function decodeDelimited(reader) {\r\n return this.$type.decodeDelimited(reader);\r\n};\r\n\r\n/**\r\n * Verifies a message of this type.\r\n * @name Message.verify\r\n * @function\r\n * @param {Object.} message Plain object to verify\r\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\r\n */\r\nMessage.verify = function verify(message) {\r\n return this.$type.verify(message);\r\n};\r\n\r\n/**\r\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\r\n * @param {Object.} object Plain object\r\n * @returns {T} Message instance\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.fromObject = function fromObject(object) {\r\n return this.$type.fromObject(object);\r\n};\r\n\r\n/**\r\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\r\n * @param {T} message Message instance\r\n * @param {IConversionOptions} [options] Conversion options\r\n * @returns {Object.} Plain object\r\n * @template T extends Message\r\n * @this Constructor\r\n */\r\nMessage.toObject = function toObject(message, options) {\r\n return this.$type.toObject(message, options);\r\n};\r\n\r\n/**\r\n * Converts this message to JSON.\r\n * @returns {Object.} JSON object\r\n */\r\nMessage.prototype.toJSON = function toJSON() {\r\n return this.$type.toObject(this, util.toJSONOptions);\r\n};\r\n\r\n/*eslint-enable valid-jsdoc*/","\"use strict\";\r\nmodule.exports = Method;\r\n\r\n// extends ReflectionObject\r\nvar ReflectionObject = require(24);\r\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\r\n\r\nvar util = require(37);\r\n\r\n/**\r\n * Constructs a new service method instance.\r\n * @classdesc Reflected service method.\r\n * @extends ReflectionObject\r\n * @constructor\r\n * @param {string} name Method name\r\n * @param {string|undefined} type Method type, usually `\"rpc\"`\r\n * @param {string} requestType Request message type\r\n * @param {string} responseType Response message type\r\n * @param {boolean|Object.} [requestStream] Whether the request is streamed\r\n * @param {boolean|Object.} [responseStream] Whether the response is streamed\r\n * @param {Object.} [options] Declared options\r\n * @param {string} [comment] The comment for this method\r\n */\r\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\r\n\r\n /* istanbul ignore next */\r\n if (util.isObject(requestStream)) {\r\n options = requestStream;\r\n requestStream = responseStream = undefined;\r\n } else if (util.isObject(responseStream)) {\r\n options = responseStream;\r\n responseStream = undefined;\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (!(type === undefined || util.isString(type)))\r\n throw TypeError(\"type must be a string\");\r\n\r\n /* istanbul ignore if */\r\n if (!util.isString(requestType))\r\n throw TypeError(\"requestType must be a string\");\r\n\r\n /* istanbul ignore if */\r\n if (!util.isString(responseType))\r\n throw TypeError(\"responseType must be a string\");\r\n\r\n ReflectionObject.call(this, name, options);\r\n\r\n /**\r\n * Method type.\r\n * @type {string}\r\n */\r\n this.type = type || \"rpc\"; // toJSON\r\n\r\n /**\r\n * Request type.\r\n * @type {string}\r\n */\r\n this.requestType = requestType; // toJSON, marker\r\n\r\n /**\r\n * Whether requests are streamed or not.\r\n * @type {boolean|undefined}\r\n */\r\n this.requestStream = requestStream ? true : undefined; // toJSON\r\n\r\n /**\r\n * Response type.\r\n * @type {string}\r\n */\r\n this.responseType = responseType; // toJSON\r\n\r\n /**\r\n * Whether responses are streamed or not.\r\n * @type {boolean|undefined}\r\n */\r\n this.responseStream = responseStream ? true : undefined; // toJSON\r\n\r\n /**\r\n * Resolved request type.\r\n * @type {Type|null}\r\n */\r\n this.resolvedRequestType = null;\r\n\r\n /**\r\n * Resolved response type.\r\n * @type {Type|null}\r\n */\r\n this.resolvedResponseType = null;\r\n\r\n /**\r\n * Comment for this method\r\n * @type {string|null}\r\n */\r\n this.comment = comment;\r\n}\r\n\r\n/**\r\n * Method descriptor.\r\n * @interface IMethod\r\n * @property {string} [type=\"rpc\"] Method type\r\n * @property {string} requestType Request type\r\n * @property {string} responseType Response type\r\n * @property {boolean} [requestStream=false] Whether requests are streamed\r\n * @property {boolean} [responseStream=false] Whether responses are streamed\r\n * @property {Object.} [options] Method options\r\n */\r\n\r\n/**\r\n * Constructs a method from a method descriptor.\r\n * @param {string} name Method name\r\n * @param {IMethod} json Method descriptor\r\n * @returns {Method} Created method\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nMethod.fromJSON = function fromJSON(name, json) {\r\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\r\n};\r\n\r\n/**\r\n * Converts this method to a method descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IMethod} Method descriptor\r\n */\r\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\r\n \"requestType\" , this.requestType,\r\n \"requestStream\" , this.requestStream,\r\n \"responseType\" , this.responseType,\r\n \"responseStream\" , this.responseStream,\r\n \"options\" , this.options,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nMethod.prototype.resolve = function resolve() {\r\n\r\n /* istanbul ignore if */\r\n if (this.resolved)\r\n return this;\r\n\r\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\r\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\r\n\r\n return ReflectionObject.prototype.resolve.call(this);\r\n};\r\n","\"use strict\";\r\nmodule.exports = Namespace;\r\n\r\n// extends ReflectionObject\r\nvar ReflectionObject = require(24);\r\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\r\n\r\nvar Field = require(16),\r\n util = require(37);\r\n\r\nvar Type, // cyclic\r\n Service,\r\n Enum;\r\n\r\n/**\r\n * Constructs a new namespace instance.\r\n * @name Namespace\r\n * @classdesc Reflected namespace.\r\n * @extends NamespaceBase\r\n * @constructor\r\n * @param {string} name Namespace name\r\n * @param {Object.} [options] Declared options\r\n */\r\n\r\n/**\r\n * Constructs a namespace from JSON.\r\n * @memberof Namespace\r\n * @function\r\n * @param {string} name Namespace name\r\n * @param {Object.} json JSON object\r\n * @returns {Namespace} Created namespace\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nNamespace.fromJSON = function fromJSON(name, json) {\r\n return new Namespace(name, json.options).addJSON(json.nested);\r\n};\r\n\r\n/**\r\n * Converts an array of reflection objects to JSON.\r\n * @memberof Namespace\r\n * @param {ReflectionObject[]} array Object array\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {Object.|undefined} JSON object or `undefined` when array is empty\r\n */\r\nfunction arrayToJSON(array, toJSONOptions) {\r\n if (!(array && array.length))\r\n return undefined;\r\n var obj = {};\r\n for (var i = 0; i < array.length; ++i)\r\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\r\n return obj;\r\n}\r\n\r\nNamespace.arrayToJSON = arrayToJSON;\r\n\r\n/**\r\n * Tests if the specified id is reserved.\r\n * @param {Array.|undefined} reserved Array of reserved ranges and names\r\n * @param {number} id Id to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nNamespace.isReservedId = function isReservedId(reserved, id) {\r\n if (reserved)\r\n for (var i = 0; i < reserved.length; ++i)\r\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] >= id)\r\n return true;\r\n return false;\r\n};\r\n\r\n/**\r\n * Tests if the specified name is reserved.\r\n * @param {Array.|undefined} reserved Array of reserved ranges and names\r\n * @param {string} name Name to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nNamespace.isReservedName = function isReservedName(reserved, name) {\r\n if (reserved)\r\n for (var i = 0; i < reserved.length; ++i)\r\n if (reserved[i] === name)\r\n return true;\r\n return false;\r\n};\r\n\r\n/**\r\n * Not an actual constructor. Use {@link Namespace} instead.\r\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\r\n * @exports NamespaceBase\r\n * @extends ReflectionObject\r\n * @abstract\r\n * @constructor\r\n * @param {string} name Namespace name\r\n * @param {Object.} [options] Declared options\r\n * @see {@link Namespace}\r\n */\r\nfunction Namespace(name, options) {\r\n ReflectionObject.call(this, name, options);\r\n\r\n /**\r\n * Nested objects by name.\r\n * @type {Object.|undefined}\r\n */\r\n this.nested = undefined; // toJSON\r\n\r\n /**\r\n * Cached nested objects as an array.\r\n * @type {ReflectionObject[]|null}\r\n * @private\r\n */\r\n this._nestedArray = null;\r\n}\r\n\r\nfunction clearCache(namespace) {\r\n namespace._nestedArray = null;\r\n return namespace;\r\n}\r\n\r\n/**\r\n * Nested objects of this namespace as an array for iteration.\r\n * @name NamespaceBase#nestedArray\r\n * @type {ReflectionObject[]}\r\n * @readonly\r\n */\r\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\r\n get: function() {\r\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\r\n }\r\n});\r\n\r\n/**\r\n * Namespace descriptor.\r\n * @interface INamespace\r\n * @property {Object.} [options] Namespace options\r\n * @property {Object.} [nested] Nested object descriptors\r\n */\r\n\r\n/**\r\n * Any extension field descriptor.\r\n * @typedef AnyExtensionField\r\n * @type {IExtensionField|IExtensionMapField}\r\n */\r\n\r\n/**\r\n * Any nested object descriptor.\r\n * @typedef AnyNestedObject\r\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\r\n */\r\n// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\r\n\r\n/**\r\n * Converts this namespace to a namespace descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {INamespace} Namespace descriptor\r\n */\r\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\r\n return util.toObject([\r\n \"options\" , this.options,\r\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\r\n ]);\r\n};\r\n\r\n/**\r\n * Adds nested objects to this namespace from nested object descriptors.\r\n * @param {Object.} nestedJson Any nested object descriptors\r\n * @returns {Namespace} `this`\r\n */\r\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\r\n var ns = this;\r\n /* istanbul ignore else */\r\n if (nestedJson) {\r\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\r\n nested = nestedJson[names[i]];\r\n ns.add( // most to least likely\r\n ( nested.fields !== undefined\r\n ? Type.fromJSON\r\n : nested.values !== undefined\r\n ? Enum.fromJSON\r\n : nested.methods !== undefined\r\n ? Service.fromJSON\r\n : nested.id !== undefined\r\n ? Field.fromJSON\r\n : Namespace.fromJSON )(names[i], nested)\r\n );\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Gets the nested object of the specified name.\r\n * @param {string} name Nested object name\r\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\r\n */\r\nNamespace.prototype.get = function get(name) {\r\n return this.nested && this.nested[name]\r\n || null;\r\n};\r\n\r\n/**\r\n * Gets the values of the nested {@link Enum|enum} of the specified name.\r\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\r\n * @param {string} name Nested enum name\r\n * @returns {Object.} Enum values\r\n * @throws {Error} If there is no such enum\r\n */\r\nNamespace.prototype.getEnum = function getEnum(name) {\r\n if (this.nested && this.nested[name] instanceof Enum)\r\n return this.nested[name].values;\r\n throw Error(\"no such enum: \" + name);\r\n};\r\n\r\n/**\r\n * Adds a nested object to this namespace.\r\n * @param {ReflectionObject} object Nested object to add\r\n * @returns {Namespace} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If there is already a nested object with this name\r\n */\r\nNamespace.prototype.add = function add(object) {\r\n\r\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\r\n throw TypeError(\"object must be a valid nested object\");\r\n\r\n if (!this.nested)\r\n this.nested = {};\r\n else {\r\n var prev = this.get(object.name);\r\n if (prev) {\r\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\r\n // replace plain namespace but keep existing nested elements and options\r\n var nested = prev.nestedArray;\r\n for (var i = 0; i < nested.length; ++i)\r\n object.add(nested[i]);\r\n this.remove(prev);\r\n if (!this.nested)\r\n this.nested = {};\r\n object.setOptions(prev.options, true);\r\n\r\n } else\r\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\r\n }\r\n }\r\n this.nested[object.name] = object;\r\n object.onAdd(this);\r\n return clearCache(this);\r\n};\r\n\r\n/**\r\n * Removes a nested object from this namespace.\r\n * @param {ReflectionObject} object Nested object to remove\r\n * @returns {Namespace} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If `object` is not a member of this namespace\r\n */\r\nNamespace.prototype.remove = function remove(object) {\r\n\r\n if (!(object instanceof ReflectionObject))\r\n throw TypeError(\"object must be a ReflectionObject\");\r\n if (object.parent !== this)\r\n throw Error(object + \" is not a member of \" + this);\r\n\r\n delete this.nested[object.name];\r\n if (!Object.keys(this.nested).length)\r\n this.nested = undefined;\r\n\r\n object.onRemove(this);\r\n return clearCache(this);\r\n};\r\n\r\n/**\r\n * Defines additial namespaces within this one if not yet existing.\r\n * @param {string|string[]} path Path to create\r\n * @param {*} [json] Nested types to create from JSON\r\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\r\n */\r\nNamespace.prototype.define = function define(path, json) {\r\n\r\n if (util.isString(path))\r\n path = path.split(\".\");\r\n else if (!Array.isArray(path))\r\n throw TypeError(\"illegal path\");\r\n if (path && path.length && path[0] === \"\")\r\n throw Error(\"path must be relative\");\r\n\r\n var ptr = this;\r\n while (path.length > 0) {\r\n var part = path.shift();\r\n if (ptr.nested && ptr.nested[part]) {\r\n ptr = ptr.nested[part];\r\n if (!(ptr instanceof Namespace))\r\n throw Error(\"path conflicts with non-namespace objects\");\r\n } else\r\n ptr.add(ptr = new Namespace(part));\r\n }\r\n if (json)\r\n ptr.addJSON(json);\r\n return ptr;\r\n};\r\n\r\n/**\r\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\r\n * @returns {Namespace} `this`\r\n */\r\nNamespace.prototype.resolveAll = function resolveAll() {\r\n var nested = this.nestedArray, i = 0;\r\n while (i < nested.length)\r\n if (nested[i] instanceof Namespace)\r\n nested[i++].resolveAll();\r\n else\r\n nested[i++].resolve();\r\n return this.resolve();\r\n};\r\n\r\n/**\r\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\r\n * @param {string|string[]} path Path to look up\r\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\r\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\r\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\r\n */\r\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\r\n\r\n /* istanbul ignore next */\r\n if (typeof filterTypes === \"boolean\") {\r\n parentAlreadyChecked = filterTypes;\r\n filterTypes = undefined;\r\n } else if (filterTypes && !Array.isArray(filterTypes))\r\n filterTypes = [ filterTypes ];\r\n\r\n if (util.isString(path) && path.length) {\r\n if (path === \".\")\r\n return this.root;\r\n path = path.split(\".\");\r\n } else if (!path.length)\r\n return this;\r\n\r\n // Start at root if path is absolute\r\n if (path[0] === \"\")\r\n return this.root.lookup(path.slice(1), filterTypes);\r\n\r\n // Test if the first part matches any nested object, and if so, traverse if path contains more\r\n var found = this.get(path[0]);\r\n if (found) {\r\n if (path.length === 1) {\r\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\r\n return found;\r\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\r\n return found;\r\n\r\n // Otherwise try each nested namespace\r\n } else\r\n for (var i = 0; i < this.nestedArray.length; ++i)\r\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\r\n return found;\r\n\r\n // If there hasn't been a match, try again at the parent\r\n if (this.parent === null || parentAlreadyChecked)\r\n return null;\r\n return this.parent.lookup(path, filterTypes);\r\n};\r\n\r\n/**\r\n * Looks up the reflection object at the specified path, relative to this namespace.\r\n * @name NamespaceBase#lookup\r\n * @function\r\n * @param {string|string[]} path Path to look up\r\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\r\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\r\n * @variation 2\r\n */\r\n// lookup(path: string, [parentAlreadyChecked: boolean])\r\n\r\n/**\r\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\r\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r\n * @param {string|string[]} path Path to look up\r\n * @returns {Type} Looked up type\r\n * @throws {Error} If `path` does not point to a type\r\n */\r\nNamespace.prototype.lookupType = function lookupType(path) {\r\n var found = this.lookup(path, [ Type ]);\r\n if (!found)\r\n throw Error(\"no such type: \" + path);\r\n return found;\r\n};\r\n\r\n/**\r\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\r\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r\n * @param {string|string[]} path Path to look up\r\n * @returns {Enum} Looked up enum\r\n * @throws {Error} If `path` does not point to an enum\r\n */\r\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\r\n var found = this.lookup(path, [ Enum ]);\r\n if (!found)\r\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\r\n return found;\r\n};\r\n\r\n/**\r\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\r\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r\n * @param {string|string[]} path Path to look up\r\n * @returns {Type} Looked up type or enum\r\n * @throws {Error} If `path` does not point to a type or enum\r\n */\r\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\r\n var found = this.lookup(path, [ Type, Enum ]);\r\n if (!found)\r\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\r\n return found;\r\n};\r\n\r\n/**\r\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\r\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\r\n * @param {string|string[]} path Path to look up\r\n * @returns {Service} Looked up service\r\n * @throws {Error} If `path` does not point to a service\r\n */\r\nNamespace.prototype.lookupService = function lookupService(path) {\r\n var found = this.lookup(path, [ Service ]);\r\n if (!found)\r\n throw Error(\"no such Service '\" + path + \"' in \" + this);\r\n return found;\r\n};\r\n\r\n// Sets up cyclic dependencies (called in index-light)\r\nNamespace._configure = function(Type_, Service_, Enum_) {\r\n Type = Type_;\r\n Service = Service_;\r\n Enum = Enum_;\r\n};\r\n","\"use strict\";\r\nmodule.exports = ReflectionObject;\r\n\r\nReflectionObject.className = \"ReflectionObject\";\r\n\r\nvar util = require(37);\r\n\r\nvar Root; // cyclic\r\n\r\n/**\r\n * Constructs a new reflection object instance.\r\n * @classdesc Base class of all reflection objects.\r\n * @constructor\r\n * @param {string} name Object name\r\n * @param {Object.} [options] Declared options\r\n * @abstract\r\n */\r\nfunction ReflectionObject(name, options) {\r\n\r\n if (!util.isString(name))\r\n throw TypeError(\"name must be a string\");\r\n\r\n if (options && !util.isObject(options))\r\n throw TypeError(\"options must be an object\");\r\n\r\n /**\r\n * Options.\r\n * @type {Object.|undefined}\r\n */\r\n this.options = options; // toJSON\r\n\r\n /**\r\n * Unique name within its namespace.\r\n * @type {string}\r\n */\r\n this.name = name;\r\n\r\n /**\r\n * Parent namespace.\r\n * @type {Namespace|null}\r\n */\r\n this.parent = null;\r\n\r\n /**\r\n * Whether already resolved or not.\r\n * @type {boolean}\r\n */\r\n this.resolved = false;\r\n\r\n /**\r\n * Comment text, if any.\r\n * @type {string|null}\r\n */\r\n this.comment = null;\r\n\r\n /**\r\n * Defining file name.\r\n * @type {string|null}\r\n */\r\n this.filename = null;\r\n}\r\n\r\nObject.defineProperties(ReflectionObject.prototype, {\r\n\r\n /**\r\n * Reference to the root namespace.\r\n * @name ReflectionObject#root\r\n * @type {Root}\r\n * @readonly\r\n */\r\n root: {\r\n get: function() {\r\n var ptr = this;\r\n while (ptr.parent !== null)\r\n ptr = ptr.parent;\r\n return ptr;\r\n }\r\n },\r\n\r\n /**\r\n * Full name including leading dot.\r\n * @name ReflectionObject#fullName\r\n * @type {string}\r\n * @readonly\r\n */\r\n fullName: {\r\n get: function() {\r\n var path = [ this.name ],\r\n ptr = this.parent;\r\n while (ptr) {\r\n path.unshift(ptr.name);\r\n ptr = ptr.parent;\r\n }\r\n return path.join(\".\");\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * Converts this reflection object to its descriptor representation.\r\n * @returns {Object.} Descriptor\r\n * @abstract\r\n */\r\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\r\n throw Error(); // not implemented, shouldn't happen\r\n};\r\n\r\n/**\r\n * Called when this object is added to a parent.\r\n * @param {ReflectionObject} parent Parent added to\r\n * @returns {undefined}\r\n */\r\nReflectionObject.prototype.onAdd = function onAdd(parent) {\r\n if (this.parent && this.parent !== parent)\r\n this.parent.remove(this);\r\n this.parent = parent;\r\n this.resolved = false;\r\n var root = parent.root;\r\n if (root instanceof Root)\r\n root._handleAdd(this);\r\n};\r\n\r\n/**\r\n * Called when this object is removed from a parent.\r\n * @param {ReflectionObject} parent Parent removed from\r\n * @returns {undefined}\r\n */\r\nReflectionObject.prototype.onRemove = function onRemove(parent) {\r\n var root = parent.root;\r\n if (root instanceof Root)\r\n root._handleRemove(this);\r\n this.parent = null;\r\n this.resolved = false;\r\n};\r\n\r\n/**\r\n * Resolves this objects type references.\r\n * @returns {ReflectionObject} `this`\r\n */\r\nReflectionObject.prototype.resolve = function resolve() {\r\n if (this.resolved)\r\n return this;\r\n if (this.root instanceof Root)\r\n this.resolved = true; // only if part of a root\r\n return this;\r\n};\r\n\r\n/**\r\n * Gets an option value.\r\n * @param {string} name Option name\r\n * @returns {*} Option value or `undefined` if not set\r\n */\r\nReflectionObject.prototype.getOption = function getOption(name) {\r\n if (this.options)\r\n return this.options[name];\r\n return undefined;\r\n};\r\n\r\n/**\r\n * Sets an option.\r\n * @param {string} name Option name\r\n * @param {*} value Option value\r\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\r\n * @returns {ReflectionObject} `this`\r\n */\r\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\r\n if (!ifNotSet || !this.options || this.options[name] === undefined)\r\n (this.options || (this.options = {}))[name] = value;\r\n return this;\r\n};\r\n\r\n/**\r\n * Sets multiple options.\r\n * @param {Object.} options Options to set\r\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\r\n * @returns {ReflectionObject} `this`\r\n */\r\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\r\n if (options)\r\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\r\n this.setOption(keys[i], options[keys[i]], ifNotSet);\r\n return this;\r\n};\r\n\r\n/**\r\n * Converts this instance to its string representation.\r\n * @returns {string} Class name[, space, full name]\r\n */\r\nReflectionObject.prototype.toString = function toString() {\r\n var className = this.constructor.className,\r\n fullName = this.fullName;\r\n if (fullName.length)\r\n return className + \" \" + fullName;\r\n return className;\r\n};\r\n\r\n// Sets up cyclic dependencies (called in index-light)\r\nReflectionObject._configure = function(Root_) {\r\n Root = Root_;\r\n};\r\n","\"use strict\";\r\nmodule.exports = OneOf;\r\n\r\n// extends ReflectionObject\r\nvar ReflectionObject = require(24);\r\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\r\n\r\nvar Field = require(16),\r\n util = require(37);\r\n\r\n/**\r\n * Constructs a new oneof instance.\r\n * @classdesc Reflected oneof.\r\n * @extends ReflectionObject\r\n * @constructor\r\n * @param {string} name Oneof name\r\n * @param {string[]|Object.} [fieldNames] Field names\r\n * @param {Object.} [options] Declared options\r\n * @param {string} [comment] Comment associated with this field\r\n */\r\nfunction OneOf(name, fieldNames, options, comment) {\r\n if (!Array.isArray(fieldNames)) {\r\n options = fieldNames;\r\n fieldNames = undefined;\r\n }\r\n ReflectionObject.call(this, name, options);\r\n\r\n /* istanbul ignore if */\r\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\r\n throw TypeError(\"fieldNames must be an Array\");\r\n\r\n /**\r\n * Field names that belong to this oneof.\r\n * @type {string[]}\r\n */\r\n this.oneof = fieldNames || []; // toJSON, marker\r\n\r\n /**\r\n * Fields that belong to this oneof as an array for iteration.\r\n * @type {Field[]}\r\n * @readonly\r\n */\r\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\r\n\r\n /**\r\n * Comment for this field.\r\n * @type {string|null}\r\n */\r\n this.comment = comment;\r\n}\r\n\r\n/**\r\n * Oneof descriptor.\r\n * @interface IOneOf\r\n * @property {Array.} oneof Oneof field names\r\n * @property {Object.} [options] Oneof options\r\n */\r\n\r\n/**\r\n * Constructs a oneof from a oneof descriptor.\r\n * @param {string} name Oneof name\r\n * @param {IOneOf} json Oneof descriptor\r\n * @returns {OneOf} Created oneof\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nOneOf.fromJSON = function fromJSON(name, json) {\r\n return new OneOf(name, json.oneof, json.options, json.comment);\r\n};\r\n\r\n/**\r\n * Converts this oneof to a oneof descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IOneOf} Oneof descriptor\r\n */\r\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"options\" , this.options,\r\n \"oneof\" , this.oneof,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * Adds the fields of the specified oneof to the parent if not already done so.\r\n * @param {OneOf} oneof The oneof\r\n * @returns {undefined}\r\n * @inner\r\n * @ignore\r\n */\r\nfunction addFieldsToParent(oneof) {\r\n if (oneof.parent)\r\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\r\n if (!oneof.fieldsArray[i].parent)\r\n oneof.parent.add(oneof.fieldsArray[i]);\r\n}\r\n\r\n/**\r\n * Adds a field to this oneof and removes it from its current parent, if any.\r\n * @param {Field} field Field to add\r\n * @returns {OneOf} `this`\r\n */\r\nOneOf.prototype.add = function add(field) {\r\n\r\n /* istanbul ignore if */\r\n if (!(field instanceof Field))\r\n throw TypeError(\"field must be a Field\");\r\n\r\n if (field.parent && field.parent !== this.parent)\r\n field.parent.remove(field);\r\n this.oneof.push(field.name);\r\n this.fieldsArray.push(field);\r\n field.partOf = this; // field.parent remains null\r\n addFieldsToParent(this);\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes a field from this oneof and puts it back to the oneof's parent.\r\n * @param {Field} field Field to remove\r\n * @returns {OneOf} `this`\r\n */\r\nOneOf.prototype.remove = function remove(field) {\r\n\r\n /* istanbul ignore if */\r\n if (!(field instanceof Field))\r\n throw TypeError(\"field must be a Field\");\r\n\r\n var index = this.fieldsArray.indexOf(field);\r\n\r\n /* istanbul ignore if */\r\n if (index < 0)\r\n throw Error(field + \" is not a member of \" + this);\r\n\r\n this.fieldsArray.splice(index, 1);\r\n index = this.oneof.indexOf(field.name);\r\n\r\n /* istanbul ignore else */\r\n if (index > -1) // theoretical\r\n this.oneof.splice(index, 1);\r\n\r\n field.partOf = null;\r\n return this;\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nOneOf.prototype.onAdd = function onAdd(parent) {\r\n ReflectionObject.prototype.onAdd.call(this, parent);\r\n var self = this;\r\n // Collect present fields\r\n for (var i = 0; i < this.oneof.length; ++i) {\r\n var field = parent.get(this.oneof[i]);\r\n if (field && !field.partOf) {\r\n field.partOf = self;\r\n self.fieldsArray.push(field);\r\n }\r\n }\r\n // Add not yet present fields\r\n addFieldsToParent(this);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nOneOf.prototype.onRemove = function onRemove(parent) {\r\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\r\n if ((field = this.fieldsArray[i]).parent)\r\n field.parent.remove(field);\r\n ReflectionObject.prototype.onRemove.call(this, parent);\r\n};\r\n\r\n/**\r\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\r\n * @typedef OneOfDecorator\r\n * @type {function}\r\n * @param {Object} prototype Target prototype\r\n * @param {string} oneofName OneOf name\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * OneOf decorator (TypeScript).\r\n * @function\r\n * @param {...string} fieldNames Field names\r\n * @returns {OneOfDecorator} Decorator function\r\n * @template T extends string\r\n */\r\nOneOf.d = function decorateOneOf() {\r\n var fieldNames = new Array(arguments.length),\r\n index = 0;\r\n while (index < arguments.length)\r\n fieldNames[index] = arguments[index++];\r\n return function oneOfDecorator(prototype, oneofName) {\r\n util.decorateType(prototype.constructor)\r\n .add(new OneOf(oneofName, fieldNames));\r\n Object.defineProperty(prototype, oneofName, {\r\n get: util.oneOfGetter(fieldNames),\r\n set: util.oneOfSetter(fieldNames)\r\n });\r\n };\r\n};\r\n","\"use strict\";\r\nmodule.exports = parse;\r\n\r\nparse.filename = null;\r\nparse.defaults = { keepCase: false };\r\n\r\nvar tokenize = require(34),\r\n Root = require(29),\r\n Type = require(35),\r\n Field = require(16),\r\n MapField = require(20),\r\n OneOf = require(25),\r\n Enum = require(15),\r\n Service = require(33),\r\n Method = require(22),\r\n types = require(36),\r\n util = require(37);\r\n\r\nvar base10Re = /^[1-9][0-9]*$/,\r\n base10NegRe = /^-?[1-9][0-9]*$/,\r\n base16Re = /^0[x][0-9a-fA-F]+$/,\r\n base16NegRe = /^-?0[x][0-9a-fA-F]+$/,\r\n base8Re = /^0[0-7]+$/,\r\n base8NegRe = /^-?0[0-7]+$/,\r\n numberRe = /^(?![eE])[0-9]*(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,\r\n nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,\r\n typeRefRe = /^(?:\\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\r\n fqTypeRefRe = /^(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;\r\n\r\n/**\r\n * Result object returned from {@link parse}.\r\n * @interface IParserResult\r\n * @property {string|undefined} package Package name, if declared\r\n * @property {string[]|undefined} imports Imports, if any\r\n * @property {string[]|undefined} weakImports Weak imports, if any\r\n * @property {string|undefined} syntax Syntax, if specified (either `\"proto2\"` or `\"proto3\"`)\r\n * @property {Root} root Populated root instance\r\n */\r\n\r\n/**\r\n * Options modifying the behavior of {@link parse}.\r\n * @interface IParseOptions\r\n * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case\r\n * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments.\r\n */\r\n\r\n/**\r\n * Options modifying the behavior of JSON serialization.\r\n * @interface IToJSONOptions\r\n * @property {boolean} [keepComments=false] Serializes comments.\r\n */\r\n\r\n/**\r\n * Parses the given .proto source and returns an object with the parsed contents.\r\n * @param {string} source Source contents\r\n * @param {Root} root Root to populate\r\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r\n * @returns {IParserResult} Parser result\r\n * @property {string} filename=null Currently processing file name for error reporting, if known\r\n * @property {IParseOptions} defaults Default {@link IParseOptions}\r\n */\r\nfunction parse(source, root, options) {\r\n /* eslint-disable callback-return */\r\n if (!(root instanceof Root)) {\r\n options = root;\r\n root = new Root();\r\n }\r\n if (!options)\r\n options = parse.defaults;\r\n\r\n var tn = tokenize(source, options.alternateCommentMode || false),\r\n next = tn.next,\r\n push = tn.push,\r\n peek = tn.peek,\r\n skip = tn.skip,\r\n cmnt = tn.cmnt;\r\n\r\n var head = true,\r\n pkg,\r\n imports,\r\n weakImports,\r\n syntax,\r\n isProto3 = false;\r\n\r\n var ptr = root;\r\n\r\n var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase;\r\n\r\n /* istanbul ignore next */\r\n function illegal(token, name, insideTryCatch) {\r\n var filename = parse.filename;\r\n if (!insideTryCatch)\r\n parse.filename = null;\r\n return Error(\"illegal \" + (name || \"token\") + \" '\" + token + \"' (\" + (filename ? filename + \", \" : \"\") + \"line \" + tn.line + \")\");\r\n }\r\n\r\n function readString() {\r\n var values = [],\r\n token;\r\n do {\r\n /* istanbul ignore if */\r\n if ((token = next()) !== \"\\\"\" && token !== \"'\")\r\n throw illegal(token);\r\n\r\n values.push(next());\r\n skip(token);\r\n token = peek();\r\n } while (token === \"\\\"\" || token === \"'\");\r\n return values.join(\"\");\r\n }\r\n\r\n function readValue(acceptTypeRef) {\r\n var token = next();\r\n switch (token) {\r\n case \"'\":\r\n case \"\\\"\":\r\n push(token);\r\n return readString();\r\n case \"true\": case \"TRUE\":\r\n return true;\r\n case \"false\": case \"FALSE\":\r\n return false;\r\n }\r\n try {\r\n return parseNumber(token, /* insideTryCatch */ true);\r\n } catch (e) {\r\n\r\n /* istanbul ignore else */\r\n if (acceptTypeRef && typeRefRe.test(token))\r\n return token;\r\n\r\n /* istanbul ignore next */\r\n throw illegal(token, \"value\");\r\n }\r\n }\r\n\r\n function readRanges(target, acceptStrings) {\r\n var token, start;\r\n do {\r\n if (acceptStrings && ((token = peek()) === \"\\\"\" || token === \"'\"))\r\n target.push(readString());\r\n else\r\n target.push([ start = parseId(next()), skip(\"to\", true) ? parseId(next()) : start ]);\r\n } while (skip(\",\", true));\r\n skip(\";\");\r\n }\r\n\r\n function parseNumber(token, insideTryCatch) {\r\n var sign = 1;\r\n if (token.charAt(0) === \"-\") {\r\n sign = -1;\r\n token = token.substring(1);\r\n }\r\n switch (token) {\r\n case \"inf\": case \"INF\": case \"Inf\":\r\n return sign * Infinity;\r\n case \"nan\": case \"NAN\": case \"Nan\": case \"NaN\":\r\n return NaN;\r\n case \"0\":\r\n return 0;\r\n }\r\n if (base10Re.test(token))\r\n return sign * parseInt(token, 10);\r\n if (base16Re.test(token))\r\n return sign * parseInt(token, 16);\r\n if (base8Re.test(token))\r\n return sign * parseInt(token, 8);\r\n\r\n /* istanbul ignore else */\r\n if (numberRe.test(token))\r\n return sign * parseFloat(token);\r\n\r\n /* istanbul ignore next */\r\n throw illegal(token, \"number\", insideTryCatch);\r\n }\r\n\r\n function parseId(token, acceptNegative) {\r\n switch (token) {\r\n case \"max\": case \"MAX\": case \"Max\":\r\n return 536870911;\r\n case \"0\":\r\n return 0;\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (!acceptNegative && token.charAt(0) === \"-\")\r\n throw illegal(token, \"id\");\r\n\r\n if (base10NegRe.test(token))\r\n return parseInt(token, 10);\r\n if (base16NegRe.test(token))\r\n return parseInt(token, 16);\r\n\r\n /* istanbul ignore else */\r\n if (base8NegRe.test(token))\r\n return parseInt(token, 8);\r\n\r\n /* istanbul ignore next */\r\n throw illegal(token, \"id\");\r\n }\r\n\r\n function parsePackage() {\r\n\r\n /* istanbul ignore if */\r\n if (pkg !== undefined)\r\n throw illegal(\"package\");\r\n\r\n pkg = next();\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(pkg))\r\n throw illegal(pkg, \"name\");\r\n\r\n ptr = ptr.define(pkg);\r\n skip(\";\");\r\n }\r\n\r\n function parseImport() {\r\n var token = peek();\r\n var whichImports;\r\n switch (token) {\r\n case \"weak\":\r\n whichImports = weakImports || (weakImports = []);\r\n next();\r\n break;\r\n case \"public\":\r\n next();\r\n // eslint-disable-line no-fallthrough\r\n default:\r\n whichImports = imports || (imports = []);\r\n break;\r\n }\r\n token = readString();\r\n skip(\";\");\r\n whichImports.push(token);\r\n }\r\n\r\n function parseSyntax() {\r\n skip(\"=\");\r\n syntax = readString();\r\n isProto3 = syntax === \"proto3\";\r\n\r\n /* istanbul ignore if */\r\n if (!isProto3 && syntax !== \"proto2\")\r\n throw illegal(syntax, \"syntax\");\r\n\r\n skip(\";\");\r\n }\r\n\r\n function parseCommon(parent, token) {\r\n switch (token) {\r\n\r\n case \"option\":\r\n parseOption(parent, token);\r\n skip(\";\");\r\n return true;\r\n\r\n case \"message\":\r\n parseType(parent, token);\r\n return true;\r\n\r\n case \"enum\":\r\n parseEnum(parent, token);\r\n return true;\r\n\r\n case \"service\":\r\n parseService(parent, token);\r\n return true;\r\n\r\n case \"extend\":\r\n parseExtension(parent, token);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n function ifBlock(obj, fnIf, fnElse) {\r\n var trailingLine = tn.line;\r\n if (obj) {\r\n obj.comment = cmnt(); // try block-type comment\r\n obj.filename = parse.filename;\r\n }\r\n if (skip(\"{\", true)) {\r\n var token;\r\n while ((token = next()) !== \"}\")\r\n fnIf(token);\r\n skip(\";\", true);\r\n } else {\r\n if (fnElse)\r\n fnElse();\r\n skip(\";\");\r\n if (obj && typeof obj.comment !== \"string\")\r\n obj.comment = cmnt(trailingLine); // try line-type comment if no block\r\n }\r\n }\r\n\r\n function parseType(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"type name\");\r\n\r\n var type = new Type(token);\r\n ifBlock(type, function parseType_block(token) {\r\n if (parseCommon(type, token))\r\n return;\r\n\r\n switch (token) {\r\n\r\n case \"map\":\r\n parseMapField(type, token);\r\n break;\r\n\r\n case \"required\":\r\n case \"optional\":\r\n case \"repeated\":\r\n parseField(type, token);\r\n break;\r\n\r\n case \"oneof\":\r\n parseOneOf(type, token);\r\n break;\r\n\r\n case \"extensions\":\r\n readRanges(type.extensions || (type.extensions = []));\r\n break;\r\n\r\n case \"reserved\":\r\n readRanges(type.reserved || (type.reserved = []), true);\r\n break;\r\n\r\n default:\r\n /* istanbul ignore if */\r\n if (!isProto3 || !typeRefRe.test(token))\r\n throw illegal(token);\r\n\r\n push(token);\r\n parseField(type, \"optional\");\r\n break;\r\n }\r\n });\r\n parent.add(type);\r\n }\r\n\r\n function parseField(parent, rule, extend) {\r\n var type = next();\r\n if (type === \"group\") {\r\n parseGroup(parent, rule);\r\n return;\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(type))\r\n throw illegal(type, \"type\");\r\n\r\n var name = next();\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(name))\r\n throw illegal(name, \"name\");\r\n\r\n name = applyCase(name);\r\n skip(\"=\");\r\n\r\n var field = new Field(name, parseId(next()), type, rule, extend);\r\n ifBlock(field, function parseField_block(token) {\r\n\r\n /* istanbul ignore else */\r\n if (token === \"option\") {\r\n parseOption(field, token);\r\n skip(\";\");\r\n } else\r\n throw illegal(token);\r\n\r\n }, function parseField_line() {\r\n parseInlineOptions(field);\r\n });\r\n parent.add(field);\r\n\r\n // JSON defaults to packed=true if not set so we have to set packed=false explicity when\r\n // parsing proto2 descriptors without the option, where applicable. This must be done for\r\n // all known packable types and anything that could be an enum (= is not a basic type).\r\n if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined))\r\n field.setOption(\"packed\", false, /* ifNotSet */ true);\r\n }\r\n\r\n function parseGroup(parent, rule) {\r\n var name = next();\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(name))\r\n throw illegal(name, \"name\");\r\n\r\n var fieldName = util.lcFirst(name);\r\n if (name === fieldName)\r\n name = util.ucFirst(name);\r\n skip(\"=\");\r\n var id = parseId(next());\r\n var type = new Type(name);\r\n type.group = true;\r\n var field = new Field(fieldName, id, name, rule);\r\n field.filename = parse.filename;\r\n ifBlock(type, function parseGroup_block(token) {\r\n switch (token) {\r\n\r\n case \"option\":\r\n parseOption(type, token);\r\n skip(\";\");\r\n break;\r\n\r\n case \"required\":\r\n case \"optional\":\r\n case \"repeated\":\r\n parseField(type, token);\r\n break;\r\n\r\n /* istanbul ignore next */\r\n default:\r\n throw illegal(token); // there are no groups with proto3 semantics\r\n }\r\n });\r\n parent.add(type)\r\n .add(field);\r\n }\r\n\r\n function parseMapField(parent) {\r\n skip(\"<\");\r\n var keyType = next();\r\n\r\n /* istanbul ignore if */\r\n if (types.mapKey[keyType] === undefined)\r\n throw illegal(keyType, \"type\");\r\n\r\n skip(\",\");\r\n var valueType = next();\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(valueType))\r\n throw illegal(valueType, \"type\");\r\n\r\n skip(\">\");\r\n var name = next();\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(name))\r\n throw illegal(name, \"name\");\r\n\r\n skip(\"=\");\r\n var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);\r\n ifBlock(field, function parseMapField_block(token) {\r\n\r\n /* istanbul ignore else */\r\n if (token === \"option\") {\r\n parseOption(field, token);\r\n skip(\";\");\r\n } else\r\n throw illegal(token);\r\n\r\n }, function parseMapField_line() {\r\n parseInlineOptions(field);\r\n });\r\n parent.add(field);\r\n }\r\n\r\n function parseOneOf(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"name\");\r\n\r\n var oneof = new OneOf(applyCase(token));\r\n ifBlock(oneof, function parseOneOf_block(token) {\r\n if (token === \"option\") {\r\n parseOption(oneof, token);\r\n skip(\";\");\r\n } else {\r\n push(token);\r\n parseField(oneof, \"optional\");\r\n }\r\n });\r\n parent.add(oneof);\r\n }\r\n\r\n function parseEnum(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"name\");\r\n\r\n var enm = new Enum(token);\r\n ifBlock(enm, function parseEnum_block(token) {\r\n switch(token) {\r\n case \"option\":\r\n parseOption(enm, token);\r\n skip(\";\");\r\n break;\r\n\r\n case \"reserved\":\r\n readRanges(enm.reserved || (enm.reserved = []), true);\r\n break;\r\n\r\n default:\r\n parseEnumValue(enm, token);\r\n }\r\n });\r\n parent.add(enm);\r\n }\r\n\r\n function parseEnumValue(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token))\r\n throw illegal(token, \"name\");\r\n\r\n skip(\"=\");\r\n var value = parseId(next(), true),\r\n dummy = {};\r\n ifBlock(dummy, function parseEnumValue_block(token) {\r\n\r\n /* istanbul ignore else */\r\n if (token === \"option\") {\r\n parseOption(dummy, token); // skip\r\n skip(\";\");\r\n } else\r\n throw illegal(token);\r\n\r\n }, function parseEnumValue_line() {\r\n parseInlineOptions(dummy); // skip\r\n });\r\n parent.add(token, value, dummy.comment);\r\n }\r\n\r\n function parseOption(parent, token) {\r\n var isCustom = skip(\"(\", true);\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(token = next()))\r\n throw illegal(token, \"name\");\r\n\r\n var name = token;\r\n if (isCustom) {\r\n skip(\")\");\r\n name = \"(\" + name + \")\";\r\n token = peek();\r\n if (fqTypeRefRe.test(token)) {\r\n name += token;\r\n next();\r\n }\r\n }\r\n skip(\"=\");\r\n parseOptionValue(parent, name);\r\n }\r\n\r\n function parseOptionValue(parent, name) {\r\n if (skip(\"{\", true)) { // { a: \"foo\" b { c: \"bar\" } }\r\n do {\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"name\");\r\n\r\n if (peek() === \"{\")\r\n parseOptionValue(parent, name + \".\" + token);\r\n else {\r\n skip(\":\");\r\n if (peek() === \"{\")\r\n parseOptionValue(parent, name + \".\" + token);\r\n else\r\n setOption(parent, name + \".\" + token, readValue(true));\r\n }\r\n skip(\",\", true);\r\n } while (!skip(\"}\", true));\r\n } else\r\n setOption(parent, name, readValue(true));\r\n // Does not enforce a delimiter to be universal\r\n }\r\n\r\n function setOption(parent, name, value) {\r\n if (parent.setOption)\r\n parent.setOption(name, value);\r\n }\r\n\r\n function parseInlineOptions(parent) {\r\n if (skip(\"[\", true)) {\r\n do {\r\n parseOption(parent, \"option\");\r\n } while (skip(\",\", true));\r\n skip(\"]\");\r\n }\r\n return parent;\r\n }\r\n\r\n function parseService(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"service name\");\r\n\r\n var service = new Service(token);\r\n ifBlock(service, function parseService_block(token) {\r\n if (parseCommon(service, token))\r\n return;\r\n\r\n /* istanbul ignore else */\r\n if (token === \"rpc\")\r\n parseMethod(service, token);\r\n else\r\n throw illegal(token);\r\n });\r\n parent.add(service);\r\n }\r\n\r\n function parseMethod(parent, token) {\r\n var type = token;\r\n\r\n /* istanbul ignore if */\r\n if (!nameRe.test(token = next()))\r\n throw illegal(token, \"name\");\r\n\r\n var name = token,\r\n requestType, requestStream,\r\n responseType, responseStream;\r\n\r\n skip(\"(\");\r\n if (skip(\"stream\", true))\r\n requestStream = true;\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(token = next()))\r\n throw illegal(token);\r\n\r\n requestType = token;\r\n skip(\")\"); skip(\"returns\"); skip(\"(\");\r\n if (skip(\"stream\", true))\r\n responseStream = true;\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(token = next()))\r\n throw illegal(token);\r\n\r\n responseType = token;\r\n skip(\")\");\r\n\r\n var method = new Method(name, type, requestType, responseType, requestStream, responseStream);\r\n ifBlock(method, function parseMethod_block(token) {\r\n\r\n /* istanbul ignore else */\r\n if (token === \"option\") {\r\n parseOption(method, token);\r\n skip(\";\");\r\n } else\r\n throw illegal(token);\r\n\r\n });\r\n parent.add(method);\r\n }\r\n\r\n function parseExtension(parent, token) {\r\n\r\n /* istanbul ignore if */\r\n if (!typeRefRe.test(token = next()))\r\n throw illegal(token, \"reference\");\r\n\r\n var reference = token;\r\n ifBlock(null, function parseExtension_block(token) {\r\n switch (token) {\r\n\r\n case \"required\":\r\n case \"repeated\":\r\n case \"optional\":\r\n parseField(parent, token, reference);\r\n break;\r\n\r\n default:\r\n /* istanbul ignore if */\r\n if (!isProto3 || !typeRefRe.test(token))\r\n throw illegal(token);\r\n push(token);\r\n parseField(parent, \"optional\", reference);\r\n break;\r\n }\r\n });\r\n }\r\n\r\n var token;\r\n while ((token = next()) !== null) {\r\n switch (token) {\r\n\r\n case \"package\":\r\n\r\n /* istanbul ignore if */\r\n if (!head)\r\n throw illegal(token);\r\n\r\n parsePackage();\r\n break;\r\n\r\n case \"import\":\r\n\r\n /* istanbul ignore if */\r\n if (!head)\r\n throw illegal(token);\r\n\r\n parseImport();\r\n break;\r\n\r\n case \"syntax\":\r\n\r\n /* istanbul ignore if */\r\n if (!head)\r\n throw illegal(token);\r\n\r\n parseSyntax();\r\n break;\r\n\r\n case \"option\":\r\n\r\n /* istanbul ignore if */\r\n if (!head)\r\n throw illegal(token);\r\n\r\n parseOption(ptr, token);\r\n skip(\";\");\r\n break;\r\n\r\n default:\r\n\r\n /* istanbul ignore else */\r\n if (parseCommon(ptr, token)) {\r\n head = false;\r\n continue;\r\n }\r\n\r\n /* istanbul ignore next */\r\n throw illegal(token);\r\n }\r\n }\r\n\r\n parse.filename = null;\r\n return {\r\n \"package\" : pkg,\r\n \"imports\" : imports,\r\n weakImports : weakImports,\r\n syntax : syntax,\r\n root : root\r\n };\r\n}\r\n\r\n/**\r\n * Parses the given .proto source and returns an object with the parsed contents.\r\n * @name parse\r\n * @function\r\n * @param {string} source Source contents\r\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r\n * @returns {IParserResult} Parser result\r\n * @property {string} filename=null Currently processing file name for error reporting, if known\r\n * @property {IParseOptions} defaults Default {@link IParseOptions}\r\n * @variation 2\r\n */\r\n","\"use strict\";\r\nmodule.exports = Reader;\r\n\r\nvar util = require(39);\r\n\r\nvar BufferReader; // cyclic\r\n\r\nvar LongBits = util.LongBits,\r\n utf8 = util.utf8;\r\n\r\n/* istanbul ignore next */\r\nfunction indexOutOfRange(reader, writeLength) {\r\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\r\n}\r\n\r\n/**\r\n * Constructs a new reader instance using the specified buffer.\r\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\r\n * @constructor\r\n * @param {Uint8Array} buffer Buffer to read from\r\n */\r\nfunction Reader(buffer) {\r\n\r\n /**\r\n * Read buffer.\r\n * @type {Uint8Array}\r\n */\r\n this.buf = buffer;\r\n\r\n /**\r\n * Read buffer position.\r\n * @type {number}\r\n */\r\n this.pos = 0;\r\n\r\n /**\r\n * Read buffer length.\r\n * @type {number}\r\n */\r\n this.len = buffer.length;\r\n}\r\n\r\nvar create_array = typeof Uint8Array !== \"undefined\"\r\n ? function create_typed_array(buffer) {\r\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\r\n return new Reader(buffer);\r\n throw Error(\"illegal buffer\");\r\n }\r\n /* istanbul ignore next */\r\n : function create_array(buffer) {\r\n if (Array.isArray(buffer))\r\n return new Reader(buffer);\r\n throw Error(\"illegal buffer\");\r\n };\r\n\r\n/**\r\n * Creates a new reader using the specified buffer.\r\n * @function\r\n * @param {Uint8Array|Buffer} buffer Buffer to read from\r\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\r\n * @throws {Error} If `buffer` is not a valid buffer\r\n */\r\nReader.create = util.Buffer\r\n ? function create_buffer_setup(buffer) {\r\n return (Reader.create = function create_buffer(buffer) {\r\n return util.Buffer.isBuffer(buffer)\r\n ? new BufferReader(buffer)\r\n /* istanbul ignore next */\r\n : create_array(buffer);\r\n })(buffer);\r\n }\r\n /* istanbul ignore next */\r\n : create_array;\r\n\r\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\r\n\r\n/**\r\n * Reads a varint as an unsigned 32 bit value.\r\n * @function\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.uint32 = (function read_uint32_setup() {\r\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\r\n return function read_uint32() {\r\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\r\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\r\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\r\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\r\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\r\n\r\n /* istanbul ignore if */\r\n if ((this.pos += 5) > this.len) {\r\n this.pos = this.len;\r\n throw indexOutOfRange(this, 10);\r\n }\r\n return value;\r\n };\r\n})();\r\n\r\n/**\r\n * Reads a varint as a signed 32 bit value.\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.int32 = function read_int32() {\r\n return this.uint32() | 0;\r\n};\r\n\r\n/**\r\n * Reads a zig-zag encoded varint as a signed 32 bit value.\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.sint32 = function read_sint32() {\r\n var value = this.uint32();\r\n return value >>> 1 ^ -(value & 1) | 0;\r\n};\r\n\r\n/* eslint-disable no-invalid-this */\r\n\r\nfunction readLongVarint() {\r\n // tends to deopt with local vars for octet etc.\r\n var bits = new LongBits(0, 0);\r\n var i = 0;\r\n if (this.len - this.pos > 4) { // fast route (lo)\r\n for (; i < 4; ++i) {\r\n // 1st..4th\r\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\r\n if (this.buf[this.pos++] < 128)\r\n return bits;\r\n }\r\n // 5th\r\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\r\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\r\n if (this.buf[this.pos++] < 128)\r\n return bits;\r\n i = 0;\r\n } else {\r\n for (; i < 3; ++i) {\r\n /* istanbul ignore if */\r\n if (this.pos >= this.len)\r\n throw indexOutOfRange(this);\r\n // 1st..3th\r\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\r\n if (this.buf[this.pos++] < 128)\r\n return bits;\r\n }\r\n // 4th\r\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\r\n return bits;\r\n }\r\n if (this.len - this.pos > 4) { // fast route (hi)\r\n for (; i < 5; ++i) {\r\n // 6th..10th\r\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\r\n if (this.buf[this.pos++] < 128)\r\n return bits;\r\n }\r\n } else {\r\n for (; i < 5; ++i) {\r\n /* istanbul ignore if */\r\n if (this.pos >= this.len)\r\n throw indexOutOfRange(this);\r\n // 6th..10th\r\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\r\n if (this.buf[this.pos++] < 128)\r\n return bits;\r\n }\r\n }\r\n /* istanbul ignore next */\r\n throw Error(\"invalid varint encoding\");\r\n}\r\n\r\n/* eslint-enable no-invalid-this */\r\n\r\n/**\r\n * Reads a varint as a signed 64 bit value.\r\n * @name Reader#int64\r\n * @function\r\n * @returns {Long} Value read\r\n */\r\n\r\n/**\r\n * Reads a varint as an unsigned 64 bit value.\r\n * @name Reader#uint64\r\n * @function\r\n * @returns {Long} Value read\r\n */\r\n\r\n/**\r\n * Reads a zig-zag encoded varint as a signed 64 bit value.\r\n * @name Reader#sint64\r\n * @function\r\n * @returns {Long} Value read\r\n */\r\n\r\n/**\r\n * Reads a varint as a boolean.\r\n * @returns {boolean} Value read\r\n */\r\nReader.prototype.bool = function read_bool() {\r\n return this.uint32() !== 0;\r\n};\r\n\r\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\r\n return (buf[end - 4]\r\n | buf[end - 3] << 8\r\n | buf[end - 2] << 16\r\n | buf[end - 1] << 24) >>> 0;\r\n}\r\n\r\n/**\r\n * Reads fixed 32 bits as an unsigned 32 bit integer.\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.fixed32 = function read_fixed32() {\r\n\r\n /* istanbul ignore if */\r\n if (this.pos + 4 > this.len)\r\n throw indexOutOfRange(this, 4);\r\n\r\n return readFixed32_end(this.buf, this.pos += 4);\r\n};\r\n\r\n/**\r\n * Reads fixed 32 bits as a signed 32 bit integer.\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.sfixed32 = function read_sfixed32() {\r\n\r\n /* istanbul ignore if */\r\n if (this.pos + 4 > this.len)\r\n throw indexOutOfRange(this, 4);\r\n\r\n return readFixed32_end(this.buf, this.pos += 4) | 0;\r\n};\r\n\r\n/* eslint-disable no-invalid-this */\r\n\r\nfunction readFixed64(/* this: Reader */) {\r\n\r\n /* istanbul ignore if */\r\n if (this.pos + 8 > this.len)\r\n throw indexOutOfRange(this, 8);\r\n\r\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\r\n}\r\n\r\n/* eslint-enable no-invalid-this */\r\n\r\n/**\r\n * Reads fixed 64 bits.\r\n * @name Reader#fixed64\r\n * @function\r\n * @returns {Long} Value read\r\n */\r\n\r\n/**\r\n * Reads zig-zag encoded fixed 64 bits.\r\n * @name Reader#sfixed64\r\n * @function\r\n * @returns {Long} Value read\r\n */\r\n\r\n/**\r\n * Reads a float (32 bit) as a number.\r\n * @function\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.float = function read_float() {\r\n\r\n /* istanbul ignore if */\r\n if (this.pos + 4 > this.len)\r\n throw indexOutOfRange(this, 4);\r\n\r\n var value = util.float.readFloatLE(this.buf, this.pos);\r\n this.pos += 4;\r\n return value;\r\n};\r\n\r\n/**\r\n * Reads a double (64 bit float) as a number.\r\n * @function\r\n * @returns {number} Value read\r\n */\r\nReader.prototype.double = function read_double() {\r\n\r\n /* istanbul ignore if */\r\n if (this.pos + 8 > this.len)\r\n throw indexOutOfRange(this, 4);\r\n\r\n var value = util.float.readDoubleLE(this.buf, this.pos);\r\n this.pos += 8;\r\n return value;\r\n};\r\n\r\n/**\r\n * Reads a sequence of bytes preceeded by its length as a varint.\r\n * @returns {Uint8Array} Value read\r\n */\r\nReader.prototype.bytes = function read_bytes() {\r\n var length = this.uint32(),\r\n start = this.pos,\r\n end = this.pos + length;\r\n\r\n /* istanbul ignore if */\r\n if (end > this.len)\r\n throw indexOutOfRange(this, length);\r\n\r\n this.pos += length;\r\n if (Array.isArray(this.buf)) // plain array\r\n return this.buf.slice(start, end);\r\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\r\n ? new this.buf.constructor(0)\r\n : this._slice.call(this.buf, start, end);\r\n};\r\n\r\n/**\r\n * Reads a string preceeded by its byte length as a varint.\r\n * @returns {string} Value read\r\n */\r\nReader.prototype.string = function read_string() {\r\n var bytes = this.bytes();\r\n return utf8.read(bytes, 0, bytes.length);\r\n};\r\n\r\n/**\r\n * Skips the specified number of bytes if specified, otherwise skips a varint.\r\n * @param {number} [length] Length if known, otherwise a varint is assumed\r\n * @returns {Reader} `this`\r\n */\r\nReader.prototype.skip = function skip(length) {\r\n if (typeof length === \"number\") {\r\n /* istanbul ignore if */\r\n if (this.pos + length > this.len)\r\n throw indexOutOfRange(this, length);\r\n this.pos += length;\r\n } else {\r\n do {\r\n /* istanbul ignore if */\r\n if (this.pos >= this.len)\r\n throw indexOutOfRange(this);\r\n } while (this.buf[this.pos++] & 128);\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Skips the next element of the specified wire type.\r\n * @param {number} wireType Wire type received\r\n * @returns {Reader} `this`\r\n */\r\nReader.prototype.skipType = function(wireType) {\r\n switch (wireType) {\r\n case 0:\r\n this.skip();\r\n break;\r\n case 1:\r\n this.skip(8);\r\n break;\r\n case 2:\r\n this.skip(this.uint32());\r\n break;\r\n case 3:\r\n while ((wireType = this.uint32() & 7) !== 4) {\r\n this.skipType(wireType);\r\n }\r\n break;\r\n case 5:\r\n this.skip(4);\r\n break;\r\n\r\n /* istanbul ignore next */\r\n default:\r\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\r\n }\r\n return this;\r\n};\r\n\r\nReader._configure = function(BufferReader_) {\r\n BufferReader = BufferReader_;\r\n\r\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\r\n util.merge(Reader.prototype, {\r\n\r\n int64: function read_int64() {\r\n return readLongVarint.call(this)[fn](false);\r\n },\r\n\r\n uint64: function read_uint64() {\r\n return readLongVarint.call(this)[fn](true);\r\n },\r\n\r\n sint64: function read_sint64() {\r\n return readLongVarint.call(this).zzDecode()[fn](false);\r\n },\r\n\r\n fixed64: function read_fixed64() {\r\n return readFixed64.call(this)[fn](true);\r\n },\r\n\r\n sfixed64: function read_sfixed64() {\r\n return readFixed64.call(this)[fn](false);\r\n }\r\n\r\n });\r\n};\r\n","\"use strict\";\r\nmodule.exports = BufferReader;\r\n\r\n// extends Reader\r\nvar Reader = require(27);\r\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\r\n\r\nvar util = require(39);\r\n\r\n/**\r\n * Constructs a new buffer reader instance.\r\n * @classdesc Wire format reader using node buffers.\r\n * @extends Reader\r\n * @constructor\r\n * @param {Buffer} buffer Buffer to read from\r\n */\r\nfunction BufferReader(buffer) {\r\n Reader.call(this, buffer);\r\n\r\n /**\r\n * Read buffer.\r\n * @name BufferReader#buf\r\n * @type {Buffer}\r\n */\r\n}\r\n\r\n/* istanbul ignore else */\r\nif (util.Buffer)\r\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\r\n\r\n/**\r\n * @override\r\n */\r\nBufferReader.prototype.string = function read_string_buffer() {\r\n var len = this.uint32(); // modifies pos\r\n return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len));\r\n};\r\n\r\n/**\r\n * Reads a sequence of bytes preceeded by its length as a varint.\r\n * @name BufferReader#bytes\r\n * @function\r\n * @returns {Buffer} Value read\r\n */\r\n","\"use strict\";\r\nmodule.exports = Root;\r\n\r\n// extends Namespace\r\nvar Namespace = require(23);\r\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\r\n\r\nvar Field = require(16),\r\n Enum = require(15),\r\n OneOf = require(25),\r\n util = require(37);\r\n\r\nvar Type, // cyclic\r\n parse, // might be excluded\r\n common; // \"\r\n\r\n/**\r\n * Constructs a new root namespace instance.\r\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\r\n * @extends NamespaceBase\r\n * @constructor\r\n * @param {Object.} [options] Top level options\r\n */\r\nfunction Root(options) {\r\n Namespace.call(this, \"\", options);\r\n\r\n /**\r\n * Deferred extension fields.\r\n * @type {Field[]}\r\n */\r\n this.deferred = [];\r\n\r\n /**\r\n * Resolved file names of loaded files.\r\n * @type {string[]}\r\n */\r\n this.files = [];\r\n}\r\n\r\n/**\r\n * Loads a namespace descriptor into a root namespace.\r\n * @param {INamespace} json Nameespace descriptor\r\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\r\n * @returns {Root} Root namespace\r\n */\r\nRoot.fromJSON = function fromJSON(json, root) {\r\n if (!root)\r\n root = new Root();\r\n if (json.options)\r\n root.setOptions(json.options);\r\n return root.addJSON(json.nested);\r\n};\r\n\r\n/**\r\n * Resolves the path of an imported file, relative to the importing origin.\r\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\r\n * @function\r\n * @param {string} origin The file name of the importing file\r\n * @param {string} target The file name being imported\r\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\r\n */\r\nRoot.prototype.resolvePath = util.path.resolve;\r\n\r\n// A symbol-like function to safely signal synchronous loading\r\n/* istanbul ignore next */\r\nfunction SYNC() {} // eslint-disable-line no-empty-function\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\r\n * @param {string|string[]} filename Names of one or multiple files to load\r\n * @param {IParseOptions} options Parse options\r\n * @param {LoadCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nRoot.prototype.load = function load(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = undefined;\r\n }\r\n var self = this;\r\n if (!callback)\r\n return util.asPromise(load, self, filename, options);\r\n\r\n var sync = callback === SYNC; // undocumented\r\n\r\n // Finishes loading by calling the callback (exactly once)\r\n function finish(err, root) {\r\n /* istanbul ignore if */\r\n if (!callback)\r\n return;\r\n var cb = callback;\r\n callback = null;\r\n if (sync)\r\n throw err;\r\n cb(err, root);\r\n }\r\n\r\n // Processes a single file\r\n function process(filename, source) {\r\n try {\r\n if (util.isString(source) && source.charAt(0) === \"{\")\r\n source = JSON.parse(source);\r\n if (!util.isString(source))\r\n self.setOptions(source.options).addJSON(source.nested);\r\n else {\r\n parse.filename = filename;\r\n var parsed = parse(source, self, options),\r\n resolved,\r\n i = 0;\r\n if (parsed.imports)\r\n for (; i < parsed.imports.length; ++i)\r\n if (resolved = self.resolvePath(filename, parsed.imports[i]))\r\n fetch(resolved);\r\n if (parsed.weakImports)\r\n for (i = 0; i < parsed.weakImports.length; ++i)\r\n if (resolved = self.resolvePath(filename, parsed.weakImports[i]))\r\n fetch(resolved, true);\r\n }\r\n } catch (err) {\r\n finish(err);\r\n }\r\n if (!sync && !queued)\r\n finish(null, self); // only once anyway\r\n }\r\n\r\n // Fetches a single file\r\n function fetch(filename, weak) {\r\n\r\n // Strip path if this file references a bundled definition\r\n var idx = filename.lastIndexOf(\"google/protobuf/\");\r\n if (idx > -1) {\r\n var altname = filename.substring(idx);\r\n if (altname in common)\r\n filename = altname;\r\n }\r\n\r\n // Skip if already loaded / attempted\r\n if (self.files.indexOf(filename) > -1)\r\n return;\r\n self.files.push(filename);\r\n\r\n // Shortcut bundled definitions\r\n if (filename in common) {\r\n if (sync)\r\n process(filename, common[filename]);\r\n else {\r\n ++queued;\r\n setTimeout(function() {\r\n --queued;\r\n process(filename, common[filename]);\r\n });\r\n }\r\n return;\r\n }\r\n\r\n // Otherwise fetch from disk or network\r\n if (sync) {\r\n var source;\r\n try {\r\n source = util.fs.readFileSync(filename).toString(\"utf8\");\r\n } catch (err) {\r\n if (!weak)\r\n finish(err);\r\n return;\r\n }\r\n process(filename, source);\r\n } else {\r\n ++queued;\r\n util.fetch(filename, function(err, source) {\r\n --queued;\r\n /* istanbul ignore if */\r\n if (!callback)\r\n return; // terminated meanwhile\r\n if (err) {\r\n /* istanbul ignore else */\r\n if (!weak)\r\n finish(err);\r\n else if (!queued) // can't be covered reliably\r\n finish(null, self);\r\n return;\r\n }\r\n process(filename, source);\r\n });\r\n }\r\n }\r\n var queued = 0;\r\n\r\n // Assembling the root namespace doesn't require working type\r\n // references anymore, so we can load everything in parallel\r\n if (util.isString(filename))\r\n filename = [ filename ];\r\n for (var i = 0, resolved; i < filename.length; ++i)\r\n if (resolved = self.resolvePath(\"\", filename[i]))\r\n fetch(resolved);\r\n\r\n if (sync)\r\n return self;\r\n if (!queued)\r\n finish(null, self);\r\n return undefined;\r\n};\r\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\r\n * @function Root#load\r\n * @param {string|string[]} filename Names of one or multiple files to load\r\n * @param {LoadCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n// function load(filename:string, callback:LoadCallback):undefined\r\n\r\n/**\r\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\r\n * @function Root#load\r\n * @param {string|string[]} filename Names of one or multiple files to load\r\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n// function load(filename:string, [options:IParseOptions]):Promise\r\n\r\n/**\r\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\r\n * @function Root#loadSync\r\n * @param {string|string[]} filename Names of one or multiple files to load\r\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\r\n * @returns {Root} Root namespace\r\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\r\n */\r\nRoot.prototype.loadSync = function loadSync(filename, options) {\r\n if (!util.isNode)\r\n throw Error(\"not supported\");\r\n return this.load(filename, options, SYNC);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nRoot.prototype.resolveAll = function resolveAll() {\r\n if (this.deferred.length)\r\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\r\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\r\n }).join(\", \"));\r\n return Namespace.prototype.resolveAll.call(this);\r\n};\r\n\r\n// only uppercased (and thus conflict-free) children are exposed, see below\r\nvar exposeRe = /^[A-Z]/;\r\n\r\n/**\r\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\r\n * @param {Root} root Root instance\r\n * @param {Field} field Declaring extension field witin the declaring type\r\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\r\n * @inner\r\n * @ignore\r\n */\r\nfunction tryHandleExtension(root, field) {\r\n var extendedType = field.parent.lookup(field.extend);\r\n if (extendedType) {\r\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\r\n sisterField.declaringField = field;\r\n field.extensionField = sisterField;\r\n extendedType.add(sisterField);\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Called when any object is added to this root or its sub-namespaces.\r\n * @param {ReflectionObject} object Object added\r\n * @returns {undefined}\r\n * @private\r\n */\r\nRoot.prototype._handleAdd = function _handleAdd(object) {\r\n if (object instanceof Field) {\r\n\r\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\r\n if (!tryHandleExtension(this, object))\r\n this.deferred.push(object);\r\n\r\n } else if (object instanceof Enum) {\r\n\r\n if (exposeRe.test(object.name))\r\n object.parent[object.name] = object.values; // expose enum values as property of its parent\r\n\r\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\r\n\r\n if (object instanceof Type) // Try to handle any deferred extensions\r\n for (var i = 0; i < this.deferred.length;)\r\n if (tryHandleExtension(this, this.deferred[i]))\r\n this.deferred.splice(i, 1);\r\n else\r\n ++i;\r\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\r\n this._handleAdd(object._nestedArray[j]);\r\n if (exposeRe.test(object.name))\r\n object.parent[object.name] = object; // expose namespace as property of its parent\r\n }\r\n\r\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\r\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\r\n // a static module with reflection-based solutions where the condition is met.\r\n};\r\n\r\n/**\r\n * Called when any object is removed from this root or its sub-namespaces.\r\n * @param {ReflectionObject} object Object removed\r\n * @returns {undefined}\r\n * @private\r\n */\r\nRoot.prototype._handleRemove = function _handleRemove(object) {\r\n if (object instanceof Field) {\r\n\r\n if (/* an extension field */ object.extend !== undefined) {\r\n if (/* already handled */ object.extensionField) { // remove its sister field\r\n object.extensionField.parent.remove(object.extensionField);\r\n object.extensionField = null;\r\n } else { // cancel the extension\r\n var index = this.deferred.indexOf(object);\r\n /* istanbul ignore else */\r\n if (index > -1)\r\n this.deferred.splice(index, 1);\r\n }\r\n }\r\n\r\n } else if (object instanceof Enum) {\r\n\r\n if (exposeRe.test(object.name))\r\n delete object.parent[object.name]; // unexpose enum values\r\n\r\n } else if (object instanceof Namespace) {\r\n\r\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\r\n this._handleRemove(object._nestedArray[i]);\r\n\r\n if (exposeRe.test(object.name))\r\n delete object.parent[object.name]; // unexpose namespaces\r\n\r\n }\r\n};\r\n\r\n// Sets up cyclic dependencies (called in index-light)\r\nRoot._configure = function(Type_, parse_, common_) {\r\n Type = Type_;\r\n parse = parse_;\r\n common = common_;\r\n};\r\n","\"use strict\";\r\nmodule.exports = {};\r\n\r\n/**\r\n * Named roots.\r\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\r\n * Can also be used manually to make roots available accross modules.\r\n * @name roots\r\n * @type {Object.}\r\n * @example\r\n * // pbjs -r myroot -o compiled.js ...\r\n *\r\n * // in another module:\r\n * require(\"./compiled.js\");\r\n *\r\n * // in any subsequent module:\r\n * var root = protobuf.roots[\"myroot\"];\r\n */\r\n","\"use strict\";\r\n\r\n/**\r\n * Streaming RPC helpers.\r\n * @namespace\r\n */\r\nvar rpc = exports;\r\n\r\n/**\r\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\r\n * @typedef RPCImpl\r\n * @type {function}\r\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\r\n * @param {Uint8Array} requestData Request data\r\n * @param {RPCImplCallback} callback Callback function\r\n * @returns {undefined}\r\n * @example\r\n * function rpcImpl(method, requestData, callback) {\r\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\r\n * throw Error(\"no such method\");\r\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\r\n * callback(err, responseData);\r\n * });\r\n * }\r\n */\r\n\r\n/**\r\n * Node-style callback as used by {@link RPCImpl}.\r\n * @typedef RPCImplCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any, otherwise `null`\r\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\nrpc.Service = require(32);\r\n","\"use strict\";\r\nmodule.exports = Service;\r\n\r\nvar util = require(39);\r\n\r\n// Extends EventEmitter\r\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\r\n\r\n/**\r\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\r\n *\r\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\r\n * @typedef rpc.ServiceMethodCallback\r\n * @template TRes extends Message\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {TRes} [response] Response message\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\r\n * @typedef rpc.ServiceMethod\r\n * @template TReq extends Message\r\n * @template TRes extends Message\r\n * @type {function}\r\n * @param {TReq|Properties} request Request message or plain object\r\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\r\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\r\n */\r\n\r\n/**\r\n * Constructs a new RPC service instance.\r\n * @classdesc An RPC service as returned by {@link Service#create}.\r\n * @exports rpc.Service\r\n * @extends util.EventEmitter\r\n * @constructor\r\n * @param {RPCImpl} rpcImpl RPC implementation\r\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\r\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\r\n */\r\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\r\n\r\n if (typeof rpcImpl !== \"function\")\r\n throw TypeError(\"rpcImpl must be a function\");\r\n\r\n util.EventEmitter.call(this);\r\n\r\n /**\r\n * RPC implementation. Becomes `null` once the service is ended.\r\n * @type {RPCImpl|null}\r\n */\r\n this.rpcImpl = rpcImpl;\r\n\r\n /**\r\n * Whether requests are length-delimited.\r\n * @type {boolean}\r\n */\r\n this.requestDelimited = Boolean(requestDelimited);\r\n\r\n /**\r\n * Whether responses are length-delimited.\r\n * @type {boolean}\r\n */\r\n this.responseDelimited = Boolean(responseDelimited);\r\n}\r\n\r\n/**\r\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\r\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\r\n * @param {Constructor} requestCtor Request constructor\r\n * @param {Constructor} responseCtor Response constructor\r\n * @param {TReq|Properties} request Request message or plain object\r\n * @param {rpc.ServiceMethodCallback} callback Service callback\r\n * @returns {undefined}\r\n * @template TReq extends Message\r\n * @template TRes extends Message\r\n */\r\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\r\n\r\n if (!request)\r\n throw TypeError(\"request must be specified\");\r\n\r\n var self = this;\r\n if (!callback)\r\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\r\n\r\n if (!self.rpcImpl) {\r\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\r\n return undefined;\r\n }\r\n\r\n try {\r\n return self.rpcImpl(\r\n method,\r\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\r\n function rpcCallback(err, response) {\r\n\r\n if (err) {\r\n self.emit(\"error\", err, method);\r\n return callback(err);\r\n }\r\n\r\n if (response === null) {\r\n self.end(/* endedByRPC */ true);\r\n return undefined;\r\n }\r\n\r\n if (!(response instanceof responseCtor)) {\r\n try {\r\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\r\n } catch (err) {\r\n self.emit(\"error\", err, method);\r\n return callback(err);\r\n }\r\n }\r\n\r\n self.emit(\"data\", response, method);\r\n return callback(null, response);\r\n }\r\n );\r\n } catch (err) {\r\n self.emit(\"error\", err, method);\r\n setTimeout(function() { callback(err); }, 0);\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * Ends this service and emits the `end` event.\r\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\r\n * @returns {rpc.Service} `this`\r\n */\r\nService.prototype.end = function end(endedByRPC) {\r\n if (this.rpcImpl) {\r\n if (!endedByRPC) // signal end to rpcImpl\r\n this.rpcImpl(null, null, null);\r\n this.rpcImpl = null;\r\n this.emit(\"end\").off();\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = Service;\r\n\r\n// extends Namespace\r\nvar Namespace = require(23);\r\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\r\n\r\nvar Method = require(22),\r\n util = require(37),\r\n rpc = require(31);\r\n\r\n/**\r\n * Constructs a new service instance.\r\n * @classdesc Reflected service.\r\n * @extends NamespaceBase\r\n * @constructor\r\n * @param {string} name Service name\r\n * @param {Object.} [options] Service options\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nfunction Service(name, options) {\r\n Namespace.call(this, name, options);\r\n\r\n /**\r\n * Service methods.\r\n * @type {Object.}\r\n */\r\n this.methods = {}; // toJSON, marker\r\n\r\n /**\r\n * Cached methods as an array.\r\n * @type {Method[]|null}\r\n * @private\r\n */\r\n this._methodsArray = null;\r\n}\r\n\r\n/**\r\n * Service descriptor.\r\n * @interface IService\r\n * @extends INamespace\r\n * @property {Object.} methods Method descriptors\r\n */\r\n\r\n/**\r\n * Constructs a service from a service descriptor.\r\n * @param {string} name Service name\r\n * @param {IService} json Service descriptor\r\n * @returns {Service} Created service\r\n * @throws {TypeError} If arguments are invalid\r\n */\r\nService.fromJSON = function fromJSON(name, json) {\r\n var service = new Service(name, json.options);\r\n /* istanbul ignore else */\r\n if (json.methods)\r\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\r\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\r\n if (json.nested)\r\n service.addJSON(json.nested);\r\n service.comment = json.comment;\r\n return service;\r\n};\r\n\r\n/**\r\n * Converts this service to a service descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IService} Service descriptor\r\n */\r\nService.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"options\" , inherited && inherited.options || undefined,\r\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\r\n \"nested\" , inherited && inherited.nested || undefined,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * Methods of this service as an array for iteration.\r\n * @name Service#methodsArray\r\n * @type {Method[]}\r\n * @readonly\r\n */\r\nObject.defineProperty(Service.prototype, \"methodsArray\", {\r\n get: function() {\r\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\r\n }\r\n});\r\n\r\nfunction clearCache(service) {\r\n service._methodsArray = null;\r\n return service;\r\n}\r\n\r\n/**\r\n * @override\r\n */\r\nService.prototype.get = function get(name) {\r\n return this.methods[name]\r\n || Namespace.prototype.get.call(this, name);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nService.prototype.resolveAll = function resolveAll() {\r\n var methods = this.methodsArray;\r\n for (var i = 0; i < methods.length; ++i)\r\n methods[i].resolve();\r\n return Namespace.prototype.resolve.call(this);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nService.prototype.add = function add(object) {\r\n\r\n /* istanbul ignore if */\r\n if (this.get(object.name))\r\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\r\n\r\n if (object instanceof Method) {\r\n this.methods[object.name] = object;\r\n object.parent = this;\r\n return clearCache(this);\r\n }\r\n return Namespace.prototype.add.call(this, object);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nService.prototype.remove = function remove(object) {\r\n if (object instanceof Method) {\r\n\r\n /* istanbul ignore if */\r\n if (this.methods[object.name] !== object)\r\n throw Error(object + \" is not a member of \" + this);\r\n\r\n delete this.methods[object.name];\r\n object.parent = null;\r\n return clearCache(this);\r\n }\r\n return Namespace.prototype.remove.call(this, object);\r\n};\r\n\r\n/**\r\n * Creates a runtime service using the specified rpc implementation.\r\n * @param {RPCImpl} rpcImpl RPC implementation\r\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\r\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\r\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\r\n */\r\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\r\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\r\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\r\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\r\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\r\n m: method,\r\n q: method.resolvedRequestType.ctor,\r\n s: method.resolvedResponseType.ctor\r\n });\r\n }\r\n return rpcService;\r\n};\r\n","\"use strict\";\r\nmodule.exports = tokenize;\r\n\r\nvar delimRe = /[\\s{}=;:[\\],'\"()<>]/g,\r\n stringDoubleRe = /(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\")/g,\r\n stringSingleRe = /(?:'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')/g;\r\n\r\nvar setCommentRe = /^ *[*/]+ */,\r\n setCommentAltRe = /^\\s*\\*?\\/*/,\r\n setCommentSplitRe = /\\n/g,\r\n whitespaceRe = /\\s/,\r\n unescapeRe = /\\\\(.?)/g;\r\n\r\nvar unescapeMap = {\r\n \"0\": \"\\0\",\r\n \"r\": \"\\r\",\r\n \"n\": \"\\n\",\r\n \"t\": \"\\t\"\r\n};\r\n\r\n/**\r\n * Unescapes a string.\r\n * @param {string} str String to unescape\r\n * @returns {string} Unescaped string\r\n * @property {Object.} map Special characters map\r\n * @memberof tokenize\r\n */\r\nfunction unescape(str) {\r\n return str.replace(unescapeRe, function($0, $1) {\r\n switch ($1) {\r\n case \"\\\\\":\r\n case \"\":\r\n return $1;\r\n default:\r\n return unescapeMap[$1] || \"\";\r\n }\r\n });\r\n}\r\n\r\ntokenize.unescape = unescape;\r\n\r\n/**\r\n * Gets the next token and advances.\r\n * @typedef TokenizerHandleNext\r\n * @type {function}\r\n * @returns {string|null} Next token or `null` on eof\r\n */\r\n\r\n/**\r\n * Peeks for the next token.\r\n * @typedef TokenizerHandlePeek\r\n * @type {function}\r\n * @returns {string|null} Next token or `null` on eof\r\n */\r\n\r\n/**\r\n * Pushes a token back to the stack.\r\n * @typedef TokenizerHandlePush\r\n * @type {function}\r\n * @param {string} token Token\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Skips the next token.\r\n * @typedef TokenizerHandleSkip\r\n * @type {function}\r\n * @param {string} expected Expected token\r\n * @param {boolean} [optional=false] If optional\r\n * @returns {boolean} Whether the token matched\r\n * @throws {Error} If the token didn't match and is not optional\r\n */\r\n\r\n/**\r\n * Gets the comment on the previous line or, alternatively, the line comment on the specified line.\r\n * @typedef TokenizerHandleCmnt\r\n * @type {function}\r\n * @param {number} [line] Line number\r\n * @returns {string|null} Comment text or `null` if none\r\n */\r\n\r\n/**\r\n * Handle object returned from {@link tokenize}.\r\n * @interface ITokenizerHandle\r\n * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof)\r\n * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof)\r\n * @property {TokenizerHandlePush} push Pushes a token back to the stack\r\n * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws\r\n * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any\r\n * @property {number} line Current line number\r\n */\r\n\r\n/**\r\n * Tokenizes the given .proto source and returns an object with useful utility functions.\r\n * @param {string} source Source contents\r\n * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode.\r\n * @returns {ITokenizerHandle} Tokenizer handle\r\n */\r\nfunction tokenize(source, alternateCommentMode) {\r\n /* eslint-disable callback-return */\r\n source = source.toString();\r\n\r\n var offset = 0,\r\n length = source.length,\r\n line = 1,\r\n commentType = null,\r\n commentText = null,\r\n commentLine = 0,\r\n commentLineEmpty = false;\r\n\r\n var stack = [];\r\n\r\n var stringDelim = null;\r\n\r\n /* istanbul ignore next */\r\n /**\r\n * Creates an error for illegal syntax.\r\n * @param {string} subject Subject\r\n * @returns {Error} Error created\r\n * @inner\r\n */\r\n function illegal(subject) {\r\n return Error(\"illegal \" + subject + \" (line \" + line + \")\");\r\n }\r\n\r\n /**\r\n * Reads a string till its end.\r\n * @returns {string} String read\r\n * @inner\r\n */\r\n function readString() {\r\n var re = stringDelim === \"'\" ? stringSingleRe : stringDoubleRe;\r\n re.lastIndex = offset - 1;\r\n var match = re.exec(source);\r\n if (!match)\r\n throw illegal(\"string\");\r\n offset = re.lastIndex;\r\n push(stringDelim);\r\n stringDelim = null;\r\n return unescape(match[1]);\r\n }\r\n\r\n /**\r\n * Gets the character at `pos` within the source.\r\n * @param {number} pos Position\r\n * @returns {string} Character\r\n * @inner\r\n */\r\n function charAt(pos) {\r\n return source.charAt(pos);\r\n }\r\n\r\n /**\r\n * Sets the current comment text.\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {undefined}\r\n * @inner\r\n */\r\n function setComment(start, end) {\r\n commentType = source.charAt(start++);\r\n commentLine = line;\r\n commentLineEmpty = false;\r\n var lookback;\r\n if (alternateCommentMode) {\r\n lookback = 2; // alternate comment parsing: \"//\" or \"/*\"\r\n } else {\r\n lookback = 3; // \"///\" or \"/**\"\r\n }\r\n var commentOffset = start - lookback,\r\n c;\r\n do {\r\n if (--commentOffset < 0 ||\r\n (c = source.charAt(commentOffset)) === \"\\n\") {\r\n commentLineEmpty = true;\r\n break;\r\n }\r\n } while (c === \" \" || c === \"\\t\");\r\n var lines = source\r\n .substring(start, end)\r\n .split(setCommentSplitRe);\r\n for (var i = 0; i < lines.length; ++i)\r\n lines[i] = lines[i]\r\n .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, \"\")\r\n .trim();\r\n commentText = lines\r\n .join(\"\\n\")\r\n .trim();\r\n }\r\n\r\n function isDoubleSlashCommentLine(startOffset) {\r\n var endOffset = findEndOfLine(startOffset);\r\n\r\n // see if remaining line matches comment pattern\r\n var lineText = source.substring(startOffset, endOffset);\r\n // look for 1 or 2 slashes since startOffset would already point past\r\n // the first slash that started the comment.\r\n var isComment = /^\\s*\\/{1,2}/.test(lineText);\r\n return isComment;\r\n }\r\n\r\n function findEndOfLine(cursor) {\r\n // find end of cursor's line\r\n var endOffset = cursor;\r\n while (endOffset < length && charAt(endOffset) !== \"\\n\") {\r\n endOffset++;\r\n }\r\n return endOffset;\r\n }\r\n\r\n /**\r\n * Obtains the next token.\r\n * @returns {string|null} Next token or `null` on eof\r\n * @inner\r\n */\r\n function next() {\r\n if (stack.length > 0)\r\n return stack.shift();\r\n if (stringDelim)\r\n return readString();\r\n var repeat,\r\n prev,\r\n curr,\r\n start,\r\n isDoc;\r\n do {\r\n if (offset === length)\r\n return null;\r\n repeat = false;\r\n while (whitespaceRe.test(curr = charAt(offset))) {\r\n if (curr === \"\\n\")\r\n ++line;\r\n if (++offset === length)\r\n return null;\r\n }\r\n\r\n if (charAt(offset) === \"/\") {\r\n if (++offset === length) {\r\n throw illegal(\"comment\");\r\n }\r\n if (charAt(offset) === \"/\") { // Line\r\n if (!alternateCommentMode) {\r\n // check for triple-slash comment\r\n isDoc = charAt(start = offset + 1) === \"/\";\r\n\r\n while (charAt(++offset) !== \"\\n\") {\r\n if (offset === length) {\r\n return null;\r\n }\r\n }\r\n ++offset;\r\n if (isDoc) {\r\n setComment(start, offset - 1);\r\n }\r\n ++line;\r\n repeat = true;\r\n } else {\r\n // check for double-slash comments, consolidating consecutive lines\r\n start = offset;\r\n isDoc = false;\r\n if (isDoubleSlashCommentLine(offset)) {\r\n isDoc = true;\r\n do {\r\n offset = findEndOfLine(offset);\r\n if (offset === length) {\r\n break;\r\n }\r\n offset++;\r\n } while (isDoubleSlashCommentLine(offset));\r\n } else {\r\n offset = Math.min(length, findEndOfLine(offset) + 1);\r\n }\r\n if (isDoc) {\r\n setComment(start, offset);\r\n }\r\n line++;\r\n repeat = true;\r\n }\r\n } else if ((curr = charAt(offset)) === \"*\") { /* Block */\r\n // check for /** (regular comment mode) or /* (alternate comment mode)\r\n start = offset + 1;\r\n isDoc = alternateCommentMode || charAt(start) === \"*\";\r\n do {\r\n if (curr === \"\\n\") {\r\n ++line;\r\n }\r\n if (++offset === length) {\r\n throw illegal(\"comment\");\r\n }\r\n prev = curr;\r\n curr = charAt(offset);\r\n } while (prev !== \"*\" || curr !== \"/\");\r\n ++offset;\r\n if (isDoc) {\r\n setComment(start, offset - 2);\r\n }\r\n repeat = true;\r\n } else {\r\n return \"/\";\r\n }\r\n }\r\n } while (repeat);\r\n\r\n // offset !== length if we got here\r\n\r\n var end = offset;\r\n delimRe.lastIndex = 0;\r\n var delim = delimRe.test(charAt(end++));\r\n if (!delim)\r\n while (end < length && !delimRe.test(charAt(end)))\r\n ++end;\r\n var token = source.substring(offset, offset = end);\r\n if (token === \"\\\"\" || token === \"'\")\r\n stringDelim = token;\r\n return token;\r\n }\r\n\r\n /**\r\n * Pushes a token back to the stack.\r\n * @param {string} token Token\r\n * @returns {undefined}\r\n * @inner\r\n */\r\n function push(token) {\r\n stack.push(token);\r\n }\r\n\r\n /**\r\n * Peeks for the next token.\r\n * @returns {string|null} Token or `null` on eof\r\n * @inner\r\n */\r\n function peek() {\r\n if (!stack.length) {\r\n var token = next();\r\n if (token === null)\r\n return null;\r\n push(token);\r\n }\r\n return stack[0];\r\n }\r\n\r\n /**\r\n * Skips a token.\r\n * @param {string} expected Expected token\r\n * @param {boolean} [optional=false] Whether the token is optional\r\n * @returns {boolean} `true` when skipped, `false` if not\r\n * @throws {Error} When a required token is not present\r\n * @inner\r\n */\r\n function skip(expected, optional) {\r\n var actual = peek(),\r\n equals = actual === expected;\r\n if (equals) {\r\n next();\r\n return true;\r\n }\r\n if (!optional)\r\n throw illegal(\"token '\" + actual + \"', '\" + expected + \"' expected\");\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets a comment.\r\n * @param {number} [trailingLine] Line number if looking for a trailing comment\r\n * @returns {string|null} Comment text\r\n * @inner\r\n */\r\n function cmnt(trailingLine) {\r\n var ret = null;\r\n if (trailingLine === undefined) {\r\n if (commentLine === line - 1 && (alternateCommentMode || commentType === \"*\" || commentLineEmpty)) {\r\n ret = commentText;\r\n }\r\n } else {\r\n /* istanbul ignore else */\r\n if (commentLine < trailingLine) {\r\n peek();\r\n }\r\n if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === \"/\")) {\r\n ret = commentText;\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n return Object.defineProperty({\r\n next: next,\r\n peek: peek,\r\n push: push,\r\n skip: skip,\r\n cmnt: cmnt\r\n }, \"line\", {\r\n get: function() { return line; }\r\n });\r\n /* eslint-enable callback-return */\r\n}\r\n","\"use strict\";\r\nmodule.exports = Type;\r\n\r\n// extends Namespace\r\nvar Namespace = require(23);\r\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\r\n\r\nvar Enum = require(15),\r\n OneOf = require(25),\r\n Field = require(16),\r\n MapField = require(20),\r\n Service = require(33),\r\n Message = require(21),\r\n Reader = require(27),\r\n Writer = require(42),\r\n util = require(37),\r\n encoder = require(14),\r\n decoder = require(13),\r\n verifier = require(40),\r\n converter = require(12),\r\n wrappers = require(41);\r\n\r\n/**\r\n * Constructs a new reflected message type instance.\r\n * @classdesc Reflected message type.\r\n * @extends NamespaceBase\r\n * @constructor\r\n * @param {string} name Message name\r\n * @param {Object.} [options] Declared options\r\n */\r\nfunction Type(name, options) {\r\n Namespace.call(this, name, options);\r\n\r\n /**\r\n * Message fields.\r\n * @type {Object.}\r\n */\r\n this.fields = {}; // toJSON, marker\r\n\r\n /**\r\n * Oneofs declared within this namespace, if any.\r\n * @type {Object.}\r\n */\r\n this.oneofs = undefined; // toJSON\r\n\r\n /**\r\n * Extension ranges, if any.\r\n * @type {number[][]}\r\n */\r\n this.extensions = undefined; // toJSON\r\n\r\n /**\r\n * Reserved ranges, if any.\r\n * @type {Array.}\r\n */\r\n this.reserved = undefined; // toJSON\r\n\r\n /*?\r\n * Whether this type is a legacy group.\r\n * @type {boolean|undefined}\r\n */\r\n this.group = undefined; // toJSON\r\n\r\n /**\r\n * Cached fields by id.\r\n * @type {Object.|null}\r\n * @private\r\n */\r\n this._fieldsById = null;\r\n\r\n /**\r\n * Cached fields as an array.\r\n * @type {Field[]|null}\r\n * @private\r\n */\r\n this._fieldsArray = null;\r\n\r\n /**\r\n * Cached oneofs as an array.\r\n * @type {OneOf[]|null}\r\n * @private\r\n */\r\n this._oneofsArray = null;\r\n\r\n /**\r\n * Cached constructor.\r\n * @type {Constructor<{}>}\r\n * @private\r\n */\r\n this._ctor = null;\r\n}\r\n\r\nObject.defineProperties(Type.prototype, {\r\n\r\n /**\r\n * Message fields by id.\r\n * @name Type#fieldsById\r\n * @type {Object.}\r\n * @readonly\r\n */\r\n fieldsById: {\r\n get: function() {\r\n\r\n /* istanbul ignore if */\r\n if (this._fieldsById)\r\n return this._fieldsById;\r\n\r\n this._fieldsById = {};\r\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\r\n var field = this.fields[names[i]],\r\n id = field.id;\r\n\r\n /* istanbul ignore if */\r\n if (this._fieldsById[id])\r\n throw Error(\"duplicate id \" + id + \" in \" + this);\r\n\r\n this._fieldsById[id] = field;\r\n }\r\n return this._fieldsById;\r\n }\r\n },\r\n\r\n /**\r\n * Fields of this message as an array for iteration.\r\n * @name Type#fieldsArray\r\n * @type {Field[]}\r\n * @readonly\r\n */\r\n fieldsArray: {\r\n get: function() {\r\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\r\n }\r\n },\r\n\r\n /**\r\n * Oneofs of this message as an array for iteration.\r\n * @name Type#oneofsArray\r\n * @type {OneOf[]}\r\n * @readonly\r\n */\r\n oneofsArray: {\r\n get: function() {\r\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\r\n }\r\n },\r\n\r\n /**\r\n * The registered constructor, if any registered, otherwise a generic constructor.\r\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\r\n * @name Type#ctor\r\n * @type {Constructor<{}>}\r\n */\r\n ctor: {\r\n get: function() {\r\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\r\n },\r\n set: function(ctor) {\r\n\r\n // Ensure proper prototype\r\n var prototype = ctor.prototype;\r\n if (!(prototype instanceof Message)) {\r\n (ctor.prototype = new Message()).constructor = ctor;\r\n util.merge(ctor.prototype, prototype);\r\n }\r\n\r\n // Classes and messages reference their reflected type\r\n ctor.$type = ctor.prototype.$type = this;\r\n\r\n // Mix in static methods\r\n util.merge(ctor, Message, true);\r\n\r\n this._ctor = ctor;\r\n\r\n // Messages have non-enumerable default values on their prototype\r\n var i = 0;\r\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\r\n this._fieldsArray[i].resolve(); // ensures a proper value\r\n\r\n // Messages have non-enumerable getters and setters for each virtual oneof field\r\n var ctorProperties = {};\r\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\r\n ctorProperties[this._oneofsArray[i].resolve().name] = {\r\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\r\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\r\n };\r\n if (i)\r\n Object.defineProperties(ctor.prototype, ctorProperties);\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * Generates a constructor function for the specified type.\r\n * @param {Type} mtype Message type\r\n * @returns {Codegen} Codegen instance\r\n */\r\nType.generateConstructor = function generateConstructor(mtype) {\r\n /* eslint-disable no-unexpected-multiline */\r\n var gen = util.codegen([\"p\"], mtype.name);\r\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\r\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\r\n if ((field = mtype._fieldsArray[i]).map) gen\r\n (\"this%s={}\", util.safeProp(field.name));\r\n else if (field.repeated) gen\r\n (\"this%s=[]\", util.safeProp(field.name));\r\n return gen\r\n (\"if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors\r\n * @property {Object.} fields Field descriptors\r\n * @property {number[][]} [extensions] Extension ranges\r\n * @property {number[][]} [reserved] Reserved ranges\r\n * @property {boolean} [group=false] Whether a legacy group or not\r\n */\r\n\r\n/**\r\n * Creates a message type from a message type descriptor.\r\n * @param {string} name Message name\r\n * @param {IType} json Message type descriptor\r\n * @returns {Type} Created message type\r\n */\r\nType.fromJSON = function fromJSON(name, json) {\r\n var type = new Type(name, json.options);\r\n type.extensions = json.extensions;\r\n type.reserved = json.reserved;\r\n var names = Object.keys(json.fields),\r\n i = 0;\r\n for (; i < names.length; ++i)\r\n type.add(\r\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\r\n ? MapField.fromJSON\r\n : Field.fromJSON )(names[i], json.fields[names[i]])\r\n );\r\n if (json.oneofs)\r\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\r\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\r\n if (json.nested)\r\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\r\n var nested = json.nested[names[i]];\r\n type.add( // most to least likely\r\n ( nested.id !== undefined\r\n ? Field.fromJSON\r\n : nested.fields !== undefined\r\n ? Type.fromJSON\r\n : nested.values !== undefined\r\n ? Enum.fromJSON\r\n : nested.methods !== undefined\r\n ? Service.fromJSON\r\n : Namespace.fromJSON )(names[i], nested)\r\n );\r\n }\r\n if (json.extensions && json.extensions.length)\r\n type.extensions = json.extensions;\r\n if (json.reserved && json.reserved.length)\r\n type.reserved = json.reserved;\r\n if (json.group)\r\n type.group = true;\r\n if (json.comment)\r\n type.comment = json.comment;\r\n return type;\r\n};\r\n\r\n/**\r\n * Converts this message type to a message type descriptor.\r\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\r\n * @returns {IType} Message type descriptor\r\n */\r\nType.prototype.toJSON = function toJSON(toJSONOptions) {\r\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\r\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\r\n return util.toObject([\r\n \"options\" , inherited && inherited.options || undefined,\r\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\r\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\r\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\r\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\r\n \"group\" , this.group || undefined,\r\n \"nested\" , inherited && inherited.nested || undefined,\r\n \"comment\" , keepComments ? this.comment : undefined\r\n ]);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nType.prototype.resolveAll = function resolveAll() {\r\n var fields = this.fieldsArray, i = 0;\r\n while (i < fields.length)\r\n fields[i++].resolve();\r\n var oneofs = this.oneofsArray; i = 0;\r\n while (i < oneofs.length)\r\n oneofs[i++].resolve();\r\n return Namespace.prototype.resolveAll.call(this);\r\n};\r\n\r\n/**\r\n * @override\r\n */\r\nType.prototype.get = function get(name) {\r\n return this.fields[name]\r\n || this.oneofs && this.oneofs[name]\r\n || this.nested && this.nested[name]\r\n || null;\r\n};\r\n\r\n/**\r\n * Adds a nested object to this type.\r\n * @param {ReflectionObject} object Nested object to add\r\n * @returns {Type} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\r\n */\r\nType.prototype.add = function add(object) {\r\n\r\n if (this.get(object.name))\r\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\r\n\r\n if (object instanceof Field && object.extend === undefined) {\r\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\r\n // The root object takes care of adding distinct sister-fields to the respective extended\r\n // type instead.\r\n\r\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\r\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\r\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\r\n if (this.isReservedId(object.id))\r\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\r\n if (this.isReservedName(object.name))\r\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\r\n\r\n if (object.parent)\r\n object.parent.remove(object);\r\n this.fields[object.name] = object;\r\n object.message = this;\r\n object.onAdd(this);\r\n return clearCache(this);\r\n }\r\n if (object instanceof OneOf) {\r\n if (!this.oneofs)\r\n this.oneofs = {};\r\n this.oneofs[object.name] = object;\r\n object.onAdd(this);\r\n return clearCache(this);\r\n }\r\n return Namespace.prototype.add.call(this, object);\r\n};\r\n\r\n/**\r\n * Removes a nested object from this type.\r\n * @param {ReflectionObject} object Nested object to remove\r\n * @returns {Type} `this`\r\n * @throws {TypeError} If arguments are invalid\r\n * @throws {Error} If `object` is not a member of this type\r\n */\r\nType.prototype.remove = function remove(object) {\r\n if (object instanceof Field && object.extend === undefined) {\r\n // See Type#add for the reason why extension fields are excluded here.\r\n\r\n /* istanbul ignore if */\r\n if (!this.fields || this.fields[object.name] !== object)\r\n throw Error(object + \" is not a member of \" + this);\r\n\r\n delete this.fields[object.name];\r\n object.parent = null;\r\n object.onRemove(this);\r\n return clearCache(this);\r\n }\r\n if (object instanceof OneOf) {\r\n\r\n /* istanbul ignore if */\r\n if (!this.oneofs || this.oneofs[object.name] !== object)\r\n throw Error(object + \" is not a member of \" + this);\r\n\r\n delete this.oneofs[object.name];\r\n object.parent = null;\r\n object.onRemove(this);\r\n return clearCache(this);\r\n }\r\n return Namespace.prototype.remove.call(this, object);\r\n};\r\n\r\n/**\r\n * Tests if the specified id is reserved.\r\n * @param {number} id Id to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nType.prototype.isReservedId = function isReservedId(id) {\r\n return Namespace.isReservedId(this.reserved, id);\r\n};\r\n\r\n/**\r\n * Tests if the specified name is reserved.\r\n * @param {string} name Name to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nType.prototype.isReservedName = function isReservedName(name) {\r\n return Namespace.isReservedName(this.reserved, name);\r\n};\r\n\r\n/**\r\n * Creates a new message of this type using the specified properties.\r\n * @param {Object.} [properties] Properties to set\r\n * @returns {Message<{}>} Message instance\r\n */\r\nType.prototype.create = function create(properties) {\r\n return new this.ctor(properties);\r\n};\r\n\r\n/**\r\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\r\n * @returns {Type} `this`\r\n */\r\nType.prototype.setup = function setup() {\r\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\r\n // multiple times (V8, soft-deopt prototype-check).\r\n\r\n var fullName = this.fullName,\r\n types = [];\r\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\r\n types.push(this._fieldsArray[i].resolve().resolvedType);\r\n\r\n // Replace setup methods with type-specific generated functions\r\n this.encode = encoder(this)({\r\n Writer : Writer,\r\n types : types,\r\n util : util\r\n });\r\n this.decode = decoder(this)({\r\n Reader : Reader,\r\n types : types,\r\n util : util\r\n });\r\n this.verify = verifier(this)({\r\n types : types,\r\n util : util\r\n });\r\n this.fromObject = converter.fromObject(this)({\r\n types : types,\r\n util : util\r\n });\r\n this.toObject = converter.toObject(this)({\r\n types : types,\r\n util : util\r\n });\r\n\r\n // Inject custom wrappers for common types\r\n var wrapper = wrappers[fullName];\r\n if (wrapper) {\r\n var originalThis = Object.create(this);\r\n // if (wrapper.fromObject) {\r\n originalThis.fromObject = this.fromObject;\r\n this.fromObject = wrapper.fromObject.bind(originalThis);\r\n // }\r\n // if (wrapper.toObject) {\r\n originalThis.toObject = this.toObject;\r\n this.toObject = wrapper.toObject.bind(originalThis);\r\n // }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\r\n * @param {Message<{}>|Object.} message Message instance or plain object\r\n * @param {Writer} [writer] Writer to encode to\r\n * @returns {Writer} writer\r\n */\r\nType.prototype.encode = function encode_setup(message, writer) {\r\n return this.setup().encode(message, writer); // overrides this method\r\n};\r\n\r\n/**\r\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\r\n * @param {Message<{}>|Object.} message Message instance or plain object\r\n * @param {Writer} [writer] Writer to encode to\r\n * @returns {Writer} writer\r\n */\r\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\r\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\r\n};\r\n\r\n/**\r\n * Decodes a message of this type.\r\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\r\n * @param {number} [length] Length of the message, if known beforehand\r\n * @returns {Message<{}>} Decoded message\r\n * @throws {Error} If the payload is not a reader or valid buffer\r\n * @throws {util.ProtocolError<{}>} If required fields are missing\r\n */\r\nType.prototype.decode = function decode_setup(reader, length) {\r\n return this.setup().decode(reader, length); // overrides this method\r\n};\r\n\r\n/**\r\n * Decodes a message of this type preceeded by its byte length as a varint.\r\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\r\n * @returns {Message<{}>} Decoded message\r\n * @throws {Error} If the payload is not a reader or valid buffer\r\n * @throws {util.ProtocolError} If required fields are missing\r\n */\r\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\r\n if (!(reader instanceof Reader))\r\n reader = Reader.create(reader);\r\n return this.decode(reader, reader.uint32());\r\n};\r\n\r\n/**\r\n * Verifies that field values are valid and that required fields are present.\r\n * @param {Object.} message Plain object to verify\r\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\r\n */\r\nType.prototype.verify = function verify_setup(message) {\r\n return this.setup().verify(message); // overrides this method\r\n};\r\n\r\n/**\r\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\r\n * @param {Object.} object Plain object to convert\r\n * @returns {Message<{}>} Message instance\r\n */\r\nType.prototype.fromObject = function fromObject(object) {\r\n return this.setup().fromObject(object);\r\n};\r\n\r\n/**\r\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\r\n * @interface IConversionOptions\r\n * @property {Function} [longs] Long conversion type.\r\n * Valid values are `String` and `Number` (the global types).\r\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\r\n * @property {Function} [enums] Enum value conversion type.\r\n * Only valid value is `String` (the global type).\r\n * Defaults to copy the present value, which is the numeric id.\r\n * @property {Function} [bytes] Bytes value conversion type.\r\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\r\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\r\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\r\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\r\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\r\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\r\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\r\n */\r\n\r\n/**\r\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\r\n * @param {Message<{}>} message Message instance\r\n * @param {IConversionOptions} [options] Conversion options\r\n * @returns {Object.} Plain object\r\n */\r\nType.prototype.toObject = function toObject(message, options) {\r\n return this.setup().toObject(message, options);\r\n};\r\n\r\n/**\r\n * Decorator function as returned by {@link Type.d} (TypeScript).\r\n * @typedef TypeDecorator\r\n * @type {function}\r\n * @param {Constructor} target Target constructor\r\n * @returns {undefined}\r\n * @template T extends Message\r\n */\r\n\r\n/**\r\n * Type decorator (TypeScript).\r\n * @param {string} [typeName] Type name, defaults to the constructor's name\r\n * @returns {TypeDecorator} Decorator function\r\n * @template T extends Message\r\n */\r\nType.d = function decorateType(typeName) {\r\n return function typeDecorator(target) {\r\n util.decorateType(target, typeName);\r\n };\r\n};\r\n","\"use strict\";\r\n\r\n/**\r\n * Common type constants.\r\n * @namespace\r\n */\r\nvar types = exports;\r\n\r\nvar util = require(37);\r\n\r\nvar s = [\r\n \"double\", // 0\r\n \"float\", // 1\r\n \"int32\", // 2\r\n \"uint32\", // 3\r\n \"sint32\", // 4\r\n \"fixed32\", // 5\r\n \"sfixed32\", // 6\r\n \"int64\", // 7\r\n \"uint64\", // 8\r\n \"sint64\", // 9\r\n \"fixed64\", // 10\r\n \"sfixed64\", // 11\r\n \"bool\", // 12\r\n \"string\", // 13\r\n \"bytes\" // 14\r\n];\r\n\r\nfunction bake(values, offset) {\r\n var i = 0, o = {};\r\n offset |= 0;\r\n while (i < values.length) o[s[i + offset]] = values[i++];\r\n return o;\r\n}\r\n\r\n/**\r\n * Basic type wire types.\r\n * @type {Object.}\r\n * @const\r\n * @property {number} double=1 Fixed64 wire type\r\n * @property {number} float=5 Fixed32 wire type\r\n * @property {number} int32=0 Varint wire type\r\n * @property {number} uint32=0 Varint wire type\r\n * @property {number} sint32=0 Varint wire type\r\n * @property {number} fixed32=5 Fixed32 wire type\r\n * @property {number} sfixed32=5 Fixed32 wire type\r\n * @property {number} int64=0 Varint wire type\r\n * @property {number} uint64=0 Varint wire type\r\n * @property {number} sint64=0 Varint wire type\r\n * @property {number} fixed64=1 Fixed64 wire type\r\n * @property {number} sfixed64=1 Fixed64 wire type\r\n * @property {number} bool=0 Varint wire type\r\n * @property {number} string=2 Ldelim wire type\r\n * @property {number} bytes=2 Ldelim wire type\r\n */\r\ntypes.basic = bake([\r\n /* double */ 1,\r\n /* float */ 5,\r\n /* int32 */ 0,\r\n /* uint32 */ 0,\r\n /* sint32 */ 0,\r\n /* fixed32 */ 5,\r\n /* sfixed32 */ 5,\r\n /* int64 */ 0,\r\n /* uint64 */ 0,\r\n /* sint64 */ 0,\r\n /* fixed64 */ 1,\r\n /* sfixed64 */ 1,\r\n /* bool */ 0,\r\n /* string */ 2,\r\n /* bytes */ 2\r\n]);\r\n\r\n/**\r\n * Basic type defaults.\r\n * @type {Object.}\r\n * @const\r\n * @property {number} double=0 Double default\r\n * @property {number} float=0 Float default\r\n * @property {number} int32=0 Int32 default\r\n * @property {number} uint32=0 Uint32 default\r\n * @property {number} sint32=0 Sint32 default\r\n * @property {number} fixed32=0 Fixed32 default\r\n * @property {number} sfixed32=0 Sfixed32 default\r\n * @property {number} int64=0 Int64 default\r\n * @property {number} uint64=0 Uint64 default\r\n * @property {number} sint64=0 Sint32 default\r\n * @property {number} fixed64=0 Fixed64 default\r\n * @property {number} sfixed64=0 Sfixed64 default\r\n * @property {boolean} bool=false Bool default\r\n * @property {string} string=\"\" String default\r\n * @property {Array.} bytes=Array(0) Bytes default\r\n * @property {null} message=null Message default\r\n */\r\ntypes.defaults = bake([\r\n /* double */ 0,\r\n /* float */ 0,\r\n /* int32 */ 0,\r\n /* uint32 */ 0,\r\n /* sint32 */ 0,\r\n /* fixed32 */ 0,\r\n /* sfixed32 */ 0,\r\n /* int64 */ 0,\r\n /* uint64 */ 0,\r\n /* sint64 */ 0,\r\n /* fixed64 */ 0,\r\n /* sfixed64 */ 0,\r\n /* bool */ false,\r\n /* string */ \"\",\r\n /* bytes */ util.emptyArray,\r\n /* message */ null\r\n]);\r\n\r\n/**\r\n * Basic long type wire types.\r\n * @type {Object.}\r\n * @const\r\n * @property {number} int64=0 Varint wire type\r\n * @property {number} uint64=0 Varint wire type\r\n * @property {number} sint64=0 Varint wire type\r\n * @property {number} fixed64=1 Fixed64 wire type\r\n * @property {number} sfixed64=1 Fixed64 wire type\r\n */\r\ntypes.long = bake([\r\n /* int64 */ 0,\r\n /* uint64 */ 0,\r\n /* sint64 */ 0,\r\n /* fixed64 */ 1,\r\n /* sfixed64 */ 1\r\n], 7);\r\n\r\n/**\r\n * Allowed types for map keys with their associated wire type.\r\n * @type {Object.}\r\n * @const\r\n * @property {number} int32=0 Varint wire type\r\n * @property {number} uint32=0 Varint wire type\r\n * @property {number} sint32=0 Varint wire type\r\n * @property {number} fixed32=5 Fixed32 wire type\r\n * @property {number} sfixed32=5 Fixed32 wire type\r\n * @property {number} int64=0 Varint wire type\r\n * @property {number} uint64=0 Varint wire type\r\n * @property {number} sint64=0 Varint wire type\r\n * @property {number} fixed64=1 Fixed64 wire type\r\n * @property {number} sfixed64=1 Fixed64 wire type\r\n * @property {number} bool=0 Varint wire type\r\n * @property {number} string=2 Ldelim wire type\r\n */\r\ntypes.mapKey = bake([\r\n /* int32 */ 0,\r\n /* uint32 */ 0,\r\n /* sint32 */ 0,\r\n /* fixed32 */ 5,\r\n /* sfixed32 */ 5,\r\n /* int64 */ 0,\r\n /* uint64 */ 0,\r\n /* sint64 */ 0,\r\n /* fixed64 */ 1,\r\n /* sfixed64 */ 1,\r\n /* bool */ 0,\r\n /* string */ 2\r\n], 2);\r\n\r\n/**\r\n * Allowed types for packed repeated fields with their associated wire type.\r\n * @type {Object.}\r\n * @const\r\n * @property {number} double=1 Fixed64 wire type\r\n * @property {number} float=5 Fixed32 wire type\r\n * @property {number} int32=0 Varint wire type\r\n * @property {number} uint32=0 Varint wire type\r\n * @property {number} sint32=0 Varint wire type\r\n * @property {number} fixed32=5 Fixed32 wire type\r\n * @property {number} sfixed32=5 Fixed32 wire type\r\n * @property {number} int64=0 Varint wire type\r\n * @property {number} uint64=0 Varint wire type\r\n * @property {number} sint64=0 Varint wire type\r\n * @property {number} fixed64=1 Fixed64 wire type\r\n * @property {number} sfixed64=1 Fixed64 wire type\r\n * @property {number} bool=0 Varint wire type\r\n */\r\ntypes.packed = bake([\r\n /* double */ 1,\r\n /* float */ 5,\r\n /* int32 */ 0,\r\n /* uint32 */ 0,\r\n /* sint32 */ 0,\r\n /* fixed32 */ 5,\r\n /* sfixed32 */ 5,\r\n /* int64 */ 0,\r\n /* uint64 */ 0,\r\n /* sint64 */ 0,\r\n /* fixed64 */ 1,\r\n /* sfixed64 */ 1,\r\n /* bool */ 0\r\n]);\r\n","\"use strict\";\r\n\r\n/**\r\n * Various utility functions.\r\n * @namespace\r\n */\r\nvar util = module.exports = require(39);\r\n\r\nvar roots = require(30);\r\n\r\nvar Type, // cyclic\r\n Enum;\r\n\r\nutil.codegen = require(3);\r\nutil.fetch = require(5);\r\nutil.path = require(8);\r\n\r\n/**\r\n * Node's fs module if available.\r\n * @type {Object.}\r\n */\r\nutil.fs = util.inquire(\"fs\");\r\n\r\n/**\r\n * Converts an object's values to an array.\r\n * @param {Object.} object Object to convert\r\n * @returns {Array.<*>} Converted array\r\n */\r\nutil.toArray = function toArray(object) {\r\n if (object) {\r\n var keys = Object.keys(object),\r\n array = new Array(keys.length),\r\n index = 0;\r\n while (index < keys.length)\r\n array[index] = object[keys[index++]];\r\n return array;\r\n }\r\n return [];\r\n};\r\n\r\n/**\r\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\r\n * @param {Array.<*>} array Array to convert\r\n * @returns {Object.} Converted object\r\n */\r\nutil.toObject = function toObject(array) {\r\n var object = {},\r\n index = 0;\r\n while (index < array.length) {\r\n var key = array[index++],\r\n val = array[index++];\r\n if (val !== undefined)\r\n object[key] = val;\r\n }\r\n return object;\r\n};\r\n\r\nvar safePropBackslashRe = /\\\\/g,\r\n safePropQuoteRe = /\"/g;\r\n\r\n/**\r\n * Tests whether the specified name is a reserved word in JS.\r\n * @param {string} name Name to test\r\n * @returns {boolean} `true` if reserved, otherwise `false`\r\n */\r\nutil.isReserved = function isReserved(name) {\r\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\r\n};\r\n\r\n/**\r\n * Returns a safe property accessor for the specified property name.\r\n * @param {string} prop Property name\r\n * @returns {string} Safe accessor\r\n */\r\nutil.safeProp = function safeProp(prop) {\r\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\r\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\r\n return \".\" + prop;\r\n};\r\n\r\n/**\r\n * Converts the first character of a string to upper case.\r\n * @param {string} str String to convert\r\n * @returns {string} Converted string\r\n */\r\nutil.ucFirst = function ucFirst(str) {\r\n return str.charAt(0).toUpperCase() + str.substring(1);\r\n};\r\n\r\nvar camelCaseRe = /_([a-z])/g;\r\n\r\n/**\r\n * Converts a string to camel case.\r\n * @param {string} str String to convert\r\n * @returns {string} Converted string\r\n */\r\nutil.camelCase = function camelCase(str) {\r\n return str.substring(0, 1)\r\n + str.substring(1)\r\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\r\n};\r\n\r\n/**\r\n * Compares reflected fields by id.\r\n * @param {Field} a First field\r\n * @param {Field} b Second field\r\n * @returns {number} Comparison value\r\n */\r\nutil.compareFieldsById = function compareFieldsById(a, b) {\r\n return a.id - b.id;\r\n};\r\n\r\n/**\r\n * Decorator helper for types (TypeScript).\r\n * @param {Constructor} ctor Constructor function\r\n * @param {string} [typeName] Type name, defaults to the constructor's name\r\n * @returns {Type} Reflected type\r\n * @template T extends Message\r\n * @property {Root} root Decorators root\r\n */\r\nutil.decorateType = function decorateType(ctor, typeName) {\r\n\r\n /* istanbul ignore if */\r\n if (ctor.$type) {\r\n if (typeName && ctor.$type.name !== typeName) {\r\n util.decorateRoot.remove(ctor.$type);\r\n ctor.$type.name = typeName;\r\n util.decorateRoot.add(ctor.$type);\r\n }\r\n return ctor.$type;\r\n }\r\n\r\n /* istanbul ignore next */\r\n if (!Type)\r\n Type = require(35);\r\n\r\n var type = new Type(typeName || ctor.name);\r\n util.decorateRoot.add(type);\r\n type.ctor = ctor; // sets up .encode, .decode etc.\r\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\r\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\r\n return type;\r\n};\r\n\r\nvar decorateEnumIndex = 0;\r\n\r\n/**\r\n * Decorator helper for enums (TypeScript).\r\n * @param {Object} object Enum object\r\n * @returns {Enum} Reflected enum\r\n */\r\nutil.decorateEnum = function decorateEnum(object) {\r\n\r\n /* istanbul ignore if */\r\n if (object.$type)\r\n return object.$type;\r\n\r\n /* istanbul ignore next */\r\n if (!Enum)\r\n Enum = require(15);\r\n\r\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\r\n util.decorateRoot.add(enm);\r\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\r\n return enm;\r\n};\r\n\r\n/**\r\n * Decorator root (TypeScript).\r\n * @name util.decorateRoot\r\n * @type {Root}\r\n * @readonly\r\n */\r\nObject.defineProperty(util, \"decorateRoot\", {\r\n get: function() {\r\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (require(29))());\r\n }\r\n});\r\n","\"use strict\";\r\nmodule.exports = LongBits;\r\n\r\nvar util = require(39);\r\n\r\n/**\r\n * Constructs new long bits.\r\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\r\n * @memberof util\r\n * @constructor\r\n * @param {number} lo Low 32 bits, unsigned\r\n * @param {number} hi High 32 bits, unsigned\r\n */\r\nfunction LongBits(lo, hi) {\r\n\r\n // note that the casts below are theoretically unnecessary as of today, but older statically\r\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\r\n\r\n /**\r\n * Low bits.\r\n * @type {number}\r\n */\r\n this.lo = lo >>> 0;\r\n\r\n /**\r\n * High bits.\r\n * @type {number}\r\n */\r\n this.hi = hi >>> 0;\r\n}\r\n\r\n/**\r\n * Zero bits.\r\n * @memberof util.LongBits\r\n * @type {util.LongBits}\r\n */\r\nvar zero = LongBits.zero = new LongBits(0, 0);\r\n\r\nzero.toNumber = function() { return 0; };\r\nzero.zzEncode = zero.zzDecode = function() { return this; };\r\nzero.length = function() { return 1; };\r\n\r\n/**\r\n * Zero hash.\r\n * @memberof util.LongBits\r\n * @type {string}\r\n */\r\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\r\n\r\n/**\r\n * Constructs new long bits from the specified number.\r\n * @param {number} value Value\r\n * @returns {util.LongBits} Instance\r\n */\r\nLongBits.fromNumber = function fromNumber(value) {\r\n if (value === 0)\r\n return zero;\r\n var sign = value < 0;\r\n if (sign)\r\n value = -value;\r\n var lo = value >>> 0,\r\n hi = (value - lo) / 4294967296 >>> 0;\r\n if (sign) {\r\n hi = ~hi >>> 0;\r\n lo = ~lo >>> 0;\r\n if (++lo > 4294967295) {\r\n lo = 0;\r\n if (++hi > 4294967295)\r\n hi = 0;\r\n }\r\n }\r\n return new LongBits(lo, hi);\r\n};\r\n\r\n/**\r\n * Constructs new long bits from a number, long or string.\r\n * @param {Long|number|string} value Value\r\n * @returns {util.LongBits} Instance\r\n */\r\nLongBits.from = function from(value) {\r\n if (typeof value === \"number\")\r\n return LongBits.fromNumber(value);\r\n if (util.isString(value)) {\r\n /* istanbul ignore else */\r\n if (util.Long)\r\n value = util.Long.fromString(value);\r\n else\r\n return LongBits.fromNumber(parseInt(value, 10));\r\n }\r\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\r\n};\r\n\r\n/**\r\n * Converts this long bits to a possibly unsafe JavaScript number.\r\n * @param {boolean} [unsigned=false] Whether unsigned or not\r\n * @returns {number} Possibly unsafe number\r\n */\r\nLongBits.prototype.toNumber = function toNumber(unsigned) {\r\n if (!unsigned && this.hi >>> 31) {\r\n var lo = ~this.lo + 1 >>> 0,\r\n hi = ~this.hi >>> 0;\r\n if (!lo)\r\n hi = hi + 1 >>> 0;\r\n return -(lo + hi * 4294967296);\r\n }\r\n return this.lo + this.hi * 4294967296;\r\n};\r\n\r\n/**\r\n * Converts this long bits to a long.\r\n * @param {boolean} [unsigned=false] Whether unsigned or not\r\n * @returns {Long} Long\r\n */\r\nLongBits.prototype.toLong = function toLong(unsigned) {\r\n return util.Long\r\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\r\n /* istanbul ignore next */\r\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\r\n};\r\n\r\nvar charCodeAt = String.prototype.charCodeAt;\r\n\r\n/**\r\n * Constructs new long bits from the specified 8 characters long hash.\r\n * @param {string} hash Hash\r\n * @returns {util.LongBits} Bits\r\n */\r\nLongBits.fromHash = function fromHash(hash) {\r\n if (hash === zeroHash)\r\n return zero;\r\n return new LongBits(\r\n ( charCodeAt.call(hash, 0)\r\n | charCodeAt.call(hash, 1) << 8\r\n | charCodeAt.call(hash, 2) << 16\r\n | charCodeAt.call(hash, 3) << 24) >>> 0\r\n ,\r\n ( charCodeAt.call(hash, 4)\r\n | charCodeAt.call(hash, 5) << 8\r\n | charCodeAt.call(hash, 6) << 16\r\n | charCodeAt.call(hash, 7) << 24) >>> 0\r\n );\r\n};\r\n\r\n/**\r\n * Converts this long bits to a 8 characters long hash.\r\n * @returns {string} Hash\r\n */\r\nLongBits.prototype.toHash = function toHash() {\r\n return String.fromCharCode(\r\n this.lo & 255,\r\n this.lo >>> 8 & 255,\r\n this.lo >>> 16 & 255,\r\n this.lo >>> 24 ,\r\n this.hi & 255,\r\n this.hi >>> 8 & 255,\r\n this.hi >>> 16 & 255,\r\n this.hi >>> 24\r\n );\r\n};\r\n\r\n/**\r\n * Zig-zag encodes this long bits.\r\n * @returns {util.LongBits} `this`\r\n */\r\nLongBits.prototype.zzEncode = function zzEncode() {\r\n var mask = this.hi >> 31;\r\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\r\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\r\n return this;\r\n};\r\n\r\n/**\r\n * Zig-zag decodes this long bits.\r\n * @returns {util.LongBits} `this`\r\n */\r\nLongBits.prototype.zzDecode = function zzDecode() {\r\n var mask = -(this.lo & 1);\r\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\r\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\r\n return this;\r\n};\r\n\r\n/**\r\n * Calculates the length of this longbits when encoded as a varint.\r\n * @returns {number} Length\r\n */\r\nLongBits.prototype.length = function length() {\r\n var part0 = this.lo,\r\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\r\n part2 = this.hi >>> 24;\r\n return part2 === 0\r\n ? part1 === 0\r\n ? part0 < 16384\r\n ? part0 < 128 ? 1 : 2\r\n : part0 < 2097152 ? 3 : 4\r\n : part1 < 16384\r\n ? part1 < 128 ? 5 : 6\r\n : part1 < 2097152 ? 7 : 8\r\n : part2 < 128 ? 9 : 10;\r\n};\r\n","\"use strict\";\r\nvar util = exports;\r\n\r\n// used to return a Promise where callback is omitted\r\nutil.asPromise = require(1);\r\n\r\n// converts to / from base64 encoded strings\r\nutil.base64 = require(2);\r\n\r\n// base class of rpc.Service\r\nutil.EventEmitter = require(4);\r\n\r\n// float handling accross browsers\r\nutil.float = require(6);\r\n\r\n// requires modules optionally and hides the call from bundlers\r\nutil.inquire = require(7);\r\n\r\n// converts to / from utf8 encoded strings\r\nutil.utf8 = require(10);\r\n\r\n// provides a node-like buffer pool in the browser\r\nutil.pool = require(9);\r\n\r\n// utility to work with the low and high bits of a 64 bit value\r\nutil.LongBits = require(38);\r\n\r\n// global object reference\r\nutil.global = typeof window !== \"undefined\" && window\r\n || typeof global !== \"undefined\" && global\r\n || typeof self !== \"undefined\" && self\r\n || this; // eslint-disable-line no-invalid-this\r\n\r\n/**\r\n * An immuable empty array.\r\n * @memberof util\r\n * @type {Array.<*>}\r\n * @const\r\n */\r\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\r\n\r\n/**\r\n * An immutable empty object.\r\n * @type {Object}\r\n * @const\r\n */\r\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\r\n\r\n/**\r\n * Whether running within node or not.\r\n * @memberof util\r\n * @type {boolean}\r\n * @const\r\n */\r\nutil.isNode = Boolean(util.global.process && util.global.process.versions && util.global.process.versions.node);\r\n\r\n/**\r\n * Tests if the specified value is an integer.\r\n * @function\r\n * @param {*} value Value to test\r\n * @returns {boolean} `true` if the value is an integer\r\n */\r\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\r\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\r\n};\r\n\r\n/**\r\n * Tests if the specified value is a string.\r\n * @param {*} value Value to test\r\n * @returns {boolean} `true` if the value is a string\r\n */\r\nutil.isString = function isString(value) {\r\n return typeof value === \"string\" || value instanceof String;\r\n};\r\n\r\n/**\r\n * Tests if the specified value is a non-null object.\r\n * @param {*} value Value to test\r\n * @returns {boolean} `true` if the value is a non-null object\r\n */\r\nutil.isObject = function isObject(value) {\r\n return value && typeof value === \"object\";\r\n};\r\n\r\n/**\r\n * Checks if a property on a message is considered to be present.\r\n * This is an alias of {@link util.isSet}.\r\n * @function\r\n * @param {Object} obj Plain object or message instance\r\n * @param {string} prop Property name\r\n * @returns {boolean} `true` if considered to be present, otherwise `false`\r\n */\r\nutil.isset =\r\n\r\n/**\r\n * Checks if a property on a message is considered to be present.\r\n * @param {Object} obj Plain object or message instance\r\n * @param {string} prop Property name\r\n * @returns {boolean} `true` if considered to be present, otherwise `false`\r\n */\r\nutil.isSet = function isSet(obj, prop) {\r\n var value = obj[prop];\r\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\r\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\r\n return false;\r\n};\r\n\r\n/**\r\n * Any compatible Buffer instance.\r\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\r\n * @interface Buffer\r\n * @extends Uint8Array\r\n */\r\n\r\n/**\r\n * Node's Buffer class if available.\r\n * @type {Constructor}\r\n */\r\nutil.Buffer = (function() {\r\n try {\r\n var Buffer = util.inquire(\"buffer\").Buffer;\r\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\r\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\r\n } catch (e) {\r\n /* istanbul ignore next */\r\n return null;\r\n }\r\n})();\r\n\r\n// Internal alias of or polyfull for Buffer.from.\r\nutil._Buffer_from = null;\r\n\r\n// Internal alias of or polyfill for Buffer.allocUnsafe.\r\nutil._Buffer_allocUnsafe = null;\r\n\r\n/**\r\n * Creates a new buffer of whatever type supported by the environment.\r\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\r\n * @returns {Uint8Array|Buffer} Buffer\r\n */\r\nutil.newBuffer = function newBuffer(sizeOrArray) {\r\n /* istanbul ignore next */\r\n return typeof sizeOrArray === \"number\"\r\n ? util.Buffer\r\n ? util._Buffer_allocUnsafe(sizeOrArray)\r\n : new util.Array(sizeOrArray)\r\n : util.Buffer\r\n ? util._Buffer_from(sizeOrArray)\r\n : typeof Uint8Array === \"undefined\"\r\n ? sizeOrArray\r\n : new Uint8Array(sizeOrArray);\r\n};\r\n\r\n/**\r\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\r\n * @type {Constructor}\r\n */\r\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\r\n\r\n/**\r\n * Any compatible Long instance.\r\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\r\n * @interface Long\r\n * @property {number} low Low bits\r\n * @property {number} high High bits\r\n * @property {boolean} unsigned Whether unsigned or not\r\n */\r\n\r\n/**\r\n * Long.js's Long class if available.\r\n * @type {Constructor}\r\n */\r\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\r\n || /* istanbul ignore next */ util.global.Long\r\n || util.inquire(\"long\");\r\n\r\n/**\r\n * Regular expression used to verify 2 bit (`bool`) map keys.\r\n * @type {RegExp}\r\n * @const\r\n */\r\nutil.key2Re = /^true|false|0|1$/;\r\n\r\n/**\r\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\r\n * @type {RegExp}\r\n * @const\r\n */\r\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\r\n\r\n/**\r\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\r\n * @type {RegExp}\r\n * @const\r\n */\r\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\r\n\r\n/**\r\n * Converts a number or long to an 8 characters long hash string.\r\n * @param {Long|number} value Value to convert\r\n * @returns {string} Hash\r\n */\r\nutil.longToHash = function longToHash(value) {\r\n return value\r\n ? util.LongBits.from(value).toHash()\r\n : util.LongBits.zeroHash;\r\n};\r\n\r\n/**\r\n * Converts an 8 characters long hash string to a long or number.\r\n * @param {string} hash Hash\r\n * @param {boolean} [unsigned=false] Whether unsigned or not\r\n * @returns {Long|number} Original value\r\n */\r\nutil.longFromHash = function longFromHash(hash, unsigned) {\r\n var bits = util.LongBits.fromHash(hash);\r\n if (util.Long)\r\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\r\n return bits.toNumber(Boolean(unsigned));\r\n};\r\n\r\n/**\r\n * Merges the properties of the source object into the destination object.\r\n * @memberof util\r\n * @param {Object.} dst Destination object\r\n * @param {Object.} src Source object\r\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\r\n * @returns {Object.} Destination object\r\n */\r\nfunction merge(dst, src, ifNotSet) { // used by converters\r\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\r\n if (dst[keys[i]] === undefined || !ifNotSet)\r\n dst[keys[i]] = src[keys[i]];\r\n return dst;\r\n}\r\n\r\nutil.merge = merge;\r\n\r\n/**\r\n * Converts the first character of a string to lower case.\r\n * @param {string} str String to convert\r\n * @returns {string} Converted string\r\n */\r\nutil.lcFirst = function lcFirst(str) {\r\n return str.charAt(0).toLowerCase() + str.substring(1);\r\n};\r\n\r\n/**\r\n * Creates a custom error constructor.\r\n * @memberof util\r\n * @param {string} name Error name\r\n * @returns {Constructor} Custom error constructor\r\n */\r\nfunction newError(name) {\r\n\r\n function CustomError(message, properties) {\r\n\r\n if (!(this instanceof CustomError))\r\n return new CustomError(message, properties);\r\n\r\n // Error.call(this, message);\r\n // ^ just returns a new error instance because the ctor can be called as a function\r\n\r\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\r\n\r\n /* istanbul ignore next */\r\n if (Error.captureStackTrace) // node\r\n Error.captureStackTrace(this, CustomError);\r\n else\r\n Object.defineProperty(this, \"stack\", { value: (new Error()).stack || \"\" });\r\n\r\n if (properties)\r\n merge(this, properties);\r\n }\r\n\r\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\r\n\r\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\r\n\r\n CustomError.prototype.toString = function toString() {\r\n return this.name + \": \" + this.message;\r\n };\r\n\r\n return CustomError;\r\n}\r\n\r\nutil.newError = newError;\r\n\r\n/**\r\n * Constructs a new protocol error.\r\n * @classdesc Error subclass indicating a protocol specifc error.\r\n * @memberof util\r\n * @extends Error\r\n * @template T extends Message\r\n * @constructor\r\n * @param {string} message Error message\r\n * @param {Object.} [properties] Additional properties\r\n * @example\r\n * try {\r\n * MyMessage.decode(someBuffer); // throws if required fields are missing\r\n * } catch (e) {\r\n * if (e instanceof ProtocolError && e.instance)\r\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\r\n * }\r\n */\r\nutil.ProtocolError = newError(\"ProtocolError\");\r\n\r\n/**\r\n * So far decoded message instance.\r\n * @name util.ProtocolError#instance\r\n * @type {Message}\r\n */\r\n\r\n/**\r\n * A OneOf getter as returned by {@link util.oneOfGetter}.\r\n * @typedef OneOfGetter\r\n * @type {function}\r\n * @returns {string|undefined} Set field name, if any\r\n */\r\n\r\n/**\r\n * Builds a getter for a oneof's present field name.\r\n * @param {string[]} fieldNames Field names\r\n * @returns {OneOfGetter} Unbound getter\r\n */\r\nutil.oneOfGetter = function getOneOf(fieldNames) {\r\n var fieldMap = {};\r\n for (var i = 0; i < fieldNames.length; ++i)\r\n fieldMap[fieldNames[i]] = 1;\r\n\r\n /**\r\n * @returns {string|undefined} Set field name, if any\r\n * @this Object\r\n * @ignore\r\n */\r\n return function() { // eslint-disable-line consistent-return\r\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\r\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\r\n return keys[i];\r\n };\r\n};\r\n\r\n/**\r\n * A OneOf setter as returned by {@link util.oneOfSetter}.\r\n * @typedef OneOfSetter\r\n * @type {function}\r\n * @param {string|undefined} value Field name\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Builds a setter for a oneof's present field name.\r\n * @param {string[]} fieldNames Field names\r\n * @returns {OneOfSetter} Unbound setter\r\n */\r\nutil.oneOfSetter = function setOneOf(fieldNames) {\r\n\r\n /**\r\n * @param {string} name Field name\r\n * @returns {undefined}\r\n * @this Object\r\n * @ignore\r\n */\r\n return function(name) {\r\n for (var i = 0; i < fieldNames.length; ++i)\r\n if (fieldNames[i] !== name)\r\n delete this[fieldNames[i]];\r\n };\r\n};\r\n\r\n/**\r\n * Default conversion options used for {@link Message#toJSON} implementations.\r\n *\r\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\r\n *\r\n * - Longs become strings\r\n * - Enums become string keys\r\n * - Bytes become base64 encoded strings\r\n * - (Sub-)Messages become plain objects\r\n * - Maps become plain objects with all string keys\r\n * - Repeated fields become arrays\r\n * - NaN and Infinity for float and double fields become strings\r\n *\r\n * @type {IConversionOptions}\r\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\r\n */\r\nutil.toJSONOptions = {\r\n longs: String,\r\n enums: String,\r\n bytes: String,\r\n json: true\r\n};\r\n\r\n// Sets up buffer utility according to the environment (called in index-minimal)\r\nutil._configure = function() {\r\n var Buffer = util.Buffer;\r\n /* istanbul ignore if */\r\n if (!Buffer) {\r\n util._Buffer_from = util._Buffer_allocUnsafe = null;\r\n return;\r\n }\r\n // because node 4.x buffers are incompatible & immutable\r\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\r\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\r\n /* istanbul ignore next */\r\n function Buffer_from(value, encoding) {\r\n return new Buffer(value, encoding);\r\n };\r\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\r\n /* istanbul ignore next */\r\n function Buffer_allocUnsafe(size) {\r\n return new Buffer(size);\r\n };\r\n};\r\n","\"use strict\";\r\nmodule.exports = verifier;\r\n\r\nvar Enum = require(15),\r\n util = require(37);\r\n\r\nfunction invalid(field, expected) {\r\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\r\n}\r\n\r\n/**\r\n * Generates a partial value verifier.\r\n * @param {Codegen} gen Codegen instance\r\n * @param {Field} field Reflected field\r\n * @param {number} fieldIndex Field index\r\n * @param {string} ref Variable reference\r\n * @returns {Codegen} Codegen instance\r\n * @ignore\r\n */\r\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\r\n /* eslint-disable no-unexpected-multiline */\r\n if (field.resolvedType) {\r\n if (field.resolvedType instanceof Enum) { gen\r\n (\"switch(%s){\", ref)\r\n (\"default:\")\r\n (\"return%j\", invalid(field, \"enum value\"));\r\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\r\n (\"case %i:\", field.resolvedType.values[keys[j]]);\r\n gen\r\n (\"break\")\r\n (\"}\");\r\n } else {\r\n gen\r\n (\"{\")\r\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\r\n (\"if(e)\")\r\n (\"return%j+e\", field.name + \".\")\r\n (\"}\");\r\n }\r\n } else {\r\n switch (field.type) {\r\n case \"int32\":\r\n case \"uint32\":\r\n case \"sint32\":\r\n case \"fixed32\":\r\n case \"sfixed32\": gen\r\n (\"if(!util.isInteger(%s))\", ref)\r\n (\"return%j\", invalid(field, \"integer\"));\r\n break;\r\n case \"int64\":\r\n case \"uint64\":\r\n case \"sint64\":\r\n case \"fixed64\":\r\n case \"sfixed64\": gen\r\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\r\n (\"return%j\", invalid(field, \"integer|Long\"));\r\n break;\r\n case \"float\":\r\n case \"double\": gen\r\n (\"if(typeof %s!==\\\"number\\\")\", ref)\r\n (\"return%j\", invalid(field, \"number\"));\r\n break;\r\n case \"bool\": gen\r\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\r\n (\"return%j\", invalid(field, \"boolean\"));\r\n break;\r\n case \"string\": gen\r\n (\"if(!util.isString(%s))\", ref)\r\n (\"return%j\", invalid(field, \"string\"));\r\n break;\r\n case \"bytes\": gen\r\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\r\n (\"return%j\", invalid(field, \"buffer\"));\r\n break;\r\n }\r\n }\r\n return gen;\r\n /* eslint-enable no-unexpected-multiline */\r\n}\r\n\r\n/**\r\n * Generates a partial key verifier.\r\n * @param {Codegen} gen Codegen instance\r\n * @param {Field} field Reflected field\r\n * @param {string} ref Variable reference\r\n * @returns {Codegen} Codegen instance\r\n * @ignore\r\n */\r\nfunction genVerifyKey(gen, field, ref) {\r\n /* eslint-disable no-unexpected-multiline */\r\n switch (field.keyType) {\r\n case \"int32\":\r\n case \"uint32\":\r\n case \"sint32\":\r\n case \"fixed32\":\r\n case \"sfixed32\": gen\r\n (\"if(!util.key32Re.test(%s))\", ref)\r\n (\"return%j\", invalid(field, \"integer key\"));\r\n break;\r\n case \"int64\":\r\n case \"uint64\":\r\n case \"sint64\":\r\n case \"fixed64\":\r\n case \"sfixed64\": gen\r\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\r\n (\"return%j\", invalid(field, \"integer|Long key\"));\r\n break;\r\n case \"bool\": gen\r\n (\"if(!util.key2Re.test(%s))\", ref)\r\n (\"return%j\", invalid(field, \"boolean key\"));\r\n break;\r\n }\r\n return gen;\r\n /* eslint-enable no-unexpected-multiline */\r\n}\r\n\r\n/**\r\n * Generates a verifier specific to the specified message type.\r\n * @param {Type} mtype Message type\r\n * @returns {Codegen} Codegen instance\r\n */\r\nfunction verifier(mtype) {\r\n /* eslint-disable no-unexpected-multiline */\r\n\r\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\r\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\r\n (\"return%j\", \"object expected\");\r\n var oneofs = mtype.oneofsArray,\r\n seenFirstField = {};\r\n if (oneofs.length) gen\r\n (\"var p={}\");\r\n\r\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\r\n var field = mtype._fieldsArray[i].resolve(),\r\n ref = \"m\" + util.safeProp(field.name);\r\n\r\n if (field.optional) gen\r\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\r\n\r\n // map fields\r\n if (field.map) { gen\r\n (\"if(!util.isObject(%s))\", ref)\r\n (\"return%j\", invalid(field, \"object\"))\r\n (\"var k=Object.keys(%s)\", ref)\r\n (\"for(var i=0;i}\r\n * @const\r\n */\r\nvar wrappers = exports;\r\n\r\nvar Message = require(21);\r\n\r\n/**\r\n * From object converter part of an {@link IWrapper}.\r\n * @typedef WrapperFromObjectConverter\r\n * @type {function}\r\n * @param {Object.} object Plain object\r\n * @returns {Message<{}>} Message instance\r\n * @this Type\r\n */\r\n\r\n/**\r\n * To object converter part of an {@link IWrapper}.\r\n * @typedef WrapperToObjectConverter\r\n * @type {function}\r\n * @param {Message<{}>} message Message instance\r\n * @param {IConversionOptions} [options] Conversion options\r\n * @returns {Object.} Plain object\r\n * @this Type\r\n */\r\n\r\n/**\r\n * Common type wrapper part of {@link wrappers}.\r\n * @interface IWrapper\r\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\r\n * @property {WrapperToObjectConverter} [toObject] To object converter\r\n */\r\n\r\n// Custom wrapper for Any\r\nwrappers[\".google.protobuf.Any\"] = {\r\n\r\n fromObject: function(object) {\r\n\r\n // unwrap value type if mapped\r\n if (object && object[\"@type\"]) {\r\n var type = this.lookup(object[\"@type\"]);\r\n /* istanbul ignore else */\r\n if (type) {\r\n // type_url does not accept leading \".\"\r\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\r\n object[\"@type\"].substr(1) : object[\"@type\"];\r\n // type_url prefix is optional, but path seperator is required\r\n return this.create({\r\n type_url: \"/\" + type_url,\r\n value: type.encode(type.fromObject(object)).finish()\r\n });\r\n }\r\n }\r\n\r\n return this.fromObject(object);\r\n },\r\n\r\n toObject: function(message, options) {\r\n\r\n // decode value if requested and unmapped\r\n if (options && options.json && message.type_url && message.value) {\r\n // Only use fully qualified type name after the last '/'\r\n var name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\r\n var type = this.lookup(name);\r\n /* istanbul ignore else */\r\n if (type)\r\n message = type.decode(message.value);\r\n }\r\n\r\n // wrap value if unmapped\r\n if (!(message instanceof this.ctor) && message instanceof Message) {\r\n var object = message.$type.toObject(message, options);\r\n object[\"@type\"] = message.$type.fullName;\r\n return object;\r\n }\r\n\r\n return this.toObject(message, options);\r\n }\r\n};\r\n","\"use strict\";\r\nmodule.exports = Writer;\r\n\r\nvar util = require(39);\r\n\r\nvar BufferWriter; // cyclic\r\n\r\nvar LongBits = util.LongBits,\r\n base64 = util.base64,\r\n utf8 = util.utf8;\r\n\r\n/**\r\n * Constructs a new writer operation instance.\r\n * @classdesc Scheduled writer operation.\r\n * @constructor\r\n * @param {function(*, Uint8Array, number)} fn Function to call\r\n * @param {number} len Value byte length\r\n * @param {*} val Value to write\r\n * @ignore\r\n */\r\nfunction Op(fn, len, val) {\r\n\r\n /**\r\n * Function to call.\r\n * @type {function(Uint8Array, number, *)}\r\n */\r\n this.fn = fn;\r\n\r\n /**\r\n * Value byte length.\r\n * @type {number}\r\n */\r\n this.len = len;\r\n\r\n /**\r\n * Next operation.\r\n * @type {Writer.Op|undefined}\r\n */\r\n this.next = undefined;\r\n\r\n /**\r\n * Value to write.\r\n * @type {*}\r\n */\r\n this.val = val; // type varies\r\n}\r\n\r\n/* istanbul ignore next */\r\nfunction noop() {} // eslint-disable-line no-empty-function\r\n\r\n/**\r\n * Constructs a new writer state instance.\r\n * @classdesc Copied writer state.\r\n * @memberof Writer\r\n * @constructor\r\n * @param {Writer} writer Writer to copy state from\r\n * @ignore\r\n */\r\nfunction State(writer) {\r\n\r\n /**\r\n * Current head.\r\n * @type {Writer.Op}\r\n */\r\n this.head = writer.head;\r\n\r\n /**\r\n * Current tail.\r\n * @type {Writer.Op}\r\n */\r\n this.tail = writer.tail;\r\n\r\n /**\r\n * Current buffer length.\r\n * @type {number}\r\n */\r\n this.len = writer.len;\r\n\r\n /**\r\n * Next state.\r\n * @type {State|null}\r\n */\r\n this.next = writer.states;\r\n}\r\n\r\n/**\r\n * Constructs a new writer instance.\r\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\r\n * @constructor\r\n */\r\nfunction Writer() {\r\n\r\n /**\r\n * Current length.\r\n * @type {number}\r\n */\r\n this.len = 0;\r\n\r\n /**\r\n * Operations head.\r\n * @type {Object}\r\n */\r\n this.head = new Op(noop, 0, 0);\r\n\r\n /**\r\n * Operations tail\r\n * @type {Object}\r\n */\r\n this.tail = this.head;\r\n\r\n /**\r\n * Linked forked states.\r\n * @type {Object|null}\r\n */\r\n this.states = null;\r\n\r\n // When a value is written, the writer calculates its byte length and puts it into a linked\r\n // list of operations to perform when finish() is called. This both allows us to allocate\r\n // buffers of the exact required size and reduces the amount of work we have to do compared\r\n // to first calculating over objects and then encoding over objects. In our case, the encoding\r\n // part is just a linked list walk calling operations with already prepared values.\r\n}\r\n\r\n/**\r\n * Creates a new writer.\r\n * @function\r\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\r\n */\r\nWriter.create = util.Buffer\r\n ? function create_buffer_setup() {\r\n return (Writer.create = function create_buffer() {\r\n return new BufferWriter();\r\n })();\r\n }\r\n /* istanbul ignore next */\r\n : function create_array() {\r\n return new Writer();\r\n };\r\n\r\n/**\r\n * Allocates a buffer of the specified size.\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\nWriter.alloc = function alloc(size) {\r\n return new util.Array(size);\r\n};\r\n\r\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\r\n/* istanbul ignore else */\r\nif (util.Array !== Array)\r\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\r\n\r\n/**\r\n * Pushes a new operation to the queue.\r\n * @param {function(Uint8Array, number, *)} fn Function to call\r\n * @param {number} len Value byte length\r\n * @param {number} val Value to write\r\n * @returns {Writer} `this`\r\n * @private\r\n */\r\nWriter.prototype._push = function push(fn, len, val) {\r\n this.tail = this.tail.next = new Op(fn, len, val);\r\n this.len += len;\r\n return this;\r\n};\r\n\r\nfunction writeByte(val, buf, pos) {\r\n buf[pos] = val & 255;\r\n}\r\n\r\nfunction writeVarint32(val, buf, pos) {\r\n while (val > 127) {\r\n buf[pos++] = val & 127 | 128;\r\n val >>>= 7;\r\n }\r\n buf[pos] = val;\r\n}\r\n\r\n/**\r\n * Constructs a new varint writer operation instance.\r\n * @classdesc Scheduled varint writer operation.\r\n * @extends Op\r\n * @constructor\r\n * @param {number} len Value byte length\r\n * @param {number} val Value to write\r\n * @ignore\r\n */\r\nfunction VarintOp(len, val) {\r\n this.len = len;\r\n this.next = undefined;\r\n this.val = val;\r\n}\r\n\r\nVarintOp.prototype = Object.create(Op.prototype);\r\nVarintOp.prototype.fn = writeVarint32;\r\n\r\n/**\r\n * Writes an unsigned 32 bit value as a varint.\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.uint32 = function write_uint32(value) {\r\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\r\n // uint32 is by far the most frequently used operation and benefits significantly from this.\r\n this.len += (this.tail = this.tail.next = new VarintOp(\r\n (value = value >>> 0)\r\n < 128 ? 1\r\n : value < 16384 ? 2\r\n : value < 2097152 ? 3\r\n : value < 268435456 ? 4\r\n : 5,\r\n value)).len;\r\n return this;\r\n};\r\n\r\n/**\r\n * Writes a signed 32 bit value as a varint.\r\n * @function\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.int32 = function write_int32(value) {\r\n return value < 0\r\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\r\n : this.uint32(value);\r\n};\r\n\r\n/**\r\n * Writes a 32 bit value as a varint, zig-zag encoded.\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.sint32 = function write_sint32(value) {\r\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\r\n};\r\n\r\nfunction writeVarint64(val, buf, pos) {\r\n while (val.hi) {\r\n buf[pos++] = val.lo & 127 | 128;\r\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\r\n val.hi >>>= 7;\r\n }\r\n while (val.lo > 127) {\r\n buf[pos++] = val.lo & 127 | 128;\r\n val.lo = val.lo >>> 7;\r\n }\r\n buf[pos++] = val.lo;\r\n}\r\n\r\n/**\r\n * Writes an unsigned 64 bit value as a varint.\r\n * @param {Long|number|string} value Value to write\r\n * @returns {Writer} `this`\r\n * @throws {TypeError} If `value` is a string and no long library is present.\r\n */\r\nWriter.prototype.uint64 = function write_uint64(value) {\r\n var bits = LongBits.from(value);\r\n return this._push(writeVarint64, bits.length(), bits);\r\n};\r\n\r\n/**\r\n * Writes a signed 64 bit value as a varint.\r\n * @function\r\n * @param {Long|number|string} value Value to write\r\n * @returns {Writer} `this`\r\n * @throws {TypeError} If `value` is a string and no long library is present.\r\n */\r\nWriter.prototype.int64 = Writer.prototype.uint64;\r\n\r\n/**\r\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\r\n * @param {Long|number|string} value Value to write\r\n * @returns {Writer} `this`\r\n * @throws {TypeError} If `value` is a string and no long library is present.\r\n */\r\nWriter.prototype.sint64 = function write_sint64(value) {\r\n var bits = LongBits.from(value).zzEncode();\r\n return this._push(writeVarint64, bits.length(), bits);\r\n};\r\n\r\n/**\r\n * Writes a boolish value as a varint.\r\n * @param {boolean} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.bool = function write_bool(value) {\r\n return this._push(writeByte, 1, value ? 1 : 0);\r\n};\r\n\r\nfunction writeFixed32(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\n/**\r\n * Writes an unsigned 32 bit value as fixed 32 bits.\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.fixed32 = function write_fixed32(value) {\r\n return this._push(writeFixed32, 4, value >>> 0);\r\n};\r\n\r\n/**\r\n * Writes a signed 32 bit value as fixed 32 bits.\r\n * @function\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\r\n\r\n/**\r\n * Writes an unsigned 64 bit value as fixed 64 bits.\r\n * @param {Long|number|string} value Value to write\r\n * @returns {Writer} `this`\r\n * @throws {TypeError} If `value` is a string and no long library is present.\r\n */\r\nWriter.prototype.fixed64 = function write_fixed64(value) {\r\n var bits = LongBits.from(value);\r\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\r\n};\r\n\r\n/**\r\n * Writes a signed 64 bit value as fixed 64 bits.\r\n * @function\r\n * @param {Long|number|string} value Value to write\r\n * @returns {Writer} `this`\r\n * @throws {TypeError} If `value` is a string and no long library is present.\r\n */\r\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\r\n\r\n/**\r\n * Writes a float (32 bit).\r\n * @function\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.float = function write_float(value) {\r\n return this._push(util.float.writeFloatLE, 4, value);\r\n};\r\n\r\n/**\r\n * Writes a double (64 bit float).\r\n * @function\r\n * @param {number} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.double = function write_double(value) {\r\n return this._push(util.float.writeDoubleLE, 8, value);\r\n};\r\n\r\nvar writeBytes = util.Array.prototype.set\r\n ? function writeBytes_set(val, buf, pos) {\r\n buf.set(val, pos); // also works for plain array values\r\n }\r\n /* istanbul ignore next */\r\n : function writeBytes_for(val, buf, pos) {\r\n for (var i = 0; i < val.length; ++i)\r\n buf[pos + i] = val[i];\r\n };\r\n\r\n/**\r\n * Writes a sequence of bytes.\r\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.bytes = function write_bytes(value) {\r\n var len = value.length >>> 0;\r\n if (!len)\r\n return this._push(writeByte, 1, 0);\r\n if (util.isString(value)) {\r\n var buf = Writer.alloc(len = base64.length(value));\r\n base64.decode(value, buf, 0);\r\n value = buf;\r\n }\r\n return this.uint32(len)._push(writeBytes, len, value);\r\n};\r\n\r\n/**\r\n * Writes a string.\r\n * @param {string} value Value to write\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.string = function write_string(value) {\r\n var len = utf8.length(value);\r\n return len\r\n ? this.uint32(len)._push(utf8.write, len, value)\r\n : this._push(writeByte, 1, 0);\r\n};\r\n\r\n/**\r\n * Forks this writer's state by pushing it to a stack.\r\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.fork = function fork() {\r\n this.states = new State(this);\r\n this.head = this.tail = new Op(noop, 0, 0);\r\n this.len = 0;\r\n return this;\r\n};\r\n\r\n/**\r\n * Resets this instance to the last state.\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.reset = function reset() {\r\n if (this.states) {\r\n this.head = this.states.head;\r\n this.tail = this.states.tail;\r\n this.len = this.states.len;\r\n this.states = this.states.next;\r\n } else {\r\n this.head = this.tail = new Op(noop, 0, 0);\r\n this.len = 0;\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\r\n * @returns {Writer} `this`\r\n */\r\nWriter.prototype.ldelim = function ldelim() {\r\n var head = this.head,\r\n tail = this.tail,\r\n len = this.len;\r\n this.reset().uint32(len);\r\n if (len) {\r\n this.tail.next = head.next; // skip noop\r\n this.tail = tail;\r\n this.len += len;\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Finishes the write operation.\r\n * @returns {Uint8Array} Finished buffer\r\n */\r\nWriter.prototype.finish = function finish() {\r\n var head = this.head.next, // skip noop\r\n buf = this.constructor.alloc(this.len),\r\n pos = 0;\r\n while (head) {\r\n head.fn(head.val, buf, pos);\r\n pos += head.len;\r\n head = head.next;\r\n }\r\n // this.head = this.tail = null;\r\n return buf;\r\n};\r\n\r\nWriter._configure = function(BufferWriter_) {\r\n BufferWriter = BufferWriter_;\r\n};\r\n","\"use strict\";\r\nmodule.exports = BufferWriter;\r\n\r\n// extends Writer\r\nvar Writer = require(42);\r\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\r\n\r\nvar util = require(39);\r\n\r\nvar Buffer = util.Buffer;\r\n\r\n/**\r\n * Constructs a new buffer writer instance.\r\n * @classdesc Wire format writer using node buffers.\r\n * @extends Writer\r\n * @constructor\r\n */\r\nfunction BufferWriter() {\r\n Writer.call(this);\r\n}\r\n\r\n/**\r\n * Allocates a buffer of the specified size.\r\n * @param {number} size Buffer size\r\n * @returns {Buffer} Buffer\r\n */\r\nBufferWriter.alloc = function alloc_buffer(size) {\r\n return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size);\r\n};\r\n\r\nvar writeBytesBuffer = Buffer && Buffer.prototype instanceof Uint8Array && Buffer.prototype.set.name === \"set\"\r\n ? function writeBytesBuffer_set(val, buf, pos) {\r\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\r\n // also works for plain array values\r\n }\r\n /* istanbul ignore next */\r\n : function writeBytesBuffer_copy(val, buf, pos) {\r\n if (val.copy) // Buffer values\r\n val.copy(buf, pos, 0, val.length);\r\n else for (var i = 0; i < val.length;) // plain array values\r\n buf[pos++] = val[i++];\r\n };\r\n\r\n/**\r\n * @override\r\n */\r\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\r\n if (util.isString(value))\r\n value = util._Buffer_from(value, \"base64\");\r\n var len = value.length >>> 0;\r\n this.uint32(len);\r\n if (len)\r\n this._push(writeBytesBuffer, len, value);\r\n return this;\r\n};\r\n\r\nfunction writeStringBuffer(val, buf, pos) {\r\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\r\n util.utf8.write(val, buf, pos);\r\n else\r\n buf.utf8Write(val, pos);\r\n}\r\n\r\n/**\r\n * @override\r\n */\r\nBufferWriter.prototype.string = function write_string_buffer(value) {\r\n var len = Buffer.byteLength(value);\r\n this.uint32(len);\r\n if (len)\r\n this._push(writeStringBuffer, len, value);\r\n return this;\r\n};\r\n\r\n\r\n/**\r\n * Finishes the write operation.\r\n * @name BufferWriter#finish\r\n * @function\r\n * @returns {Buffer} Finished buffer\r\n */\r\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/frontend/assets/scripts/modules/protobuf.js.map.meta b/frontend/assets/scripts/modules/protobuf.js.map.meta deleted file mode 100644 index 99daa5a..0000000 --- a/frontend/assets/scripts/modules/protobuf.js.map.meta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ver": "1.0.1", - "uuid": "e646fbd9-7821-4567-9846-fb6e45aeb921", - "subMetas": {} -} \ No newline at end of file diff --git a/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js b/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js index b8f70f8..ceb622f 100644 --- a/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js +++ b/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js @@ -9,20 +9,20 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.ut // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); -$root.treasurehunterx = (function() { +$root.sharedprotos = (function() { /** - * Namespace treasurehunterx. - * @exports treasurehunterx + * Namespace sharedprotos. + * @exports sharedprotos * @namespace */ - var treasurehunterx = {}; + var sharedprotos = {}; - treasurehunterx.Direction = (function() { + sharedprotos.Direction = (function() { /** * Properties of a Direction. - * @memberof treasurehunterx + * @memberof sharedprotos * @interface IDirection * @property {number|null} [dx] Direction dx * @property {number|null} [dy] Direction dy @@ -30,11 +30,11 @@ $root.treasurehunterx = (function() { /** * Constructs a new Direction. - * @memberof treasurehunterx + * @memberof sharedprotos * @classdesc Represents a Direction. * @implements IDirection * @constructor - * @param {treasurehunterx.IDirection=} [properties] Properties to set + * @param {sharedprotos.IDirection=} [properties] Properties to set */ function Direction(properties) { if (properties) @@ -46,7 +46,7 @@ $root.treasurehunterx = (function() { /** * Direction dx. * @member {number} dx - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @instance */ Direction.prototype.dx = 0; @@ -54,7 +54,7 @@ $root.treasurehunterx = (function() { /** * Direction dy. * @member {number} dy - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @instance */ Direction.prototype.dy = 0; @@ -62,21 +62,21 @@ $root.treasurehunterx = (function() { /** * Creates a new Direction instance using the specified properties. * @function create - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static - * @param {treasurehunterx.IDirection=} [properties] Properties to set - * @returns {treasurehunterx.Direction} Direction instance + * @param {sharedprotos.IDirection=} [properties] Properties to set + * @returns {sharedprotos.Direction} Direction instance */ Direction.create = function create(properties) { return new Direction(properties); }; /** - * Encodes the specified Direction message. Does not implicitly {@link treasurehunterx.Direction.verify|verify} messages. + * Encodes the specified Direction message. Does not implicitly {@link sharedprotos.Direction.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static - * @param {treasurehunterx.Direction} message Direction message or plain object to encode + * @param {sharedprotos.Direction} message Direction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -91,11 +91,11 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified Direction message, length delimited. Does not implicitly {@link treasurehunterx.Direction.verify|verify} messages. + * Encodes the specified Direction message, length delimited. Does not implicitly {@link sharedprotos.Direction.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static - * @param {treasurehunterx.Direction} message Direction message or plain object to encode + * @param {sharedprotos.Direction} message Direction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -106,18 +106,18 @@ $root.treasurehunterx = (function() { /** * Decodes a Direction message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Direction} Direction + * @returns {sharedprotos.Direction} Direction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Direction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Direction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Direction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -140,10 +140,10 @@ $root.treasurehunterx = (function() { /** * Decodes a Direction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Direction} Direction + * @returns {sharedprotos.Direction} Direction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -156,7 +156,7 @@ $root.treasurehunterx = (function() { /** * Verifies a Direction message. * @function verify - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -176,15 +176,15 @@ $root.treasurehunterx = (function() { /** * Creates a Direction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Direction} Direction + * @returns {sharedprotos.Direction} Direction */ Direction.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Direction) + if (object instanceof $root.sharedprotos.Direction) return object; - var message = new $root.treasurehunterx.Direction(); + var message = new $root.sharedprotos.Direction(); if (object.dx != null) message.dx = object.dx | 0; if (object.dy != null) @@ -195,9 +195,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a Direction message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static - * @param {treasurehunterx.Direction} message Direction + * @param {sharedprotos.Direction} message Direction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -219,7 +219,7 @@ $root.treasurehunterx = (function() { /** * Converts this Direction to JSON. * @function toJSON - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @instance * @returns {Object.} JSON object */ @@ -230,7 +230,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for Direction * @function getTypeUrl - * @memberof treasurehunterx.Direction + * @memberof sharedprotos.Direction * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -239,17 +239,17 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Direction"; + return typeUrlPrefix + "/sharedprotos.Direction"; }; return Direction; })(); - treasurehunterx.Vec2D = (function() { + sharedprotos.Vec2D = (function() { /** * Properties of a Vec2D. - * @memberof treasurehunterx + * @memberof sharedprotos * @interface IVec2D * @property {number|null} [x] Vec2D x * @property {number|null} [y] Vec2D y @@ -257,11 +257,11 @@ $root.treasurehunterx = (function() { /** * Constructs a new Vec2D. - * @memberof treasurehunterx + * @memberof sharedprotos * @classdesc Represents a Vec2D. * @implements IVec2D * @constructor - * @param {treasurehunterx.IVec2D=} [properties] Properties to set + * @param {sharedprotos.IVec2D=} [properties] Properties to set */ function Vec2D(properties) { if (properties) @@ -273,7 +273,7 @@ $root.treasurehunterx = (function() { /** * Vec2D x. * @member {number} x - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @instance */ Vec2D.prototype.x = 0; @@ -281,7 +281,7 @@ $root.treasurehunterx = (function() { /** * Vec2D y. * @member {number} y - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @instance */ Vec2D.prototype.y = 0; @@ -289,21 +289,21 @@ $root.treasurehunterx = (function() { /** * Creates a new Vec2D instance using the specified properties. * @function create - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {treasurehunterx.IVec2D=} [properties] Properties to set - * @returns {treasurehunterx.Vec2D} Vec2D instance + * @param {sharedprotos.IVec2D=} [properties] Properties to set + * @returns {sharedprotos.Vec2D} Vec2D instance */ Vec2D.create = function create(properties) { return new Vec2D(properties); }; /** - * Encodes the specified Vec2D message. Does not implicitly {@link treasurehunterx.Vec2D.verify|verify} messages. + * Encodes the specified Vec2D message. Does not implicitly {@link sharedprotos.Vec2D.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {treasurehunterx.Vec2D} message Vec2D message or plain object to encode + * @param {sharedprotos.Vec2D} message Vec2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -318,11 +318,11 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified Vec2D message, length delimited. Does not implicitly {@link treasurehunterx.Vec2D.verify|verify} messages. + * Encodes the specified Vec2D message, length delimited. Does not implicitly {@link sharedprotos.Vec2D.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {treasurehunterx.Vec2D} message Vec2D message or plain object to encode + * @param {sharedprotos.Vec2D} message Vec2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -333,18 +333,18 @@ $root.treasurehunterx = (function() { /** * Decodes a Vec2D message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Vec2D.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Vec2D(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Vec2D(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -367,10 +367,10 @@ $root.treasurehunterx = (function() { /** * Decodes a Vec2D message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -383,7 +383,7 @@ $root.treasurehunterx = (function() { /** * Verifies a Vec2D message. * @function verify - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -403,15 +403,15 @@ $root.treasurehunterx = (function() { /** * Creates a Vec2D message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D */ Vec2D.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Vec2D) + if (object instanceof $root.sharedprotos.Vec2D) return object; - var message = new $root.treasurehunterx.Vec2D(); + var message = new $root.sharedprotos.Vec2D(); if (object.x != null) message.x = Number(object.x); if (object.y != null) @@ -422,9 +422,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a Vec2D message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {treasurehunterx.Vec2D} message Vec2D + * @param {sharedprotos.Vec2D} message Vec2D * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -446,7 +446,7 @@ $root.treasurehunterx = (function() { /** * Converts this Vec2D to JSON. * @function toJSON - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @instance * @returns {Object.} JSON object */ @@ -457,7 +457,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for Vec2D * @function getTypeUrl - * @memberof treasurehunterx.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -466,32 +466,32 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Vec2D"; + return typeUrlPrefix + "/sharedprotos.Vec2D"; }; return Vec2D; })(); - treasurehunterx.Polygon2D = (function() { + sharedprotos.Polygon2D = (function() { /** * Properties of a Polygon2D. - * @memberof treasurehunterx + * @memberof sharedprotos * @interface IPolygon2D - * @property {treasurehunterx.Vec2D|null} [Anchor] Polygon2D Anchor - * @property {Array.|null} [Points] Polygon2D Points + * @property {sharedprotos.Vec2D|null} [anchor] Polygon2D anchor + * @property {Array.|null} [points] Polygon2D points */ /** * Constructs a new Polygon2D. - * @memberof treasurehunterx + * @memberof sharedprotos * @classdesc Represents a Polygon2D. * @implements IPolygon2D * @constructor - * @param {treasurehunterx.IPolygon2D=} [properties] Properties to set + * @param {sharedprotos.IPolygon2D=} [properties] Properties to set */ function Polygon2D(properties) { - this.Points = []; + this.points = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -499,59 +499,59 @@ $root.treasurehunterx = (function() { } /** - * Polygon2D Anchor. - * @member {treasurehunterx.Vec2D|null|undefined} Anchor - * @memberof treasurehunterx.Polygon2D + * Polygon2D anchor. + * @member {sharedprotos.Vec2D|null|undefined} anchor + * @memberof sharedprotos.Polygon2D * @instance */ - Polygon2D.prototype.Anchor = null; + Polygon2D.prototype.anchor = null; /** - * Polygon2D Points. - * @member {Array.} Points - * @memberof treasurehunterx.Polygon2D + * Polygon2D points. + * @member {Array.} points + * @memberof sharedprotos.Polygon2D * @instance */ - Polygon2D.prototype.Points = $util.emptyArray; + Polygon2D.prototype.points = $util.emptyArray; /** * Creates a new Polygon2D instance using the specified properties. * @function create - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {treasurehunterx.IPolygon2D=} [properties] Properties to set - * @returns {treasurehunterx.Polygon2D} Polygon2D instance + * @param {sharedprotos.IPolygon2D=} [properties] Properties to set + * @returns {sharedprotos.Polygon2D} Polygon2D instance */ Polygon2D.create = function create(properties) { return new Polygon2D(properties); }; /** - * Encodes the specified Polygon2D message. Does not implicitly {@link treasurehunterx.Polygon2D.verify|verify} messages. + * Encodes the specified Polygon2D message. Does not implicitly {@link sharedprotos.Polygon2D.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {treasurehunterx.Polygon2D} message Polygon2D message or plain object to encode + * @param {sharedprotos.Polygon2D} message Polygon2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Polygon2D.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.Anchor != null && Object.hasOwnProperty.call(message, "Anchor")) - $root.treasurehunterx.Vec2D.encode(message.Anchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.Points != null && message.Points.length) - for (var i = 0; i < message.Points.length; ++i) - $root.treasurehunterx.Vec2D.encode(message.Points[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.anchor != null && Object.hasOwnProperty.call(message, "anchor")) + $root.sharedprotos.Vec2D.encode(message.anchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.points != null && message.points.length) + for (var i = 0; i < message.points.length; ++i) + $root.sharedprotos.Vec2D.encode(message.points[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Polygon2D message, length delimited. Does not implicitly {@link treasurehunterx.Polygon2D.verify|verify} messages. + * Encodes the specified Polygon2D message, length delimited. Does not implicitly {@link sharedprotos.Polygon2D.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {treasurehunterx.Polygon2D} message Polygon2D message or plain object to encode + * @param {sharedprotos.Polygon2D} message Polygon2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -562,29 +562,29 @@ $root.treasurehunterx = (function() { /** * Decodes a Polygon2D message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Polygon2D.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Polygon2D(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Polygon2D(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.Anchor = $root.treasurehunterx.Vec2D.decode(reader, reader.uint32()); + message.anchor = $root.sharedprotos.Vec2D.decode(reader, reader.uint32()); break; } case 2: { - if (!(message.Points && message.Points.length)) - message.Points = []; - message.Points.push($root.treasurehunterx.Vec2D.decode(reader, reader.uint32())); + if (!(message.points && message.points.length)) + message.points = []; + message.points.push($root.sharedprotos.Vec2D.decode(reader, reader.uint32())); break; } default: @@ -598,10 +598,10 @@ $root.treasurehunterx = (function() { /** * Decodes a Polygon2D message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -614,7 +614,7 @@ $root.treasurehunterx = (function() { /** * Verifies a Polygon2D message. * @function verify - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -622,18 +622,18 @@ $root.treasurehunterx = (function() { Polygon2D.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.Anchor != null && message.hasOwnProperty("Anchor")) { - var error = $root.treasurehunterx.Vec2D.verify(message.Anchor); + if (message.anchor != null && message.hasOwnProperty("anchor")) { + var error = $root.sharedprotos.Vec2D.verify(message.anchor); if (error) - return "Anchor." + error; + return "anchor." + error; } - if (message.Points != null && message.hasOwnProperty("Points")) { - if (!Array.isArray(message.Points)) - return "Points: array expected"; - for (var i = 0; i < message.Points.length; ++i) { - var error = $root.treasurehunterx.Vec2D.verify(message.Points[i]); + if (message.points != null && message.hasOwnProperty("points")) { + if (!Array.isArray(message.points)) + return "points: array expected"; + for (var i = 0; i < message.points.length; ++i) { + var error = $root.sharedprotos.Vec2D.verify(message.points[i]); if (error) - return "Points." + error; + return "points." + error; } } return null; @@ -642,28 +642,28 @@ $root.treasurehunterx = (function() { /** * Creates a Polygon2D message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D */ Polygon2D.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Polygon2D) + if (object instanceof $root.sharedprotos.Polygon2D) return object; - var message = new $root.treasurehunterx.Polygon2D(); - if (object.Anchor != null) { - if (typeof object.Anchor !== "object") - throw TypeError(".treasurehunterx.Polygon2D.Anchor: object expected"); - message.Anchor = $root.treasurehunterx.Vec2D.fromObject(object.Anchor); + var message = new $root.sharedprotos.Polygon2D(); + if (object.anchor != null) { + if (typeof object.anchor !== "object") + throw TypeError(".sharedprotos.Polygon2D.anchor: object expected"); + message.anchor = $root.sharedprotos.Vec2D.fromObject(object.anchor); } - if (object.Points) { - if (!Array.isArray(object.Points)) - throw TypeError(".treasurehunterx.Polygon2D.Points: array expected"); - message.Points = []; - for (var i = 0; i < object.Points.length; ++i) { - if (typeof object.Points[i] !== "object") - throw TypeError(".treasurehunterx.Polygon2D.Points: object expected"); - message.Points[i] = $root.treasurehunterx.Vec2D.fromObject(object.Points[i]); + if (object.points) { + if (!Array.isArray(object.points)) + throw TypeError(".sharedprotos.Polygon2D.points: array expected"); + message.points = []; + for (var i = 0; i < object.points.length; ++i) { + if (typeof object.points[i] !== "object") + throw TypeError(".sharedprotos.Polygon2D.points: object expected"); + message.points[i] = $root.sharedprotos.Vec2D.fromObject(object.points[i]); } } return message; @@ -672,9 +672,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a Polygon2D message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {treasurehunterx.Polygon2D} message Polygon2D + * @param {sharedprotos.Polygon2D} message Polygon2D * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -683,15 +683,15 @@ $root.treasurehunterx = (function() { options = {}; var object = {}; if (options.arrays || options.defaults) - object.Points = []; + object.points = []; if (options.defaults) - object.Anchor = null; - if (message.Anchor != null && message.hasOwnProperty("Anchor")) - object.Anchor = $root.treasurehunterx.Vec2D.toObject(message.Anchor, options); - if (message.Points && message.Points.length) { - object.Points = []; - for (var j = 0; j < message.Points.length; ++j) - object.Points[j] = $root.treasurehunterx.Vec2D.toObject(message.Points[j], options); + object.anchor = null; + if (message.anchor != null && message.hasOwnProperty("anchor")) + object.anchor = $root.sharedprotos.Vec2D.toObject(message.anchor, options); + if (message.points && message.points.length) { + object.points = []; + for (var j = 0; j < message.points.length; ++j) + object.points[j] = $root.sharedprotos.Vec2D.toObject(message.points[j], options); } return object; }; @@ -699,7 +699,7 @@ $root.treasurehunterx = (function() { /** * Converts this Polygon2D to JSON. * @function toJSON - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @instance * @returns {Object.} JSON object */ @@ -710,7 +710,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for Polygon2D * @function getTypeUrl - * @memberof treasurehunterx.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -719,31 +719,31 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Polygon2D"; + return typeUrlPrefix + "/sharedprotos.Polygon2D"; }; return Polygon2D; })(); - treasurehunterx.Vec2DList = (function() { + sharedprotos.Vec2DList = (function() { /** * Properties of a Vec2DList. - * @memberof treasurehunterx + * @memberof sharedprotos * @interface IVec2DList - * @property {Array.|null} [vec2DList] Vec2DList vec2DList + * @property {Array.|null} [eles] Vec2DList eles */ /** * Constructs a new Vec2DList. - * @memberof treasurehunterx + * @memberof sharedprotos * @classdesc Represents a Vec2DList. * @implements IVec2DList * @constructor - * @param {treasurehunterx.IVec2DList=} [properties] Properties to set + * @param {sharedprotos.IVec2DList=} [properties] Properties to set */ function Vec2DList(properties) { - this.vec2DList = []; + this.eles = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -751,49 +751,49 @@ $root.treasurehunterx = (function() { } /** - * Vec2DList vec2DList. - * @member {Array.} vec2DList - * @memberof treasurehunterx.Vec2DList + * Vec2DList eles. + * @member {Array.} eles + * @memberof sharedprotos.Vec2DList * @instance */ - Vec2DList.prototype.vec2DList = $util.emptyArray; + Vec2DList.prototype.eles = $util.emptyArray; /** * Creates a new Vec2DList instance using the specified properties. * @function create - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {treasurehunterx.IVec2DList=} [properties] Properties to set - * @returns {treasurehunterx.Vec2DList} Vec2DList instance + * @param {sharedprotos.IVec2DList=} [properties] Properties to set + * @returns {sharedprotos.Vec2DList} Vec2DList instance */ Vec2DList.create = function create(properties) { return new Vec2DList(properties); }; /** - * Encodes the specified Vec2DList message. Does not implicitly {@link treasurehunterx.Vec2DList.verify|verify} messages. + * Encodes the specified Vec2DList message. Does not implicitly {@link sharedprotos.Vec2DList.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {treasurehunterx.Vec2DList} message Vec2DList message or plain object to encode + * @param {sharedprotos.Vec2DList} message Vec2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Vec2DList.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vec2DList != null && message.vec2DList.length) - for (var i = 0; i < message.vec2DList.length; ++i) - $root.treasurehunterx.Vec2D.encode(message.vec2DList[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.eles != null && message.eles.length) + for (var i = 0; i < message.eles.length; ++i) + $root.sharedprotos.Vec2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Vec2DList message, length delimited. Does not implicitly {@link treasurehunterx.Vec2DList.verify|verify} messages. + * Encodes the specified Vec2DList message, length delimited. Does not implicitly {@link sharedprotos.Vec2DList.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {treasurehunterx.Vec2DList} message Vec2DList message or plain object to encode + * @param {sharedprotos.Vec2DList} message Vec2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -804,25 +804,25 @@ $root.treasurehunterx = (function() { /** * Decodes a Vec2DList message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Vec2DList.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Vec2DList(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Vec2DList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.vec2DList && message.vec2DList.length)) - message.vec2DList = []; - message.vec2DList.push($root.treasurehunterx.Vec2D.decode(reader, reader.uint32())); + if (!(message.eles && message.eles.length)) + message.eles = []; + message.eles.push($root.sharedprotos.Vec2D.decode(reader, reader.uint32())); break; } default: @@ -836,10 +836,10 @@ $root.treasurehunterx = (function() { /** * Decodes a Vec2DList message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -852,7 +852,7 @@ $root.treasurehunterx = (function() { /** * Verifies a Vec2DList message. * @function verify - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -860,13 +860,13 @@ $root.treasurehunterx = (function() { Vec2DList.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vec2DList != null && message.hasOwnProperty("vec2DList")) { - if (!Array.isArray(message.vec2DList)) - return "vec2DList: array expected"; - for (var i = 0; i < message.vec2DList.length; ++i) { - var error = $root.treasurehunterx.Vec2D.verify(message.vec2DList[i]); + if (message.eles != null && message.hasOwnProperty("eles")) { + if (!Array.isArray(message.eles)) + return "eles: array expected"; + for (var i = 0; i < message.eles.length; ++i) { + var error = $root.sharedprotos.Vec2D.verify(message.eles[i]); if (error) - return "vec2DList." + error; + return "eles." + error; } } return null; @@ -875,23 +875,23 @@ $root.treasurehunterx = (function() { /** * Creates a Vec2DList message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList */ Vec2DList.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Vec2DList) + if (object instanceof $root.sharedprotos.Vec2DList) return object; - var message = new $root.treasurehunterx.Vec2DList(); - if (object.vec2DList) { - if (!Array.isArray(object.vec2DList)) - throw TypeError(".treasurehunterx.Vec2DList.vec2DList: array expected"); - message.vec2DList = []; - for (var i = 0; i < object.vec2DList.length; ++i) { - if (typeof object.vec2DList[i] !== "object") - throw TypeError(".treasurehunterx.Vec2DList.vec2DList: object expected"); - message.vec2DList[i] = $root.treasurehunterx.Vec2D.fromObject(object.vec2DList[i]); + var message = new $root.sharedprotos.Vec2DList(); + if (object.eles) { + if (!Array.isArray(object.eles)) + throw TypeError(".sharedprotos.Vec2DList.eles: array expected"); + message.eles = []; + for (var i = 0; i < object.eles.length; ++i) { + if (typeof object.eles[i] !== "object") + throw TypeError(".sharedprotos.Vec2DList.eles: object expected"); + message.eles[i] = $root.sharedprotos.Vec2D.fromObject(object.eles[i]); } } return message; @@ -900,9 +900,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a Vec2DList message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {treasurehunterx.Vec2DList} message Vec2DList + * @param {sharedprotos.Vec2DList} message Vec2DList * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -911,11 +911,11 @@ $root.treasurehunterx = (function() { options = {}; var object = {}; if (options.arrays || options.defaults) - object.vec2DList = []; - if (message.vec2DList && message.vec2DList.length) { - object.vec2DList = []; - for (var j = 0; j < message.vec2DList.length; ++j) - object.vec2DList[j] = $root.treasurehunterx.Vec2D.toObject(message.vec2DList[j], options); + object.eles = []; + if (message.eles && message.eles.length) { + object.eles = []; + for (var j = 0; j < message.eles.length; ++j) + object.eles[j] = $root.sharedprotos.Vec2D.toObject(message.eles[j], options); } return object; }; @@ -923,7 +923,7 @@ $root.treasurehunterx = (function() { /** * Converts this Vec2DList to JSON. * @function toJSON - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @instance * @returns {Object.} JSON object */ @@ -934,7 +934,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for Vec2DList * @function getTypeUrl - * @memberof treasurehunterx.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -943,31 +943,31 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Vec2DList"; + return typeUrlPrefix + "/sharedprotos.Vec2DList"; }; return Vec2DList; })(); - treasurehunterx.Polygon2DList = (function() { + sharedprotos.Polygon2DList = (function() { /** * Properties of a Polygon2DList. - * @memberof treasurehunterx + * @memberof sharedprotos * @interface IPolygon2DList - * @property {Array.|null} [polygon2DList] Polygon2DList polygon2DList + * @property {Array.|null} [eles] Polygon2DList eles */ /** * Constructs a new Polygon2DList. - * @memberof treasurehunterx + * @memberof sharedprotos * @classdesc Represents a Polygon2DList. * @implements IPolygon2DList * @constructor - * @param {treasurehunterx.IPolygon2DList=} [properties] Properties to set + * @param {sharedprotos.IPolygon2DList=} [properties] Properties to set */ function Polygon2DList(properties) { - this.polygon2DList = []; + this.eles = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -975,49 +975,49 @@ $root.treasurehunterx = (function() { } /** - * Polygon2DList polygon2DList. - * @member {Array.} polygon2DList - * @memberof treasurehunterx.Polygon2DList + * Polygon2DList eles. + * @member {Array.} eles + * @memberof sharedprotos.Polygon2DList * @instance */ - Polygon2DList.prototype.polygon2DList = $util.emptyArray; + Polygon2DList.prototype.eles = $util.emptyArray; /** * Creates a new Polygon2DList instance using the specified properties. * @function create - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {treasurehunterx.IPolygon2DList=} [properties] Properties to set - * @returns {treasurehunterx.Polygon2DList} Polygon2DList instance + * @param {sharedprotos.IPolygon2DList=} [properties] Properties to set + * @returns {sharedprotos.Polygon2DList} Polygon2DList instance */ Polygon2DList.create = function create(properties) { return new Polygon2DList(properties); }; /** - * Encodes the specified Polygon2DList message. Does not implicitly {@link treasurehunterx.Polygon2DList.verify|verify} messages. + * Encodes the specified Polygon2DList message. Does not implicitly {@link sharedprotos.Polygon2DList.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {treasurehunterx.Polygon2DList} message Polygon2DList message or plain object to encode + * @param {sharedprotos.Polygon2DList} message Polygon2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Polygon2DList.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.polygon2DList != null && message.polygon2DList.length) - for (var i = 0; i < message.polygon2DList.length; ++i) - $root.treasurehunterx.Polygon2D.encode(message.polygon2DList[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.eles != null && message.eles.length) + for (var i = 0; i < message.eles.length; ++i) + $root.sharedprotos.Polygon2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Polygon2DList message, length delimited. Does not implicitly {@link treasurehunterx.Polygon2DList.verify|verify} messages. + * Encodes the specified Polygon2DList message, length delimited. Does not implicitly {@link sharedprotos.Polygon2DList.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {treasurehunterx.Polygon2DList} message Polygon2DList message or plain object to encode + * @param {sharedprotos.Polygon2DList} message Polygon2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1028,25 +1028,25 @@ $root.treasurehunterx = (function() { /** * Decodes a Polygon2DList message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Polygon2DList.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Polygon2DList(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Polygon2DList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.polygon2DList && message.polygon2DList.length)) - message.polygon2DList = []; - message.polygon2DList.push($root.treasurehunterx.Polygon2D.decode(reader, reader.uint32())); + if (!(message.eles && message.eles.length)) + message.eles = []; + message.eles.push($root.sharedprotos.Polygon2D.decode(reader, reader.uint32())); break; } default: @@ -1060,10 +1060,10 @@ $root.treasurehunterx = (function() { /** * Decodes a Polygon2DList message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1076,7 +1076,7 @@ $root.treasurehunterx = (function() { /** * Verifies a Polygon2DList message. * @function verify - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1084,13 +1084,13 @@ $root.treasurehunterx = (function() { Polygon2DList.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.polygon2DList != null && message.hasOwnProperty("polygon2DList")) { - if (!Array.isArray(message.polygon2DList)) - return "polygon2DList: array expected"; - for (var i = 0; i < message.polygon2DList.length; ++i) { - var error = $root.treasurehunterx.Polygon2D.verify(message.polygon2DList[i]); + if (message.eles != null && message.hasOwnProperty("eles")) { + if (!Array.isArray(message.eles)) + return "eles: array expected"; + for (var i = 0; i < message.eles.length; ++i) { + var error = $root.sharedprotos.Polygon2D.verify(message.eles[i]); if (error) - return "polygon2DList." + error; + return "eles." + error; } } return null; @@ -1099,23 +1099,23 @@ $root.treasurehunterx = (function() { /** * Creates a Polygon2DList message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList */ Polygon2DList.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Polygon2DList) + if (object instanceof $root.sharedprotos.Polygon2DList) return object; - var message = new $root.treasurehunterx.Polygon2DList(); - if (object.polygon2DList) { - if (!Array.isArray(object.polygon2DList)) - throw TypeError(".treasurehunterx.Polygon2DList.polygon2DList: array expected"); - message.polygon2DList = []; - for (var i = 0; i < object.polygon2DList.length; ++i) { - if (typeof object.polygon2DList[i] !== "object") - throw TypeError(".treasurehunterx.Polygon2DList.polygon2DList: object expected"); - message.polygon2DList[i] = $root.treasurehunterx.Polygon2D.fromObject(object.polygon2DList[i]); + var message = new $root.sharedprotos.Polygon2DList(); + if (object.eles) { + if (!Array.isArray(object.eles)) + throw TypeError(".sharedprotos.Polygon2DList.eles: array expected"); + message.eles = []; + for (var i = 0; i < object.eles.length; ++i) { + if (typeof object.eles[i] !== "object") + throw TypeError(".sharedprotos.Polygon2DList.eles: object expected"); + message.eles[i] = $root.sharedprotos.Polygon2D.fromObject(object.eles[i]); } } return message; @@ -1124,9 +1124,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a Polygon2DList message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {treasurehunterx.Polygon2DList} message Polygon2DList + * @param {sharedprotos.Polygon2DList} message Polygon2DList * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1135,11 +1135,11 @@ $root.treasurehunterx = (function() { options = {}; var object = {}; if (options.arrays || options.defaults) - object.polygon2DList = []; - if (message.polygon2DList && message.polygon2DList.length) { - object.polygon2DList = []; - for (var j = 0; j < message.polygon2DList.length; ++j) - object.polygon2DList[j] = $root.treasurehunterx.Polygon2D.toObject(message.polygon2DList[j], options); + object.eles = []; + if (message.eles && message.eles.length) { + object.eles = []; + for (var j = 0; j < message.eles.length; ++j) + object.eles[j] = $root.sharedprotos.Polygon2D.toObject(message.eles[j], options); } return object; }; @@ -1147,7 +1147,7 @@ $root.treasurehunterx = (function() { /** * Converts this Polygon2DList to JSON. * @function toJSON - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @instance * @returns {Object.} JSON object */ @@ -1158,7 +1158,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for Polygon2DList * @function getTypeUrl - * @memberof treasurehunterx.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -1167,21 +1167,33 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Polygon2DList"; + return typeUrlPrefix + "/sharedprotos.Polygon2DList"; }; return Polygon2DList; })(); - treasurehunterx.BattleColliderInfo = (function() { + return sharedprotos; +})(); + +$root.protos = (function() { + + /** + * Namespace protos. + * @exports protos + * @namespace + */ + var protos = {}; + + protos.BattleColliderInfo = (function() { /** * Properties of a BattleColliderInfo. - * @memberof treasurehunterx + * @memberof protos * @interface IBattleColliderInfo * @property {string|null} [stageName] BattleColliderInfo stageName - * @property {Object.|null} [strToVec2DListMap] BattleColliderInfo strToVec2DListMap - * @property {Object.|null} [strToPolygon2DListMap] BattleColliderInfo strToPolygon2DListMap + * @property {Object.|null} [strToVec2DListMap] BattleColliderInfo strToVec2DListMap + * @property {Object.|null} [strToPolygon2DListMap] BattleColliderInfo strToPolygon2DListMap * @property {number|null} [stageDiscreteW] BattleColliderInfo stageDiscreteW * @property {number|null} [stageDiscreteH] BattleColliderInfo stageDiscreteH * @property {number|null} [stageTileW] BattleColliderInfo stageTileW @@ -1197,18 +1209,19 @@ $root.treasurehunterx = (function() { * @property {number|null} [inputFrameUpsyncDelayTolerance] BattleColliderInfo inputFrameUpsyncDelayTolerance * @property {number|null} [maxChasingRenderFramesPerUpdate] BattleColliderInfo maxChasingRenderFramesPerUpdate * @property {number|null} [playerBattleState] BattleColliderInfo playerBattleState - * @property {number|null} [rollbackEstimatedDt] BattleColliderInfo rollbackEstimatedDt * @property {number|null} [rollbackEstimatedDtMillis] BattleColliderInfo rollbackEstimatedDtMillis * @property {number|Long|null} [rollbackEstimatedDtNanos] BattleColliderInfo rollbackEstimatedDtNanos + * @property {number|null} [worldToVirtualGridRatio] BattleColliderInfo worldToVirtualGridRatio + * @property {number|null} [virtualGridToWorldRatio] BattleColliderInfo virtualGridToWorldRatio */ /** * Constructs a new BattleColliderInfo. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents a BattleColliderInfo. * @implements IBattleColliderInfo * @constructor - * @param {treasurehunterx.IBattleColliderInfo=} [properties] Properties to set + * @param {protos.IBattleColliderInfo=} [properties] Properties to set */ function BattleColliderInfo(properties) { this.strToVec2DListMap = {}; @@ -1222,23 +1235,23 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo stageName. * @member {string} stageName - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.stageName = ""; /** * BattleColliderInfo strToVec2DListMap. - * @member {Object.} strToVec2DListMap - * @memberof treasurehunterx.BattleColliderInfo + * @member {Object.} strToVec2DListMap + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.strToVec2DListMap = $util.emptyObject; /** * BattleColliderInfo strToPolygon2DListMap. - * @member {Object.} strToPolygon2DListMap - * @memberof treasurehunterx.BattleColliderInfo + * @member {Object.} strToPolygon2DListMap + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.strToPolygon2DListMap = $util.emptyObject; @@ -1246,7 +1259,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo stageDiscreteW. * @member {number} stageDiscreteW - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.stageDiscreteW = 0; @@ -1254,7 +1267,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo stageDiscreteH. * @member {number} stageDiscreteH - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.stageDiscreteH = 0; @@ -1262,7 +1275,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo stageTileW. * @member {number} stageTileW - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.stageTileW = 0; @@ -1270,7 +1283,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo stageTileH. * @member {number} stageTileH - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.stageTileH = 0; @@ -1278,7 +1291,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo intervalToPing. * @member {number} intervalToPing - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.intervalToPing = 0; @@ -1286,7 +1299,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo willKickIfInactiveFor. * @member {number} willKickIfInactiveFor - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.willKickIfInactiveFor = 0; @@ -1294,7 +1307,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo boundRoomId. * @member {number} boundRoomId - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.boundRoomId = 0; @@ -1302,7 +1315,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo battleDurationNanos. * @member {number|Long} battleDurationNanos - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.battleDurationNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; @@ -1310,7 +1323,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo serverFps. * @member {number} serverFps - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.serverFps = 0; @@ -1318,7 +1331,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo inputDelayFrames. * @member {number} inputDelayFrames - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.inputDelayFrames = 0; @@ -1326,7 +1339,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo inputScaleFrames. * @member {number} inputScaleFrames - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.inputScaleFrames = 0; @@ -1334,7 +1347,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo nstDelayFrames. * @member {number} nstDelayFrames - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.nstDelayFrames = 0; @@ -1342,7 +1355,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo inputFrameUpsyncDelayTolerance. * @member {number} inputFrameUpsyncDelayTolerance - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.inputFrameUpsyncDelayTolerance = 0; @@ -1350,7 +1363,7 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo maxChasingRenderFramesPerUpdate. * @member {number} maxChasingRenderFramesPerUpdate - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.maxChasingRenderFramesPerUpdate = 0; @@ -1358,23 +1371,15 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo playerBattleState. * @member {number} playerBattleState - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.playerBattleState = 0; - /** - * BattleColliderInfo rollbackEstimatedDt. - * @member {number} rollbackEstimatedDt - * @memberof treasurehunterx.BattleColliderInfo - * @instance - */ - BattleColliderInfo.prototype.rollbackEstimatedDt = 0; - /** * BattleColliderInfo rollbackEstimatedDtMillis. * @member {number} rollbackEstimatedDtMillis - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.rollbackEstimatedDtMillis = 0; @@ -1382,29 +1387,45 @@ $root.treasurehunterx = (function() { /** * BattleColliderInfo rollbackEstimatedDtNanos. * @member {number|Long} rollbackEstimatedDtNanos - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance */ BattleColliderInfo.prototype.rollbackEstimatedDtNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * BattleColliderInfo worldToVirtualGridRatio. + * @member {number} worldToVirtualGridRatio + * @memberof protos.BattleColliderInfo + * @instance + */ + BattleColliderInfo.prototype.worldToVirtualGridRatio = 0; + + /** + * BattleColliderInfo virtualGridToWorldRatio. + * @member {number} virtualGridToWorldRatio + * @memberof protos.BattleColliderInfo + * @instance + */ + BattleColliderInfo.prototype.virtualGridToWorldRatio = 0; + /** * Creates a new BattleColliderInfo instance using the specified properties. * @function create - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static - * @param {treasurehunterx.IBattleColliderInfo=} [properties] Properties to set - * @returns {treasurehunterx.BattleColliderInfo} BattleColliderInfo instance + * @param {protos.IBattleColliderInfo=} [properties] Properties to set + * @returns {protos.BattleColliderInfo} BattleColliderInfo instance */ BattleColliderInfo.create = function create(properties) { return new BattleColliderInfo(properties); }; /** - * Encodes the specified BattleColliderInfo message. Does not implicitly {@link treasurehunterx.BattleColliderInfo.verify|verify} messages. + * Encodes the specified BattleColliderInfo message. Does not implicitly {@link protos.BattleColliderInfo.verify|verify} messages. * @function encode - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static - * @param {treasurehunterx.BattleColliderInfo} message BattleColliderInfo message or plain object to encode + * @param {protos.BattleColliderInfo} message BattleColliderInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1416,12 +1437,12 @@ $root.treasurehunterx = (function() { if (message.strToVec2DListMap != null && Object.hasOwnProperty.call(message, "strToVec2DListMap")) for (var keys = Object.keys(message.strToVec2DListMap), i = 0; i < keys.length; ++i) { writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.treasurehunterx.Vec2DList.encode(message.strToVec2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.sharedprotos.Vec2DList.encode(message.strToVec2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } if (message.strToPolygon2DListMap != null && Object.hasOwnProperty.call(message, "strToPolygon2DListMap")) for (var keys = Object.keys(message.strToPolygon2DListMap), i = 0; i < keys.length; ++i) { writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.treasurehunterx.Polygon2DList.encode(message.strToPolygon2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.sharedprotos.Polygon2DList.encode(message.strToPolygon2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } if (message.stageDiscreteW != null && Object.hasOwnProperty.call(message, "stageDiscreteW")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.stageDiscreteW); @@ -1453,21 +1474,23 @@ $root.treasurehunterx = (function() { writer.uint32(/* id 17, wireType 0 =*/136).int32(message.maxChasingRenderFramesPerUpdate); if (message.playerBattleState != null && Object.hasOwnProperty.call(message, "playerBattleState")) writer.uint32(/* id 18, wireType 0 =*/144).int32(message.playerBattleState); - if (message.rollbackEstimatedDt != null && Object.hasOwnProperty.call(message, "rollbackEstimatedDt")) - writer.uint32(/* id 19, wireType 1 =*/153).double(message.rollbackEstimatedDt); if (message.rollbackEstimatedDtMillis != null && Object.hasOwnProperty.call(message, "rollbackEstimatedDtMillis")) - writer.uint32(/* id 20, wireType 1 =*/161).double(message.rollbackEstimatedDtMillis); + writer.uint32(/* id 19, wireType 1 =*/153).double(message.rollbackEstimatedDtMillis); if (message.rollbackEstimatedDtNanos != null && Object.hasOwnProperty.call(message, "rollbackEstimatedDtNanos")) - writer.uint32(/* id 21, wireType 0 =*/168).int64(message.rollbackEstimatedDtNanos); + writer.uint32(/* id 20, wireType 0 =*/160).int64(message.rollbackEstimatedDtNanos); + if (message.worldToVirtualGridRatio != null && Object.hasOwnProperty.call(message, "worldToVirtualGridRatio")) + writer.uint32(/* id 21, wireType 1 =*/169).double(message.worldToVirtualGridRatio); + if (message.virtualGridToWorldRatio != null && Object.hasOwnProperty.call(message, "virtualGridToWorldRatio")) + writer.uint32(/* id 22, wireType 1 =*/177).double(message.virtualGridToWorldRatio); return writer; }; /** - * Encodes the specified BattleColliderInfo message, length delimited. Does not implicitly {@link treasurehunterx.BattleColliderInfo.verify|verify} messages. + * Encodes the specified BattleColliderInfo message, length delimited. Does not implicitly {@link protos.BattleColliderInfo.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static - * @param {treasurehunterx.BattleColliderInfo} message BattleColliderInfo message or plain object to encode + * @param {protos.BattleColliderInfo} message BattleColliderInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -1478,18 +1501,18 @@ $root.treasurehunterx = (function() { /** * Decodes a BattleColliderInfo message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.BattleColliderInfo} BattleColliderInfo + * @returns {protos.BattleColliderInfo} BattleColliderInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ BattleColliderInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.BattleColliderInfo(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.BattleColliderInfo(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1510,7 +1533,7 @@ $root.treasurehunterx = (function() { key = reader.string(); break; case 2: - value = $root.treasurehunterx.Vec2DList.decode(reader, reader.uint32()); + value = $root.sharedprotos.Vec2DList.decode(reader, reader.uint32()); break; default: reader.skipType(tag2 & 7); @@ -1533,7 +1556,7 @@ $root.treasurehunterx = (function() { key = reader.string(); break; case 2: - value = $root.treasurehunterx.Polygon2DList.decode(reader, reader.uint32()); + value = $root.sharedprotos.Polygon2DList.decode(reader, reader.uint32()); break; default: reader.skipType(tag2 & 7); @@ -1604,17 +1627,21 @@ $root.treasurehunterx = (function() { break; } case 19: { - message.rollbackEstimatedDt = reader.double(); - break; - } - case 20: { message.rollbackEstimatedDtMillis = reader.double(); break; } - case 21: { + case 20: { message.rollbackEstimatedDtNanos = reader.int64(); break; } + case 21: { + message.worldToVirtualGridRatio = reader.double(); + break; + } + case 22: { + message.virtualGridToWorldRatio = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -1626,10 +1653,10 @@ $root.treasurehunterx = (function() { /** * Decodes a BattleColliderInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.BattleColliderInfo} BattleColliderInfo + * @returns {protos.BattleColliderInfo} BattleColliderInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -1642,7 +1669,7 @@ $root.treasurehunterx = (function() { /** * Verifies a BattleColliderInfo message. * @function verify - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -1658,7 +1685,7 @@ $root.treasurehunterx = (function() { return "strToVec2DListMap: object expected"; var key = Object.keys(message.strToVec2DListMap); for (var i = 0; i < key.length; ++i) { - var error = $root.treasurehunterx.Vec2DList.verify(message.strToVec2DListMap[key[i]]); + var error = $root.sharedprotos.Vec2DList.verify(message.strToVec2DListMap[key[i]]); if (error) return "strToVec2DListMap." + error; } @@ -1668,7 +1695,7 @@ $root.treasurehunterx = (function() { return "strToPolygon2DListMap: object expected"; var key = Object.keys(message.strToPolygon2DListMap); for (var i = 0; i < key.length; ++i) { - var error = $root.treasurehunterx.Polygon2DList.verify(message.strToPolygon2DListMap[key[i]]); + var error = $root.sharedprotos.Polygon2DList.verify(message.strToPolygon2DListMap[key[i]]); if (error) return "strToPolygon2DListMap." + error; } @@ -1718,50 +1745,53 @@ $root.treasurehunterx = (function() { if (message.playerBattleState != null && message.hasOwnProperty("playerBattleState")) if (!$util.isInteger(message.playerBattleState)) return "playerBattleState: integer expected"; - if (message.rollbackEstimatedDt != null && message.hasOwnProperty("rollbackEstimatedDt")) - if (typeof message.rollbackEstimatedDt !== "number") - return "rollbackEstimatedDt: number expected"; if (message.rollbackEstimatedDtMillis != null && message.hasOwnProperty("rollbackEstimatedDtMillis")) if (typeof message.rollbackEstimatedDtMillis !== "number") return "rollbackEstimatedDtMillis: number expected"; if (message.rollbackEstimatedDtNanos != null && message.hasOwnProperty("rollbackEstimatedDtNanos")) if (!$util.isInteger(message.rollbackEstimatedDtNanos) && !(message.rollbackEstimatedDtNanos && $util.isInteger(message.rollbackEstimatedDtNanos.low) && $util.isInteger(message.rollbackEstimatedDtNanos.high))) return "rollbackEstimatedDtNanos: integer|Long expected"; + if (message.worldToVirtualGridRatio != null && message.hasOwnProperty("worldToVirtualGridRatio")) + if (typeof message.worldToVirtualGridRatio !== "number") + return "worldToVirtualGridRatio: number expected"; + if (message.virtualGridToWorldRatio != null && message.hasOwnProperty("virtualGridToWorldRatio")) + if (typeof message.virtualGridToWorldRatio !== "number") + return "virtualGridToWorldRatio: number expected"; return null; }; /** * Creates a BattleColliderInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.BattleColliderInfo} BattleColliderInfo + * @returns {protos.BattleColliderInfo} BattleColliderInfo */ BattleColliderInfo.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.BattleColliderInfo) + if (object instanceof $root.protos.BattleColliderInfo) return object; - var message = new $root.treasurehunterx.BattleColliderInfo(); + var message = new $root.protos.BattleColliderInfo(); if (object.stageName != null) message.stageName = String(object.stageName); if (object.strToVec2DListMap) { if (typeof object.strToVec2DListMap !== "object") - throw TypeError(".treasurehunterx.BattleColliderInfo.strToVec2DListMap: object expected"); + throw TypeError(".protos.BattleColliderInfo.strToVec2DListMap: object expected"); message.strToVec2DListMap = {}; for (var keys = Object.keys(object.strToVec2DListMap), i = 0; i < keys.length; ++i) { if (typeof object.strToVec2DListMap[keys[i]] !== "object") - throw TypeError(".treasurehunterx.BattleColliderInfo.strToVec2DListMap: object expected"); - message.strToVec2DListMap[keys[i]] = $root.treasurehunterx.Vec2DList.fromObject(object.strToVec2DListMap[keys[i]]); + throw TypeError(".protos.BattleColliderInfo.strToVec2DListMap: object expected"); + message.strToVec2DListMap[keys[i]] = $root.sharedprotos.Vec2DList.fromObject(object.strToVec2DListMap[keys[i]]); } } if (object.strToPolygon2DListMap) { if (typeof object.strToPolygon2DListMap !== "object") - throw TypeError(".treasurehunterx.BattleColliderInfo.strToPolygon2DListMap: object expected"); + throw TypeError(".protos.BattleColliderInfo.strToPolygon2DListMap: object expected"); message.strToPolygon2DListMap = {}; for (var keys = Object.keys(object.strToPolygon2DListMap), i = 0; i < keys.length; ++i) { if (typeof object.strToPolygon2DListMap[keys[i]] !== "object") - throw TypeError(".treasurehunterx.BattleColliderInfo.strToPolygon2DListMap: object expected"); - message.strToPolygon2DListMap[keys[i]] = $root.treasurehunterx.Polygon2DList.fromObject(object.strToPolygon2DListMap[keys[i]]); + throw TypeError(".protos.BattleColliderInfo.strToPolygon2DListMap: object expected"); + message.strToPolygon2DListMap[keys[i]] = $root.sharedprotos.Polygon2DList.fromObject(object.strToPolygon2DListMap[keys[i]]); } } if (object.stageDiscreteW != null) @@ -1801,8 +1831,6 @@ $root.treasurehunterx = (function() { message.maxChasingRenderFramesPerUpdate = object.maxChasingRenderFramesPerUpdate | 0; if (object.playerBattleState != null) message.playerBattleState = object.playerBattleState | 0; - if (object.rollbackEstimatedDt != null) - message.rollbackEstimatedDt = Number(object.rollbackEstimatedDt); if (object.rollbackEstimatedDtMillis != null) message.rollbackEstimatedDtMillis = Number(object.rollbackEstimatedDtMillis); if (object.rollbackEstimatedDtNanos != null) @@ -1814,15 +1842,19 @@ $root.treasurehunterx = (function() { message.rollbackEstimatedDtNanos = object.rollbackEstimatedDtNanos; else if (typeof object.rollbackEstimatedDtNanos === "object") message.rollbackEstimatedDtNanos = new $util.LongBits(object.rollbackEstimatedDtNanos.low >>> 0, object.rollbackEstimatedDtNanos.high >>> 0).toNumber(); + if (object.worldToVirtualGridRatio != null) + message.worldToVirtualGridRatio = Number(object.worldToVirtualGridRatio); + if (object.virtualGridToWorldRatio != null) + message.virtualGridToWorldRatio = Number(object.virtualGridToWorldRatio); return message; }; /** * Creates a plain object from a BattleColliderInfo message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static - * @param {treasurehunterx.BattleColliderInfo} message BattleColliderInfo + * @param {protos.BattleColliderInfo} message BattleColliderInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -1855,13 +1887,14 @@ $root.treasurehunterx = (function() { object.inputFrameUpsyncDelayTolerance = 0; object.maxChasingRenderFramesPerUpdate = 0; object.playerBattleState = 0; - object.rollbackEstimatedDt = 0; object.rollbackEstimatedDtMillis = 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.rollbackEstimatedDtNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.rollbackEstimatedDtNanos = options.longs === String ? "0" : 0; + object.worldToVirtualGridRatio = 0; + object.virtualGridToWorldRatio = 0; } if (message.stageName != null && message.hasOwnProperty("stageName")) object.stageName = message.stageName; @@ -1869,12 +1902,12 @@ $root.treasurehunterx = (function() { if (message.strToVec2DListMap && (keys2 = Object.keys(message.strToVec2DListMap)).length) { object.strToVec2DListMap = {}; for (var j = 0; j < keys2.length; ++j) - object.strToVec2DListMap[keys2[j]] = $root.treasurehunterx.Vec2DList.toObject(message.strToVec2DListMap[keys2[j]], options); + object.strToVec2DListMap[keys2[j]] = $root.sharedprotos.Vec2DList.toObject(message.strToVec2DListMap[keys2[j]], options); } if (message.strToPolygon2DListMap && (keys2 = Object.keys(message.strToPolygon2DListMap)).length) { object.strToPolygon2DListMap = {}; for (var j = 0; j < keys2.length; ++j) - object.strToPolygon2DListMap[keys2[j]] = $root.treasurehunterx.Polygon2DList.toObject(message.strToPolygon2DListMap[keys2[j]], options); + object.strToPolygon2DListMap[keys2[j]] = $root.sharedprotos.Polygon2DList.toObject(message.strToPolygon2DListMap[keys2[j]], options); } if (message.stageDiscreteW != null && message.hasOwnProperty("stageDiscreteW")) object.stageDiscreteW = message.stageDiscreteW; @@ -1909,8 +1942,6 @@ $root.treasurehunterx = (function() { object.maxChasingRenderFramesPerUpdate = message.maxChasingRenderFramesPerUpdate; if (message.playerBattleState != null && message.hasOwnProperty("playerBattleState")) object.playerBattleState = message.playerBattleState; - if (message.rollbackEstimatedDt != null && message.hasOwnProperty("rollbackEstimatedDt")) - object.rollbackEstimatedDt = options.json && !isFinite(message.rollbackEstimatedDt) ? String(message.rollbackEstimatedDt) : message.rollbackEstimatedDt; if (message.rollbackEstimatedDtMillis != null && message.hasOwnProperty("rollbackEstimatedDtMillis")) object.rollbackEstimatedDtMillis = options.json && !isFinite(message.rollbackEstimatedDtMillis) ? String(message.rollbackEstimatedDtMillis) : message.rollbackEstimatedDtMillis; if (message.rollbackEstimatedDtNanos != null && message.hasOwnProperty("rollbackEstimatedDtNanos")) @@ -1918,13 +1949,17 @@ $root.treasurehunterx = (function() { object.rollbackEstimatedDtNanos = options.longs === String ? String(message.rollbackEstimatedDtNanos) : message.rollbackEstimatedDtNanos; else object.rollbackEstimatedDtNanos = options.longs === String ? $util.Long.prototype.toString.call(message.rollbackEstimatedDtNanos) : options.longs === Number ? new $util.LongBits(message.rollbackEstimatedDtNanos.low >>> 0, message.rollbackEstimatedDtNanos.high >>> 0).toNumber() : message.rollbackEstimatedDtNanos; + if (message.worldToVirtualGridRatio != null && message.hasOwnProperty("worldToVirtualGridRatio")) + object.worldToVirtualGridRatio = options.json && !isFinite(message.worldToVirtualGridRatio) ? String(message.worldToVirtualGridRatio) : message.worldToVirtualGridRatio; + if (message.virtualGridToWorldRatio != null && message.hasOwnProperty("virtualGridToWorldRatio")) + object.virtualGridToWorldRatio = options.json && !isFinite(message.virtualGridToWorldRatio) ? String(message.virtualGridToWorldRatio) : message.virtualGridToWorldRatio; return object; }; /** * Converts this BattleColliderInfo to JSON. * @function toJSON - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @instance * @returns {Object.} JSON object */ @@ -1935,7 +1970,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for BattleColliderInfo * @function getTypeUrl - * @memberof treasurehunterx.BattleColliderInfo + * @memberof protos.BattleColliderInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -1944,39 +1979,39 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.BattleColliderInfo"; + return typeUrlPrefix + "/protos.BattleColliderInfo"; }; return BattleColliderInfo; })(); - treasurehunterx.Player = (function() { + protos.PlayerDownsync = (function() { /** - * Properties of a Player. - * @memberof treasurehunterx - * @interface IPlayer - * @property {number|null} [id] Player id - * @property {number|null} [x] Player x - * @property {number|null} [y] Player y - * @property {treasurehunterx.Direction|null} [dir] Player dir - * @property {number|null} [speed] Player speed - * @property {number|null} [battleState] Player battleState - * @property {number|null} [lastMoveGmtMillis] Player lastMoveGmtMillis - * @property {number|null} [score] Player score - * @property {boolean|null} [removed] Player removed - * @property {number|null} [joinIndex] Player joinIndex + * Properties of a PlayerDownsync. + * @memberof protos + * @interface IPlayerDownsync + * @property {number|null} [id] PlayerDownsync id + * @property {number|null} [virtualGridX] PlayerDownsync virtualGridX + * @property {number|null} [virtualGridY] PlayerDownsync virtualGridY + * @property {sharedprotos.Direction|null} [dir] PlayerDownsync dir + * @property {number|null} [speed] PlayerDownsync speed + * @property {number|null} [battleState] PlayerDownsync battleState + * @property {number|null} [lastMoveGmtMillis] PlayerDownsync lastMoveGmtMillis + * @property {number|null} [score] PlayerDownsync score + * @property {boolean|null} [removed] PlayerDownsync removed + * @property {number|null} [joinIndex] PlayerDownsync joinIndex */ /** - * Constructs a new Player. - * @memberof treasurehunterx - * @classdesc Represents a Player. - * @implements IPlayer + * Constructs a new PlayerDownsync. + * @memberof protos + * @classdesc Represents a PlayerDownsync. + * @implements IPlayerDownsync * @constructor - * @param {treasurehunterx.IPlayer=} [properties] Properties to set + * @param {protos.IPlayerDownsync=} [properties] Properties to set */ - function Player(properties) { + function PlayerDownsync(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1984,119 +2019,119 @@ $root.treasurehunterx = (function() { } /** - * Player id. + * PlayerDownsync id. * @member {number} id - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.id = 0; + PlayerDownsync.prototype.id = 0; /** - * Player x. - * @member {number} x - * @memberof treasurehunterx.Player + * PlayerDownsync virtualGridX. + * @member {number} virtualGridX + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.x = 0; + PlayerDownsync.prototype.virtualGridX = 0; /** - * Player y. - * @member {number} y - * @memberof treasurehunterx.Player + * PlayerDownsync virtualGridY. + * @member {number} virtualGridY + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.y = 0; + PlayerDownsync.prototype.virtualGridY = 0; /** - * Player dir. - * @member {treasurehunterx.Direction|null|undefined} dir - * @memberof treasurehunterx.Player + * PlayerDownsync dir. + * @member {sharedprotos.Direction|null|undefined} dir + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.dir = null; + PlayerDownsync.prototype.dir = null; /** - * Player speed. + * PlayerDownsync speed. * @member {number} speed - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.speed = 0; + PlayerDownsync.prototype.speed = 0; /** - * Player battleState. + * PlayerDownsync battleState. * @member {number} battleState - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.battleState = 0; + PlayerDownsync.prototype.battleState = 0; /** - * Player lastMoveGmtMillis. + * PlayerDownsync lastMoveGmtMillis. * @member {number} lastMoveGmtMillis - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.lastMoveGmtMillis = 0; + PlayerDownsync.prototype.lastMoveGmtMillis = 0; /** - * Player score. + * PlayerDownsync score. * @member {number} score - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.score = 0; + PlayerDownsync.prototype.score = 0; /** - * Player removed. + * PlayerDownsync removed. * @member {boolean} removed - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.removed = false; + PlayerDownsync.prototype.removed = false; /** - * Player joinIndex. + * PlayerDownsync joinIndex. * @member {number} joinIndex - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.joinIndex = 0; + PlayerDownsync.prototype.joinIndex = 0; /** - * Creates a new Player instance using the specified properties. + * Creates a new PlayerDownsync instance using the specified properties. * @function create - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static - * @param {treasurehunterx.IPlayer=} [properties] Properties to set - * @returns {treasurehunterx.Player} Player instance + * @param {protos.IPlayerDownsync=} [properties] Properties to set + * @returns {protos.PlayerDownsync} PlayerDownsync instance */ - Player.create = function create(properties) { - return new Player(properties); + PlayerDownsync.create = function create(properties) { + return new PlayerDownsync(properties); }; /** - * Encodes the specified Player message. Does not implicitly {@link treasurehunterx.Player.verify|verify} messages. + * Encodes the specified PlayerDownsync message. Does not implicitly {@link protos.PlayerDownsync.verify|verify} messages. * @function encode - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static - * @param {treasurehunterx.Player} message Player message or plain object to encode + * @param {protos.PlayerDownsync} message PlayerDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Player.encode = function encode(message, writer) { + PlayerDownsync.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.y); + if (message.virtualGridX != null && Object.hasOwnProperty.call(message, "virtualGridX")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.virtualGridX); + if (message.virtualGridY != null && Object.hasOwnProperty.call(message, "virtualGridY")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.virtualGridY); if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) - $root.treasurehunterx.Direction.encode(message.dir, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.sharedprotos.Direction.encode(message.dir, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.speed != null && Object.hasOwnProperty.call(message, "speed")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.speed); + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.speed); if (message.battleState != null && Object.hasOwnProperty.call(message, "battleState")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.battleState); if (message.lastMoveGmtMillis != null && Object.hasOwnProperty.call(message, "lastMoveGmtMillis")) @@ -2111,33 +2146,33 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified Player message, length delimited. Does not implicitly {@link treasurehunterx.Player.verify|verify} messages. + * Encodes the specified PlayerDownsync message, length delimited. Does not implicitly {@link protos.PlayerDownsync.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static - * @param {treasurehunterx.Player} message Player message or plain object to encode + * @param {protos.PlayerDownsync} message PlayerDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Player.encodeDelimited = function encodeDelimited(message, writer) { + PlayerDownsync.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Player message from the specified reader or buffer. + * Decodes a PlayerDownsync message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Player.decode = function decode(reader, length) { + PlayerDownsync.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.Player(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.PlayerDownsync(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -2146,19 +2181,19 @@ $root.treasurehunterx = (function() { break; } case 2: { - message.x = reader.double(); + message.virtualGridX = reader.int32(); break; } case 3: { - message.y = reader.double(); + message.virtualGridY = reader.int32(); break; } case 4: { - message.dir = $root.treasurehunterx.Direction.decode(reader, reader.uint32()); + message.dir = $root.sharedprotos.Direction.decode(reader, reader.uint32()); break; } case 5: { - message.speed = reader.double(); + message.speed = reader.int32(); break; } case 6: { @@ -2190,49 +2225,49 @@ $root.treasurehunterx = (function() { }; /** - * Decodes a Player message from the specified reader or buffer, length delimited. + * Decodes a PlayerDownsync message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Player.decodeDelimited = function decodeDelimited(reader) { + PlayerDownsync.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Player message. + * Verifies a PlayerDownsync message. * @function verify - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Player.verify = function verify(message) { + PlayerDownsync.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) if (!$util.isInteger(message.id)) return "id: integer expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + if (message.virtualGridX != null && message.hasOwnProperty("virtualGridX")) + if (!$util.isInteger(message.virtualGridX)) + return "virtualGridX: integer expected"; + if (message.virtualGridY != null && message.hasOwnProperty("virtualGridY")) + if (!$util.isInteger(message.virtualGridY)) + return "virtualGridY: integer expected"; if (message.dir != null && message.hasOwnProperty("dir")) { - var error = $root.treasurehunterx.Direction.verify(message.dir); + var error = $root.sharedprotos.Direction.verify(message.dir); if (error) return "dir." + error; } if (message.speed != null && message.hasOwnProperty("speed")) - if (typeof message.speed !== "number") - return "speed: number expected"; + if (!$util.isInteger(message.speed)) + return "speed: integer expected"; if (message.battleState != null && message.hasOwnProperty("battleState")) if (!$util.isInteger(message.battleState)) return "battleState: integer expected"; @@ -2252,30 +2287,30 @@ $root.treasurehunterx = (function() { }; /** - * Creates a Player message from a plain object. Also converts values to their respective internal types. + * Creates a PlayerDownsync message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync */ - Player.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.Player) + PlayerDownsync.fromObject = function fromObject(object) { + if (object instanceof $root.protos.PlayerDownsync) return object; - var message = new $root.treasurehunterx.Player(); + var message = new $root.protos.PlayerDownsync(); if (object.id != null) message.id = object.id | 0; - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + if (object.virtualGridX != null) + message.virtualGridX = object.virtualGridX | 0; + if (object.virtualGridY != null) + message.virtualGridY = object.virtualGridY | 0; if (object.dir != null) { if (typeof object.dir !== "object") - throw TypeError(".treasurehunterx.Player.dir: object expected"); - message.dir = $root.treasurehunterx.Direction.fromObject(object.dir); + throw TypeError(".protos.PlayerDownsync.dir: object expected"); + message.dir = $root.sharedprotos.Direction.fromObject(object.dir); } if (object.speed != null) - message.speed = Number(object.speed); + message.speed = object.speed | 0; if (object.battleState != null) message.battleState = object.battleState | 0; if (object.lastMoveGmtMillis != null) @@ -2290,22 +2325,22 @@ $root.treasurehunterx = (function() { }; /** - * Creates a plain object from a Player message. Also converts values to other types if specified. + * Creates a plain object from a PlayerDownsync message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static - * @param {treasurehunterx.Player} message Player + * @param {protos.PlayerDownsync} message PlayerDownsync * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Player.toObject = function toObject(message, options) { + PlayerDownsync.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.id = 0; - object.x = 0; - object.y = 0; + object.virtualGridX = 0; + object.virtualGridY = 0; object.dir = null; object.speed = 0; object.battleState = 0; @@ -2316,14 +2351,14 @@ $root.treasurehunterx = (function() { } if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.virtualGridX != null && message.hasOwnProperty("virtualGridX")) + object.virtualGridX = message.virtualGridX; + if (message.virtualGridY != null && message.hasOwnProperty("virtualGridY")) + object.virtualGridY = message.virtualGridY; if (message.dir != null && message.hasOwnProperty("dir")) - object.dir = $root.treasurehunterx.Direction.toObject(message.dir, options); + object.dir = $root.sharedprotos.Direction.toObject(message.dir, options); if (message.speed != null && message.hasOwnProperty("speed")) - object.speed = options.json && !isFinite(message.speed) ? String(message.speed) : message.speed; + object.speed = message.speed; if (message.battleState != null && message.hasOwnProperty("battleState")) object.battleState = message.battleState; if (message.lastMoveGmtMillis != null && message.hasOwnProperty("lastMoveGmtMillis")) @@ -2338,56 +2373,57 @@ $root.treasurehunterx = (function() { }; /** - * Converts this Player to JSON. + * Converts this PlayerDownsync to JSON. * @function toJSON - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @instance * @returns {Object.} JSON object */ - Player.prototype.toJSON = function toJSON() { + PlayerDownsync.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Player + * Gets the default type url for PlayerDownsync * @function getTypeUrl - * @memberof treasurehunterx.Player + * @memberof protos.PlayerDownsync * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Player.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PlayerDownsync.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.Player"; + return typeUrlPrefix + "/protos.PlayerDownsync"; }; - return Player; + return PlayerDownsync; })(); - treasurehunterx.PlayerMeta = (function() { + protos.PlayerDownsyncMeta = (function() { /** - * Properties of a PlayerMeta. - * @memberof treasurehunterx - * @interface IPlayerMeta - * @property {number|null} [id] PlayerMeta id - * @property {string|null} [name] PlayerMeta name - * @property {string|null} [displayName] PlayerMeta displayName - * @property {string|null} [avatar] PlayerMeta avatar - * @property {number|null} [joinIndex] PlayerMeta joinIndex + * Properties of a PlayerDownsyncMeta. + * @memberof protos + * @interface IPlayerDownsyncMeta + * @property {number|null} [id] PlayerDownsyncMeta id + * @property {string|null} [name] PlayerDownsyncMeta name + * @property {string|null} [displayName] PlayerDownsyncMeta displayName + * @property {string|null} [avatar] PlayerDownsyncMeta avatar + * @property {number|null} [joinIndex] PlayerDownsyncMeta joinIndex + * @property {number|null} [colliderRadius] PlayerDownsyncMeta colliderRadius */ /** - * Constructs a new PlayerMeta. - * @memberof treasurehunterx - * @classdesc Represents a PlayerMeta. - * @implements IPlayerMeta + * Constructs a new PlayerDownsyncMeta. + * @memberof protos + * @classdesc Represents a PlayerDownsyncMeta. + * @implements IPlayerDownsyncMeta * @constructor - * @param {treasurehunterx.IPlayerMeta=} [properties] Properties to set + * @param {protos.IPlayerDownsyncMeta=} [properties] Properties to set */ - function PlayerMeta(properties) { + function PlayerDownsyncMeta(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2395,67 +2431,75 @@ $root.treasurehunterx = (function() { } /** - * PlayerMeta id. + * PlayerDownsyncMeta id. * @member {number} id - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.id = 0; + PlayerDownsyncMeta.prototype.id = 0; /** - * PlayerMeta name. + * PlayerDownsyncMeta name. * @member {string} name - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.name = ""; + PlayerDownsyncMeta.prototype.name = ""; /** - * PlayerMeta displayName. + * PlayerDownsyncMeta displayName. * @member {string} displayName - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.displayName = ""; + PlayerDownsyncMeta.prototype.displayName = ""; /** - * PlayerMeta avatar. + * PlayerDownsyncMeta avatar. * @member {string} avatar - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.avatar = ""; + PlayerDownsyncMeta.prototype.avatar = ""; /** - * PlayerMeta joinIndex. + * PlayerDownsyncMeta joinIndex. * @member {number} joinIndex - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.joinIndex = 0; + PlayerDownsyncMeta.prototype.joinIndex = 0; /** - * Creates a new PlayerMeta instance using the specified properties. - * @function create - * @memberof treasurehunterx.PlayerMeta - * @static - * @param {treasurehunterx.IPlayerMeta=} [properties] Properties to set - * @returns {treasurehunterx.PlayerMeta} PlayerMeta instance + * PlayerDownsyncMeta colliderRadius. + * @member {number} colliderRadius + * @memberof protos.PlayerDownsyncMeta + * @instance */ - PlayerMeta.create = function create(properties) { - return new PlayerMeta(properties); + PlayerDownsyncMeta.prototype.colliderRadius = 0; + + /** + * Creates a new PlayerDownsyncMeta instance using the specified properties. + * @function create + * @memberof protos.PlayerDownsyncMeta + * @static + * @param {protos.IPlayerDownsyncMeta=} [properties] Properties to set + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta instance + */ + PlayerDownsyncMeta.create = function create(properties) { + return new PlayerDownsyncMeta(properties); }; /** - * Encodes the specified PlayerMeta message. Does not implicitly {@link treasurehunterx.PlayerMeta.verify|verify} messages. + * Encodes the specified PlayerDownsyncMeta message. Does not implicitly {@link protos.PlayerDownsyncMeta.verify|verify} messages. * @function encode - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {treasurehunterx.PlayerMeta} message PlayerMeta message or plain object to encode + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PlayerMeta.encode = function encode(message, writer) { + PlayerDownsyncMeta.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.id != null && Object.hasOwnProperty.call(message, "id")) @@ -2468,37 +2512,39 @@ $root.treasurehunterx = (function() { writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatar); if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.joinIndex); + if (message.colliderRadius != null && Object.hasOwnProperty.call(message, "colliderRadius")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.colliderRadius); return writer; }; /** - * Encodes the specified PlayerMeta message, length delimited. Does not implicitly {@link treasurehunterx.PlayerMeta.verify|verify} messages. + * Encodes the specified PlayerDownsyncMeta message, length delimited. Does not implicitly {@link protos.PlayerDownsyncMeta.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {treasurehunterx.PlayerMeta} message PlayerMeta message or plain object to encode + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PlayerMeta.encodeDelimited = function encodeDelimited(message, writer) { + PlayerDownsyncMeta.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PlayerMeta message from the specified reader or buffer. + * Decodes a PlayerDownsyncMeta message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PlayerMeta.decode = function decode(reader, length) { + PlayerDownsyncMeta.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.PlayerMeta(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.PlayerDownsyncMeta(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -2522,6 +2568,10 @@ $root.treasurehunterx = (function() { message.joinIndex = reader.int32(); break; } + case 6: { + message.colliderRadius = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -2531,30 +2581,30 @@ $root.treasurehunterx = (function() { }; /** - * Decodes a PlayerMeta message from the specified reader or buffer, length delimited. + * Decodes a PlayerDownsyncMeta message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PlayerMeta.decodeDelimited = function decodeDelimited(reader) { + PlayerDownsyncMeta.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PlayerMeta message. + * Verifies a PlayerDownsyncMeta message. * @function verify - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PlayerMeta.verify = function verify(message) { + PlayerDownsyncMeta.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) @@ -2572,21 +2622,24 @@ $root.treasurehunterx = (function() { if (message.joinIndex != null && message.hasOwnProperty("joinIndex")) if (!$util.isInteger(message.joinIndex)) return "joinIndex: integer expected"; + if (message.colliderRadius != null && message.hasOwnProperty("colliderRadius")) + if (typeof message.colliderRadius !== "number") + return "colliderRadius: number expected"; return null; }; /** - * Creates a PlayerMeta message from a plain object. Also converts values to their respective internal types. + * Creates a PlayerDownsyncMeta message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta */ - PlayerMeta.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.PlayerMeta) + PlayerDownsyncMeta.fromObject = function fromObject(object) { + if (object instanceof $root.protos.PlayerDownsyncMeta) return object; - var message = new $root.treasurehunterx.PlayerMeta(); + var message = new $root.protos.PlayerDownsyncMeta(); if (object.id != null) message.id = object.id | 0; if (object.name != null) @@ -2597,19 +2650,21 @@ $root.treasurehunterx = (function() { message.avatar = String(object.avatar); if (object.joinIndex != null) message.joinIndex = object.joinIndex | 0; + if (object.colliderRadius != null) + message.colliderRadius = Number(object.colliderRadius); return message; }; /** - * Creates a plain object from a PlayerMeta message. Also converts values to other types if specified. + * Creates a plain object from a PlayerDownsyncMeta message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {treasurehunterx.PlayerMeta} message PlayerMeta + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PlayerMeta.toObject = function toObject(message, options) { + PlayerDownsyncMeta.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -2619,6 +2674,7 @@ $root.treasurehunterx = (function() { object.displayName = ""; object.avatar = ""; object.joinIndex = 0; + object.colliderRadius = 0; } if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; @@ -2630,43 +2686,45 @@ $root.treasurehunterx = (function() { object.avatar = message.avatar; if (message.joinIndex != null && message.hasOwnProperty("joinIndex")) object.joinIndex = message.joinIndex; + if (message.colliderRadius != null && message.hasOwnProperty("colliderRadius")) + object.colliderRadius = options.json && !isFinite(message.colliderRadius) ? String(message.colliderRadius) : message.colliderRadius; return object; }; /** - * Converts this PlayerMeta to JSON. + * Converts this PlayerDownsyncMeta to JSON. * @function toJSON - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance * @returns {Object.} JSON object */ - PlayerMeta.prototype.toJSON = function toJSON() { + PlayerDownsyncMeta.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PlayerMeta + * Gets the default type url for PlayerDownsyncMeta * @function getTypeUrl - * @memberof treasurehunterx.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PlayerMeta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PlayerDownsyncMeta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.PlayerMeta"; + return typeUrlPrefix + "/protos.PlayerDownsyncMeta"; }; - return PlayerMeta; + return PlayerDownsyncMeta; })(); - treasurehunterx.InputFrameUpsync = (function() { + protos.InputFrameUpsync = (function() { /** * Properties of an InputFrameUpsync. - * @memberof treasurehunterx + * @memberof protos * @interface IInputFrameUpsync * @property {number|null} [inputFrameId] InputFrameUpsync inputFrameId * @property {number|null} [encodedDir] InputFrameUpsync encodedDir @@ -2674,11 +2732,11 @@ $root.treasurehunterx = (function() { /** * Constructs a new InputFrameUpsync. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents an InputFrameUpsync. * @implements IInputFrameUpsync * @constructor - * @param {treasurehunterx.IInputFrameUpsync=} [properties] Properties to set + * @param {protos.IInputFrameUpsync=} [properties] Properties to set */ function InputFrameUpsync(properties) { if (properties) @@ -2690,7 +2748,7 @@ $root.treasurehunterx = (function() { /** * InputFrameUpsync inputFrameId. * @member {number} inputFrameId - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @instance */ InputFrameUpsync.prototype.inputFrameId = 0; @@ -2698,7 +2756,7 @@ $root.treasurehunterx = (function() { /** * InputFrameUpsync encodedDir. * @member {number} encodedDir - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @instance */ InputFrameUpsync.prototype.encodedDir = 0; @@ -2706,21 +2764,21 @@ $root.treasurehunterx = (function() { /** * Creates a new InputFrameUpsync instance using the specified properties. * @function create - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static - * @param {treasurehunterx.IInputFrameUpsync=} [properties] Properties to set - * @returns {treasurehunterx.InputFrameUpsync} InputFrameUpsync instance + * @param {protos.IInputFrameUpsync=} [properties] Properties to set + * @returns {protos.InputFrameUpsync} InputFrameUpsync instance */ InputFrameUpsync.create = function create(properties) { return new InputFrameUpsync(properties); }; /** - * Encodes the specified InputFrameUpsync message. Does not implicitly {@link treasurehunterx.InputFrameUpsync.verify|verify} messages. + * Encodes the specified InputFrameUpsync message. Does not implicitly {@link protos.InputFrameUpsync.verify|verify} messages. * @function encode - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static - * @param {treasurehunterx.InputFrameUpsync} message InputFrameUpsync message or plain object to encode + * @param {protos.InputFrameUpsync} message InputFrameUpsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -2735,11 +2793,11 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified InputFrameUpsync message, length delimited. Does not implicitly {@link treasurehunterx.InputFrameUpsync.verify|verify} messages. + * Encodes the specified InputFrameUpsync message, length delimited. Does not implicitly {@link protos.InputFrameUpsync.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static - * @param {treasurehunterx.InputFrameUpsync} message InputFrameUpsync message or plain object to encode + * @param {protos.InputFrameUpsync} message InputFrameUpsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -2750,18 +2808,18 @@ $root.treasurehunterx = (function() { /** * Decodes an InputFrameUpsync message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.InputFrameUpsync} InputFrameUpsync + * @returns {protos.InputFrameUpsync} InputFrameUpsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ InputFrameUpsync.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.InputFrameUpsync(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.InputFrameUpsync(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -2784,10 +2842,10 @@ $root.treasurehunterx = (function() { /** * Decodes an InputFrameUpsync message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.InputFrameUpsync} InputFrameUpsync + * @returns {protos.InputFrameUpsync} InputFrameUpsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -2800,7 +2858,7 @@ $root.treasurehunterx = (function() { /** * Verifies an InputFrameUpsync message. * @function verify - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -2820,15 +2878,15 @@ $root.treasurehunterx = (function() { /** * Creates an InputFrameUpsync message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.InputFrameUpsync} InputFrameUpsync + * @returns {protos.InputFrameUpsync} InputFrameUpsync */ InputFrameUpsync.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.InputFrameUpsync) + if (object instanceof $root.protos.InputFrameUpsync) return object; - var message = new $root.treasurehunterx.InputFrameUpsync(); + var message = new $root.protos.InputFrameUpsync(); if (object.inputFrameId != null) message.inputFrameId = object.inputFrameId | 0; if (object.encodedDir != null) @@ -2839,9 +2897,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from an InputFrameUpsync message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static - * @param {treasurehunterx.InputFrameUpsync} message InputFrameUpsync + * @param {protos.InputFrameUpsync} message InputFrameUpsync * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -2863,7 +2921,7 @@ $root.treasurehunterx = (function() { /** * Converts this InputFrameUpsync to JSON. * @function toJSON - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @instance * @returns {Object.} JSON object */ @@ -2874,7 +2932,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for InputFrameUpsync * @function getTypeUrl - * @memberof treasurehunterx.InputFrameUpsync + * @memberof protos.InputFrameUpsync * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -2883,17 +2941,17 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.InputFrameUpsync"; + return typeUrlPrefix + "/protos.InputFrameUpsync"; }; return InputFrameUpsync; })(); - treasurehunterx.InputFrameDownsync = (function() { + protos.InputFrameDownsync = (function() { /** * Properties of an InputFrameDownsync. - * @memberof treasurehunterx + * @memberof protos * @interface IInputFrameDownsync * @property {number|null} [inputFrameId] InputFrameDownsync inputFrameId * @property {Array.|null} [inputList] InputFrameDownsync inputList @@ -2902,11 +2960,11 @@ $root.treasurehunterx = (function() { /** * Constructs a new InputFrameDownsync. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents an InputFrameDownsync. * @implements IInputFrameDownsync * @constructor - * @param {treasurehunterx.IInputFrameDownsync=} [properties] Properties to set + * @param {protos.IInputFrameDownsync=} [properties] Properties to set */ function InputFrameDownsync(properties) { this.inputList = []; @@ -2919,7 +2977,7 @@ $root.treasurehunterx = (function() { /** * InputFrameDownsync inputFrameId. * @member {number} inputFrameId - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @instance */ InputFrameDownsync.prototype.inputFrameId = 0; @@ -2927,7 +2985,7 @@ $root.treasurehunterx = (function() { /** * InputFrameDownsync inputList. * @member {Array.} inputList - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @instance */ InputFrameDownsync.prototype.inputList = $util.emptyArray; @@ -2935,7 +2993,7 @@ $root.treasurehunterx = (function() { /** * InputFrameDownsync confirmedList. * @member {number|Long} confirmedList - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @instance */ InputFrameDownsync.prototype.confirmedList = $util.Long ? $util.Long.fromBits(0,0,true) : 0; @@ -2943,21 +3001,21 @@ $root.treasurehunterx = (function() { /** * Creates a new InputFrameDownsync instance using the specified properties. * @function create - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static - * @param {treasurehunterx.IInputFrameDownsync=} [properties] Properties to set - * @returns {treasurehunterx.InputFrameDownsync} InputFrameDownsync instance + * @param {protos.IInputFrameDownsync=} [properties] Properties to set + * @returns {protos.InputFrameDownsync} InputFrameDownsync instance */ InputFrameDownsync.create = function create(properties) { return new InputFrameDownsync(properties); }; /** - * Encodes the specified InputFrameDownsync message. Does not implicitly {@link treasurehunterx.InputFrameDownsync.verify|verify} messages. + * Encodes the specified InputFrameDownsync message. Does not implicitly {@link protos.InputFrameDownsync.verify|verify} messages. * @function encode - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static - * @param {treasurehunterx.InputFrameDownsync} message InputFrameDownsync message or plain object to encode + * @param {protos.InputFrameDownsync} message InputFrameDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -2978,11 +3036,11 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified InputFrameDownsync message, length delimited. Does not implicitly {@link treasurehunterx.InputFrameDownsync.verify|verify} messages. + * Encodes the specified InputFrameDownsync message, length delimited. Does not implicitly {@link protos.InputFrameDownsync.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static - * @param {treasurehunterx.InputFrameDownsync} message InputFrameDownsync message or plain object to encode + * @param {protos.InputFrameDownsync} message InputFrameDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -2993,18 +3051,18 @@ $root.treasurehunterx = (function() { /** * Decodes an InputFrameDownsync message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.InputFrameDownsync} InputFrameDownsync + * @returns {protos.InputFrameDownsync} InputFrameDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ InputFrameDownsync.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.InputFrameDownsync(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.InputFrameDownsync(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3038,10 +3096,10 @@ $root.treasurehunterx = (function() { /** * Decodes an InputFrameDownsync message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.InputFrameDownsync} InputFrameDownsync + * @returns {protos.InputFrameDownsync} InputFrameDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3054,7 +3112,7 @@ $root.treasurehunterx = (function() { /** * Verifies an InputFrameDownsync message. * @function verify - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3081,20 +3139,20 @@ $root.treasurehunterx = (function() { /** * Creates an InputFrameDownsync message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.InputFrameDownsync} InputFrameDownsync + * @returns {protos.InputFrameDownsync} InputFrameDownsync */ InputFrameDownsync.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.InputFrameDownsync) + if (object instanceof $root.protos.InputFrameDownsync) return object; - var message = new $root.treasurehunterx.InputFrameDownsync(); + var message = new $root.protos.InputFrameDownsync(); if (object.inputFrameId != null) message.inputFrameId = object.inputFrameId | 0; if (object.inputList) { if (!Array.isArray(object.inputList)) - throw TypeError(".treasurehunterx.InputFrameDownsync.inputList: array expected"); + throw TypeError(".protos.InputFrameDownsync.inputList: array expected"); message.inputList = []; for (var i = 0; i < object.inputList.length; ++i) if ($util.Long) @@ -3121,9 +3179,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from an InputFrameDownsync message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static - * @param {treasurehunterx.InputFrameDownsync} message InputFrameDownsync + * @param {protos.InputFrameDownsync} message InputFrameDownsync * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3162,7 +3220,7 @@ $root.treasurehunterx = (function() { /** * Converts this InputFrameDownsync to JSON. * @function toJSON - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @instance * @returns {Object.} JSON object */ @@ -3173,7 +3231,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for InputFrameDownsync * @function getTypeUrl - * @memberof treasurehunterx.InputFrameDownsync + * @memberof protos.InputFrameDownsync * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -3182,28 +3240,28 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.InputFrameDownsync"; + return typeUrlPrefix + "/protos.InputFrameDownsync"; }; return InputFrameDownsync; })(); - treasurehunterx.HeartbeatUpsync = (function() { + protos.HeartbeatUpsync = (function() { /** * Properties of a HeartbeatUpsync. - * @memberof treasurehunterx + * @memberof protos * @interface IHeartbeatUpsync * @property {number|Long|null} [clientTimestamp] HeartbeatUpsync clientTimestamp */ /** * Constructs a new HeartbeatUpsync. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents a HeartbeatUpsync. * @implements IHeartbeatUpsync * @constructor - * @param {treasurehunterx.IHeartbeatUpsync=} [properties] Properties to set + * @param {protos.IHeartbeatUpsync=} [properties] Properties to set */ function HeartbeatUpsync(properties) { if (properties) @@ -3215,7 +3273,7 @@ $root.treasurehunterx = (function() { /** * HeartbeatUpsync clientTimestamp. * @member {number|Long} clientTimestamp - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @instance */ HeartbeatUpsync.prototype.clientTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; @@ -3223,21 +3281,21 @@ $root.treasurehunterx = (function() { /** * Creates a new HeartbeatUpsync instance using the specified properties. * @function create - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static - * @param {treasurehunterx.IHeartbeatUpsync=} [properties] Properties to set - * @returns {treasurehunterx.HeartbeatUpsync} HeartbeatUpsync instance + * @param {protos.IHeartbeatUpsync=} [properties] Properties to set + * @returns {protos.HeartbeatUpsync} HeartbeatUpsync instance */ HeartbeatUpsync.create = function create(properties) { return new HeartbeatUpsync(properties); }; /** - * Encodes the specified HeartbeatUpsync message. Does not implicitly {@link treasurehunterx.HeartbeatUpsync.verify|verify} messages. + * Encodes the specified HeartbeatUpsync message. Does not implicitly {@link protos.HeartbeatUpsync.verify|verify} messages. * @function encode - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static - * @param {treasurehunterx.HeartbeatUpsync} message HeartbeatUpsync message or plain object to encode + * @param {protos.HeartbeatUpsync} message HeartbeatUpsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3250,11 +3308,11 @@ $root.treasurehunterx = (function() { }; /** - * Encodes the specified HeartbeatUpsync message, length delimited. Does not implicitly {@link treasurehunterx.HeartbeatUpsync.verify|verify} messages. + * Encodes the specified HeartbeatUpsync message, length delimited. Does not implicitly {@link protos.HeartbeatUpsync.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static - * @param {treasurehunterx.HeartbeatUpsync} message HeartbeatUpsync message or plain object to encode + * @param {protos.HeartbeatUpsync} message HeartbeatUpsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3265,18 +3323,18 @@ $root.treasurehunterx = (function() { /** * Decodes a HeartbeatUpsync message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.HeartbeatUpsync} HeartbeatUpsync + * @returns {protos.HeartbeatUpsync} HeartbeatUpsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ HeartbeatUpsync.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.HeartbeatUpsync(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.HeartbeatUpsync(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3295,10 +3353,10 @@ $root.treasurehunterx = (function() { /** * Decodes a HeartbeatUpsync message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.HeartbeatUpsync} HeartbeatUpsync + * @returns {protos.HeartbeatUpsync} HeartbeatUpsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3311,7 +3369,7 @@ $root.treasurehunterx = (function() { /** * Verifies a HeartbeatUpsync message. * @function verify - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3328,15 +3386,15 @@ $root.treasurehunterx = (function() { /** * Creates a HeartbeatUpsync message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.HeartbeatUpsync} HeartbeatUpsync + * @returns {protos.HeartbeatUpsync} HeartbeatUpsync */ HeartbeatUpsync.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.HeartbeatUpsync) + if (object instanceof $root.protos.HeartbeatUpsync) return object; - var message = new $root.treasurehunterx.HeartbeatUpsync(); + var message = new $root.protos.HeartbeatUpsync(); if (object.clientTimestamp != null) if ($util.Long) (message.clientTimestamp = $util.Long.fromValue(object.clientTimestamp)).unsigned = false; @@ -3352,9 +3410,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a HeartbeatUpsync message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static - * @param {treasurehunterx.HeartbeatUpsync} message HeartbeatUpsync + * @param {protos.HeartbeatUpsync} message HeartbeatUpsync * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3379,7 +3437,7 @@ $root.treasurehunterx = (function() { /** * Converts this HeartbeatUpsync to JSON. * @function toJSON - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @instance * @returns {Object.} JSON object */ @@ -3390,7 +3448,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for HeartbeatUpsync * @function getTypeUrl - * @memberof treasurehunterx.HeartbeatUpsync + * @memberof protos.HeartbeatUpsync * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -3399,31 +3457,31 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.HeartbeatUpsync"; + return typeUrlPrefix + "/protos.HeartbeatUpsync"; }; return HeartbeatUpsync; })(); - treasurehunterx.RoomDownsyncFrame = (function() { + protos.RoomDownsyncFrame = (function() { /** * Properties of a RoomDownsyncFrame. - * @memberof treasurehunterx + * @memberof protos * @interface IRoomDownsyncFrame * @property {number|null} [id] RoomDownsyncFrame id - * @property {Object.|null} [players] RoomDownsyncFrame players + * @property {Object.|null} [players] RoomDownsyncFrame players * @property {number|Long|null} [countdownNanos] RoomDownsyncFrame countdownNanos - * @property {Object.|null} [playerMetas] RoomDownsyncFrame playerMetas + * @property {Object.|null} [playerMetas] RoomDownsyncFrame playerMetas */ /** * Constructs a new RoomDownsyncFrame. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents a RoomDownsyncFrame. * @implements IRoomDownsyncFrame * @constructor - * @param {treasurehunterx.IRoomDownsyncFrame=} [properties] Properties to set + * @param {protos.IRoomDownsyncFrame=} [properties] Properties to set */ function RoomDownsyncFrame(properties) { this.players = {}; @@ -3437,15 +3495,15 @@ $root.treasurehunterx = (function() { /** * RoomDownsyncFrame id. * @member {number} id - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @instance */ RoomDownsyncFrame.prototype.id = 0; /** * RoomDownsyncFrame players. - * @member {Object.} players - * @memberof treasurehunterx.RoomDownsyncFrame + * @member {Object.} players + * @memberof protos.RoomDownsyncFrame * @instance */ RoomDownsyncFrame.prototype.players = $util.emptyObject; @@ -3453,15 +3511,15 @@ $root.treasurehunterx = (function() { /** * RoomDownsyncFrame countdownNanos. * @member {number|Long} countdownNanos - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @instance */ RoomDownsyncFrame.prototype.countdownNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * RoomDownsyncFrame playerMetas. - * @member {Object.} playerMetas - * @memberof treasurehunterx.RoomDownsyncFrame + * @member {Object.} playerMetas + * @memberof protos.RoomDownsyncFrame * @instance */ RoomDownsyncFrame.prototype.playerMetas = $util.emptyObject; @@ -3469,21 +3527,21 @@ $root.treasurehunterx = (function() { /** * Creates a new RoomDownsyncFrame instance using the specified properties. * @function create - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static - * @param {treasurehunterx.IRoomDownsyncFrame=} [properties] Properties to set - * @returns {treasurehunterx.RoomDownsyncFrame} RoomDownsyncFrame instance + * @param {protos.IRoomDownsyncFrame=} [properties] Properties to set + * @returns {protos.RoomDownsyncFrame} RoomDownsyncFrame instance */ RoomDownsyncFrame.create = function create(properties) { return new RoomDownsyncFrame(properties); }; /** - * Encodes the specified RoomDownsyncFrame message. Does not implicitly {@link treasurehunterx.RoomDownsyncFrame.verify|verify} messages. + * Encodes the specified RoomDownsyncFrame message. Does not implicitly {@link protos.RoomDownsyncFrame.verify|verify} messages. * @function encode - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static - * @param {treasurehunterx.RoomDownsyncFrame} message RoomDownsyncFrame message or plain object to encode + * @param {protos.RoomDownsyncFrame} message RoomDownsyncFrame message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3495,24 +3553,24 @@ $root.treasurehunterx = (function() { if (message.players != null && Object.hasOwnProperty.call(message, "players")) for (var keys = Object.keys(message.players), i = 0; i < keys.length; ++i) { writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]); - $root.treasurehunterx.Player.encode(message.players[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.protos.PlayerDownsync.encode(message.players[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } if (message.countdownNanos != null && Object.hasOwnProperty.call(message, "countdownNanos")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.countdownNanos); if (message.playerMetas != null && Object.hasOwnProperty.call(message, "playerMetas")) for (var keys = Object.keys(message.playerMetas), i = 0; i < keys.length; ++i) { writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]); - $root.treasurehunterx.PlayerMeta.encode(message.playerMetas[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.protos.PlayerDownsyncMeta.encode(message.playerMetas[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } return writer; }; /** - * Encodes the specified RoomDownsyncFrame message, length delimited. Does not implicitly {@link treasurehunterx.RoomDownsyncFrame.verify|verify} messages. + * Encodes the specified RoomDownsyncFrame message, length delimited. Does not implicitly {@link protos.RoomDownsyncFrame.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static - * @param {treasurehunterx.RoomDownsyncFrame} message RoomDownsyncFrame message or plain object to encode + * @param {protos.RoomDownsyncFrame} message RoomDownsyncFrame message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3523,18 +3581,18 @@ $root.treasurehunterx = (function() { /** * Decodes a RoomDownsyncFrame message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.RoomDownsyncFrame} RoomDownsyncFrame + * @returns {protos.RoomDownsyncFrame} RoomDownsyncFrame * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ RoomDownsyncFrame.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.RoomDownsyncFrame(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.RoomDownsyncFrame(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3555,7 +3613,7 @@ $root.treasurehunterx = (function() { key = reader.int32(); break; case 2: - value = $root.treasurehunterx.Player.decode(reader, reader.uint32()); + value = $root.protos.PlayerDownsync.decode(reader, reader.uint32()); break; default: reader.skipType(tag2 & 7); @@ -3582,7 +3640,7 @@ $root.treasurehunterx = (function() { key = reader.int32(); break; case 2: - value = $root.treasurehunterx.PlayerMeta.decode(reader, reader.uint32()); + value = $root.protos.PlayerDownsyncMeta.decode(reader, reader.uint32()); break; default: reader.skipType(tag2 & 7); @@ -3603,10 +3661,10 @@ $root.treasurehunterx = (function() { /** * Decodes a RoomDownsyncFrame message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.RoomDownsyncFrame} RoomDownsyncFrame + * @returns {protos.RoomDownsyncFrame} RoomDownsyncFrame * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3619,7 +3677,7 @@ $root.treasurehunterx = (function() { /** * Verifies a RoomDownsyncFrame message. * @function verify - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3638,7 +3696,7 @@ $root.treasurehunterx = (function() { if (!$util.key32Re.test(key[i])) return "players: integer key{k:int32} expected"; { - var error = $root.treasurehunterx.Player.verify(message.players[key[i]]); + var error = $root.protos.PlayerDownsync.verify(message.players[key[i]]); if (error) return "players." + error; } @@ -3655,7 +3713,7 @@ $root.treasurehunterx = (function() { if (!$util.key32Re.test(key[i])) return "playerMetas: integer key{k:int32} expected"; { - var error = $root.treasurehunterx.PlayerMeta.verify(message.playerMetas[key[i]]); + var error = $root.protos.PlayerDownsyncMeta.verify(message.playerMetas[key[i]]); if (error) return "playerMetas." + error; } @@ -3667,25 +3725,25 @@ $root.treasurehunterx = (function() { /** * Creates a RoomDownsyncFrame message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.RoomDownsyncFrame} RoomDownsyncFrame + * @returns {protos.RoomDownsyncFrame} RoomDownsyncFrame */ RoomDownsyncFrame.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.RoomDownsyncFrame) + if (object instanceof $root.protos.RoomDownsyncFrame) return object; - var message = new $root.treasurehunterx.RoomDownsyncFrame(); + var message = new $root.protos.RoomDownsyncFrame(); if (object.id != null) message.id = object.id | 0; if (object.players) { if (typeof object.players !== "object") - throw TypeError(".treasurehunterx.RoomDownsyncFrame.players: object expected"); + throw TypeError(".protos.RoomDownsyncFrame.players: object expected"); message.players = {}; for (var keys = Object.keys(object.players), i = 0; i < keys.length; ++i) { if (typeof object.players[keys[i]] !== "object") - throw TypeError(".treasurehunterx.RoomDownsyncFrame.players: object expected"); - message.players[keys[i]] = $root.treasurehunterx.Player.fromObject(object.players[keys[i]]); + throw TypeError(".protos.RoomDownsyncFrame.players: object expected"); + message.players[keys[i]] = $root.protos.PlayerDownsync.fromObject(object.players[keys[i]]); } } if (object.countdownNanos != null) @@ -3699,12 +3757,12 @@ $root.treasurehunterx = (function() { message.countdownNanos = new $util.LongBits(object.countdownNanos.low >>> 0, object.countdownNanos.high >>> 0).toNumber(); if (object.playerMetas) { if (typeof object.playerMetas !== "object") - throw TypeError(".treasurehunterx.RoomDownsyncFrame.playerMetas: object expected"); + throw TypeError(".protos.RoomDownsyncFrame.playerMetas: object expected"); message.playerMetas = {}; for (var keys = Object.keys(object.playerMetas), i = 0; i < keys.length; ++i) { if (typeof object.playerMetas[keys[i]] !== "object") - throw TypeError(".treasurehunterx.RoomDownsyncFrame.playerMetas: object expected"); - message.playerMetas[keys[i]] = $root.treasurehunterx.PlayerMeta.fromObject(object.playerMetas[keys[i]]); + throw TypeError(".protos.RoomDownsyncFrame.playerMetas: object expected"); + message.playerMetas[keys[i]] = $root.protos.PlayerDownsyncMeta.fromObject(object.playerMetas[keys[i]]); } } return message; @@ -3713,9 +3771,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a RoomDownsyncFrame message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static - * @param {treasurehunterx.RoomDownsyncFrame} message RoomDownsyncFrame + * @param {protos.RoomDownsyncFrame} message RoomDownsyncFrame * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3741,7 +3799,7 @@ $root.treasurehunterx = (function() { if (message.players && (keys2 = Object.keys(message.players)).length) { object.players = {}; for (var j = 0; j < keys2.length; ++j) - object.players[keys2[j]] = $root.treasurehunterx.Player.toObject(message.players[keys2[j]], options); + object.players[keys2[j]] = $root.protos.PlayerDownsync.toObject(message.players[keys2[j]], options); } if (message.countdownNanos != null && message.hasOwnProperty("countdownNanos")) if (typeof message.countdownNanos === "number") @@ -3751,7 +3809,7 @@ $root.treasurehunterx = (function() { if (message.playerMetas && (keys2 = Object.keys(message.playerMetas)).length) { object.playerMetas = {}; for (var j = 0; j < keys2.length; ++j) - object.playerMetas[keys2[j]] = $root.treasurehunterx.PlayerMeta.toObject(message.playerMetas[keys2[j]], options); + object.playerMetas[keys2[j]] = $root.protos.PlayerDownsyncMeta.toObject(message.playerMetas[keys2[j]], options); } return object; }; @@ -3759,7 +3817,7 @@ $root.treasurehunterx = (function() { /** * Converts this RoomDownsyncFrame to JSON. * @function toJSON - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @instance * @returns {Object.} JSON object */ @@ -3770,7 +3828,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for RoomDownsyncFrame * @function getTypeUrl - * @memberof treasurehunterx.RoomDownsyncFrame + * @memberof protos.RoomDownsyncFrame * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -3779,17 +3837,17 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.RoomDownsyncFrame"; + return typeUrlPrefix + "/protos.RoomDownsyncFrame"; }; return RoomDownsyncFrame; })(); - treasurehunterx.WsReq = (function() { + protos.WsReq = (function() { /** * Properties of a WsReq. - * @memberof treasurehunterx + * @memberof protos * @interface IWsReq * @property {number|null} [msgId] WsReq msgId * @property {number|null} [playerId] WsReq playerId @@ -3797,17 +3855,17 @@ $root.treasurehunterx = (function() { * @property {number|null} [joinIndex] WsReq joinIndex * @property {number|null} [ackingFrameId] WsReq ackingFrameId * @property {number|null} [ackingInputFrameId] WsReq ackingInputFrameId - * @property {Array.|null} [inputFrameUpsyncBatch] WsReq inputFrameUpsyncBatch - * @property {treasurehunterx.HeartbeatUpsync|null} [hb] WsReq hb + * @property {Array.|null} [inputFrameUpsyncBatch] WsReq inputFrameUpsyncBatch + * @property {protos.HeartbeatUpsync|null} [hb] WsReq hb */ /** * Constructs a new WsReq. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents a WsReq. * @implements IWsReq * @constructor - * @param {treasurehunterx.IWsReq=} [properties] Properties to set + * @param {protos.IWsReq=} [properties] Properties to set */ function WsReq(properties) { this.inputFrameUpsyncBatch = []; @@ -3820,7 +3878,7 @@ $root.treasurehunterx = (function() { /** * WsReq msgId. * @member {number} msgId - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.msgId = 0; @@ -3828,7 +3886,7 @@ $root.treasurehunterx = (function() { /** * WsReq playerId. * @member {number} playerId - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.playerId = 0; @@ -3836,7 +3894,7 @@ $root.treasurehunterx = (function() { /** * WsReq act. * @member {number} act - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.act = 0; @@ -3844,7 +3902,7 @@ $root.treasurehunterx = (function() { /** * WsReq joinIndex. * @member {number} joinIndex - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.joinIndex = 0; @@ -3852,7 +3910,7 @@ $root.treasurehunterx = (function() { /** * WsReq ackingFrameId. * @member {number} ackingFrameId - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.ackingFrameId = 0; @@ -3860,23 +3918,23 @@ $root.treasurehunterx = (function() { /** * WsReq ackingInputFrameId. * @member {number} ackingInputFrameId - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance */ WsReq.prototype.ackingInputFrameId = 0; /** * WsReq inputFrameUpsyncBatch. - * @member {Array.} inputFrameUpsyncBatch - * @memberof treasurehunterx.WsReq + * @member {Array.} inputFrameUpsyncBatch + * @memberof protos.WsReq * @instance */ WsReq.prototype.inputFrameUpsyncBatch = $util.emptyArray; /** * WsReq hb. - * @member {treasurehunterx.HeartbeatUpsync|null|undefined} hb - * @memberof treasurehunterx.WsReq + * @member {protos.HeartbeatUpsync|null|undefined} hb + * @memberof protos.WsReq * @instance */ WsReq.prototype.hb = null; @@ -3884,21 +3942,21 @@ $root.treasurehunterx = (function() { /** * Creates a new WsReq instance using the specified properties. * @function create - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static - * @param {treasurehunterx.IWsReq=} [properties] Properties to set - * @returns {treasurehunterx.WsReq} WsReq instance + * @param {protos.IWsReq=} [properties] Properties to set + * @returns {protos.WsReq} WsReq instance */ WsReq.create = function create(properties) { return new WsReq(properties); }; /** - * Encodes the specified WsReq message. Does not implicitly {@link treasurehunterx.WsReq.verify|verify} messages. + * Encodes the specified WsReq message. Does not implicitly {@link protos.WsReq.verify|verify} messages. * @function encode - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static - * @param {treasurehunterx.WsReq} message WsReq message or plain object to encode + * @param {protos.WsReq} message WsReq message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3919,18 +3977,18 @@ $root.treasurehunterx = (function() { writer.uint32(/* id 6, wireType 0 =*/48).int32(message.ackingInputFrameId); if (message.inputFrameUpsyncBatch != null && message.inputFrameUpsyncBatch.length) for (var i = 0; i < message.inputFrameUpsyncBatch.length; ++i) - $root.treasurehunterx.InputFrameUpsync.encode(message.inputFrameUpsyncBatch[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.protos.InputFrameUpsync.encode(message.inputFrameUpsyncBatch[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.hb != null && Object.hasOwnProperty.call(message, "hb")) - $root.treasurehunterx.HeartbeatUpsync.encode(message.hb, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.protos.HeartbeatUpsync.encode(message.hb, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; /** - * Encodes the specified WsReq message, length delimited. Does not implicitly {@link treasurehunterx.WsReq.verify|verify} messages. + * Encodes the specified WsReq message, length delimited. Does not implicitly {@link protos.WsReq.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static - * @param {treasurehunterx.WsReq} message WsReq message or plain object to encode + * @param {protos.WsReq} message WsReq message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3941,18 +3999,18 @@ $root.treasurehunterx = (function() { /** * Decodes a WsReq message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.WsReq} WsReq + * @returns {protos.WsReq} WsReq * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ WsReq.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.WsReq(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.WsReq(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -3983,11 +4041,11 @@ $root.treasurehunterx = (function() { case 7: { if (!(message.inputFrameUpsyncBatch && message.inputFrameUpsyncBatch.length)) message.inputFrameUpsyncBatch = []; - message.inputFrameUpsyncBatch.push($root.treasurehunterx.InputFrameUpsync.decode(reader, reader.uint32())); + message.inputFrameUpsyncBatch.push($root.protos.InputFrameUpsync.decode(reader, reader.uint32())); break; } case 8: { - message.hb = $root.treasurehunterx.HeartbeatUpsync.decode(reader, reader.uint32()); + message.hb = $root.protos.HeartbeatUpsync.decode(reader, reader.uint32()); break; } default: @@ -4001,10 +4059,10 @@ $root.treasurehunterx = (function() { /** * Decodes a WsReq message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.WsReq} WsReq + * @returns {protos.WsReq} WsReq * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -4017,7 +4075,7 @@ $root.treasurehunterx = (function() { /** * Verifies a WsReq message. * @function verify - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -4047,13 +4105,13 @@ $root.treasurehunterx = (function() { if (!Array.isArray(message.inputFrameUpsyncBatch)) return "inputFrameUpsyncBatch: array expected"; for (var i = 0; i < message.inputFrameUpsyncBatch.length; ++i) { - var error = $root.treasurehunterx.InputFrameUpsync.verify(message.inputFrameUpsyncBatch[i]); + var error = $root.protos.InputFrameUpsync.verify(message.inputFrameUpsyncBatch[i]); if (error) return "inputFrameUpsyncBatch." + error; } } if (message.hb != null && message.hasOwnProperty("hb")) { - var error = $root.treasurehunterx.HeartbeatUpsync.verify(message.hb); + var error = $root.protos.HeartbeatUpsync.verify(message.hb); if (error) return "hb." + error; } @@ -4063,15 +4121,15 @@ $root.treasurehunterx = (function() { /** * Creates a WsReq message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.WsReq} WsReq + * @returns {protos.WsReq} WsReq */ WsReq.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.WsReq) + if (object instanceof $root.protos.WsReq) return object; - var message = new $root.treasurehunterx.WsReq(); + var message = new $root.protos.WsReq(); if (object.msgId != null) message.msgId = object.msgId | 0; if (object.playerId != null) @@ -4086,18 +4144,18 @@ $root.treasurehunterx = (function() { message.ackingInputFrameId = object.ackingInputFrameId | 0; if (object.inputFrameUpsyncBatch) { if (!Array.isArray(object.inputFrameUpsyncBatch)) - throw TypeError(".treasurehunterx.WsReq.inputFrameUpsyncBatch: array expected"); + throw TypeError(".protos.WsReq.inputFrameUpsyncBatch: array expected"); message.inputFrameUpsyncBatch = []; for (var i = 0; i < object.inputFrameUpsyncBatch.length; ++i) { if (typeof object.inputFrameUpsyncBatch[i] !== "object") - throw TypeError(".treasurehunterx.WsReq.inputFrameUpsyncBatch: object expected"); - message.inputFrameUpsyncBatch[i] = $root.treasurehunterx.InputFrameUpsync.fromObject(object.inputFrameUpsyncBatch[i]); + throw TypeError(".protos.WsReq.inputFrameUpsyncBatch: object expected"); + message.inputFrameUpsyncBatch[i] = $root.protos.InputFrameUpsync.fromObject(object.inputFrameUpsyncBatch[i]); } } if (object.hb != null) { if (typeof object.hb !== "object") - throw TypeError(".treasurehunterx.WsReq.hb: object expected"); - message.hb = $root.treasurehunterx.HeartbeatUpsync.fromObject(object.hb); + throw TypeError(".protos.WsReq.hb: object expected"); + message.hb = $root.protos.HeartbeatUpsync.fromObject(object.hb); } return message; }; @@ -4105,9 +4163,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a WsReq message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static - * @param {treasurehunterx.WsReq} message WsReq + * @param {protos.WsReq} message WsReq * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -4141,17 +4199,17 @@ $root.treasurehunterx = (function() { if (message.inputFrameUpsyncBatch && message.inputFrameUpsyncBatch.length) { object.inputFrameUpsyncBatch = []; for (var j = 0; j < message.inputFrameUpsyncBatch.length; ++j) - object.inputFrameUpsyncBatch[j] = $root.treasurehunterx.InputFrameUpsync.toObject(message.inputFrameUpsyncBatch[j], options); + object.inputFrameUpsyncBatch[j] = $root.protos.InputFrameUpsync.toObject(message.inputFrameUpsyncBatch[j], options); } if (message.hb != null && message.hasOwnProperty("hb")) - object.hb = $root.treasurehunterx.HeartbeatUpsync.toObject(message.hb, options); + object.hb = $root.protos.HeartbeatUpsync.toObject(message.hb, options); return object; }; /** * Converts this WsReq to JSON. * @function toJSON - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @instance * @returns {Object.} JSON object */ @@ -4162,7 +4220,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for WsReq * @function getTypeUrl - * @memberof treasurehunterx.WsReq + * @memberof protos.WsReq * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -4171,33 +4229,33 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.WsReq"; + return typeUrlPrefix + "/protos.WsReq"; }; return WsReq; })(); - treasurehunterx.WsResp = (function() { + protos.WsResp = (function() { /** * Properties of a WsResp. - * @memberof treasurehunterx + * @memberof protos * @interface IWsResp * @property {number|null} [ret] WsResp ret * @property {number|null} [echoedMsgId] WsResp echoedMsgId * @property {number|null} [act] WsResp act - * @property {treasurehunterx.RoomDownsyncFrame|null} [rdf] WsResp rdf - * @property {Array.|null} [inputFrameDownsyncBatch] WsResp inputFrameDownsyncBatch - * @property {treasurehunterx.BattleColliderInfo|null} [bciFrame] WsResp bciFrame + * @property {protos.RoomDownsyncFrame|null} [rdf] WsResp rdf + * @property {Array.|null} [inputFrameDownsyncBatch] WsResp inputFrameDownsyncBatch + * @property {protos.BattleColliderInfo|null} [bciFrame] WsResp bciFrame */ /** * Constructs a new WsResp. - * @memberof treasurehunterx + * @memberof protos * @classdesc Represents a WsResp. * @implements IWsResp * @constructor - * @param {treasurehunterx.IWsResp=} [properties] Properties to set + * @param {protos.IWsResp=} [properties] Properties to set */ function WsResp(properties) { this.inputFrameDownsyncBatch = []; @@ -4210,7 +4268,7 @@ $root.treasurehunterx = (function() { /** * WsResp ret. * @member {number} ret - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @instance */ WsResp.prototype.ret = 0; @@ -4218,7 +4276,7 @@ $root.treasurehunterx = (function() { /** * WsResp echoedMsgId. * @member {number} echoedMsgId - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @instance */ WsResp.prototype.echoedMsgId = 0; @@ -4226,31 +4284,31 @@ $root.treasurehunterx = (function() { /** * WsResp act. * @member {number} act - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @instance */ WsResp.prototype.act = 0; /** * WsResp rdf. - * @member {treasurehunterx.RoomDownsyncFrame|null|undefined} rdf - * @memberof treasurehunterx.WsResp + * @member {protos.RoomDownsyncFrame|null|undefined} rdf + * @memberof protos.WsResp * @instance */ WsResp.prototype.rdf = null; /** * WsResp inputFrameDownsyncBatch. - * @member {Array.} inputFrameDownsyncBatch - * @memberof treasurehunterx.WsResp + * @member {Array.} inputFrameDownsyncBatch + * @memberof protos.WsResp * @instance */ WsResp.prototype.inputFrameDownsyncBatch = $util.emptyArray; /** * WsResp bciFrame. - * @member {treasurehunterx.BattleColliderInfo|null|undefined} bciFrame - * @memberof treasurehunterx.WsResp + * @member {protos.BattleColliderInfo|null|undefined} bciFrame + * @memberof protos.WsResp * @instance */ WsResp.prototype.bciFrame = null; @@ -4258,21 +4316,21 @@ $root.treasurehunterx = (function() { /** * Creates a new WsResp instance using the specified properties. * @function create - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static - * @param {treasurehunterx.IWsResp=} [properties] Properties to set - * @returns {treasurehunterx.WsResp} WsResp instance + * @param {protos.IWsResp=} [properties] Properties to set + * @returns {protos.WsResp} WsResp instance */ WsResp.create = function create(properties) { return new WsResp(properties); }; /** - * Encodes the specified WsResp message. Does not implicitly {@link treasurehunterx.WsResp.verify|verify} messages. + * Encodes the specified WsResp message. Does not implicitly {@link protos.WsResp.verify|verify} messages. * @function encode - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static - * @param {treasurehunterx.WsResp} message WsResp message or plain object to encode + * @param {protos.WsResp} message WsResp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -4286,21 +4344,21 @@ $root.treasurehunterx = (function() { if (message.act != null && Object.hasOwnProperty.call(message, "act")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.act); if (message.rdf != null && Object.hasOwnProperty.call(message, "rdf")) - $root.treasurehunterx.RoomDownsyncFrame.encode(message.rdf, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.protos.RoomDownsyncFrame.encode(message.rdf, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.inputFrameDownsyncBatch != null && message.inputFrameDownsyncBatch.length) for (var i = 0; i < message.inputFrameDownsyncBatch.length; ++i) - $root.treasurehunterx.InputFrameDownsync.encode(message.inputFrameDownsyncBatch[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.protos.InputFrameDownsync.encode(message.inputFrameDownsyncBatch[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.bciFrame != null && Object.hasOwnProperty.call(message, "bciFrame")) - $root.treasurehunterx.BattleColliderInfo.encode(message.bciFrame, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.protos.BattleColliderInfo.encode(message.bciFrame, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified WsResp message, length delimited. Does not implicitly {@link treasurehunterx.WsResp.verify|verify} messages. + * Encodes the specified WsResp message, length delimited. Does not implicitly {@link protos.WsResp.verify|verify} messages. * @function encodeDelimited - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static - * @param {treasurehunterx.WsResp} message WsResp message or plain object to encode + * @param {protos.WsResp} message WsResp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -4311,18 +4369,18 @@ $root.treasurehunterx = (function() { /** * Decodes a WsResp message from the specified reader or buffer. * @function decode - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {treasurehunterx.WsResp} WsResp + * @returns {protos.WsResp} WsResp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ WsResp.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.treasurehunterx.WsResp(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.WsResp(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -4339,17 +4397,17 @@ $root.treasurehunterx = (function() { break; } case 4: { - message.rdf = $root.treasurehunterx.RoomDownsyncFrame.decode(reader, reader.uint32()); + message.rdf = $root.protos.RoomDownsyncFrame.decode(reader, reader.uint32()); break; } case 5: { if (!(message.inputFrameDownsyncBatch && message.inputFrameDownsyncBatch.length)) message.inputFrameDownsyncBatch = []; - message.inputFrameDownsyncBatch.push($root.treasurehunterx.InputFrameDownsync.decode(reader, reader.uint32())); + message.inputFrameDownsyncBatch.push($root.protos.InputFrameDownsync.decode(reader, reader.uint32())); break; } case 6: { - message.bciFrame = $root.treasurehunterx.BattleColliderInfo.decode(reader, reader.uint32()); + message.bciFrame = $root.protos.BattleColliderInfo.decode(reader, reader.uint32()); break; } default: @@ -4363,10 +4421,10 @@ $root.treasurehunterx = (function() { /** * Decodes a WsResp message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {treasurehunterx.WsResp} WsResp + * @returns {protos.WsResp} WsResp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -4379,7 +4437,7 @@ $root.treasurehunterx = (function() { /** * Verifies a WsResp message. * @function verify - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -4397,7 +4455,7 @@ $root.treasurehunterx = (function() { if (!$util.isInteger(message.act)) return "act: integer expected"; if (message.rdf != null && message.hasOwnProperty("rdf")) { - var error = $root.treasurehunterx.RoomDownsyncFrame.verify(message.rdf); + var error = $root.protos.RoomDownsyncFrame.verify(message.rdf); if (error) return "rdf." + error; } @@ -4405,13 +4463,13 @@ $root.treasurehunterx = (function() { if (!Array.isArray(message.inputFrameDownsyncBatch)) return "inputFrameDownsyncBatch: array expected"; for (var i = 0; i < message.inputFrameDownsyncBatch.length; ++i) { - var error = $root.treasurehunterx.InputFrameDownsync.verify(message.inputFrameDownsyncBatch[i]); + var error = $root.protos.InputFrameDownsync.verify(message.inputFrameDownsyncBatch[i]); if (error) return "inputFrameDownsyncBatch." + error; } } if (message.bciFrame != null && message.hasOwnProperty("bciFrame")) { - var error = $root.treasurehunterx.BattleColliderInfo.verify(message.bciFrame); + var error = $root.protos.BattleColliderInfo.verify(message.bciFrame); if (error) return "bciFrame." + error; } @@ -4421,15 +4479,15 @@ $root.treasurehunterx = (function() { /** * Creates a WsResp message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static * @param {Object.} object Plain object - * @returns {treasurehunterx.WsResp} WsResp + * @returns {protos.WsResp} WsResp */ WsResp.fromObject = function fromObject(object) { - if (object instanceof $root.treasurehunterx.WsResp) + if (object instanceof $root.protos.WsResp) return object; - var message = new $root.treasurehunterx.WsResp(); + var message = new $root.protos.WsResp(); if (object.ret != null) message.ret = object.ret | 0; if (object.echoedMsgId != null) @@ -4438,23 +4496,23 @@ $root.treasurehunterx = (function() { message.act = object.act | 0; if (object.rdf != null) { if (typeof object.rdf !== "object") - throw TypeError(".treasurehunterx.WsResp.rdf: object expected"); - message.rdf = $root.treasurehunterx.RoomDownsyncFrame.fromObject(object.rdf); + throw TypeError(".protos.WsResp.rdf: object expected"); + message.rdf = $root.protos.RoomDownsyncFrame.fromObject(object.rdf); } if (object.inputFrameDownsyncBatch) { if (!Array.isArray(object.inputFrameDownsyncBatch)) - throw TypeError(".treasurehunterx.WsResp.inputFrameDownsyncBatch: array expected"); + throw TypeError(".protos.WsResp.inputFrameDownsyncBatch: array expected"); message.inputFrameDownsyncBatch = []; for (var i = 0; i < object.inputFrameDownsyncBatch.length; ++i) { if (typeof object.inputFrameDownsyncBatch[i] !== "object") - throw TypeError(".treasurehunterx.WsResp.inputFrameDownsyncBatch: object expected"); - message.inputFrameDownsyncBatch[i] = $root.treasurehunterx.InputFrameDownsync.fromObject(object.inputFrameDownsyncBatch[i]); + throw TypeError(".protos.WsResp.inputFrameDownsyncBatch: object expected"); + message.inputFrameDownsyncBatch[i] = $root.protos.InputFrameDownsync.fromObject(object.inputFrameDownsyncBatch[i]); } } if (object.bciFrame != null) { if (typeof object.bciFrame !== "object") - throw TypeError(".treasurehunterx.WsResp.bciFrame: object expected"); - message.bciFrame = $root.treasurehunterx.BattleColliderInfo.fromObject(object.bciFrame); + throw TypeError(".protos.WsResp.bciFrame: object expected"); + message.bciFrame = $root.protos.BattleColliderInfo.fromObject(object.bciFrame); } return message; }; @@ -4462,9 +4520,9 @@ $root.treasurehunterx = (function() { /** * Creates a plain object from a WsResp message. Also converts values to other types if specified. * @function toObject - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static - * @param {treasurehunterx.WsResp} message WsResp + * @param {protos.WsResp} message WsResp * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -4488,21 +4546,21 @@ $root.treasurehunterx = (function() { if (message.act != null && message.hasOwnProperty("act")) object.act = message.act; if (message.rdf != null && message.hasOwnProperty("rdf")) - object.rdf = $root.treasurehunterx.RoomDownsyncFrame.toObject(message.rdf, options); + object.rdf = $root.protos.RoomDownsyncFrame.toObject(message.rdf, options); if (message.inputFrameDownsyncBatch && message.inputFrameDownsyncBatch.length) { object.inputFrameDownsyncBatch = []; for (var j = 0; j < message.inputFrameDownsyncBatch.length; ++j) - object.inputFrameDownsyncBatch[j] = $root.treasurehunterx.InputFrameDownsync.toObject(message.inputFrameDownsyncBatch[j], options); + object.inputFrameDownsyncBatch[j] = $root.protos.InputFrameDownsync.toObject(message.inputFrameDownsyncBatch[j], options); } if (message.bciFrame != null && message.hasOwnProperty("bciFrame")) - object.bciFrame = $root.treasurehunterx.BattleColliderInfo.toObject(message.bciFrame, options); + object.bciFrame = $root.protos.BattleColliderInfo.toObject(message.bciFrame, options); return object; }; /** * Converts this WsResp to JSON. * @function toJSON - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @instance * @returns {Object.} JSON object */ @@ -4513,7 +4571,7 @@ $root.treasurehunterx = (function() { /** * Gets the default type url for WsResp * @function getTypeUrl - * @memberof treasurehunterx.WsResp + * @memberof protos.WsResp * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -4522,13 +4580,13 @@ $root.treasurehunterx = (function() { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/treasurehunterx.WsResp"; + return typeUrlPrefix + "/protos.WsResp"; }; return WsResp; })(); - return treasurehunterx; + return protos; })(); module.exports = $root; diff --git a/frontend/collision_test_nodejs.js b/frontend/collision_test_nodejs.js new file mode 100644 index 0000000..3db8003 --- /dev/null +++ b/frontend/collision_test_nodejs.js @@ -0,0 +1,39 @@ +const collisions = require('./assets/scripts/modules/Collisions'); + +const collisionSys = new collisions.Collisions(); + +function polygonStr(body) { + let coords = []; + let cnt = body._coords.length; + for (let ix = 0, iy = 1; ix < cnt; ix += 2, iy += 2) { + coords.push([body._coords[ix], body._coords[iy]]); + } + return JSON.stringify(coords); +} + +const playerCollider = collisionSys.createPolygon(1269.665, 1353.335, [[0, 0], [64, 0], [64, 64], [0, 64]]); + +const barrierCollider1 = collisionSys.createPolygon(1277.7159000000001, 1570.5575, [[642.5696, 319.159], [0, 319.15680000000003], [5.7286, 0], [643.7451, 0.9014999999999986]]); +const barrierCollider2 = collisionSys.createPolygon(1289.039, 1318.0805, [[628.626, 54.254500000000064], [0, 56.03250000000003], [0.42449999999999477, 1.1229999999999905], [625.9715000000001, 0]]); +const barrierCollider3 = collisionSys.createPolygon(1207, 1310, [[69, 581], [0, 579], [8, 3], [79, 0]]); + +playerCollider.x += -2.98; +playerCollider.y += -50.0; +collisionSys.update(); + +const effPushback = [0.0, 0.0]; + +const result = collisionSys.createResult(); + +const potentials = playerCollider.potentials(); + +for (const barrier of potentials) { + if (!playerCollider.collides(barrier, result)) continue; + const pushbackX = result.overlap * result.overlap_x; + const pushbackY = result.overlap * result.overlap_y; + console.log(`Overlapped: a=${polygonStr(result.a)}, b=${polygonStr(result.b)}, pushbackX=${pushbackX}, pushbackY=${pushbackY}`); + effPushback[0] += pushbackX; + effPushback[1] += pushbackY; +} + +console.log(`effPushback=${effPushback}`); diff --git a/proto_gen_shortcut.sh b/proto_gen_shortcut.sh index 1b50446..0c9881f 100644 --- a/proto_gen_shortcut.sh +++ b/proto_gen_shortcut.sh @@ -2,11 +2,16 @@ # GOLANG part # You have to download the OS binary "protoc" from `https://developers.google.com/protocol-buffers/docs/downloads` and set it to $PATH appropriately. -# You have to install `proto-gen-go` by `go get -u github.com/golang/protobuf/protoc-gen-go` as instructed in https://developers.google.com/protocol-buffers/docs/gotutorial too. +# You have to install `proto-gen-go` by `go install google.golang.org/protobuf/cmd/protoc-gen-go@latest` as instructed in https://developers.google.com/protocol-buffers/docs/gotutorial#compiling-your-protocol-buffers too. -golang_basedir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/battle_srv -mkdir -p $golang_basedir/pb_output -protoc -I=$golang_basedir/../frontend/assets/resources/pbfiles/ --go_out=$golang_basedir/pb_output room_downsync_frame.proto +golang_basedir_1=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/dnmshared +protoc -I=$golang_basedir_1/../frontend/assets/resources/pbfiles/ --go_out=. geometry.proto +echo "GOLANG part 1 done" + +# [WARNING] The following "room_downsync_frame.proto" is generated in another Go package than "geometry.proto", but the generated Go codes are also required to work with imports correctly! +golang_basedir_2=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/battle_srv +protoc -I=$golang_basedir_2/../frontend/assets/resources/pbfiles/ --go_out=. room_downsync_frame.proto +echo "GOLANG part 2 done" # JS part js_basedir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/frontend @@ -17,6 +22,8 @@ js_outdir=$js_basedir/assets/scripts/modules # npm install -g protobufjs-cli # The specific filename is respected by "frontend/build-templates/wechatgame/game.js". -pbjs -t static-module -w commonjs --keep-case --force-message -o $js_outdir/room_downsync_frame_proto_bundle.forcemsg.js $js_basedir/assets/resources/pbfiles/room_downsync_frame.proto +pbjs -t static-module -w commonjs --keep-case --force-message -o $js_outdir/room_downsync_frame_proto_bundle.forcemsg.js $js_basedir/assets/resources/pbfiles/geometry.proto $js_basedir/assets/resources/pbfiles/room_downsync_frame.proto -sed -i 's#require("protobufjs/minimal")#require("./protobuf-with-floating-num-decoding-endianess-toggle")#g' $js_outdir/room_downsync_frame_proto_bundle.forcemsg.js +sed -i 's#require("protobufjs/minimal")#require("./protobuf-with-floating-num-decoding-endianess-toggle")#g' $js_outdir/room_downsync_frame_proto_bundle.forcemsg.js # Not working in OSX, needs further investigation + +echo "JavaScript part done"