@pkcprotocol/pkc-js 0.0.62 → 0.0.64

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 (237) hide show
  1. package/dist/browser/clients/base-client-manager.js +15 -15
  2. package/dist/browser/clients/base-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-client-manager.js +10 -12
  4. package/dist/browser/community/community-client-manager.js.map +1 -1
  5. package/dist/browser/community/community-gateway-selection.js +4 -4
  6. package/dist/browser/community/community-gateway-selection.js.map +1 -1
  7. package/dist/browser/community/community-wire.js +3 -3
  8. package/dist/browser/community/community-wire.js.map +1 -1
  9. package/dist/browser/community/remote-community.d.ts +1 -1
  10. package/dist/browser/community/remote-community.js +10 -7
  11. package/dist/browser/community/remote-community.js.map +1 -1
  12. package/dist/browser/community/rpc-local-community.js +3 -3
  13. package/dist/browser/community/rpc-local-community.js.map +1 -1
  14. package/dist/browser/community/rpc-remote-community.js +5 -5
  15. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  16. package/dist/browser/community/schema.js +5 -5
  17. package/dist/browser/community/schema.js.map +1 -1
  18. package/dist/browser/generated-version.d.ts +1 -1
  19. package/dist/browser/generated-version.js +1 -1
  20. package/dist/browser/pages/pages-client-manager.js +11 -15
  21. package/dist/browser/pages/pages-client-manager.js.map +1 -1
  22. package/dist/browser/pages/util.js +9 -9
  23. package/dist/browser/pages/util.js.map +1 -1
  24. package/dist/browser/pkc/pkc-client-manager.js +6 -6
  25. package/dist/browser/pkc/pkc-client-manager.js.map +1 -1
  26. package/dist/browser/pkc/pkc.js +19 -13
  27. package/dist/browser/pkc/pkc.js.map +1 -1
  28. package/dist/browser/publications/comment/comment-client-manager.js +5 -5
  29. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  30. package/dist/browser/publications/comment/comment.js +16 -16
  31. package/dist/browser/publications/comment/comment.js.map +1 -1
  32. package/dist/browser/publications/comment/schema.js +17 -17
  33. package/dist/browser/publications/comment/schema.js.map +1 -1
  34. package/dist/browser/publications/comment-edit/schema.js +7 -7
  35. package/dist/browser/publications/comment-edit/schema.js.map +1 -1
  36. package/dist/browser/publications/comment-moderation/schema.js +11 -7
  37. package/dist/browser/publications/comment-moderation/schema.js.map +1 -1
  38. package/dist/browser/publications/community-edit/schema.js +6 -6
  39. package/dist/browser/publications/community-edit/schema.js.map +1 -1
  40. package/dist/browser/publications/publication-author.js +3 -3
  41. package/dist/browser/publications/publication-author.js.map +1 -1
  42. package/dist/browser/publications/publication-client-manager.js +4 -4
  43. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  44. package/dist/browser/publications/publication.js +9 -9
  45. package/dist/browser/publications/publication.js.map +1 -1
  46. package/dist/browser/publications/vote/schema.js +11 -7
  47. package/dist/browser/publications/vote/schema.js.map +1 -1
  48. package/dist/browser/publications/vote/vote.js.map +1 -1
  49. package/dist/browser/pubsub-messages/schema.js +5 -5
  50. package/dist/browser/pubsub-messages/schema.js.map +1 -1
  51. package/dist/browser/rpc/src/index.js +54 -15
  52. package/dist/browser/rpc/src/index.js.map +1 -1
  53. package/dist/browser/runtime/browser/localforage-lru.js +2 -2
  54. package/dist/browser/runtime/browser/localforage-lru.js.map +1 -1
  55. package/dist/browser/runtime/browser/util.d.ts +1 -1
  56. package/dist/browser/runtime/browser/util.js +4 -2
  57. package/dist/browser/runtime/browser/util.js.map +1 -1
  58. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js +3 -3
  59. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js.map +1 -1
  60. package/dist/browser/runtime/node/community/challenges/index.js +3 -3
  61. package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
  62. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +4 -4
  63. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
  64. package/dist/browser/runtime/node/community/db-handler.js +32 -32
  65. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  66. package/dist/browser/runtime/node/community/local-community/challenges.js +7 -7
  67. package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
  68. package/dist/browser/runtime/node/community/local-community/comment-updates.js +5 -5
  69. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  70. package/dist/browser/runtime/node/community/local-community/db-state.js +8 -8
  71. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  72. package/dist/browser/runtime/node/community/local-community/editing.js +6 -6
  73. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  74. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +10 -7
  75. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  76. package/dist/browser/runtime/node/community/local-community/lifecycle.js +4 -4
  77. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  78. package/dist/browser/runtime/node/community/local-community/publication-store.js +13 -19
  79. package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
  80. package/dist/browser/runtime/node/community/local-community/publication-validation.js +10 -10
  81. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  82. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +5 -5
  83. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  84. package/dist/browser/runtime/node/community/local-community.js +7 -7
  85. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  86. package/dist/browser/runtime/node/community/page-generator.js +5 -7
  87. package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
  88. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js +2 -2
  89. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -1
  90. package/dist/browser/runtime/node/sqlite-lru-cache.js +2 -2
  91. package/dist/browser/runtime/node/sqlite-lru-cache.js.map +1 -1
  92. package/dist/browser/runtime/node/util.d.ts +1 -1
  93. package/dist/browser/runtime/node/util.js +12 -8
  94. package/dist/browser/runtime/node/util.js.map +1 -1
  95. package/dist/browser/schema/schema.js +4 -4
  96. package/dist/browser/schema/schema.js.map +1 -1
  97. package/dist/browser/signer/constants.d.ts +1 -2
  98. package/dist/browser/signer/constants.js +9 -1
  99. package/dist/browser/signer/constants.js.map +1 -1
  100. package/dist/browser/signer/signatures.js +14 -12
  101. package/dist/browser/signer/signatures.js.map +1 -1
  102. package/dist/browser/stats.js +5 -5
  103. package/dist/browser/stats.js.map +1 -1
  104. package/dist/browser/test/test-util.d.ts +9 -10
  105. package/dist/browser/test/test-util.js +25 -37
  106. package/dist/browser/test/test-util.js.map +1 -1
  107. package/dist/browser/types.d.ts +1 -1
  108. package/dist/browser/util.d.ts +2 -2
  109. package/dist/browser/util.js +24 -22
  110. package/dist/browser/util.js.map +1 -1
  111. package/dist/bundled/bundle-manifest.json +242 -312
  112. package/dist/bundled/chunks/chunk-2rV9d50f.js +35 -0
  113. package/dist/bundled/chunks/{helia-for-pkc-55fcY7oN.js → helia-for-pkc-CYDRSysz.js} +6 -6
  114. package/dist/bundled/chunks/{local-community-Bdasy8ZJ.js → local-community-DYvRQWsK.js} +148 -98
  115. package/dist/bundled/chunks/{local-community-Bz-P-EGM.js → local-community-DyaGG6lj.js} +1 -1
  116. package/dist/bundled/chunks/{node-DU0tGecu.js → node-DadVit9c.js} +50 -43
  117. package/dist/bundled/chunks/{rpc-local-community-NkCEOv2-.js → rpc-local-community-1Uvl5iwp.js} +343 -111
  118. package/dist/bundled/chunks/schema-Dtvt2tQ8.js +16182 -0
  119. package/dist/bundled/chunks/src-0J9-Tmgd.js +4147 -0
  120. package/dist/bundled/chunks/src-4u0f92eE.js +9899 -0
  121. package/dist/bundled/chunks/src-BOzgM7Fp.js +800 -0
  122. package/dist/bundled/chunks/src-CYIMjhjK.js +48 -0
  123. package/dist/bundled/chunks/{util-DpR-szdu.js → util-CjfTxkQ8.js} +1 -1
  124. package/dist/bundled/index.js +1 -1
  125. package/dist/bundled/rpc/src/index.js +44 -25
  126. package/dist/node/clients/base-client-manager.js +15 -15
  127. package/dist/node/clients/base-client-manager.js.map +1 -1
  128. package/dist/node/community/community-client-manager.js +10 -12
  129. package/dist/node/community/community-client-manager.js.map +1 -1
  130. package/dist/node/community/community-gateway-selection.js +4 -4
  131. package/dist/node/community/community-gateway-selection.js.map +1 -1
  132. package/dist/node/community/community-wire.js +3 -3
  133. package/dist/node/community/community-wire.js.map +1 -1
  134. package/dist/node/community/remote-community.d.ts +1 -1
  135. package/dist/node/community/remote-community.js +10 -7
  136. package/dist/node/community/remote-community.js.map +1 -1
  137. package/dist/node/community/rpc-local-community.js +3 -3
  138. package/dist/node/community/rpc-local-community.js.map +1 -1
  139. package/dist/node/community/rpc-remote-community.js +5 -5
  140. package/dist/node/community/rpc-remote-community.js.map +1 -1
  141. package/dist/node/community/schema.js +5 -5
  142. package/dist/node/community/schema.js.map +1 -1
  143. package/dist/node/generated-version.d.ts +1 -1
  144. package/dist/node/generated-version.js +1 -1
  145. package/dist/node/pages/pages-client-manager.js +11 -15
  146. package/dist/node/pages/pages-client-manager.js.map +1 -1
  147. package/dist/node/pages/util.js +9 -9
  148. package/dist/node/pages/util.js.map +1 -1
  149. package/dist/node/pkc/pkc-client-manager.js +6 -6
  150. package/dist/node/pkc/pkc-client-manager.js.map +1 -1
  151. package/dist/node/pkc/pkc.js +19 -13
  152. package/dist/node/pkc/pkc.js.map +1 -1
  153. package/dist/node/publications/comment/comment-client-manager.js +5 -5
  154. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  155. package/dist/node/publications/comment/comment.js +16 -16
  156. package/dist/node/publications/comment/comment.js.map +1 -1
  157. package/dist/node/publications/comment/schema.js +17 -17
  158. package/dist/node/publications/comment/schema.js.map +1 -1
  159. package/dist/node/publications/comment-edit/schema.js +7 -7
  160. package/dist/node/publications/comment-edit/schema.js.map +1 -1
  161. package/dist/node/publications/comment-moderation/schema.js +11 -7
  162. package/dist/node/publications/comment-moderation/schema.js.map +1 -1
  163. package/dist/node/publications/community-edit/schema.js +6 -6
  164. package/dist/node/publications/community-edit/schema.js.map +1 -1
  165. package/dist/node/publications/publication-author.js +3 -3
  166. package/dist/node/publications/publication-author.js.map +1 -1
  167. package/dist/node/publications/publication-client-manager.js +4 -4
  168. package/dist/node/publications/publication-client-manager.js.map +1 -1
  169. package/dist/node/publications/publication.js +9 -9
  170. package/dist/node/publications/publication.js.map +1 -1
  171. package/dist/node/publications/vote/schema.js +11 -7
  172. package/dist/node/publications/vote/schema.js.map +1 -1
  173. package/dist/node/publications/vote/vote.js.map +1 -1
  174. package/dist/node/pubsub-messages/schema.js +5 -5
  175. package/dist/node/pubsub-messages/schema.js.map +1 -1
  176. package/dist/node/rpc/src/index.js +54 -15
  177. package/dist/node/rpc/src/index.js.map +1 -1
  178. package/dist/node/runtime/browser/localforage-lru.js +2 -2
  179. package/dist/node/runtime/browser/localforage-lru.js.map +1 -1
  180. package/dist/node/runtime/browser/util.d.ts +1 -1
  181. package/dist/node/runtime/browser/util.js +4 -2
  182. package/dist/node/runtime/browser/util.js.map +1 -1
  183. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js +3 -3
  184. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js.map +1 -1
  185. package/dist/node/runtime/node/community/challenges/index.js +3 -3
  186. package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
  187. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +4 -4
  188. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
  189. package/dist/node/runtime/node/community/db-handler.js +32 -32
  190. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  191. package/dist/node/runtime/node/community/local-community/challenges.js +7 -7
  192. package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
  193. package/dist/node/runtime/node/community/local-community/comment-updates.js +5 -5
  194. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  195. package/dist/node/runtime/node/community/local-community/db-state.js +8 -8
  196. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  197. package/dist/node/runtime/node/community/local-community/editing.js +6 -6
  198. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  199. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +10 -7
  200. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  201. package/dist/node/runtime/node/community/local-community/lifecycle.js +4 -4
  202. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  203. package/dist/node/runtime/node/community/local-community/publication-store.js +13 -19
  204. package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
  205. package/dist/node/runtime/node/community/local-community/publication-validation.js +10 -10
  206. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  207. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +5 -5
  208. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  209. package/dist/node/runtime/node/community/local-community.js +7 -7
  210. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  211. package/dist/node/runtime/node/community/page-generator.js +5 -7
  212. package/dist/node/runtime/node/community/page-generator.js.map +1 -1
  213. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js +2 -2
  214. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -1
  215. package/dist/node/runtime/node/sqlite-lru-cache.js +2 -2
  216. package/dist/node/runtime/node/sqlite-lru-cache.js.map +1 -1
  217. package/dist/node/runtime/node/util.d.ts +1 -1
  218. package/dist/node/runtime/node/util.js +12 -8
  219. package/dist/node/runtime/node/util.js.map +1 -1
  220. package/dist/node/schema/schema.js +4 -4
  221. package/dist/node/schema/schema.js.map +1 -1
  222. package/dist/node/signer/constants.d.ts +1 -2
  223. package/dist/node/signer/constants.js +9 -1
  224. package/dist/node/signer/constants.js.map +1 -1
  225. package/dist/node/signer/signatures.js +14 -12
  226. package/dist/node/signer/signatures.js.map +1 -1
  227. package/dist/node/stats.js +5 -5
  228. package/dist/node/stats.js.map +1 -1
  229. package/dist/node/test/test-util.d.ts +9 -10
  230. package/dist/node/test/test-util.js +25 -37
  231. package/dist/node/test/test-util.js.map +1 -1
  232. package/dist/node/types.d.ts +1 -1
  233. package/dist/node/util.d.ts +2 -2
  234. package/dist/node/util.js +24 -22
  235. package/dist/node/util.js.map +1 -1
  236. package/package.json +2 -2
  237. package/dist/bundled/chunks/schema-qXcvCeAO.js +0 -34744
@@ -1,5 +1,6 @@
1
- import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-qXcvCeAO.js";
2
- import { A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as require_lodash_merge, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as stringify, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as STORAGE_KEYS, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-NkCEOv2-.js";
1
+ import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-Dtvt2tQ8.js";
3
+ import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-1Uvl5iwp.js";
3
4
  import { randomFillSync, randomUUID } from "node:crypto";
4
5
  import { fileURLToPath, pathToFileURL } from "node:url";
5
6
  import path from "node:path";
@@ -8,11 +9,62 @@ import { existsSync, promises } from "node:fs";
8
9
  import path$1 from "path";
9
10
  import assert from "assert";
10
11
  import fs from "fs";
11
- import { CID } from "multiformats/cid";
12
12
  import Database from "better-sqlite3";
13
+ import { CID } from "multiformats/cid";
13
14
  import { of } from "typestub-ipfs-only-hash";
15
+ //#region node_modules/remeda/dist/entries.js
16
+ function t$2(...t) {
17
+ return t$3(Object.entries, t);
18
+ }
19
+ //#endregion
20
+ //#region node_modules/remeda/dist/groupBy.js
21
+ function t$1(...t) {
22
+ return t$3(n$2, t);
23
+ }
24
+ const n$2 = (e, t) => {
25
+ let n = Object.create(null);
26
+ for (let r = 0; r < e.length; r++) {
27
+ let i = e[r], a = t(i, r, e);
28
+ if (a !== void 0) {
29
+ let e = n[a];
30
+ e === void 0 ? n[a] = [i] : e.push(i);
31
+ }
32
+ }
33
+ return Object.setPrototypeOf(n, Object.prototype), n;
34
+ };
35
+ //#endregion
36
+ //#region node_modules/remeda/dist/sumBy.js
37
+ function t(...t) {
38
+ return t$3(n$1, t);
39
+ }
40
+ const n$1 = (e, t) => {
41
+ let n = e.entries(), r = n.next();
42
+ if (`done` in r && r.done) return 0;
43
+ let { value: [, i] } = r, a = t(i, 0, e);
44
+ for (let [r, i] of n) {
45
+ let n = t(i, r, e);
46
+ a += n;
47
+ }
48
+ return a;
49
+ };
50
+ //#endregion
51
+ //#region node_modules/remeda/dist/uniqueBy.js
52
+ function n(...e) {
53
+ return t$4(r, e);
54
+ }
55
+ function r(t) {
56
+ let n = t, r = /* @__PURE__ */ new Set();
57
+ return (t, i, a) => {
58
+ let o = n(t, i, a);
59
+ return r.has(o) ? t$5 : (r.add(o), {
60
+ done: !1,
61
+ hasNext: !0,
62
+ next: t
63
+ });
64
+ };
65
+ }
66
+ //#endregion
14
67
  //#region dist/node/runtime/node/community/local-community/comment-updates.js
15
- var import_commonjs = /* @__PURE__ */ __toESM(require_commonjs(), 1);
16
68
  function pubsubTopicWithfallback(community) {
17
69
  return community.pubsubTopic || community.address;
18
70
  }
@@ -53,7 +105,7 @@ async function calculateNewCommentUpdate(community, comment) {
53
105
  if ("singlePreloadedPage" in generatedRepliesPages) commentUpdatePriorToSigning.replies = { pages: generatedRepliesPages.singlePreloadedPage };
54
106
  else if (generatedRepliesPages.pageCids) commentUpdatePriorToSigning.replies = {
55
107
  pageCids: generatedRepliesPages.pageCids,
56
- pages: import_commonjs.pick(generatedRepliesPages.pages, [preloadedRepliesPages])
108
+ pages: t$9(generatedRepliesPages.pages, [preloadedRepliesPages])
57
109
  };
58
110
  }
59
111
  const allPageCids = generatedRepliesPages && !("singlePreloadedPage" in generatedRepliesPages) ? generatedRepliesPages.allPageCids : void 0;
@@ -118,13 +170,13 @@ async function updateCommentsThatNeedToBeUpdated(community) {
118
170
  if (commentsToUpdate.length === 0) return [];
119
171
  community._communityUpdateTrigger = true;
120
172
  log(`Will update ${commentsToUpdate.length} comments in this update loop for community (${community.address})`);
121
- const commentsByPostCid = import_commonjs.groupBy.strict(commentsToUpdate, (x) => x.postCid);
173
+ const commentsByPostCid = t$1(commentsToUpdate, (x) => x.postCid);
122
174
  const allCommentUpdateRows = [];
123
175
  const postLimit = pLimit(10);
124
176
  const postProcessingPromises = Object.entries(commentsByPostCid).map(([postCid, commentsForPost]) => postLimit(async () => {
125
177
  try {
126
- const commentsByDepth = import_commonjs.groupBy.strict(commentsForPost, (x) => x.depth);
127
- const depthsKeySorted = import_commonjs.keys.strict(commentsByDepth).sort((a, b) => Number(b) - Number(a));
178
+ const commentsByDepth = t$1(commentsForPost, (x) => x.depth);
179
+ const depthsKeySorted = t$6(commentsByDepth).sort((a, b) => Number(b) - Number(a));
128
180
  const postUpdateRows = [];
129
181
  for (const depthKey of depthsKeySorted) {
130
182
  const commentsAtDepth = commentsByDepth[depthKey];
@@ -425,7 +477,7 @@ async function publishChallenges(community, challenges, request) {
425
477
  const pubsubClient = community._clientsManager.getDefaultKuboPubsubClient();
426
478
  community._clientsManager.updateKuboRpcPubsubState("publishing-challenge", pubsubClient.url);
427
479
  if (!community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(pubsubTopicWithfallback(community), challengeMessage);
428
- log(`Community ${community.address} with pubsub topic ${pubsubTopicWithfallback(community)} published ${challengeMessage.type} over pubsub: `, import_commonjs.pick(toSignChallenge, ["timestamp"]), toEncryptChallenge.challenges.map((challenge) => challenge.type));
480
+ log(`Community ${community.address} with pubsub topic ${pubsubTopicWithfallback(community)} published ${challengeMessage.type} over pubsub: `, t$9(toSignChallenge, ["timestamp"]), toEncryptChallenge.challenges.map((challenge) => challenge.type));
429
481
  community._clientsManager.updateKuboRpcPubsubState("waiting-challenge-answers", pubsubClient.url);
430
482
  community.emit("challenge", {
431
483
  ...challengeMessage,
@@ -453,7 +505,7 @@ async function publishFailedChallengeVerification(community, result, challengeRe
453
505
  };
454
506
  const pubsubClient = community._clientsManager.getDefaultKuboPubsubClient();
455
507
  community._clientsManager.updateKuboRpcPubsubState("publishing-challenge-verification", pubsubClient.url);
456
- log(`Will publish ${challengeVerification.type} over pubsub topic ${pubsubTopicWithfallback(community)} on community ${community.address}:`, import_commonjs.omit(toSignVerification, ["challengeRequestId"]));
508
+ log(`Will publish ${challengeVerification.type} over pubsub topic ${pubsubTopicWithfallback(community)} on community ${community.address}:`, n$3(toSignVerification, ["challengeRequestId"]));
457
509
  if (!community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(pubsubTopicWithfallback(community), challengeVerification);
458
510
  community._clientsManager.updateKuboRpcPubsubState("waiting-challenge-requests", pubsubClient.url);
459
511
  community.emit("challengeverification", challengeVerification);
@@ -603,7 +655,7 @@ async function publishChallengeVerification(community, challengeResult, request,
603
655
  community._ongoingChallengeExchanges.delete(request.challengeRequestId.toString());
604
656
  delete community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()];
605
657
  cleanUpChallengeAnswerPromise(community, request.challengeRequestId.toString());
606
- log.trace(`Published ${challengeVerification.type} over pubsub topic ${pubsubTopicWithfallback(community)}:`, import_commonjs.omit(objectToEmit, [
658
+ log.trace(`Published ${challengeVerification.type} over pubsub topic ${pubsubTopicWithfallback(community)}:`, n$3(objectToEmit, [
607
659
  "signature",
608
660
  "encrypted",
609
661
  "challengeRequestId"
@@ -639,7 +691,7 @@ function buildRuntimeChallengeRequestPublication({ publication, authorCommunity
639
691
  };
640
692
  }
641
693
  function buildRuntimeChallengeRequest({ request, authorCommunity }) {
642
- const runtimeRequest = import_commonjs.clone(request);
694
+ const runtimeRequest = t$10(request);
643
695
  if (request.comment) runtimeRequest.comment = buildRuntimeChallengeRequestPublication({
644
696
  publication: request.comment,
645
697
  authorCommunity
@@ -664,7 +716,7 @@ function buildRuntimeChallengeRequest({ request, authorCommunity }) {
664
716
  }
665
717
  async function parseAndValidateChallengeRequest(community, request, log) {
666
718
  const decryptedRequest = await parseChallengeRequestPublicationOrRespondWithFailure(community, request, await decryptOrRespondWithFailure(community, request));
667
- const publicationFieldNames = import_commonjs.keys.strict(DecryptedChallengeRequestPublicationSchema.shape);
719
+ const publicationFieldNames = t$6(DecryptedChallengeRequestPublicationSchema.shape);
668
720
  let publication;
669
721
  try {
670
722
  publication = derivePublicationFromChallengeRequest(decryptedRequest);
@@ -788,7 +840,7 @@ async function handleChallengeRequest(community, request, isLocalPublisher) {
788
840
  request,
789
841
  validateTimestampRange: true
790
842
  });
791
- if (!requestSignatureValidation.valid) throw new PKCError(getErrorCodeFromMessage(requestSignatureValidation.reason), { challengeRequest: import_commonjs.omit(request, ["encrypted"]) });
843
+ if (!requestSignatureValidation.valid) throw new PKCError(getErrorCodeFromMessage(requestSignatureValidation.reason), { challengeRequest: n$3(request, ["encrypted"]) });
792
844
  const parsed = await parseAndValidateChallengeRequest(community, request, log);
793
845
  if (!parsed) return;
794
846
  const challengeVerification = await runChallengeExchangeIfNeeded(community, parsed, log);
@@ -885,7 +937,7 @@ async function handleChallengeExchange(community, pubsubMsg) {
885
937
  //#endregion
886
938
  //#region dist/node/runtime/node/community/local-community/publication-validation.js
887
939
  function isFlairInAllowedList(flair, allowedFlairs) {
888
- return allowedFlairs.some((allowed) => import_commonjs.isDeepEqual(allowed, flair));
940
+ return allowedFlairs.some((allowed) => t$11(allowed, flair));
889
941
  }
890
942
  async function isPublicationAuthorPartOfRoles(community, publication, rolesToCheckAgainst) {
891
943
  if (!community.roles) return false;
@@ -953,7 +1005,7 @@ async function checkWireFormatAndCommunityAuthor(community, publication, authorC
953
1005
  if (typeof authorCommunity?.banExpiresAt === "number" && authorCommunity.banExpiresAt > timestamp()) return messages.ERR_AUTHOR_IS_BANNED;
954
1006
  }
955
1007
  async function checkAuthorIdentity(community, publication, log) {
956
- if (publication.author && import_commonjs.intersection(import_commonjs.keys.strict(publication.author), AuthorReservedFields).length > 0) return messages.ERR_PUBLICATION_AUTHOR_HAS_RESERVED_FIELD;
1008
+ if (publication.author && r$2(t$6(publication.author), AuthorReservedFields).length > 0) return messages.ERR_PUBLICATION_AUTHOR_HAS_RESERVED_FIELD;
957
1009
  const authorName = getAuthorNameFromWire(publication.author);
958
1010
  if (authorName && !isStringDomain(authorName)) {
959
1011
  log("Rejecting publication: author.name is not a domain", authorName);
@@ -1010,7 +1062,7 @@ async function checkParentAndPostState(community, request, publication) {
1010
1062
  async function checkCommentPublication(community, request) {
1011
1063
  if (!request.comment) return void 0;
1012
1064
  const commentPublication = request.comment;
1013
- if (import_commonjs.intersection(import_commonjs.keys.strict(commentPublication), CommentPubsubMessageReservedFields).length > 0) return messages.ERR_COMMENT_HAS_RESERVED_FIELD;
1065
+ if (r$2(t$6(commentPublication), CommentPubsubMessageReservedFields).length > 0) return messages.ERR_COMMENT_HAS_RESERVED_FIELD;
1014
1066
  if (community.features?.requirePostLink && !commentPublication.parentCid && (!commentPublication.link || !community.features?.requirePostLinkIsMedia && !isLinkValid(commentPublication.link))) return messages.ERR_COMMENT_HAS_INVALID_LINK_FIELD;
1015
1067
  if (community.features?.requirePostLinkIsMedia && commentPublication.link && (!isLinkValid(commentPublication.link) || !isLinkOfMedia(commentPublication.link))) return messages.ERR_POST_LINK_IS_NOT_OF_MEDIA;
1016
1068
  if (community.features?.requireReplyLink && commentPublication.parentCid && (!commentPublication.link || !community.features?.requireReplyLinkIsMedia && !isLinkValid(commentPublication.link))) return messages.ERR_REPLY_HAS_INVALID_LINK_FIELD;
@@ -1067,7 +1119,7 @@ async function checkCommentPublication(community, request) {
1067
1119
  async function checkVotePublication(community, request) {
1068
1120
  if (!request.vote) return void 0;
1069
1121
  const votePublication = request.vote;
1070
- if (import_commonjs.intersection(VotePubsubReservedFields, import_commonjs.keys.strict(votePublication)).length > 0) return messages.ERR_VOTE_HAS_RESERVED_FIELD;
1122
+ if (r$2(VotePubsubReservedFields, t$6(votePublication)).length > 0) return messages.ERR_VOTE_HAS_RESERVED_FIELD;
1071
1123
  if (community.features?.noUpvotes && votePublication.vote === 1) return messages.ERR_NOT_ALLOWED_TO_PUBLISH_UPVOTES;
1072
1124
  if (community.features?.noDownvotes && votePublication.vote === -1) return messages.ERR_NOT_ALLOWED_TO_PUBLISH_DOWNVOTES;
1073
1125
  const commentToVoteOn = community._dbHandler.queryComment(request.vote.commentCid);
@@ -1081,7 +1133,7 @@ async function checkVotePublication(community, request) {
1081
1133
  async function checkCommentModerationPublication(community, request) {
1082
1134
  if (!request.commentModeration) return void 0;
1083
1135
  const commentModerationPublication = request.commentModeration;
1084
- if (import_commonjs.intersection(CommentModerationReservedFields, import_commonjs.keys.strict(commentModerationPublication)).length > 0) return messages.ERR_COMMENT_MODERATION_HAS_RESERVED_FIELD;
1136
+ if (r$2(CommentModerationReservedFields, t$6(commentModerationPublication)).length > 0) return messages.ERR_COMMENT_MODERATION_HAS_RESERVED_FIELD;
1085
1137
  const isAuthorMod = await isPublicationAuthorPartOfRoles(community, commentModerationPublication, [
1086
1138
  "owner",
1087
1139
  "moderator",
@@ -1098,18 +1150,18 @@ async function checkCommentModerationPublication(community, request) {
1098
1150
  async function checkCommunityEditPublication(community, request) {
1099
1151
  if (!request.communityEdit) return void 0;
1100
1152
  const communityEdit = request.communityEdit;
1101
- if (import_commonjs.intersection(CommunityEditPublicationPubsubReservedFields, import_commonjs.keys.strict(communityEdit)).length > 0) return messages.ERR_COMMUNITY_EDIT_HAS_RESERVED_FIELD;
1153
+ if (r$2(CommunityEditPublicationPubsubReservedFields, t$6(communityEdit)).length > 0) return messages.ERR_COMMUNITY_EDIT_HAS_RESERVED_FIELD;
1102
1154
  if (communityEdit.communityEdit.roles || communityEdit.communityEdit.address) {
1103
1155
  if (!await isPublicationAuthorPartOfRoles(community, communityEdit, ["owner"])) return messages.ERR_COMMUNITY_EDIT_ATTEMPTED_TO_MODIFY_OWNER_EXCLUSIVE_PROPS;
1104
1156
  }
1105
1157
  if (!await isPublicationAuthorPartOfRoles(community, communityEdit, ["owner", "admin"])) return messages.ERR_COMMUNITY_EDIT_ATTEMPTED_TO_MODIFY_COMMUNITY_WITHOUT_BEING_OWNER_OR_ADMIN;
1106
- const allowedCommunityEditKeys = [...import_commonjs.keys.strict(CommunityIpfsSchema.shape), "address"];
1107
- if (import_commonjs.difference(import_commonjs.keys.strict(communityEdit.communityEdit), allowedCommunityEditKeys).length > 0) return messages.ERR_COMMUNITY_EDIT_ATTEMPTED_TO_NON_PUBLIC_PROPS;
1158
+ const allowedCommunityEditKeys = [...t$6(CommunityIpfsSchema.shape), "address"];
1159
+ if (r$1(t$6(communityEdit.communityEdit), allowedCommunityEditKeys).length > 0) return messages.ERR_COMMUNITY_EDIT_ATTEMPTED_TO_NON_PUBLIC_PROPS;
1108
1160
  }
1109
1161
  async function checkCommentEditPublication(community, request) {
1110
1162
  if (!request.commentEdit) return void 0;
1111
1163
  const commentEditPublication = request.commentEdit;
1112
- if (import_commonjs.intersection(CommentEditReservedFields, import_commonjs.keys.strict(commentEditPublication)).length > 0) return messages.ERR_COMMENT_EDIT_HAS_RESERVED_FIELD;
1164
+ if (r$2(CommentEditReservedFields, t$6(commentEditPublication)).length > 0) return messages.ERR_COMMENT_EDIT_HAS_RESERVED_FIELD;
1113
1165
  const commentToBeEdited = community._dbHandler.queryComment(commentEditPublication.commentCid);
1114
1166
  if (!commentToBeEdited) return messages.ERR_COMMENT_EDIT_NO_COMMENT_TO_EDIT;
1115
1167
  if (community._dbHandler.hasCommentEditWithSignatureEncoded(commentEditPublication.signature.signature)) return messages.ERR_DUPLICATE_COMMENT_EDIT;
@@ -1218,7 +1270,7 @@ async function prepareCommentWithAnonymity(community, originalComment) {
1218
1270
  });
1219
1271
  const displayName = originalComment.author?.displayName;
1220
1272
  const sanitizedAuthor = cleanWireAuthor(displayName !== void 0 ? { displayName } : void 0);
1221
- const anonymizedComment = import_commonjs.clone(originalComment);
1273
+ const anonymizedComment = t$10(originalComment);
1222
1274
  if (sanitizedAuthor !== void 0) anonymizedComment.author = sanitizedAuthor;
1223
1275
  else delete anonymizedComment.author;
1224
1276
  anonymizedComment.signature = await signComment({
@@ -1246,7 +1298,7 @@ async function prepareCommentEditWithAlias(community, originalEdit) {
1246
1298
  privateKey: aliasSignerOfComment.aliasPrivateKey,
1247
1299
  type: "ed25519"
1248
1300
  });
1249
- const commentEditSignedByAlias = import_commonjs.clone(originalEdit);
1301
+ const commentEditSignedByAlias = t$10(originalEdit);
1250
1302
  delete commentEditSignedByAlias.author;
1251
1303
  commentEditSignedByAlias.signature = await signCommentEdit({
1252
1304
  edit: {
@@ -1274,10 +1326,10 @@ async function storeCommentEdit(community, commentEditRaw, challengeRequestId) {
1274
1326
  authorSignerAddress,
1275
1327
  insertedAt: timestamp()
1276
1328
  };
1277
- const extraPropsInEdit = import_commonjs.difference(import_commonjs.keys.strict(commentEditRaw), import_commonjs.keys.strict(CommentEditPubsubMessagePublicationSchema.shape)).filter((key) => key !== "communityAddress");
1329
+ const extraPropsInEdit = r$1(t$6(commentEditRaw), t$6(CommentEditPubsubMessagePublicationSchema.shape)).filter((key) => key !== "communityAddress");
1278
1330
  if (extraPropsInEdit.length > 0) {
1279
1331
  log("Found extra props on CommentEdit", extraPropsInEdit, "Will be adding them to extraProps column");
1280
- editTableRow.extraProps = import_commonjs.pick(commentEditRaw, extraPropsInEdit);
1332
+ editTableRow.extraProps = t$9(commentEditRaw, extraPropsInEdit);
1281
1333
  }
1282
1334
  if (community._dbHandler.hasCommentEditWithSignatureEncoded(editTableRow.signature.signature)) throw new PKCError("ERR_DUPLICATE_COMMENT_EDIT", { editTableRow });
1283
1335
  community._dbHandler.insertCommentEdits([editTableRow]);
@@ -1321,10 +1373,10 @@ async function storeCommentModeration(community, commentModRaw, challengeRequest
1321
1373
  targetAuthorDomain
1322
1374
  };
1323
1375
  if (community._dbHandler.hasCommentModerationWithSignatureEncoded(modTableRow.signature.signature)) throw new PKCError("ERR_DUPLICATE_COMMENT_MODERATION", { modTableRow });
1324
- const extraPropsInMod = import_commonjs.difference(import_commonjs.keys.strict(commentModRaw), import_commonjs.keys.strict(CommentModerationPubsubMessagePublicationSchema.shape)).filter((key) => key !== "communityAddress");
1376
+ const extraPropsInMod = r$1(t$6(commentModRaw), t$6(CommentModerationPubsubMessagePublicationSchema.shape)).filter((key) => key !== "communityAddress");
1325
1377
  if (extraPropsInMod.length > 0) {
1326
1378
  log("Found extra props on CommentModeration", extraPropsInMod, "Will be adding them to extraProps column");
1327
- modTableRow.extraProps = import_commonjs.pick(commentModRaw, extraPropsInMod);
1379
+ modTableRow.extraProps = t$9(commentModRaw, extraPropsInMod);
1328
1380
  }
1329
1381
  if (modTableRow.commentModeration.purged) {
1330
1382
  log("commentModeration.purged=true, and therefore will delete the post/comment and all its reply tree from the db as well as unpin the cids from ipfs", "comment cid is", modTableRow.commentCid);
@@ -1356,7 +1408,7 @@ async function storeVote(community, newVoteProps, challengeRequestId) {
1356
1408
  const authorSignerAddress = await getPKCAddressFromPublicKey(newVoteProps.signature.publicKey);
1357
1409
  community._dbHandler.deleteVote(authorSignerAddress, newVoteProps.commentCid);
1358
1410
  const voteTableRow = {
1359
- ...import_commonjs.pick(newVoteProps, [
1411
+ ...t$9(newVoteProps, [
1360
1412
  "vote",
1361
1413
  "commentCid",
1362
1414
  "protocolVersion",
@@ -1365,10 +1417,10 @@ async function storeVote(community, newVoteProps, challengeRequestId) {
1365
1417
  authorSignerAddress,
1366
1418
  insertedAt: timestamp()
1367
1419
  };
1368
- const extraPropsInVote = import_commonjs.difference(import_commonjs.keys.strict(newVoteProps), import_commonjs.keys.strict(VotePubsubMessagePublicationSchema.shape));
1420
+ const extraPropsInVote = r$1(t$6(newVoteProps), t$6(VotePubsubMessagePublicationSchema.shape));
1369
1421
  if (extraPropsInVote.length > 0) {
1370
1422
  log("Found extra props on Vote", extraPropsInVote, "Will be adding them to extraProps column");
1371
- voteTableRow.extraProps = import_commonjs.pick(newVoteProps, extraPropsInVote);
1423
+ voteTableRow.extraProps = t$9(newVoteProps, extraPropsInVote);
1372
1424
  }
1373
1425
  community._dbHandler.insertVotes([voteTableRow]);
1374
1426
  log("Inserted vote", "of comment", voteTableRow.commentCid, "into db", "with props", voteTableRow);
@@ -1378,7 +1430,7 @@ async function storeCommunityEditPublication(community, editProps, challengeRequ
1378
1430
  const authorSignerAddress = await getPKCAddressFromPublicKey(editProps.signature.publicKey);
1379
1431
  const authorIdentity = getAuthorNameFromWire(editProps.author) || authorSignerAddress;
1380
1432
  log("Received community edit", editProps.communityEdit, "from author", authorIdentity, "with signer address", authorSignerAddress, "Will be using these props to edit the community props");
1381
- const propsAfterEdit = import_commonjs.pick(community, import_commonjs.keys.strict(editProps.communityEdit));
1433
+ const propsAfterEdit = t$9(community, t$6(editProps.communityEdit));
1382
1434
  log("Current props from community edit (not edited yet)", propsAfterEdit);
1383
1435
  (0, import_lodash_merge.default)(propsAfterEdit, editProps.communityEdit);
1384
1436
  await community.edit(propsAfterEdit);
@@ -1428,10 +1480,10 @@ async function storeComment(community, opts) {
1428
1480
  insertedAt: timestamp(),
1429
1481
  pendingApproval
1430
1482
  };
1431
- const unknownProps = import_commonjs.difference(import_commonjs.keys.strict(commentIpfs), import_commonjs.keys.strict(CommentIpfsSchema.shape)).filter((key) => key !== "communityAddress");
1483
+ const unknownProps = r$1(t$6(commentIpfs), t$6(CommentIpfsSchema.shape)).filter((key) => key !== "communityAddress");
1432
1484
  if (unknownProps.length > 0) {
1433
1485
  log("Found extra props on Comment", unknownProps, "Will be adding them to extraProps column");
1434
- commentRow.extraProps = import_commonjs.pick(commentIpfs, unknownProps);
1486
+ commentRow.extraProps = t$9(commentIpfs, unknownProps);
1435
1487
  }
1436
1488
  if (challengeAggregate?.aggregatedCommentUpdate && Object.keys(challengeAggregate.aggregatedCommentUpdate).length > 0) commentRow.challengeCommentUpdate = challengeAggregate.aggregatedCommentUpdate;
1437
1489
  if (originalCommentSignatureEncoded) commentRow.originalCommentSignatureEncoded = originalCommentSignatureEncoded;
@@ -3202,7 +3254,7 @@ var DbHandler = class {
3202
3254
  "reply",
3203
3255
  "vote"
3204
3256
  ];
3205
- const newSettings = import_commonjs.clone(oldSettings);
3257
+ const newSettings = t$10(oldSettings);
3206
3258
  if (Array.isArray(newSettings.challenges)) {
3207
3259
  newSettings.challenges = newSettings.challenges.filter((cs) => !cs.name || cs.path || cs.name in pkcJsChallenges);
3208
3260
  for (const oldChallengeSetting of newSettings.challenges) if (oldChallengeSetting.exclude) for (const oldExcludeSetting of oldChallengeSetting.exclude) for (const fieldToMove of fieldsToRemove) delete oldExcludeSetting[fieldToMove];
@@ -3395,7 +3447,7 @@ var DbHandler = class {
3395
3447
  const commentToBeEdited = this.queryComment(srcRecord.commentCid);
3396
3448
  if (!commentToBeEdited) throw Error(`Failed to compute isAuthorEdit for ${srcRecord.commentCid}`);
3397
3449
  srcRecord["isAuthorEdit"] = parsedSig.publicKey === commentToBeEdited.signature.publicKey;
3398
- const extraProps = removeNullUndefinedValues(import_commonjs.pick(srcRecord, ["removed"]));
3450
+ const extraProps = removeNullUndefinedValues(t$9(srcRecord, ["removed"]));
3399
3451
  if (Object.keys(extraProps).length > 0) srcRecord.extraProps = {
3400
3452
  ...srcRecord.extraProps,
3401
3453
  ...extraProps
@@ -3406,7 +3458,7 @@ var DbHandler = class {
3406
3458
  srcRecord["authorSignerAddress"] = await getPKCAddressFromPublicKey(sig["publicKey"]);
3407
3459
  }
3408
3460
  if (srcTable === TABLES.COMMENTS) {
3409
- const extraProps = removeNullUndefinedValues(import_commonjs.pick(srcRecord, ["ipnsName"]));
3461
+ const extraProps = removeNullUndefinedValues(t$9(srcRecord, ["ipnsName"]));
3410
3462
  if (Object.keys(extraProps).length > 0) srcRecord.extraProps = {
3411
3463
  ...srcRecord.extraProps,
3412
3464
  ...extraProps
@@ -3527,7 +3579,7 @@ var DbHandler = class {
3527
3579
  }
3528
3580
  const commentEditWithExtraProps = this._spreadExtraProps({ ...commentEditRecord });
3529
3581
  const validRes = await verifyCommentEdit({
3530
- edit: import_commonjs.pick(commentEditWithExtraProps, [...commentEditWithExtraProps.signature.signedPropertyNames, "signature"]),
3582
+ edit: t$9(commentEditWithExtraProps, [...commentEditWithExtraProps.signature.signedPropertyNames, "signature"]),
3531
3583
  resolveAuthorNames: false,
3532
3584
  clientsManager: this._community._clientsManager
3533
3585
  });
@@ -3613,7 +3665,7 @@ var DbHandler = class {
3613
3665
  (cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
3614
3666
  VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
3615
3667
  `);
3616
- const defaults = import_commonjs.mapToObj(columnNames, (column) => [column, null]);
3668
+ const defaults = t$7(columnNames, (column) => [column, null]);
3617
3669
  this._db.transaction((items) => {
3618
3670
  for (const comment of items) {
3619
3671
  const completeComment = {
@@ -3654,7 +3706,7 @@ var DbHandler = class {
3654
3706
  publishedToPostUpdatesMFS = excluded.publishedToPostUpdatesMFS,
3655
3707
  insertedAt = excluded.insertedAt
3656
3708
  `);
3657
- const defaults = import_commonjs.mapToObj(columnNames, (column) => [column, null]);
3709
+ const defaults = t$7(columnNames, (column) => [column, null]);
3658
3710
  this._db.transaction((items) => {
3659
3711
  for (const update of items) {
3660
3712
  const completeUpdate = {
@@ -3674,7 +3726,7 @@ var DbHandler = class {
3674
3726
  (commentCid, author, signature, modSignerAddress, protocolVersion, communityPublicKey, communityName, timestamp, commentModeration, insertedAt, extraProps, targetAuthorSignerAddress, targetAuthorDomain)
3675
3727
  VALUES (@commentCid, @author, @signature, @modSignerAddress, @protocolVersion, @communityPublicKey, @communityName, @timestamp, @commentModeration, @insertedAt, @extraProps, @targetAuthorSignerAddress, @targetAuthorDomain)
3676
3728
  `);
3677
- const defaults = import_commonjs.mapToObj(columnNames, (column) => [column, null]);
3729
+ const defaults = t$7(columnNames, (column) => [column, null]);
3678
3730
  this._db.transaction((items) => {
3679
3731
  for (const mod of items) {
3680
3732
  const completeMod = {
@@ -3694,7 +3746,7 @@ var DbHandler = class {
3694
3746
  (commentCid, authorSignerAddress, author, signature, protocolVersion, communityPublicKey, communityName, timestamp, content, reason, deleted, flairs, spoiler, nsfw, isAuthorEdit, insertedAt, extraProps)
3695
3747
  VALUES (@commentCid, @authorSignerAddress, @author, @signature, @protocolVersion, @communityPublicKey, @communityName, @timestamp, @content, @reason, @deleted, @flairs, @spoiler, @nsfw, @isAuthorEdit, @insertedAt, @extraProps)
3696
3748
  `);
3697
- const defaults = import_commonjs.mapToObj(columnNames, (column) => [column, null]);
3749
+ const defaults = t$7(columnNames, (column) => [column, null]);
3698
3750
  this._db.transaction((items) => {
3699
3751
  for (const edit of items) {
3700
3752
  const completeEdit = {
@@ -3810,8 +3862,8 @@ var DbHandler = class {
3810
3862
  return result.max_timestamp;
3811
3863
  }
3812
3864
  queryPageComments(options) {
3813
- const commentUpdateSelects = import_commonjs.keys.strict(options.commentUpdateFieldsToExclude ? import_commonjs.omit(CommentUpdateSchema.shape, options.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape).map((col) => `${TABLES.COMMENT_UPDATES}.${col} AS commentUpdate_${col}`);
3814
- const commentIpfsSelects = [...import_commonjs.keys.strict(CommentIpfsSchema.shape), "extraProps"].map((col) => `${TABLES.COMMENTS}.${col} AS commentIpfs_${col}`);
3865
+ const commentUpdateSelects = t$6(options.commentUpdateFieldsToExclude ? n$3(CommentUpdateSchema.shape, options.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape).map((col) => `${TABLES.COMMENT_UPDATES}.${col} AS commentUpdate_${col}`);
3866
+ const commentIpfsSelects = [...t$6(CommentIpfsSchema.shape), "extraProps"].map((col) => `${TABLES.COMMENTS}.${col} AS commentIpfs_${col}`);
3815
3867
  const { whereClauses, params } = this._buildPageQueryParts(options);
3816
3868
  const queryStr = `
3817
3869
  SELECT ${commentIpfsSelects.join(", ")}, ${commentUpdateSelects.join(", ")}
@@ -3827,8 +3879,8 @@ var DbHandler = class {
3827
3879
  });
3828
3880
  }
3829
3881
  queryPageCommentsWithResolvedReplies(options) {
3830
- const commentUpdateCols = import_commonjs.keys.strict(CommentUpdateSchema.shape);
3831
- const commentIpfsCols = [...import_commonjs.keys.strict(CommentIpfsSchema.shape), "extraProps"];
3882
+ const commentUpdateCols = t$6(CommentUpdateSchema.shape);
3883
+ const commentIpfsCols = [...t$6(CommentIpfsSchema.shape), "extraProps"];
3832
3884
  const baseCommentUpdateSelects = commentUpdateCols.map((col) => `${TABLES.COMMENT_UPDATES}.${col} AS commentUpdate_${col}`);
3833
3885
  const baseCommentIpfsSelects = commentIpfsCols.map((col) => `${TABLES.COMMENTS}.${col} AS commentIpfs_${col}`);
3834
3886
  const recCommentUpdateSelects = commentUpdateCols.map((col) => `cu2.${col} AS commentUpdate_${col}`);
@@ -3924,8 +3976,8 @@ var DbHandler = class {
3924
3976
  }));
3925
3977
  }
3926
3978
  resolveRepliesCidRefsForEntries(entries) {
3927
- const commentUpdateCols = import_commonjs.keys.strict(CommentUpdateSchema.shape);
3928
- const commentIpfsCols = [...import_commonjs.keys.strict(CommentIpfsSchema.shape), "extraProps"];
3979
+ const commentUpdateCols = t$6(CommentUpdateSchema.shape);
3980
+ const commentIpfsCols = [...t$6(CommentIpfsSchema.shape), "extraProps"];
3929
3981
  const allCids = [];
3930
3982
  for (const entry of entries) {
3931
3983
  const replies = entry.commentUpdate.replies;
@@ -4059,9 +4111,9 @@ var DbHandler = class {
4059
4111
  });
4060
4112
  }
4061
4113
  queryFlattenedPageReplies(options) {
4062
- const commentUpdateCols = import_commonjs.keys.strict(options.commentUpdateFieldsToExclude ? import_commonjs.omit(CommentUpdateSchema.shape, options.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape);
4114
+ const commentUpdateCols = t$6(options.commentUpdateFieldsToExclude ? n$3(CommentUpdateSchema.shape, options.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape);
4063
4115
  commentUpdateCols.map((col) => `c_updates.${col} AS commentUpdate_${col}`);
4064
- const commentIpfsSelects = [...import_commonjs.keys.strict(CommentIpfsSchema.shape), "extraProps"].map((col) => `comments_alias.${col} AS commentIpfs_${col}`);
4116
+ const commentIpfsSelects = [...t$6(CommentIpfsSchema.shape), "extraProps"].map((col) => `comments_alias.${col} AS commentIpfs_${col}`);
4065
4117
  let baseWhereClausesStr = "";
4066
4118
  let recursiveWhereClausesStr = "";
4067
4119
  const params = [options.parentCid];
@@ -4560,8 +4612,8 @@ var DbHandler = class {
4560
4612
  if (!row) return void 0;
4561
4613
  const parsed = this._spreadExtraProps(this._parseCommentEditsRow(row));
4562
4614
  const signedKeys = parsed.signature.signedPropertyNames;
4563
- const commentEditFields = import_commonjs.keys.strict(CommentEditPubsubMessagePublicationSchema.shape);
4564
- return import_commonjs.pick(parsed, [
4615
+ const commentEditFields = t$6(CommentEditPubsubMessagePublicationSchema.shape);
4616
+ return t$9(parsed, [
4565
4617
  "signature",
4566
4618
  ...signedKeys,
4567
4619
  ...commentEditFields
@@ -4700,7 +4752,7 @@ var DbHandler = class {
4700
4752
  `;
4701
4753
  const flags = this._db.prepare(query).get(cid);
4702
4754
  if (!flags) return {};
4703
- return import_commonjs.mapValues(removeNullUndefinedValues(flags), Boolean);
4755
+ return t$12(removeNullUndefinedValues(flags), Boolean);
4704
4756
  }
4705
4757
  queryAuthorEditDeleted(cid) {
4706
4758
  const result = this._db.prepare(`
@@ -4923,11 +4975,11 @@ var DbHandler = class {
4923
4975
  }
4924
4976
  const authorPosts = authorCommentsData.filter((c) => c.depth === 0);
4925
4977
  const authorReplies = authorCommentsData.filter((c) => c.depth > 0);
4926
- const postScore = import_commonjs.sumBy(authorPosts, (p) => p.upvoteCount) - import_commonjs.sumBy(authorPosts, (p) => p.downvoteCount);
4927
- const replyScore = import_commonjs.sumBy(authorReplies, (r) => r.upvoteCount) - import_commonjs.sumBy(authorReplies, (r) => r.downvoteCount);
4928
- const lastCommentCid = import_commonjs.maxBy(authorCommentsData, (c) => c.rowid)?.cid;
4978
+ const postScore = t(authorPosts, (p) => p.upvoteCount) - t(authorPosts, (p) => p.downvoteCount);
4979
+ const replyScore = t(authorReplies, (r) => r.upvoteCount) - t(authorReplies, (r) => r.downvoteCount);
4980
+ const lastCommentCid = n$5(authorCommentsData, [(c) => c.rowid, "desc"])?.cid;
4929
4981
  if (!lastCommentCid) throw Error("Failed to query communityAuthor.lastCommentCid");
4930
- const firstCommentTimestamp = import_commonjs.minBy(authorCommentsData, (c) => c.rowid)?.timestamp;
4982
+ const firstCommentTimestamp = n$5(authorCommentsData, (c) => c.rowid)?.timestamp;
4931
4983
  if (typeof firstCommentTimestamp !== "number") throw Error("Failed to query communityAuthor.firstCommentTimestamp");
4932
4984
  return {
4933
4985
  postScore,
@@ -5014,7 +5066,7 @@ var DbHandler = class {
5014
5066
  if (allCommentsToUpdate.length > 0) this.forceUpdateOnAllCommentsWithCid(allCommentsToUpdate);
5015
5067
  }
5016
5068
  if (!isNestedCall) this.commitTransaction();
5017
- return import_commonjs.uniqueBy(purgedRecords, (record) => record.commentTableRow.cid);
5069
+ return n(purgedRecords, (record) => record.commentTableRow.cid);
5018
5070
  } catch (error) {
5019
5071
  log.error(`Error during comment purge for ${cid}: ${error}`);
5020
5072
  if (!isNestedCall) this.rollbackTransaction();
@@ -5188,9 +5240,9 @@ var DbHandler = class {
5188
5240
  ${activeScoreDescendantWhere}
5189
5241
  ) SELECT post_cid, MAX(timestamp) as active_score FROM descendants GROUP BY post_cid
5190
5242
  `;
5191
- const commentUpdateSelects = import_commonjs.keys.strict(pageOptions.commentUpdateFieldsToExclude ? import_commonjs.omit(CommentUpdateSchema.shape, pageOptions.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape).map((col) => `cu.${col} AS commentUpdate_${col}`);
5243
+ const commentUpdateSelects = t$6(pageOptions.commentUpdateFieldsToExclude ? n$3(CommentUpdateSchema.shape, pageOptions.commentUpdateFieldsToExclude) : CommentUpdateSchema.shape).map((col) => `cu.${col} AS commentUpdate_${col}`);
5192
5244
  let postsQueryStr = `
5193
- SELECT ${[...import_commonjs.keys.strict(CommentIpfsSchema.shape), "extraProps"].map((col) => `c.${col} AS commentIpfs_${col}`).join(", ")}, ${commentUpdateSelects.join(", ")}, asc_scores.active_score
5245
+ SELECT ${[...t$6(CommentIpfsSchema.shape), "extraProps"].map((col) => `c.${col} AS commentIpfs_${col}`).join(", ")}, ${commentUpdateSelects.join(", ")}, asc_scores.active_score
5194
5246
  FROM ${TABLES.COMMENTS} c INNER JOIN ${TABLES.COMMENT_UPDATES} cu ON c.cid = cu.cid
5195
5247
  INNER JOIN (${activeScoresCte}) AS asc_scores ON c.cid = asc_scores.post_cid
5196
5248
  `;
@@ -5220,7 +5272,7 @@ var DbHandler = class {
5220
5272
  _processRecordsForDbBeforeInsert(records) {
5221
5273
  return records.map((record) => {
5222
5274
  const processed = { ...record };
5223
- for (const [key, value] of import_commonjs.entries(processed)) if (import_commonjs.isPlainObject(value) || Array.isArray(value)) processed[key] = JSON.stringify(value);
5275
+ for (const [key, value] of t$2(processed)) if (e(value) || Array.isArray(value)) processed[key] = JSON.stringify(value);
5224
5276
  else if (typeof value === "boolean") processed[key] = value ? 1 : 0;
5225
5277
  return processed;
5226
5278
  });
@@ -5454,7 +5506,7 @@ var PageGenerator = class {
5454
5506
  const timestampLower = options.baseTimestamp - TIMEFRAMES_TO_SECONDS[sortProps.timeframe];
5455
5507
  unpinnedComments = unpinnedComments.filter((obj) => obj.comment.timestamp >= timestampLower);
5456
5508
  }
5457
- const commentsSorted = pinnedComments.concat(unpinnedComments).map((comment) => import_commonjs.omit(comment, ["activeScore"]));
5509
+ const commentsSorted = pinnedComments.concat(unpinnedComments).map((comment) => n$3(comment, ["activeScore"]));
5458
5510
  if (commentsSorted.length === 0) return [];
5459
5511
  return await this._chunkComments({
5460
5512
  comments: commentsSorted,
@@ -5501,7 +5553,7 @@ var PageGenerator = class {
5501
5553
  if (preloadedChunk.length === 1) return { singlePreloadedPage: { [preloadedPageSortName]: { comments: preloadedChunk[0] } } };
5502
5554
  const sortResults = [];
5503
5555
  sortResults.push(await this.addPreloadedCommentChunksToIpfs(preloadedChunk, preloadedPageSortName));
5504
- const nonPreloadedSorts = import_commonjs.keys.strict(POSTS_SORT_TYPES).filter((sortName) => sortName !== preloadedPageSortName);
5556
+ const nonPreloadedSorts = t$6(POSTS_SORT_TYPES).filter((sortName) => sortName !== preloadedPageSortName);
5505
5557
  await Promise.all(nonPreloadedSorts.map(async (sortName) => {
5506
5558
  sortResults.push(await this.sortChunkAddIpfsNonPreloaded(rawPosts, sortName, {
5507
5559
  ...pageOptions,
@@ -5573,7 +5625,7 @@ var PageGenerator = class {
5573
5625
  firstPageSizeBytes: 1024 * 1024
5574
5626
  }));
5575
5627
  else sortResults.push(await this.addPreloadedCommentChunksToIpfs(preloadedChunk, preloadedReplyPageSortName));
5576
- const nonPreloadedSorts = import_commonjs.keys.strict(POST_REPLIES_SORT_TYPES).filter((sortName) => sortName !== preloadedReplyPageSortName);
5628
+ const nonPreloadedSorts = t$6(POST_REPLIES_SORT_TYPES).filter((sortName) => sortName !== preloadedReplyPageSortName);
5577
5629
  const flattenedReplies = this._community._dbHandler.queryFlattenedPageReplies({
5578
5630
  ...pageOptions,
5579
5631
  commentUpdateFieldsToExclude: ["replies"]
@@ -5613,7 +5665,7 @@ var PageGenerator = class {
5613
5665
  });
5614
5666
  const disablePreload = await getSerializedCommentsSize(preloadedChunk[0], preloadedChunk.length > 1) > preloadedPageSizeBytes;
5615
5667
  if (!disablePreload && preloadedChunk.length === 1) return { singlePreloadedPage: { [preloadedReplyPageSortName]: { comments: preloadedChunk[0] } } };
5616
- const nonPreloadedSorts = import_commonjs.keys.strict(REPLY_REPLIES_SORT_TYPES).filter((sortName) => sortName !== preloadedReplyPageSortName);
5668
+ const nonPreloadedSorts = t$6(REPLY_REPLIES_SORT_TYPES).filter((sortName) => sortName !== preloadedReplyPageSortName);
5617
5669
  const sortResults = [];
5618
5670
  if (disablePreload) sortResults.push(await this.sortChunkAddIpfsNonPreloaded(hierarchalReplies, preloadedReplyPageSortName, {
5619
5671
  ...pageOptions,
@@ -5684,7 +5736,7 @@ async function getDbInternalState(community, lock) {
5684
5736
  }
5685
5737
  async function updateDbInternalState(community, props) {
5686
5738
  const log = logger_default("pkc-js:local-community:_updateDbInternalState");
5687
- if (import_commonjs.isEmpty(props)) throw Error("props to update DB internal state should not be empty");
5739
+ if (e$1(props)) throw Error("props to update DB internal state should not be empty");
5688
5740
  await community._dbHandler.initDbIfNeeded();
5689
5741
  props._internalStateUpdateId = v4();
5690
5742
  let lockedIt = false;
@@ -5779,7 +5831,7 @@ async function setChallengesToDefaultIfNotDefined(community, log) {
5779
5831
  if (community._usingDefaultChallenge) {
5780
5832
  const currentAnswer = community.settings?.challenges?.[0]?.options?.answer;
5781
5833
  if (currentAnswer && isDefaultChallengeStructure(community._defaultCommunityChallenges)) community._defaultCommunityChallenges = generateDefaultChallenges(currentAnswer);
5782
- if (!import_commonjs.isDeepEqual(community.settings?.challenges, community._defaultCommunityChallenges)) {
5834
+ if (!t$11(community.settings?.challenges, community._defaultCommunityChallenges)) {
5783
5835
  await community.edit({ settings: {
5784
5836
  ...community.settings,
5785
5837
  challenges: community._defaultCommunityChallenges
@@ -5795,7 +5847,7 @@ async function createNewLocalCommunityDb(community) {
5795
5847
  await community._dbHandler.initDbIfNeeded({ fileMustExist: false });
5796
5848
  await community._dbHandler.createOrMigrateTablesIfNeeded();
5797
5849
  await initSignerProps(community, community.signer);
5798
- if (!community.pubsubTopic) community.pubsubTopic = import_commonjs.clone(community.signer.address);
5850
+ if (!community.pubsubTopic) community.pubsubTopic = t$10(community.signer.address);
5799
5851
  if (typeof community.createdAt !== "number") community.createdAt = timestamp();
5800
5852
  if (!community.protocolVersion) community.protocolVersion = version_default.PROTOCOL_VERSION;
5801
5853
  if (!community.settings?.maxPendingApprovalCount) community.settings = {
@@ -5858,9 +5910,9 @@ async function initInternalCommunityAfterFirstUpdateNoMerge(community, newProps)
5858
5910
  }
5859
5911
  const keysOfCommunityIpfs = [...CommunitySignedPropertyNames, "signature"];
5860
5912
  community.initRpcInternalCommunityAfterFirstUpdateNoMerge({
5861
- community: import_commonjs.pick(newProps, keysOfCommunityIpfs),
5913
+ community: t$9(newProps, keysOfCommunityIpfs),
5862
5914
  localCommunity: {
5863
- signer: import_commonjs.pick(newProps.signer, [
5915
+ signer: t$9(newProps.signer, [
5864
5916
  "publicKey",
5865
5917
  "address",
5866
5918
  "shortAddress",
@@ -5884,12 +5936,12 @@ async function initInternalCommunityAfterFirstUpdateNoMerge(community, newProps)
5884
5936
  }
5885
5937
  async function initInternalCommunityBeforeFirstUpdateNoMerge(community, newProps) {
5886
5938
  community.initRpcInternalCommunityBeforeFirstUpdateNoMerge({ localCommunity: {
5887
- ...import_commonjs.omit(newProps, [
5939
+ ...n$3(newProps, [
5888
5940
  "signer",
5889
5941
  "_internalStateUpdateId",
5890
5942
  "_pendingEditProps"
5891
5943
  ]),
5892
- signer: import_commonjs.pick(newProps.signer, [
5944
+ signer: t$9(newProps.signer, [
5893
5945
  "publicKey",
5894
5946
  "address",
5895
5947
  "shortAddress",
@@ -5962,7 +6014,7 @@ async function calculateNewPostUpdates(community) {
5962
6014
  });
5963
6015
  if (statRes.blocks !== 0) postUpdates[String(timeBucket)] = String(statRes.cid);
5964
6016
  } catch {}
5965
- if (import_commonjs.isEmpty(postUpdates)) return void 0;
6017
+ if (e$1(postUpdates)) return void 0;
5966
6018
  return postUpdates;
5967
6019
  }
5968
6020
  function calculateLatestUpdateTrigger(community) {
@@ -6005,7 +6057,7 @@ async function addOldPageCidsToCidsToUnpin(community, curPages, newPages, addToB
6005
6057
  pages: newPages,
6006
6058
  clientManager: community._clientsManager
6007
6059
  });
6008
- import_commonjs.difference(allPageCidsUnderCurPages, allPageCidsUnderNewPages).forEach((cid) => {
6060
+ r$1(n$4(allPageCidsUnderCurPages), allPageCidsUnderNewPages).forEach((cid) => {
6009
6061
  community._cidsToUnPin.add(cid);
6010
6062
  if (addToBlockRm) community._blocksToRm.push(cid);
6011
6063
  });
@@ -6053,10 +6105,10 @@ async function calculateNextCommunityRecord(community, commentUpdateRowsToPublis
6053
6105
  const currentTimestamp = timestamp();
6054
6106
  const updatedAt = typeof community?.updatedAt === "number" && community.updatedAt >= currentTimestamp ? community.updatedAt + 1 : currentTimestamp;
6055
6107
  const editIdsToIncludeInNextUpdate = community._pendingEditProps.map((editProps) => editProps.editId);
6056
- const pendingCommunityIpfsEditProps = Object.assign({}, ...community._pendingEditProps.map((editProps) => import_commonjs.pick(editProps, import_commonjs.keys.strict(CommunityIpfsSchema.shape))));
6108
+ const pendingCommunityIpfsEditProps = Object.assign({}, ...community._pendingEditProps.map((editProps) => t$9(editProps, t$6(CommunityIpfsSchema.shape))));
6057
6109
  if (community._pendingEditProps.length > 0) log("Including edit props in next IPNS update", community._pendingEditProps);
6058
6110
  const newIpns = { ...cleanUpBeforePublishing({
6059
- ...import_commonjs.omit(community._toJSONIpfsBaseNoPosts(), ["signature"]),
6111
+ ...n$3(community._toJSONIpfsBaseNoPosts(), ["signature"]),
6060
6112
  ...pendingCommunityIpfsEditProps,
6061
6113
  lastPostCid: latestPost?.cid,
6062
6114
  lastCommentCid: latestComment?.cid,
@@ -6075,7 +6127,7 @@ async function calculateNextCommunityRecord(community, commentUpdateRowsToPublis
6075
6127
  if ("singlePreloadedPage" in generatedPosts) newIpns.posts = { pages: generatedPosts.singlePreloadedPage };
6076
6128
  else if (generatedPosts.pageCids) newIpns.posts = {
6077
6129
  pageCids: generatedPosts.pageCids,
6078
- pages: import_commonjs.pick(generatedPosts.pages, [preloadedPostsPages])
6130
+ pages: t$9(generatedPosts.pages, [preloadedPostsPages])
6079
6131
  };
6080
6132
  } else await community._updateDbInternalState({ posts: void 0 });
6081
6133
  {
@@ -6160,7 +6212,7 @@ async function publishCommunityRecordToIpns(community, build, newCommunityRecord
6160
6212
  community.updateCid = file.path;
6161
6213
  community._pendingEditProps = community._pendingEditProps.filter((editProps) => !editIdsToIncludeInNextUpdate.includes(editProps.editId));
6162
6214
  if (community._pendingEditProps.length > 0) {
6163
- const remainingEditProps = Object.assign({}, ...community._pendingEditProps.map((editProps) => import_commonjs.pick(editProps, import_commonjs.keys.strict(CommunityIpfsSchema.shape))));
6215
+ const remainingEditProps = Object.assign({}, ...community._pendingEditProps.map((editProps) => t$9(editProps, t$6(CommunityIpfsSchema.shape))));
6164
6216
  Object.assign(community, remainingEditProps);
6165
6217
  }
6166
6218
  community._communityUpdateTrigger = false;
@@ -6222,11 +6274,10 @@ async function getBrowserDialableSelfAddrs(client) {
6222
6274
  const idRes = await client.id();
6223
6275
  const peerId = idRes.id.toString();
6224
6276
  const swarmListeningAddresses = (await client.swarm.addrs()).filter((swarmAddr) => swarmAddr.id.toString() === peerId);
6225
- const normalized = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...import_commonjs.flatten(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
6226
- return import_commonjs.unique(normalized.filter(isBrowserDialableAddr)).sort();
6277
+ return n$4(normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...n$6(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId).filter(isBrowserDialableAddr)).sort();
6227
6278
  }
6228
6279
  function connectionCriticalCids(community) {
6229
- return import_commonjs.unique([community.pubsubTopicRoutingCid, community.ipnsPubsubTopicRoutingCid].filter((cid) => typeof cid === "string"));
6280
+ return n$4([community.pubsubTopicRoutingCid, community.ipnsPubsubTopicRoutingCid].filter((cid) => typeof cid === "string"));
6230
6281
  }
6231
6282
  /**
6232
6283
  * Re-provide the connection-critical CIDs when the node's browser-dialable (WSS/WebRTC) self-addresses
@@ -6249,7 +6300,7 @@ async function reprovideConnectionCidsIfBrowserAddrsChanged(community) {
6249
6300
  browserAddrs: current
6250
6301
  };
6251
6302
  }
6252
- if (import_commonjs.isDeepEqual(previous, current)) return {
6303
+ if (t$11(previous, current)) return {
6253
6304
  reprovided: false,
6254
6305
  providedCids: [],
6255
6306
  browserAddrs: current
@@ -6435,7 +6486,7 @@ async function initMirroringStartedOrUpdatingCommunity(community, startedCommuni
6435
6486
  community._mirroredStartedOrUpdatingCommunity.community.on("challengeverification", community._mirroredStartedOrUpdatingCommunity.challengeverification);
6436
6487
  community._mirroredStartedOrUpdatingCommunity.community.on("challengeanswer", community._mirroredStartedOrUpdatingCommunity.challengeanswer);
6437
6488
  community._mirroredStartedOrUpdatingCommunity.community.on("challenge", community._mirroredStartedOrUpdatingCommunity.challenge);
6438
- const clientKeys = import_commonjs.keys.strict(community.clients);
6489
+ const clientKeys = t$6(community.clients);
6439
6490
  for (const clientType of clientKeys) if (community.clients[clientType]) {
6440
6491
  for (const clientUrl of Object.keys(community.clients[clientType])) if (clientUrl in community._mirroredStartedOrUpdatingCommunity.community.clients[clientType]) community.clients[clientType][clientUrl].mirror(community._mirroredStartedOrUpdatingCommunity.community.clients[clientType][clientUrl]);
6441
6492
  }
@@ -6454,7 +6505,7 @@ async function cleanUpMirroredStartedOrUpdatingCommunity(community) {
6454
6505
  community._mirroredStartedOrUpdatingCommunity.community.removeListener("challengeverification", community._mirroredStartedOrUpdatingCommunity.challengeverification);
6455
6506
  community._mirroredStartedOrUpdatingCommunity.community.removeListener("challengeanswer", community._mirroredStartedOrUpdatingCommunity.challengeanswer);
6456
6507
  community._mirroredStartedOrUpdatingCommunity.community.removeListener("challenge", community._mirroredStartedOrUpdatingCommunity.challenge);
6457
- const clientKeys = import_commonjs.keys.strict(community.clients);
6508
+ const clientKeys = t$6(community.clients);
6458
6509
  for (const clientType of clientKeys) if (community.clients[clientType]) for (const clientUrl of Object.keys(community.clients[clientType])) community.clients[clientType][clientUrl].unmirror();
6459
6510
  community._mirroredStartedOrUpdatingCommunity = void 0;
6460
6511
  }
@@ -6484,7 +6535,7 @@ async function updateOnce(community) {
6484
6535
  return;
6485
6536
  }
6486
6537
  trackUpdatingCommunity(community._pkc, community);
6487
- const oldUpdateId = import_commonjs.clone(community._internalStateUpdateId);
6538
+ const oldUpdateId = t$10(community._internalStateUpdateId);
6488
6539
  await updateInstancePropsWithStartedCommunityOrDb(community);
6489
6540
  if (community._internalStateUpdateId !== oldUpdateId) {
6490
6541
  log(`Local Community (${community.address}) received a new update from db with updatedAt (${community.updatedAt}). Will emit an update event`);
@@ -6686,7 +6737,7 @@ async function parseRolesToEdit(community, newRawRoles) {
6686
6737
  if (!resolved) throw new PKCError("ERR_ROLE_ADDRESS_NAME_COULD_NOT_BE_RESOLVED", { roleAddress });
6687
6738
  }
6688
6739
  }
6689
- return import_commonjs.omitBy(newRawRoles, (val, key) => val === void 0 || val === null);
6740
+ return t$8(newRawRoles, (val, key) => val === void 0 || val === null);
6690
6741
  }
6691
6742
  async function parseChallengesToEdit(community, newChallengeSettings) {
6692
6743
  return {
@@ -6711,7 +6762,7 @@ async function validateNewAddressBeforeEditing(community, newAddress, log) {
6711
6762
  }
6712
6763
  async function editPropsOnStartedCommunity(community, parsedEditOptions) {
6713
6764
  const log = logger_default("pkc-js:local-community:start:editPropsOnStartedCommunity");
6714
- const oldAddress = import_commonjs.clone(community.address);
6765
+ const oldAddress = t$10(community.address);
6715
6766
  if (typeof parsedEditOptions.address === "string" && community.address !== parsedEditOptions.address) {
6716
6767
  await validateNewAddressBeforeEditing(community, parsedEditOptions.address, log);
6717
6768
  log(`Attempting to edit community.address from ${oldAddress} to ${parsedEditOptions.address}. We will stop community first`);
@@ -6738,7 +6789,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions) {
6738
6789
  _internalStateUpdateId: uniqueEditId
6739
6790
  });
6740
6791
  community._communityUpdateTrigger = true;
6741
- log(`Community (${community.address}) props (${import_commonjs.keys.strict(parsedEditOptions)}) has been edited. Will be including edited props in next update: `, import_commonjs.pick(community, import_commonjs.keys.strict(parsedEditOptions)));
6792
+ log(`Community (${community.address}) props (${t$6(parsedEditOptions)}) has been edited. Will be including edited props in next update: `, t$9(community, t$6(parsedEditOptions)));
6742
6793
  community.emit("update", community);
6743
6794
  if (community.address !== oldAddress) {
6744
6795
  trackStartedCommunity(community._pkc, community);
@@ -6748,7 +6799,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions) {
6748
6799
  }
6749
6800
  async function editPropsOnNotStartedCommunity(community, parsedEditOptions) {
6750
6801
  const log = logger_default("pkc-js:local-community:edit:editPropsOnNotStartedCommunity");
6751
- const oldAddress = import_commonjs.clone(community.address);
6802
+ const oldAddress = t$10(community.address);
6752
6803
  await community.initDbHandlerIfNeeded();
6753
6804
  await community._dbHandler.initDbIfNeeded();
6754
6805
  if (typeof parsedEditOptions.address === "string" && community.address !== parsedEditOptions.address) {
@@ -6801,7 +6852,7 @@ async function edit(community, newCommunityOptions) {
6801
6852
  ...editWithDerivedName?.settings?.challenges ? await parseChallengesToEdit(community, editWithDerivedName.settings.challenges) : void 0
6802
6853
  };
6803
6854
  const newProps = {
6804
- ...import_commonjs.omit(editWithDerivedName, ["roles"]),
6855
+ ...n$3(editWithDerivedName, ["roles"]),
6805
6856
  ...newInternalProps
6806
6857
  };
6807
6858
  if (!community.started && !startedCommunity) return editPropsOnNotStartedCommunity(community, newProps);
@@ -7050,9 +7101,9 @@ var LocalCommunity = class extends RpcLocalCommunity {
7050
7101
  const rpcJson = this.toJSONInternalRpcAfterFirstUpdate();
7051
7102
  return {
7052
7103
  ...rpcJson.community,
7053
- ...import_commonjs.omit(rpcJson.localCommunity, ["started", "startedState"]),
7104
+ ...n$3(rpcJson.localCommunity, ["started", "startedState"]),
7054
7105
  updateCid: rpcJson.runtimeFields.updateCid,
7055
- signer: import_commonjs.pick(this.signer, [
7106
+ signer: t$9(this.signer, [
7056
7107
  "privateKey",
7057
7108
  "type",
7058
7109
  "address",
@@ -7066,10 +7117,9 @@ var LocalCommunity = class extends RpcLocalCommunity {
7066
7117
  };
7067
7118
  }
7068
7119
  toJSONInternalBeforeFirstUpdate() {
7069
- const rpcJson = this.toJSONInternalRpcBeforeFirstUpdate();
7070
7120
  return {
7071
- ...import_commonjs.omit(rpcJson.localCommunity, ["started", "startedState"]),
7072
- signer: import_commonjs.pick(this.signer, [
7121
+ ...n$3(this.toJSONInternalRpcBeforeFirstUpdate().localCommunity, ["started", "startedState"]),
7122
+ signer: t$9(this.signer, [
7073
7123
  "privateKey",
7074
7124
  "type",
7075
7125
  "address",
@@ -7086,7 +7136,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
7086
7136
  ...base,
7087
7137
  localCommunity: {
7088
7138
  ...base.localCommunity,
7089
- signer: import_commonjs.pick(this.signer, [
7139
+ signer: t$9(this.signer, [
7090
7140
  "publicKey",
7091
7141
  "address",
7092
7142
  "shortAddress",
@@ -7098,7 +7148,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
7098
7148
  toJSONInternalRpcBeforeFirstUpdate() {
7099
7149
  return { localCommunity: {
7100
7150
  ...super.toJSONInternalRpcBeforeFirstUpdate().localCommunity,
7101
- signer: import_commonjs.pick(this.signer, [
7151
+ signer: t$9(this.signer, [
7102
7152
  "publicKey",
7103
7153
  "address",
7104
7154
  "shortAddress",