├── fbinstant.d.ts ├── README.md └── fbinstant.js /fbinstant.d.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | //Copyright (c) 2014-present, Egret Technology. 4 | //for fbinstant.6.1.js 5 | declare class FBInstant { 6 | /** 7 | * 获取用户信息. 8 | * Contains functions and properties related to the current player. 9 | */ 10 | static player: FBInstant.FBPlayer; 11 | /** 12 | * 当前游戏的来源信息 13 | * Contains functions and properties related to the current game context. 14 | */ 15 | static context: FBInstant.Context; 16 | /** 17 | * 获取用户的语言设置,例如:zh_CN en_US 18 | * The current locale 19 | */ 20 | static getLocale(): string; 21 | /** 22 | * 获取运行的平台信息: IOS | ANDROID | WEB | MOBILE_WEB 23 | * The platform on which the game is currently running 24 | */ 25 | static getPlatform(): FBPlatform; 26 | /** 27 | * SDK 的版本号,例如: '4.1' 28 | * The string representation of this SDK version. 29 | */ 30 | static getSDKVersion(): string; 31 | /** 32 | * SDK 初始化结束会返回一个 Promise 方法,应当在其他 API 使用前调用 33 | * Initializes the SDK library. 34 | */ 35 | static initializeAsync(): Promise; 36 | /** 37 | * 通知平台资源加载的百分比 38 | * Report the game's initial loading progress. 39 | * @param percentage 0-100 40 | */ 41 | static setLoadingProgress(percentage: number): void; 42 | /** 43 | * 获取平台支持的 api 列表 44 | * Provides a list of API functions that are supported by the client. 45 | */ 46 | static getSupportedAPIs(): string[]; 47 | /** 48 | * 获取入口点数据 49 | * Returns any data object associated with the entry point that the game was launched from. 50 | */ 51 | static getEntryPointData(): Object; 52 | /** 53 | * 用户从哪个入口进入的游戏 54 | * Returns the entry point that the game was launched from 55 | */ 56 | static getEntryPointAsync(): string; 57 | /** 58 | * 设置会话数据 59 | * Sets the data associated with the individual gameplay session for the current context. 60 | */ 61 | static setSessionData(sessionData: Object): void; 62 | /** 63 | * 游戏已完成加载资源,用户点击了开始游戏的按钮 64 | * 返回一个 Promise 方法 65 | * This indicates that the game has finished initial loading and is ready to start. Context information will be up-to-date when the returned promise resolves. 66 | */ 67 | static startGameAsync(): Promise; 68 | /** 69 | * 分享游戏 70 | * This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. 71 | */ 72 | static shareAsync(payload: FBInstant.SharePayload): Promise; 73 | /** 74 | * 通知 Facebook 在游戏中发生的更新 75 | * Informs Facebook of an update that occurred in the game. 76 | */ 77 | static updateAsync(payload: FBInstant.CustomUpdatePayload | FBInstant.LeaderboardUpdatePayload): Promise; 78 | /** 79 | * 请求客户端切换到另一个小游戏 80 | * Request that the client switch to a different Instant Game. 81 | */ 82 | static switchGameAsync(appID: string, data?: string): Promise; 83 | /** 84 | * 用户是否有资格创建快捷方式。 85 | * Returns whether or not the user is eligible to have shortcut creation requested. 86 | */ 87 | static canCreateShortcutAsync(): Promise; 88 | /** 89 | * 如果用户有资格,提示用户创建游戏的快捷方式。 90 | * Prompts the user to create a shortcut to the game if they are eligible to Can only be called once per session. 91 | */ 92 | static createShortcutAsync(): Promise; 93 | /** 94 | * 退出游戏 95 | * Quits the game. 96 | */ 97 | static quit(): void; 98 | /** 99 | * 使用 Facebook 的分析功能来分析应用。 100 | * Log an app event with FB Analytics 101 | * @param eventName 要分析的事件名称 102 | * @param valueToSum 可选,FB分析可以计算它。 103 | * @param parameters 可选,它可以包含多达25个 key-value,以记录事件。key 必须是2-40个字符,只能包含'_', '-', ' '和字母数字的字符。 Value 必须少于100个字符。 104 | */ 105 | static logEvent(eventName: string, valueToSum?: number, parameters?: Object): FBInstant.APIError; 106 | /** 107 | * 设置一个暂停触发的方法 108 | * Set a callback to be fired when a pause event is triggered. 109 | */ 110 | static onPause(func: Function): void; 111 | /** 112 | * 创建交互广告 113 | * Attempt to create an instance of interstitial ad. This instance can then be preloaded and presented. 114 | * @param placementID 在 Audience Network 设置的位置ID 115 | */ 116 | static getInterstitialAdAsync(placementID: String): Promise; 117 | /** 118 | * 创建激励视频广告 119 | * Attempt to create an instance of rewarded video. This instance can then be preloaded and presented. 120 | * @param placementID 在 Audience Network 设置的位置ID 121 | */ 122 | static getRewardedVideoAsync(placementID: String): Promise; 123 | /** 124 | * 尝试将当前玩家与等待他人加入游戏的其他玩家进行匹配 125 | * Attempts to match the current player with other users looking for people to play with 126 | */ 127 | static matchPlayerAsync(matchTag: string, switchContextWhenMatched: boolean): Promise; 128 | /** 129 | * 检查当前玩家是否符合 matchPlayerAsync API 的条件。 130 | * Checks if the current player is eligible for the matchPlayerAsync API. 131 | */ 132 | static checkCanPlayerMatchAsync(): Promise; 133 | /** 134 | * 获取这款小游戏中的特有排行榜。 135 | * An Instant Game leaderboard 136 | */ 137 | static getLeaderboardAsync(name: string): Promise; 138 | } 139 | declare namespace FBInstant { 140 | interface AdInstance { 141 | /** 142 | * 获取广告位id 143 | */ 144 | getPlacementID(): string; 145 | /** 146 | * 加载广告资源 147 | */ 148 | loadAsync(): Promise; 149 | /** 150 | * 播放广告 151 | */ 152 | showAsync(): Promise; 153 | } 154 | interface FBPlayer { 155 | /** 156 | * 玩家的唯一标识ID. 157 | * A unique identifier for the player. 158 | */ 159 | getID(): string; 160 | /** 161 | * 获取玩家的唯一ID和一个签名,签名用来验证该 ID 来自 Facebook ,没有被篡改。 162 | * Fetch the player's unique identifier along with a signature that verifies that the identifier indeed comes from Facebook without being tampered with 163 | */ 164 | getSignedPlayerInfoAsync(requestPayload?: string): Promise; 165 | /** 166 | * 返回一个 promise,表示玩家是否可以与游戏机器人对战。 167 | * Returns a promise that resolves with whether the player can subscribe to the game bot or not. 168 | */ 169 | canSubscribeBotAsync(): Promise; 170 | /** 171 | * 请求玩家订阅游戏机器人。 172 | * Request that the player subscribe the bot associated to the game. 173 | */ 174 | subscribeBotAsync(): Promise; 175 | /** 176 | * 获取用户在Facebook上的的名字,使用用户的语言种类显示 177 | * The player's localized display name. 178 | */ 179 | getName(): string; 180 | /** 181 | * 获取用户在Facebook上的头像的url,头像为正方形,最小尺寸为200x200. 182 | * A url to the player's public profile photo. 183 | */ 184 | getPhoto(): string; 185 | /** 186 | * 取回在FB平台储存的当前用户的数据 187 | * Retrieve data from the designated cloud storage of the current player 188 | * @param keys 数据的 key 的数组 189 | */ 190 | getDataAsync(keys: string[]): Promise; 191 | /** 192 | * 把当前用户的数据储存在FB平台上。 193 | * Set data to be saved to the designated cloud storage of the current player. 194 | * @param data 包含key-value的数据对象. 195 | */ 196 | setDataAsync(data: Object): Promise; 197 | /** 198 | * 立刻保存数据 199 | * Immediately flushes any changes to the player data to the designated cloud storage. 200 | */ 201 | flushDataAsync(): Promise; 202 | /** 203 | * 获取当前玩家数据 204 | * Retrieve stats from the designated cloud storage of the current player. 205 | * @param keys 数据的 key 的数组 206 | */ 207 | getStatsAsync(keys: string[]): Promise; 208 | /** 209 | * 把当前用户的数据储存在FB平台上。 210 | * Set stats to be saved to the designated cloud storage of the current player. 211 | * @param data 包含key-value的数据对象. 212 | */ 213 | setStatsAsync(stats: Object): Promise; 214 | /** 215 | * 把当前玩家数据增量更新储存到FB平台上。 216 | * Increment stats saved in the designated cloud storage of the current player. 217 | * @param data 包含key-value的数据对象. 218 | */ 219 | incrementStatsAsync(increments: Object): Promise; 220 | /** 221 | * 获取玩家好友的信息 222 | * Fetches an array of ConnectedPlayer objects containing information about players that are connected to the current player. 223 | */ 224 | getConnectedPlayersAsync(): Promise; 225 | } 226 | 227 | /** 228 | * 当前游戏的来源信息 229 | */ 230 | interface Context { 231 | /** 232 | * 当前游戏来源的唯一id 233 | * A unique identifier for the current game context. 234 | */ 235 | getID(): string; 236 | /** 237 | * 游戏的来源类型:"POST" | "THREAD" | "GROUP" | "SOLO" 238 | * The type of the current game context. 239 | */ 240 | getType(): string; 241 | /** 242 | * 用这个方法来判断当前游戏环境中游戏参与者的数量是否介于指定的最小值和最大值之间。 243 | * This function determines whether the number of participants in the current game context is between a given minimum and maximum, inclusive. 244 | */ 245 | isSizeBetween(minSize: number, maxSize: number): { answer: boolean, minSize: number, maxSize: number }; 246 | /** 247 | * 切换游戏场景 248 | * Request a switch into a specific context. 249 | */ 250 | switchAsync(id: string): Promise; 251 | /** 252 | * 选择游戏场景 253 | * Opens a context selection dialog for the player. 254 | */ 255 | chooseAsync(options?: { filter?: FBContextFilter[], maxSize?: number, minSize?: number }): Promise; 256 | /** 257 | * 创建游戏场景 258 | * Attempts to create or switch into a context between a specified player and the current player. 259 | */ 260 | createAsync(playerID: string): Promise; 261 | /** 262 | * 获取当前环境中正在玩游戏的玩家列表,它可能包含当前玩家的信息。 263 | * Gets an array of #contextplayer objects containing information about active players 264 | */ 265 | getPlayersAsync(): Promise; 266 | } 267 | /** 268 | * 支付 269 | */ 270 | interface payments { 271 | /** 272 | * 获取游戏的产品目录。 273 | * Fetches the game's product catalog. 274 | */ 275 | getCatalogAsync(): Promise; 276 | /** 277 | * 开始特定产品的购买流程。 278 | * Begins the purchase flow for a specific product. 279 | */ 280 | purchaseAsync(purchaseConfig: PurchaseConfig): Promise; 281 | /** 282 | * 获取玩家未消费的所有购买商品 283 | * Fetches all of the player's unconsumed purchases. 284 | */ 285 | getPurchasesAsync(): Promise; 286 | /** 287 | * 消费当前玩家拥有的特定购买商品 288 | * Consumes a specific purchase belonging to the current player. 289 | */ 290 | consumePurchaseAsync(purchaseToken: string): Promise; 291 | /** 292 | * 设置一个回调,在支付操作可进行时触发。 293 | * Sets a callback to be triggered when Payments operations are available. 294 | */ 295 | onReady(callBack: Function): void; 296 | } 297 | /** 298 | * 游戏好友的信息 299 | */ 300 | interface ConnectedPlayer { 301 | /** 302 | * 关联用户的ID 303 | * Get the id of the connected player. 304 | */ 305 | getID(): string; 306 | /** 307 | * 关联用户的名字 308 | * Get the player's full name. 309 | */ 310 | getName(): string; 311 | /** 312 | * Get the player's public profile photo. 313 | * 关联用户的头像 ulr 地址 314 | */ 315 | getPhoto(): string; 316 | } 317 | /** 318 | * 游戏环境中的玩家 319 | */ 320 | interface ContextPlayer { 321 | /** 322 | * 关联用户的ID 323 | * Get the id of the context player. 324 | */ 325 | getID(): string; 326 | /** 327 | * 关联用户的名字 328 | * Get the player's localized display name. 329 | */ 330 | getName(): string; 331 | /** 332 | * 关联用户的头像 ulr 地址 333 | * Get the player's public profile photo. 334 | */ 335 | getPhoto(): string; 336 | } 337 | /** 338 | * 玩家的签名信息 339 | */ 340 | interface SignedPlayerInfo { 341 | /** 342 | * 玩家的id 343 | * Get the id of the player. 344 | */ 345 | getPlayerID(): string; 346 | /** 347 | * 验证这个对象的签名确实来自Facebook。该字符串是base64url编码的,使用 HMAC 对您应用的 Sccret 进行签名,基于 OAuth 2.0 规范, 348 | * A signature to verify this object indeed comes from Facebook. 349 | */ 350 | getSignature(): string; 351 | 352 | } 353 | /** 354 | * 要分享的内容 355 | */ 356 | interface SharePayload { 357 | /** 358 | * 表示共享的目标 359 | * Indicates the intent of the share. 360 | * "INVITE" | "REQUEST" | "CHALLENGE" | "SHARE" 361 | */ 362 | intent: string; 363 | /** 364 | * 要分享的图像,使用 base64 编码 365 | * A base64 encoded image to be shared. 366 | */ 367 | image: string; 368 | /** 369 | * 要分享的文字 370 | * A text message to be shared. 371 | */ 372 | text: string; 373 | /** 374 | * 一个附加到分享上的数据。 375 | * 所有从这个分享启动的游戏都可以通过 FBInstant.getEntryPointData() 方法获取到该数据。 376 | * A blob of data to attach to the share. 377 | */ 378 | data?: Object; 379 | } 380 | /** 381 | * 自定义更新内容 382 | */ 383 | interface CustomUpdatePayload { 384 | /** 385 | * 对于自定义更新来说,该值应该为 'CUSTOM'. 386 | * For custom updates, this should be 'CUSTOM'. 387 | */ 388 | action: string; 389 | /** 390 | * 自定义更新使用的模板的ID,模板应该在 fbapp-config.json 中预定义。 391 | * 查看配置文件说明:https://developers.facebook.com/docs/games/instant-games/bundle-config 392 | * ID of the template this custom update is using. 393 | */ 394 | template: string; 395 | /** 396 | * 可选,按钮文字。默认情况下,我们本地化的 'Play' 作为按钮文字。 397 | * Optional call-to-action button text. 398 | */ 399 | cta?: string; 400 | /** 401 | * base64 编码的图像信息 402 | * Data URL of a base64 encoded image. 403 | */ 404 | image: string; 405 | /** 406 | * 文本信息 407 | * A text message, or an object with the default text as the value of 'default' and another object mapping locale keys to translations as the value of 'localizations'. 408 | */ 409 | text: string; 410 | /** 411 | * 附加到更新上的数据。当游戏通过分享启动时,可以通过 FBInstant.getEntryPointData() 方法获取。 412 | * 该数据必须少于1000个字符。 413 | * A blob of data to attach to the update. 414 | */ 415 | data?: Object; 416 | /** 417 | * 指定更新的方式。 418 | * Specifies how the update should be delivered. 419 | * 'IMMEDIATE' - 默认值,立即发布更新 420 | * 'LAST' - 当游戏结束时,发布更新 421 | * 'IMMEDIATE_CLEAR' - 立即发布更新,并清除任何其他正在等待的更新 422 | */ 423 | strategy?: string; 424 | /** 425 | * 指定自定义更新的通知设置。可以是“NO_PUSH”或“PUSH”,默认为“NO_PUSH”。 426 | * Specifies notification setting for the custom update. 427 | */ 428 | notification?: string; 429 | } 430 | /** 431 | * 表示 FBInstant.updateAsync 的一项排行榜更新 432 | * Represents a leaderboard update for FBInstant.updateAsync. 433 | */ 434 | interface LeaderboardUpdatePayload { 435 | /** 436 | * 对于排行榜更新,此属性应为 “LEADERBOARD” 437 | * For a leaderboard update, this should be 'LEADERBOARD'. text. 438 | */ 439 | action: string; 440 | /** 441 | * 更新排行榜的名称。 442 | * The name of the leaderboard to feature in the update. 443 | */ 444 | name: string; 445 | /** 446 | * 可选的文本消息 447 | * Optional text message 448 | */ 449 | text?: string; 450 | } 451 | interface APIError { 452 | /** 453 | * 错误码 454 | * The relevant error code 455 | */ 456 | code: string; 457 | /** 458 | * 错误信息 459 | * A message describing the error 460 | */ 461 | message: string; 462 | } 463 | interface Product { 464 | /** 465 | * 产品的名称 466 | * The title of the product 467 | */ 468 | title: string, 469 | /** 470 | * 产品的游戏指定id 471 | * The product's game-specified identifier 472 | */ 473 | productID: string, 474 | /** 475 | * 产品的描述 476 | * The product description 477 | */ 478 | description: string, 479 | /** 480 | * 产品相关图片的链接 481 | * A link to the product's associated image 482 | */ 483 | imageURI: string, 484 | /** 485 | * 产品的价格 486 | * The price of the product 487 | */ 488 | price: string, 489 | /** 490 | * 产品的货币代码 491 | * The currency code for the product 492 | */ 493 | priceCurrencyCode: string, 494 | } 495 | interface PurchaseConfig { 496 | /** 497 | * 产品id 498 | * The identifier of the product to purchase 499 | */ 500 | productID: string, 501 | /** 502 | * 可选参数,开发人员指定的内容,将包含在返回的购买签名请求里。 503 | * An optional developer-specified payload, to be included in the returned purchase's signed request. 504 | */ 505 | developerPayload: string, 506 | } 507 | interface Purchase { 508 | /** 509 | * 可选参数,开发人员指定的内容,将包含在返回的购买签名请求里。 510 | * A developer-specified string, provided during the purchase of the product 511 | */ 512 | developerPayload: string, 513 | /** 514 | * 购买交易的标识符 515 | * The identifier for the purchase transaction 516 | */ 517 | paymentID: string, 518 | /** 519 | * 产品id 520 | * The product's game-specified identifier 521 | */ 522 | productID: string, 523 | /** 524 | * 发生购买时的Unix时间戳 525 | * Unix timestamp of when the purchase occurred 526 | */ 527 | purchaseTime: string, 528 | /** 529 | * 代表可用于消费者购买时的token 530 | * A token representing the purchase that may be used to consume the purchase 531 | */ 532 | purchaseToken: string, 533 | /** 534 | * 购买请求的服务器签名编码 535 | * Server-signed encoding of the purchase request 536 | */ 537 | signedRequest: string, 538 | 539 | } 540 | /** 541 | * 排行榜 542 | * Leaderboard 543 | */ 544 | interface Leaderboard { 545 | /** 546 | * 排行榜的名称 547 | * The name of the leaderboard. 548 | */ 549 | getName(): string, 550 | /** 551 | * 排行榜的上下文id 552 | * The ID of the context that the leaderboard is associated with 553 | */ 554 | getContextID(): string; 555 | /** 556 | * 获取排行榜中玩家总量 557 | * Fetches the total number of player entries in the leaderboard. 558 | */ 559 | getEntryCountAsync(): Promise; 560 | /** 561 | * 更新玩家的分数 562 | * Updates the player's score. 563 | */ 564 | setScoreAsync(score: number, extraData: string): Promise; 565 | /** 566 | * 获取当前玩家游戏榜单的入口点 567 | * Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet. 568 | */ 569 | getPlayerEntryAsync(): Promise; 570 | /** 571 | * 检索一组排行榜条目, 按排行榜中的评分顺序排序。 572 | * Retrieves a set of leaderboard entries, ordered by score ranking in the leaderboard. 573 | */ 574 | getEntriesAsync(count: number, offset: number): Promise; 575 | /** 576 | * 检索与当前玩家分数相邻的玩家(包括当前玩家)的排行榜分录,按照玩家的级别排序。 577 | * Retrieves the leaderboard score entries of the current player's connected players (including the current player), ordered by local rank within the set of connected players. 578 | */ 579 | getConnectedPlayerEntriesAsync(count: number, offset: number): Promise; 580 | } 581 | interface LeaderboardEntry { 582 | /** 583 | * 获取与该项关联的分数。 584 | * Gets the score associated with the entry. 585 | */ 586 | getScore(): number; 587 | /** 588 | * 获取与该项关联的分数, 格式化为与排行榜关联的评分格式。 589 | * Gets the score associated with the entry, formatted with the score format associated with the leaderboard. 590 | */ 591 | getFormattedScore(): string; 592 | /** 593 | * 获取上次更新排行榜条目的时间戳。 594 | * Gets the timestamp of when the leaderboard entry was last updated. 595 | */ 596 | getTimestamp(): number; 597 | /** 598 | * 获取排行榜中玩家得分的等级。 599 | * Gets the rank of the player's score in the leaderboard. 600 | */ 601 | getRank(): number; 602 | /** 603 | * 获取与分数关联的额外数据,由开发者设定 604 | * Gets the developer-specified payload associated with the score, or null if one was not set. 605 | */ 606 | getExtraData(): string; 607 | /** 608 | * 获取有关与该项关联的玩家的信息。 609 | * Gets information about the player associated with the entry. 610 | */ 611 | getPlayer(): LeaderboardPlayer 612 | 613 | } 614 | interface LeaderboardPlayer { 615 | /** 616 | * 玩家的名字 617 | * Gets the player's localized display name. 618 | */ 619 | getName(): string; 620 | /** 621 | * 玩家的头像链接 622 | * Returns a url to the player's public profile photo. 623 | */ 624 | getPhoto(): string; 625 | /** 626 | * 玩家的id 627 | * Gets the game's unique identifier for the player. 628 | */ 629 | getID(): string; 630 | } 631 | } 632 | type FBContextFilter = "NEW_CONTEXT_ONLY" | "INCLUDE_EXISTING_CHALLENGES"; 633 | type FBPlatform = "IOS" | "ANDROID" | "WEB" | "MOBILE_WEB"; 634 | 635 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Facebook Instant Games API 说明 2 | 3 | fbinstant.d.ts for sdk v6.2 4 | 5 | # FBInstant 6 | 7 | Instant Games SDK 的顶级命名空间. 8 | 9 | ## player 10 | 包含与当前玩家相关的功能和属性 11 | 12 | ### getID() 13 | 玩家的唯一标识ID。一个Facebook用户的id是不会改变的。同一个Facebook的用户,在不同的游戏里会有不用的id。 14 | 注意,该方法必须在 FBInstant.initializeAsync() 调用之后使用 15 | 16 | **代码示例:** 17 | 18 | ``` 19 | // 该方法必须在 FBInstant.initializeAsync() 调用之后使用 20 | var playerID = FBInstant.player.getID(); 21 | ``` 22 | 返回值:**string**,用户的唯一ID 23 | 24 | ### getSignedPlayerInfoAsync( ) 25 | 获取玩家的唯一ID和签名,签名用来验证该 ID 来自 Facebook ,并且没有被篡改。该方法必须在 FBInstant.initializeAsync() 调用之后使用 26 | 27 | **参数** 28 | 29 | • requestPayload **String** 一个由开发者指定的信息,包含在已签名的响应消息里。 30 | 31 | **代码示例** 32 | 33 | ``` 34 | 该方法必须在 FBInstant.initializeAsync() 调用之后使用 35 | // resolves. 36 | FBInstant.player.getSignedPlayerInfoAsync('my_metadata') 37 | .then(function (result) { 38 | // ID和签名的验证应放在服务器端处理。 39 | SendToMyServer( 40 | result.getPlayerID(), // 和 FBInstant.player.getID() 相同 41 | result.getSignature(), 42 | 'GAIN_COINS', 43 | 100); 44 | }); 45 | ``` 46 | • 抛出 **INVALID_PARAM** 47 | 48 | • 抛出 **NETWORK_FAILURE** 49 | 50 | • 抛出 **CLIENT_REQUIRES_UPDATE** 51 | 52 | 返回值: **Promise<SignedPlayerInfo>** 一个带有 signedplayerinfo 对象的 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). 53 | 54 | ### canSubscribeBotAsync() 55 | 返回一个 promise,表示玩家是否可以与游戏机器人对战。 56 | 57 | 代码示例: 58 | 59 | ``` 60 | // 该方法必须在 FBInstant.player.subscribeBotAsync() 之前调用 61 | FBInstant.player.canSubscribeBotAsync().then( 62 | can_subscribe => console.log(can_subscribe) 63 | ); 64 | ``` 65 | 返回值: **Promise<boolean>** 玩家是否可以与机器人对战。开发者必须在检测 canSubscribeBotAsync() 之后再调用 subscribeBotAsync()。玩家在游戏中只会看到一次订阅机器人的对话框。 66 | 67 | ### subscribeBotAsync() 68 | 请求玩家订阅游戏机器人。如果失败,API 将返回 reject,如果成功,玩家将订阅游戏机器人。 69 | 70 | 代码示例: 71 | 72 | ``` 73 | FBInstant.player.subscribeBotAsync().then( 74 | // Player is subscribed to the bot 75 | ).catch(function (e) { 76 | // Handle subscription failure 77 | }); 78 | ``` 79 | • 抛出 **INVALID_PARAM** 80 | 81 | • 抛出 **PENDING_REQUEST** 82 | 83 | • 抛出 **CLIENT_REQUIRES_UPDATE** 84 | 85 | 返回值: **Promise** 如果玩家成功订阅游戏机器人,将返回 resolve;如果失败或玩家选择不订阅,将返回 reject. 86 | 87 | ### getName() 88 | 用户在Facebook上的的名字,使用用户的语言种类显示。 89 | 注意,该方法必须在 FBInstant.initializeAsync() 调用之后使用 90 | 91 | 代码示例: 92 | 93 | ``` 94 | //该方法必须在 FBInstant.initializeAsync() 调用之后使用 95 | var playerName = FBInstant.player.getName(); 96 | ``` 97 | 返回值:**string**,用户的名字 98 | 99 | ### getPhoto() 100 | 用户头像的链接地址。头像的图片始终为正方形,尺寸最小为200x200。建议在游戏中使用的时候,先将图像缩放到所需的大小。 101 | 注意,该方法必须在 FBInstant.initializeAsync() 调用之后使用 102 | 103 | 警告:由于跨域的问题,在 canvas 里使用图片会有问题。要防止此情况,请将图像的 cross-origin 属性设置为 "anonymous" 104 | 105 | 代码示例: 106 | 107 | ``` 108 | //该方法必须在 FBInstant.initializeAsync() 调用之后使用 109 | var playerImage = new Image(); 110 | playerImage.crossOrigin = 'anonymous'; 111 | playerImage.src = FBInstant.player.getPhoto(); 112 | ``` 113 | 返回值:**string**,用户的头像的链接地址 114 | 115 | 116 | ### getDataAsync() 117 | 取回当前用户在FB平台储存的数据 118 | 119 | **参数** 120 | 121 | • keys **Array <String>** 一个用来检索数据的key的数组 122 | 123 | 代码示例: 124 | 125 | ``` 126 | FBInstant.player 127 | .getDataAsync(['achievements', 'currentLife']) 128 | .then(function(data) { 129 | console.log('data is loaded'); 130 | var achievements = data['achievements']; 131 | var currentLife = data['currentLife']; 132 | }); 133 | ``` 134 | * Throws **INVALID_PARAM** 135 | * Throws **NETWORK_FAILURE** 136 | * Throws **CLIENT_REQUIRES_UPDATE** 137 | 138 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) <Object> 如果发送的Key存在,则通过Promise 返回储存的数据对象. 139 | 140 | ### setDataAsync() 141 | 把当前用户的数据储存在FB平台上。每个用户可以在每个游戏里储存1MB的数据。 142 | 代码示例: 143 | 144 | **参数** 145 | 146 | • data **Object** 需要储存的数据,包含key-value的数据对象。对象只能包含可以序列化的值,任何不可序列化的值都会导致储存失败。 147 | 148 | 代码示例: 149 | 150 | ``` 151 | FBInstant.player 152 | .setDataAsync({ 153 | achievements: ['medal1', 'medal2', 'medal3'], 154 | currentLife: 300, 155 | }) 156 | .then(function() { 157 | console.log('data is set'); 158 | }); 159 | ``` 160 | * Throws **INVALID_PARAM** 161 | * Throws **NETWORK_FAILURE** 162 | * Throws **PENDING_REQUEST** 163 | * Throws **CLIENT_REQUIRES_UPDATE** 164 | 165 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当数据提交了以后会返回一个 promise。 注意:这个promise 并不意味着这个数据已经被成功保存。它只是验证了数据的有效性,并且随后会被保存。可以保证的是,在调用 player.getDataAsync 方法时,这些设定的数据会生效。 166 | 167 | 168 | ### flushDataAsync() 169 | 将用户的数据立刻更新到云存储。这个方法的调用成本较高,应该主要用于关键的更改。非关键的更改应该依赖于平台来将它们储存到后台。注意: 当该方法未完成时,调用 player.setDataAsync 这个方法会被拒绝. 170 | 171 | 代码示例: 172 | 173 | ``` 174 | FBInstant.player 175 | .setDataAsync({ 176 | achievements: ['medal1', 'medal2', 'medal3'], 177 | currentLife: 300, 178 | }) 179 | .then(FBInstant.player.flushDataAsync) 180 | .then(function() { 181 | console.log('Data persisted to FB!'); 182 | }); 183 | ``` 184 | * Throws **INVALID_PARAM** 185 | * Throws **NETWORK_FAILURE** 186 | * Throws **PENDING_REQUEST** 187 | * Throws **CLIENT_REQUIRES_UPDATE** 188 | 189 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 数据储存成功会返回一个promise,如果保存失败则返回拒绝 190 | 191 | ### getStatsAsync() 192 | 从云存储中获取当前玩家数据。 193 | 194 | **参数** 195 | 196 | • keys **Array <String>?** 一个用来检索状态数据的key的数组(可选)。如果没有参数,将返回所有状态 197 | 198 | 代码示例: 199 | 200 | ``` 201 | FBInstant.player 202 | .getStatsAsync(['level', 'zombiesSlain']) 203 | .then(function(stats) { 204 | console.log('stats are loaded'); 205 | var level = stats['level']; 206 | var zombiesSlain = stats['zombiesSlain']; 207 | }); 208 | ``` 209 | * Throws **INVALID_PARAM** 210 | * Throws **NETWORK_FAILURE** 211 | * Throws **CLIENT_UNSUPPORTED_OPERATION** 212 | 213 | 返回值: **Promise<Object>** 输入的数组作为键值的对象. 214 | 215 | ### setStatsAsync() 216 | 把当前玩家数据储存到云空间里。 217 | 218 | **参数** 219 | 220 | • stats **Object** 一个包含了key-value的对象,将被持久化的存储到云端,它可以在各种方法中使用。该对象只能使用数字作为value,任何非数值类型都会导致存储失败。 221 | 222 | 代码示例: 223 | 224 | ``` 225 | FBInstant.player 226 | .setStatsAsync({ 227 | level: 5, 228 | zombiesSlain: 27, 229 | }) 230 | .then(function() { 231 | console.log('data is set'); 232 | }); 233 | ``` 234 | * Throws **INVALID_PARAM** 235 | * Throws **NETWORK_FAILURE** 236 | * Throws **PENDING_REQUEST** 237 | * Throws **CLIENT_UNSUPPORTED_OPERATION** 238 | 239 | 返回值: **Promise** 当数据提交了以后会返回一个 promise。 注意:这个promise 并不意味着这个数据已经被成功保存。它只是验证了数据的有效性,并且随后会被保存。可以保证的是,在调用 player.getStatsAsync 方法时,这些设定的数据会生效。 240 | 241 | ### incrementStatsAsync() 242 | 把当前玩家数据增量更新储存到云空间里。 243 | 244 | **参数** 245 | 246 | • increments **Object** 一个包含了key-value的对象,它表明了哪个 stat 的值会增量更新。该对象只能使用数字作为value,任何非数值类型都会导致存储失败。 247 | 248 | 代码示例: 249 | 250 | ``` 251 | FBInstant.player 252 | .incrementStatsAsync({ 253 | level: 1, 254 | zombiesSlain: 17, 255 | rank: -1, 256 | }) 257 | .then(function(stats) { 258 | console.log('increments have been made! New values'); 259 | var level = stats['level']; 260 | var zombiesSlain = stats['zombiesSlain']; 261 | }); 262 | ``` 263 | * Throws **INVALID_PARAM** 264 | * Throws **NETWORK_FAILURE** 265 | * Throws **PENDING_REQUEST** 266 | * Throws **CLIENT_UNSUPPORTED_OPERATION** 267 | 268 | 返回值: **Promise** 当数据提交了以后会返回一个 promise。 注意:这个promise 并不意味着这个数据已经被成功保存。它只是验证了数据的有效性,并且随后会被保存。可以保证的是,在调用 player.getStatsAsync 方法时,这些设定的数据会生效。 269 | 270 | ### getConnectedPlayersAsync() 271 | 获取和当前玩家有关联的玩家列表信息(即好友列表)。 272 | 273 | 代码示例: 274 | 275 | ``` 276 | var connectedPlayers = FBInstant.player.getConnectedPlayersAsync() 277 | .then(function(players) { 278 | console.log(players.map(function(player) { 279 | return { 280 | id: player.getID(), 281 | name: player.getName(), 282 | } 283 | })); 284 | }); 285 | // [{id: '123456789', name: 'Paul Atreides'}, {id: '987654321', name: 'Duncan Idaho'}] 286 | 287 | ``` 288 | * Throws **NETWORK_FAILURE** 289 | * Throws **CLIENT_REQUIRES_UPDATE** 290 | 291 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) <Object<ConnectedPlayer>返回一个promise,包含了关联用户对象的数据 292 | 293 | ##context 294 | 包含当前游戏环境的一些方法和属性 295 | 296 | ### getID() 297 | 当前游戏来源的唯一id。它代表了当前游戏是在哪玩的(例如:是在 messenger 的对话里还是 facebook 的网页里)。如果是在独立页面玩的游戏,这个id值为 null。只有在 FBInstant.startGameAsync 方法被调用后,这个结果才能保证是正确的。 298 | 299 | 代码示例: 300 | 301 | ``` 302 | //该方法必须放在 FBInstant.startGameAsync() 的回调里。 303 | var contextID = FBInstant.context.getID(); 304 | ``` 305 | 返回值 **string**,当前游戏环境的id。 306 | 307 | ### getType() 308 | 当前游戏的环境类型。 309 | 310 | 代码示例: 311 | 312 | ``` 313 | //该方法必须放在 FBInstant.startGameAsync() 的回调里。 314 | var contextType = FBInstant.context.getType(); 315 | ``` 316 | 返回值 ("POST" | "THREAD" | "GROUP" | "SOLO") 当前游戏环境的类型。 317 | 318 | ### isSizeBetween() 319 | 用这个方法来判断当前游戏环境中游戏参与者的数量是否介于指定的最小值和最大值之间。 320 | 如果其中一个边界为空,则只对另一个边界进行检查。在当前游戏中第一次调用后,以后永远返回这个结果,不管参数如何改变。直到游戏环境发生改变,才会重置查询结果。 321 | 322 | **参数** 323 | • minSize **number** 要查询的环境值的最小值。 324 | • maxSize **number** 要查询的环境值的最大值。 325 | 326 | 代码示例: 327 | 328 | ``` 329 | console.log(FBInstant.context.isSizeBetween(3, 5)); //(Context size = 4) 330 | // {answer: true, minSize: 3, maxSize: 5} 331 | ``` 332 | ``` 333 | console.log(FBInstant.context.isSizeBetween(5, 7)); //(Context size = 4) 334 | // {answer: false, minSize: 5, maxSize: 7} 335 | ``` 336 | ``` 337 | console.log(FBInstant.context.isSizeBetween(2, 10));// (Context size = 3) 338 | // {answer: true, minSize: 2, maxSize: 10} 339 | console.log(FBInstant.context.isSizeBetween(4, 8));// (Still in same context) 340 | // {answer: true, minSize: 2, maxSize: 10} 341 | ``` 342 | ``` 343 | console.log(FBInstant.context.isSizeBetween(3, null)); //(Context size = 4) 344 | // {answer: true, minSize: 3, maxSize: null} 345 | ``` 346 | ``` 347 | console.log(FBInstant.context.isSizeBetween(null, 3)); (Context size = 4) 348 | // {answer: false, minSize: null, maxSize: 3} 349 | ``` 350 | ``` 351 | console.log(FBInstant.context.isSizeBetween("test", 5)); (Context size = 4) 352 | // null 353 | ``` 354 | ``` 355 | console.log(FBInstant.context.isSizeBetween(0, 100)); (Context size = null) 356 | // null 357 | ``` 358 | 返回值 ContextSizeResponse。 359 | 360 | ### switchAsync() 361 | 请求切换到指定的游戏环境。如果玩家没有进入该环境的权限,或者玩家没有提供进入游戏的许可,该方法都会被拒绝。如果成功切换到指定游戏环境,将会返回一个 promise. 362 | 363 | **参数** 364 | 365 | • id **string** 想要进入的环境ID 366 | 367 | 代码示例: 368 | 369 | ``` 370 | console.log(FBInstant.context.getID()); 371 | // 1122334455 372 | FBInstant.context 373 | .switchAsync('1234567890') 374 | .then(function() { 375 | console.log(FBInstant.context.getID()); 376 | // 1234567890 377 | }); 378 | ``` 379 | * Throws INVALID_PARAM 380 | * Throws SAME_CONTEXT 381 | * Throws NETWORK_FAILURE 382 | * Throws USER_INPUT 383 | * Throws PENDING_REQUEST 384 | * Throws CLIENT_REQUIRES_UPDATE 385 | 386 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当游戏切换到指定环境,返回一个 promise,失败会被拒绝。 387 | 388 | ### chooseAsync() 389 | 为玩家打开一个游戏环境选择列表。如果玩家选择了一个可用的环境,客户端将尝试切到那个环境,如果成功,返回 resolve。如果玩家退出菜单,或者客户端未能切换到新环境,返回 reject. 390 | 391 | **参数** 392 | 393 | • options **Object?** 提供可选择的环境对象。 394 | 395 | • options.filters **Array< ContextFilter>?** 设置一组应用于环境对象的过滤器. 396 | 397 | • options.maxSize **number?** 理想情况下,环境对象的最大值 398 | 399 | • options.minSize **number?** 理想情况下,环境对象的最小值 400 | 401 | 代码示例: 402 | 403 | ``` 404 | console.log(FBInstant.context.getID()); 405 | // 1122334455 406 | FBInstant.context 407 | .chooseAsync() 408 | .then(function() { 409 | console.log(FBInstant.context.getID()); 410 | // 1234567890 411 | }); 412 | ``` 413 | 414 | ``` 415 | console.log(FBInstant.context.getID()); 416 | // 1122334455 417 | FBInstant.context 418 | .chooseAsync({ 419 | filters: ['NEW_CONTEXT_ONLY'], 420 | minSize: 3, 421 | }) 422 | .then(function() { 423 | console.log(FBInstant.context.getID()); 424 | // 1234567890 425 | }); 426 | ``` 427 | * Throws INVALID_PARAM 428 | * Throws SAME_CONTEXT 429 | * Throws NETWORK_FAILURE 430 | * Throws USER_INPUT 431 | * Throws PENDING_REQUEST 432 | * Throws CLIENT_REQUIRES_UPDATE 433 | 434 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当游戏切换到指定环境,返回一个 promise,失败会返回reject(例如,用户取消了对话框) 435 | 436 | ### createAsync() 437 | 在当前玩家和指定玩家之间,尝试创建或切换一个环境。如果指定玩家不能玩这个游戏,或者玩家决绝进入新环境,则返回 recject。如果成功切换到新游戏的环境时,则返回 resolve。 438 | 439 | **参数** 440 | 441 | • playerID **string** 用户的 ID 442 | 443 | 代码示例: 444 | 445 | ``` 446 | console.log(FBInstant.context.getID()); 447 | // 1122334455 448 | FBInstant.context 449 | .createAsync('12345678') 450 | .then(function() { 451 | console.log(FBInstant.context.getID()); 452 | // 5544332211 453 | }); 454 | ``` 455 | * Throws INVALID_PARAM 456 | * Throws SAME_CONTEXT 457 | * Throws NETWORK_FAILURE 458 | * Throws USER_INPUT 459 | * Throws PENDING_REQUEST 460 | * Throws CLIENT_REQUIRES_UPDATE 461 | 462 | 463 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当游戏成功切换到指定环境,返回一个 promise 的 resolve,失败会返回reject 464 | 465 | ### getPlayersAsync() 466 | 获取当前环境中正在玩游戏的玩家列表(在过去 90 天内玩过游戏的用户),它可能包含当前玩家的信息。 467 | 468 | 代码示例: 469 | 470 | ``` 471 | var contextPlayers = FBInstant.context.getPlayersAsync() 472 | .then(function(players) { 473 | console.log(players.map(function(player) { 474 | return { 475 | id: player.getID(), 476 | name: player.getName(), 477 | } 478 | })); 479 | }); 480 | // [{id: '123456789', name: 'Luke'}, {id: '987654321', name: 'Leia'}] 481 | ``` 482 | * Throws NETWORK_FAILURE 483 | * Throws CLIENT_REQUIRES_UPDATE 484 | * Throws INVALID_OPERATION 485 | 486 | 返回 **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) <Array<ContextPlayer>>** 487 | 488 | 489 | ## payments 490 | 【内测】包含与支付和购买游戏产品相关的功能和属性。 491 | 492 | ### getCatalogAsync() 493 | 获取游戏的产品目录。 494 | 495 | 代码示例: 496 | 497 | ``` 498 | FBInstant.payments.getCatalogAsync().then(function (catalog) { 499 | console.log(catalog); // [{productID: '12345', ...}, ...] 500 | }); 501 | ``` 502 | 503 | * Throws CLIENT_UNSUPPORTED_OPERATION 504 | * Throws PAYMENTS_NOT_INITIALIZED 505 | * Throws NETWORK_FAILURE 506 | 507 | 返回值 **Promise**,注册到游戏的一组产品 508 | 509 | ### purchaseAsync() 510 | 开始特定产品的购买流程。 如果在FBInstant.startGameAsync()解析之前调用,将返回 reject。 511 | 512 | **参数** 513 | 514 | • playerID **purchaseConfig** 购买的配置文件 515 | 516 | 代码示例: 517 | 518 | ``` 519 | FBInstant.payments.purchaseAsync({ 520 | productID: '12345', 521 | developerPayload: 'foobar', 522 | }).then(function (purchase) { 523 | console.log(purchase); 524 | // {productID: '12345', purchaseToken: '54321', developerPayload: 'foobar', ...} 525 | }); 526 | ``` 527 | 528 | * Throws CLIENT_UNSUPPORTED_OPERATION 529 | * Throws PAYMENTS_NOT_INITIALIZED 530 | * Throws INVALID_PARAM 531 | * Throws NETWORK_FAILURE 532 | * Throws INVALID_OPERATION 533 | 534 | 535 | 返回值 **Promise**,当玩家成功购买产品时返回 resolve。 失败返回 reject。 536 | 537 | ### getPurchasesAsync() 538 | 获取玩家未消费的所有购买商品。最佳做法是,游戏在客户端表明已准备好执行支付相关操作时,立即获取当前玩家的购买商品。游戏 随后可处理和消费正在等待被消费的任何购买商品。 539 | 540 | 代码示例: 541 | 542 | ``` 543 | FBInstant.payments.getPurchasesAsync().then(function (purchases) { 544 | console.log(purchase); 545 | // [{productID: '12345', ...}, ...] 546 | }); 547 | ``` 548 | 549 | * Throws CLIENT_UNSUPPORTED_OPERATION 550 | * Throws PAYMENTS_NOT_INITIALIZED 551 | * Throws NETWORK_FAILURE 552 | 553 | 返回值 **Promise**,玩家为游戏购买的一组商品。 554 | 555 | 556 | ### consumePurchaseAsync() 557 | 558 | 消费当前玩家拥有的特定购买商品。在为玩家配置商品效果之前,游戏应先请求消费已购买的商品。购买的商品成功消费后,游戏应立即向玩家呈现购买商品的效果。 559 | 560 | **参数** 561 | 562 | • purchaseToken **string** 要使用的购买商品的购买口令。 563 | 564 | 代码示例: 565 | 566 | ``` 567 | FBInstant.payments.consumePurchaseAsync('54321').then(function () { 568 | // Purchase successfully consumed! 569 | // Game should now provision the product to the player 570 | }); 571 | ``` 572 | 573 | * Throws CLIENT_UNSUPPORTED_OPERATION 574 | * Throws PAYMENTS_NOT_INITIALIZED 575 | * Throws INVALID_PARAM 576 | * Throws NETWORK_FAILURE 577 | 578 | 返回值 **Promise**,此 promise 在成功消费已购买的商品时被解析。 579 | 580 | 581 | ### onReady() 582 | 583 | 设置一个回调,在支付操作可进行时触发。 584 | 585 | **参数** 586 | 587 | • callback **Function** 当支付可进行时执行的回调函数。 588 | 589 | 代码示例: 590 | 591 | ``` 592 | FBInstant.payments.onReady(function () { 593 | console.log('Payments Ready!') 594 | }); 595 | ``` 596 | 597 | 返回值 **void** 598 | 599 | ### getLocale() 600 | 601 | 获取用户的语言设置。 例如 **zh_CN**、 **en_US** 602 | 全部的地域信息数据,请看此链接 https://www.facebook.com/translations/FacebookLocales.xml 。使用这个值用来确定游戏中应该显示那种语言。 603 | 该方法必须在 FBInstant.initializeAsync() 调用之后使用 604 | 605 | 代码示例: 606 | 607 | ``` 608 | // 该方法必须在 FBInstant.initializeAsync() 调用之后使用 609 | var locale = FBInstant.getLocale(); // 'en_US' 610 | ``` 611 | 返回值 **string**,当前地域信息。 612 | 613 | ### getPlatform() 614 | 当前游戏运行在哪个平台。该方法必须在 FBInstant.initializeAsync() 调用之后使用 615 | 616 | 代码示例: 617 | 618 | ``` 619 | 该方法必须在 FBInstant.initializeAsync() 调用之后使用 620 | var platform = FBInstant.getPlatform(); // 'IOS' 621 | ``` 622 | 返回值 **Platform?**,当前游戏运行的平台("IOS" | "ANDROID" | "WEB" | "MOBILE_WEB") 623 | 624 | ### getSDKVersion() 625 | 获取SDK的版本号,用字符串来表示。 626 | 627 | 代码示例: 628 | 629 | ``` 630 | var sdkVersion = FBInstant.getSDKVersion(); // '4.1' 631 | ``` 632 | 返回值 **string**,SDK 的版本号。 633 | 634 | 635 | ### initializeAsync() 636 | 初始化SDK,应当在所有其他的API使用前调用。 637 | 代码示例: 638 | 639 | ``` 640 | FBInstant.initializeAsync().then(function() { 641 | // 在初始化完成之前,下面这些属性都是无法得到的。必须要放在这个回调方法里。 642 | var locale = FBInstant.getLocale(); // 'en_US' 643 | var platform = FBInstant.getPlatform(); // 'IOS' 644 | var sdkVersion = FBInstant.getSDKVersion(); // '4.1' 645 | var playerID = FBInstant.player.getID(); 646 | }); 647 | ``` 648 | * Throws INVALID_OPERATION 649 | 650 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当sdk 初始化完成后会返回 promise 651 | 652 | 653 | ### setLoadingProgress() 654 | 通知平台游戏初始化资源加载的进度 655 | 656 | **参数** 657 | 658 | • percentage **number** 0到100之间的数字 659 | 660 | 代码示例: 661 | 662 | ``` 663 | FBInstant.setLoadingProgress(50); // 50%的资源被加载了 664 | ``` 665 | 返回值 **void** 666 | 667 | 668 | ### getSupportedAPIs() 669 | 提供当前客户端支持的 API 函数列表。 670 | 671 | 代码示例:该方法必须在 FBInstant.initializeAsync() 调用之后使用 672 | 673 | ``` 674 | //该方法必须在 FBInstant.initializeAsync() 调用之后使用 675 | FBInstant.getSupportedAPIs(); 676 | // ['getLocale', 'initializeAsync', 'player.getID', 'context.getType', ...] 677 | ``` 678 | 返回值 **Array<string>** 返回客户端支持的 API 函数列表 679 | 680 | 681 | ### getEntryPointData() 682 | 返回与游戏启动的入口点相关的数据对象。 683 | 684 | 对象的内容是开发人员定义的,并且可以在不同平台的入口点触发。在老的移动客户端上会返回 null。如果特定的入口点没有数据时,也会返回 null。 685 | 686 | 代码示例: 687 | 688 | ``` 689 | //该方法必须在 FBInstant.initializeAsync() 调用之后使用 690 | const entryPointData = FBInstant.getEntryPointData(); 691 | ``` 692 | 返回值 **Object** 与当前入口点相关的数据。 693 | 694 | ### getEntryPointAsync() 695 | 返回与游戏启动的入口点相关的数据对象。 696 | 697 | 代码示例: 698 | 699 | ``` 700 | //该方法必须在 FBInstant.initializeAsync() 调用之后使用 701 | FBInstant.getEntryPointAsync(); 702 | // 'admin_message' 703 | ``` 704 | 705 | 返回值: **String** 用户从哪个入口进入的游戏 706 | 707 | ### setSessionData() 708 | 为当前环境设置游戏的数据。 709 | 每当游戏想要更新当前会话的数据时,可以调用该方法。 710 | **参数** 711 | 712 | • sessionData **Object** 一个任意的数据对象,必须小于1000个字符 713 | 714 | 代码示例: 715 | 716 | ``` 717 | FBInstant.setSessionData({coinsEarned: 10, eventsSeen: ['start', ...]}); 718 | ``` 719 | 返回值 **void** 720 | 721 | ### startGameAsync() 722 | 这表明游戏已经加载完资源,可以开始玩了。当返回 promise 的 resolve 时,环境信息将会更新。 723 | 724 | 代码示例: 725 | 726 | ``` 727 | FBInstant.startGameAsync().then(function() { 728 | myGame.start(); 729 | }); 730 | ``` 731 | * Throws INVALID_PARAM 732 | * Throws CLIENT_REQUIRES_UPDATE 733 | * 734 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当游戏应当开始玩的时候会返回 promise 735 | 736 | ### shareAsync() 737 | 这将启动一个对话框,让用户共享指定的内容,可能是一个 Messenger 里的消息,或者是用户时间线上的一个帖子。一个blob数据可以附加在分享上,当游戏通过分享启动时,可以通过 FBInstant.getEntryPointData() 方法获取。这个数据必须少于1000个字符。用户可以选择取消分享,或者关闭对话框,但不论用户是否真的分享了内容,都会返回 promise 的 resolve。 738 | 739 | **参数** 740 | 741 | • payload **SharePayload** 要分享的内容,请看示例代码 742 | 743 | 代码示例: 744 | 745 | ``` 746 | FBInstant.shareAsync({ 747 | intent: 'REQUEST', 748 | image: base64Picture, 749 | text: 'X is asking for your help!', 750 | data: { myReplayData: '...' }, 751 | }).then(function() { 752 | // 继续游戏 753 | }); 754 | ``` 755 | * 抛出 INVALID_PARAM 756 | * 抛出 NETWORK_FAILURE 757 | * 抛出 PENDING_REQUEST 758 | * 抛出 CLIENT_REQUIRES_UPDATE 759 | * 抛出 INVALID_OPERATION 760 | 761 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 不管分享成功或失败,都会返回 promise 的 resolve 762 | 763 | ### updateAsync() 764 | 通知Facebook在游戏中发生的更新。这将暂时把控制权交给Facebook,而Facebook将决定根据更新的内容来做什么。当Facebook将控制权归还给游戏时,将返回 promise 的 resolve/reject. 765 | 766 | **参数** 767 | 768 | • payload **CustomUpdatePayload | LeaderboardUpdatePayload** 要更新的内容 769 | 770 | 代码示例: 771 | 772 | ``` 773 | //这将发送一个自定义更新。如果游戏是运行在一个 messenger 的对话里, 774 | //它将发送一条带有图文的消息到指定的对话里。 775 | //如果其他用户通过这条消息启动了游戏, 776 | //这些游戏会话将可以通过 FBInstant.getEntryPointData() 方法获取附加的 blob 数据。 777 | 778 | FBInstant.updateAsync({ 779 | action: 'CUSTOM', 780 | cta: 'Join The Fight', 781 | template:'join_fight', 782 | image: base64Picture, 783 | text: { 784 | default: 'X just invaded Y\'s village!', 785 | localizations: { 786 | ar_AR: 'X \u0641\u0642\u0637 \u063A\u0632\u062A ' + 787 | '\u0642\u0631\u064A\u0629 Y!', 788 | en_US: 'X just invaded Y\'s village!', 789 | es_LA: '\u00A1X acaba de invadir el pueblo de Y!', 790 | } 791 | }, 792 | template: 'VILLAGE_INVASION', 793 | data: { myReplayData: '...' }, 794 | strategy: 'IMMEDIATE', 795 | notification: 'NO_PUSH', 796 | }).then(function() { 797 | //当消息发送后,关闭游戏 798 | FBInstant.quit(); 799 | }); 800 | ``` 801 | * 抛出 INVALID_PARAM 802 | * 抛出 PENDING_REQUEST 803 | * 抛出 INVALID_OPERATION 804 | 805 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当Facebook将控制权归还给游戏时返回 promise 806 | 807 | ### switchGameAsync() 808 | 请求客户端切换到另一个小游戏。切换 失败时,API 将拒绝;成功时,客户端将加载 新游戏。 809 | 810 | **参数** 811 | 812 | • appID **string ** 要切换到的小游戏相应的应用编号。 应用必须为小游戏,且必须和当前游戏 属于同一商家所有。要将不同游戏关联到相同商家, 您可使用商务管理平台:https://developers.facebook.com/docs/apps/business-manager#update-business 813 | 814 | • data **string** 可选的附加数据。会被设置为要切换到的游戏的入口点数据。转变为字符串时,必须小于或等于 1000 个字符。 815 | 816 | 代码示例: 817 | 818 | ``` 819 | FBInstant.switchGameAsync('12345678').catch(function (e) { 820 | // Handle game change failure 821 | }); 822 | ``` 823 | * 抛出 USER_INPUT 824 | * 抛出 INVALID_PARAM 825 | * 抛出 PENDING_REQUEST 826 | * 抛出 CLIENT_REQUIRES_UPDATE 827 | 828 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 当Facebook将控制权归还给游戏时返回 promise 829 | 830 | ### canCreateShortcutAsync() 831 | 用户是否有资格创建快捷方式。 832 | 如果 createShortcutAsync 已经被调用了或者用户没有资格创建快捷方式,返回 false. 833 | 834 | 代码示例: 835 | 836 | ``` 837 | FBInstant.canCreateShortcutAsync() 838 | .then(function(canCreateShortcut) { 839 | if (canCreateShortcut) { 840 | FBInstant.createShortcutAsync() 841 | .then(function() { 842 | // Shortcut created 843 | }) 844 | .catch(function() { 845 | // Shortcut not created 846 | }); 847 | } 848 | }); 849 | ``` 850 | * 抛出 PENDING_REQUEST 851 | * 抛出 CLIENT_REQUIRES_UPDATE 852 | * 抛出 INVALID_OPERATION 853 | 854 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 如果游戏允许玩家创建快捷方式,返回 true,否则返回 false 855 | 856 | ### createShortcutAsync() 857 | 如果用户有资格,提示用户创建游戏的快捷方式。每次会话只能调用一次。 858 | 859 | 代码示例: 860 | 861 | ``` 862 | FBInstant.canCreateShortcutAsync() 863 | .then(function(canCreateShortcut) { 864 | if (canCreateShortcut) { 865 | FBInstant.createShortcutAsync() 866 | .then(function() { 867 | // Shortcut created 868 | }) 869 | .catch(function() { 870 | // Shortcut not created 871 | }); 872 | } 873 | }); 874 | ``` 875 | * 抛出 USER_INPUT 876 | * 抛出 PENDING_REQUEST 877 | * 抛出 CLIENT_REQUIRES_UPDATE 878 | * 抛出 INVALID_OPERATION 879 | 880 | 返回值 [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 881 | 882 | ### quit() 883 | 退出游戏 884 | 885 | 代码示例: 886 | 887 | ``` 888 | FBInstant.quit(); 889 | ``` 890 | 返回值 **void** 891 | 892 | ### logEvent() 893 | 894 | 使用 Facebook 的分析系统来记录一个应用的事件消息,更多细节请参见: https://developers.facebook.com/docs/javascript/reference/v2.8#app_events 895 | 896 | **参数** 897 | 898 | • eventName **string** 事件的名称。必须是2到40个字符,只能包含'_', '-', ' '和字母数字的字符。 899 | 900 | • valueToSum **number** 一个可选的数字,FB分析可以计算它。 901 | 902 | • parameters **Object** 一个可选的对象,它可以包含多达25个 key-value,以记录事件。key 必须是2-40个字符,只能包含'_', '-', ' '和字母数字的字符。 Value 必须少于100个字符。 903 | 904 | 代码示例: 905 | 906 | ``` 907 | var logged = FBInstant.logEvent( 908 | 'my_custom_event', 909 | 42, 910 | {custom_property: 'custom_value'}, 911 | ); 912 | ``` 913 | 返回值 **APIError** 如果事件记录失败,返回错误信息,否则返回 null. 914 | 915 | ### onPause() 916 | 设置一个暂停事件触发时调用的方法。 917 | 918 | **参数** 919 | 920 | • func **Function** 当暂停事件触发时调用的方法。 921 | 922 | ``` 923 | FBInstant.onPause(function() { 924 | console.log('Pause event was triggered!'); 925 | }) 926 | ``` 927 | 928 | 返回值 **void** 929 | 930 | ### getInterstitialAdAsync() 931 | 尝试创建插屏广告的实例。此实例可在之后预载和显示。 932 | 933 | **参数** 934 | 935 | • placementID **String** 在 Audience Network 设置的位置ID。 936 | 937 | 代码示例: 938 | 939 | ``` 940 | FBInstant.getInterstitialAdAsync( 941 | 'my_placement_id', 942 | ).then(function(interstitial) { 943 | interstitial.getPlacementID(); // 'my_placement_id' 944 | }); 945 | ``` 946 | * 抛出 **ADS_TOO_MANY_INSTANCES** 947 | * 抛出 **CLIENT_UNSUPPORTED_OPERATION** 948 | 949 | 返回值: **Promise** 成功了返回 resolves,失败了返回 reject 950 | 951 | ### getRewardedVideoAsync() 952 | 尝试创建一个激励视频广告的实例。此实例可在之后预载和显示。 953 | 954 | **参数** 955 | 956 | • placementID **string** 在 Audience Network 设置的位置ID。 957 | 958 | 代码示例: 959 | 960 | ``` 961 | FBInstant.getRewardedVideoAsync( 962 | 'my_placement_id', 963 | ).then(function(rewardedVideo) { 964 | rewardedVideo.getPlacementID(); // 'my_placement_id' 965 | }); 966 | ``` 967 | * 抛出 **ADS_TOO_MANY_INSTANCES** 968 | * 抛出 **CLIENT_UNSUPPORTED_OPERATION** 969 | 970 | 返回值: **Promise** 成功了返回 resolves,失败了返回 reject 971 | 972 | ### matchPlayerAsync() 973 | [封闭公测] 尝试将当前玩家与等待他人加入游戏的其他玩家进行匹配。如果匹配成功,将为匹配的玩家创建一个新的 Messenger 群聊,且玩家的游戏环境将切换到该群聊。 974 | 975 | **参数** 976 | 977 | * matchTag **string** 玩家的可选额外信息,可用于将玩家 加到具有相似玩家的群聊中。具有完全相同标签的玩家才会加入同一群聊。标签只能包含字母、数字和下划线,且长度不能超过 100 个字符。 978 | * switchContextWhenMatched **boolean** 可选的额外参数, 指定当找到匹配时,是否将玩家立即切换到新环境。默认设置为 false,亦即玩家在匹配成功后,需要明确点击玩游戏按钮才会切换到新环境。 979 | 980 | 代码示例: 981 | 982 | ``` 983 | FBInstant 984 | .matchPlayerAsync('level1') 985 | .then(function() { 986 | console.log(FBInstant.context.getID()); 987 | // 12345 988 | }); 989 | ``` 990 | ``` 991 | FBInstant 992 | .matchPlayerAsync() 993 | .then(function() { 994 | console.log(FBInstant.context.getID()); 995 | // 3456 996 | }); 997 | ``` 998 | ``` 999 | FBInstant 1000 | .matchPlayerAsync(null, true) 1001 | .then(function() { 1002 | console.log(FBInstant.context.getID()); 1003 | // 3456 1004 | }); 1005 | ``` 1006 | * 抛出 **INVALID_PARAM** 1007 | * 抛出 **NETWORK_FAILURE** 1008 | * 抛出 **USER_INPUT** 1009 | * 抛出 **PENDING_REQUEST** 1010 | * 抛出 **CLIENT_UNSUPPORTED_OPERATION** 1011 | * 抛出 **INVALID_OPERATION** 1012 | 1013 | 返回值: **Promise** 当玩家已加入群聊并切换到 群聊环境时,此 promise 被解析。 1014 | 1015 | ### checkCanPlayerMatchAsync() 1016 | [封闭公测] 检查当前玩家是否符合 matchPlayerAsync API 的条件。 1017 | 1018 | 1019 | 代码示例: 1020 | 1021 | ``` 1022 | FBInstant 1023 | .checkCanPlayerMatchAsync() 1024 | .then(canMatch => { 1025 | if (canMatch) { 1026 | FBInstant.matchPlayerAsync('level1'); 1027 | } 1028 | }); 1029 | ``` 1030 | 1031 | * 抛出 **NETWORK_FAILURE** 1032 | * 抛出 **CLIENT_UNSUPPORTED_OPERATION** 1033 | 1034 | 1035 | 返回值: **Promise** 当玩家符合与其他玩家匹配的条件时, 此 promise 被解析为 true,否则解析为 false。 1036 | 1037 | ### getLeaderboardAsync() 1038 | 获取这款小游戏中的特有排行榜。 1039 | 1040 | **参数** 1041 | 1042 | • name **string** 小游戏的每个排行榜必须具有唯一的名称 1043 | 1044 | **代码示例** 1045 | ``` 1046 | FBInstant.getLeaderboardAsync('my_awesome_leaderboard') 1047 | .then(leaderboard => { 1048 | console.log(leaderboard.getName()); // 'my_awesome_leaderboard' 1049 | }); 1050 | ``` 1051 | 1052 | * 抛出 **LEADERBOARD_NOT_FOUND** 1053 | * 抛出 **NETWORK_FAILURE** 1054 | * 抛出 **CLIENT_UNSUPPORTED_OPERATION** 1055 | * 抛出 **INVALID_OPERATION** 1056 | * 抛出 **INVALID_PARAM** 1057 | 1058 | 返回值: **Promise** 此 promise 在获得匹配的排行榜时被解析, 在未找到匹配时被拒绝。 1059 | -------------------------------------------------------------------------------- /fbinstant.js: -------------------------------------------------------------------------------- 1 | /*1525326118,,JIT Construction: v3873717,en_US*/ 2 | 3 | /** 4 | * Copyright (c) 2017-present, Facebook, Inc. All rights reserved. 5 | * 6 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 7 | * copy, modify, and distribute this software in source code or binary form for use 8 | * in connection with the web services and APIs provided by Facebook. 9 | * 10 | * As with any software that integrates with the Facebook platform, your use of 11 | * this software is subject to the Facebook Platform Policy 12 | * [http://developers.facebook.com/policy/]. This copyright notice shall be 13 | * included in all copies or substantial portions of the software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | try {window.FB|| (function(window, fb_fif_window) { var apply = Function.prototype.apply; function bindContext(fn, thisArg) { return function _sdkBound() { return apply.call(fn, thisArg, arguments); }; } var global = { __type: 'JS_SDK_SANDBOX', window: window, document: window.document }; var sandboxWhitelist = [ 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval' ]; for (var i = 0; i < sandboxWhitelist.length; i++) { global[sandboxWhitelist[i]] = bindContext( window[sandboxWhitelist[i]], window ); } (function() { var self = window; var __DEV__ = 0; function emptyFunction() {}; var __transform_includes = {}; var __annotator, __bodyWrapper; var __w, __t; var undefined; var __p; with (this) { (function(){var a={},b=function(a,b){if(!a&&!b)return null;var c={};typeof a!=="undefined"&&(c.type=a);typeof b!=="undefined"&&(c.signature=b);return c},c=function(a,c){return b(a&&/^[A-Z]/.test(a)?a:undefined,c&&(c.params&&c.params.length||c.returns)?"function("+(c.params?c.params.map(function(a){return/\?/.test(a)?"?"+a.replace("?",""):a}).join(","):"")+")"+(c.returns?":"+c.returns:""):undefined)},d=function(a,b,c){return a},e=function(a,b,d){"sourcemeta"in __transform_includes&&(a.__SMmeta=b);if("typechecks"in __transform_includes){b=c(b?b.name:undefined,d);b&&__w(a,b)}return a},f=function(a,b,c){return c.apply(a,b)},g=function(a,b,c,d){d&&d.params&&__t.apply(a,d.params);c=c.apply(a,b);d&&d.returns&&__t([c,d.returns]);return c},h=function(b,c,d,e,f){if(f){f.callId||(f.callId=f.module+":"+(f.line||0)+":"+(f.column||0));e=f.callId;a[e]=(a[e]||0)+1}return d.apply(b,c)};typeof __transform_includes==="undefined"?(__annotator=d,__bodyWrapper=f):(__annotator=e,"codeusage"in __transform_includes?(__annotator=d,__bodyWrapper=h,__bodyWrapper.getCodeUsage=function(){return a},__bodyWrapper.clearCodeUsage=function(){a={}}):"typechecks"in __transform_includes?__bodyWrapper=g:__bodyWrapper=f)})(); 23 | __t=function(a){return a[0]},__w=function(a){return a}; 24 | var require,__d;(function(a){var b={},c={},d=["global","require","requireDynamic","requireLazy","module","exports"];require=function(d,e){if(Object.prototype.hasOwnProperty.call(c,d))return c[d];if(!Object.prototype.hasOwnProperty.call(b,d)){if(e)return null;throw new Error("Module "+d+" has not been defined")}e=b[d];var f=e.deps,g=e.factory.length,h,i=[];for(var j=0;j1?Number(arguments[1]):0;isNaN(c)&&(c=0);var d=Math.min(Math.max(c,0),b.length);return b.indexOf(String(a),c)==d};a.endsWith=function(a){var b=String(this);if(this==null)throw new TypeError("String.prototype.endsWith called on null or undefined");var c=b.length,d=String(a),e=arguments.length>1?Number(arguments[1]):c;isNaN(e)&&(e=0);var f=Math.min(Math.max(e,0),c),g=f-d.length;return g<0?!1:b.lastIndexOf(d,g)==g};a.includes=function(a){if(this==null)throw new TypeError("String.prototype.contains called on null or undefined");var b=String(this),c=arguments.length>1?Number(arguments[1]):0;isNaN(c)&&(c=0);return b.indexOf(String(a),c)!=-1};a.contains=a.includes;a.repeat=function(a){__p&&__p();if(this==null)throw new TypeError("String.prototype.repeat called on null or undefined");var b=String(this);a=a?Number(a):0;isNaN(a)&&(a=0);if(a<0||a===Infinity)throw RangeError();if(a===1)return b;if(a===0)return"";var c="";while(a)a&1&&(c+=b),(a>>=1)&&(b+=b);return c};e.exports=a}),null); 32 | __d("ES6Array",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();a={from:function(a){__p&&__p();if(a==null)throw new TypeError("Object is null or undefined");var b=arguments[1],c=arguments[2],d=this,e=Object(a),f=typeof Symbol==="function"?typeof Symbol==="function"?Symbol.iterator:"@@iterator":"@@iterator",g=typeof b==="function",h=typeof e[f]==="function",i=0,j=void 0,k;void 0;if(h){j=typeof d==="function"?new d():[];var l=e[f](),m;void 0;while(!(m=l.next()).done)k=m.value,g&&(k=b.call(c,k,i)),j[i]=k,i+=1;j.length=i;return j}var n=e.length;(isNaN(n)||n<0)&&(n=0);j=typeof d==="function"?new d(n):new Array(n);while(i>>0;for(var e=0;e>>0,d=arguments[1],e=d>>0,f=e<0?Math.max(c+e,0):Math.min(e,c),g=arguments[2],h=g===undefined?c:g>>0,i=h<0?Math.max(c+h,0):Math.min(h,c);while(f9999?"+":"")+("00000"+Math.abs(a)).slice(0<=a&&a<=9999?-4:-6);return a+"-"+g(this.getUTCMonth()+1)+"-"+g(this.getUTCDate())+"T"+g(this.getUTCHours())+":"+g(this.getUTCMinutes())+":"+g(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}};e.exports=a}),null); 35 | __d("ES6Number",[],(function(a,b,c,d,e,f){__p&&__p();a=Math.pow(2,-52);b=Math.pow(2,53)-1;c=-1*b;d={isFinite:function(a){function b(b){return a.apply(this,arguments)}b.toString=function(){return a.toString()};return b}(function(a){return typeof a=="number"&&isFinite(a)}),isNaN:function(a){function b(b){return a.apply(this,arguments)}b.toString=function(){return a.toString()};return b}(function(a){return typeof a=="number"&&isNaN(a)}),isInteger:function(a){return this.isFinite(a)&&Math.floor(a)===a},isSafeInteger:function(a){return this.isFinite(a)&&a>=this.MIN_SAFE_INTEGER&&a<=this.MAX_SAFE_INTEGER&&Math.floor(a)===a},EPSILON:a,MAX_SAFE_INTEGER:b,MIN_SAFE_INTEGER:c};e.exports=d}),null); 36 | __d("ES6Object",["ie8DontEnum"],(function(a,b,c,d,e,f,g){__p&&__p();var h={}.hasOwnProperty;a={assign:function(a){__p&&__p();if(a==null)throw new TypeError("Object.assign target cannot be null or undefined");a=Object(a);for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;d=0?1:-1}a={includes:function(a){"use strict";__p&&__p();if(a!==undefined&&j(this)&&!(typeof a==="number"&&isNaN(a)))return i.apply(this,arguments)!==-1;var b=Object(this),c=b.length?k(b.length):0;if(c===0)return!1;var d=arguments.length>1?l(arguments[1]):0,e=d<0?Math.max(c+d,0):d,f=isNaN(a)&&typeof a==="number";while(e1)))/4)-A((a-1901+b)/100)+A((a-1601+b)/400)};(o=b.hasOwnProperty)||(o=function(a){var b={},c;(b.__proto__=null,b.__proto__={toString:1},b).toString!=n?o=function(a){var b=this.__proto__;a=a in(this.__proto__=null,this);this.__proto__=b;return a}:(c=b.constructor,o=function(a){var b=(this.constructor||c).prototype;return a in this&&!(a in b&&this[a]===b[a])});return o.call(this,a)});p=function(a,b){__p&&__p();var d=0,e,f;(e=function(){this.valueOf=0}).prototype.valueOf=0;f=new e();for(e in f)o.call(f,e)&&d++;f=null;!d?(f=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],p=function(a,b){var d=n.call(a)==t,e,g=!d&&typeof a.constructor!="function"&&c[typeof a.hasOwnProperty]&&a.hasOwnProperty||o;for(e in a)!(d&&e=="prototype")&&g.call(a,e)&&b(e);for(d=f.length;e=f[--d];g.call(a,e)&&b(e));}):d==2?p=function(a,b){var c={},d=n.call(a)==t,e;for(e in a)!(d&&e=="prototype")&&!o.call(c,e)&&(c[e]=1)&&o.call(a,e)&&b(e)}:p=function(a,b){var c=n.call(a)==t,d,e;for(d in a)!(c&&d=="prototype")&&o.call(a,d)&&!(e=d==="constructor")&&b(d);(e||o.call(a,d="constructor"))&&b(d)};return p(a,b)};if(!s("json-stringify")){var D={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},E="000000",F=function(a,b){return(E+(b||0)).slice(-a)},G="\\u00",H=function(a){__p&&__p();var b='"',c=0,d=a.length,e=!z||d>10,f=e&&(z?a.split(""):a);for(;c-1/0&&h<1/0){if(C){m=A(h/864e5);for(j=A(m/365.2425)+1970-1;C(j+1,0)<=m;j++);for(k=A((m-C(j,0))/30.42);C(j,k+1)<=m;k++);m=1+m-C(j,k);r=(h%864e5+864e5)%864e5;s=A(r/36e5)%24;t=A(r/6e4)%60;z=A(r/1e3)%60;r=r%1e3}else j=h.getUTCFullYear(),k=h.getUTCMonth(),m=h.getUTCDate(),s=h.getUTCHours(),t=h.getUTCMinutes(),z=h.getUTCSeconds(),r=h.getUTCMilliseconds();h=(j<=0||j>=1e4?(j<0?"-":"+")+F(6,j<0?-j:j):F(4,j))+"-"+F(2,k+1)+"-"+F(2,m)+"T"+F(2,s)+":"+F(2,t)+":"+F(2,z)+"."+F(3,r)+"Z"}else h=null;else typeof h.toJSON=="function"&&(i!=v&&i!=w&&i!=x||o.call(h,"toJSON"))&&(h=h.toJSON(a))}c&&(h=c.call(b,a,h));if(h===null)return"null";i=n.call(h);if(i==y)return""+h;else if(i==v)return h>-1/0&&h<1/0?""+h:"null";else if(i==w)return H(""+h);if(typeof h=="object"){for(j=g.length;j--;)if(g[j]===h)throw l();g.push(h);B=[];k=f;f+=e;if(i==x){for(m=0,j=h.length;m0)for(e="",d>10&&(d=10);e.length=48&&g<=57||g>=97&&g<=102||g>=65&&g<=70||N();c+=J("0x"+a.slice(d,L));break;default:N()}}else{if(g==34)break;g=a.charCodeAt(L);d=L;while(g>=32&&g!=92&&g!=34)g=a.charCodeAt(++L);c+=a.slice(d,L)}}if(a.charCodeAt(L)==34){L++;return c}N();default:d=L;g==45&&(f=!0,g=a.charCodeAt(++L));if(g>=48&&g<=57){g==48&&(g=a.charCodeAt(L+1),g>=48&&g<=57)&&N();f=!1;for(;L=48&&g<=57);L++);if(a.charCodeAt(L)==46){e=++L;for(;e=48&&g<=57);e++);e==L&&N();L=e}g=a.charCodeAt(L);if(g==101||g==69){g=a.charCodeAt(++L);(g==43||g==45)&&L++;for(e=L;e=48&&g<=57);e++);e==L&&N();L=e}return+a.slice(d,L)}f&&N();if(a.slice(L,L+4)=="true"){L+=4;return!0}else if(a.slice(L,L+5)=="false"){L+=5;return!1}else if(a.slice(L,L+4)=="null"){L+=4;return null}N()}}return"$"},P=function(a){__p&&__p();var b,c;a=="$"&&N();if(typeof a=="string"){if((z?a.charAt(0):a[0])=="@")return a.slice(1);if(a=="["){b=[];for(;;c||(c=!0)){a=O();if(a=="]")break;c&&(a==","?(a=O(),a=="]"&&N()):N());a==","&&N();b.push(P(a))}return b}else if(a=="{"){b={};for(;;c||(c=!0)){a=O();if(a=="}")break;c&&(a==","?(a=O(),a=="}"&&N()):N());(a==","||typeof a!="string"||(z?a.charAt(0):a[0])!="@"||O()!=":")&&N();b[a.slice(1)]=P(O())}return b}N()}return a},Q=function(a,b,c){c=R(a,b,c);c===q?delete a[b]:a[b]=c},R=function(a,b,c){var d=a[b],e;if(typeof d=="object"&&d)if(n.call(d)==x)for(e=d.length;e--;)Q(d,e,c);else p(d,function(a){Q(d,a,c)});return c.call(a,b,d)};a.parse=function(a,b){var c;L=0;M=""+a;a=P(O());O()!="$"&&N();L=M=null;return b&&n.call(b)==t?R((c={},c[""]=a,c),"",b):a}}}a.runInContext=k;return a}if(d&&!b)k(e,d);else{var l=e.JSON,m=e.JSON3,n=!1,o=k(e,e.JSON3={noConflict:function(){n||(n=!0,e.JSON=l,e.JSON3=m,l=m=null);return o}});e.JSON={parse:o.parse,stringify:o.stringify}}b&&i(function(){return o})}).call(this)}var k=!1,l=function(){k||(k=!0,j());return h.exports};b=function(a){switch(a){case undefined:return l()}};e.exports=b}),null); 44 | __d("json3",["json3-3.3.2"],(function(a,b,c,d,e,f){e.exports=b("json3-3.3.2")()}),null); 45 | __d("ES",["json3","ES5ArrayPrototype","ES5FunctionPrototype","ES5StringPrototype","ES5Array","ES5Object","ES5Date","ES6Array","ES6Object","ES6ArrayPrototype","ES6DatePrototype","ES6Number","ES7StringPrototype","ES7Object","ES7ArrayPrototype"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){__p&&__p();var v={}.toString,w={"JSON.stringify":g.stringify,"JSON.parse":g.parse};c={"Array.prototype":h,"Function.prototype":i,"String.prototype":j,Object:l,Array:k,Date:m};d={Object:o,"Array.prototype":p,"Date.prototype":q,Number:r,Array:n};f={Object:t,"String.prototype":s,"Array.prototype":u};function a(a){__p&&__p();for(var b in a){if(!Object.prototype.hasOwnProperty.call(a,b))continue;var c=a[b],d=b.split(".");if(d.length===2){var e=d[0],f=d[1];if(!e||!f||!window[e]||!window[e][f]){var g=e?window[e]:"-",h=e&&window[e]&&f?window[e][f]:"-";throw new Error("Unexpected state (t11975770): "+(e+", "+f+", "+g+", "+h+", "+b))}}e=d.length===2?window[d[0]][d[1]]:window[b];for(var i in c){if(!Object.prototype.hasOwnProperty.call(c,i))continue;if(typeof c[i]!=="function"){w[b+"."+i]=c[i];continue}f=e[i];w[b+"."+i]=f&&/\{\s+\[native code\]\s\}/.test(f)?f:c[i]}}}a(c);a(d);a(f);function b(a,b,c){var d=c?v.call(a).slice(8,-1)+".prototype":a,e=w[d+"."+b]||a[b];if(typeof e==="function"){for(var f=arguments.length,g=Array(f>3?f-3:0),h=3;h1?b-1:0),d=1;d=0)continue;c[d]=a[d]}return c};a.taggedTemplateLiteralLoose=function(a,b){a.raw=b;return a};a.bind=g.bind;e.exports=a}),null); var ES = require('ES'); var babelHelpers = require('sdk.babelHelpers'); (function(a,b){var c="keys",d="values",e="entries",f=function(){var a=h(Array),f=void 0;a||(f=function(){function a(a,b){"use strict";this.$1=a,this.$2=b,this.$3=0}a.prototype.next=function(){"use strict";if(this.$1==null)return{value:b,done:!0};var a=this.$1,f=this.$1.length,g=this.$3,h=this.$2;if(g>=f){this.$1=b;return{value:b,done:!0}}this.$3=g+1;if(h===c)return{value:g,done:!1};else if(h===d)return{value:a[g],done:!1};else if(h===e)return{value:[g,a[g]],done:!1}};a.prototype[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]=function(){"use strict";return this};return a}());return{keys:a?function(a){return a.keys()}:function(a){return new f(a,c)},values:a?function(a){return a.values()}:function(a){return new f(a,d)},entries:a?function(a){return a.entries()}:function(a){return new f(a,e)}}}(),g=function(){var a=h(String),c=void 0;a||(c=function(){function a(a){"use strict";this.$1=a,this.$2=0}a.prototype.next=function(){"use strict";if(this.$1==null)return{value:b,done:!0};var a=this.$2,c=this.$1,d=c.length;if(a>=d){this.$1=b;return{value:b,done:!0}}void 0;var e=c.charCodeAt(a);if(e<55296||e>56319||a+1===d)e=c[a];else{d=c.charCodeAt(a+1);d<56320||d>57343?e=c[a]:e=c[a]+c[a+1]}this.$2=a+e.length;return{value:e,done:!1}};a.prototype[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]=function(){"use strict";return this};return a}());return{keys:function(){throw TypeError("Strings default iterator doesn't implement keys.")},values:a?function(a){return a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]()}:function(a){return new c(a)},entries:function(){throw TypeError("Strings default iterator doesn't implement entries.")}}}();function h(a){return typeof a.prototype[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]==="function"&&typeof a.prototype.values==="function"&&typeof a.prototype.keys==="function"&&typeof a.prototype.entries==="function"}function i(a,b){"use strict";this.$1=a,this.$2=b,this.$3=ES("Object","keys",!1,a),this.$4=0}i.prototype.next=function(){"use strict";var a=this.$3.length,f=this.$4,g=this.$2,h=this.$3[f];if(f>=a){this.$1=b;return{value:b,done:!0}}this.$4=f+1;if(g===c)return{value:h,done:!1};else if(g===d)return{value:this.$1[h],done:!1};else if(g===e)return{value:[h,this.$1[h]],done:!1}};i.prototype[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]=function(){"use strict";return this};var j={keys:function(a){return new i(a,c)},values:function(a){return new i(a,d)},entries:function(a){return new i(a,e)}};function k(a,b){if(typeof a==="string")return g[b||d](a);else if(ES("Array","isArray",!1,a))return f[b||d](a);else if(a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"])return a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();else return j[b||e](a)}ES("Object","assign",!1,k,{KIND_KEYS:c,KIND_VALUES:d,KIND_ENTRIES:e,keys:function(a){return k(a,c)},values:function(a){return k(a,d)},entries:function(a){return k(a,e)},generic:j.entries});a.FB_enumerate=k})(typeof global==="undefined"?this:global); 51 | (function(a,b){var c=a.window||a;function d(){return"f"+(Math.random()*(1<<30)).toString(16).replace(".","")}function e(a){var b=a?a.ownerDocument||a:document;b=b.defaultView||c;return!!(a&&(typeof b.Node==="function"?a instanceof b.Node:typeof a==="object"&&typeof a.nodeType==="number"&&typeof a.nodeName==="string"))}function f(a){a=c[a];if(a==null)return!0;if(typeof c.Symbol!=="function")return!0;var b=a.prototype;return a==null||typeof a!=="function"||typeof b.clear!=="function"||new a().size!==0||typeof b.keys!=="function"||typeof b.forEach!=="function"}var g=a.FB_enumerate,h=function(){if(!f("Map"))return c.Map;var i="key",j="value",k="key+value",l="$map_",m=void 0,n="IE_HASH_";function a(a){"use strict";if(!s(this))throw new TypeError("Wrong map object type.");r(this);if(a!=null){a=g(a);var b=void 0;while(!(b=a.next()).done){if(!s(b.value))throw new TypeError("Expected iterable items to be pair objects.");this.set(b.value[0],b.value[1])}}}a.prototype.clear=function(){"use strict";r(this)};a.prototype.has=function(a){"use strict";a=p(this,a);return!!(a!=null&&this._mapData[a])};a.prototype.set=function(a,b){"use strict";var c=p(this,a);c!=null&&this._mapData[c]?this._mapData[c][1]=b:(c=this._mapData.push([a,b])-1,q(this,a,c),this.size+=1);return this};a.prototype.get=function(a){"use strict";a=p(this,a);if(a==null)return b;else return this._mapData[a][1]};a.prototype["delete"]=function(a){"use strict";var c=p(this,a);if(c!=null&&this._mapData[c]){q(this,a,b);this._mapData[c]=b;this.size-=1;return!0}else return!1};a.prototype.entries=function(){"use strict";return new o(this,k)};a.prototype.keys=function(){"use strict";return new o(this,i)};a.prototype.values=function(){"use strict";return new o(this,j)};a.prototype.forEach=function(a,c){"use strict";if(typeof a!=="function")throw new TypeError("Callback must be callable.");a=ES(a,"bind",!0,c||b);c=this._mapData;for(var d=0;d1?b-1:0),d=1;d1?b-1:0),d=1;d1?b-1:0),d=1;d2?d-2:0),f=2;f0||g(0),this.$1=a,this.$2=0,this.$3=[],this.$4=[]}a.prototype.write=function(a){"use strict";this.$3.lengththis.$1){var b=this.read();this.$2=0;this.$3=b;this.$1=a}return this};a.prototype.dropFirst=function(a){"use strict";if(a<=this.$1){var b=this.read();this.$2=0;b.splice(0,a);this.$3=b}return this};a.prototype.clear=function(){"use strict";this.$2=0;this.$3=[];return this};a.prototype.currentSize=function(){"use strict";return this.$3.length};e.exports=a}),null); 64 | __d("Env",[],(function(a,b,c,d,e,f){b={start:ES("Date","now",!1),nocatch:!1,ajaxpipe_token:null};a.Env&&ES("Object","assign",!1,b,a.Env);a.Env=b;e.exports=b}),null); 65 | __d("ManagedError",[],(function(a,b,c,d,e,f){function a(a,b){Error.prototype.constructor.call(this,a),this.message=a,this.innerError=b}a.prototype=new Error();a.prototype.constructor=a;e.exports=a}),null); 66 | __d("LogviewForcedKeyError",["ManagedError"],(function(a,b,c,d,e,f,g){__p&&__p();var h;b=babelHelpers.inherits(a,g);h=b&&b.prototype;function a(a,b){"use strict";h.constructor.call(this,b,a)}a.prototype.getCause=function(){"use strict";return this.innerError};a.prototype.getForcedCategoryKey=function(){"use strict";return this.message};e.exports=a}),null); 67 | __d("erx",["ex"],(function(a,b,c,d,e,f,g){__p&&__p();function a(a){__p&&__p();if(typeof a!=="string")return a;var b=ES(a,"indexOf",!0,g._prefix),c=a.lastIndexOf(g._suffix);if(b<0||c<0)return[a];var d=b+g._prefix.length,e=c+g._suffix.length;if(d>=c)return["erx slice failure: %s",a];b=a.substring(0,b);e=a.substring(e);a=a.substring(d,c);try{d=ES("JSON","parse",!1,a);d[0]=b+d[0]+e;return d}catch(b){return["erx parse failure: %s",a]}}e.exports=a}),null); 68 | __d("removeFromArray",[],(function(a,b,c,d,e,f){function a(a,b){b=ES(a,"indexOf",!0,b);b!==-1&&a.splice(b,1)}e.exports=a}),null); 69 | __d("ErrorUtils",["Env","LogviewForcedKeyError","eprintf","erx","removeFromArray","sprintf"],(function(a,b,c,d,e,f,g,h,i,j,k,l){__p&&__p();var m="",n="",o=typeof window==="undefined"?"":"",p="",q=/^https?:\/\//i,r=/^Type Mismatch for/,s=/(.*)[@\s][^\s]+$/,t=/^at .*eval eval (at .*\:\d+\:\d+), .*$/,u=[],v=void 0,w=[],x=50,y=[],z=!1,A=!1,B=!1,C=/\bnocatch\b/.test(location.search),D=["Unknown script code","Function code","eval code"];g.stack_trace_limit&&Error.stackTraceLimit!=null&&(Error.stackTraceLimit=g.stack_trace_limit);function E(a){a=a.columnNumber||a.column;return a!=null?String(a):""}function F(a){return a[0]&&a[0].column||""}function G(a){for(var b=0;b");e={column:c,identifier:d,line:b,script:a};v&&v(e);c=" at"+(e.identifier?" "+e.identifier+" (":" ")+e.script+(e.line?":"+e.line:"")+(e.column?":"+e.column:"")+(e.identifier?")":"");return babelHelpers["extends"]({},e,{text:c})})}function N(a){y.unshift(a),z=!0}function O(){y.shift(),z=y.length!==0}var P={ANONYMOUS_GUARD_TAG:m,GENERATED_GUARD_TAG:n,GLOBAL_ERROR_HANDLER_TAG:o,history:w,addListener:function(a){var b=arguments.length<=1||arguments[1]===undefined?!1:arguments[1];u.push(a);b||ES(w,"forEach",!0,a)},removeListener:function(a){k(u,a)},setSourceResolver:function(a){v=a},applyWithGuard:function(b,c,d,e,f){__p&&__p();N(f||m);g.nocatch&&(C=!0);if(C){f=void 0;try{f=b.apply(c,d||[])}finally{O()}return f}try{return b.apply(c,d||[])}catch(j){f=j;if(f==null)try{(function(){__p&&__p();var e=c,h=function(a){__p&&__p();if(a==null)return"";else if(typeof a==="object"&&a.toString)return a.toString();else if(typeof a==="boolean"&&a.toString)return a.toString();else if(typeof a==="number"&&a.toString)return a.toString();else if(typeof a==="string")return a;else if(typeof a==="symbol"&&a.toString)return a.toString();else if(typeof a==="function"&&a.toString)return a.toString();return""};c!=null&&(c==window?e="[The window object]":c==a?e="[The global object]":function(){var a=c,b={};ES(ES("Object","keys",!1,a),"map",!0,function(c,d){d=a[c];b[c]=h(d)});e=b}());var i=ES(d||[],"map",!0,h),j="applyWithGuard threw null or undefined:\nFunc: %s\nContext: %s\nArgs: %s",k=b.toString&&b.toString().substr(0,1024),m=ES("JSON","stringify",!1,e).substr(0,1024);i=ES("JSON","stringify",!1,i).substr(0,1024);var n=l(j,k?k:"this function does not support toString",m,i);f=new Error(n);f.messageWithParams=g.reliability_fixederrors_2018?[j,k?k:"this function does not support toString",m,i]:[j]})()}catch(a){var h="applyWithGuard threw null or undefined with unserializable data:\nFunc: %s\nMetaEx: %s",i=b.toString&&b.toString().substr(0,1024);h=l(h,i?i:"this function does not support toString",a.message);f=new Error(h);f.messageWithParams=g.reliability_fixederrors_2018?[h,i?i:"this function does not support toString",a.message]:[h]}i=P.normalizeError(f);e&&e(i);if(b)try{i.callee=b.toString().substring(0,100)}catch(a){}d&&(i.args=ES("Array","from",!1,d).toString().substring(0,100));i.guard=y[0];i.guardList=y.slice();P.reportError(i)}finally{O()}},guard:function(a,b,c){b=b||a.name||n;function d(){return P.applyWithGuard(a,c||this,[].concat(Array.prototype.slice.call(arguments)),null,b)}a.__SMmeta&&(d.__SMmeta=a.__SMmeta);return d},inGuard:function(){return z},normalizeError:function(a){__p&&__p();var b=a;a=a!=null?a:{};if(Object.prototype.hasOwnProperty.call(a,"_originalError"))return a;var c=M(a),d=!1;if(a.framesToPop){var e=a.framesToPop,f=void 0;while(e>0&&c.length>0)f=c.shift(),e--,d=!0;r.test(a.message)&&a.framesToPop===2&&f&&(q.test(f.script)&&(a.message+=" at "+f.script+(f.line?":"+f.line:"")+(f.column?":"+f.column:"")))}e=L(a.reactComponentStackForLogging);f=a instanceof h?a.getForcedCategoryKey():null;b={_originalError:b,column:d?F(c):E(a)||F(c),extra:a.extra,fbloggerMetadata:a.fbloggerMetadata,forcedLogviewKey:f,guard:a.guard,guardList:a.guardList,line:d?I(c):H(a)||I(c),message:a.message,messageWithParams:a.messageWithParams,name:a.name,reactComponentStack:e,script:d?K(c):J(a)||K(c),snapshot:a.snapshot,stack:ES(c,"map",!0,function(a){return a.text}).join("\n"),stackFrames:c,type:a.type};typeof b.message==="string"?b.messageWithParams=b.messageWithParams||j(b.message):(b.messageObject=b.message,b.message=String(b.message)+" ("+typeof b.message+")");b.messageWithParams&&(b.message=i.apply(undefined,b.messageWithParams));typeof window!=="undefined"&&window&&window.location&&(b.windowLocationURL=window.location.href);v&&v(b);for(var g in b)b[g]==null&&delete b[g];return b},onerror:function(a,b,c,d,e){e=e||{},e.message=e.message||a,e.script=e.script||b,e.line=e.line||c,e.column=e.column||d,e.guard=o,e.guardList=[o],P.reportError(e,!0)},reportError:function(b){__p&&__p();var c=arguments.length<=1||arguments[1]===undefined?!1:arguments[1];if(A){!1;return!1}b.reactComponentStack&&N(p);y.length>0&&(b.guard=b.guard||y[0],b.guardList=y.slice());b.reactComponentStack&&O();var d=P.normalizeError(b);if(!c){var e=a.console,f=d._originalError,g=f!=null?""+f.message:"";if((!e[d.type]||d.type==="error")&&!B){var h=g.length>80?g.slice(0,77)+"...":g;e.error('ErrorUtils caught an error: "'+h+"\". Subsequent errors won't be logged; see https://fburl.com/debugjs.");B=!0}}w.length>x&&w.splice(x/2,1);w.push(d);A=!0;for(var i=0;i-1});if(c.length>0){a.push(b);return!1}return!0});return{invalidMetadata:a,validMetadata:b}};a.addGlobalMetadata=function(a,b,c){g.push([a,b,c])};e.exports=a}),null); 71 | __d("javascript_shared_TAAL_OpCode",[],(function(a,b,c,d,e,f){e.exports=ES("Object","freeze",!1,{PREVIOUS_FILE:1,PREVIOUS_FRAME:2,PREVIOUS_DIR:3})}),null); 72 | __d("TAALOpcodes",["javascript_shared_TAAL_OpCode"],(function(a,b,c,d,e,f,g){"use strict";a={previousFile:function(){return g.PREVIOUS_FILE},previousFrame:function(){return g.PREVIOUS_FRAME},previousDirectory:function(){return g.PREVIOUS_DIR},getString:function(a){return a&&a.length?" TAAL["+a.join(";")+"]":""}};e.exports=a}),null); 73 | __d("TAAL",["TAALOpcodes"],(function(a,b,c,d,e,f,g){"use strict";a={blameToPreviousFile:function(a){return this.applyOpcodes(a,[g.previousFile()])},blameToPreviousFrame:function(a){return this.applyOpcodes(a,[g.previousFrame()])},blameToPreviousDirectory:function(a){return this.applyOpcodes(a,[g.previousDirectory()])},applyOpcodes:function(a,b){return a+g.getString(b)}};e.exports=a}),null); 74 | __d("FBLogMessage",["ErrorUtils","FBLoggerMetadata","TAAL","TAALOpcodes","ex","sprintf"],(function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";__p&&__p();var m={mustfix:"error",warn:"warn",info:"log"},n=k,o=function a(b){return function(c){b>0&&(c(),a(b-1)(c))}};function p(a){this.project=a,this.metadata=new h(),this.taalOpcodes=[]}p.prototype.$1=function(a,b){__p&&__p();var c,d=3;if(b===undefined){var c=function(){var a=new p("fblogger");o(d)(function(){return a.blameToPreviousFrame()});a.mustfix("You provided an undefined format string to FBLogger, dropping log line");return{v:void 0}}();if(typeof c==="object")return c.v}for(var e=arguments.length,f=Array(e>2?e-2:0),h=2;h %s",a,this.project,r);if(!this.metadata.isEmpty()){var s=this.metadata.getAll(),t=s.invalidMetadata,u=s.validMetadata;t.length>0&&(function(){var a=new p("fblogger");o(d)(function(){return a.blameToPreviousFrame()});a.warn("Metadata cannot contain colon %s",ES(t,"map",!0,function(a){return a.join(":")}).join(" "))})();q.fbloggerMetadata=ES(u,"map",!0,function(a){return a.join(":")})}var v=m[a];q.type=v;!this.error?(o(d)(ES(function(){return this.taalOpcodes.unshift(j.previousFrame())},"bind",!0,this)),q.messageWithParams=[this.taalOpcodes?i.applyOpcodes(b,this.taalOpcodes):b].concat(f),this.taalOpcodes&&(q.message=i.applyOpcodes(q.message,this.taalOpcodes))):this.taalOpcodes&&this.taalOpcodes.length&&(function(){var a=new p("fblogger");o(d)(function(){return a.blameToPreviousFrame()});a.warn("Calling blame helpers doesn't work with catching, if you want to properly categorize a caught error please apply a TAAL rule on the Error message at the site where it is thrown. Ignoring the blame methods for this call.")})();g.reportError(q)};p.prototype.mustfix=function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;d1?b-1:0),d=1;d0},getOverflowSize:ES(function(){return c!=null?c:Math.max(this.$6-d,0)},"bind",!0,this),close:ES(function(){if(b)return[];else{b=!0;c=this.$6-d;return this.$7(a)}},"bind",!0,this)};this.$2.push(e);return e};a.prototype.pushElement=function(a){this.$2.length>0&&(this.$1.write(a),this.$5++);return this};a.prototype.isActive=function(){return this.$2.length>0};a.prototype.$8=function(a){return Math.max(a-this.$6,0)};a.prototype.$7=function(a){__p&&__p();var b=void 0,c=void 0,d=void 0,e=void 0;for(var f=0;f0&&(this.$1.dropFirst(f),this.$6+=f);return i};e.exports=a}),null); 77 | __d("WorkerUtils",[],(function(a,b,c,d,e,f){"use strict";function b(){try{return"WorkerGlobalScope"in a&&a instanceof a.WorkerGlobalScope}catch(a){return!1}}e.exports={isWorkerContext:b}}),null); 78 | __d("getReusableTimeSliceContinuation",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();function a(a,b,c){__p&&__p();var d=!1,e=a.getGuardedContinuation(c),f=function(b){e(function(){d||(e=a.getGuardedContinuation(c)),b()})};f.last=function(a){var b=e;g();b(a)};f[b]={cancel:function(){d||(a.cancel(e),g(),d=!0)},tokens:[],invoked:!1};function g(){d=!0,e=function(a){a()}}return f}e.exports=a}),null); 79 | __d("nullthrows",[],(function(a,b,c,d,e,f){a=function(a){var b=arguments.length<=1||arguments[1]===undefined?"Got unexpected null or undefined":arguments[1];if(a!=null)return a;var c=new Error(b);c.framesToPop=1;throw c};e.exports=a}),null); 80 | __d("ExecutionEnvironment",[],(function(a,b,c,d,e,f){"use strict";a=!!(typeof window!=="undefined"&&window.document&&window.document.createElement);b={canUseDOM:a,canUseWorkers:typeof Worker!=="undefined",canUseEventListeners:a&&!!(window.addEventListener||window.attachEvent),canUseViewport:a&&!!window.screen,isInWorker:!a};e.exports=b}),null); 81 | __d("performance",["ExecutionEnvironment"],(function(a,b,c,d,e,f,g){"use strict";a=void 0;g.canUseDOM&&(a=window.performance||window.msPerformance||window.webkitPerformance);e.exports=a||{}}),null); 82 | __d("performanceAbsoluteNow",["performance"],(function(a,b,c,d,e,f,g){if(g.now&&g.timing&&g.timing.navigationStart){var h=g.timing.navigationStart;a=function(){return g.now()+h}}else a=function(){return ES("Date","now",!1)};e.exports=a}),null); 83 | __d("wrapFunction",[],(function(a,b,c,d,e,f){__p&&__p();var g={};a=function(a,b,c){return function(){var d=b in g?g[b](a,c):a;for(var e=arguments.length,f=Array(e),h=0;h0?a[a.length-1]:null}function M(a,b){var c={};j.applyWithGuard(Q,null,[a,b,c]);j.applyWithGuard(R,null,[a,b,c]);H.push(a);I.push(b);J.push(c)}function N(a,b,c){ES(s,"forEach",!0,function(d){var e=d.onNewContextCreated(K(),b,c);a[d.getBeforeID()]=e})}function O(a,b){ES(s,"forEach",!0,function(c){c.onContextCanceled(a,b[c.getBeforeID()])})}function P(a,b,c){ES(t,"forEach",!0,function(d){d.onAfterContextEnded(a,b[d.getBeforeID()],c[d.getBeforeID()],a.meta)})}function Q(a,b,c){ES(s,"forEach",!0,function(d){var e=d.onBeforeContextStarted(a,b[d.getBeforeID()],a.meta);c[d.getBeforeID()]=e})}function R(a,b,c){ES(s,"forEach",!0,function(d){var e=d.onAfterContextStarted(a,b[d.getBeforeID()],c[d.getBeforeID()],a.meta);c[d.getBeforeID()]=e})}function S(){__p&&__p();var a=K(),b=L(I),c=L(J);if(a==null||b==null||c==null){k("TimeSlice").mustfix("popped too many times off the timeslice stack");w=!1;return}j.applyWithGuard(P,null,[a,b,c]);w=!a.isRoot;H.pop();I.pop();J.pop()}var T={PropagationType:{CONTINUATION:0,EXECUTION:1,ORPHAN:2},guard:function(a,b,c){__p&&__p();typeof a==="function"||o(0);typeof b==="string"||o(0);var d=U(c);if(a[u])return a;d.root||T.checkCoverage();var e=void 0;w&&(e=K());var f={},g=0,h={cancel:function(){h.invoked||j.applyWithGuard(O,null,[b,f])},tokens:[],invoked:!1};c=function(){__p&&__p();var c=q(),i;void 0;var l=v++,n={contextID:l,name:b,isRoot:!w,executionNumber:g++,meta:d,absBeginTimeMs:c};h.invoked||(h.invoked=!0,h.tokens.length&&(ES(h.tokens,"forEach",!0,function(a){delete A[a]}),h.tokens=[]));M(n,f);if(e!=null){var o=!!d.isContinuation;e.isRoot?(n.indirectParentID=e.contextID,n.isEdgeContinuation=o):(n.indirectParentID=e.indirectParentID,n.isEdgeContinuation=!!(o&&e.isEdgeContinuation))}var p=m.isWorkerContext();w=!0;try{if(!n.isRoot||p)return a.apply(this,arguments);else{var r="TimeSlice"+(b?": "+b:"");i=j.applyWithGuard(a,this,[].concat(Array.prototype.slice.call(arguments)),null,r);return i}}finally{var s=K();if(s==null)k("TimeSlice").mustfix("timeslice stack misaligned, not logging the block"),w=!1;else{var t=s.isRoot,u=s.contextID,x=s.indirectParentID,y=s.isEdgeContinuation,z=q();s.absEndTimeMs=z;if(t&&c!=null){E+=z-c;var B=babelHelpers["extends"]({begin:c,end:z,id:u,indirectParentID:x,representsExecution:!0,isEdgeContinuation:e&&y,guard:b},d,a.__SMmeta);F.pushElement(B)}S()}}};c=c;c[u]=h;j.applyWithGuard(N,null,[f,b,d]);return c},copyGuardForWrapper:function(a,b){a[u]&&(b[u]=a[u]);return b},cancel:function(a){a=a?a[u]:null;a&&!a.invoked&&(a.cancel(),ES(a.tokens,"forEach",!0,function(a){delete A[a]}),a.invoked=!0)},cancelWithToken:function(a){A[a]&&T.cancel(A[a])},registerForCancelling:function(a,b){a&&(b[u]&&(A[a]||(b[u].invoked||(A[a]=b,b[u].tokens.push(a)))))},inGuard:function(){return w},checkCoverage:function(){var a=void 0;if(B!==z&&!w){G&&(a=Error.stackTraceLimit,Error.stackTraceLimit=50);var b=new Error("Missing TimeSlice coverage");G&&(Error.stackTraceLimit=a);B===y&&Math.random()1?b-1:0),d=1;da.getBeforeID()){s.splice(c,0,a);b=!0;break}b||s.push(a);for(var c=0;ca.getAfterID()){t.splice(c,0,a);return}t.push(a)},catchUpOnDemandExecutionContextObservers:function(a){for(var b=0;b1?b-1:0),d=1;d1?c-1:0),e=1;e2?e-2:0),g=2;g=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e(a)}};e.exports=a}),null); 98 | __d("fbinstant/common/requestAnimationFrameListener",["fbinstant/common/event"],(function(a,b,c,d,e,f,g){"use strict";__p&&__p();var h=["requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","msRequestAnimationFrame"];function a(){this.$1=new g()}a.prototype.init=function(){__p&&__p();for(var a=h,b=Array.isArray(a),c=0,a=b?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var d;if(b){if(c>=a.length)break;d=a[c++]}else{c=a.next();if(c.done)break;d=c.value}d=d;this.$2(d)}};a.prototype.on=function(a){this.$1.on(a)};a.prototype.$2=function(a){var b=window[a];b&&(window[a]=function(a){b(function(b){a(b),this.$1.triggerSubscribers(b)}.bind(this))}.bind(this))};e.exports=new a()}),null); 99 | __d("fbinstant/common/performanceTracker",["InstantGamesSDKMessages","fbinstant/common/requestAnimationFrameListener"],(function(a,b,c,d,e,f,g,h){"use strict";__p&&__p();var i=1.5;(function(){window.performance||(window.performance={}),window.performance.now||(function(){var a=Date.now();window.performance.now=function(){return Date.now()-a}})()})();function a(){this.$1=0,this.$2=0,this.$3=0,this.$4=0}a.prototype.init=function(a){__p&&__p();this.$5=a,h.init(),this.$1=window.performance.now(),h.on(function(a){var b=a-this.$1;this.$4&&b>i*this.$4&&this.$5.send(g.ON_FRAME_DROP,b);this.$2+=b;this.$3++;this.$1=a}.bind(this)),window.setInterval(function(){if(this.$3){var a=this.$2/this.$3;this.$4=a;this.$5.send(g.AVERAGE_FRAME_TIME,a)}this.$2=0;this.$3=0}.bind(this),1e3)};e.exports=new a()}),null); 100 | __d("fbinstant/common/platform",[],(function(a,b,c,d,e,f){"use strict";e.exports={IOS:"IOS",ANDROID:"ANDROID",WEB:"WEB",MOBILE_WEB:"MOBILE_WEB"}}),null); 101 | __d("fbinstant/common/supportedFeaturesManager",[],(function(a,b,c,d,e,f){"use strict";function a(){this.$1=new Set()}a.prototype.setSupported=function(a){this.$1=new Set(a)};a.prototype.isSupported=function(a){return this.$1.has(a)?!0:!1};e.exports=new a()}),null); 102 | __d("fbinstant/common/validator",["Promise","fbinstant/common/errorCode"],(function(a,b,c,d,e,f,g,h){"use strict";__p&&__p();var i,j,k,l,m,n,o;a.prototype.validate=function(a,b){return b.validate(a)["catch"](function(a){a={code:h.INVALID_PARAM,message:a.message};throw a})};a.prototype.object=function(){return new q()};a.prototype.array=function(){return new r()};a.prototype.string=function(){return new s()};a.prototype.number=function(){return new t()};a.prototype.integer=function(){return new u()};a.prototype["boolean"]=function(){return new v()};a.prototype.union=function(a){return new w(a)};function a(){}function p(){this.errors=[],this.isOptional=!1,this.type="Any"}p.prototype.validate=function(a){this.validator(a);return new g(function(b,c){return this.errors.length>0?c(new Error(this.errors.map(function(a){return a.message}).join("\n"))):b(a)}.bind(this))};p.prototype.validator=function(a){return};p.prototype.optional=function(){this.isOptional=!0;return this};p.prototype.addError=function(a,b){if(b){this.errors.push(new Error(b));return}this.errors.push(new Error("Expected a value of type "+this.type+", received: "+String(a)))};p.prototype.getErrors=function(){return this.errors};p.prototype.getType=function(){return this.type};b=babelHelpers.inherits(q,p);i=b&&b.prototype;function q(){i.constructor.call(this),this.$ObjectSchema1={},this.$ObjectSchema2=null,this.$ObjectSchema3=null,this.type="Object"}q.prototype.keys=function(a){this.$ObjectSchema1=a;return this};q.prototype.maxSize=function(a){this.$ObjectSchema2=a;return this};q.prototype.minSize=function(a){this.$ObjectSchema3=a;return this};q.prototype.validator=function(a){__p&&__p();if(a==null&&this.isOptional)return;(typeof a!=="object"||Array.isArray(a))&&this.addError(a);this.$ObjectSchema4(a);for(var b in this.$ObjectSchema1){var c=a[b],d=this.$ObjectSchema1[b];if(!d.validator){this.addError(c,"Bad/missing validator for key: "+b);return}d.validator(c);d=d.getErrors();if(d.length>0){var e="For key "+b+": ";for(var d=d,f=Array.isArray(d),g=0,d=f?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=d.length)break;h=d[g++]}else{g=d.next();if(g.done)break;h=g.value}h=h;e+="["+h.message+"],"}this.addError(c,e)}}};q.prototype.$ObjectSchema4=function(a){if(this.$ObjectSchema2||this.$ObjectSchema3){a=JSON.stringify(a).length;this.$ObjectSchema2&&a>this.$ObjectSchema2&&this.errors.push(new Error("Object must be at most "+String(this.$ObjectSchema2)+" characters when stringified, was "+String(a)));this.$ObjectSchema3&&a=a.length)break;d=a[c++]}else{c=a.next();if(c.done)break;d=c.value}d=d;if(!this.$ArraySchema1.validator){this.addError(d,"Bad/missing validator for Array");return}this.$ArraySchema1.validator(d);var e=this.$ArraySchema1.getErrors();if(e.length>0){e=this.$ArraySchema1.getType();e="Array of type "+e+" contained a value of another type: "+String(d);this.addError(d,e);return}}};d=babelHelpers.inherits(s,p);k=d&&d.prototype;function s(){k.constructor.call(this),this.type="String"}s.prototype.validator=function(a){if(a==null&&this.isOptional)return;typeof a!=="string"&&this.addError(a)};f=babelHelpers.inherits(t,p);l=f&&f.prototype;function t(){l.constructor.call(this),this.type="Number"}t.prototype.validator=function(a){if(a==null&&this.isOptional)return;var b=typeof a==="number"&&!isNaN(a);b||this.addError(a)};b=babelHelpers.inherits(u,t);m=b&&b.prototype;function u(){m.constructor.call(this),this.type="Integer"}u.prototype.validator=function(a){if(a==null&&this.isOptional)return;Number.isInteger(a)||this.addError(a)};c=babelHelpers.inherits(v,p);n=c&&c.prototype;function v(){n.constructor.call(this),this.type="Boolean"}v.prototype.validator=function(a){if(a==null&&this.isOptional)return;typeof a!=="boolean"&&this.addError(a)};d=babelHelpers.inherits(w,p);o=d&&d.prototype;function w(a){__p&&__p();o.constructor.call(this);this.$UnionSchema1=a;var b=" or ",c="";for(var a=a,d=Array.isArray(a),e=0,a=d?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var f;if(d){if(e>=a.length)break;f=a[e++]}else{e=a.next();if(e.done)break;f=e.value}f=f;c+=f.type+b}this.type=c.substring(0,c.length-b.length)}w.prototype.validator=function(a){__p&&__p();if(a==null&&this.isOptional)return;var b=[];for(var c=this.$UnionSchema1,d=Array.isArray(c),e=0,c=d?c:c[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{e=c.next();if(e.done)break;f=e.value}f=f;f.validator(a);f=f.getErrors();if(f.length===0)return;b.concat(f)}this.addError(a);for(var f=b,e=Array.isArray(f),d=0,f=e?f:f[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(d>=f.length)break;c=f[d++]}else{d=f.next();if(d.done)break;c=d.value}a=c;this.errors.push(a)}};e.exports=new a()}),null); 103 | __d("fbinstant/common/codedError",["fbinstant/common/errorCode"],(function(a,b,c,d,e,f,g){"use strict";function a(a){this.code=a.code||g.UNKNOWN,this.message=a.message}e.exports=a}),null); 104 | __d("AppCustomEventType",[],(function(a,b,c,d,e,f){e.exports={FB_MOBILE_ACTIVATE_APP:"fb_mobile_activate_app",FB_MOBILE_COMPLETE_REGISTRATION:"fb_mobile_complete_registration",FB_MOBILE_CONTACT:"Contact",FB_MOBILE_CONTENT_VIEW:"fb_mobile_content_view",FB_MOBILE_CUSTOMIZE_PRODUCT:"CustomizeProduct",FB_MOBILE_DONATE:"Donate",FB_MOBILE_FIND_LOCATION:"FindLocation",FB_MOBILE_RATE:"fb_mobile_rate",FB_MOBILE_SCHEDULE:"Schedule",FB_MOBILE_SEARCH:"fb_mobile_search",FB_MOBILE_START_TRIAL:"StartTrial",FB_MOBILE_SUBMIT_APPLICATION:"SubmitApplication",FB_MOBILE_SUBSCRIBE:"Subscribe",FB_MOBILE_TAKE_SURVEY:"TakeSurvey",FB_MOBILE_TUTORIAL_COMPLETION:"fb_mobile_tutorial_completion",FB_MOBILE_ADD_TO_CART:"fb_mobile_add_to_cart",FB_MOBILE_ADD_TO_WISHLIST:"fb_mobile_add_to_wishlist",FB_MOBILE_INITIATED_CHECKOUT:"fb_mobile_initiated_checkout",FB_MOBILE_ADD_PAYMENT_INFO:"fb_mobile_add_payment_info",FB_MOBILE_PURCHASE:"fb_mobile_purchase",FB_MOBILE_LEVEL_ACHIEVED:"fb_mobile_level_achieved",FB_MOBILE_ACHIEVEMENT_UNLOCKED:"fb_mobile_achievement_unlocked",FB_MOBILE_SPENT_CREDITS:"fb_mobile_spent_credits",FB_DIRECT_INSTALL_SUCCESS:"fb_direct_install_success",APPMANAGER_CRASH_REPORT:"appmanager_crash_report",FB_MOBILE_D2_RETENTION:"fb_mobile_d2_retention",FB_MOBILE_D7_RETENTION:"fb_mobile_d7_retention",FB_PAGE_VIEW:"fb_page_view",FB_WEB_NEW_USER:"fb_web_new_user",FB_OTHER:"fb_other",FB_MESSENGER_BOT_NEW_USER:"fb_messenger_bot_new_user",FB_MESSENGER_BOT_MESSAGE_SENT:"fb_messenger_bot_message_sent",FB_MESSENGER_BOT_MESSAGE_RECEIVED:"fb_messenger_bot_message_received",FB_MESSENGER_BOT_THREAD_DELETED:"fb_messenger_bot_thread_deleted",FB_MESSENGER_BOT_STOPPED:"fb_messenger_bot_stopped",FB_MESSENGER_BOT_STARTED:"fb_messenger_bot_started",FB_MESSENGER_BOT_POSTBACK_CALLED:"fb_messenger_bot_postback_called",FB_INSTANT_EXPERIENCES_LAUNCH:"fb_instant_experiences_launch",FB_INSTANT_EXPERIENCES_NEW_USER:"fb_instant_experiences_new_user",FB_INSTANT_ARTICLES_CTA_SIGN_UP:"fb_instant_articles_cta_sign_up",FB_INSTANT_ARTICLES_CTA_IMPRESSION:"fb_instant_articles_cta_impression",FB_INSTANT_ARTICLES_NEW_USER:"fb_instant_articles_new_user",FB_INSTANT_ARTICLES_CLICK:"fb_instant_articles_click",FB_INSTANT_GAMES_NEW_USER:"fb_instant_games_new_user",FB_INSTANT_GAMES_LAUNCH:"fb_instant_games_launch",FB_INSTANT_GAMES_UPDATE_SENT:"fb_instant_games_update_sent",FB_INSTANT_GAMES_UPDATE_CLICK:"fb_instant_games_update_click",FB_INSTANT_GAMES_BOT_MESSAGE_SEND:"fb_instant_games_bot_message_sent",FB_INSTANT_GAMES_BOT_MESSAGE_CLICK:"fb_instant_games_bot_message_click",FB_INSTANT_GAMES_SESSION_PLAY:"fb_instant_games_session_play",FB_INSTANT_GAMES_PLATFORM_EVENT:"fb_instant_games_platform_event",FB_OFFLINE_PURCHASE:"fb_offline_purchase",FB_OFFLINE_NEW_USER:"fb_offline_new_user",FB_OFFLINE_LEAD:"fb_offline_lead",FB_PAGES_POST_REACTION:"fb_pages_post_reaction",FB_PAGES_POST_COMMENT:"fb_pages_post_comment",FB_PAGES_POST_SHARE:"fb_pages_post_share",FB_PAGES_POST_ANSWER:"fb_pages_post_answer",FB_PAGES_POST_RSVP:"fb_pages_post_rsvp",FB_PAGES_PAGE_CHECKIN:"fb_pages_page_checkin",FB_PAGES_MESSAGING_THREAD_READ:"fb_pages_messaging_thread_read",FB_PAGES_MESSAGING_MESSAGE_RECEIVED:"fb_pages_messaging_message_received",FB_PAGES_MESSAGING_MESSAGE_SENT:"fb_pages_messaging_message_sent",FB_PAGES_MESSAGING_BLOCK:"fb_pages_messaging_block",FB_PAGES_MESSAGING_DELETE_THREAD:"fb_pages_messaging_delete_thread",FB_PAGES_MESSAGING_MARK_SPAM:"fb_pages_messaging_mark_spam",FB_PAGES_MESSAGING_LABEL_ADDED:"fb_pages_messaging_label_added",FB_PAGES_MESSAGING_LABEL_REMOVED:"fb_pages_messaging_label_removed",FB_PAGES_MESSAGING_NEW_CONVERSATION:"fb_pages_messaging_new_conversation",FB_PAGES_POST_VIDEO_PLAY_CLICK:"fb_pages_post_video_play_click",FB_PAGES_POST_PHOTO_VIEW_CLICK:"fb_pages_post_photo_view_click",FB_PAGES_NEW_USER:"fb_pages_new_user",FB_CAMERA_EFFECT_OPENED:"fb_camera_effect_opened",FB_CAMERA_EFFECT_SHARED:"fb_camera_effect_shared",FB_CAMERA_EFFECT_SHARE_IMPRESSION:"fb_camera_effect_share_impression",FB_CAMERA_EFFECT_TIME_SPENT:"fb_camera_effect_time_spent",FB_CAMERA_EFFECT_POST_IMPRESSION:"fb_camera_effect_post_impression",FB_CAMERA_EFFECT_CAMERA_CAPTURE:"fb_camera_effect_camera_capture",FB_VIDEO_ASSET_VIDEO_VIEW:"fb_video_asset_video_view",FB_VIDEO_ASSET_IMPRESSION:"fb_video_asset_impression",FB_VIDEO_ASSET_REACTION:"fb_video_asset_reaction",FB_VIDEO_ASSET_COMMENT:"fb_video_asset_comment",FB_VIDEO_ASSET_SHARE:"fb_video_asset_share",FB_VIDEO_POST_VIDEO_VIEW:"fb_video_post_video_view",FB_VIDEO_POST_IMPRESSION:"fb_video_post_impression",FB_VIDEO_POST_REACTION:"fb_video_post_reaction",FB_VIDEO_POST_COMMENT:"fb_video_post_comment",FB_VIDEO_POST_SHARE:"fb_video_post_share",FB_JOURNEY_4_HOUR:"fb_journey_4_hour",FB_JOURNEY_1_DAY:"fb_journey_1_day",FB_JOURNEY_3_DAY:"fb_journey_3_day",FB_JOURNEY_7_DAY:"fb_journey_7_day",FB_JOURNEY_14_DAY:"fb_journey_14_day",FB_JOURNEY_28_DAY:"fb_journey_28_day",FB_JOURNEY_60_DAY:"fb_journey_60_day",FB_JOURNEY_90_DAY:"fb_journey_90_day",FB_MOBILE_INSTALL:"fb_mobile_first_app_launch",FB_MOBILE_DEACTIVATE_APP:"fb_mobile_deactivate_app",FB_BASE_EVENT:"fb_base_event",FB_NEW_USER:"fb_new_user",FB_PURCHASE:"fb_purchase",FB_PAGE_MESSAGING_ACTIVE_CONVERSATION:"fb_pages_messaging_active_conversation"}}),null); 105 | __d("AppEventField",[],(function(a,b,c,d,e,f){e.exports={ANALYTICS_PARTNER_APP_ID:"_analyticsPartnerAppid",APP_USER_ID:"_app_user_id",APP_VERSION:"_appVersion",EVENT_NAME:"_eventName",EVENT_NAME_MD5:"_eventName_md5",IMPLICITLY_LOGGED:"_implicitlyLogged",IS_TIMED_EVENT:"_isTimedEvent",LOG_TIME:"_logTime",ORDER_ID:"fb_order_id",SESSION_ID:"_session_id",UI:"_ui",VALUE_TO_SUM:"_valueToSum",IS_CODELESS:"_is_fb_codeless",COUNT:"$aggr.count"}}),null); 106 | __d("FBEventsParamList",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();var g="deep",h="shallow";function a(){this.list=[]}a.prototype={append:function(a,b){this._append(encodeURIComponent(a),b,g)},_append:function(a,b,c){Object(b)!==b?this._appendPrimitive(a,b):c===g?this._appendObject(a,b):this._appendPrimitive(a,i(b))},_appendPrimitive:function(a,b){b!=null&&this.list.push([a,b])},_appendObject:function(a,b){for(var c in b)if(Object.prototype.hasOwnProperty.call(b,c)){var d=a+"["+encodeURIComponent(c)+"]";this._append(d,b[c],h)}},each:function(a){var b=this.list;for(var c=0,d=b.length;c1&&a[1])return a[1]}return null};e.exports=a}),null); 110 | __d("fbinstant/common/supportedMessagesManager",["InstantGamesSDKMessages"],(function(a,b,c,d,e,f,g){"use strict";var h=new Set([g.INITIALIZE_ASYNC,g.ON_BEGIN_LOAD,g.ON_CONSOLE,g.ON_PROGRESS_LOAD,g.ON_GAME_READY,g.ON_SCORE,g.ON_SCREENSHOT,g.ON_PICTURE,g.ON_END_GAME,g.GET_PLAYER_DATA_ASYNC,g.SET_PLAYER_DATA_ASYNC]);function a(){this.$1=new Set()}a.prototype.setSupported=function(a){this.$1=new Set(a)};a.prototype.isSupported=function(a){return h.has(a)?!0:this.$1.has(a)};e.exports=new a()}),null); 111 | __d("fbinstant/releases/6.2/contextType",[],(function(a,b,c,d,e,f){"use strict";e.exports={GROUP:"GROUP",POST:"POST",SOLO:"SOLO",THREAD:"THREAD"}}),null); 112 | __d("fbinstant/releases/6.2/gameContext",["fbinstant/releases/6.2/contextType"],(function(a,b,c,d,e,f,g){"use strict";__p&&__p();function a(a){__p&&__p();this.$4=null;var b=a.id,c=a.type;a=a.size;if(!b||!c||c===g.SOLO){this.$1=null;this.$2=null;this.$3=g.SOLO;return}this.$3=c;this.$1=b;this.$2=a||null}a.prototype.getID=function(){return this.$1};a.prototype.getType=function(){return this.$3};a.prototype.getSize=function(){return this.$2};a.prototype.getContextSizeResponse=function(){return this.$4};a.prototype.setContextSizeResponse=function(a){this.$4=a};e.exports=a}),null); 113 | __d("fbinstant/common/eventBatcher",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();var g=5e3;function a(a){this.$4=function(){this.$3(this.$2),this.$2=[]}.bind(this),this.$3=a,this.$2=[],this.$1=null}a.prototype.startInterval=function(){var a=arguments.length<=0||arguments[0]===undefined?g:arguments[0];this.$1!==null&&this.stopInterval();this.$1=setInterval(this.$4,a)};a.prototype.stopInterval=function(){if(!this.$1)return;clearInterval(this.$1);this.$1=null};a.prototype.logEvent=function(event){this.$2.push(event)};e.exports=a}),null); 114 | /** 115 | * License: https://www.facebook.com/legal/license/Xw9uo4x52zr/ 116 | */ 117 | __d("Alea",[],(function(a,b,c,d,e,f){__p&&__p();function g(){__p&&__p();var a=4022871197,b=function(b){__p&&__p();b=b.toString();for(var c=0;c>>0;d-=a;d*=a;a=d>>>0;d-=a;a+=d*4294967296}return(a>>>0)*23283064365386963e-26};b.version="Mash 0.9";return b}function a(){__p&&__p();return function(a){__p&&__p();var b=0,c=0,d=0,e=1;a.length===0&&(a=[new Date()]);var f=new g();b=f(" ");c=f(" ");d=f(" ");for(var h=0;h=c.length)break;f=c[e++]}else{e=c.next();if(e.done)break;f=e.value}f=f;if(this.$1.has(f)){f=this.$1.get(f);f!==undefined||j(0);return this.$2(f)}}for(var f=b,e=Array.isArray(f),d=0,f=e?f:f[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(d>=f.length)break;c=f[d++]}else{d=f.next();if(d.done)break;c=d.value}b=c;this.$1.set(b,a)}return g.resolve()};a.prototype.release=function(a){__p&&__p();a=i[a];if(!a)return;for(var a=a,b=Array.isArray(a),c=0,a=b?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var d;if(b){if(c>=a.length)break;d=a[c++]}else{c=a.next();if(c.done)break;d=c.value}d=d;this.$1["delete"](d)}};a.prototype.reset_TESTINGONLY=function(){this.$1=new Map()};a.prototype.$2=function(a){return g.reject({code:h.PENDING_REQUEST,message:"There is currently a pending request for locking message: "+a})};e.exports=new a()}),null); 121 | __d("fbinstant/releases/6.2/apiError",["fbinstant/common/errorCode"],(function(a,b,c,d,e,f,g){"use strict";function a(a){this.code=a.code||g.UNKNOWN,this.message=a.message,this.code===g.CLIENT_REQUIRES_UPDATE&&(this.code=g.CLIENT_UNSUPPORTED_OPERATION)}e.exports=a}),null); 122 | __d("fbinstant/releases/6.2/messageSender",["Promise","InstantGamesSDKMessages","Random","fbinstant/common/errorCode","fbinstant/common/event","fbinstant/common/exclusiveMessageManager","fbinstant/common/supportedMessagesManager","fbinstant/releases/6.2/apiError"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";__p&&__p();function a(a){this.$4=a,this.$1={},this.$2=new k(),this.$3=new k()}a.prototype.initialize=function(a){__p&&__p();this.$6=a.source;this.$5=a.sender;this.$2.on(function(a){this.$7(a,!0)}.bind(this));this.$3.on(function(a){this.$7(a,!1)}.bind(this));a=new RegExp("[?&]IsMobileWeb(=([^&#]*)|&|#|$)","i");a=a.exec(window.location.href);if(!a||!a[2])return;window.IsMobileWeb=parseInt(a[2],10)===1};a.prototype.getResolvePromiseEvent=function(){return this.$2};a.prototype.getRejectPromiseEvent=function(){return this.$3};a.prototype.send=function(a,b){if(!this.$6||!this.$5||!m.isSupported(a))return;this.$5.postMessage(this.$8({type:a,content:b,destination:this.$6}),"*")};a.prototype.sendAsync=function(a,b){return!m.isSupported(a)?g.reject(new n({code:j.CLIENT_UNSUPPORTED_OPERATION,message:"Client does not support the message: "+a})):l.lockOrThrow(a).then(function(){return this.$9(a,b).then(function(b){l.release(a);return b})["catch"](function(b){l.release(a);throw b})}.bind(this))["catch"](function(a){throw new n(a)})};a.prototype.showGenericDialogAsync=function(a,b){b=JSON.stringify(b||{});b={data:b,request:a,sdkVersion:this.$4};return this.sendAsync(h.SHOW_GENERIC_DIALOG_ASYNC,b).then(function(a){if(!a)return g.reject(new n({code:j.UNKNOWN,message:"No response data provided"}));a=JSON.parse(a);var b=a.data,c=a.errorCode;a=a.errorMessage;return c?g.reject(new n({code:c,message:a||""})):b})};a.prototype.sendPassThroughAsync=function(a,b){b=JSON.stringify(b||{});b={data:b,request:a,sdkVersion:this.$4};return this.sendAsync(h.SEND_PASS_THROUGH_ASYNC,b).then(function(a){if(!a)return g.reject(new n({code:j.UNKNOWN,message:"No response data provided"}));a=JSON.parse(a);var b=a.data,c=a.errorCode;a=a.errorMessage;return c?g.reject(new n({code:c,message:a||""})):b})};a.prototype.$8=function(a){switch(this.$6){case"Android":case"quicksilver-rn":return JSON.stringify(a)}return a};a.prototype.$10=function(a){return a+"_"+i.uint32().toString()};a.prototype.$11=function(a,b,c){this.$1[a]={resolve:b,reject:c}};a.prototype.$7=function(a,b){__p&&__p();var c=a.promiseID;if(!c||!this.$1[c])return;var d=this.$1[c];if(b&&d.resolve)d.resolve(a.data);else if(!b&&d.reject){b=a.data;!b?b=new n({message:""}):b=new n({code:b.code||j.UNKNOWN,message:b.message||""});d.reject(b)}delete this.$1[c]};a.prototype.$9=function(a,b){return new g(function(c,d){var e=this.$10(a);this.$11(e,c,d);c=b||{};c.promiseID=e;this.send(a,c)}.bind(this))};e.exports=a}),null); 123 | __d("fbinstant/releases/6.2/internalEventLogger",["InstantGamesPassThroughRequestType","fbinstant/common/eventBatcher","fbinstant/releases/6.2/messageSender"],(function(a,b,c,d,e,f,g,h,i){"use strict";__p&&__p();function a(){this.$3=function(a){var b=this.$2;if(a.length<=0||!b)return;a=this.$4(a);b.sendPassThroughAsync(g.SDK_EVENT,{events:a})}.bind(this),this.$1=new h(this.$3)}a.prototype.initialize=function(a){this.$2=a,this.$1.startInterval()};a.prototype.logEvent=function(a,b,c){this.$1.logEvent({type:a,data:babelHelpers["extends"]({},c,{contextID:b.getContext().getID()})})};a.prototype.$4=function(a){__p&&__p();var b={};for(var a=a,c=Array.isArray(a),d=0,a=c?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}var event=e;Object.prototype.hasOwnProperty.call(b,event.data.key)||(b[event.data.key]=babelHelpers["extends"]({},event),b[event.data.key].data.count=0);b[event.data.key].data.count+=1}e=[];for(var f in b)e.push(b[f]);return e};e.exports=a}),null); 124 | __d("promiseDone",["TAAL","setTimeoutAcrossTransitions"],(function(a,b,c,d,e,f,g,h){__p&&__p();function a(a,b,c){var d=new Error("promiseDone"),e=arguments.length>1?a.then(b,c):a;e.then(null,function(a){h(function(){if(a instanceof Error)throw a;else{d.message=g.blameToPreviousFile(a);throw d}},0)})}e.exports=a}),null); 125 | __d("fbinstant/releases/6.2/paymentsState",["Promise","fbinstant/common/event","promiseDone"],(function(a,b,c,d,e,f,g,h,i){"use strict";__p&&__p();function a(){this.$3=!1,this.$1=new h(),this.$2=new g(function(a,b){this.$1.on(function(){this.$3=!0,a(),this.$1.unbind()}.bind(this))}.bind(this))}a.prototype.getPaymentsInitializedEvent=function(){return this.$1};a.prototype.isClientReady=function(){return this.$3};a.prototype.onInitialized=function(a){i(this.$2,a)};e.exports=a}),null); 126 | __d("fbinstant/releases/6.2/internalStates",["InstantGamesGameState","fbinstant/common/analytics","fbinstant/common/event","fbinstant/common/supportedFeaturesManager","fbinstant/common/supportedMessagesManager","fbinstant/releases/6.2/contextType","fbinstant/releases/6.2/gameContext","fbinstant/releases/6.2/internalEventLogger","fbinstant/releases/6.2/messageSender","fbinstant/releases/6.2/paymentsState"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){"use strict";__p&&__p();function a(){this.$25="fbinstant.6.2".substring("fbinstant.".length),this.$16=new o(this.$25),this.$1=new h(),this.$2=new i(),this.$3=null,this.$4=null,this.$5=new m({type:l.SOLO}),this.$6=null,this.$7=0,this.$9=null,this.$8=null,this.$10=g.LOADING,this.$11=new i(),this.$12=!1,this.$13=new n(),this.$14=null,this.$15=null,this.$18=new p(),this.$19=null,this.$20=null,this.$21=null,this.$22=null,this.$23=null,this.$24=new i(),this.$17=new i()}a.prototype.initialize=function(a){__p&&__p();a.appID&&this.setAppID(a.appID);a.locale&&this.setLocale(a.locale);a.playerID&&this.setPlayerID(a.playerID);a.playerName&&this.setPlayerName(a.playerName);a.playerPhoto&&this.setPlayerPhoto(a.playerPhoto);a.supportedMessages&&Array.isArray(a.supportedMessages)&&k.setSupported(a.supportedMessages);a.supportedFeatures&&Array.isArray(a.supportedFeatures)&&j.setSupported(a.supportedFeatures);if(a.entryPointData)try{this.setEntryPointData(JSON.parse(a.entryPointData))}catch(a){!1}a.entryPoint&&this.setRawSource(a.entryPoint);this.updateContext(a);this.setInitialized();this.getAnalytics().init(this.getAppID(),this.getPlayerID());this.getAnalyticsLogEvent().on(function(event){var a=event.eventName,b=event.valueToSum,c=event.parameters;if(!a)return;this.getAnalytics().logEvent(a,b!=null?b:null,c||null)}.bind(this));this.getInternalEventLogger().initialize(this.getMessageSender())};a.prototype.updateContext=function(a){if(!a.contextType)return;this.setContextPlayersPromise(null);this.$5=new m({id:a.contextID,size:a.contextSize,type:a.contextType.toUpperCase()})};a.prototype.setAppID=function(a){this.$3=a};a.prototype.setLocale=function(a){this.$14=a};a.prototype.setPlayerID=function(a){this.$20=a};a.prototype.setPlayerName=function(a){this.$21=a};a.prototype.setPlayerPhoto=function(a){this.$22=a};a.prototype.setRawSource=function(a){this.$23=a};a.prototype.setEntryPoint=function(a){this.$9=a};a.prototype.setEntryPointData=function(a){this.$8=a};a.prototype.setInitialized=function(){this.$12=!0};a.prototype.setPlatform=function(a){this.$19=a};a.prototype.setLoadingProgress=function(a){this.$7=a};a.prototype.setGameState=function(a){this.$10=a};a.prototype.setConnectedPlayersPromise=function(a){this.$4=a};a.prototype.setContextPlayersPromise=function(a){this.$6=a};a.prototype.setMatchPlayerPromise=function(a){this.$15=a};a.prototype.getAnalytics=function(){return this.$1};a.prototype.getAppID=function(){return this.$3};a.prototype.getConnectedPlayersPromise=function(){return this.$4};a.prototype.getContext=function(){return this.$5};a.prototype.getContextPlayersPromise=function(){return this.$6};a.prototype.getLoadingProgress=function(){return this.$7};a.prototype.getEntryPoint=function(){return this.$9};a.prototype.getEntryPointData=function(){return this.$8};a.prototype.getGameState=function(){return this.$10};a.prototype.getGameStartEvent=function(){return this.$11};a.prototype.isInitialized=function(){return this.$12};a.prototype.getInternalEventLogger=function(){return this.$13};a.prototype.getLocale=function(){return this.$14};a.prototype.getMatchPlayerPromise=function(){return this.$15};a.prototype.getMessageSender=function(){return this.$16};a.prototype.getPaymentsState=function(){return this.$18};a.prototype.getPlatform=function(){return this.$19};a.prototype.getPlayerID=function(){return this.$20};a.prototype.getPlayerName=function(){return this.$21};a.prototype.getPlayerPhoto=function(){return this.$22};a.prototype.getRestartEvent=function(){return this.$24};a.prototype.getPauseEvent=function(){return this.$17};a.prototype.getAnalyticsLogEvent=function(){return this.$2};a.prototype.getSdkVersion=function(){return this.$25};a.prototype.getRawSource=function(){return this.$23};e.exports=new a()}),null); 127 | __d("InstantGamesSDKEventType",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({API_CALL:"api_call",API_BEGIN_ASYNC:"api_begin_async",API_REJECT_ASYNC:"api_reject_async",API_RESOLVE_ASYNC:"api_resolve_async",PRE_GAME_START_API_CALL:"pre_game_start_api_call",NOT_TOSED:"not_tosed",PASSTHROUGH_REQUEST:"passthrough_request",TOSED:"tosed",UPDATE_POLICY:"update_policy"})}),null); 128 | __d("InstantGamesSDKEvents",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({API:"API",CLIENT:"CLIENT",SERVER:"SERVER"})}),null); 129 | __d("fbinstant/releases/6.2/logger",["InstantGamesSDKEvents","InstantGamesSDKEventType","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h,i){"use strict";__p&&__p();function a(a,b){return a.then(function(a){k(b);return a})["catch"](function(a){var c=a&&a.code||null;j(b,c);throw a})}function b(a){var b=i.getAnalytics();b.logAPICall(a);l(m(a,h.API_CALL),g.API,{type:h.API_CALL,name:a})}function c(a){var b=i.getAnalytics();b.logBeginAsyncAPICall(a);l(m(a,h.API_BEGIN_ASYNC),g.API,{type:h.API_BEGIN_ASYNC,name:a})}function j(a,b){var c=i.getAnalytics();c.logRejectAsyncAPICall(a,b);l(m(a,h.API_REJECT_ASYNC,String(b)),g.API,{type:h.API_REJECT_ASYNC,name:a,code:b})}function k(a){var b=i.getAnalytics();b.logResolveAsyncAPICall(a);l(m(a,h.API_RESOLVE_ASYNC),g.API,{type:h.API_RESOLVE_ASYNC,name:a})}function l(a,b,c){c=babelHelpers["extends"]({},c,{key:a,gameState:i.getGameState()});i.getInternalEventLogger().logEvent(b,i,c)}function m(a,b){var c=arguments.length<=2||arguments[2]===undefined?null:arguments[2];return c!=null?a+"."+b+"."+c:a+"."+b}e.exports={logAPICall:b,logBeginAsync:c,logAsyncResult:a,logReject:j,logResolve:k}}),null); 130 | __d("fbinstant/releases/6.2/ads",["Promise","InstantGamesGameState","InstantGamesSDKMessages","fbinstant/common/codedError","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";__p&&__p();function o(a){this.$1=a}o.prototype.getPlacementID=function(){return this.$1.placementID};o.prototype.loadAsync=function(){var a="AdInstance_loadAsync";n.logBeginAsync(a);var b=m.getMessageSender().sendAsync(i.LOAD_AD_ASYNC,{adInstanceID:this.$1.adInstanceID});return n.logAsyncResult(b,a).then(function(){})};o.prototype.showAsync=function(){var a="AdInstance_showAsync";n.logBeginAsync(a);if(m.getGameState()!==h.PLAYING){n.logReject(a);return g.reject(new j({code:k.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var b=m.getMessageSender().sendAsync(i.SHOW_AD_ASYNC,{adInstanceID:this.$1.adInstanceID});return n.logAsyncResult(b,a).then(function(){})};e.exports={AdInstance:o,getInterstitialAdAsync:function(a){return l.validate(a,l.string()).then(function(){return m.getMessageSender().sendAsync(i.GET_INTERSTITIAL_AD_ASYNC,{placementID:a})}).then(function(a){return new o(a)})},getRewardedVideoAsync:function(a){return l.validate(a,l.string()).then(function(){return m.getMessageSender().sendAsync(i.GET_REWARDED_VIDEO_ASYNC,{placementID:a})}).then(function(a){return new o(a)})}}}),null); 131 | __d("InstantGamesChallengePickerFilter",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({NEW_CONTEXT_ONLY:"NEW_CONTEXT_ONLY",INCLUDE_EXISTING_CHALLENGES:"INCLUDE_EXISTING_CHALLENGES",NEW_PLAYERS_ONLY:"NEW_PLAYERS_ONLY"})}),null); 132 | __d("InstantGamesContextMatchStatus",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({ACTIVE:"ACTIVE",ENDED:"ENDED"})}),null); 133 | __d("fbinstant/releases/6.2/activityStore",["Promise","InstantGamesContextMatchStatus","InstantGamesSDKMessages","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";__p&&__p();var o=64,p=2048;function a(a){var b=a.id,c=a.contextID,d=a.status;if(!b||!c||!d)throw new l({code:j.UNKNOWN,message:"Context activity store has an invalid configuration"});this.$1=a;this.$1.name=this.$1.name!=null?this.$1.name:null;this.$2=!1}a.prototype.getID=function(){n.logAPICall("activityStore_getID");return this.$1.id};a.prototype.getContextID=function(){n.logAPICall("activityStore_getContextID");return this.$1.contextID};a.prototype.getName=function(){n.logAPICall("activityStore_getName");return this.$1.name};a.prototype.getStatus=function(){n.logAPICall("activityStore_getStatus");return this.$1.status};a.prototype.endAsync=function(){__p&&__p();var a="activityStore_endAsync";n.logBeginAsync(a);var b=this.$3().then(function(){return m.getMessageSender().sendAsync(i.CONTEXT_MATCH_END_ASYNC,{contextID:this.$1.contextID,matchID:this.$1.id}).then(function(a){return this.$4().then(function(){return a})}.bind(this))["catch"](function(a){return this.$4().then(function(){throw a})}.bind(this))}.bind(this)).then(function(a){this.$1=a;return this}.bind(this));return n.logAsyncResult(b,a)};a.prototype.getDataAsync=function(a){var b="activityStore_getDataAsync";n.logBeginAsync(b);var c=k.validate(a,k.array().schemaType(k.string())).then(function(){return m.getMessageSender().sendAsync(i.CONTEXT_MATCH_DATA_FETCH_ASYNC,{contextID:this.$1.contextID,keys:a,matchID:this.$1.id})}.bind(this)).then(this.$5);return n.logAsyncResult(c,b)};a.prototype.saveDataAsync=function(a){__p&&__p();var b="activityStore_saveDataAsync";n.logBeginAsync(b);var c=this.$3().then(function(){return k.validate(a,k.object()).then(this.$6).then(function(a){return m.getMessageSender().sendAsync(i.CONTEXT_MATCH_DATA_SAVE_ASYNC,{contextID:this.$1.contextID,matchID:this.$1.id,data:a})}.bind(this)).then(function(){return this.$4().then(function(){return})}.bind(this))["catch"](function(a){return this.$4().then(function(){throw a})}.bind(this))}.bind(this));return n.logAsyncResult(c,b)};a.prototype.incrementDataAsync=function(a){__p&&__p();var b="activityStore_incrementDataAsync";n.logBeginAsync(b);var c=k.validate(a,k.object()).then(function(){for(var b in a)if(!Number.isInteger(a[b]))return g.reject(new l({code:j.INVALID_PARAM,message:'Provided key "'+b+'" contained a non-integer value: '+String(a[b])}));return g.resolve(JSON.stringify(a))}).then(function(){return this.$3()}.bind(this)).then(function(){return m.getMessageSender().sendAsync(i.CONTEXT_MATCH_DATA_INC_ASYNC,{contextID:this.$1.contextID,data:a,keys:Object.keys(a),matchID:this.$1.id}).then(function(a){return this.$4().then(function(){return a})}.bind(this))["catch"](function(a){return this.$4().then(function(){throw a})}.bind(this))}.bind(this)).then(this.$5);return n.logAsyncResult(c,b)};a.prototype.$3=function(){if(this.$2)return g.reject(new l({code:j.PENDING_REQUEST,message:"Cannot mutate a store that has a pending mutation."}));if(this.getStatus()===h.ENDED)return g.reject(new l({code:j.INVALID_OPERATION,message:"Cannot mutate a store that has ended."}));if(m.getContext().getID()!==this.$1.contextID)return g.reject(new l({code:j.INVALID_PARAM,message:"Cannot mutate a store in a context other than the current one."}));this.$2=!0;return g.resolve()};a.prototype.$4=function(){this.$2=!1;return g.resolve()};a.prototype.$6=function(a){__p&&__p();var b={};for(var c in a){if(new Blob([c]).size>o)return g.reject(new l({code:j.INVALID_PARAM,message:'Key "'+c+'" in provided data was greater than '+String(o)+" byte limit"}));var d=a[c];d=JSON.stringify(d);if(new Blob([d]).size>p)return g.reject(new l({code:j.INVALID_PARAM,message:'Value "'+d+'" in provided data was greater than '+String(p)+" byte limit"}));b[c]=d}return g.resolve(JSON.stringify(b))};a.prototype.$5=function(a){a=JSON.parse(a);var b={};for(var c in a){var d=a[c];d=JSON.parse(d);b[c]=d}return g.resolve(b)};e.exports=a}),null); 134 | __d("fbinstant/releases/6.2/connectedPlayers",["InstantGamesSDKMessages","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h){"use strict";__p&&__p();function i(a){this.$1=a}i.prototype.getID=function(){return this.$1.id};i.prototype.getName=function(){return this.$1.name||null};i.prototype.getPhoto=function(){return this.$1.photo||null};a={fetchAsync:function(){return h.getMessageSender().sendAsync(g.GET_CONNECTED_PLAYERS_ASYNC,{}).then(function(a){return a.map(function(a){return new i(a)})})},ConnectedPlayer:i};e.exports=a}),null); 135 | __d("fbinstant/releases/6.2/contextPlayers",["InstantGamesSDKMessages","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h){"use strict";__p&&__p();function i(a){this.$1=a}i.prototype.getID=function(){return this.$1.id};i.prototype.getName=function(){return this.$1.name||null};i.prototype.getPhoto=function(){return this.$1.photo||null};a={fetchAsync:function(){return h.getMessageSender().sendAsync(g.CONTEXT_PLAYERS_FETCH_ASYNC,{}).then(function(a){return a.map(function(a){return new i(a)})})},ContextPlayer:i};e.exports=a}),null); 136 | __d("fbinstant/releases/6.2/context",["Promise","InstantGamesChallengePickerFilter","InstantGamesContextMatchStatus","InstantGamesGameState","InstantGamesSDKMessages","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/activityStore","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/connectedPlayers","fbinstant/releases/6.2/contextPlayers","fbinstant/releases/6.2/contextType","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){"use strict";__p&&__p();a={getID:function(){t.logAPICall("context_getID");return s.getGameState()!==j.PLAYING?null:s.getContext().getID()},getType:function(){t.logAPICall("context_getType");return s.getGameState()!==j.PLAYING?r.SOLO:s.getContext().getType()},isSizeBetween:function(a,b){__p&&__p();t.logAPICall("context_isSizeBetween");if(s.getGameState()!==j.PLAYING)return null;var c=s.getContext().getContextSizeResponse();if(c)return c;c=s.getContext().getSize();if(a!==null&&!Number.isInteger(a)||b!==null&&!Number.isInteger(b)||c==null)return null;var d=!1;(!a||c>=a)&&(!b||c<=b)&&(d=!0);c={answer:d,minSize:a,maxSize:b};s.getContext().setContextSizeResponse(c);return c},switchAsync:function(a){__p&&__p();var b="context_switchAsync";t.logBeginAsync(b);if(s.getGameState()!==j.PLAYING){t.logReject(b,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}if(a===s.getContext().getID()){t.logReject(b,l.SAME_CONTEXT);return g.reject(new o({code:l.SAME_CONTEXT,message:"Must specify a context other than the current one."}))}var c=m.validate(a,m.string()).then(function(){return s.getMessageSender().sendAsync(k.CONTEXT_SWITCH_ASYNC,{id:a})}).then(function(a){s.updateContext(a);return});return t.logAsyncResult(c,b)},chooseAsync:function(a){__p&&__p();var b="context_chooseAsync";t.logBeginAsync(b);if(s.getGameState()!==j.PLAYING){t.logReject(b,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var c=a||{};c.filters=c.filters||[];c.maxSize=c.maxSize||null;c.minSize=c.minSize||null;if(c.maxSize&&c.maxSize<2){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:"The maximum context size must be at least 2"}))}else if(c.minSize&&c.minSize<2){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:"The minimum context size must be at least 2"}))}else if(c.maxSize&&c.minSize&&c.minSize>c.maxSize){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:"The min size cannot be greater than the max size"}))}for(var a=c.filters,d=Array.isArray(a),e=0,a=d?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var f;if(d){if(e>=a.length)break;f=a[e++]}else{e=a.next();if(e.done)break;f=e.value}f=f;if(!Object.prototype.hasOwnProperty.call(h,f)){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:'Filter "'+f+'" is not supported'}))}}f=m.object().keys({filters:m.array().schemaType(m.string()),maxSize:m.number().optional(),minSize:m.number().optional()});e=m.validate(c,f).then(function(){return s.getMessageSender().sendAsync(k.CONTEXT_CHOOSE_ASYNC,c)}).then(function(a){s.updateContext(a);return});return t.logAsyncResult(e,b)},createAsync:function(a){__p&&__p();var b="context_createAsync";t.logBeginAsync(b);if(s.getGameState()!==j.PLAYING){t.logReject(b,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var c=[a];return m.validate(c,m.array().schemaType(m.string()).length(1)).then(function(){__p&&__p();var a=c.indexOf(s.getPlayerID()||"");a>-1&&c.splice(a,1);if(c.length===0){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:"At least one player id besides the current player'smust be provided."}))}a=s.getConnectedPlayersPromise();if(a)return a;a=p.fetchAsync();s.setConnectedPlayersPromise(a);return a}).then(function(a){__p&&__p();a=new Set(a.map(function(a){return a.getID()}));for(var d=c,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(e){if(f>=d.length)break;h=d[f++]}else{f=d.next();if(f.done)break;h=f.value}h=h;if(!a.has(h)){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:"Provided ID "+String(h)+" is not a connected player of the current player."}))}}return s.getMessageSender().sendAsync(k.CONTEXT_CREATE_ASYNC,{playerIDs:c})}).then(function(a){s.updateContext(a);t.logResolve(b);return})["catch"](function(a){t.logReject(b);throw a})},createStoreAsync:function(a){__p&&__p();var b="context_createStoreAsync";t.logBeginAsync(b);if(s.getContext().getID()===null){t.logReject(b,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Cannot create a new activity store in a solo context"}))}return m.validate(a,m.string().optional()).then(function(){return s.getMessageSender().sendAsync(k.CONTEXT_MATCH_CREATE_ASYNC,{name:a||null})}).then(function(a){return new n(a)}).then(function(a){t.logResolve(b);return a})["catch"](function(a){t.logReject(b);throw a})},getStoresAsync:function(a){__p&&__p();var b="context_getStoresAsync";t.logBeginAsync(b);var c={};c.contextID=a&&a.contextID||s.getContext().getID()||null;c.matches=a&&a.stores||null;c.status=a&&a.status||null;if(c.status!==null&&!Object.prototype.hasOwnProperty.call(i,c.status)){t.logReject(b,l.INVALID_PARAM);return g.reject(new o({code:l.INVALID_PARAM,message:'Value provided for property "status" was not a valid option'}))}a=m.object().keys({contextID:m.string(),matches:m.array().optional().schemaType(m.string()),status:m.string().optional()});return m.validate(c,a).then(function(){return s.getMessageSender().sendAsync(k.CONTEXT_MATCH_FETCH_ASYNC,c)}).then(function(a){if(!a||!Array.isArray(a)){t.logReject(b,l.UNKNOWN);return g.reject(new o({code:l.UNKNOWN,message:"Response data was invalid."}))}return a.map(function(a){return new n(a)})}).then(function(a){t.logResolve(b);return a})["catch"](function(a){t.logReject(b);throw a})},getPlayersAsync:function(){__p&&__p();var a="context_fetchPlayers",b=s.getContextPlayersPromise();if(b)return b;t.logBeginAsync(a);if(s.getGameState()!==j.PLAYING){t.logReject(a,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}if(s.getContext().getID()===null){t.logReject(a,l.INVALID_OPERATION);return g.reject(new o({code:l.INVALID_OPERATION,message:"Cannot get context players in a solo context"}))}b=q.fetchAsync().then(function(a){return new g(function(b,c){if(s.getGameState()===j.PLAYING){b(a);return}c=function c(){s.getGameStartEvent().off(c),b(a)};s.getGameStartEvent().on(c)})}).then(function(b){t.logResolve(a);return b})["catch"](function(b){t.logReject(a);s.setContextPlayersPromise(null);throw b});s.setContextPlayersPromise(b);return b}};e.exports=a}),null); 137 | __d("InstantGameSDKCustomUpdateNotificationType",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({PUSH:"PUSH",NO_PUSH:"NO_PUSH"})}),null); 138 | __d("InstantGameSDKEndAction",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({SCORE:"SCORE",CUSTOM:"CUSTOM",NONE:"NONE"})}),null); 139 | __d("InstantGamesCustomUpdateDeliveryPolicy",[],(function(a,b,c,d,e,f){e.exports={IMMEDIATE:"IMMEDIATE",LAST:"LAST",IMMEDIATE_CLEAR:"IMMEDIATE_CLEAR"}}),null); 140 | __d("fbinstant/releases/6.2/endGamePayload",["Promise","InstantGamesCustomUpdateDeliveryPolicy","InstantGameSDKCustomUpdateNotificationType","InstantGameSDKEndAction","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/apiError"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";__p&&__p();a.prototype.format=function(a){return!a||!(a instanceof Object)||!a.action||a.action!==j.CUSTOM?g.reject(new m({code:k.INVALID_PARAM,message:'Update action property must be "CUSTOM"'})):this.$1(a)};a.prototype.$1=function(a){var b=a.strategy&&a.strategy in h?a.strategy:h.IMMEDIATE,c=a.notification&&a.notification in i?a.notification:i.NO_PUSH;a=babelHelpers["extends"]({},a,{strategy:b,notification:c});b=l.object().keys({action:l.string(),template:l.string(),cta:l.union([l.string(),l.object()]).optional(),image:l.string(),text:l.union([l.string(),l.object()]),data:l.object().optional().maxSize(1e3),strategy:l.string(),notification:l.string()});return this.$2(a,b,["action","cta","image","text","data","strategy"],["data"])};a.prototype.$2=function(a,b,c){var d=arguments.length<=3||arguments[3]===undefined?[]:arguments[3];return l.validate(a,b).then(function(a){return g.resolve(this.$3(a,c,d))}.bind(this))};a.prototype.$3=function(a,b){__p&&__p();var c=arguments.length<=2||arguments[2]===undefined?[]:arguments[2],d=this.$4(a),e=babelHelpers["extends"]({},a,d),f={};for(var g in e)if(c.indexOf(g)!==-1)try{e[g]=JSON.stringify(e[g])}catch(a){!1}for(var h in e)b.indexOf(h)===-1&&(f[h]=e[h],delete e[h]);e.extra=JSON.stringify(f);return e};a.prototype.$4=function(a){var b={},c=a.text,d=a.cta;typeof c==="object"&&(b.text_localizations=c.localizations,a.text=c["default"]);d!=null&&typeof d!=="string"&&(b.cta_localizations=d.localizations,a.cta=d["default"]);return b};function a(){}e.exports=new a()}),null); 141 | __d("InstantGamesHeartbeatAction",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({START:"start",UPDATE:"update",END:"end"})}),null); 142 | __d("fbinstant/releases/6.2/heartbeat",["InstantGamesHeartbeatAction","InstantGamesPassThroughRequestType","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h,i){"use strict";var j=6e4;a={_heartbeatInterval:null,startHeartbeat:function(){this._heartbeatInterval&&this.stopHeartbeat(),this.sendHeartbeat(g.START),this._heartbeatInterval=setInterval(function(){this.sendHeartbeat(g.UPDATE)}.bind(this),j)},stopHeartbeat:function(){clearInterval(this._heartbeatInterval),this._heartbeatInterval=null,this.sendHeartbeat(g.END)},sendHeartbeat:function(a){i.getMessageSender().sendPassThroughAsync(h.HEARTBEAT,{action:a,contextID:i.getContext().getID()})}};e.exports=a}),null); 143 | __d("InstantGameLeaderboardAPIOperation",[],(function(a,b,c,d,e,f){e.exports=Object.freeze({COUNT:"COUNT",GET_ENTRIES:"GET_ENTRIES",GET_ENTRY:"GET_ENTRY",GET_FRIENDS_ENTRIES:"GET_FRIENDS_ENTRIES",SET_SCORE:"SET_SCORE"})}),null); 144 | __d("fbinstant/common/rateLimiter",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();function a(a,b){this.$4=function(){this.$1=0}.bind(this),this.$2=a,this.$1=0,this.$3=setInterval(this.$4,b)}a.prototype.bump=function(){if(this.$1>=this.$2)return!1;this.$1+=1;return!0};e.exports=a}),null); 145 | __d("fbinstant/releases/6.2/leaderboards",["Promise","InstantGameLeaderboardAPIOperation","InstantGamesPassThroughRequestType","fbinstant/common/errorCode","fbinstant/common/rateLimiter","fbinstant/common/validator","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";__p&&__p();c=20;d=2e3;var p=new k(c,d);function q(){var a=p.bump();return a?g.resolve():g.reject(new m({code:j.RATE_LIMITED,message:"Game called too many leaderboard APIs too quickly. Reduce the rate of requests in order to avoid being rate-limited."}))}function r(a){var b=a.id,c=a.name;a=a.contextID;this.$1=b;this.$2=c;this.$3=a}r.prototype.getName=function(){return this.$2};r.prototype.getContextID=function(){return this.$3};r.prototype.getEntryCountAsync=function(){var a="Leaderboard_getEntryCountAsync";o.logBeginAsync(a);var b=q().then(function(){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_OPERATION,{leaderboard_id:this.$1,operation:h.COUNT})}.bind(this));return o.logAsyncResult(b,a)};r.prototype.setScoreAsync=function(a){var b=arguments.length<=1||arguments[1]===undefined?null:arguments[1],c="Leaderboard_setScoreAsync";o.logBeginAsync(c);var d=l.integer(),e=l.string().optional(),f=l.validate(a,d).then(function(){return l.validate(b,e)}).then(q).then(function(){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_OPERATION,{context_id:n.getContext().getID(),leaderboard_id:this.$1,operation:h.SET_SCORE,score:a,extra_data:b})}.bind(this)).then(function(a){return new s(a)});return o.logAsyncResult(f,c)};r.prototype.getPlayerEntryAsync=function(){var a="Leaderboard_getPlayerEntryAsync";o.logBeginAsync(a);var b=q().then(function(){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_OPERATION,{leaderboard_id:this.$1,operation:h.GET_ENTRY})}.bind(this)).then(function(a){return!a?null:new s(a)});return o.logAsyncResult(b,a)};r.prototype.getEntriesAsync=function(a,b){var c="Leaderboard_getEntriesAsync";o.logBeginAsync(c);var d=l.integer().optional(),e=l.integer().optional();d=l.validate(a,d).then(function(){return l.validate(b,e)}).then(q).then(function(){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_OPERATION,{leaderboard_id:this.$1,operation:h.GET_ENTRIES,limit:a,offset:b})}.bind(this)).then(function(a){return a.map(function(a){return new s(a)})});return o.logAsyncResult(d,c)};r.prototype.getConnectedPlayerEntriesAsync=function(a,b){var c="Leaderboard_getConnectedPlayerEntriesAsync";o.logBeginAsync(c);var d=l.integer().optional(),e=l.integer().optional();d=l.validate(a,d).then(function(){return l.validate(b,e)}).then(q).then(function(){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_OPERATION,{leaderboard_id:this.$1,operation:h.GET_FRIENDS_ENTRIES,limit:a,offset:b})}.bind(this)).then(function(a){return a.map(function(a){return new s(a)})});return o.logAsyncResult(d,c)};function s(a){this.$1=a.score,this.$2=a.format_score,this.$5=a.rank,this.$3=a.extra_data,this.$4=a.ts,this.$6=new t(a.player.name,a.player.photo,a.player.player_id)}s.prototype.getScore=function(){return this.$1};s.prototype.getFormattedScore=function(){return this.$2};s.prototype.getTimestamp=function(){return this.$4};s.prototype.getRank=function(){return this.$5};s.prototype.getExtraData=function(){return this.$3};s.prototype.getPlayer=function(){return this.$6};function t(a,b,c){this.$1=a,this.$2=c,this.$3=b}t.prototype.getName=function(){return this.$1};t.prototype.getPhoto=function(){return this.$3};t.prototype.getID=function(){return this.$2};function a(a){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_FETCH,{name:a}).then(function(a){var b=a.id,c=a.name;a=a.context_id;return new r({id:b,name:c,contextID:a})})}function b(a){var b=l.object().keys({name:l.string(),text:l.string().optional()});return l.validate(a,b).then(function(a){return n.getMessageSender().sendPassThroughAsync(i.LEADERBOARD_UPDATE,{context_token_id:n.getContext().getID(),leaderboard_name:a.name,text:a.text})}).then(function(){})}e.exports={getLeaderboardAsync:a,sendUpdateAsync:b,Leaderboard:r}}),null); 146 | __d("fbinstant/releases/6.2/messageConfig",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();a={getConfig:function(){if(window.QuicksilverAndroid)return{sender:window.QuicksilverAndroid,source:"Android"};else if(window.webkit&&window.webkit.messageHandlers)return{sender:window.webkit.messageHandlers.quicksilver||parent,source:"iOS"};var a=new RegExp("[?&]source(=([^&#]*)|&|#|$)","i");a=a.exec(window.location.href);return{sender:parent,source:a&&a[2]&&decodeURIComponent(a[2].replace(/\+/g," "))}}};e.exports=a}),null); 147 | __d("fbinstant/releases/6.2/messageReceiver",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();function a(){this.$1=null}a.prototype.$2=function(a){if(!a.data||!a.data.source)return;var b=a.data.type;if(!b)return;b=this.$1&&this.$1[b];if(!b)return;b(a.data.content)};a.prototype.init=function(){this.$1={},window.addEventListener("message",this.$2.bind(this))};a.prototype.registerMessageHandler=function(a,b,c){var d=this.$1;if(!d)return;c?d[a]=b.triggerSubscribers.bind(b,c):d[a]=b.triggerSubscribers.bind(b)};e.exports=new a()}),null); 148 | __d("fbinstant/releases/6.2/payments",["Promise","InstantGamesGameState","InstantGamesSDKMessages","fbinstant/common/errorCode","fbinstant/common/supportedMessagesManager","fbinstant/common/validator","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";__p&&__p();function a(){var a="payments_getCatalogAsync";o.logBeginAsync(a);var b=q(i.PAYMENTS_FETCH_CATALOG_ASYNC).then(function(){return n.getMessageSender().sendAsync(i.PAYMENTS_FETCH_CATALOG_ASYNC,{})});return o.logAsyncResult(b,a)}function b(a){var b="payments_purchaseAsync";if(n.getGameState()!==h.PLAYING)return g.reject(new m({code:j.INVALID_OPERATION,message:"Cannot purchase until startGameAsync() resolves."}));o.logBeginAsync(b);var c=l.object().keys({productID:l.string(),developerPayload:l.string().optional()});c=l.validate(a,c).then(function(){return q(i.PAYMENTS_PURCHASE_ASYNC)}).then(function(){return n.getMessageSender().sendAsync(i.PAYMENTS_PURCHASE_ASYNC,{config:a})});return o.logAsyncResult(c,b)}function c(){var a="payments_getPurchasesAsync";o.logBeginAsync(a);var b=q(i.PAYMENTS_FETCH_PURCHASES_ASYNC).then(function(){return n.getMessageSender().sendAsync(i.PAYMENTS_FETCH_PURCHASES_ASYNC,{})});return o.logAsyncResult(b,a)}function d(a){var b="payments_consumePurchaseAsync";o.logBeginAsync(b);var c=l.string();c=l.validate(a,c).then(function(){return q(i.PAYMENTS_CONSUME_PURCHASE_ASYNC)}).then(function(){return n.getMessageSender().sendAsync(i.PAYMENTS_CONSUME_PURCHASE_ASYNC,{token:a})});return o.logAsyncResult(c,b).then(function(){})}function f(a){n.getPaymentsState().onInitialized(a)}function p(){var a="payments_restorePurchasesAsync";o.logBeginAsync(a);var b=q(i.PAYMENTS_RESTORE_PURCHASES_ASYNC).then(function(){return n.getMessageSender().sendAsync(i.PAYMENTS_RESTORE_PURCHASES_ASYNC,{})});return o.logAsyncResult(b,a).then(function(){})}function q(a){return!k.isSupported(a)?g.reject(new m({code:j.CLIENT_UNSUPPORTED_OPERATION,message:"Client does not support this API"})):g.resolve()}d={consumePurchaseAsync:d,getCatalogAsync:a,getPurchasesAsync:c,purchaseAsync:b,onReady:f,restorePurchasesAsync:p};e.exports=d}),null); 149 | __d("fbinstant/releases/6.2/auth",["InstantGamesSDKMessages","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h){"use strict";__p&&__p();function i(a){this.$1=a}i.prototype.getPlayerID=function(){return this.$1.playerID};i.prototype.getSignature=function(){return this.$1.signature};e.exports={SignedPlayerInfo:i,getSignedPlayerInfoAsync:function(a){return h.getMessageSender().sendAsync(g.GET_SIGNED_PLAYER_INFO_ASYNC,{requestPayload:a||null}).then(function(a){return new i(a)})}}}),null); 150 | __d("fbinstant/releases/6.2/botSubscription",["Promise","InstantGamesGameState","InstantGamesPassThroughRequestType","InstantGamesSDKMessages","fbinstant/common/errorCode","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/internalStates","promiseDone"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";__p&&__p();var o=1,p=0,q=null;function a(){__p&&__p();if(m.getGameState()!==h.PLAYING)return g.resolve(!1);if(p>=o){q=!1;return g.resolve(!1)}if(q!=null)return g.resolve(q);var a=m.getMessageSender().sendPassThroughAsync(i.PLAYER_CAN_SUBSCRIBE_GAME_BOT);n(a.then(function(a){return q=a}));return a}function b(){__p&&__p();if(m.getGameState()!==h.PLAYING)return g.reject(new l({code:k.INVALID_OPERATION,message:"Cannot perform this operation before the game has started."}));if(p>=o)return g.reject(new l({code:k.INVALID_OPERATION,message:"Player can only see the subscription dialog once per session."}));if(q!=null){if(!q)return g.reject(new l({code:k.INVALID_OPERATION,message:"Cannot use subscribeBotAsync() to the player. Please check canSubscribeBotAsync() before calling this API."}))}else return g.reject(new l({code:k.INVALID_OPERATION,message:"Cannot directly use subscribeBotAsync(). Please check canSubscribeBotAsync() before calling this API."}));q=null;p+=1;return m.getMessageSender().sendAsync(j.SUBSCRIBE_BOT_ASYNC)}e.exports={canSubscribeBotAsync:a,subscribeBotAsync:b}}),null); 151 | __d("fbinstant/releases/6.2/playerStats",["Promise","InstantGamesPassThroughRequestType","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/internalStates"],(function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";__p&&__p();function a(){this.$1=!1}a.prototype.getAsync=function(a){if(!a)return l.getMessageSender().sendPassThroughAsync(h.GET_PLAYER_STATS,{});var b=j.array().schemaType(j.string());return j.validate(a,b).then(function(){this.$2();return l.getMessageSender().sendPassThroughAsync(h.GET_PLAYER_STATS,{stat_keys:a})}.bind(this))};a.prototype.setAsync=function(a){return j.validate(a,j.object()).then(function(b){return g.all(Object.keys(a).map(function(b){return j.validate(a[b],j.integer())}))}).then(function(b){this.$3();return l.getMessageSender().sendPassThroughAsync(h.SET_PLAYER_STATS,{stats:a}).then(function(a){this.$4();return a}.bind(this))["catch"](function(a){this.$4();throw a}.bind(this))}.bind(this))};a.prototype.incrementAsync=function(a){return j.validate(a,j.object()).then(function(b){return g.all(Object.keys(a).map(function(b){return j.validate(a[b],j.integer())}))}).then(function(b){this.$3();return l.getMessageSender().sendPassThroughAsync(h.INCREMENT_PLAYER_STATS,{increments:a}).then(function(a){this.$4();return a}.bind(this))["catch"](function(a){this.$4();throw a}.bind(this))}.bind(this))};a.prototype.$2=function(){if(this.$1)throw new k({code:i.PENDING_REQUEST,message:"A set or increment stats request is pending, please wait for it to resolve or reject before making another stats request."})};a.prototype.$3=function(){this.$2(),this.$1=!0};a.prototype.$4=function(){this.$1=!1};e.exports=new a()}),null); 152 | __d("fbinstant/releases/6.2/player",["Promise","InstantGamesGameState","InstantGamesSDKMessages","fbinstant/common/errorCode","fbinstant/common/validator","fbinstant/releases/6.2/apiError","fbinstant/releases/6.2/auth","fbinstant/releases/6.2/botSubscription","fbinstant/releases/6.2/connectedPlayers","fbinstant/releases/6.2/internalStates","fbinstant/releases/6.2/logger","fbinstant/releases/6.2/playerStats"],(function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){"use strict";__p&&__p();a={getID:function(){q.logAPICall("player_getID");return p.getPlayerID()},getSignedPlayerInfoAsync:function(a){var b="player_getSignedPlayerInfoAsync";q.logBeginAsync(b);var c=k.string().optional();c=k.validate(a,c).then(function(){return m.getSignedPlayerInfoAsync(a)});return q.logAsyncResult(c,b)},canSubscribeBotAsync:function(){var a="getPlayerCanSubscribeBotAsync";q.logBeginAsync(a);var b=n.canSubscribeBotAsync();return q.logAsyncResult(b,a)},subscribeBotAsync:function(){var a="subscribeBotAsync";q.logBeginAsync(a);var b=n.subscribeBotAsync();return q.logAsyncResult(b,a)},getName:function(){q.logAPICall("player_getName");return p.getGameState()!==h.PLAYING?null:p.getPlayerName()},getPhoto:function(){q.logAPICall("player_getPhoto");return p.getGameState()!==h.PLAYING?null:p.getPlayerPhoto()},getDataAsync:function(a){var b="player_getDataAsync";q.logBeginAsync(b);var c=k.array().schemaType(k.string());c=k.validate(a,c).then(function(){return p.getMessageSender().sendAsync(i.GET_PLAYER_DATA_ASYNC,{keys:a})});return q.logAsyncResult(c,b)},setDataAsync:function(a){__p&&__p();var b="player_setDataAsync";q.logBeginAsync(b);var c=function(a){__p&&__p();for(var b=Object.keys(a),c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e=a[e];if(typeof e==="function")return!0}return!1},d=function(a){try{JSON.stringify(a);return!1}catch(a){return!0}},e=k.validate(a,k.object()).then(function(a){if(c(a)||d(a)){q.logReject(b,j.INVALID_PARAM);return g.reject(new l({code:j.INVALID_PARAM,message:"Object is not serializable"}))}return a}).then(function(b){return p.getMessageSender().sendAsync(i.SET_PLAYER_DATA_ASYNC,{data:a})});return q.logAsyncResult(e,b).then(function(){})},flushDataAsync:function(){var a="player_flushDataAsync";q.logBeginAsync(a);var b=p.getMessageSender().sendAsync(i.FLUSH_PLAYER_DATA_ASYNC,null);return q.logAsyncResult(b,a).then(function(){})},getStatsAsync:function(a){var b="player_getStatsAsync";q.logBeginAsync(b);a=r.getAsync(a);return q.logAsyncResult(a,b)},setStatsAsync:function(a){var b="player_setStatsAsync";q.logBeginAsync(b);a=r.setAsync(a);return q.logAsyncResult(a,b).then(function(){})},incrementStatsAsync:function(a){var b="player_incrementStatsAsync";q.logBeginAsync(b);a=r.incrementAsync(a);return q.logAsyncResult(a,b)},getConnectedPlayersAsync:function(){__p&&__p();var a="player_getConnectedPlayers",b=p.getConnectedPlayersPromise();if(b)return b;q.logBeginAsync(a);if(p.getGameState()!==h.PLAYING){q.logReject(a,j.INVALID_OPERATION);return g.reject(new l({code:j.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}b=q.logAsyncResult(o.fetchAsync(),a).then(function(a){return new g(function(b,c){if(p.getGameState()===h.PLAYING){b(a);return}c=function c(){p.getGameStartEvent().off(c),b(a)};p.getGameStartEvent().on(c)})})["catch"](function(a){p.setConnectedPlayersPromise(null);throw a});p.setConnectedPlayersPromise(b);return b}};e.exports=a}),null); 153 | __d("ES6Array",[],(function(a,b,c,d,e,f){"use strict";__p&&__p();a={from:function(a){__p&&__p();if(a==null)throw new TypeError("Object is null or undefined");var b=arguments[1],c=arguments[2],d=this,e=Object(a),f=typeof Symbol==="function"?typeof Symbol==="function"?Symbol.iterator:"@@iterator":"@@iterator",g=typeof b==="function",h=typeof e[f]==="function",i=0,j=void 0,k;void 0;if(h){j=typeof d==="function"?new d():[];var l=e[f](),m;void 0;while(!(m=l.next()).done)k=m.value,g&&(k=b.call(c,k,i)),j[i]=k,i+=1;j.length=i;return j}var n=e.length;(isNaN(n)||n<0)&&(n=0);j=typeof d==="function"?new d(n):new Array(n);while(i=0&&a<=100&&a>w.getLoadingProgress())w.getMessageSender().send(k.ON_PROGRESS_LOAD,a),w.setLoadingProgress(a);else{var b="FbInstant::setLoadingProgress(";b=") is invalid. The progress must be";a<0||a>100?!1:a<=w.getLoadingProgress()&&!1}},getSupportedAPIs:function(){return D.getSupported()},getEntryPointData:function(){y.logAPICall("getEntryPointData");return w.getGameState()!==h.PLAYING?null:w.getEntryPointData()},getEntryPointAsync:function(){__p&&__p();var a="getEntryPointAsync";y.logBeginAsync(a);if(w.getGameState()!==h.PLAYING){y.logReject(a,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var b=w.getEntryPoint();if(b!=null)return g.resolve(b);b=w.getMessageSender().sendPassThroughAsync(i.GET_ENTRY_POINT,{source:w.getRawSource()});return y.logAsyncResult(b,a).then(function(a){w.setEntryPoint(a.entry_point);return g.resolve(a.entry_point)})},setSessionData:function(a){y.logAPICall("setSessionData");var b=a;E(q.validate(b,q.object().maxSize(1e3)),function(){w.getMessageSender().send(k.SET_SESSION_DATA,JSON.stringify(b))})},startGameAsync:function(){__p&&__p();var a="startGameAsync";return new g(function(b,c){__p&&__p();var d=w.getAnalytics();y.logBeginAsync(a);w.getGameState()===h.PLAYING?(y.logResolve(a),b()):(function(){__p&&__p();var e=w.getMessageSender();n.init(e);e.send(k.ON_GAME_READY);w.setLoadingProgress(100);e=function e(f){__p&&__p();w.getGameStartEvent().off(e);w.setGameState(h.PLAYING);d.logActive();w.getMessageSender().sendPassThroughAsync(i.APP_CUSTOM_EVENT,{});if(f){w.updateContext(f);f.playerName&&w.setPlayerName(f.playerName);f.playerPhoto&&w.setPlayerPhoto(f.playerPhoto);f.locale&&w.setLocale(f.locale);if(f.entryPointData)try{w.setEntryPointData(JSON.parse(f.entryPointData))}catch(a){!1}f.entryPoint&&(w.setRawSource(f.entryPoint),w.setEntryPoint(null))}if(!p.isSupported(j.FLEXIBLE)){y.logReject(a,m.CLIENT_UNSUPPORTED_OPERATION);c(new s({code:m.CLIENT_UNSUPPORTED_OPERATION,message:"Client does not support the flexible platform."}));return}y.logResolve(a);b()};w.getGameStartEvent().on(e)})();v.startHeartbeat()})},player:C,context:t,payments:B,shareAsync:function(a){__p&&__p();var b="shareAsync",c=q.object().keys({intent:q.string(),image:q.string(),text:q.string(),data:q.object().optional().maxSize(1e3)});y.logBeginAsync(b);if(w.getGameState()!==h.PLAYING){y.logReject(b,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}c=q.validate(a,c).then(function(){var b=babelHelpers["extends"]({},a);a.data&&(b.data=JSON.stringify(a.data));return w.getMessageSender().sendAsync(k.SHARE_ASYNC,b)});return y.logAsyncResult(c,b).then(function(){})},sendImageAsync:function(a,b){var c="sendImageAsync",d=q.object().keys({image:q.string(),data:q.object().optional().maxSize(1e3)}),e={image:a,data:b};y.logBeginAsync(c);a=q.validate(e,d).then(function(){var a={};a.image=e.image;e.data&&(a.data=JSON.stringify(e.data));return w.getMessageSender().sendAsync(k.MEDIA_SEND_IMAGE_ASYNC,a)});return y.logAsyncResult(a,c).then(function(){})},updateAsync:function(a){__p&&__p();var b="updateAsync";if(a.action===F.LEADERBOARD){var c=a;y.logBeginAsync(b);c=x.sendUpdateAsync(c);return y.logAsyncResult(c,b)}else if(a.action===F.CUSTOM){c=function(){__p&&__p();var c=a;return{v:new g(function(a,d){__p&&__p();u.format(c).then(function(c){__p&&__p();y.logBeginAsync(b),w.getMessageSender().send(k.ON_END_GAME,c),w.getRestartEvent().on(function(c){if(c&&c.error){y.logReject(b);d(new s({code:c.error.code,message:c.error.message}));return}c&&c.contextType&&w.updateContext(c);y.logResolve(b);a();w.getRestartEvent().unbind()})})["catch"](function(a){d(a)})})}}();if(typeof c==="object")return c.v}return g.reject(new s({code:m.INVALID_PARAM,message:'Invalid update action. Must be "CUSTOM" or "LEADERBOARD".'}))},switchGameAsync:function(a,b){__p&&__p();var c="switchGameAsync";y.logBeginAsync(c);if(w.getGameState()!==h.PLAYING){y.logReject(c,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var d=q.validate(a,q.string()).then(function(){return q.validate(b,q.object().optional().maxSize(1e3))}).then(function(){return w.getMessageSender().sendPassThroughAsync(i.SWITCH_GAME,{app_id:a})}).then(function(){var c={app_id:a,payload:b!=null?JSON.stringify(b):null};return w.getMessageSender().sendAsync(k.GAME_SWITCH,c)});return y.logAsyncResult(d,c)},canCreateShortcutAsync:function(){__p&&__p();var a="canCreateShortcutAsync";y.logBeginAsync(a);if(w.getGameState()!==h.PLAYING){y.logReject(a,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var b=w.getMessageSender().sendAsync(k.CAN_CREATE_SHORTCUT_ASYNC,null);return y.logAsyncResult(b,a).then(function(a){return a.canCreateShortcut})["catch"](function(a){return!1})},createShortcutAsync:function(){var a="createShortcutAsync";y.logBeginAsync(a);if(w.getGameState()!==h.PLAYING){y.logReject(a,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var b=w.getMessageSender().sendAsync(k.CREATE_SHORTCUT_ASYNC,null);return y.logAsyncResult(b,a)},quit:function(){y.logAPICall("quit"),w.getMessageSender().send(k.QUIT,{}),v.stopHeartbeat()},logEvent:function(a,b,c){a=w.getAnalytics().logEvent(a,b,c);return!a?null:new s({code:a.code,message:a.message})},onPause:function(a){y.logAPICall("onPause"),w.getPauseEvent().on(a)},getInterstitialAdAsync:function(a){var b="getInterstitialAdAsync";y.logBeginAsync(b);var c=q.string();c=q.validate(a,c).then(function(){return r.getInterstitialAdAsync(a)});return y.logAsyncResult(c,b)},getRewardedVideoAsync:function(a){var b="getRewardedVideoAsync";y.logBeginAsync(b);var c=q.string();c=q.validate(a,c).then(function(){return r.getRewardedVideoAsync(a)});return y.logAsyncResult(c,b)},matchPlayerAsync:function(a,b){__p&&__p();var c="matchPlayerAsync",d=w.getMatchPlayerPromise();if(d)return d;y.logBeginAsync(c);if(w.getGameState()!==h.PLAYING){y.logReject(c,m.INVALID_OPERATION);return g.reject(new s({code:m.INVALID_OPERATION,message:"Can not perform this operation before game start."}))}var e={};e.matchTag=a||null;e.switchContextWhenMatched=b||!1;d=/^[a-zA-Z0-9_]+$/;if(e.matchTag&&e.matchTag.search(d)===-1){y.logReject(c);return g.reject(new s({code:m.INVALID_PARAM,message:"Match Tag must only include letters, numbers and underscores."}))}if(e.matchTag&&e.matchTag.length>100){y.logReject(c);return g.reject(new s({code:m.INVALID_PARAM,message:"Match Tag must be 100 characters or less."}))}a=q.object().keys({matchTag:q.string().optional(),switchContextWhenMatched:q["boolean"]()});b=q.validate(e,a).then(function(a){return w.getMessageSender().sendPassThroughAsync(i.CAN_PLAYER_MATCH,{contextID:w.getContext().getID()})}).then(function(a){__p&&__p();if(!a.can_match)throw new s({code:m.INVALID_OPERATION,message:"The player is not currently eligible to match."});e.dialogTitle=a.dialog_title;e.dialogTextLineOne=a.dialog_text_line_one;e.dialogTextLineTwo=a.dialog_text_line_two;e.dialogButtonText=a.dialog_button_text;e.bannerSearchText=a.banner_search_text;e.bannerRetryText=a.banner_retry_text;e.bannerMatchFoundText=a.banner_match_found_text;e.useV2=a.use_v2||!1;return w.getMessageSender().sendAsync(k.MATCH_PLAYER_ASYNC,e)}).then(function(a){w.updateContext(a);w.setMatchPlayerPromise(null);return})["catch"](function(a){w.setMatchPlayerPromise(null);throw a});b=y.logAsyncResult(b,c);w.setMatchPlayerPromise(b);return b},checkCanPlayerMatchAsync:function(){var a="checkCanPlayerMatchAsync";y.logBeginAsync(a);var b=w.getMessageSender().sendPassThroughAsync(i.CAN_PLAYER_MATCH,{contextID:w.getContext().getID()}).then(function(a){return a.can_match});return y.logAsyncResult(b,a)},getLeaderboardAsync:function(a){var b="getLeaderboardAsync";y.logBeginAsync(b);var c=q.string();c=q.validate(a,c).then(function(){return x.getLeaderboardAsync(a)});return y.logAsyncResult(c,b)}};e.exports=a}),null); 156 | __d("legacy:fbinstant.6.2.all",["fbinstant/releases/6.2"],(function(a,b,c,d,e,f){"use strict";window.FBInstant=b("fbinstant/releases/6.2")}),3); 157 | } }).call(global);})(window.inDapIF ? parent.window : window, window);} catch (e) {new Image().src="https:\/\/www.facebook.com\/" + 'common/scribe_endpoint.php?c=jssdk_error&m='+encodeURIComponent('{"error":"LOAD", "extra": {"name":"'+e.name+'","line":"'+(e.lineNumber||e.line)+'","script":"'+(e.fileName||e.sourceURL||e.script)+'","stack":"'+(e.stackTrace||e.stack)+'","revision":"3873717","namespace":"FB","message":"'+e.message+'"}}');} --------------------------------------------------------------------------------