@badzz88/baileys 8.4.7 → 8.5.0

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1055 -337
  3. package/WAProto/index.js +5 -5
  4. package/lib/Defaults/index.js +187 -127
  5. package/lib/Defaults/phonenumber-mcc.json +223 -0
  6. package/lib/Signal/Group/ciphertext-message.js +14 -11
  7. package/lib/Signal/Group/group-session-builder.js +91 -29
  8. package/lib/Signal/Group/group_cipher.js +88 -81
  9. package/lib/Signal/Group/index.js +136 -12
  10. package/lib/Signal/Group/keyhelper.js +70 -15
  11. package/lib/Signal/Group/sender-chain-key.js +31 -25
  12. package/lib/Signal/Group/sender-key-distribution-message.js +65 -62
  13. package/lib/Signal/Group/sender-key-message.js +68 -65
  14. package/lib/Signal/Group/sender-key-name.js +43 -41
  15. package/lib/Signal/Group/sender-key-record.js +43 -40
  16. package/lib/Signal/Group/sender-key-state.js +96 -83
  17. package/lib/Signal/Group/sender-message-key.js +29 -25
  18. package/lib/Signal/libsignal.js +483 -424
  19. package/lib/Signal/lid-mapping.js +261 -276
  20. package/lib/Socket/Client/index.js +30 -3
  21. package/lib/Socket/Client/types.js +12 -10
  22. package/lib/Socket/Client/websocket.js +61 -53
  23. package/lib/Socket/aigroups.js +240 -0
  24. package/lib/Socket/business.js +422 -379
  25. package/lib/Socket/chats.js +1816 -1193
  26. package/lib/Socket/communities.js +549 -431
  27. package/lib/Socket/graphql.js +656 -0
  28. package/lib/Socket/groups.js +764 -374
  29. package/lib/Socket/index.js +38 -11
  30. package/lib/Socket/interactive-handler.js +522 -0
  31. package/lib/Socket/interop.js +549 -0
  32. package/lib/Socket/luxu.js +6 -5
  33. package/lib/Socket/managed-account.js +183 -0
  34. package/lib/Socket/messages-recv.js +2439 -1915
  35. package/lib/Socket/messages-send.js +1642 -1242
  36. package/lib/Socket/mex.js +59 -40
  37. package/lib/Socket/newsletter.js +812 -249
  38. package/lib/Socket/privacy.js +449 -0
  39. package/lib/Socket/registration.js +427 -0
  40. package/lib/Socket/socket.js +1077 -965
  41. package/lib/Socket/text-router.js +83 -0
  42. package/lib/Socket/username.js +237 -140
  43. package/lib/Store/index.js +36 -10
  44. package/lib/Store/make-cache-manager-store.js +85 -80
  45. package/lib/Store/make-in-memory-store.js +591 -185
  46. package/lib/Store/make-ordered-dictionary.js +78 -72
  47. package/lib/Store/object-repository.js +25 -28
  48. package/lib/Types/Auth.js +38 -2
  49. package/lib/Types/Bussines.js +2 -2
  50. package/lib/Types/Call.js +2 -2
  51. package/lib/Types/Chat.js +4 -8
  52. package/lib/Types/Contact.js +2 -2
  53. package/lib/Types/Events.js +2 -2
  54. package/lib/Types/GroupMetadata.js +2 -2
  55. package/lib/Types/Label.js +26 -24
  56. package/lib/Types/LabelAssociation.js +8 -6
  57. package/lib/Types/Message.js +95 -11
  58. package/lib/Types/Mex.js +112 -37
  59. package/lib/Types/Newsletter.js +121 -0
  60. package/lib/Types/Product.js +2 -2
  61. package/lib/Types/Signal.js +2 -2
  62. package/lib/Types/Socket.js +2 -3
  63. package/lib/Types/State.js +70 -56
  64. package/lib/Types/USync.js +2 -2
  65. package/lib/Types/index.js +55 -26
  66. package/lib/Utils/auth-utils.js +292 -288
  67. package/lib/Utils/browser-utils.js +113 -48
  68. package/lib/Utils/business.js +240 -224
  69. package/lib/Utils/chat-utils.js +1205 -869
  70. package/lib/Utils/command-loader.d.ts +31 -0
  71. package/lib/Utils/command-loader.js +100 -0
  72. package/lib/Utils/companion-reg-client-utils.js +41 -34
  73. package/lib/Utils/consumer-application.js +107 -0
  74. package/lib/Utils/crypto.js +144 -107
  75. package/lib/Utils/curve25519-js.js +275 -0
  76. package/lib/Utils/decode-wa-message.js +518 -308
  77. package/lib/Utils/event-buffer.js +596 -611
  78. package/lib/Utils/generics.js +514 -354
  79. package/lib/Utils/group-history.js +60 -0
  80. package/lib/Utils/history.js +244 -134
  81. package/lib/Utils/identity-change-handler.js +51 -49
  82. package/lib/Utils/index.js +57 -23
  83. package/lib/Utils/jid-display-normalization.js +218 -0
  84. package/lib/Utils/link-preview.js +135 -77
  85. package/lib/Utils/logger.js +9 -3
  86. package/lib/Utils/lt-hash.js +37 -6
  87. package/lib/Utils/make-mutex.js +36 -33
  88. package/lib/Utils/message-composer.js +439 -233
  89. package/lib/Utils/message-retry-manager.js +265 -260
  90. package/lib/Utils/messages-media.js +855 -747
  91. package/lib/Utils/messages.js +2528 -884
  92. package/lib/Utils/meta-ai-msmsg.js +262 -0
  93. package/lib/Utils/native-bridge.js +82 -0
  94. package/lib/Utils/noise-handler.js +195 -200
  95. package/lib/Utils/offline-node-processor.js +35 -33
  96. package/lib/Utils/pre-key-manager.js +103 -102
  97. package/lib/Utils/process-message.js +978 -560
  98. package/lib/Utils/reporting-utils.js +257 -253
  99. package/lib/Utils/session-pool.d.ts +16 -0
  100. package/lib/Utils/session-pool.js +94 -0
  101. package/lib/Utils/signal.js +218 -195
  102. package/lib/Utils/stanza-ack.js +31 -29
  103. package/lib/Utils/sticker.d.ts +17 -0
  104. package/lib/Utils/sticker.js +145 -0
  105. package/lib/Utils/sync-action-utils.js +50 -45
  106. package/lib/Utils/tc-token-utils.js +137 -139
  107. package/lib/Utils/use-multi-file-auth-state.js +109 -109
  108. package/lib/Utils/validate-connection.js +218 -202
  109. package/lib/Utils/view-once-cache.d.ts +9 -0
  110. package/lib/Utils/view-once-cache.js +79 -0
  111. package/lib/Utils/voip-rekey.js +22 -0
  112. package/lib/WABinary/constants.js +1302 -1299
  113. package/lib/WABinary/decode.js +343 -262
  114. package/lib/WABinary/encode.js +12 -4
  115. package/lib/WABinary/generic-utils.js +223 -187
  116. package/lib/WABinary/index.js +33 -6
  117. package/lib/WABinary/jid-utils.js +351 -88
  118. package/lib/WABinary/types.js +2 -2
  119. package/lib/WAM/BinaryInfo.js +12 -9
  120. package/lib/WAM/constants.js +39486 -22853
  121. package/lib/WAM/encode.js +132 -140
  122. package/lib/WAM/index.js +31 -4
  123. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +55 -0
  124. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
  125. package/lib/WAUSync/Protocols/USyncContactProtocol.js +53 -51
  126. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +56 -53
  127. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +29 -26
  128. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +59 -0
  129. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +31 -0
  130. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
  131. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +29 -0
  132. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -37
  133. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
  134. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +26 -24
  135. package/lib/WAUSync/Protocols/index.js +39 -6
  136. package/lib/WAUSync/USyncQuery.js +132 -97
  137. package/lib/WAUSync/USyncUser.js +49 -30
  138. package/lib/WAUSync/index.js +31 -4
  139. package/lib/antiban.js +4637 -0
  140. package/lib/index.js +48 -15
  141. package/package.json +55 -92
  142. package/lib/WAUSync/Protocols/USyncNewsletterProtocol.js +0 -263
  143. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -51
  144. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -29
@@ -1,204 +1,240 @@
1
- import { Boom } from '@hapi/boom'
2
- import { proto } from '../../WAProto/index.js'
3
- import { unixTimestampSeconds } from '../Utils/generics.js'
4
-
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
3
+ exports.getBinaryNodeMessages =
4
+ exports.reduceBinaryNodeToDictionary =
5
+ exports.assertNodeErrorFree =
6
+ exports.getBinaryNodeChildUInt =
7
+ exports.getBinaryNodeChildString =
8
+ exports.getBinaryNodeChildBuffer =
9
+ exports.getAllBinaryNodeChildren =
10
+ exports.getBinaryNodeChild =
11
+ exports.getBinaryNodeChildren =
12
+ void 0
13
+ exports.binaryNodeToString = binaryNodeToString
14
+ const boom_1 = require('@hapi/boom')
15
+ const index_js_1 = require('../../WAProto/index.js')
5
16
  // some extra useful utilities
6
- export const getBinaryNodeChildren = (node, childTag) => {
7
- if (Array.isArray(node?.content)) {
8
- return node.content.filter(item => item.tag === childTag)
9
- }
10
- return []
11
- }
12
-
13
- export const getAllBinaryNodeChildren = ({ content }) => {
14
- if (Array.isArray(content)) {
15
- return content
16
- }
17
- return []
17
+ const indexCache = new WeakMap()
18
+ const getBinaryNodeChildren = (node, childTag) => {
19
+ if (!node || !Array.isArray(node.content)) return []
20
+ let index = indexCache.get(node)
21
+ // Build the index once per node
22
+ if (!index) {
23
+ index = new Map()
24
+ for (const child of node.content) {
25
+ let arr = index.get(child.tag)
26
+ if (!arr) index.set(child.tag, (arr = []))
27
+ arr.push(child)
28
+ }
29
+ indexCache.set(node, index)
30
+ }
31
+ // Return first matching child
32
+ return index.get(childTag) || []
18
33
  }
19
-
20
- export const getBinaryNodeChild = (node, childTag) => {
21
- if (Array.isArray(node?.content)) {
22
- return node?.content.find(item => item.tag === childTag)
23
- }
34
+ exports.getBinaryNodeChildren = getBinaryNodeChildren
35
+ const getBinaryNodeChild = (node, childTag) => {
36
+ return (0, exports.getBinaryNodeChildren)(node, childTag)[0]
24
37
  }
25
-
26
- export const getBinaryNodeChildBuffer = (node, childTag) => {
27
- const child = getBinaryNodeChild(node, childTag)?.content
28
- if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
29
- return child
30
- }
38
+ exports.getBinaryNodeChild = getBinaryNodeChild
39
+ const getAllBinaryNodeChildren = ({ content }) => {
40
+ if (Array.isArray(content)) {
41
+ return content
42
+ }
43
+ return []
31
44
  }
32
-
33
- export const getBinaryNodeChildString = (node, childTag) => {
34
- const child = getBinaryNodeChild(node, childTag)?.content
35
- if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
36
- return Buffer.from(child).toString('utf-8')
37
- }
38
- else if (typeof child === 'string') {
39
- return child
40
- }
45
+ exports.getAllBinaryNodeChildren = getAllBinaryNodeChildren
46
+ const getBinaryNodeChildBuffer = (node, childTag) => {
47
+ const child = (0, exports.getBinaryNodeChild)(node, childTag)?.content
48
+ if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
49
+ return child
50
+ }
41
51
  }
42
-
43
- export const getBinaryNodeChildUInt = (node, childTag, length) => {
44
- const buff = getBinaryNodeChildBuffer(node, childTag)
45
- if (buff) {
46
- return bufferToUInt(buff, length)
47
- }
52
+ exports.getBinaryNodeChildBuffer = getBinaryNodeChildBuffer
53
+ const getBinaryNodeChildString = (node, childTag) => {
54
+ const child = (0, exports.getBinaryNodeChild)(node, childTag)?.content
55
+ if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
56
+ return Buffer.from(child).toString('utf-8')
57
+ } else if (typeof child === 'string') {
58
+ return child
59
+ }
48
60
  }
49
-
50
- export const assertNodeErrorFree = (node) => {
51
- const errNode = getBinaryNodeChild(node, 'error')
52
- if (errNode) {
53
- throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code })
54
- }
61
+ exports.getBinaryNodeChildString = getBinaryNodeChildString
62
+ const getBinaryNodeChildUInt = (node, childTag, length) => {
63
+ const buff = (0, exports.getBinaryNodeChildBuffer)(node, childTag)
64
+ if (buff) {
65
+ return bufferToUInt(buff, length)
66
+ }
55
67
  }
56
-
57
- export const reduceBinaryNodeToDictionary = (node, tag) => {
58
- const nodes = getBinaryNodeChildren(node, tag)
59
- const dict = nodes.reduce((dict, { attrs }) => {
60
- dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value
61
- return dict
62
- }, {})
63
- return dict
68
+ exports.getBinaryNodeChildUInt = getBinaryNodeChildUInt
69
+ const assertNodeErrorFree = node => {
70
+ const errNode = (0, exports.getBinaryNodeChild)(node, 'error')
71
+ if (errNode) {
72
+ throw new boom_1.Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code })
73
+ }
64
74
  }
65
-
66
- export const getBinaryNodeMessages = ({ content }) => {
67
- const msgs = []
68
- if (Array.isArray(content)) {
69
- for (const item of content) {
70
- if (item.tag === 'message') {
71
- msgs.push(proto.WebMessageInfo.decode(item.content))
72
- }
73
- }
74
- }
75
- return msgs
75
+ exports.assertNodeErrorFree = assertNodeErrorFree
76
+ const reduceBinaryNodeToDictionary = (node, tag) => {
77
+ const nodes = (0, exports.getBinaryNodeChildren)(node, tag)
78
+ const dict = nodes.reduce((dict, { attrs }) => {
79
+ if (typeof attrs.name === 'string') {
80
+ dict[attrs.name] = attrs.value || attrs.config_value
81
+ } else {
82
+ dict[attrs.config_code] = attrs.value || attrs.config_value
83
+ }
84
+ return dict
85
+ }, {})
86
+ return dict
76
87
  }
77
-
78
- function bufferToUInt(e, t) {
79
- let a = 0;
80
- for (let i = 0; i < t; i++) {
81
- a = 256 * a + e[i];
82
- }
83
- return a;
88
+ exports.reduceBinaryNodeToDictionary = reduceBinaryNodeToDictionary
89
+ const getBinaryNodeMessages = ({ content }) => {
90
+ const msgs = []
91
+ if (Array.isArray(content)) {
92
+ for (const item of content) {
93
+ if (item.tag === 'message') {
94
+ msgs.push(index_js_1.proto.WebMessageInfo.decode(item.content).toJSON())
95
+ }
96
+ }
97
+ }
98
+ return msgs
84
99
  }
100
+ exports.getBinaryNodeMessages = getBinaryNodeMessages
85
101
 
86
- const tabs = (n) => '\t'.repeat(n)
102
+ const getBinaryFilteredButtons = nodeContent => {
103
+ if (!Array.isArray(nodeContent)) return false
87
104
 
88
- export function binaryNodeToString(node, i = 0) {
89
- if (!node) {
90
- return node;
91
- }
92
- if (typeof node === 'string') {
93
- return tabs(i) + node;
94
- }
95
- if (node instanceof Uint8Array) {
96
- return tabs(i) + Buffer.from(node).toString('hex');
97
- }
98
- if (Array.isArray(node)) {
99
- return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
100
- }
101
- const children = binaryNodeToString(node.content, i + 1);
102
- const tag = `<${node.tag} ${Object.entries(node.attrs || {})
103
- .filter(([, v]) => v!== undefined)
104
- .map(([k, v]) => `${k}='${v}'`)
105
- .join(' ')}`;
106
- const content = children? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
107
- return tag + content;
105
+ return nodeContent.some(
106
+ a =>
107
+ ['native_flow'].includes(a?.content?.[0]?.content?.[0]?.tag) ||
108
+ ['interactive', 'buttons', 'list'].includes(a?.content?.[0]?.tag) ||
109
+ ['hsm', 'biz'].includes(a?.tag)
110
+ )
108
111
  }
112
+ exports.getBinaryFilteredButtons = getBinaryFilteredButtons
113
+ const getBinaryFilteredBizBot = nodeContent => {
114
+ if (!Array.isArray(nodeContent)) return false
109
115
 
110
- export const getBinaryNodeFilter = (node) => {
111
- if (!Array.isArray(node)) return false
112
-
113
- return node.some(item =>
114
- ['native_flow'].includes(item?.content?.[0]?.content?.[0]?.tag) ||
115
- ['interactive', 'buttons', 'list'].includes(item?.content?.[0]?.tag) ||
116
- ['hsm', 'biz'].includes(item?.tag) ||
117
- ['bot'].includes(item?.tag) && item?.attrs?.biz_bot === '1'
118
- )
116
+ return nodeContent.some(b => ['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1')
119
117
  }
118
+ exports.getBinaryFilteredBizBot = getBinaryFilteredBizBot
119
+
120
+ const getAdditionalNode = name => {
121
+ if (name) name = name.toLowerCase()
122
+ const ts = Math.floor(Date.now() / 1000) - 77980457
123
+ const order_response_name = {
124
+ review_and_pay: 'order_details',
125
+ review_order: 'order_status',
126
+ order_status: 'order_status',
127
+ payment_info: 'payment_info',
128
+ payment_status: 'payment_status',
129
+ payment_method: 'payment_method',
130
+ catalog_message: 'catalog_message'
131
+ }
132
+ const flow_name = {
133
+ cta_catalog: 'cta_catalog',
134
+ mpm: 'mpm',
135
+ call_request: 'call_permission_request',
136
+ view_catalog: 'automated_greeting_message_view_catalog',
137
+ wa_pay_detail: 'wa_payment_transaction_details',
138
+ send_location: 'send_location',
139
+ payment_key_info: 'payment_key_info'
140
+ }
141
+ if (order_response_name[name]) {
142
+ return [
143
+ {
144
+ tag: 'biz',
145
+ attrs: {
146
+ native_flow_name: order_response_name[name]
147
+ },
148
+ content: []
149
+ }
150
+ ]
151
+ } else if (flow_name[name] || name === 'interactive' || name === 'buttons') {
152
+ return [
153
+ {
154
+ tag: 'biz',
155
+ attrs: {
156
+ actual_actors: '2',
157
+ host_storage: '2',
158
+ privacy_mode_ts: `${ts}`
159
+ },
160
+ content: [
161
+ {
162
+ tag: 'engagement',
163
+ attrs: {
164
+ customer_service_state: 'open',
165
+ conversation_state: 'open'
166
+ }
167
+ },
168
+ {
169
+ tag: 'interactive',
170
+ attrs: {
171
+ type: 'native_flow',
172
+ v: '1'
173
+ },
174
+ content: [
175
+ {
176
+ tag: 'native_flow',
177
+ attrs: {
178
+ v: '9',
179
+ name: flow_name[name] ?? 'mixed'
180
+ },
181
+ content: []
182
+ }
183
+ ]
184
+ }
185
+ ]
186
+ }
187
+ ]
188
+ } else {
189
+ return [
190
+ {
191
+ tag: 'biz',
192
+ attrs: {
193
+ actual_actors: '2',
194
+ host_storage: '2',
195
+ privacy_mode_ts: `${ts}`
196
+ },
197
+ content: [
198
+ {
199
+ tag: 'engagement',
200
+ attrs: {
201
+ customer_service_state: 'open',
202
+ conversation_state: 'open'
203
+ }
204
+ }
205
+ ]
206
+ }
207
+ ]
208
+ }
209
+ }
210
+ exports.getAdditionalNode = getAdditionalNode
120
211
 
121
- export const getAdditionalNode = (name) => {
122
- if (name) name = name.toLowerCase()
123
- const ts = unixTimestampSeconds(new Date()) - 77980457
124
-
125
- const order_response_name = {
126
- review_and_pay: 'order_details',
127
- review_order: 'order_status',
128
- order_status: 'order_status',
129
- payment_info: 'payment_info',
130
- payment_status: 'payment_status',
131
- payment_method: 'payment_method',
132
- catalog_message: 'catalog_message',
133
- }
134
-
135
- const flow_name = {
136
- cta_catalog: 'cta_catalog',
137
- mpm: 'mpm',
138
- call_request: 'call_permission_request',
139
- view_catalog: 'automated_greeting_message_view_catalog',
140
- wa_pay_detail: 'wa_payment_transaction_details',
141
- send_location: 'send_location',
142
- payment_key_info: 'payment_key_info'
143
- }
144
-
145
- if(order_response_name[name]) {
146
- return [{
147
- tag: 'biz',
148
- attrs: {
149
- native_flow_name: order_response_name[name]
150
- },
151
- content: []
152
- }]
153
- } else if (flow_name[name] || name === 'interactive' || name === 'buttons') {
154
- return [{
155
- tag: 'biz',
156
- attrs: {
157
- actual_actors: '2',
158
- host_storage: '2',
159
- privacy_mode_ts: `${ts}`
160
- },
161
- content: [{
162
- tag: 'engagement',
163
- attrs: {
164
- customer_service_state: 'open',
165
- conversation_state: 'open'
166
- }
167
- }, {
168
- tag: 'interactive',
169
- attrs: {
170
- type: 'native_flow',
171
- v: '1'
172
- },
173
- content: [{
174
- tag: 'native_flow',
175
- attrs: {
176
- v: '9',
177
- name: flow_name[name]?? 'mixed',
178
- },
179
- content: []
180
- }]
181
- }]
182
- }]
183
- } else {
184
- return [{
185
- tag: 'biz',
186
- attrs: {
187
- actual_actors: '2',
188
- host_storage: '2',
189
- privacy_mode_ts: `${ts}`
190
- },
191
- content: [{
192
- tag: 'engagement',
193
- attrs: {
194
- customer_service_state: 'open',
195
- conversation_state: 'open'
196
- }
197
- }]
198
- }]
199
- }
212
+ function bufferToUInt(e, t) {
213
+ let a = 0
214
+ for (let i = 0; i < t; i++) {
215
+ a = 256 * a + e[i]
216
+ }
217
+ return a
218
+ }
219
+ const tabs = n => '\t'.repeat(n)
220
+ function binaryNodeToString(node, i = 0) {
221
+ if (!node) {
222
+ return node
223
+ }
224
+ if (typeof node === 'string') {
225
+ return tabs(i) + node
226
+ }
227
+ if (node instanceof Uint8Array) {
228
+ return tabs(i) + Buffer.from(node).toString('hex')
229
+ }
230
+ if (Array.isArray(node)) {
231
+ return node.map(x => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n')
232
+ }
233
+ const children = binaryNodeToString(node.content, i + 1)
234
+ const tag = `<${node.tag} ${Object.entries(node.attrs || {})
235
+ .filter(([, v]) => v !== undefined)
236
+ .map(([k, v]) => `${k}='${v}'`)
237
+ .join(' ')}`
238
+ const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>'
239
+ return tag + content
200
240
  }
201
- export const getBinaryFilteredBizBot = nodeContent => {
202
- if (!Array.isArray(nodeContent)) return false
203
- return nodeContent.some(b => ['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1')
204
- }
@@ -1,6 +1,33 @@
1
- export * from './encode.js';
2
- export * from './decode.js';
3
- export * from './generic-utils.js';
4
- export * from './jid-utils.js';
5
- export * from './types.js';
6
- //# sourceMappingURL=index.js.map
1
+ 'use strict'
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k
7
+ var desc = Object.getOwnPropertyDescriptor(m, k)
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k]
13
+ }
14
+ }
15
+ }
16
+ Object.defineProperty(o, k2, desc)
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k
20
+ o[k2] = m[k]
21
+ })
22
+ var __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m)
26
+ if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
27
+ }
28
+ Object.defineProperty(exports, '__esModule', { value: true })
29
+ __exportStar(require('./encode'), exports)
30
+ __exportStar(require('./decode'), exports)
31
+ __exportStar(require('./generic-utils'), exports)
32
+ __exportStar(require('./jid-utils'), exports)
33
+ __exportStar(require('./types'), exports)