@pkcprotocol/pkc-js 0.0.128 → 0.0.129

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 (102) hide show
  1. package/README.md +16 -5
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +8 -3
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  5. package/dist/browser/clients/rpc-client/schema.d.ts +10 -1
  6. package/dist/browser/clients/rpc-client/schema.js +8 -1
  7. package/dist/browser/clients/rpc-client/schema.js.map +1 -1
  8. package/dist/browser/clients/rpc-client/types.d.ts +5 -1
  9. package/dist/browser/community/communities-entry-util.d.ts +14 -0
  10. package/dist/browser/community/communities-entry-util.js +20 -0
  11. package/dist/browser/community/communities-entry-util.js.map +1 -0
  12. package/dist/browser/errors.d.ts +1 -0
  13. package/dist/browser/errors.js +1 -0
  14. package/dist/browser/errors.js.map +1 -1
  15. package/dist/browser/generated-version.d.ts +1 -1
  16. package/dist/browser/generated-version.js +1 -1
  17. package/dist/browser/pkc/pkc-with-rpc-client.d.ts +2 -0
  18. package/dist/browser/pkc/pkc-with-rpc-client.js +66 -3
  19. package/dist/browser/pkc/pkc-with-rpc-client.js.map +1 -1
  20. package/dist/browser/pkc/pkc.d.ts +5 -3
  21. package/dist/browser/pkc/pkc.js +15 -10
  22. package/dist/browser/pkc/pkc.js.map +1 -1
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/rpc/src/index.js +10 -8
  25. package/dist/browser/rpc/src/index.js.map +1 -1
  26. package/dist/browser/runtime/browser/util.d.ts +1 -0
  27. package/dist/browser/runtime/browser/util.js +3 -0
  28. package/dist/browser/runtime/browser/util.js.map +1 -1
  29. package/dist/browser/runtime/node/community/db-handler.js +2 -4
  30. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  31. package/dist/browser/runtime/node/community/local-community/editing.js +13 -6
  32. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  33. package/dist/browser/runtime/node/community/local-community.js +9 -1
  34. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  35. package/dist/browser/runtime/node/community/start-lock.d.ts +8 -0
  36. package/dist/browser/runtime/node/community/start-lock.js +18 -0
  37. package/dist/browser/runtime/node/community/start-lock.js.map +1 -0
  38. package/dist/browser/runtime/node/util.d.ts +6 -0
  39. package/dist/browser/runtime/node/util.js +106 -8
  40. package/dist/browser/runtime/node/util.js.map +1 -1
  41. package/dist/browser/test/test-util.d.ts +20 -0
  42. package/dist/browser/test/test-util.js +25 -0
  43. package/dist/browser/test/test-util.js.map +1 -1
  44. package/dist/browser/types.d.ts +7 -3
  45. package/dist/bundled/bundle-manifest.json +65 -63
  46. package/dist/bundled/challenges.js +1 -1
  47. package/dist/bundled/chunks/{helia-for-pkc-6kkeZX1a.js → helia-for-pkc-Cg_zH9dT.js} +31 -31
  48. package/dist/bundled/chunks/{local-community-BST1U_f3.js → local-community-CufTrjaK.js} +1 -1
  49. package/dist/bundled/chunks/{local-community-B79BAYRo.js → local-community-Gj16RMFM.js} +18 -1381
  50. package/dist/bundled/chunks/{node-BEH8NA_I.js → node-jDoQBCgW.js} +76 -16
  51. package/dist/bundled/chunks/{page-sort-scoring-2FkqYYNf.js → page-sort-scoring-B53_j_WT.js} +1 -1
  52. package/dist/bundled/chunks/{rpc-local-community-SmLDPm1j.js → rpc-local-community-9DP4Rskv.js} +1571 -48
  53. package/dist/bundled/chunks/{util-jyIDYw_Q.js → util-CxVo5EMD.js} +1 -1
  54. package/dist/bundled/chunks/{util-LwSS90AE.js → util-D7gst5MT.js} +20 -19
  55. package/dist/bundled/chunks/{validate-package-factories-_KKnb8At.js → validate-package-factories-D2LBnQVu.js} +2 -2
  56. package/dist/bundled/index.js +1 -1
  57. package/dist/bundled/page-sorts.js +1 -1
  58. package/dist/bundled/rpc/src/index.js +10 -9
  59. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  60. package/dist/node/clients/rpc-client/pkc-rpc-client.js +8 -3
  61. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  62. package/dist/node/clients/rpc-client/schema.d.ts +10 -1
  63. package/dist/node/clients/rpc-client/schema.js +8 -1
  64. package/dist/node/clients/rpc-client/schema.js.map +1 -1
  65. package/dist/node/clients/rpc-client/types.d.ts +5 -1
  66. package/dist/node/community/communities-entry-util.d.ts +14 -0
  67. package/dist/node/community/communities-entry-util.js +20 -0
  68. package/dist/node/community/communities-entry-util.js.map +1 -0
  69. package/dist/node/errors.d.ts +1 -0
  70. package/dist/node/errors.js +1 -0
  71. package/dist/node/errors.js.map +1 -1
  72. package/dist/node/generated-version.d.ts +1 -1
  73. package/dist/node/generated-version.js +1 -1
  74. package/dist/node/pkc/pkc-with-rpc-client.d.ts +2 -0
  75. package/dist/node/pkc/pkc-with-rpc-client.js +66 -3
  76. package/dist/node/pkc/pkc-with-rpc-client.js.map +1 -1
  77. package/dist/node/pkc/pkc.d.ts +5 -3
  78. package/dist/node/pkc/pkc.js +15 -10
  79. package/dist/node/pkc/pkc.js.map +1 -1
  80. package/dist/node/pkc-error.d.ts +1 -1
  81. package/dist/node/rpc/src/index.js +10 -8
  82. package/dist/node/rpc/src/index.js.map +1 -1
  83. package/dist/node/runtime/browser/util.d.ts +1 -0
  84. package/dist/node/runtime/browser/util.js +3 -0
  85. package/dist/node/runtime/browser/util.js.map +1 -1
  86. package/dist/node/runtime/node/community/db-handler.js +2 -4
  87. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  88. package/dist/node/runtime/node/community/local-community/editing.js +13 -6
  89. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  90. package/dist/node/runtime/node/community/local-community.js +9 -1
  91. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  92. package/dist/node/runtime/node/community/start-lock.d.ts +8 -0
  93. package/dist/node/runtime/node/community/start-lock.js +18 -0
  94. package/dist/node/runtime/node/community/start-lock.js.map +1 -0
  95. package/dist/node/runtime/node/util.d.ts +6 -0
  96. package/dist/node/runtime/node/util.js +106 -8
  97. package/dist/node/runtime/node/util.js.map +1 -1
  98. package/dist/node/test/test-util.d.ts +20 -0
  99. package/dist/node/test/test-util.js +25 -0
  100. package/dist/node/test/test-util.js.map +1 -1
  101. package/dist/node/types.d.ts +7 -3
  102. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, Ar as e$4, Bn as CommentUpdateReservedFields, Br as require_supports_color, C as hideClassPrivateProps, Cn as areEquivalentNames, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VotePubsubMessagePublicationSchema, Dr as r$7, Dt as require_sha256$1, E as isAbortError, En as VoteChallengeRequestToEncryptSchema, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as CreateCommentOptionsWithRefinementSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Hn as CommentUpdateSignedPropertyNames, Ht as DecryptedChallengeVerificationSchema, In as CommentSignedPropertyNames, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as PageIpfsSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as GetPageParamSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateChallengeReservedFieldNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mn as CommentIpfsReservedFields, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as CreateVoteUserOptionsWithRefinementSchema, Tr as t$12, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vn as CommentUpdateSchema, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditChallengeRequestToEncryptSchema, Xr as object, Yn as isReservedObjectKey, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as AuthorPubsubSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CidPathSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as CommunityAuthorChallengeReservedFieldNames, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CommentEditSignedPropertyNames, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as CreateSignerSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as ProtocolVersionSchema, in as CommentModerationsTableRowSchema, ir as AuthorCommentIpfsReservedFields, it as throwIfAbortSignalAborted, jn as CommentChallengeRequestToEncryptSchema, jr as require_retry$1, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as VoteSignedPropertyNames, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CidStringSchema, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as PKCTimestampSchema, mt as forgetTrackedUpdatingCommunityName, nr as CreateCommentEditOptionsWithRefinementSchema, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as AuthorReservedFields, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as JsonSignatureSchema, pt as findUpdatingCommunity, qn as ModQueuePageIpfsSchema, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorAddressSchema, sn as ChallengeFileSchema, sr as ChallengeAnswersSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CommunityAddressSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as isStringDomain, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateForChallengeVerificationSignedPropertyNames, zr as logger_default } from "./util-LwSS90AE.js";
2
+ import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$1, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as CidPathSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, qn as isReservedObjectKey, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default } from "./util-D7gst5MT.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-2FkqYYNf.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-B53_j_WT.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import dns from "node:dns";
@@ -2058,10 +2058,10 @@ var require_stats = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2058
2058
  //#region node_modules/undici/lib/core/diagnostics.js
2059
2059
  var require_diagnostics = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2060
2060
  const diagnosticsChannel$1 = __require("node:diagnostics_channel");
2061
- const util$3 = __require("node:util");
2062
- const undiciDebugLog = util$3.debuglog("undici");
2063
- const fetchDebuglog = util$3.debuglog("fetch");
2064
- const websocketDebuglog = util$3.debuglog("websocket");
2061
+ const util$4 = __require("node:util");
2062
+ const undiciDebugLog = util$4.debuglog("undici");
2063
+ const fetchDebuglog = util$4.debuglog("fetch");
2064
+ const websocketDebuglog = util$4.debuglog("websocket");
2065
2065
  const channels = {
2066
2066
  beforeConnect: diagnosticsChannel$1.channel("undici:client:beforeConnect"),
2067
2067
  connected: diagnosticsChannel$1.channel("undici:client:connected"),
@@ -16667,7 +16667,7 @@ var require_headers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16667
16667
  const { iteratorMixin, isValidHeaderName, isValidHeaderValue } = require_util$5();
16668
16668
  const { webidl } = require_webidl();
16669
16669
  const assert$11 = __require("node:assert");
16670
- const util$2 = __require("node:util");
16670
+ const util$3 = __require("node:util");
16671
16671
  /**
16672
16672
  * @param {number} code
16673
16673
  * @returns {code is (0x0a | 0x0d | 0x09 | 0x20)}
@@ -16983,9 +16983,9 @@ var require_headers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16983
16983
  if (list) return [...list];
16984
16984
  return [];
16985
16985
  }
16986
- [util$2.inspect.custom](depth, options) {
16986
+ [util$3.inspect.custom](depth, options) {
16987
16987
  options.depth ??= depth;
16988
- return `Headers ${util$2.formatWithOptions(options, this.#headersList.entries)}`;
16988
+ return `Headers ${util$3.formatWithOptions(options, this.#headersList.entries)}`;
16989
16989
  }
16990
16990
  static getHeadersGuard(o) {
16991
16991
  return o.#guard;
@@ -17024,12 +17024,12 @@ var require_headers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17024
17024
  value: "Headers",
17025
17025
  configurable: true
17026
17026
  },
17027
- [util$2.inspect.custom]: { enumerable: false }
17027
+ [util$3.inspect.custom]: { enumerable: false }
17028
17028
  });
17029
17029
  webidl.converters.HeadersInit = function(V, prefix, argument) {
17030
17030
  if (webidl.util.Type(V) === webidl.util.Types.OBJECT) {
17031
17031
  const iterator = Reflect.get(V, Symbol.iterator);
17032
- if (!util$2.types.isProxy(V) && iterator === Headers.prototype.entries) try {
17032
+ if (!util$3.types.isProxy(V) && iterator === Headers.prototype.entries) try {
17033
17033
  return getHeadersList(V).entriesList;
17034
17034
  } catch {}
17035
17035
  if (typeof iterator === "function") return webidl.converters["sequence<sequence<ByteString>>"](V, prefix, argument, iterator.bind(V));
@@ -41511,7 +41511,7 @@ var require_serializer$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
41511
41511
  }));
41512
41512
  //#endregion
41513
41513
  //#region node_modules/parse5/dist/cjs/index.js
41514
- var require_cjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
41514
+ var require_cjs$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
41515
41515
  Object.defineProperty(exports, "__esModule", { value: true });
41516
41516
  exports.TokenizerMode = exports.Tokenizer = exports.Token = exports.html = exports.foreignContent = exports.ErrorCodes = exports.serializeOuter = exports.serialize = exports.Parser = exports.defaultTreeAdapter = void 0;
41517
41517
  exports.parse = parse;
@@ -41602,11 +41602,11 @@ var require_cjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
41602
41602
  }));
41603
41603
  //#endregion
41604
41604
  //#region node_modules/parse5-htmlparser2-tree-adapter/dist/cjs/index.js
41605
- var require_cjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
41605
+ var require_cjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
41606
41606
  Object.defineProperty(exports, "__esModule", { value: true });
41607
41607
  exports.adapter = void 0;
41608
41608
  exports.serializeDoctypeContent = serializeDoctypeContent;
41609
- const parse5_1 = require_cjs$2();
41609
+ const parse5_1 = require_cjs$3();
41610
41610
  const domhandler_1 = require_lib$13();
41611
41611
  function enquoteDoctypeId(id) {
41612
41612
  const quote = id.includes("\"") ? "'" : "\"";
@@ -41794,8 +41794,8 @@ var require_parse5_adapter = /* @__PURE__ */ __commonJSMin(((exports) => {
41794
41794
  exports.parseWithParse5 = parseWithParse5;
41795
41795
  exports.renderWithParse5 = renderWithParse5;
41796
41796
  const domhandler_1 = require_lib$13();
41797
- const parse5_1 = require_cjs$2();
41798
- const parse5_htmlparser2_tree_adapter_1 = require_cjs$1();
41797
+ const parse5_1 = require_cjs$3();
41798
+ const parse5_htmlparser2_tree_adapter_1 = require_cjs$2();
41799
41799
  /**
41800
41800
  * Parse the content with `parse5` in the context of the given `ParentNode`.
41801
41801
  *
@@ -41865,11 +41865,11 @@ var require_load_parse = /* @__PURE__ */ __commonJSMin(((exports) => {
41865
41865
  }));
41866
41866
  //#endregion
41867
41867
  //#region node_modules/parse5-parser-stream/dist/cjs/index.js
41868
- var require_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
41868
+ var require_cjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
41869
41869
  Object.defineProperty(exports, "__esModule", { value: true });
41870
41870
  exports.ParserStream = void 0;
41871
41871
  const node_stream_1$2 = __require("node:stream");
41872
- const parse5_1 = require_cjs$2();
41872
+ const parse5_1 = require_cjs$3();
41873
41873
  exports.ParserStream = class ParserStream extends node_stream_1$2.Writable {
41874
41874
  static getFragmentStream(fragmentContext, options) {
41875
41875
  return new ParserStream(options, parse5_1.Parser.getFragmentParser(fragmentContext, options));
@@ -60571,9 +60571,9 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
60571
60571
  return static_js_1.merge;
60572
60572
  }
60573
60573
  });
60574
- const parse5_htmlparser2_tree_adapter_1 = require_cjs$1();
60574
+ const parse5_htmlparser2_tree_adapter_1 = require_cjs$2();
60575
60575
  const htmlparser2 = __importStar(require_commonjs$3());
60576
- const parse5_parser_stream_1 = require_cjs();
60576
+ const parse5_parser_stream_1 = require_cjs$1();
60577
60577
  const encoding_sniffer_1 = require_commonjs$1();
60578
60578
  const undici = __importStar(require_undici());
60579
60579
  const whatwg_mimetype_1 = __importDefault(require_mime_type());
@@ -77740,7 +77740,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77740
77740
  * Module dependencies.
77741
77741
  */
77742
77742
  var tty$1 = __require("tty");
77743
- var util$1 = __require("util");
77743
+ var util$2 = __require("util");
77744
77744
  /**
77745
77745
  * This is the Node.js implementation of `debug()`.
77746
77746
  *
@@ -77790,7 +77790,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77790
77790
  * $ DEBUG_FD=3 node script.js 3>debug.log
77791
77791
  */
77792
77792
  var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
77793
- if (1 !== fd && 2 !== fd) util$1.deprecate(function() {}, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();
77793
+ if (1 !== fd && 2 !== fd) util$2.deprecate(function() {}, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();
77794
77794
  var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd);
77795
77795
  /**
77796
77796
  * Is stdout a TTY? Colored output is enabled when `true`.
@@ -77803,7 +77803,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77803
77803
  */
77804
77804
  exports.formatters.o = function(v) {
77805
77805
  this.inspectOpts.colors = this.useColors;
77806
- return util$1.inspect(v, this.inspectOpts).split("\n").map(function(str) {
77806
+ return util$2.inspect(v, this.inspectOpts).split("\n").map(function(str) {
77807
77807
  return str.trim();
77808
77808
  }).join(" ");
77809
77809
  };
@@ -77812,7 +77812,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77812
77812
  */
77813
77813
  exports.formatters.O = function(v) {
77814
77814
  this.inspectOpts.colors = this.useColors;
77815
- return util$1.inspect(v, this.inspectOpts);
77815
+ return util$2.inspect(v, this.inspectOpts);
77816
77816
  };
77817
77817
  /**
77818
77818
  * Adds ANSI color escape codes if enabled.
@@ -77832,7 +77832,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77832
77832
  * Invokes `util.format()` with the specified arguments and writes to `stream`.
77833
77833
  */
77834
77834
  function log() {
77835
- return stream.write(util$1.format.apply(util$1, arguments) + "\n");
77835
+ return stream.write(util$2.format.apply(util$2, arguments) + "\n");
77836
77836
  }
77837
77837
  /**
77838
77838
  * Save `namespaces`.
@@ -77907,7 +77907,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77907
77907
  }));
77908
77908
  //#endregion
77909
77909
  //#region node_modules/stream-parser/node_modules/debug/src/index.js
77910
- var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77910
+ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
77911
77911
  /**
77912
77912
  * Detect Electron renderer process, which is node, but we should
77913
77913
  * treat as a browser.
@@ -77922,7 +77922,7 @@ var require_stream_parser = /* @__PURE__ */ __commonJSMin(((exports, module) =>
77922
77922
  * Module dependencies.
77923
77923
  */
77924
77924
  var assert$1 = __require("assert");
77925
- var debug = require_src$1()("stream-parser");
77925
+ var debug = require_src$2()("stream-parser");
77926
77926
  /**
77927
77927
  * Module exports.
77928
77928
  */
@@ -79764,7 +79764,7 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79764
79764
  * Module dependencies.
79765
79765
  */
79766
79766
  var tty = __require("tty");
79767
- var util = __require("util");
79767
+ var util$1 = __require("util");
79768
79768
  /**
79769
79769
  * This is the Node.js implementation of `debug()`.
79770
79770
  */
@@ -79914,7 +79914,7 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79914
79914
  * Invokes `util.format()` with the specified arguments and writes to stderr.
79915
79915
  */
79916
79916
  function log() {
79917
- return process.stderr.write(util.format.apply(util, arguments) + "\n");
79917
+ return process.stderr.write(util$1.format.apply(util$1, arguments) + "\n");
79918
79918
  }
79919
79919
  /**
79920
79920
  * Save `namespaces`.
@@ -79953,7 +79953,7 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79953
79953
  */
79954
79954
  formatters.o = function(v) {
79955
79955
  this.inspectOpts.colors = this.useColors;
79956
- return util.inspect(v, this.inspectOpts).split("\n").map(function(str) {
79956
+ return util$1.inspect(v, this.inspectOpts).split("\n").map(function(str) {
79957
79957
  return str.trim();
79958
79958
  }).join(" ");
79959
79959
  };
@@ -79962,12 +79962,12 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79962
79962
  */
79963
79963
  formatters.O = function(v) {
79964
79964
  this.inspectOpts.colors = this.useColors;
79965
- return util.inspect(v, this.inspectOpts);
79965
+ return util$1.inspect(v, this.inspectOpts);
79966
79966
  };
79967
79967
  }));
79968
79968
  //#endregion
79969
79969
  //#region node_modules/needle/node_modules/debug/src/index.js
79970
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79970
+ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
79971
79971
  /**
79972
79972
  * Detect Electron renderer / nwjs process, which is node, but we should
79973
79973
  * treat as a browser.
@@ -90103,7 +90103,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
90103
90103
  //#endregion
90104
90104
  //#region node_modules/needle/lib/needle.js
90105
90105
  var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
90106
- var fs = __require("fs"), http$1 = __require("http"), https = __require("https"), url = __require("url"), stream = __require("stream"), debug = require_src()("needle"), stringify$1 = require_querystring().build, multipart = require_multipart(), auth = require_auth(), cookies = require_cookies(), parsers = require_parsers(), decoder = require_decoder();
90106
+ var fs$1 = __require("fs"), http$1 = __require("http"), https = __require("https"), url = __require("url"), stream = __require("stream"), debug = require_src$1()("needle"), stringify$1 = require_querystring().build, multipart = require_multipart(), auth = require_auth(), cookies = require_cookies(), parsers = require_parsers(), decoder = require_decoder();
90107
90107
  var version = require_package$1().version;
90108
90108
  var user_agent = "Needle/" + version;
90109
90109
  user_agent += " (Node.js " + process.version + "; " + process.platform + " " + process.arch + ")";
@@ -90195,7 +90195,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
90195
90195
  function get_stream_length(stream, given_length, cb) {
90196
90196
  if (given_length > 0) return cb(given_length);
90197
90197
  if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) return cb(stream.end + 1 - (stream.start || 0));
90198
- fs.stat(stream.path, function(err, stat) {
90198
+ fs$1.stat(stream.path, function(err, stat) {
90199
90199
  cb(stat ? stat.size - (stream.start || 0) : null);
90200
90200
  });
90201
90201
  }
@@ -90458,7 +90458,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
90458
90458
  if (err && err.message == "write after end") request.destroy();
90459
90459
  });
90460
90460
  if (config.output && resp.statusCode == 200) {
90461
- var file = fs.createWriteStream(config.output);
90461
+ var file = fs$1.createWriteStream(config.output);
90462
90462
  file.on("error", had_error);
90463
90463
  out.on("end", function() {
90464
90464
  if (file.writable) file.end();
@@ -93360,8 +93360,1440 @@ function t(n) {
93360
93360
  return r;
93361
93361
  }
93362
93362
  //#endregion
93363
- //#region dist/node/runtime/node/util.js
93363
+ //#region node_modules/graceful-fs/polyfills.js
93364
+ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
93365
+ var constants = __require("constants");
93366
+ var origCwd = process.cwd;
93367
+ var cwd = null;
93368
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
93369
+ process.cwd = function() {
93370
+ if (!cwd) cwd = origCwd.call(process);
93371
+ return cwd;
93372
+ };
93373
+ try {
93374
+ process.cwd();
93375
+ } catch (er) {}
93376
+ if (typeof process.chdir === "function") {
93377
+ var chdir = process.chdir;
93378
+ process.chdir = function(d) {
93379
+ cwd = null;
93380
+ chdir.call(process, d);
93381
+ };
93382
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
93383
+ }
93384
+ module.exports = patch;
93385
+ function patch(fs) {
93386
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
93387
+ if (!fs.lutimes) patchLutimes(fs);
93388
+ fs.chown = chownFix(fs.chown);
93389
+ fs.fchown = chownFix(fs.fchown);
93390
+ fs.lchown = chownFix(fs.lchown);
93391
+ fs.chmod = chmodFix(fs.chmod);
93392
+ fs.fchmod = chmodFix(fs.fchmod);
93393
+ fs.lchmod = chmodFix(fs.lchmod);
93394
+ fs.chownSync = chownFixSync(fs.chownSync);
93395
+ fs.fchownSync = chownFixSync(fs.fchownSync);
93396
+ fs.lchownSync = chownFixSync(fs.lchownSync);
93397
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
93398
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
93399
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
93400
+ fs.stat = statFix(fs.stat);
93401
+ fs.fstat = statFix(fs.fstat);
93402
+ fs.lstat = statFix(fs.lstat);
93403
+ fs.statSync = statFixSync(fs.statSync);
93404
+ fs.fstatSync = statFixSync(fs.fstatSync);
93405
+ fs.lstatSync = statFixSync(fs.lstatSync);
93406
+ if (fs.chmod && !fs.lchmod) {
93407
+ fs.lchmod = function(path, mode, cb) {
93408
+ if (cb) process.nextTick(cb);
93409
+ };
93410
+ fs.lchmodSync = function() {};
93411
+ }
93412
+ if (fs.chown && !fs.lchown) {
93413
+ fs.lchown = function(path, uid, gid, cb) {
93414
+ if (cb) process.nextTick(cb);
93415
+ };
93416
+ fs.lchownSync = function() {};
93417
+ }
93418
+ if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
93419
+ function rename(from, to, cb) {
93420
+ var start = Date.now();
93421
+ var backoff = 0;
93422
+ fs$rename(from, to, function CB(er) {
93423
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
93424
+ setTimeout(function() {
93425
+ fs.stat(to, function(stater, st) {
93426
+ if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
93427
+ else cb(er);
93428
+ });
93429
+ }, backoff);
93430
+ if (backoff < 100) backoff += 10;
93431
+ return;
93432
+ }
93433
+ if (cb) cb(er);
93434
+ });
93435
+ }
93436
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
93437
+ return rename;
93438
+ })(fs.rename);
93439
+ fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
93440
+ function read(fd, buffer, offset, length, position, callback_) {
93441
+ var callback;
93442
+ if (callback_ && typeof callback_ === "function") {
93443
+ var eagCounter = 0;
93444
+ callback = function(er, _, __) {
93445
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
93446
+ eagCounter++;
93447
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
93448
+ }
93449
+ callback_.apply(this, arguments);
93450
+ };
93451
+ }
93452
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
93453
+ }
93454
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
93455
+ return read;
93456
+ })(fs.read);
93457
+ fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
93458
+ return function(fd, buffer, offset, length, position) {
93459
+ var eagCounter = 0;
93460
+ while (true) try {
93461
+ return fs$readSync.call(fs, fd, buffer, offset, length, position);
93462
+ } catch (er) {
93463
+ if (er.code === "EAGAIN" && eagCounter < 10) {
93464
+ eagCounter++;
93465
+ continue;
93466
+ }
93467
+ throw er;
93468
+ }
93469
+ };
93470
+ })(fs.readSync);
93471
+ function patchLchmod(fs) {
93472
+ fs.lchmod = function(path, mode, callback) {
93473
+ fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
93474
+ if (err) {
93475
+ if (callback) callback(err);
93476
+ return;
93477
+ }
93478
+ fs.fchmod(fd, mode, function(err) {
93479
+ fs.close(fd, function(err2) {
93480
+ if (callback) callback(err || err2);
93481
+ });
93482
+ });
93483
+ });
93484
+ };
93485
+ fs.lchmodSync = function(path, mode) {
93486
+ var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
93487
+ var threw = true;
93488
+ var ret;
93489
+ try {
93490
+ ret = fs.fchmodSync(fd, mode);
93491
+ threw = false;
93492
+ } finally {
93493
+ if (threw) try {
93494
+ fs.closeSync(fd);
93495
+ } catch (er) {}
93496
+ else fs.closeSync(fd);
93497
+ }
93498
+ return ret;
93499
+ };
93500
+ }
93501
+ function patchLutimes(fs) {
93502
+ if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
93503
+ fs.lutimes = function(path, at, mt, cb) {
93504
+ fs.open(path, constants.O_SYMLINK, function(er, fd) {
93505
+ if (er) {
93506
+ if (cb) cb(er);
93507
+ return;
93508
+ }
93509
+ fs.futimes(fd, at, mt, function(er) {
93510
+ fs.close(fd, function(er2) {
93511
+ if (cb) cb(er || er2);
93512
+ });
93513
+ });
93514
+ });
93515
+ };
93516
+ fs.lutimesSync = function(path, at, mt) {
93517
+ var fd = fs.openSync(path, constants.O_SYMLINK);
93518
+ var ret;
93519
+ var threw = true;
93520
+ try {
93521
+ ret = fs.futimesSync(fd, at, mt);
93522
+ threw = false;
93523
+ } finally {
93524
+ if (threw) try {
93525
+ fs.closeSync(fd);
93526
+ } catch (er) {}
93527
+ else fs.closeSync(fd);
93528
+ }
93529
+ return ret;
93530
+ };
93531
+ } else if (fs.futimes) {
93532
+ fs.lutimes = function(_a, _b, _c, cb) {
93533
+ if (cb) process.nextTick(cb);
93534
+ };
93535
+ fs.lutimesSync = function() {};
93536
+ }
93537
+ }
93538
+ function chmodFix(orig) {
93539
+ if (!orig) return orig;
93540
+ return function(target, mode, cb) {
93541
+ return orig.call(fs, target, mode, function(er) {
93542
+ if (chownErOk(er)) er = null;
93543
+ if (cb) cb.apply(this, arguments);
93544
+ });
93545
+ };
93546
+ }
93547
+ function chmodFixSync(orig) {
93548
+ if (!orig) return orig;
93549
+ return function(target, mode) {
93550
+ try {
93551
+ return orig.call(fs, target, mode);
93552
+ } catch (er) {
93553
+ if (!chownErOk(er)) throw er;
93554
+ }
93555
+ };
93556
+ }
93557
+ function chownFix(orig) {
93558
+ if (!orig) return orig;
93559
+ return function(target, uid, gid, cb) {
93560
+ return orig.call(fs, target, uid, gid, function(er) {
93561
+ if (chownErOk(er)) er = null;
93562
+ if (cb) cb.apply(this, arguments);
93563
+ });
93564
+ };
93565
+ }
93566
+ function chownFixSync(orig) {
93567
+ if (!orig) return orig;
93568
+ return function(target, uid, gid) {
93569
+ try {
93570
+ return orig.call(fs, target, uid, gid);
93571
+ } catch (er) {
93572
+ if (!chownErOk(er)) throw er;
93573
+ }
93574
+ };
93575
+ }
93576
+ function statFix(orig) {
93577
+ if (!orig) return orig;
93578
+ return function(target, options, cb) {
93579
+ if (typeof options === "function") {
93580
+ cb = options;
93581
+ options = null;
93582
+ }
93583
+ function callback(er, stats) {
93584
+ if (stats) {
93585
+ if (stats.uid < 0) stats.uid += 4294967296;
93586
+ if (stats.gid < 0) stats.gid += 4294967296;
93587
+ }
93588
+ if (cb) cb.apply(this, arguments);
93589
+ }
93590
+ return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
93591
+ };
93592
+ }
93593
+ function statFixSync(orig) {
93594
+ if (!orig) return orig;
93595
+ return function(target, options) {
93596
+ var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
93597
+ if (stats) {
93598
+ if (stats.uid < 0) stats.uid += 4294967296;
93599
+ if (stats.gid < 0) stats.gid += 4294967296;
93600
+ }
93601
+ return stats;
93602
+ };
93603
+ }
93604
+ function chownErOk(er) {
93605
+ if (!er) return true;
93606
+ if (er.code === "ENOSYS") return true;
93607
+ if (!process.getuid || process.getuid() !== 0) {
93608
+ if (er.code === "EINVAL" || er.code === "EPERM") return true;
93609
+ }
93610
+ return false;
93611
+ }
93612
+ }
93613
+ }));
93614
+ //#endregion
93615
+ //#region node_modules/graceful-fs/legacy-streams.js
93616
+ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
93617
+ var Stream = __require("stream").Stream;
93618
+ module.exports = legacy;
93619
+ function legacy(fs) {
93620
+ return {
93621
+ ReadStream,
93622
+ WriteStream
93623
+ };
93624
+ function ReadStream(path, options) {
93625
+ if (!(this instanceof ReadStream)) return new ReadStream(path, options);
93626
+ Stream.call(this);
93627
+ var self = this;
93628
+ this.path = path;
93629
+ this.fd = null;
93630
+ this.readable = true;
93631
+ this.paused = false;
93632
+ this.flags = "r";
93633
+ this.mode = 438;
93634
+ this.bufferSize = 64 * 1024;
93635
+ options = options || {};
93636
+ var keys = Object.keys(options);
93637
+ for (var index = 0, length = keys.length; index < length; index++) {
93638
+ var key = keys[index];
93639
+ this[key] = options[key];
93640
+ }
93641
+ if (this.encoding) this.setEncoding(this.encoding);
93642
+ if (this.start !== void 0) {
93643
+ if ("number" !== typeof this.start) throw TypeError("start must be a Number");
93644
+ if (this.end === void 0) this.end = Infinity;
93645
+ else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
93646
+ if (this.start > this.end) throw new Error("start must be <= end");
93647
+ this.pos = this.start;
93648
+ }
93649
+ if (this.fd !== null) {
93650
+ process.nextTick(function() {
93651
+ self._read();
93652
+ });
93653
+ return;
93654
+ }
93655
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
93656
+ if (err) {
93657
+ self.emit("error", err);
93658
+ self.readable = false;
93659
+ return;
93660
+ }
93661
+ self.fd = fd;
93662
+ self.emit("open", fd);
93663
+ self._read();
93664
+ });
93665
+ }
93666
+ function WriteStream(path, options) {
93667
+ if (!(this instanceof WriteStream)) return new WriteStream(path, options);
93668
+ Stream.call(this);
93669
+ this.path = path;
93670
+ this.fd = null;
93671
+ this.writable = true;
93672
+ this.flags = "w";
93673
+ this.encoding = "binary";
93674
+ this.mode = 438;
93675
+ this.bytesWritten = 0;
93676
+ options = options || {};
93677
+ var keys = Object.keys(options);
93678
+ for (var index = 0, length = keys.length; index < length; index++) {
93679
+ var key = keys[index];
93680
+ this[key] = options[key];
93681
+ }
93682
+ if (this.start !== void 0) {
93683
+ if ("number" !== typeof this.start) throw TypeError("start must be a Number");
93684
+ if (this.start < 0) throw new Error("start must be >= zero");
93685
+ this.pos = this.start;
93686
+ }
93687
+ this.busy = false;
93688
+ this._queue = [];
93689
+ if (this.fd === null) {
93690
+ this._open = fs.open;
93691
+ this._queue.push([
93692
+ this._open,
93693
+ this.path,
93694
+ this.flags,
93695
+ this.mode,
93696
+ void 0
93697
+ ]);
93698
+ this.flush();
93699
+ }
93700
+ }
93701
+ }
93702
+ }));
93703
+ //#endregion
93704
+ //#region node_modules/graceful-fs/clone.js
93705
+ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
93706
+ module.exports = clone;
93707
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
93708
+ return obj.__proto__;
93709
+ };
93710
+ function clone(obj) {
93711
+ if (obj === null || typeof obj !== "object") return obj;
93712
+ if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
93713
+ else var copy = Object.create(null);
93714
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
93715
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
93716
+ });
93717
+ return copy;
93718
+ }
93719
+ }));
93720
+ //#endregion
93721
+ //#region node_modules/graceful-fs/graceful-fs.js
93722
+ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
93723
+ var fs = __require("fs");
93724
+ var polyfills = require_polyfills();
93725
+ var legacy = require_legacy_streams();
93726
+ var clone = require_clone();
93727
+ var util = __require("util");
93728
+ /* istanbul ignore next - node 0.x polyfill */
93729
+ var gracefulQueue;
93730
+ var previousSymbol;
93731
+ /* istanbul ignore else - node 0.x polyfill */
93732
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
93733
+ gracefulQueue = Symbol.for("graceful-fs.queue");
93734
+ previousSymbol = Symbol.for("graceful-fs.previous");
93735
+ } else {
93736
+ gracefulQueue = "___graceful-fs.queue";
93737
+ previousSymbol = "___graceful-fs.previous";
93738
+ }
93739
+ function noop() {}
93740
+ function publishQueue(context, queue) {
93741
+ Object.defineProperty(context, gracefulQueue, { get: function() {
93742
+ return queue;
93743
+ } });
93744
+ }
93745
+ var debug = noop;
93746
+ if (util.debuglog) debug = util.debuglog("gfs4");
93747
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
93748
+ var m = util.format.apply(util, arguments);
93749
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
93750
+ console.error(m);
93751
+ };
93752
+ if (!fs[gracefulQueue]) {
93753
+ publishQueue(fs, global[gracefulQueue] || []);
93754
+ fs.close = (function(fs$close) {
93755
+ function close(fd, cb) {
93756
+ return fs$close.call(fs, fd, function(err) {
93757
+ if (!err) resetQueue();
93758
+ if (typeof cb === "function") cb.apply(this, arguments);
93759
+ });
93760
+ }
93761
+ Object.defineProperty(close, previousSymbol, { value: fs$close });
93762
+ return close;
93763
+ })(fs.close);
93764
+ fs.closeSync = (function(fs$closeSync) {
93765
+ function closeSync(fd) {
93766
+ fs$closeSync.apply(fs, arguments);
93767
+ resetQueue();
93768
+ }
93769
+ Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
93770
+ return closeSync;
93771
+ })(fs.closeSync);
93772
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
93773
+ debug(fs[gracefulQueue]);
93774
+ __require("assert").equal(fs[gracefulQueue].length, 0);
93775
+ });
93776
+ }
93777
+ if (!global[gracefulQueue]) publishQueue(global, fs[gracefulQueue]);
93778
+ module.exports = patch(clone(fs));
93779
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
93780
+ module.exports = patch(fs);
93781
+ fs.__patched = true;
93782
+ }
93783
+ function patch(fs) {
93784
+ polyfills(fs);
93785
+ fs.gracefulify = patch;
93786
+ fs.createReadStream = createReadStream;
93787
+ fs.createWriteStream = createWriteStream;
93788
+ var fs$readFile = fs.readFile;
93789
+ fs.readFile = readFile;
93790
+ function readFile(path, options, cb) {
93791
+ if (typeof options === "function") cb = options, options = null;
93792
+ return go$readFile(path, options, cb);
93793
+ function go$readFile(path, options, cb, startTime) {
93794
+ return fs$readFile(path, options, function(err) {
93795
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
93796
+ go$readFile,
93797
+ [
93798
+ path,
93799
+ options,
93800
+ cb
93801
+ ],
93802
+ err,
93803
+ startTime || Date.now(),
93804
+ Date.now()
93805
+ ]);
93806
+ else if (typeof cb === "function") cb.apply(this, arguments);
93807
+ });
93808
+ }
93809
+ }
93810
+ var fs$writeFile = fs.writeFile;
93811
+ fs.writeFile = writeFile;
93812
+ function writeFile(path, data, options, cb) {
93813
+ if (typeof options === "function") cb = options, options = null;
93814
+ return go$writeFile(path, data, options, cb);
93815
+ function go$writeFile(path, data, options, cb, startTime) {
93816
+ return fs$writeFile(path, data, options, function(err) {
93817
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
93818
+ go$writeFile,
93819
+ [
93820
+ path,
93821
+ data,
93822
+ options,
93823
+ cb
93824
+ ],
93825
+ err,
93826
+ startTime || Date.now(),
93827
+ Date.now()
93828
+ ]);
93829
+ else if (typeof cb === "function") cb.apply(this, arguments);
93830
+ });
93831
+ }
93832
+ }
93833
+ var fs$appendFile = fs.appendFile;
93834
+ if (fs$appendFile) fs.appendFile = appendFile;
93835
+ function appendFile(path, data, options, cb) {
93836
+ if (typeof options === "function") cb = options, options = null;
93837
+ return go$appendFile(path, data, options, cb);
93838
+ function go$appendFile(path, data, options, cb, startTime) {
93839
+ return fs$appendFile(path, data, options, function(err) {
93840
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
93841
+ go$appendFile,
93842
+ [
93843
+ path,
93844
+ data,
93845
+ options,
93846
+ cb
93847
+ ],
93848
+ err,
93849
+ startTime || Date.now(),
93850
+ Date.now()
93851
+ ]);
93852
+ else if (typeof cb === "function") cb.apply(this, arguments);
93853
+ });
93854
+ }
93855
+ }
93856
+ var fs$copyFile = fs.copyFile;
93857
+ if (fs$copyFile) fs.copyFile = copyFile;
93858
+ function copyFile(src, dest, flags, cb) {
93859
+ if (typeof flags === "function") {
93860
+ cb = flags;
93861
+ flags = 0;
93862
+ }
93863
+ return go$copyFile(src, dest, flags, cb);
93864
+ function go$copyFile(src, dest, flags, cb, startTime) {
93865
+ return fs$copyFile(src, dest, flags, function(err) {
93866
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
93867
+ go$copyFile,
93868
+ [
93869
+ src,
93870
+ dest,
93871
+ flags,
93872
+ cb
93873
+ ],
93874
+ err,
93875
+ startTime || Date.now(),
93876
+ Date.now()
93877
+ ]);
93878
+ else if (typeof cb === "function") cb.apply(this, arguments);
93879
+ });
93880
+ }
93881
+ }
93882
+ var fs$readdir = fs.readdir;
93883
+ fs.readdir = readdir;
93884
+ var noReaddirOptionVersions = /^v[0-5]\./;
93885
+ function readdir(path, options, cb) {
93886
+ if (typeof options === "function") cb = options, options = null;
93887
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
93888
+ return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
93889
+ } : function go$readdir(path, options, cb, startTime) {
93890
+ return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
93891
+ };
93892
+ return go$readdir(path, options, cb);
93893
+ function fs$readdirCallback(path, options, cb, startTime) {
93894
+ return function(err, files) {
93895
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
93896
+ go$readdir,
93897
+ [
93898
+ path,
93899
+ options,
93900
+ cb
93901
+ ],
93902
+ err,
93903
+ startTime || Date.now(),
93904
+ Date.now()
93905
+ ]);
93906
+ else {
93907
+ if (files && files.sort) files.sort();
93908
+ if (typeof cb === "function") cb.call(this, err, files);
93909
+ }
93910
+ };
93911
+ }
93912
+ }
93913
+ if (process.version.substr(0, 4) === "v0.8") {
93914
+ var legStreams = legacy(fs);
93915
+ ReadStream = legStreams.ReadStream;
93916
+ WriteStream = legStreams.WriteStream;
93917
+ }
93918
+ var fs$ReadStream = fs.ReadStream;
93919
+ if (fs$ReadStream) {
93920
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
93921
+ ReadStream.prototype.open = ReadStream$open;
93922
+ }
93923
+ var fs$WriteStream = fs.WriteStream;
93924
+ if (fs$WriteStream) {
93925
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
93926
+ WriteStream.prototype.open = WriteStream$open;
93927
+ }
93928
+ Object.defineProperty(fs, "ReadStream", {
93929
+ get: function() {
93930
+ return ReadStream;
93931
+ },
93932
+ set: function(val) {
93933
+ ReadStream = val;
93934
+ },
93935
+ enumerable: true,
93936
+ configurable: true
93937
+ });
93938
+ Object.defineProperty(fs, "WriteStream", {
93939
+ get: function() {
93940
+ return WriteStream;
93941
+ },
93942
+ set: function(val) {
93943
+ WriteStream = val;
93944
+ },
93945
+ enumerable: true,
93946
+ configurable: true
93947
+ });
93948
+ var FileReadStream = ReadStream;
93949
+ Object.defineProperty(fs, "FileReadStream", {
93950
+ get: function() {
93951
+ return FileReadStream;
93952
+ },
93953
+ set: function(val) {
93954
+ FileReadStream = val;
93955
+ },
93956
+ enumerable: true,
93957
+ configurable: true
93958
+ });
93959
+ var FileWriteStream = WriteStream;
93960
+ Object.defineProperty(fs, "FileWriteStream", {
93961
+ get: function() {
93962
+ return FileWriteStream;
93963
+ },
93964
+ set: function(val) {
93965
+ FileWriteStream = val;
93966
+ },
93967
+ enumerable: true,
93968
+ configurable: true
93969
+ });
93970
+ function ReadStream(path, options) {
93971
+ if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
93972
+ else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
93973
+ }
93974
+ function ReadStream$open() {
93975
+ var that = this;
93976
+ open(that.path, that.flags, that.mode, function(err, fd) {
93977
+ if (err) {
93978
+ if (that.autoClose) that.destroy();
93979
+ that.emit("error", err);
93980
+ } else {
93981
+ that.fd = fd;
93982
+ that.emit("open", fd);
93983
+ that.read();
93984
+ }
93985
+ });
93986
+ }
93987
+ function WriteStream(path, options) {
93988
+ if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
93989
+ else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
93990
+ }
93991
+ function WriteStream$open() {
93992
+ var that = this;
93993
+ open(that.path, that.flags, that.mode, function(err, fd) {
93994
+ if (err) {
93995
+ that.destroy();
93996
+ that.emit("error", err);
93997
+ } else {
93998
+ that.fd = fd;
93999
+ that.emit("open", fd);
94000
+ }
94001
+ });
94002
+ }
94003
+ function createReadStream(path, options) {
94004
+ return new fs.ReadStream(path, options);
94005
+ }
94006
+ function createWriteStream(path, options) {
94007
+ return new fs.WriteStream(path, options);
94008
+ }
94009
+ var fs$open = fs.open;
94010
+ fs.open = open;
94011
+ function open(path, flags, mode, cb) {
94012
+ if (typeof mode === "function") cb = mode, mode = null;
94013
+ return go$open(path, flags, mode, cb);
94014
+ function go$open(path, flags, mode, cb, startTime) {
94015
+ return fs$open(path, flags, mode, function(err, fd) {
94016
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
94017
+ go$open,
94018
+ [
94019
+ path,
94020
+ flags,
94021
+ mode,
94022
+ cb
94023
+ ],
94024
+ err,
94025
+ startTime || Date.now(),
94026
+ Date.now()
94027
+ ]);
94028
+ else if (typeof cb === "function") cb.apply(this, arguments);
94029
+ });
94030
+ }
94031
+ }
94032
+ return fs;
94033
+ }
94034
+ function enqueue(elem) {
94035
+ debug("ENQUEUE", elem[0].name, elem[1]);
94036
+ fs[gracefulQueue].push(elem);
94037
+ retry();
94038
+ }
94039
+ var retryTimer;
94040
+ function resetQueue() {
94041
+ var now = Date.now();
94042
+ for (var i = 0; i < fs[gracefulQueue].length; ++i) if (fs[gracefulQueue][i].length > 2) {
94043
+ fs[gracefulQueue][i][3] = now;
94044
+ fs[gracefulQueue][i][4] = now;
94045
+ }
94046
+ retry();
94047
+ }
94048
+ function retry() {
94049
+ clearTimeout(retryTimer);
94050
+ retryTimer = void 0;
94051
+ if (fs[gracefulQueue].length === 0) return;
94052
+ var elem = fs[gracefulQueue].shift();
94053
+ var fn = elem[0];
94054
+ var args = elem[1];
94055
+ var err = elem[2];
94056
+ var startTime = elem[3];
94057
+ var lastTime = elem[4];
94058
+ if (startTime === void 0) {
94059
+ debug("RETRY", fn.name, args);
94060
+ fn.apply(null, args);
94061
+ } else if (Date.now() - startTime >= 6e4) {
94062
+ debug("TIMEOUT", fn.name, args);
94063
+ var cb = args.pop();
94064
+ if (typeof cb === "function") cb.call(null, err);
94065
+ } else {
94066
+ var sinceAttempt = Date.now() - lastTime;
94067
+ var sinceStart = Math.max(lastTime - startTime, 1);
94068
+ if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
94069
+ debug("RETRY", fn.name, args);
94070
+ fn.apply(null, args.concat([startTime]));
94071
+ } else fs[gracefulQueue].push(elem);
94072
+ }
94073
+ if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
94074
+ }
94075
+ }));
94076
+ //#endregion
94077
+ //#region node_modules/signal-exit/dist/cjs/signals.js
94078
+ var require_signals = /* @__PURE__ */ __commonJSMin(((exports) => {
94079
+ Object.defineProperty(exports, "__esModule", { value: true });
94080
+ exports.signals = void 0;
94081
+ /**
94082
+ * This is not the set of all possible signals.
94083
+ *
94084
+ * It IS, however, the set of all signals that trigger
94085
+ * an exit on either Linux or BSD systems. Linux is a
94086
+ * superset of the signal names supported on BSD, and
94087
+ * the unknown signals just fail to register, so we can
94088
+ * catch that easily enough.
94089
+ *
94090
+ * Windows signals are a different set, since there are
94091
+ * signals that terminate Windows processes, but don't
94092
+ * terminate (or don't even exist) on Posix systems.
94093
+ *
94094
+ * Don't bother with SIGKILL. It's uncatchable, which
94095
+ * means that we can't fire any callbacks anyway.
94096
+ *
94097
+ * If a user does happen to register a handler on a non-
94098
+ * fatal signal like SIGWINCH or something, and then
94099
+ * exit, it'll end up firing `process.emit('exit')`, so
94100
+ * the handler will be fired anyway.
94101
+ *
94102
+ * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
94103
+ * artificially, inherently leave the process in a
94104
+ * state from which it is not safe to try and enter JS
94105
+ * listeners.
94106
+ */
94107
+ exports.signals = [];
94108
+ exports.signals.push("SIGHUP", "SIGINT", "SIGTERM");
94109
+ if (process.platform !== "win32") exports.signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
94110
+ if (process.platform === "linux") exports.signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
94111
+ }));
94112
+ //#endregion
94113
+ //#region node_modules/signal-exit/dist/cjs/index.js
94114
+ var require_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
94115
+ var _a;
94116
+ Object.defineProperty(exports, "__esModule", { value: true });
94117
+ exports.unload = exports.load = exports.onExit = exports.signals = void 0;
94118
+ const signals_js_1 = require_signals();
94119
+ Object.defineProperty(exports, "signals", {
94120
+ enumerable: true,
94121
+ get: function() {
94122
+ return signals_js_1.signals;
94123
+ }
94124
+ });
94125
+ const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
94126
+ const kExitEmitter = Symbol.for("signal-exit emitter");
94127
+ const global = globalThis;
94128
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
94129
+ var Emitter = class {
94130
+ emitted = {
94131
+ afterExit: false,
94132
+ exit: false
94133
+ };
94134
+ listeners = {
94135
+ afterExit: [],
94136
+ exit: []
94137
+ };
94138
+ count = 0;
94139
+ id = Math.random();
94140
+ constructor() {
94141
+ if (global[kExitEmitter]) return global[kExitEmitter];
94142
+ ObjectDefineProperty(global, kExitEmitter, {
94143
+ value: this,
94144
+ writable: false,
94145
+ enumerable: false,
94146
+ configurable: false
94147
+ });
94148
+ }
94149
+ on(ev, fn) {
94150
+ this.listeners[ev].push(fn);
94151
+ }
94152
+ removeListener(ev, fn) {
94153
+ const list = this.listeners[ev];
94154
+ const i = list.indexOf(fn);
94155
+ /* c8 ignore start */
94156
+ if (i === -1) return;
94157
+ /* c8 ignore stop */
94158
+ if (i === 0 && list.length === 1) list.length = 0;
94159
+ else list.splice(i, 1);
94160
+ }
94161
+ emit(ev, code, signal) {
94162
+ if (this.emitted[ev]) return false;
94163
+ this.emitted[ev] = true;
94164
+ let ret = false;
94165
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
94166
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
94167
+ return ret;
94168
+ }
94169
+ };
94170
+ var SignalExitBase = class {};
94171
+ const signalExitWrap = (handler) => {
94172
+ return {
94173
+ onExit(cb, opts) {
94174
+ return handler.onExit(cb, opts);
94175
+ },
94176
+ load() {
94177
+ return handler.load();
94178
+ },
94179
+ unload() {
94180
+ return handler.unload();
94181
+ }
94182
+ };
94183
+ };
94184
+ var SignalExitFallback = class extends SignalExitBase {
94185
+ onExit() {
94186
+ return () => {};
94187
+ }
94188
+ load() {}
94189
+ unload() {}
94190
+ };
94191
+ var SignalExit = class extends SignalExitBase {
94192
+ /* c8 ignore start */
94193
+ #hupSig = process.platform === "win32" ? "SIGINT" : "SIGHUP";
94194
+ /* c8 ignore stop */
94195
+ #emitter = new Emitter();
94196
+ #process;
94197
+ #originalProcessEmit;
94198
+ #originalProcessReallyExit;
94199
+ #sigListeners = {};
94200
+ #loaded = false;
94201
+ constructor(process) {
94202
+ super();
94203
+ this.#process = process;
94204
+ this.#sigListeners = {};
94205
+ for (const sig of signals_js_1.signals) this.#sigListeners[sig] = () => {
94206
+ const listeners = this.#process.listeners(sig);
94207
+ let { count } = this.#emitter;
94208
+ /* c8 ignore start */
94209
+ const p = process;
94210
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
94211
+ /* c8 ignore stop */
94212
+ if (listeners.length === count) {
94213
+ this.unload();
94214
+ const ret = this.#emitter.emit("exit", null, sig);
94215
+ /* c8 ignore start */
94216
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
94217
+ if (!ret) process.kill(process.pid, s);
94218
+ }
94219
+ };
94220
+ this.#originalProcessReallyExit = process.reallyExit;
94221
+ this.#originalProcessEmit = process.emit;
94222
+ }
94223
+ onExit(cb, opts) {
94224
+ /* c8 ignore start */
94225
+ if (!processOk(this.#process)) return () => {};
94226
+ /* c8 ignore stop */
94227
+ if (this.#loaded === false) this.load();
94228
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
94229
+ this.#emitter.on(ev, cb);
94230
+ return () => {
94231
+ this.#emitter.removeListener(ev, cb);
94232
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
94233
+ };
94234
+ }
94235
+ load() {
94236
+ if (this.#loaded) return;
94237
+ this.#loaded = true;
94238
+ this.#emitter.count += 1;
94239
+ for (const sig of signals_js_1.signals) try {
94240
+ const fn = this.#sigListeners[sig];
94241
+ if (fn) this.#process.on(sig, fn);
94242
+ } catch (_) {}
94243
+ this.#process.emit = (ev, ...a) => {
94244
+ return this.#processEmit(ev, ...a);
94245
+ };
94246
+ this.#process.reallyExit = (code) => {
94247
+ return this.#processReallyExit(code);
94248
+ };
94249
+ }
94250
+ unload() {
94251
+ if (!this.#loaded) return;
94252
+ this.#loaded = false;
94253
+ signals_js_1.signals.forEach((sig) => {
94254
+ const listener = this.#sigListeners[sig];
94255
+ /* c8 ignore start */
94256
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
94257
+ /* c8 ignore stop */
94258
+ try {
94259
+ this.#process.removeListener(sig, listener);
94260
+ } catch (_) {}
94261
+ /* c8 ignore stop */
94262
+ });
94263
+ this.#process.emit = this.#originalProcessEmit;
94264
+ this.#process.reallyExit = this.#originalProcessReallyExit;
94265
+ this.#emitter.count -= 1;
94266
+ }
94267
+ #processReallyExit(code) {
94268
+ /* c8 ignore start */
94269
+ if (!processOk(this.#process)) return 0;
94270
+ this.#process.exitCode = code || 0;
94271
+ /* c8 ignore stop */
94272
+ this.#emitter.emit("exit", this.#process.exitCode, null);
94273
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
94274
+ }
94275
+ #processEmit(ev, ...args) {
94276
+ const og = this.#originalProcessEmit;
94277
+ if (ev === "exit" && processOk(this.#process)) {
94278
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
94279
+ /* c8 ignore start */
94280
+ const ret = og.call(this.#process, ev, ...args);
94281
+ /* c8 ignore start */
94282
+ this.#emitter.emit("exit", this.#process.exitCode, null);
94283
+ /* c8 ignore stop */
94284
+ return ret;
94285
+ } else return og.call(this.#process, ev, ...args);
94286
+ }
94287
+ };
94288
+ const process = globalThis.process;
94289
+ _a = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()), exports.onExit = _a.onExit, exports.load = _a.load, exports.unload = _a.unload;
94290
+ }));
94291
+ //#endregion
94292
+ //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/mtime-precision.js
94293
+ var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports) => {
94294
+ Object.defineProperty(exports, "__esModule", { value: true });
94295
+ exports.probe = probe;
94296
+ exports.getMtime = getMtime;
94297
+ const cacheSymbol = Symbol();
94298
+ function probe(file, fs, callback) {
94299
+ const cachedPrecision = fs[cacheSymbol];
94300
+ if (cachedPrecision) return fs.stat(file, (err, stat) => {
94301
+ /* istanbul ignore if */
94302
+ if (err) return callback(err);
94303
+ callback(null, stat.mtime, cachedPrecision);
94304
+ });
94305
+ const mtime = /* @__PURE__ */ new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
94306
+ fs.utimes(file, mtime, mtime, (err) => {
94307
+ /* istanbul ignore if */
94308
+ if (err) return callback(err);
94309
+ fs.stat(file, (err, stat) => {
94310
+ /* istanbul ignore if */
94311
+ if (err) return callback(err);
94312
+ const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
94313
+ Object.defineProperty(fs, cacheSymbol, { value: precision });
94314
+ callback(null, stat.mtime, precision);
94315
+ });
94316
+ });
94317
+ }
94318
+ function getMtime(precision) {
94319
+ let now = Date.now();
94320
+ if (precision === "s") now = Math.ceil(now / 1e3) * 1e3;
94321
+ return new Date(now);
94322
+ }
94323
+ }));
94324
+ //#endregion
94325
+ //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/lockfile.js
94326
+ var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports) => {
94327
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
94328
+ if (k2 === void 0) k2 = k;
94329
+ var desc = Object.getOwnPropertyDescriptor(m, k);
94330
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
94331
+ enumerable: true,
94332
+ get: function() {
94333
+ return m[k];
94334
+ }
94335
+ };
94336
+ Object.defineProperty(o, k2, desc);
94337
+ }) : (function(o, m, k, k2) {
94338
+ if (k2 === void 0) k2 = k;
94339
+ o[k2] = m[k];
94340
+ }));
94341
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
94342
+ Object.defineProperty(o, "default", {
94343
+ enumerable: true,
94344
+ value: v
94345
+ });
94346
+ }) : function(o, v) {
94347
+ o["default"] = v;
94348
+ });
94349
+ var __importStar = exports && exports.__importStar || (function() {
94350
+ var ownKeys = function(o) {
94351
+ ownKeys = Object.getOwnPropertyNames || function(o) {
94352
+ var ar = [];
94353
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
94354
+ return ar;
94355
+ };
94356
+ return ownKeys(o);
94357
+ };
94358
+ return function(mod) {
94359
+ if (mod && mod.__esModule) return mod;
94360
+ var result = {};
94361
+ if (mod != null) {
94362
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
94363
+ }
94364
+ __setModuleDefault(result, mod);
94365
+ return result;
94366
+ };
94367
+ })();
94368
+ var __importDefault = exports && exports.__importDefault || function(mod) {
94369
+ return mod && mod.__esModule ? mod : { "default": mod };
94370
+ };
94371
+ Object.defineProperty(exports, "__esModule", { value: true });
94372
+ exports.lock = lock;
94373
+ exports.unlock = unlock;
94374
+ exports.check = check;
94375
+ exports.getLocks = getLocks;
94376
+ const path_1 = __importDefault(__require("path"));
94377
+ const graceful_fs_1 = __importDefault(require_graceful_fs());
94378
+ const retry_1 = __importDefault(require_retry$1());
94379
+ const signal_exit_1 = require_cjs();
94380
+ const assert_1 = __importDefault(__require("assert"));
94381
+ const mtimePrecision = __importStar(require_mtime_precision());
94382
+ const locks = {};
94383
+ function getLockFile(file, options) {
94384
+ (0, assert_1.default)(typeof options.lockfilePath === "string");
94385
+ return options.lockfilePath;
94386
+ }
94387
+ function resolveCanonicalPath(file, options, callback) {
94388
+ if (!options.realpath) return callback(null, path_1.default.resolve(file));
94389
+ options.fs.realpath(file, (err, resolvedPath) => {
94390
+ callback(err, resolvedPath);
94391
+ });
94392
+ }
94393
+ function acquireLock(file, options, callback) {
94394
+ const lockfilePath = getLockFile(file, options);
94395
+ options.fs.mkdir(lockfilePath, (err) => {
94396
+ if (!err) return mtimePrecision.probe(lockfilePath, options.fs, (err, mtime, precision) => {
94397
+ /* istanbul ignore if */
94398
+ if (err) {
94399
+ options.fs.rmdir(lockfilePath, () => {});
94400
+ return callback(err);
94401
+ }
94402
+ callback(null, mtime, precision);
94403
+ });
94404
+ if (err.code !== "EEXIST") return callback(err);
94405
+ if (options.stale <= 0) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
94406
+ code: "ELOCKED",
94407
+ file
94408
+ }));
94409
+ options.fs.stat(lockfilePath, (err, stat) => {
94410
+ if (err) {
94411
+ if (err.code === "ENOENT") return acquireLock(file, {
94412
+ ...options,
94413
+ stale: 0
94414
+ }, callback);
94415
+ return callback(err);
94416
+ }
94417
+ if (!isLockStale(stat, options)) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
94418
+ code: "ELOCKED",
94419
+ file
94420
+ }));
94421
+ removeLock(file, options, (err) => {
94422
+ if (err) return callback(err);
94423
+ acquireLock(file, {
94424
+ ...options,
94425
+ stale: 0
94426
+ }, callback);
94427
+ });
94428
+ });
94429
+ });
94430
+ }
94431
+ function isLockStale(stat, options) {
94432
+ return stat.mtime.getTime() < Date.now() - options.stale;
94433
+ }
94434
+ function removeLock(file, options, callback) {
94435
+ options.fs.rmdir(getLockFile(file, options), (err) => {
94436
+ if (err && err.code !== "ENOENT") return callback(err);
94437
+ callback();
94438
+ });
94439
+ }
94440
+ function updateLock(file, options) {
94441
+ if (typeof options.lockfilePath !== "string") throw Error("Options is not defined ");
94442
+ const lock = locks[file + options.lockfilePath];
94443
+ /* istanbul ignore if */
94444
+ if (lock.updateTimeout) return;
94445
+ lock.updateDelay = lock.updateDelay || options.update;
94446
+ lock.updateTimeout = setTimeout(() => {
94447
+ lock.updateTimeout = null;
94448
+ options.fs.stat(lock.lockfilePath, (err, stat) => {
94449
+ const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
94450
+ if (err) {
94451
+ if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
94452
+ lock.updateDelay = 1e3;
94453
+ return updateLock(file, options);
94454
+ }
94455
+ if (!(lock.mtime.getTime() === stat.mtime.getTime())) return setLockAsCompromised(file, lock, Object.assign(/* @__PURE__ */ new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
94456
+ const mtime = mtimePrecision.getMtime(lock.mtimePrecision);
94457
+ options.fs.utimes(lock.lockfilePath, mtime, mtime, (err) => {
94458
+ const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
94459
+ if (lock.released) return;
94460
+ if (err) {
94461
+ if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
94462
+ lock.updateDelay = 1e3;
94463
+ return updateLock(file, options);
94464
+ }
94465
+ lock.mtime = mtime;
94466
+ lock.lastUpdate = Date.now();
94467
+ lock.updateDelay = null;
94468
+ updateLock(file, options);
94469
+ });
94470
+ });
94471
+ }, lock.updateDelay);
94472
+ /* istanbul ignore else */
94473
+ if (lock.updateTimeout && lock.updateTimeout.unref) lock.updateTimeout.unref();
94474
+ }
94475
+ function setLockAsCompromised(file, lock, err) {
94476
+ lock.released = true;
94477
+ /* istanbul ignore if */
94478
+ if (lock.updateTimeout) clearTimeout(lock.updateTimeout);
94479
+ const lockKey = file + lock.lockfilePath;
94480
+ if (locks[lockKey] === lock) delete locks[lockKey];
94481
+ lock.options.onCompromised(err);
94482
+ }
94483
+ function lock(file, options, callback) {
94484
+ /* istanbul ignore next */
94485
+ const merged = {
94486
+ stale: 1e4,
94487
+ update: null,
94488
+ realpath: true,
94489
+ retries: { retries: 0 },
94490
+ fs: graceful_fs_1.default,
94491
+ onCompromised: (err) => {
94492
+ throw err;
94493
+ },
94494
+ lockfilePath: "",
94495
+ ...options
94496
+ };
94497
+ let retries = merged.retries || { retries: 0 };
94498
+ retries = typeof retries === "number" ? { retries } : retries;
94499
+ const stale = Math.max(merged.stale || 0, 2e3);
94500
+ let update = merged.update == null ? stale / 2 : merged.update || 0;
94501
+ update = Math.max(Math.min(update, stale / 2), 1e3);
94502
+ const opts = {
94503
+ stale,
94504
+ update,
94505
+ realpath: merged.realpath,
94506
+ retries,
94507
+ fs: merged.fs,
94508
+ onCompromised: merged.onCompromised,
94509
+ lockfilePath: merged.lockfilePath
94510
+ };
94511
+ resolveCanonicalPath(file, opts, (err, resolvedFile) => {
94512
+ if (err) return callback(err);
94513
+ file = resolvedFile;
94514
+ const operation = retry_1.default.operation(opts.retries);
94515
+ operation.attempt(() => {
94516
+ acquireLock(file, opts, (err, mtime, precision) => {
94517
+ if (operation.retry(err)) return;
94518
+ if (err) return callback(operation.mainError());
94519
+ const lockKey = file + opts.lockfilePath;
94520
+ const lockEntry = locks[lockKey] = {
94521
+ lockfilePath: getLockFile(file, opts),
94522
+ file,
94523
+ mtime,
94524
+ mtimePrecision: precision,
94525
+ options: opts,
94526
+ lastUpdate: Date.now(),
94527
+ released: false,
94528
+ updateTimeout: null,
94529
+ updateDelay: null
94530
+ };
94531
+ updateLock(file, opts);
94532
+ callback(null, (releasedCallback) => {
94533
+ if (lockEntry.released) return releasedCallback && releasedCallback(Object.assign(/* @__PURE__ */ new Error("Lock is already released"), { code: "ERELEASED" }));
94534
+ unlock(file, {
94535
+ ...opts,
94536
+ realpath: false
94537
+ }, releasedCallback);
94538
+ });
94539
+ });
94540
+ });
94541
+ });
94542
+ }
94543
+ function unlock(file, options, callback) {
94544
+ const opts = {
94545
+ fs: graceful_fs_1.default,
94546
+ realpath: true,
94547
+ lockfilePath: "",
94548
+ ...options
94549
+ };
94550
+ resolveCanonicalPath(file, opts, (err, resolvedFile) => {
94551
+ if (err) return callback(err);
94552
+ file = resolvedFile;
94553
+ const lockKey = file + opts.lockfilePath;
94554
+ const lockEntry = locks[lockKey];
94555
+ if (!lockEntry) return callback(Object.assign(/* @__PURE__ */ new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
94556
+ lockEntry.updateTimeout && clearTimeout(lockEntry.updateTimeout);
94557
+ lockEntry.released = true;
94558
+ delete locks[lockKey];
94559
+ removeLock(file, opts, callback);
94560
+ });
94561
+ }
94562
+ function check(file, options, callback) {
94563
+ const merged = {
94564
+ stale: 1e4,
94565
+ realpath: true,
94566
+ fs: graceful_fs_1.default,
94567
+ lockfilePath: "",
94568
+ ...options
94569
+ };
94570
+ const opts = {
94571
+ ...merged,
94572
+ stale: Math.max(merged.stale || 0, 2e3)
94573
+ };
94574
+ resolveCanonicalPath(file, opts, (err, resolvedFile) => {
94575
+ if (err) return callback(err);
94576
+ file = resolvedFile;
94577
+ opts.fs.stat(getLockFile(file, opts), (err, stat) => {
94578
+ if (err) return err.code === "ENOENT" ? callback(null, false) : callback(err);
94579
+ return callback(null, !isLockStale(stat, opts));
94580
+ });
94581
+ });
94582
+ }
94583
+ function getLocks() {
94584
+ return locks;
94585
+ }
94586
+ /* istanbul ignore next */
94587
+ (0, signal_exit_1.onExit)(() => {
94588
+ for (const entry of Object.values(locks)) try {
94589
+ entry.options.fs.rmdirSync(entry.lockfilePath);
94590
+ } catch (e) {}
94591
+ });
94592
+ }));
94593
+ //#endregion
94594
+ //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/adapter.js
94595
+ var require_adapter = /* @__PURE__ */ __commonJSMin(((exports) => {
94596
+ var __importDefault = exports && exports.__importDefault || function(mod) {
94597
+ return mod && mod.__esModule ? mod : { "default": mod };
94598
+ };
94599
+ Object.defineProperty(exports, "__esModule", { value: true });
94600
+ exports.toPromise = toPromise;
94601
+ exports.toSync = toSync;
94602
+ exports.toSyncOptions = toSyncOptions;
94603
+ const graceful_fs_1 = __importDefault(require_graceful_fs());
94604
+ function createSyncFs(inputFs) {
94605
+ const methods = [
94606
+ "mkdir",
94607
+ "realpath",
94608
+ "stat",
94609
+ "rmdir",
94610
+ "utimes"
94611
+ ];
94612
+ const newFs = { ...inputFs };
94613
+ methods.forEach((method) => {
94614
+ newFs[method] = (...args) => {
94615
+ const callback = args.pop();
94616
+ let ret;
94617
+ try {
94618
+ ret = inputFs[`${method}Sync`](...args);
94619
+ } catch (err) {
94620
+ return callback(err);
94621
+ }
94622
+ callback(null, ret);
94623
+ };
94624
+ });
94625
+ return newFs;
94626
+ }
94627
+ function toPromise(method) {
94628
+ return (...args) => new Promise((resolve, reject) => {
94629
+ args.push((err, result) => {
94630
+ if (err) reject(err);
94631
+ else resolve(result);
94632
+ });
94633
+ method(...args);
94634
+ });
94635
+ }
94636
+ function toSync(method) {
94637
+ return (...args) => {
94638
+ let err;
94639
+ let result;
94640
+ args.push((_err, _result) => {
94641
+ err = _err ?? void 0;
94642
+ result = _result;
94643
+ });
94644
+ method(...args);
94645
+ if (err) throw err;
94646
+ return result;
94647
+ };
94648
+ }
94649
+ function toSyncOptions(options) {
94650
+ const opts = { ...options };
94651
+ opts.fs = createSyncFs(opts.fs || graceful_fs_1.default);
94652
+ if (typeof opts.retries === "number" && opts.retries > 0 || opts.retries && typeof opts.retries.retries === "number" && opts.retries.retries > 0) throw Object.assign(/* @__PURE__ */ new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
94653
+ return opts;
94654
+ }
94655
+ }));
94656
+ //#endregion
94657
+ //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/index.js
94658
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94659
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
94660
+ if (k2 === void 0) k2 = k;
94661
+ var desc = Object.getOwnPropertyDescriptor(m, k);
94662
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
94663
+ enumerable: true,
94664
+ get: function() {
94665
+ return m[k];
94666
+ }
94667
+ };
94668
+ Object.defineProperty(o, k2, desc);
94669
+ }) : (function(o, m, k, k2) {
94670
+ if (k2 === void 0) k2 = k;
94671
+ o[k2] = m[k];
94672
+ }));
94673
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
94674
+ Object.defineProperty(o, "default", {
94675
+ enumerable: true,
94676
+ value: v
94677
+ });
94678
+ }) : function(o, v) {
94679
+ o["default"] = v;
94680
+ });
94681
+ const lockfileModule = (exports && exports.__importStar || (function() {
94682
+ var ownKeys = function(o) {
94683
+ ownKeys = Object.getOwnPropertyNames || function(o) {
94684
+ var ar = [];
94685
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
94686
+ return ar;
94687
+ };
94688
+ return ownKeys(o);
94689
+ };
94690
+ return function(mod) {
94691
+ if (mod && mod.__esModule) return mod;
94692
+ var result = {};
94693
+ if (mod != null) {
94694
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
94695
+ }
94696
+ __setModuleDefault(result, mod);
94697
+ return result;
94698
+ };
94699
+ })())(require_lockfile());
94700
+ const adapter_1 = require_adapter();
94701
+ async function lock(file, options) {
94702
+ const release = await (0, adapter_1.toPromise)(lockfileModule.lock)(file, options);
94703
+ return (0, adapter_1.toPromise)(release);
94704
+ }
94705
+ function lockSync(file, options) {
94706
+ const release = (0, adapter_1.toSync)(lockfileModule.lock)(file, (0, adapter_1.toSyncOptions)(options));
94707
+ return (0, adapter_1.toSync)(release);
94708
+ }
94709
+ function unlock(file, options) {
94710
+ return (0, adapter_1.toPromise)(lockfileModule.unlock)(file, options);
94711
+ }
94712
+ function unlockSync(file, options) {
94713
+ return (0, adapter_1.toSync)(lockfileModule.unlock)(file, (0, adapter_1.toSyncOptions)(options));
94714
+ }
94715
+ function check(file, options) {
94716
+ return (0, adapter_1.toPromise)(lockfileModule.check)(file, options);
94717
+ }
94718
+ function checkSync(file, options) {
94719
+ return (0, adapter_1.toSync)(lockfileModule.check)(file, (0, adapter_1.toSyncOptions)(options));
94720
+ }
94721
+ module.exports = Object.assign(lock, {
94722
+ lock,
94723
+ unlock,
94724
+ lockSync,
94725
+ unlockSync,
94726
+ check,
94727
+ checkSync
94728
+ });
94729
+ }));
94730
+ //#endregion
94731
+ //#region dist/node/runtime/node/community/start-lock.js
93364
94732
  var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
94733
+ var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
94734
+ const START_LOCK_CHECK_OPTIONS = {
94735
+ realpath: false,
94736
+ stale: 1e4
94737
+ };
94738
+ function getStartLockPaths({ dataPath, communityAddress }) {
94739
+ const communityDbPath = path.join(dataPath, "communities", communityAddress);
94740
+ return {
94741
+ communityDbPath,
94742
+ lockfilePath: `${communityDbPath}.start.lock`
94743
+ };
94744
+ }
94745
+ async function isCommunityStartLocked(args) {
94746
+ const { communityDbPath, lockfilePath } = getStartLockPaths(args);
94747
+ return import_src.default.check(communityDbPath, {
94748
+ ...START_LOCK_CHECK_OPTIONS,
94749
+ lockfilePath
94750
+ });
94751
+ }
94752
+ function isCommunityStartLockedSync(args) {
94753
+ const { communityDbPath, lockfilePath } = getStartLockPaths(args);
94754
+ return import_src.default.checkSync(communityDbPath, {
94755
+ ...START_LOCK_CHECK_OPTIONS,
94756
+ lockfilePath
94757
+ });
94758
+ }
94759
+ //#endregion
94760
+ //#region dist/node/community/communities-entry-util.js
94761
+ function doesCommunitiesEntryMatch(entry, lookup) {
94762
+ const identifiers = [
94763
+ lookup.address,
94764
+ lookup.name,
94765
+ lookup.publicKey
94766
+ ].filter((id) => typeof id === "string");
94767
+ if (identifiers.length === 0) return false;
94768
+ return identifiers.every((id) => id === entry.publicKey || entry.name !== void 0 && areEquivalentNames(entry.name, id));
94769
+ }
94770
+ function findCommunitiesEntry(entries, lookup) {
94771
+ return entries.find((entry) => doesCommunitiesEntryMatch(entry, lookup));
94772
+ }
94773
+ function toCommunitiesEntry({ name, publicKey, started }) {
94774
+ return name !== void 0 ? {
94775
+ name,
94776
+ publicKey,
94777
+ address: name,
94778
+ started
94779
+ } : {
94780
+ publicKey,
94781
+ address: publicKey,
94782
+ started
94783
+ };
94784
+ }
94785
+ function toCommunitiesWireEntry({ name, publicKey, started }) {
94786
+ return name !== void 0 ? {
94787
+ name,
94788
+ publicKey,
94789
+ started
94790
+ } : {
94791
+ publicKey,
94792
+ started
94793
+ };
94794
+ }
94795
+ //#endregion
94796
+ //#region dist/node/runtime/node/util.js
93365
94797
  const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
93366
94798
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
93367
94799
  let filename;
@@ -93529,9 +94961,77 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
93529
94961
  }
93530
94962
  }
93531
94963
  }
94964
+ const localCommunityIdentities = /* @__PURE__ */ new WeakMap();
94965
+ function getLocalCommunityIdentities(pkc) {
94966
+ let identities = localCommunityIdentities.get(pkc);
94967
+ if (!identities) localCommunityIdentities.set(pkc, identities = /* @__PURE__ */ new Map());
94968
+ return identities;
94969
+ }
94970
+ function readLocalCommunityIdentity(pkc, communityAddress) {
94971
+ const log = logger_default("pkc-js:readLocalCommunityIdentity");
94972
+ const dbPath = path.join(pkc.dataPath, "communities", communityAddress);
94973
+ let db;
94974
+ try {
94975
+ db = new Database(dbPath, {
94976
+ readonly: true,
94977
+ fileMustExist: true
94978
+ });
94979
+ const row = db.prepare("SELECT value FROM keyv WHERE key = ?").get(`keyv:${STORAGE_KEYS[STORAGE_KEYS.INTERNAL_COMMUNITY]}`);
94980
+ const internalState = row ? JSON.parse(row.value)?.value : void 0;
94981
+ const publicKey = internalState?.anchor?.publicKey ?? internalState?.signer?.address;
94982
+ if (typeof publicKey !== "string") {
94983
+ log(`Community DB (${communityAddress}) has no internal state yet, leaving it out of pkc.communities for now`);
94984
+ return;
94985
+ }
94986
+ return isStringDomain(communityAddress) ? {
94987
+ name: communityAddress,
94988
+ publicKey
94989
+ } : { publicKey };
94990
+ } catch (e) {
94991
+ log.error(`Failed to read the identity of community DB (${communityAddress}), leaving it out of pkc.communities for now`, e);
94992
+ return;
94993
+ } finally {
94994
+ db?.close();
94995
+ }
94996
+ }
94997
+ function listCommunitiesEntriesSync(pkc) {
94998
+ const communityAddresses = listCommunitiesSync(pkc);
94999
+ const identities = getLocalCommunityIdentities(pkc);
95000
+ for (const cachedAddress of identities.keys()) if (!communityAddresses.includes(cachedAddress)) identities.delete(cachedAddress);
95001
+ const entries = [];
95002
+ for (const communityAddress of communityAddresses) {
95003
+ let identity = identities.get(communityAddress);
95004
+ if (!identity) {
95005
+ identity = readLocalCommunityIdentity(pkc, communityAddress);
95006
+ if (!identity) continue;
95007
+ identities.set(communityAddress, identity);
95008
+ }
95009
+ entries.push(toCommunitiesEntry({
95010
+ ...identity,
95011
+ started: isCommunityStartLockedSync({
95012
+ dataPath: pkc.dataPath,
95013
+ communityAddress
95014
+ })
95015
+ }));
95016
+ }
95017
+ return entries;
95018
+ }
95019
+ function findLocalCommunityAddress(pkc, lookup) {
95020
+ const identities = getLocalCommunityIdentities(pkc);
95021
+ const communityAddresses = listCommunitiesSync(pkc);
95022
+ const identifiers = [
95023
+ lookup.address,
95024
+ lookup.name,
95025
+ lookup.publicKey
95026
+ ].filter((id) => typeof id === "string");
95027
+ return communityAddresses.find((communityAddress) => {
95028
+ const identity = identities.get(communityAddress);
95029
+ return identity && doesCommunitiesEntryMatch(identity, lookup);
95030
+ }) ?? communityAddresses.find((communityAddress) => !identities.has(communityAddress) && identifiers.length > 0 && identifiers.every((id) => areEquivalentNames(communityAddress, id)));
95031
+ }
93532
95032
  function refreshCommunitiesList(pkc) {
93533
- const currentCommunities = listCommunitiesSync(pkc);
93534
- if (stringify(currentCommunities) !== stringify(pkc.communities)) pkc.emit("communitieschange", currentCommunities);
95033
+ const communities = listCommunitiesEntriesSync(pkc);
95034
+ if (stringify(communities) !== stringify(pkc.communities)) pkc.emit("communitieschange", { communities });
93535
95035
  }
93536
95036
  function listCommunitiesSync(pkc) {
93537
95037
  const log = logger_default("pkc-js:listCommunitiesSync");
@@ -93541,7 +95041,8 @@ function listCommunitiesSync(pkc) {
93541
95041
  recursive: false,
93542
95042
  withFileTypes: true
93543
95043
  }).filter((dirent) => dirent.isFile()).map((dirent) => dirent.name).filter((file) => !file.includes(".lock") && !file.endsWith("-journal") && !file.endsWith("-shm") && !file.endsWith("-wal"));
93544
- const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
95044
+ const knownCommunities = getLocalCommunityIdentities(pkc);
95045
+ const communityFilesWeDontNeedToCheck = files.filter((address) => knownCommunities.has(address));
93545
95046
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
93546
95047
  const filePath = path.join(communitiesPath, address);
93547
95048
  try {
@@ -93746,23 +95247,40 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
93746
95247
  timeout: onehourMs
93747
95248
  });
93748
95249
  }
95250
+ const COMMUNITIES_DIR_EXTENSIONS_TO_IGNORE = [
95251
+ ".lock",
95252
+ "-journal",
95253
+ "-shm",
95254
+ "-wal"
95255
+ ];
95256
+ const START_LOCK_SUFFIX = ".start.lock";
95257
+ function isCommunitiesListChangeEvent({ pkc, filename }) {
95258
+ if (typeof filename !== "string") return true;
95259
+ if (filename.endsWith(START_LOCK_SUFFIX)) {
95260
+ const communityAddress = filename.slice(0, -11);
95261
+ const entry = pkc.communities.find((listed) => listed.address === communityAddress);
95262
+ if (!entry) return true;
95263
+ return entry.started !== isCommunityStartLockedSync({
95264
+ dataPath: pkc.dataPath,
95265
+ communityAddress
95266
+ });
95267
+ }
95268
+ return !COMMUNITIES_DIR_EXTENSIONS_TO_IGNORE.some((ext) => filename.endsWith(ext));
95269
+ }
93749
95270
  async function monitorCommunitiesDirectory(pkc) {
93750
95271
  const watchAbortController = new AbortController();
93751
95272
  const communitiesPath = path.join(pkc.dataPath, "communities");
93752
95273
  await promises.mkdir(communitiesPath, { recursive: true });
93753
- const extensionsToIgnore = [
93754
- ".lock",
93755
- "-journal",
93756
- "-shm",
93757
- "-wal"
93758
- ];
93759
95274
  let isProcessingChange = false;
93760
95275
  refreshCommunitiesList(pkc);
93761
95276
  watch(communitiesPath, {
93762
95277
  signal: watchAbortController.signal,
93763
95278
  persistent: false
93764
95279
  }, (eventType, filename) => {
93765
- if (typeof filename === "string" && extensionsToIgnore.some((ext) => filename.endsWith(ext))) return;
95280
+ if (!isCommunitiesListChangeEvent({
95281
+ pkc,
95282
+ filename
95283
+ })) return;
93766
95284
  if (isProcessingChange) return;
93767
95285
  isProcessingChange = true;
93768
95286
  try {
@@ -122425,7 +123943,12 @@ const RpcPublishChallengeAnswersParamSchema = object({
122425
123943
  });
122426
123944
  const RpcUnsubscribeParamSchema = object({ subscriptionId: SubscriptionIdSchema });
122427
123945
  const RpcStateChangeEventResultSchema = object({ state: string() });
122428
- const RpcCommunitiesChangeEventResultSchema = object({ communities: array(string()) });
123946
+ const PKCCommunitiesWireEntrySchema = object({
123947
+ name: string().min(1).optional(),
123948
+ publicKey: string().min(1),
123949
+ started: boolean()
123950
+ });
123951
+ const RpcCommunitiesChangeEventResultSchema = object({ communities: PKCCommunitiesWireEntrySchema.loose().array() });
122429
123952
  const RpcFetchCidResultSchema = object({ content: string() });
122430
123953
  const RpcResolveAuthorNameResultSchema = object({ resolvedAuthorName: string().nullable() });
122431
123954
  const RpcSuccessResultSchema = object({ success: literal(true) });
@@ -131663,4 +133186,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
131663
133186
  }
131664
133187
  };
131665
133188
  //#endregion
131666
- export { createSchemaRowParser as $, getCommunityAddressFromRecord as $n, RpcPublishCommunityListResultSchema as $t, findCommentInParsedPages as A, verifyChallengeMessage as An, t$2 as Ar, parseRpcCommentUpdateEventWithPKCErrorIfItFails as At, GenericStateClient as B, verifyCommunityList as Bn, NAME_RESOLVED_FALSE_TTL_MS as Br, RpcCommunityPageParamSchema as Bt, RepliesPages as C, signCommentUpdate as Cn, listCommunitiesSync as Cr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signCommunityList as Dn, resolveDbPostsCidRefs as Dr, parseJsonWithPKCErrorIfFails as Dt, buildPagesRuntimeFields as E, signCommunityEdit as En, refreshCommunitiesList as Er, parseDecryptedChallengeWithPKCErrorIfItFails as Et, cloneCrosspostForRuntime as F, verifyCommentModeration as Fn, n$6 as Fr, RpcAuthorNameParamSchema as Ft, PKCTypedEmitter as G, getAuthorNameFromWire as Gn, nativeFunctions$1 as Gr, RpcExportCommunityResultSchema as Gt, InflightResourceTypes as H, buildRuntimeAuthor as Hn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Hr, RpcExportCommunityModLogsParamSchema as Ht, collectCrosspostAuthorsToResolve as I, verifyCommentPubsubMessage as In, t$7 as Ir, RpcCancelExportParamSchema as It, decodeRpcChallengeRequestPubsubMsg as J, CreateNewCommunityListOptionsSchema as Jn, RpcFetchCommunityListParamSchema as Jt, decodeRpcChallengeAnswerPubsubMsg as K, normalizeCreatePublicationAuthor as Kn, require_undici as Kr, RpcFetchCidParamSchema as Kt, extractCrosspostRuntimeFields as L, verifyCommentUpdate as Ln, t$8 as Lr, RpcCidParamSchema as Lt, parseRawPages as M, verifyChallengeVerification as Mn, r as Mr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Mt, MAX_PAGE_SIZE_BYTES as N, verifyCommentEdit as Nn, t$5 as Nr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Nt, findCommentInPageInstance as O, signVote as On, setNativeFunctions as Or, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Ot, applyNameResolvedCacheToCrosspost as P, verifyCommentIpfs as Pn, n$5 as Pr, RpcAnchorPublishPreparationResultSchema as Pt, collectSchemaRowCoercions as Q, buildRuntimeCommunityFields as Qn, RpcPublishCommunityListParamSchema as Qt, stripNameResolvedFromCrosspost as R, verifyCommunity as Rn, stringify as Rr, RpcCommentRepliesPageParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signCommentModeration as Sn, importSignerIntoKuboNode as Sr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommunity as Tn, moveCommunityDbToDeletedDirectory as Tr, parseDecryptedChallengeVerification as Tt, pRetry as U, cleanWireAuthor as Un, STORAGE_KEYS as Ur, RpcExportCommunityModLogsResultSchema as Ut, InflightFetchManager as V, verifyVote as Vn, NAME_RESOLVED_TRUE_TTL_MS as Vr, RpcEditCommunityParamSchema as Vt, pLimit as W, getAuthorNameFromRuntime as Wn, require_lodash_merge as Wr, RpcExportCommunityParamSchema as Wt, coerceSchemaRowBoolean as X, crosspostChainDepthUpTo as Xn, RpcPublishAnchorRecordParamSchema as Xt, decodeRpcChallengeVerificationPubsubMsg as Y, MAX_COMMUNITY_LIST_SIZE_BYTES as Yn, RpcFetchCommunityListResultSchema as Yt, coerceSchemaRowJson as Z, effectiveMaxCrosspostDepth as Zn, RpcPublishChallengeAnswersParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeMessage as _n, deriveDbPosts as _r, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, findCommunityRecordNameMismatch as an, getBufferedPKCAddressFromPublicKey as ar, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, signComment as bn, getDefaultDataPath as br, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, createSigner as cn, getPKCAddressFromPublicKeySync as cr, parseCommentUpdateSchemaWithPKCErrorIfItFails as ct, getChallengeVerification as d, decryptEd25519AesGcmPublicKeyBuffer as dn, backupCommunityDb as dr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as dt, RpcPublishedAnchorRecordResultSchema as en, getCommunityNameFromWire$1 as er, parseCidStringSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, encryptEd25519AesGcm as fn, calculateExpectedSignatureSize as fr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signChallengeAnswer as gn, deriveCommentIpfsFromCommentTableRow as gr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, cleanUpBeforePublishing as hn, deleteOldCommunityInWindows as hr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, RpcUnsubscribeParamSchema as in, encode as ir, parseCommentIpfsSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyChallengeRequest as jn, t$4 as jr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyChallengeAnswer as kn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as kr, parseRpcCommentEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, createAnchorIpnsRecord as ln, getPublicKeyFromPrivateKey as lr, parseCommunityAddressWithPKCErrorIfItFails as lt, pkcJsChallenges as m, _validateSignatureOfPKCRecord as mn, createKuboRpcClient as mr, parseCommunityListSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcSubscriptionIdResultSchema as nn, normalizeCommunityInputFromCommunity as nr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, require_lib as on, getIpfsKeyFromPrivateKey as or, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, encryptEd25519AesGcmPublicKeyBuffer as pn, calculateInlineRepliesBudget as pr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as pt, decodeRpcChallengePubsubMsg as q, CreateCommunityListWithCidOptionsSchema as qn, RpcFetchCidResultSchema as qt, computePageSortsFingerprint as r, RpcSuccessResultSchema as rn, decode as rr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, SignerWithPublicKeyAddress as sn, getPKCAddressFromPublicKey as sr, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcResolveAuthorNameResultSchema as tn, getCommunityPublicKeyFromWire as tr, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, decryptEd25519AesGcm as un, BackupAbortError as ur, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signChallengeRequest as vn, deriveDbReplies as vr, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommentUpdateForChallengeVerification as wn, monitorCommunitiesDirectory as wr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as wt, RemoteCommunity as x, signCommentEdit as xn, getThumbnailPropsOfLink as xr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signChallengeVerification as yn, getDefaultCommunityDbConfig as yr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as yt, PKCClientsManager as z, verifyCommunityEdit as zn, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as zr, RpcCommunityIdentifierParamSchema as zt };
133189
+ export { createSchemaRowParser as $, buildRuntimeCommunityFields as $n, require_undici as $r, RpcPublishCommunityListParamSchema as $t, findCommentInParsedPages as A, verifyChallengeAnswer as An, setNativeFunctions as Ar, parseRpcCommentUpdateEventWithPKCErrorIfItFails as At, GenericStateClient as B, verifyCommunityEdit as Bn, t$5 as Br, RpcCommunityIdentifierParamSchema as Bt, RepliesPages as C, signCommentModeration as Cn, getThumbnailPropsOfLink as Cr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signCommunityEdit as Dn, moveCommunityDbToDeletedDirectory as Dr, parseJsonWithPKCErrorIfFails as Dt, buildPagesRuntimeFields as E, signCommunity as En, monitorCommunitiesDirectory as Er, parseDecryptedChallengeWithPKCErrorIfItFails as Et, cloneCrosspostForRuntime as F, verifyCommentIpfs as Fn, isCommunityStartLocked as Fr, RpcAuthorNameParamSchema as Ft, PKCTypedEmitter as G, getAuthorNameFromRuntime as Gn, stringify as Gr, RpcExportCommunityParamSchema as Gt, InflightResourceTypes as H, verifyVote as Hn, n$6 as Hr, RpcEditCommunityParamSchema as Ht, collectCrosspostAuthorsToResolve as I, verifyCommentModeration as In, require_src as Ir, RpcCancelExportParamSchema as It, decodeRpcChallengeRequestPubsubMsg as J, CreateCommunityListWithCidOptionsSchema as Jn, NAME_RESOLVED_TRUE_TTL_MS as Jr, RpcFetchCidResultSchema as Jt, decodeRpcChallengeAnswerPubsubMsg as K, getAuthorNameFromWire as Kn, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Kr, RpcExportCommunityResultSchema as Kt, extractCrosspostRuntimeFields as L, verifyCommentPubsubMessage as Ln, t$2 as Lr, RpcCidParamSchema as Lt, parseRawPages as M, verifyChallengeRequest as Mn, findCommunitiesEntry as Mr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Mt, MAX_PAGE_SIZE_BYTES as N, verifyChallengeVerification as Nn, toCommunitiesEntry as Nr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Nt, findCommentInPageInstance as O, signCommunityList as On, refreshCommunitiesList as Or, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Ot, applyNameResolvedCacheToCrosspost as P, verifyCommentEdit as Pn, toCommunitiesWireEntry as Pr, RpcAnchorPublishPreparationResultSchema as Pt, collectSchemaRowCoercions as Q, effectiveMaxCrosspostDepth as Qn, nativeFunctions$1 as Qr, RpcPublishChallengeAnswersParamSchema as Qt, stripNameResolvedFromCrosspost as R, verifyCommentUpdate as Rn, t$4 as Rr, RpcCommentRepliesPageParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signCommentEdit as Sn, getDefaultDataPath as Sr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommentUpdateForChallengeVerification as Tn, listCommunitiesSync as Tr, parseDecryptedChallengeVerification as Tt, pRetry as U, buildRuntimeAuthor as Un, t$7 as Ur, RpcExportCommunityModLogsParamSchema as Ut, InflightFetchManager as V, verifyCommunityList as Vn, n$5 as Vr, RpcCommunityPageParamSchema as Vt, pLimit as W, cleanWireAuthor as Wn, t$8 as Wr, RpcExportCommunityModLogsResultSchema as Wt, coerceSchemaRowBoolean as X, MAX_COMMUNITY_LIST_SIZE_BYTES as Xn, STORAGE_KEYS as Xr, RpcFetchCommunityListResultSchema as Xt, decodeRpcChallengeVerificationPubsubMsg as Y, CreateNewCommunityListOptionsSchema as Yn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Yr, RpcFetchCommunityListParamSchema as Yt, coerceSchemaRowJson as Z, crosspostChainDepthUpTo as Zn, require_lodash_merge as Zr, RpcPublishAnchorRecordParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeAnswer as _n, deriveCommentIpfsFromCommentTableRow as _r, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, RpcUnsubscribeParamSchema as an, encode as ar, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, signChallengeVerification as bn, findLocalCommunityAddress as br, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, SignerWithPublicKeyAddress as cn, getPKCAddressFromPublicKey as cr, parseCommentUpdateSchemaWithPKCErrorIfItFails as ct, getChallengeVerification as d, decryptEd25519AesGcm as dn, BackupAbortError as dr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as dt, RpcPublishCommunityListResultSchema as en, getCommunityAddressFromRecord as er, parseCidStringSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, decryptEd25519AesGcmPublicKeyBuffer as fn, backupCommunityDb as fr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, cleanUpBeforePublishing as gn, deleteOldCommunityInWindows as gr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, _validateSignatureOfPKCRecord as hn, createKuboRpcClient as hr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, RpcSuccessResultSchema as in, decode as ir, parseCommentIpfsSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyChallengeMessage as jn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as jr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, signVote as kn, resolveDbPostsCidRefs as kr, parseRpcCommentEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, createSigner as ln, getPKCAddressFromPublicKeySync as lr, parseCommunityAddressWithPKCErrorIfItFails as lt, pkcJsChallenges as m, encryptEd25519AesGcmPublicKeyBuffer as mn, calculateInlineRepliesBudget as mr, parseCommunityListSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcResolveAuthorNameResultSchema as nn, getCommunityPublicKeyFromWire as nr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, findCommunityRecordNameMismatch as on, getBufferedPKCAddressFromPublicKey as or, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, encryptEd25519AesGcm as pn, calculateExpectedSignatureSize as pr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as pt, decodeRpcChallengePubsubMsg as q, normalizeCreatePublicationAuthor as qn, NAME_RESOLVED_FALSE_TTL_MS as qr, RpcFetchCidParamSchema as qt, computePageSortsFingerprint as r, RpcSubscriptionIdResultSchema as rn, normalizeCommunityInputFromCommunity as rr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, require_lib as sn, getIpfsKeyFromPrivateKey as sr, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcPublishedAnchorRecordResultSchema as tn, getCommunityNameFromWire$1 as tr, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, createAnchorIpnsRecord as un, getPublicKeyFromPrivateKey as ur, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signChallengeMessage as vn, deriveDbPosts as vr, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommentUpdate as wn, importSignerIntoKuboNode as wr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as wt, RemoteCommunity as x, signComment as xn, getDefaultCommunityDbConfig as xr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signChallengeRequest as yn, deriveDbReplies as yr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as yt, PKCClientsManager as z, verifyCommunity as zn, r as zr, RpcCommunitiesChangeEventResultSchema as zt };