@hiroosy/baileys-lite 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/WAProto/index.js +247 -113252
  2. package/WAProto/parts/ADVDeviceIdentity.part +201 -0
  3. package/WAProto/parts/ADVEncryptionType.part +6 -0
  4. package/WAProto/parts/ADVKeyIndexList.part +201 -0
  5. package/WAProto/parts/ADVSignedDeviceIdentity.part +150 -0
  6. package/WAProto/parts/ADVSignedDeviceIdentityHMAC.part +142 -0
  7. package/WAProto/parts/ADVSignedKeyIndexList.part +128 -0
  8. package/WAProto/parts/AIHomeState.part +405 -0
  9. package/WAProto/parts/AIMediaCollectionMessage.part +119 -0
  10. package/WAProto/parts/AIMediaCollectionMetadata.part +100 -0
  11. package/WAProto/parts/AIMetadataOperation.part +83 -0
  12. package/WAProto/parts/AIQueryFanout.part +133 -0
  13. package/WAProto/parts/AIRegenerateMetadata.part +112 -0
  14. package/WAProto/parts/AIRichResponseCodeMetadata.part +252 -0
  15. package/WAProto/parts/AIRichResponseContentItemsMetadata.part +354 -0
  16. package/WAProto/parts/AIRichResponseDynamicMetadata.part +172 -0
  17. package/WAProto/parts/AIRichResponseGridImageMetadata.part +114 -0
  18. package/WAProto/parts/AIRichResponseImageURL.part +119 -0
  19. package/WAProto/parts/AIRichResponseInlineImageMetadata.part +164 -0
  20. package/WAProto/parts/AIRichResponseLatexMetadata.part +346 -0
  21. package/WAProto/parts/AIRichResponseMapMetadata.part +346 -0
  22. package/WAProto/parts/AIRichResponseMessage.part +167 -0
  23. package/WAProto/parts/AIRichResponseMessageType.part +5 -0
  24. package/WAProto/parts/AIRichResponseSubMessage.part +313 -0
  25. package/WAProto/parts/AIRichResponseSubMessageType.part +13 -0
  26. package/WAProto/parts/AIRichResponseTableMetadata.part +223 -0
  27. package/WAProto/parts/AIRichResponseUnifiedResponse.part +84 -0
  28. package/WAProto/parts/AISubscriptionRequestType.part +7 -0
  29. package/WAProto/parts/AISubscriptionUpsellMetadata.part +102 -0
  30. package/WAProto/parts/AIThreadInfo.part +316 -0
  31. package/WAProto/parts/Account.part +138 -0
  32. package/WAProto/parts/ActionLink.part +100 -0
  33. package/WAProto/parts/AutoDownloadSettings.part +138 -0
  34. package/WAProto/parts/AvatarUserSettings.part +100 -0
  35. package/WAProto/parts/BizAccountLinkInfo.part +210 -0
  36. package/WAProto/parts/BizAccountPayload.part +105 -0
  37. package/WAProto/parts/BizIdentityInfo.part +298 -0
  38. package/WAProto/parts/BotAgeCollectionMetadata.part +138 -0
  39. package/WAProto/parts/BotAgentDeepLinkMetadata.part +81 -0
  40. package/WAProto/parts/BotAgentMetadata.part +83 -0
  41. package/WAProto/parts/BotCapabilityMetadata.part +437 -0
  42. package/WAProto/parts/BotCommandMetadata.part +119 -0
  43. package/WAProto/parts/BotDocumentMessageMetadata.part +100 -0
  44. package/WAProto/parts/BotFeedbackMessage.part +1366 -0
  45. package/WAProto/parts/BotGroupMetadata.part +92 -0
  46. package/WAProto/parts/BotGroupParticipantMetadata.part +81 -0
  47. package/WAProto/parts/BotImagineMetadata.part +134 -0
  48. package/WAProto/parts/BotInfrastructureDiagnostics.part +148 -0
  49. package/WAProto/parts/BotLinkedAccount.part +95 -0
  50. package/WAProto/parts/BotLinkedAccountsMetadata.part +134 -0
  51. package/WAProto/parts/BotMediaMetadata.part +229 -0
  52. package/WAProto/parts/BotMemoryFact.part +100 -0
  53. package/WAProto/parts/BotMemoryMetadata.part +141 -0
  54. package/WAProto/parts/BotMemuMetadata.part +92 -0
  55. package/WAProto/parts/BotMessageOrigin.part +95 -0
  56. package/WAProto/parts/BotMessageOriginMetadata.part +92 -0
  57. package/WAProto/parts/BotMessageSharingInfo.part +297 -0
  58. package/WAProto/parts/BotMetadata.part +934 -0
  59. package/WAProto/parts/BotMetricsEntryPoint.part +51 -0
  60. package/WAProto/parts/BotMetricsMetadata.part +341 -0
  61. package/WAProto/parts/BotMetricsThreadEntryPoint.part +8 -0
  62. package/WAProto/parts/BotModeSelectionMetadata.part +151 -0
  63. package/WAProto/parts/BotModelMetadata.part +167 -0
  64. package/WAProto/parts/BotPluginMetadata.part +379 -0
  65. package/WAProto/parts/BotProgressIndicatorMetadata.part +837 -0
  66. package/WAProto/parts/BotPromotionMessageMetadata.part +124 -0
  67. package/WAProto/parts/BotPromptSuggestion.part +100 -0
  68. package/WAProto/parts/BotPromptSuggestions.part +92 -0
  69. package/WAProto/parts/BotPttPromptMetadata.part +81 -0
  70. package/WAProto/parts/BotQuotaMetadata.part +241 -0
  71. package/WAProto/parts/BotReminderMetadata.part +232 -0
  72. package/WAProto/parts/BotRenderingConfigMetadata.part +100 -0
  73. package/WAProto/parts/BotRenderingMetadata.part +203 -0
  74. package/WAProto/parts/BotResolvedToolCallMetadata.part +100 -0
  75. package/WAProto/parts/BotSessionMetadata.part +137 -0
  76. package/WAProto/parts/BotSessionSource.part +11 -0
  77. package/WAProto/parts/BotSignatureVerificationMetadata.part +92 -0
  78. package/WAProto/parts/BotSignatureVerificationUseCaseProof.part +183 -0
  79. package/WAProto/parts/BotSourcesMetadata.part +322 -0
  80. package/WAProto/parts/BotSuggestedPromptMetadata.part +150 -0
  81. package/WAProto/parts/BotUnifiedResponseMutation.part +339 -0
  82. package/WAProto/parts/CallLogRecord.part +646 -0
  83. package/WAProto/parts/CertChain.part +392 -0
  84. package/WAProto/parts/ChatLockSettings.part +102 -0
  85. package/WAProto/parts/ChatRowOpaqueData.part +712 -0
  86. package/WAProto/parts/Citation.part +119 -0
  87. package/WAProto/parts/ClientPairingProps.part +160 -0
  88. package/WAProto/parts/ClientPayload.part +2892 -0
  89. package/WAProto/parts/CollectionName.part +9 -0
  90. package/WAProto/parts/CommentMetadata.part +102 -0
  91. package/WAProto/parts/CompanionCommitment.part +84 -0
  92. package/WAProto/parts/CompanionEphemeralIdentity.part +227 -0
  93. package/WAProto/parts/Config.part +136 -0
  94. package/WAProto/parts/ContextInfo.part +4137 -0
  95. package/WAProto/parts/Conversation.part +1472 -0
  96. package/WAProto/parts/DeviceCapabilities.part +670 -0
  97. package/WAProto/parts/DeviceConsistencyCodeMessage.part +103 -0
  98. package/WAProto/parts/DeviceListMetadata.part +306 -0
  99. package/WAProto/parts/DeviceProps.part +982 -0
  100. package/WAProto/parts/DisappearingMode.part +206 -0
  101. package/WAProto/parts/EmbeddedContent.part +100 -0
  102. package/WAProto/parts/EmbeddedMessage.part +102 -0
  103. package/WAProto/parts/EmbeddedMusic.part +370 -0
  104. package/WAProto/parts/EncryptedPairingRequest.part +106 -0
  105. package/WAProto/parts/EphemeralSetting.part +110 -0
  106. package/WAProto/parts/EventAdditionalMetadata.part +81 -0
  107. package/WAProto/parts/EventResponse.part +152 -0
  108. package/WAProto/parts/ExitCode.part +110 -0
  109. package/WAProto/parts/ExternalBlobReference.part +195 -0
  110. package/WAProto/parts/Field.part +193 -0
  111. package/WAProto/parts/ForwardedAIBotMessageInfo.part +119 -0
  112. package/WAProto/parts/GlobalSettings.part +497 -0
  113. package/WAProto/parts/GroupHistoryBundleInfo.part +141 -0
  114. package/WAProto/parts/GroupHistoryIndividualMessageInfo.part +102 -0
  115. package/WAProto/parts/GroupMention.part +100 -0
  116. package/WAProto/parts/GroupParticipant.part +142 -0
  117. package/WAProto/parts/GroupRootKeyShare.part +92 -0
  118. package/WAProto/parts/GroupRootKeyShareEntry.part +161 -0
  119. package/WAProto/parts/HandshakeMessage.part +815 -0
  120. package/WAProto/parts/HatchMetadataSync.part +132 -0
  121. package/WAProto/parts/HistorySync.part +605 -0
  122. package/WAProto/parts/HistorySyncMsg.part +112 -0
  123. package/WAProto/parts/HydratedTemplateButton.part +501 -0
  124. package/WAProto/parts/IdentityKeyPairStructure.part +106 -0
  125. package/WAProto/parts/InThreadSurveyMetadata.part +779 -0
  126. package/WAProto/parts/InlineContact.part +157 -0
  127. package/WAProto/parts/InteractiveAnnotation.part +246 -0
  128. package/WAProto/parts/InteractiveMessageAdditionalMetadata.part +81 -0
  129. package/WAProto/parts/KeepInChat.part +225 -0
  130. package/WAProto/parts/KeepType.part +6 -0
  131. package/WAProto/parts/KeyExchangeMessage.part +169 -0
  132. package/WAProto/parts/KeyId.part +84 -0
  133. package/WAProto/parts/LIDMigrationMapping.part +149 -0
  134. package/WAProto/parts/LIDMigrationMappingSyncMessage.part +84 -0
  135. package/WAProto/parts/LIDMigrationMappingSyncPayload.part +122 -0
  136. package/WAProto/parts/LegacyMessage.part +104 -0
  137. package/WAProto/parts/LimitSharing.part +177 -0
  138. package/WAProto/parts/LocalizedName.part +119 -0
  139. package/WAProto/parts/Location.part +119 -0
  140. package/WAProto/parts/MediaData.part +81 -0
  141. package/WAProto/parts/MediaDomainInfo.part +120 -0
  142. package/WAProto/parts/MediaKeyDomain.part +6 -0
  143. package/WAProto/parts/MediaNotifyMessage.part +132 -0
  144. package/WAProto/parts/MediaRetryNotification.part +170 -0
  145. package/WAProto/parts/MediaVisibility.part +6 -0
  146. package/WAProto/parts/MemberLabel.part +110 -0
  147. package/WAProto/parts/Message.part +32376 -0
  148. package/WAProto/parts/MessageAddOn.part +305 -0
  149. package/WAProto/parts/MessageAddOnContextInfo.part +113 -0
  150. package/WAProto/parts/MessageAssociation.part +235 -0
  151. package/WAProto/parts/MessageContextInfo.part +451 -0
  152. package/WAProto/parts/MessageKey.part +138 -0
  153. package/WAProto/parts/MessageSecretMessage.part +125 -0
  154. package/WAProto/parts/Money.part +129 -0
  155. package/WAProto/parts/MsgOpaqueData.part +1732 -0
  156. package/WAProto/parts/MsgRowOpaqueData.part +104 -0
  157. package/WAProto/parts/MutationProps.part +89 -0
  158. package/WAProto/parts/NoiseCertificate.part +277 -0
  159. package/WAProto/parts/NotificationMessageInfo.part +152 -0
  160. package/WAProto/parts/NotificationSettings.part +176 -0
  161. package/WAProto/parts/PairingRequest.part +128 -0
  162. package/WAProto/parts/PastParticipant.part +148 -0
  163. package/WAProto/parts/PastParticipants.part +112 -0
  164. package/WAProto/parts/PatchDebugData.part +358 -0
  165. package/WAProto/parts/PaymentBackground.part +460 -0
  166. package/WAProto/parts/PaymentInfo.part +602 -0
  167. package/WAProto/parts/PhoneNumberToLIDMapping.part +100 -0
  168. package/WAProto/parts/PhotoChange.part +125 -0
  169. package/WAProto/parts/PinInChat.part +205 -0
  170. package/WAProto/parts/Point.part +138 -0
  171. package/WAProto/parts/PollAdditionalMetadata.part +216 -0
  172. package/WAProto/parts/PollEncValue.part +106 -0
  173. package/WAProto/parts/PollUpdate.part +202 -0
  174. package/WAProto/parts/PreKeyRecordStructure.part +125 -0
  175. package/WAProto/parts/PreKeySignalMessage.part +185 -0
  176. package/WAProto/parts/PremiumMessageInfo.part +81 -0
  177. package/WAProto/parts/PrimaryEphemeralIdentity.part +106 -0
  178. package/WAProto/parts/PrivacySystemMessage.part +6 -0
  179. package/WAProto/parts/ProcessedVideo.part +266 -0
  180. package/WAProto/parts/ProloguePayload.part +105 -0
  181. package/WAProto/parts/Pushname.part +100 -0
  182. package/WAProto/parts/QuarantinedMessage.part +103 -0
  183. package/WAProto/parts/Reaction.part +169 -0
  184. package/WAProto/parts/RecentEmojiWeight.part +100 -0
  185. package/WAProto/parts/RecordStructure.part +114 -0
  186. package/WAProto/parts/Reportable.part +138 -0
  187. package/WAProto/parts/ReportingTokenInfo.part +84 -0
  188. package/WAProto/parts/ScheduledMessageMetadata.part +132 -0
  189. package/WAProto/parts/SenderKeyDistributionMessage.part +144 -0
  190. package/WAProto/parts/SenderKeyMessage.part +122 -0
  191. package/WAProto/parts/SenderKeyRecordStructure.part +92 -0
  192. package/WAProto/parts/SenderKeyStateStructure.part +469 -0
  193. package/WAProto/parts/ServerErrorReceipt.part +81 -0
  194. package/WAProto/parts/SessionStructure.part +1087 -0
  195. package/WAProto/parts/SessionTransparencyMetadata.part +132 -0
  196. package/WAProto/parts/SessionTransparencyType.part +5 -0
  197. package/WAProto/parts/SignalMessage.part +144 -0
  198. package/WAProto/parts/SignedPreKeyRecordStructure.part +176 -0
  199. package/WAProto/parts/StatusAttribution.part +1235 -0
  200. package/WAProto/parts/StatusMentionMessage.part +83 -0
  201. package/WAProto/parts/StatusPSA.part +121 -0
  202. package/WAProto/parts/StickerMetadata.part +357 -0
  203. package/WAProto/parts/SyncActionData.part +146 -0
  204. package/WAProto/parts/SyncActionValue.part +12959 -0
  205. package/WAProto/parts/SyncdIndex.part +84 -0
  206. package/WAProto/parts/SyncdMutation.part +121 -0
  207. package/WAProto/parts/SyncdMutations.part +92 -0
  208. package/WAProto/parts/SyncdPatch.part +262 -0
  209. package/WAProto/parts/SyncdRecord.part +125 -0
  210. package/WAProto/parts/SyncdSnapshot.part +157 -0
  211. package/WAProto/parts/SyncdValue.part +84 -0
  212. package/WAProto/parts/SyncdVersion.part +91 -0
  213. package/WAProto/parts/TapLinkAction.part +100 -0
  214. package/WAProto/parts/TemplateButton.part +449 -0
  215. package/WAProto/parts/ThreadID.part +126 -0
  216. package/WAProto/parts/UrlTrackingMap.part +231 -0
  217. package/WAProto/parts/UserPassword.part +399 -0
  218. package/WAProto/parts/UserReceipt.part +221 -0
  219. package/WAProto/parts/VerifiedNameCertificate.part +318 -0
  220. package/WAProto/parts/WallpaperSettings.part +119 -0
  221. package/WAProto/parts/WebFeatures.part +1870 -0
  222. package/WAProto/parts/WebLinkRenderConfig.part +5 -0
  223. package/WAProto/parts/WebMessageInfo.part +2851 -0
  224. package/WAProto/parts/WebNotificationsInfo.part +160 -0
  225. package/package.json +1 -1
  226. package/src/binary/wa-binary.js +4 -2
  227. package/src/defaults.js +2 -1
  228. package/src/foundation/cache.js +99 -24
  229. package/src/foundation/memory.js +103 -0
  230. package/src/signal/libsignal.js +1 -8
  231. package/src/signal/signal-repository.js +6 -4
  232. package/src/socket/chats.js +2 -0
  233. package/src/socket/messages-recv.js +5 -3
  234. package/src/socket/messages-send.js +2 -2
  235. package/src/socket/socket-core.js +3 -0
  236. package/src/utils/auth-state-core.js +2 -1
  237. package/src/utils/chat-sync.js +4 -0
  238. package/src/utils/media.js +13 -8
  239. package/src/utils/message-processing.js +22 -6
  240. package/src/utils/wa-protocol-core.js +6 -5
  241. package/src/wam/wam-constants.js +22 -22851
  242. package/src/wam/wam-data.json +1 -0
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ function HistorySyncMsg(p) {
3
+ if (p)
4
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
5
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
6
+ this[ks[i]] = p[ks[i]];
7
+ }
8
+ HistorySyncMsg.prototype.message = null;
9
+ HistorySyncMsg.prototype.msgOrderId = null;
10
+ let $oneOfFields;
11
+ Object.defineProperty(HistorySyncMsg.prototype, "_message", {
12
+ get: $util.oneOfGetter($oneOfFields = ["message"]),
13
+ set: $util.oneOfSetter($oneOfFields)
14
+ });
15
+ Object.defineProperty(HistorySyncMsg.prototype, "_msgOrderId", {
16
+ get: $util.oneOfGetter($oneOfFields = ["msgOrderId"]),
17
+ set: $util.oneOfSetter($oneOfFields)
18
+ });
19
+ HistorySyncMsg.create = function create(properties) {
20
+ return new HistorySyncMsg(properties);
21
+ };
22
+ HistorySyncMsg.encode = function encode(m, w) {
23
+ if (!w)
24
+ w = $Writer.create();
25
+ if (m.message != null && Object.hasOwnProperty.call(m, "message"))
26
+ $root.proto.WebMessageInfo.encode(m.message, w.uint32(10).fork()).ldelim();
27
+ if (m.msgOrderId != null && Object.hasOwnProperty.call(m, "msgOrderId"))
28
+ w.uint32(16).uint64(m.msgOrderId);
29
+ return w;
30
+ };
31
+ HistorySyncMsg.decode = function decode(r, l, e, n) {
32
+ if (!(r instanceof $Reader))
33
+ r = $Reader.create(r);
34
+ if (n === undefined)
35
+ n = 0;
36
+ if (n > $Reader.recursionLimit)
37
+ throw Error("maximum nesting depth exceeded");
38
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HistorySyncMsg();
39
+ while (r.pos < c) {
40
+ var t = r.uint32();
41
+ if (t === e)
42
+ break;
43
+ switch (t >>> 3) {
44
+ case 1: {
45
+ m.message = $root.proto.WebMessageInfo.decode(r, r.uint32(), undefined, n + 1);
46
+ break;
47
+ }
48
+ case 2: {
49
+ m.msgOrderId = r.uint64();
50
+ break;
51
+ }
52
+ default:
53
+ r.skipType(t & 7, n);
54
+ break;
55
+ }
56
+ }
57
+ return m;
58
+ };
59
+ HistorySyncMsg.fromObject = function fromObject(d, n) {
60
+ if (d instanceof $root.proto.HistorySyncMsg)
61
+ return d;
62
+ if (n === undefined)
63
+ n = 0;
64
+ if (n > $util.recursionLimit)
65
+ throw Error("maximum nesting depth exceeded");
66
+ var m = new $root.proto.HistorySyncMsg();
67
+ if (d.message != null) {
68
+ if (typeof d.message !== "object")
69
+ throw TypeError(".proto.HistorySyncMsg.message: object expected");
70
+ m.message = $root.proto.WebMessageInfo.fromObject(d.message, n + 1);
71
+ }
72
+ if (d.msgOrderId != null) {
73
+ if ($util.Long)
74
+ (m.msgOrderId = $util.Long.fromValue(d.msgOrderId)).unsigned = true;
75
+ else if (typeof d.msgOrderId === "string")
76
+ m.msgOrderId = parseInt(d.msgOrderId, 10);
77
+ else if (typeof d.msgOrderId === "number")
78
+ m.msgOrderId = d.msgOrderId;
79
+ else if (typeof d.msgOrderId === "object")
80
+ m.msgOrderId = new $util.LongBits(d.msgOrderId.low >>> 0, d.msgOrderId.high >>> 0).toNumber(true);
81
+ }
82
+ return m;
83
+ };
84
+ HistorySyncMsg.toObject = function toObject(m, o) {
85
+ if (!o)
86
+ o = {};
87
+ var d = {};
88
+ if (m.message != null && m.hasOwnProperty("message")) {
89
+ d.message = $root.proto.WebMessageInfo.toObject(m.message, o);
90
+ if (o.oneofs)
91
+ d._message = "message";
92
+ }
93
+ if (m.msgOrderId != null && m.hasOwnProperty("msgOrderId")) {
94
+ if (typeof m.msgOrderId === "number")
95
+ d.msgOrderId = o.longs === String ? String(m.msgOrderId) : m.msgOrderId;
96
+ else
97
+ d.msgOrderId = o.longs === String ? longToString(m.msgOrderId, true) : o.longs === Number ? longToNumber(m.msgOrderId, true) : m.msgOrderId;
98
+ if (o.oneofs)
99
+ d._msgOrderId = "msgOrderId";
100
+ }
101
+ return d;
102
+ };
103
+ HistorySyncMsg.prototype.toJSON = function toJSON() {
104
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
105
+ };
106
+ HistorySyncMsg.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
107
+ if (typeUrlPrefix === undefined) {
108
+ typeUrlPrefix = "type.googleapis.com";
109
+ }
110
+ return typeUrlPrefix + "/proto.HistorySyncMsg";
111
+ };
112
+ return HistorySyncMsg;
@@ -0,0 +1,501 @@
1
+ "use strict";
2
+ function HydratedTemplateButton(p) {
3
+ if (p)
4
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
5
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
6
+ this[ks[i]] = p[ks[i]];
7
+ }
8
+ HydratedTemplateButton.prototype.index = null;
9
+ HydratedTemplateButton.prototype.quickReplyButton = null;
10
+ HydratedTemplateButton.prototype.urlButton = null;
11
+ HydratedTemplateButton.prototype.callButton = null;
12
+ let $oneOfFields;
13
+ Object.defineProperty(HydratedTemplateButton.prototype, "_index", {
14
+ get: $util.oneOfGetter($oneOfFields = ["index"]),
15
+ set: $util.oneOfSetter($oneOfFields)
16
+ });
17
+ Object.defineProperty(HydratedTemplateButton.prototype, "hydratedButton", {
18
+ get: $util.oneOfGetter($oneOfFields = ["quickReplyButton", "urlButton", "callButton"]),
19
+ set: $util.oneOfSetter($oneOfFields)
20
+ });
21
+ HydratedTemplateButton.create = function create(properties) {
22
+ return new HydratedTemplateButton(properties);
23
+ };
24
+ HydratedTemplateButton.encode = function encode(m, w) {
25
+ if (!w)
26
+ w = $Writer.create();
27
+ if (m.quickReplyButton != null && Object.hasOwnProperty.call(m, "quickReplyButton"))
28
+ $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.encode(m.quickReplyButton, w.uint32(10).fork()).ldelim();
29
+ if (m.urlButton != null && Object.hasOwnProperty.call(m, "urlButton"))
30
+ $root.proto.HydratedTemplateButton.HydratedURLButton.encode(m.urlButton, w.uint32(18).fork()).ldelim();
31
+ if (m.callButton != null && Object.hasOwnProperty.call(m, "callButton"))
32
+ $root.proto.HydratedTemplateButton.HydratedCallButton.encode(m.callButton, w.uint32(26).fork()).ldelim();
33
+ if (m.index != null && Object.hasOwnProperty.call(m, "index"))
34
+ w.uint32(32).uint32(m.index);
35
+ return w;
36
+ };
37
+ HydratedTemplateButton.decode = function decode(r, l, e, n) {
38
+ if (!(r instanceof $Reader))
39
+ r = $Reader.create(r);
40
+ if (n === undefined)
41
+ n = 0;
42
+ if (n > $Reader.recursionLimit)
43
+ throw Error("maximum nesting depth exceeded");
44
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HydratedTemplateButton();
45
+ while (r.pos < c) {
46
+ var t = r.uint32();
47
+ if (t === e)
48
+ break;
49
+ switch (t >>> 3) {
50
+ case 4: {
51
+ m.index = r.uint32();
52
+ break;
53
+ }
54
+ case 1: {
55
+ m.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.decode(r, r.uint32(), undefined, n + 1);
56
+ break;
57
+ }
58
+ case 2: {
59
+ m.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.decode(r, r.uint32(), undefined, n + 1);
60
+ break;
61
+ }
62
+ case 3: {
63
+ m.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.decode(r, r.uint32(), undefined, n + 1);
64
+ break;
65
+ }
66
+ default:
67
+ r.skipType(t & 7, n);
68
+ break;
69
+ }
70
+ }
71
+ return m;
72
+ };
73
+ HydratedTemplateButton.fromObject = function fromObject(d, n) {
74
+ if (d instanceof $root.proto.HydratedTemplateButton)
75
+ return d;
76
+ if (n === undefined)
77
+ n = 0;
78
+ if (n > $util.recursionLimit)
79
+ throw Error("maximum nesting depth exceeded");
80
+ var m = new $root.proto.HydratedTemplateButton();
81
+ if (d.index != null) {
82
+ m.index = d.index >>> 0;
83
+ }
84
+ if (d.quickReplyButton != null) {
85
+ if (typeof d.quickReplyButton !== "object")
86
+ throw TypeError(".proto.HydratedTemplateButton.quickReplyButton: object expected");
87
+ m.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.fromObject(d.quickReplyButton, n + 1);
88
+ }
89
+ if (d.urlButton != null) {
90
+ if (typeof d.urlButton !== "object")
91
+ throw TypeError(".proto.HydratedTemplateButton.urlButton: object expected");
92
+ m.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.fromObject(d.urlButton, n + 1);
93
+ }
94
+ if (d.callButton != null) {
95
+ if (typeof d.callButton !== "object")
96
+ throw TypeError(".proto.HydratedTemplateButton.callButton: object expected");
97
+ m.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.fromObject(d.callButton, n + 1);
98
+ }
99
+ return m;
100
+ };
101
+ HydratedTemplateButton.toObject = function toObject(m, o) {
102
+ if (!o)
103
+ o = {};
104
+ var d = {};
105
+ if (m.quickReplyButton != null && m.hasOwnProperty("quickReplyButton")) {
106
+ d.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.toObject(m.quickReplyButton, o);
107
+ if (o.oneofs)
108
+ d.hydratedButton = "quickReplyButton";
109
+ }
110
+ if (m.urlButton != null && m.hasOwnProperty("urlButton")) {
111
+ d.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.toObject(m.urlButton, o);
112
+ if (o.oneofs)
113
+ d.hydratedButton = "urlButton";
114
+ }
115
+ if (m.callButton != null && m.hasOwnProperty("callButton")) {
116
+ d.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.toObject(m.callButton, o);
117
+ if (o.oneofs)
118
+ d.hydratedButton = "callButton";
119
+ }
120
+ if (m.index != null && m.hasOwnProperty("index")) {
121
+ d.index = m.index;
122
+ if (o.oneofs)
123
+ d._index = "index";
124
+ }
125
+ return d;
126
+ };
127
+ HydratedTemplateButton.prototype.toJSON = function toJSON() {
128
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
129
+ };
130
+ HydratedTemplateButton.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
131
+ if (typeUrlPrefix === undefined) {
132
+ typeUrlPrefix = "type.googleapis.com";
133
+ }
134
+ return typeUrlPrefix + "/proto.HydratedTemplateButton";
135
+ };
136
+ $lazy(HydratedTemplateButton, "HydratedCallButton", function() {
137
+ function HydratedCallButton(p) {
138
+ if (p)
139
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
140
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
141
+ this[ks[i]] = p[ks[i]];
142
+ }
143
+ HydratedCallButton.prototype.displayText = null;
144
+ HydratedCallButton.prototype.phoneNumber = null;
145
+ let $oneOfFields;
146
+ Object.defineProperty(HydratedCallButton.prototype, "_displayText", {
147
+ get: $util.oneOfGetter($oneOfFields = ["displayText"]),
148
+ set: $util.oneOfSetter($oneOfFields)
149
+ });
150
+ Object.defineProperty(HydratedCallButton.prototype, "_phoneNumber", {
151
+ get: $util.oneOfGetter($oneOfFields = ["phoneNumber"]),
152
+ set: $util.oneOfSetter($oneOfFields)
153
+ });
154
+ HydratedCallButton.create = function create(properties) {
155
+ return new HydratedCallButton(properties);
156
+ };
157
+ HydratedCallButton.encode = function encode(m, w) {
158
+ if (!w)
159
+ w = $Writer.create();
160
+ if (m.displayText != null && Object.hasOwnProperty.call(m, "displayText"))
161
+ w.uint32(10).string(m.displayText);
162
+ if (m.phoneNumber != null && Object.hasOwnProperty.call(m, "phoneNumber"))
163
+ w.uint32(18).string(m.phoneNumber);
164
+ return w;
165
+ };
166
+ HydratedCallButton.decode = function decode(r, l, e, n) {
167
+ if (!(r instanceof $Reader))
168
+ r = $Reader.create(r);
169
+ if (n === undefined)
170
+ n = 0;
171
+ if (n > $Reader.recursionLimit)
172
+ throw Error("maximum nesting depth exceeded");
173
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HydratedTemplateButton.HydratedCallButton();
174
+ while (r.pos < c) {
175
+ var t = r.uint32();
176
+ if (t === e)
177
+ break;
178
+ switch (t >>> 3) {
179
+ case 1: {
180
+ m.displayText = r.string();
181
+ break;
182
+ }
183
+ case 2: {
184
+ m.phoneNumber = r.string();
185
+ break;
186
+ }
187
+ default:
188
+ r.skipType(t & 7, n);
189
+ break;
190
+ }
191
+ }
192
+ return m;
193
+ };
194
+ HydratedCallButton.fromObject = function fromObject(d, n) {
195
+ if (d instanceof $root.proto.HydratedTemplateButton.HydratedCallButton)
196
+ return d;
197
+ if (n === undefined)
198
+ n = 0;
199
+ if (n > $util.recursionLimit)
200
+ throw Error("maximum nesting depth exceeded");
201
+ var m = new $root.proto.HydratedTemplateButton.HydratedCallButton();
202
+ if (d.displayText != null) {
203
+ m.displayText = String(d.displayText);
204
+ }
205
+ if (d.phoneNumber != null) {
206
+ m.phoneNumber = String(d.phoneNumber);
207
+ }
208
+ return m;
209
+ };
210
+ HydratedCallButton.toObject = function toObject(m, o) {
211
+ if (!o)
212
+ o = {};
213
+ var d = {};
214
+ if (m.displayText != null && m.hasOwnProperty("displayText")) {
215
+ d.displayText = m.displayText;
216
+ if (o.oneofs)
217
+ d._displayText = "displayText";
218
+ }
219
+ if (m.phoneNumber != null && m.hasOwnProperty("phoneNumber")) {
220
+ d.phoneNumber = m.phoneNumber;
221
+ if (o.oneofs)
222
+ d._phoneNumber = "phoneNumber";
223
+ }
224
+ return d;
225
+ };
226
+ HydratedCallButton.prototype.toJSON = function toJSON() {
227
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
228
+ };
229
+ HydratedCallButton.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
230
+ if (typeUrlPrefix === undefined) {
231
+ typeUrlPrefix = "type.googleapis.com";
232
+ }
233
+ return typeUrlPrefix + "/proto.HydratedTemplateButton.HydratedCallButton";
234
+ };
235
+ return HydratedCallButton;
236
+ });
237
+ $lazy(HydratedTemplateButton, "HydratedQuickReplyButton", function() {
238
+ function HydratedQuickReplyButton(p) {
239
+ if (p)
240
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
241
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
242
+ this[ks[i]] = p[ks[i]];
243
+ }
244
+ HydratedQuickReplyButton.prototype.displayText = null;
245
+ HydratedQuickReplyButton.prototype.id = null;
246
+ let $oneOfFields;
247
+ Object.defineProperty(HydratedQuickReplyButton.prototype, "_displayText", {
248
+ get: $util.oneOfGetter($oneOfFields = ["displayText"]),
249
+ set: $util.oneOfSetter($oneOfFields)
250
+ });
251
+ Object.defineProperty(HydratedQuickReplyButton.prototype, "_id", {
252
+ get: $util.oneOfGetter($oneOfFields = ["id"]),
253
+ set: $util.oneOfSetter($oneOfFields)
254
+ });
255
+ HydratedQuickReplyButton.create = function create(properties) {
256
+ return new HydratedQuickReplyButton(properties);
257
+ };
258
+ HydratedQuickReplyButton.encode = function encode(m, w) {
259
+ if (!w)
260
+ w = $Writer.create();
261
+ if (m.displayText != null && Object.hasOwnProperty.call(m, "displayText"))
262
+ w.uint32(10).string(m.displayText);
263
+ if (m.id != null && Object.hasOwnProperty.call(m, "id"))
264
+ w.uint32(18).string(m.id);
265
+ return w;
266
+ };
267
+ HydratedQuickReplyButton.decode = function decode(r, l, e, n) {
268
+ if (!(r instanceof $Reader))
269
+ r = $Reader.create(r);
270
+ if (n === undefined)
271
+ n = 0;
272
+ if (n > $Reader.recursionLimit)
273
+ throw Error("maximum nesting depth exceeded");
274
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HydratedTemplateButton.HydratedQuickReplyButton();
275
+ while (r.pos < c) {
276
+ var t = r.uint32();
277
+ if (t === e)
278
+ break;
279
+ switch (t >>> 3) {
280
+ case 1: {
281
+ m.displayText = r.string();
282
+ break;
283
+ }
284
+ case 2: {
285
+ m.id = r.string();
286
+ break;
287
+ }
288
+ default:
289
+ r.skipType(t & 7, n);
290
+ break;
291
+ }
292
+ }
293
+ return m;
294
+ };
295
+ HydratedQuickReplyButton.fromObject = function fromObject(d, n) {
296
+ if (d instanceof $root.proto.HydratedTemplateButton.HydratedQuickReplyButton)
297
+ return d;
298
+ if (n === undefined)
299
+ n = 0;
300
+ if (n > $util.recursionLimit)
301
+ throw Error("maximum nesting depth exceeded");
302
+ var m = new $root.proto.HydratedTemplateButton.HydratedQuickReplyButton();
303
+ if (d.displayText != null) {
304
+ m.displayText = String(d.displayText);
305
+ }
306
+ if (d.id != null) {
307
+ m.id = String(d.id);
308
+ }
309
+ return m;
310
+ };
311
+ HydratedQuickReplyButton.toObject = function toObject(m, o) {
312
+ if (!o)
313
+ o = {};
314
+ var d = {};
315
+ if (m.displayText != null && m.hasOwnProperty("displayText")) {
316
+ d.displayText = m.displayText;
317
+ if (o.oneofs)
318
+ d._displayText = "displayText";
319
+ }
320
+ if (m.id != null && m.hasOwnProperty("id")) {
321
+ d.id = m.id;
322
+ if (o.oneofs)
323
+ d._id = "id";
324
+ }
325
+ return d;
326
+ };
327
+ HydratedQuickReplyButton.prototype.toJSON = function toJSON() {
328
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
329
+ };
330
+ HydratedQuickReplyButton.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
331
+ if (typeUrlPrefix === undefined) {
332
+ typeUrlPrefix = "type.googleapis.com";
333
+ }
334
+ return typeUrlPrefix + "/proto.HydratedTemplateButton.HydratedQuickReplyButton";
335
+ };
336
+ return HydratedQuickReplyButton;
337
+ });
338
+ $lazy(HydratedTemplateButton, "HydratedURLButton", function() {
339
+ function HydratedURLButton(p) {
340
+ if (p)
341
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
342
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
343
+ this[ks[i]] = p[ks[i]];
344
+ }
345
+ HydratedURLButton.prototype.displayText = null;
346
+ HydratedURLButton.prototype.url = null;
347
+ HydratedURLButton.prototype.consentedUsersUrl = null;
348
+ HydratedURLButton.prototype.webviewPresentation = null;
349
+ let $oneOfFields;
350
+ Object.defineProperty(HydratedURLButton.prototype, "_displayText", {
351
+ get: $util.oneOfGetter($oneOfFields = ["displayText"]),
352
+ set: $util.oneOfSetter($oneOfFields)
353
+ });
354
+ Object.defineProperty(HydratedURLButton.prototype, "_url", {
355
+ get: $util.oneOfGetter($oneOfFields = ["url"]),
356
+ set: $util.oneOfSetter($oneOfFields)
357
+ });
358
+ Object.defineProperty(HydratedURLButton.prototype, "_consentedUsersUrl", {
359
+ get: $util.oneOfGetter($oneOfFields = ["consentedUsersUrl"]),
360
+ set: $util.oneOfSetter($oneOfFields)
361
+ });
362
+ Object.defineProperty(HydratedURLButton.prototype, "_webviewPresentation", {
363
+ get: $util.oneOfGetter($oneOfFields = ["webviewPresentation"]),
364
+ set: $util.oneOfSetter($oneOfFields)
365
+ });
366
+ HydratedURLButton.create = function create(properties) {
367
+ return new HydratedURLButton(properties);
368
+ };
369
+ HydratedURLButton.encode = function encode(m, w) {
370
+ if (!w)
371
+ w = $Writer.create();
372
+ if (m.displayText != null && Object.hasOwnProperty.call(m, "displayText"))
373
+ w.uint32(10).string(m.displayText);
374
+ if (m.url != null && Object.hasOwnProperty.call(m, "url"))
375
+ w.uint32(18).string(m.url);
376
+ if (m.consentedUsersUrl != null && Object.hasOwnProperty.call(m, "consentedUsersUrl"))
377
+ w.uint32(26).string(m.consentedUsersUrl);
378
+ if (m.webviewPresentation != null && Object.hasOwnProperty.call(m, "webviewPresentation"))
379
+ w.uint32(32).int32(m.webviewPresentation);
380
+ return w;
381
+ };
382
+ HydratedURLButton.decode = function decode(r, l, e, n) {
383
+ if (!(r instanceof $Reader))
384
+ r = $Reader.create(r);
385
+ if (n === undefined)
386
+ n = 0;
387
+ if (n > $Reader.recursionLimit)
388
+ throw Error("maximum nesting depth exceeded");
389
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HydratedTemplateButton.HydratedURLButton();
390
+ while (r.pos < c) {
391
+ var t = r.uint32();
392
+ if (t === e)
393
+ break;
394
+ switch (t >>> 3) {
395
+ case 1: {
396
+ m.displayText = r.string();
397
+ break;
398
+ }
399
+ case 2: {
400
+ m.url = r.string();
401
+ break;
402
+ }
403
+ case 3: {
404
+ m.consentedUsersUrl = r.string();
405
+ break;
406
+ }
407
+ case 4: {
408
+ m.webviewPresentation = r.int32();
409
+ break;
410
+ }
411
+ default:
412
+ r.skipType(t & 7, n);
413
+ break;
414
+ }
415
+ }
416
+ return m;
417
+ };
418
+ HydratedURLButton.fromObject = function fromObject(d, n) {
419
+ if (d instanceof $root.proto.HydratedTemplateButton.HydratedURLButton)
420
+ return d;
421
+ if (n === undefined)
422
+ n = 0;
423
+ if (n > $util.recursionLimit)
424
+ throw Error("maximum nesting depth exceeded");
425
+ var m = new $root.proto.HydratedTemplateButton.HydratedURLButton();
426
+ if (d.displayText != null) {
427
+ m.displayText = String(d.displayText);
428
+ }
429
+ if (d.url != null) {
430
+ m.url = String(d.url);
431
+ }
432
+ if (d.consentedUsersUrl != null) {
433
+ m.consentedUsersUrl = String(d.consentedUsersUrl);
434
+ }
435
+ switch (d.webviewPresentation) {
436
+ default:
437
+ if (typeof d.webviewPresentation === "number") {
438
+ m.webviewPresentation = d.webviewPresentation;
439
+ break;
440
+ }
441
+ break;
442
+ case "FULL":
443
+ case 1:
444
+ m.webviewPresentation = 1;
445
+ break;
446
+ case "TALL":
447
+ case 2:
448
+ m.webviewPresentation = 2;
449
+ break;
450
+ case "COMPACT":
451
+ case 3:
452
+ m.webviewPresentation = 3;
453
+ break;
454
+ }
455
+ return m;
456
+ };
457
+ HydratedURLButton.toObject = function toObject(m, o) {
458
+ if (!o)
459
+ o = {};
460
+ var d = {};
461
+ if (m.displayText != null && m.hasOwnProperty("displayText")) {
462
+ d.displayText = m.displayText;
463
+ if (o.oneofs)
464
+ d._displayText = "displayText";
465
+ }
466
+ if (m.url != null && m.hasOwnProperty("url")) {
467
+ d.url = m.url;
468
+ if (o.oneofs)
469
+ d._url = "url";
470
+ }
471
+ if (m.consentedUsersUrl != null && m.hasOwnProperty("consentedUsersUrl")) {
472
+ d.consentedUsersUrl = m.consentedUsersUrl;
473
+ if (o.oneofs)
474
+ d._consentedUsersUrl = "consentedUsersUrl";
475
+ }
476
+ if (m.webviewPresentation != null && m.hasOwnProperty("webviewPresentation")) {
477
+ d.webviewPresentation = o.enums === String ? $root.proto.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType[m.webviewPresentation] === undefined ? m.webviewPresentation : $root.proto.HydratedTemplateButton.HydratedURLButton.WebviewPresentationType[m.webviewPresentation] : m.webviewPresentation;
478
+ if (o.oneofs)
479
+ d._webviewPresentation = "webviewPresentation";
480
+ }
481
+ return d;
482
+ };
483
+ HydratedURLButton.prototype.toJSON = function toJSON() {
484
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
485
+ };
486
+ HydratedURLButton.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
487
+ if (typeUrlPrefix === undefined) {
488
+ typeUrlPrefix = "type.googleapis.com";
489
+ }
490
+ return typeUrlPrefix + "/proto.HydratedTemplateButton.HydratedURLButton";
491
+ };
492
+ $lazy(HydratedURLButton, "WebviewPresentationType", function() {
493
+ const valuesById = {}, values = Object.create(valuesById);
494
+ values[valuesById[1] = "FULL"] = 1;
495
+ values[valuesById[2] = "TALL"] = 2;
496
+ values[valuesById[3] = "COMPACT"] = 3;
497
+ return values;
498
+ });
499
+ return HydratedURLButton;
500
+ });
501
+ return HydratedTemplateButton;