@powerhousedao/connect 6.0.0-dev.83 → 6.0.0-dev.88
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.
- package/dist/src/components/app.d.ts.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/modal/modals/settings/package-manager.d.ts.map +1 -1
- package/dist/src/components/package-install-prompt.d.ts +3 -0
- package/dist/src/components/package-install-prompt.d.ts.map +1 -0
- package/dist/src/context/index.js +1269 -836
- package/dist/src/hooks/index.js +1267 -834
- package/dist/src/main.js +1769 -1154
- package/dist/src/pages/index.js +1767 -1152
- package/dist/src/store/index.js +1470 -946
- package/dist/src/store/reactor.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1289 -816
- package/dist/src/utils/reactor.d.ts +2 -2
- package/dist/src/utils/reactor.d.ts.map +1 -1
- package/dist/src/utils/registry-url.d.ts +2 -0
- package/dist/src/utils/registry-url.d.ts.map +1 -0
- package/dist/style.css +9 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
package/dist/src/store/index.js
CHANGED
|
@@ -4499,7 +4499,7 @@ var init_package = __esm(() => {
|
|
|
4499
4499
|
package_default = {
|
|
4500
4500
|
name: "@powerhousedao/connect",
|
|
4501
4501
|
productName: "Powerhouse-Connect",
|
|
4502
|
-
version: "6.0.0-dev.
|
|
4502
|
+
version: "6.0.0-dev.87",
|
|
4503
4503
|
description: "Powerhouse Connect",
|
|
4504
4504
|
main: "dist/index.html",
|
|
4505
4505
|
type: "module",
|
|
@@ -11192,6 +11192,11 @@ class CollectionMembershipCache {
|
|
|
11192
11192
|
constructor(operationIndex) {
|
|
11193
11193
|
this.operationIndex = operationIndex;
|
|
11194
11194
|
}
|
|
11195
|
+
withScopedIndex(operationIndex) {
|
|
11196
|
+
const scoped = new CollectionMembershipCache(operationIndex);
|
|
11197
|
+
scoped.cache = this.cache;
|
|
11198
|
+
return scoped;
|
|
11199
|
+
}
|
|
11195
11200
|
async getCollectionsForDocuments(documentIds) {
|
|
11196
11201
|
const result = {};
|
|
11197
11202
|
const missing = [];
|
|
@@ -11479,6 +11484,12 @@ class DocumentMetaCache {
|
|
|
11479
11484
|
this.cache = new Map;
|
|
11480
11485
|
this.lruTracker = new LRUTracker;
|
|
11481
11486
|
}
|
|
11487
|
+
withScopedStore(operationStore) {
|
|
11488
|
+
const scoped = new DocumentMetaCache(operationStore, this.config);
|
|
11489
|
+
scoped.cache = this.cache;
|
|
11490
|
+
scoped.lruTracker = this.lruTracker;
|
|
11491
|
+
return scoped;
|
|
11492
|
+
}
|
|
11482
11493
|
async startup() {
|
|
11483
11494
|
return Promise.resolve();
|
|
11484
11495
|
}
|
|
@@ -11628,9 +11639,18 @@ class KyselyOperationIndexTxn {
|
|
|
11628
11639
|
|
|
11629
11640
|
class KyselyOperationIndex {
|
|
11630
11641
|
db;
|
|
11642
|
+
trx;
|
|
11631
11643
|
constructor(db) {
|
|
11632
11644
|
this.db = db;
|
|
11633
11645
|
}
|
|
11646
|
+
get queryExecutor() {
|
|
11647
|
+
return this.trx ?? this.db;
|
|
11648
|
+
}
|
|
11649
|
+
withTransaction(trx) {
|
|
11650
|
+
const instance = new KyselyOperationIndex(this.db);
|
|
11651
|
+
instance.trx = trx;
|
|
11652
|
+
return instance;
|
|
11653
|
+
}
|
|
11634
11654
|
start() {
|
|
11635
11655
|
return new KyselyOperationIndexTxn;
|
|
11636
11656
|
}
|
|
@@ -11639,70 +11659,76 @@ class KyselyOperationIndex {
|
|
|
11639
11659
|
throw new Error("Operation aborted");
|
|
11640
11660
|
}
|
|
11641
11661
|
const kyselyTxn = txn;
|
|
11662
|
+
if (this.trx) {
|
|
11663
|
+
return this.executeCommit(this.trx, kyselyTxn);
|
|
11664
|
+
}
|
|
11665
|
+
let resultOrdinals = [];
|
|
11666
|
+
await this.db.transaction().execute(async (trx) => {
|
|
11667
|
+
resultOrdinals = await this.executeCommit(trx, kyselyTxn);
|
|
11668
|
+
});
|
|
11669
|
+
return resultOrdinals;
|
|
11670
|
+
}
|
|
11671
|
+
async executeCommit(trx, kyselyTxn) {
|
|
11642
11672
|
const collections = kyselyTxn.getCollections();
|
|
11643
11673
|
const memberships = kyselyTxn.getCollectionMembershipRecords();
|
|
11644
11674
|
const removals = kyselyTxn.getCollectionRemovals();
|
|
11645
11675
|
const operations = kyselyTxn.getOperations();
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11676
|
+
if (collections.length > 0) {
|
|
11677
|
+
const collectionRows = collections.map((collectionId) => ({
|
|
11678
|
+
documentId: collectionId,
|
|
11679
|
+
collectionId,
|
|
11680
|
+
joinedOrdinal: BigInt(0),
|
|
11681
|
+
leftOrdinal: null
|
|
11682
|
+
}));
|
|
11683
|
+
await trx.insertInto("document_collections").values(collectionRows).onConflict((oc) => oc.doNothing()).execute();
|
|
11684
|
+
}
|
|
11685
|
+
let operationOrdinals = [];
|
|
11686
|
+
if (operations.length > 0) {
|
|
11687
|
+
const operationRows = operations.map((op) => ({
|
|
11688
|
+
opId: op.id || "",
|
|
11689
|
+
documentId: op.documentId,
|
|
11690
|
+
documentType: op.documentType,
|
|
11691
|
+
scope: op.scope,
|
|
11692
|
+
branch: op.branch,
|
|
11693
|
+
timestampUtcMs: op.timestampUtcMs,
|
|
11694
|
+
index: op.index,
|
|
11695
|
+
skip: op.skip,
|
|
11696
|
+
hash: op.hash,
|
|
11697
|
+
action: op.action,
|
|
11698
|
+
sourceRemote: op.sourceRemote
|
|
11699
|
+
}));
|
|
11700
|
+
const insertedOps = await trx.insertInto("operation_index_operations").values(operationRows).returning("ordinal").execute();
|
|
11701
|
+
operationOrdinals = insertedOps.map((row) => row.ordinal);
|
|
11702
|
+
}
|
|
11703
|
+
if (memberships.length > 0) {
|
|
11704
|
+
for (const m of memberships) {
|
|
11705
|
+
const ordinal = operationOrdinals[m.operationIndex];
|
|
11706
|
+
await trx.insertInto("document_collections").values({
|
|
11707
|
+
documentId: m.documentId,
|
|
11708
|
+
collectionId: m.collectionId,
|
|
11709
|
+
joinedOrdinal: BigInt(ordinal),
|
|
11653
11710
|
leftOrdinal: null
|
|
11654
|
-
}))
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
if (operations.length > 0) {
|
|
11659
|
-
const operationRows = operations.map((op) => ({
|
|
11660
|
-
opId: op.id || "",
|
|
11661
|
-
documentId: op.documentId,
|
|
11662
|
-
documentType: op.documentType,
|
|
11663
|
-
scope: op.scope,
|
|
11664
|
-
branch: op.branch,
|
|
11665
|
-
timestampUtcMs: op.timestampUtcMs,
|
|
11666
|
-
index: op.index,
|
|
11667
|
-
skip: op.skip,
|
|
11668
|
-
hash: op.hash,
|
|
11669
|
-
action: op.action,
|
|
11670
|
-
sourceRemote: op.sourceRemote
|
|
11671
|
-
}));
|
|
11672
|
-
const insertedOps = await trx.insertInto("operation_index_operations").values(operationRows).returning("ordinal").execute();
|
|
11673
|
-
operationOrdinals = insertedOps.map((row) => row.ordinal);
|
|
11674
|
-
resultOrdinals = operationOrdinals;
|
|
11675
|
-
}
|
|
11676
|
-
if (memberships.length > 0) {
|
|
11677
|
-
for (const m of memberships) {
|
|
11678
|
-
const ordinal = operationOrdinals[m.operationIndex];
|
|
11679
|
-
await trx.insertInto("document_collections").values({
|
|
11680
|
-
documentId: m.documentId,
|
|
11681
|
-
collectionId: m.collectionId,
|
|
11682
|
-
joinedOrdinal: BigInt(ordinal),
|
|
11683
|
-
leftOrdinal: null
|
|
11684
|
-
}).onConflict((oc) => oc.columns(["documentId", "collectionId"]).doUpdateSet({
|
|
11685
|
-
joinedOrdinal: BigInt(ordinal),
|
|
11686
|
-
leftOrdinal: null
|
|
11687
|
-
})).execute();
|
|
11688
|
-
}
|
|
11711
|
+
}).onConflict((oc) => oc.columns(["documentId", "collectionId"]).doUpdateSet({
|
|
11712
|
+
joinedOrdinal: BigInt(ordinal),
|
|
11713
|
+
leftOrdinal: null
|
|
11714
|
+
})).execute();
|
|
11689
11715
|
}
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
}
|
|
11716
|
+
}
|
|
11717
|
+
if (removals.length > 0) {
|
|
11718
|
+
for (const r of removals) {
|
|
11719
|
+
const ordinal = operationOrdinals[r.operationIndex];
|
|
11720
|
+
await trx.updateTable("document_collections").set({
|
|
11721
|
+
leftOrdinal: BigInt(ordinal)
|
|
11722
|
+
}).where("collectionId", "=", r.collectionId).where("documentId", "=", r.documentId).where("leftOrdinal", "is", null).execute();
|
|
11697
11723
|
}
|
|
11698
|
-
}
|
|
11699
|
-
return
|
|
11724
|
+
}
|
|
11725
|
+
return operationOrdinals;
|
|
11700
11726
|
}
|
|
11701
11727
|
async find(collectionId, cursor, view, paging, signal) {
|
|
11702
11728
|
if (signal?.aborted) {
|
|
11703
11729
|
throw new Error("Operation aborted");
|
|
11704
11730
|
}
|
|
11705
|
-
let query = this.
|
|
11731
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations as oi").innerJoin("document_collections as dc", "oi.documentId", "dc.documentId").selectAll("oi").select(["dc.documentId", "dc.collectionId"]).where("dc.collectionId", "=", collectionId).where(sql`(dc."leftOrdinal" IS NULL OR oi.ordinal < dc."leftOrdinal")`).orderBy("oi.ordinal", "asc");
|
|
11706
11732
|
if (cursor !== undefined) {
|
|
11707
11733
|
query = query.where("oi.ordinal", ">", cursor);
|
|
11708
11734
|
}
|
|
@@ -11744,7 +11770,7 @@ class KyselyOperationIndex {
|
|
|
11744
11770
|
if (signal?.aborted) {
|
|
11745
11771
|
throw new Error("Operation aborted");
|
|
11746
11772
|
}
|
|
11747
|
-
let query = this.
|
|
11773
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations").selectAll().where("documentId", "=", documentId).orderBy("ordinal", "asc");
|
|
11748
11774
|
if (view?.branch) {
|
|
11749
11775
|
query = query.where("branch", "=", view.branch);
|
|
11750
11776
|
}
|
|
@@ -11780,7 +11806,7 @@ class KyselyOperationIndex {
|
|
|
11780
11806
|
if (signal?.aborted) {
|
|
11781
11807
|
throw new Error("Operation aborted");
|
|
11782
11808
|
}
|
|
11783
|
-
let query = this.
|
|
11809
|
+
let query = this.queryExecutor.selectFrom("operation_index_operations").selectAll().where("ordinal", ">", ordinal).orderBy("ordinal", "asc");
|
|
11784
11810
|
if (paging?.cursor) {
|
|
11785
11811
|
const cursorOrdinal = Number.parseInt(paging.cursor, 10);
|
|
11786
11812
|
query = query.where("ordinal", ">", cursorOrdinal);
|
|
@@ -11845,14 +11871,14 @@ class KyselyOperationIndex {
|
|
|
11845
11871
|
if (signal?.aborted) {
|
|
11846
11872
|
throw new Error("Operation aborted");
|
|
11847
11873
|
}
|
|
11848
|
-
const result = await this.
|
|
11874
|
+
const result = await this.queryExecutor.selectFrom("operation_index_operations as oi").innerJoin("document_collections as dc", "oi.documentId", "dc.documentId").select("oi.timestampUtcMs").where("dc.collectionId", "=", collectionId).where(sql`(dc."leftOrdinal" IS NULL OR oi.ordinal < dc."leftOrdinal")`).orderBy("oi.ordinal", "desc").limit(1).executeTakeFirst();
|
|
11849
11875
|
return result?.timestampUtcMs ?? null;
|
|
11850
11876
|
}
|
|
11851
11877
|
async getCollectionsForDocuments(documentIds) {
|
|
11852
11878
|
if (documentIds.length === 0) {
|
|
11853
11879
|
return {};
|
|
11854
11880
|
}
|
|
11855
|
-
const rows = await this.
|
|
11881
|
+
const rows = await this.queryExecutor.selectFrom("document_collections").select(["documentId", "collectionId"]).where("documentId", "in", documentIds).where("leftOrdinal", "is", null).execute();
|
|
11856
11882
|
const result = {};
|
|
11857
11883
|
for (const row of rows) {
|
|
11858
11884
|
if (!(row.documentId in result)) {
|
|
@@ -11926,6 +11952,12 @@ class KyselyWriteCache {
|
|
|
11926
11952
|
this.streams = new Map;
|
|
11927
11953
|
this.lruTracker = new LRUTracker;
|
|
11928
11954
|
}
|
|
11955
|
+
withScopedStores(operationStore, keyframeStore) {
|
|
11956
|
+
const scoped = new KyselyWriteCache(keyframeStore, operationStore, this.registry, this.config);
|
|
11957
|
+
scoped.streams = this.streams;
|
|
11958
|
+
scoped.lruTracker = this.lruTracker;
|
|
11959
|
+
return scoped;
|
|
11960
|
+
}
|
|
11929
11961
|
async startup() {
|
|
11930
11962
|
return Promise.resolve();
|
|
11931
11963
|
}
|
|
@@ -12234,6 +12266,63 @@ class EventBus {
|
|
|
12234
12266
|
}
|
|
12235
12267
|
}
|
|
12236
12268
|
|
|
12269
|
+
class DefaultExecutionScope {
|
|
12270
|
+
operationStore;
|
|
12271
|
+
operationIndex;
|
|
12272
|
+
writeCache;
|
|
12273
|
+
documentMetaCache;
|
|
12274
|
+
collectionMembershipCache;
|
|
12275
|
+
constructor(operationStore, operationIndex, writeCache, documentMetaCache, collectionMembershipCache) {
|
|
12276
|
+
this.operationStore = operationStore;
|
|
12277
|
+
this.operationIndex = operationIndex;
|
|
12278
|
+
this.writeCache = writeCache;
|
|
12279
|
+
this.documentMetaCache = documentMetaCache;
|
|
12280
|
+
this.collectionMembershipCache = collectionMembershipCache;
|
|
12281
|
+
}
|
|
12282
|
+
async run(fn) {
|
|
12283
|
+
return fn({
|
|
12284
|
+
operationStore: this.operationStore,
|
|
12285
|
+
operationIndex: this.operationIndex,
|
|
12286
|
+
writeCache: this.writeCache,
|
|
12287
|
+
documentMetaCache: this.documentMetaCache,
|
|
12288
|
+
collectionMembershipCache: this.collectionMembershipCache
|
|
12289
|
+
});
|
|
12290
|
+
}
|
|
12291
|
+
}
|
|
12292
|
+
|
|
12293
|
+
class KyselyExecutionScope {
|
|
12294
|
+
db;
|
|
12295
|
+
operationStore;
|
|
12296
|
+
operationIndex;
|
|
12297
|
+
keyframeStore;
|
|
12298
|
+
writeCache;
|
|
12299
|
+
documentMetaCache;
|
|
12300
|
+
collectionMembershipCache;
|
|
12301
|
+
constructor(db, operationStore, operationIndex, keyframeStore, writeCache, documentMetaCache, collectionMembershipCache) {
|
|
12302
|
+
this.db = db;
|
|
12303
|
+
this.operationStore = operationStore;
|
|
12304
|
+
this.operationIndex = operationIndex;
|
|
12305
|
+
this.keyframeStore = keyframeStore;
|
|
12306
|
+
this.writeCache = writeCache;
|
|
12307
|
+
this.documentMetaCache = documentMetaCache;
|
|
12308
|
+
this.collectionMembershipCache = collectionMembershipCache;
|
|
12309
|
+
}
|
|
12310
|
+
async run(fn) {
|
|
12311
|
+
return this.db.transaction().execute(async (trx) => {
|
|
12312
|
+
const scopedOperationStore = this.operationStore.withTransaction(trx);
|
|
12313
|
+
const scopedOperationIndex = this.operationIndex.withTransaction(trx);
|
|
12314
|
+
const scopedKeyframeStore = this.keyframeStore.withTransaction(trx);
|
|
12315
|
+
return fn({
|
|
12316
|
+
operationStore: scopedOperationStore,
|
|
12317
|
+
operationIndex: scopedOperationIndex,
|
|
12318
|
+
writeCache: this.writeCache.withScopedStores(scopedOperationStore, scopedKeyframeStore),
|
|
12319
|
+
documentMetaCache: this.documentMetaCache.withScopedStore(scopedOperationStore),
|
|
12320
|
+
collectionMembershipCache: this.collectionMembershipCache.withScopedIndex(scopedOperationIndex)
|
|
12321
|
+
});
|
|
12322
|
+
});
|
|
12323
|
+
}
|
|
12324
|
+
}
|
|
12325
|
+
|
|
12237
12326
|
class DocumentModelRegistry {
|
|
12238
12327
|
modules = [];
|
|
12239
12328
|
manifests = [];
|
|
@@ -12693,37 +12782,29 @@ function driveCollectionId(branch, driveId) {
|
|
|
12693
12782
|
}
|
|
12694
12783
|
|
|
12695
12784
|
class DocumentActionHandler {
|
|
12696
|
-
writeCache;
|
|
12697
|
-
operationStore;
|
|
12698
|
-
documentMetaCache;
|
|
12699
|
-
collectionMembershipCache;
|
|
12700
12785
|
registry;
|
|
12701
12786
|
logger;
|
|
12702
|
-
constructor(
|
|
12703
|
-
this.writeCache = writeCache;
|
|
12704
|
-
this.operationStore = operationStore;
|
|
12705
|
-
this.documentMetaCache = documentMetaCache;
|
|
12706
|
-
this.collectionMembershipCache = collectionMembershipCache;
|
|
12787
|
+
constructor(registry, logger2) {
|
|
12707
12788
|
this.registry = registry;
|
|
12708
12789
|
this.logger = logger2;
|
|
12709
12790
|
}
|
|
12710
|
-
async execute(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12791
|
+
async execute(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12711
12792
|
switch (action.type) {
|
|
12712
12793
|
case "CREATE_DOCUMENT":
|
|
12713
|
-
return this.executeCreate(job, action, startTime, indexTxn, skip, sourceRemote);
|
|
12794
|
+
return this.executeCreate(job, action, startTime, indexTxn, stores, skip, sourceRemote);
|
|
12714
12795
|
case "DELETE_DOCUMENT":
|
|
12715
|
-
return this.executeDelete(job, action, startTime, indexTxn, sourceRemote);
|
|
12796
|
+
return this.executeDelete(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12716
12797
|
case "UPGRADE_DOCUMENT":
|
|
12717
|
-
return this.executeUpgrade(job, action, startTime, indexTxn, skip, sourceRemote);
|
|
12798
|
+
return this.executeUpgrade(job, action, startTime, indexTxn, stores, skip, sourceRemote);
|
|
12718
12799
|
case "ADD_RELATIONSHIP":
|
|
12719
|
-
return this.executeAddRelationship(job, action, startTime, indexTxn, sourceRemote);
|
|
12800
|
+
return this.executeAddRelationship(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12720
12801
|
case "REMOVE_RELATIONSHIP":
|
|
12721
|
-
return this.executeRemoveRelationship(job, action, startTime, indexTxn, sourceRemote);
|
|
12802
|
+
return this.executeRemoveRelationship(job, action, startTime, indexTxn, stores, sourceRemote);
|
|
12722
12803
|
default:
|
|
12723
12804
|
return buildErrorResult(job, new Error(`Unknown document action type: ${action.type}`), startTime);
|
|
12724
12805
|
}
|
|
12725
12806
|
}
|
|
12726
|
-
async executeCreate(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12807
|
+
async executeCreate(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12727
12808
|
if (job.scope !== "document") {
|
|
12728
12809
|
return {
|
|
12729
12810
|
job,
|
|
@@ -12743,12 +12824,12 @@ class DocumentActionHandler {
|
|
|
12743
12824
|
...document2.state
|
|
12744
12825
|
};
|
|
12745
12826
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12746
|
-
const writeError = await this.writeOperationToStore(document2.header.id, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12827
|
+
const writeError = await this.writeOperationToStore(document2.header.id, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12747
12828
|
if (writeError !== null) {
|
|
12748
12829
|
return writeError;
|
|
12749
12830
|
}
|
|
12750
12831
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12751
|
-
|
|
12832
|
+
stores.writeCache.putState(document2.header.id, job.scope, job.branch, operation.index, document2);
|
|
12752
12833
|
indexTxn.write([
|
|
12753
12834
|
{
|
|
12754
12835
|
...operation,
|
|
@@ -12764,14 +12845,14 @@ class DocumentActionHandler {
|
|
|
12764
12845
|
indexTxn.createCollection(collectionId);
|
|
12765
12846
|
indexTxn.addToCollection(collectionId, document2.header.id);
|
|
12766
12847
|
}
|
|
12767
|
-
|
|
12848
|
+
stores.documentMetaCache.putDocumentMeta(document2.header.id, job.branch, {
|
|
12768
12849
|
state: document2.state.document,
|
|
12769
12850
|
documentType: document2.header.documentType,
|
|
12770
12851
|
documentScopeRevision: 1
|
|
12771
12852
|
});
|
|
12772
12853
|
return buildSuccessResult(job, operation, document2.header.id, document2.header.documentType, resultingState, startTime);
|
|
12773
12854
|
}
|
|
12774
|
-
async executeDelete(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
12855
|
+
async executeDelete(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12775
12856
|
const input = action.input;
|
|
12776
12857
|
if (!input.documentId) {
|
|
12777
12858
|
return buildErrorResult(job, new Error("DELETE_DOCUMENT action requires a documentId in input"), startTime);
|
|
@@ -12779,7 +12860,7 @@ class DocumentActionHandler {
|
|
|
12779
12860
|
const documentId = input.documentId;
|
|
12780
12861
|
let document2;
|
|
12781
12862
|
try {
|
|
12782
|
-
document2 = await
|
|
12863
|
+
document2 = await stores.writeCache.getState(documentId, job.scope, job.branch);
|
|
12783
12864
|
} catch (error) {
|
|
12784
12865
|
return buildErrorResult(job, new Error(`Failed to fetch document before deletion: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12785
12866
|
}
|
|
@@ -12799,12 +12880,12 @@ class DocumentActionHandler {
|
|
|
12799
12880
|
document: document2.state.document
|
|
12800
12881
|
};
|
|
12801
12882
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12802
|
-
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12883
|
+
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12803
12884
|
if (writeError !== null) {
|
|
12804
12885
|
return writeError;
|
|
12805
12886
|
}
|
|
12806
12887
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12807
|
-
|
|
12888
|
+
stores.writeCache.putState(documentId, job.scope, job.branch, operation.index, document2);
|
|
12808
12889
|
indexTxn.write([
|
|
12809
12890
|
{
|
|
12810
12891
|
...operation,
|
|
@@ -12815,14 +12896,14 @@ class DocumentActionHandler {
|
|
|
12815
12896
|
sourceRemote
|
|
12816
12897
|
}
|
|
12817
12898
|
]);
|
|
12818
|
-
|
|
12899
|
+
stores.documentMetaCache.putDocumentMeta(documentId, job.branch, {
|
|
12819
12900
|
state: document2.state.document,
|
|
12820
12901
|
documentType: document2.header.documentType,
|
|
12821
12902
|
documentScopeRevision: operation.index + 1
|
|
12822
12903
|
});
|
|
12823
12904
|
return buildSuccessResult(job, operation, documentId, document2.header.documentType, resultingState, startTime);
|
|
12824
12905
|
}
|
|
12825
|
-
async executeUpgrade(job, action, startTime, indexTxn, skip = 0, sourceRemote = "") {
|
|
12906
|
+
async executeUpgrade(job, action, startTime, indexTxn, stores, skip = 0, sourceRemote = "") {
|
|
12826
12907
|
const input = action.input;
|
|
12827
12908
|
if (!input.documentId) {
|
|
12828
12909
|
return buildErrorResult(job, new Error("UPGRADE_DOCUMENT action requires a documentId in input"), startTime);
|
|
@@ -12832,7 +12913,7 @@ class DocumentActionHandler {
|
|
|
12832
12913
|
const toVersion = input.toVersion;
|
|
12833
12914
|
let document2;
|
|
12834
12915
|
try {
|
|
12835
|
-
document2 = await
|
|
12916
|
+
document2 = await stores.writeCache.getState(documentId, job.scope, job.branch);
|
|
12836
12917
|
} catch (error) {
|
|
12837
12918
|
return buildErrorResult(job, new Error(`Failed to fetch document for upgrade: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12838
12919
|
}
|
|
@@ -12873,12 +12954,12 @@ class DocumentActionHandler {
|
|
|
12873
12954
|
...document2.state
|
|
12874
12955
|
};
|
|
12875
12956
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12876
|
-
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
12957
|
+
const writeError = await this.writeOperationToStore(documentId, document2.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12877
12958
|
if (writeError !== null) {
|
|
12878
12959
|
return writeError;
|
|
12879
12960
|
}
|
|
12880
12961
|
updateDocumentRevision(document2, job.scope, operation.index);
|
|
12881
|
-
|
|
12962
|
+
stores.writeCache.putState(documentId, job.scope, job.branch, operation.index, document2);
|
|
12882
12963
|
indexTxn.write([
|
|
12883
12964
|
{
|
|
12884
12965
|
...operation,
|
|
@@ -12889,14 +12970,14 @@ class DocumentActionHandler {
|
|
|
12889
12970
|
sourceRemote
|
|
12890
12971
|
}
|
|
12891
12972
|
]);
|
|
12892
|
-
|
|
12973
|
+
stores.documentMetaCache.putDocumentMeta(documentId, job.branch, {
|
|
12893
12974
|
state: document2.state.document,
|
|
12894
12975
|
documentType: document2.header.documentType,
|
|
12895
12976
|
documentScopeRevision: operation.index + 1
|
|
12896
12977
|
});
|
|
12897
12978
|
return buildSuccessResult(job, operation, documentId, document2.header.documentType, resultingState, startTime);
|
|
12898
12979
|
}
|
|
12899
|
-
async executeAddRelationship(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
12980
|
+
async executeAddRelationship(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12900
12981
|
if (job.scope !== "document") {
|
|
12901
12982
|
return buildErrorResult(job, new Error(`ADD_RELATIONSHIP must be in "document" scope, got "${job.scope}"`), startTime);
|
|
12902
12983
|
}
|
|
@@ -12909,7 +12990,7 @@ class DocumentActionHandler {
|
|
|
12909
12990
|
}
|
|
12910
12991
|
let sourceDoc;
|
|
12911
12992
|
try {
|
|
12912
|
-
sourceDoc = await
|
|
12993
|
+
sourceDoc = await stores.writeCache.getState(input.sourceId, "document", job.branch);
|
|
12913
12994
|
} catch (error) {
|
|
12914
12995
|
return buildErrorResult(job, new Error(`ADD_RELATIONSHIP: source document ${input.sourceId} not found: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12915
12996
|
}
|
|
@@ -12919,7 +13000,7 @@ class DocumentActionHandler {
|
|
|
12919
13000
|
scope: job.scope,
|
|
12920
13001
|
branch: job.branch
|
|
12921
13002
|
});
|
|
12922
|
-
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
13003
|
+
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12923
13004
|
if (writeError !== null) {
|
|
12924
13005
|
return writeError;
|
|
12925
13006
|
}
|
|
@@ -12935,7 +13016,7 @@ class DocumentActionHandler {
|
|
|
12935
13016
|
[job.scope]: scopeState === undefined ? {} : structuredClone(scopeState)
|
|
12936
13017
|
};
|
|
12937
13018
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12938
|
-
|
|
13019
|
+
stores.writeCache.putState(input.sourceId, job.scope, job.branch, operation.index, sourceDoc);
|
|
12939
13020
|
indexTxn.write([
|
|
12940
13021
|
{
|
|
12941
13022
|
...operation,
|
|
@@ -12949,16 +13030,16 @@ class DocumentActionHandler {
|
|
|
12949
13030
|
if (sourceDoc.header.documentType === "powerhouse/document-drive") {
|
|
12950
13031
|
const collectionId = driveCollectionId(job.branch, input.sourceId);
|
|
12951
13032
|
indexTxn.addToCollection(collectionId, input.targetId);
|
|
12952
|
-
|
|
13033
|
+
stores.collectionMembershipCache.invalidate(input.targetId);
|
|
12953
13034
|
}
|
|
12954
|
-
|
|
13035
|
+
stores.documentMetaCache.putDocumentMeta(input.sourceId, job.branch, {
|
|
12955
13036
|
state: sourceDoc.state.document,
|
|
12956
13037
|
documentType: sourceDoc.header.documentType,
|
|
12957
13038
|
documentScopeRevision: operation.index + 1
|
|
12958
13039
|
});
|
|
12959
13040
|
return buildSuccessResult(job, operation, input.sourceId, sourceDoc.header.documentType, resultingState, startTime);
|
|
12960
13041
|
}
|
|
12961
|
-
async executeRemoveRelationship(job, action, startTime, indexTxn, sourceRemote = "") {
|
|
13042
|
+
async executeRemoveRelationship(job, action, startTime, indexTxn, stores, sourceRemote = "") {
|
|
12962
13043
|
if (job.scope !== "document") {
|
|
12963
13044
|
return buildErrorResult(job, new Error(`REMOVE_RELATIONSHIP must be in "document" scope, got "${job.scope}"`), startTime);
|
|
12964
13045
|
}
|
|
@@ -12968,7 +13049,7 @@ class DocumentActionHandler {
|
|
|
12968
13049
|
}
|
|
12969
13050
|
let sourceDoc;
|
|
12970
13051
|
try {
|
|
12971
|
-
sourceDoc = await
|
|
13052
|
+
sourceDoc = await stores.writeCache.getState(input.sourceId, "document", job.branch);
|
|
12972
13053
|
} catch (error) {
|
|
12973
13054
|
return buildErrorResult(job, new Error(`REMOVE_RELATIONSHIP: source document ${input.sourceId} not found: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
12974
13055
|
}
|
|
@@ -12978,7 +13059,7 @@ class DocumentActionHandler {
|
|
|
12978
13059
|
scope: job.scope,
|
|
12979
13060
|
branch: job.branch
|
|
12980
13061
|
});
|
|
12981
|
-
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime);
|
|
13062
|
+
const writeError = await this.writeOperationToStore(input.sourceId, sourceDoc.header.documentType, job.scope, job.branch, operation, job, startTime, stores);
|
|
12982
13063
|
if (writeError !== null) {
|
|
12983
13064
|
return writeError;
|
|
12984
13065
|
}
|
|
@@ -12994,7 +13075,7 @@ class DocumentActionHandler {
|
|
|
12994
13075
|
[job.scope]: scopeState === undefined ? {} : structuredClone(scopeState)
|
|
12995
13076
|
};
|
|
12996
13077
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
12997
|
-
|
|
13078
|
+
stores.writeCache.putState(input.sourceId, job.scope, job.branch, operation.index, sourceDoc);
|
|
12998
13079
|
indexTxn.write([
|
|
12999
13080
|
{
|
|
13000
13081
|
...operation,
|
|
@@ -13008,24 +13089,24 @@ class DocumentActionHandler {
|
|
|
13008
13089
|
if (sourceDoc.header.documentType === "powerhouse/document-drive") {
|
|
13009
13090
|
const collectionId = driveCollectionId(job.branch, input.sourceId);
|
|
13010
13091
|
indexTxn.removeFromCollection(collectionId, input.targetId);
|
|
13011
|
-
|
|
13092
|
+
stores.collectionMembershipCache.invalidate(input.targetId);
|
|
13012
13093
|
}
|
|
13013
|
-
|
|
13094
|
+
stores.documentMetaCache.putDocumentMeta(input.sourceId, job.branch, {
|
|
13014
13095
|
state: sourceDoc.state.document,
|
|
13015
13096
|
documentType: sourceDoc.header.documentType,
|
|
13016
13097
|
documentScopeRevision: operation.index + 1
|
|
13017
13098
|
});
|
|
13018
13099
|
return buildSuccessResult(job, operation, input.sourceId, sourceDoc.header.documentType, resultingState, startTime);
|
|
13019
13100
|
}
|
|
13020
|
-
async writeOperationToStore(documentId, documentType, scope, branch, operation, job, startTime) {
|
|
13101
|
+
async writeOperationToStore(documentId, documentType, scope, branch, operation, job, startTime, stores) {
|
|
13021
13102
|
try {
|
|
13022
|
-
await
|
|
13103
|
+
await stores.operationStore.apply(documentId, documentType, scope, branch, operation.index, (txn) => {
|
|
13023
13104
|
txn.addOperations(operation);
|
|
13024
13105
|
});
|
|
13025
13106
|
return null;
|
|
13026
13107
|
} catch (error) {
|
|
13027
13108
|
this.logger.error("Error writing @Operation to IOperationStore: @Error", operation, error);
|
|
13028
|
-
|
|
13109
|
+
stores.writeCache.invalidate(documentId, scope, branch);
|
|
13029
13110
|
return {
|
|
13030
13111
|
job,
|
|
13031
13112
|
success: false,
|
|
@@ -13114,7 +13195,8 @@ class SimpleJobExecutor {
|
|
|
13114
13195
|
config;
|
|
13115
13196
|
signatureVerifierModule;
|
|
13116
13197
|
documentActionHandler;
|
|
13117
|
-
|
|
13198
|
+
executionScope;
|
|
13199
|
+
constructor(logger2, registry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, config, signatureVerifier, executionScope) {
|
|
13118
13200
|
this.logger = logger2;
|
|
13119
13201
|
this.registry = registry;
|
|
13120
13202
|
this.operationStore = operationStore;
|
|
@@ -13131,71 +13213,101 @@ class SimpleJobExecutor {
|
|
|
13131
13213
|
retryMaxDelayMs: config.retryMaxDelayMs ?? 5000
|
|
13132
13214
|
};
|
|
13133
13215
|
this.signatureVerifierModule = new SignatureVerifier(signatureVerifier);
|
|
13134
|
-
this.documentActionHandler = new DocumentActionHandler(
|
|
13216
|
+
this.documentActionHandler = new DocumentActionHandler(registry, logger2);
|
|
13217
|
+
this.executionScope = executionScope ?? new DefaultExecutionScope(operationStore, operationIndex, writeCache, documentMetaCache, collectionMembershipCache);
|
|
13135
13218
|
}
|
|
13136
13219
|
async executeJob(job) {
|
|
13137
13220
|
const startTime = Date.now();
|
|
13138
|
-
const
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13221
|
+
const touchedCacheEntries = [];
|
|
13222
|
+
let pendingEvent;
|
|
13223
|
+
let result;
|
|
13224
|
+
try {
|
|
13225
|
+
result = await this.executionScope.run(async (stores) => {
|
|
13226
|
+
const indexTxn = stores.operationIndex.start();
|
|
13227
|
+
if (job.kind === "load") {
|
|
13228
|
+
const loadResult = await this.executeLoadJob(job, startTime, indexTxn, stores);
|
|
13229
|
+
if (loadResult.success && loadResult.operationsWithContext) {
|
|
13230
|
+
for (const owc of loadResult.operationsWithContext) {
|
|
13231
|
+
touchedCacheEntries.push({
|
|
13232
|
+
documentId: owc.context.documentId,
|
|
13233
|
+
scope: owc.context.scope,
|
|
13234
|
+
branch: owc.context.branch
|
|
13235
|
+
});
|
|
13236
|
+
}
|
|
13237
|
+
const ordinals2 = await stores.operationIndex.commit(indexTxn);
|
|
13238
|
+
for (let i = 0;i < loadResult.operationsWithContext.length; i++) {
|
|
13239
|
+
loadResult.operationsWithContext[i].context.ordinal = ordinals2[i];
|
|
13240
|
+
}
|
|
13241
|
+
const collectionMemberships = loadResult.operationsWithContext.length > 0 ? await this.getCollectionMembershipsForOperations(loadResult.operationsWithContext, stores) : {};
|
|
13242
|
+
pendingEvent = {
|
|
13243
|
+
jobId: job.id,
|
|
13244
|
+
operations: loadResult.operationsWithContext,
|
|
13245
|
+
jobMeta: job.meta,
|
|
13246
|
+
collectionMemberships
|
|
13247
|
+
};
|
|
13248
|
+
}
|
|
13249
|
+
return loadResult;
|
|
13250
|
+
}
|
|
13251
|
+
const actionResult = await this.processActions(job, job.actions, startTime, indexTxn, stores);
|
|
13252
|
+
if (!actionResult.success) {
|
|
13253
|
+
return {
|
|
13254
|
+
job,
|
|
13255
|
+
success: false,
|
|
13256
|
+
error: actionResult.error,
|
|
13257
|
+
duration: Date.now() - startTime
|
|
13258
|
+
};
|
|
13259
|
+
}
|
|
13260
|
+
if (actionResult.operationsWithContext.length > 0) {
|
|
13261
|
+
for (const owc of actionResult.operationsWithContext) {
|
|
13262
|
+
touchedCacheEntries.push({
|
|
13263
|
+
documentId: owc.context.documentId,
|
|
13264
|
+
scope: owc.context.scope,
|
|
13265
|
+
branch: owc.context.branch
|
|
13266
|
+
});
|
|
13267
|
+
}
|
|
13268
|
+
}
|
|
13269
|
+
const ordinals = await stores.operationIndex.commit(indexTxn);
|
|
13270
|
+
if (actionResult.operationsWithContext.length > 0) {
|
|
13271
|
+
for (let i = 0;i < actionResult.operationsWithContext.length; i++) {
|
|
13272
|
+
actionResult.operationsWithContext[i].context.ordinal = ordinals[i];
|
|
13273
|
+
}
|
|
13274
|
+
const collectionMemberships = await this.getCollectionMembershipsForOperations(actionResult.operationsWithContext, stores);
|
|
13275
|
+
pendingEvent = {
|
|
13276
|
+
jobId: job.id,
|
|
13277
|
+
operations: actionResult.operationsWithContext,
|
|
13278
|
+
jobMeta: job.meta,
|
|
13279
|
+
collectionMemberships
|
|
13280
|
+
};
|
|
13281
|
+
}
|
|
13282
|
+
return {
|
|
13283
|
+
job,
|
|
13284
|
+
success: true,
|
|
13285
|
+
operations: actionResult.generatedOperations,
|
|
13286
|
+
operationsWithContext: actionResult.operationsWithContext,
|
|
13287
|
+
duration: Date.now() - startTime
|
|
13152
13288
|
};
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13289
|
+
});
|
|
13290
|
+
} catch (error) {
|
|
13291
|
+
for (const entry of touchedCacheEntries) {
|
|
13292
|
+
this.writeCache.invalidate(entry.documentId, entry.scope, entry.branch);
|
|
13293
|
+
this.documentMetaCache.invalidate(entry.documentId, entry.branch);
|
|
13156
13294
|
}
|
|
13157
|
-
|
|
13158
|
-
}
|
|
13159
|
-
const result = await this.processActions(job, job.actions, startTime, indexTxn);
|
|
13160
|
-
if (!result.success) {
|
|
13161
|
-
return {
|
|
13162
|
-
job,
|
|
13163
|
-
success: false,
|
|
13164
|
-
error: result.error,
|
|
13165
|
-
duration: Date.now() - startTime
|
|
13166
|
-
};
|
|
13295
|
+
throw error;
|
|
13167
13296
|
}
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
result.operationsWithContext[i].context.ordinal = ordinals[i];
|
|
13172
|
-
}
|
|
13173
|
-
const collectionMemberships = await this.getCollectionMembershipsForOperations(result.operationsWithContext);
|
|
13174
|
-
const event = {
|
|
13175
|
-
jobId: job.id,
|
|
13176
|
-
operations: result.operationsWithContext,
|
|
13177
|
-
jobMeta: job.meta,
|
|
13178
|
-
collectionMemberships
|
|
13179
|
-
};
|
|
13180
|
-
this.eventBus.emit(ReactorEventTypes.JOB_WRITE_READY, event).catch((error) => {
|
|
13181
|
-
this.logger.error("Failed to emit JOB_WRITE_READY event: @Event : @Error", event, error);
|
|
13297
|
+
if (pendingEvent) {
|
|
13298
|
+
this.eventBus.emit(ReactorEventTypes.JOB_WRITE_READY, pendingEvent).catch((error) => {
|
|
13299
|
+
this.logger.error("Failed to emit JOB_WRITE_READY event: @Event : @Error", pendingEvent, error);
|
|
13182
13300
|
});
|
|
13183
13301
|
}
|
|
13184
|
-
return
|
|
13185
|
-
job,
|
|
13186
|
-
success: true,
|
|
13187
|
-
operations: result.generatedOperations,
|
|
13188
|
-
operationsWithContext: result.operationsWithContext,
|
|
13189
|
-
duration: Date.now() - startTime
|
|
13190
|
-
};
|
|
13302
|
+
return result;
|
|
13191
13303
|
}
|
|
13192
|
-
async getCollectionMembershipsForOperations(operations) {
|
|
13304
|
+
async getCollectionMembershipsForOperations(operations, stores) {
|
|
13193
13305
|
const documentIds = [
|
|
13194
13306
|
...new Set(operations.map((op) => op.context.documentId))
|
|
13195
13307
|
];
|
|
13196
|
-
return
|
|
13308
|
+
return stores.collectionMembershipCache.getCollectionsForDocuments(documentIds);
|
|
13197
13309
|
}
|
|
13198
|
-
async processActions(job, actions2, startTime, indexTxn, skipValues, sourceOperations, sourceRemote = "") {
|
|
13310
|
+
async processActions(job, actions2, startTime, indexTxn, stores, skipValues, sourceOperations, sourceRemote = "") {
|
|
13199
13311
|
const generatedOperations = [];
|
|
13200
13312
|
const operationsWithContext = [];
|
|
13201
13313
|
try {
|
|
@@ -13213,7 +13325,7 @@ class SimpleJobExecutor {
|
|
|
13213
13325
|
const skip = skipValues?.[actionIndex] ?? 0;
|
|
13214
13326
|
const sourceOperation = sourceOperations?.[actionIndex];
|
|
13215
13327
|
const isDocumentAction = documentScopeActions.includes(action.type);
|
|
13216
|
-
const result = isDocumentAction ? await this.documentActionHandler.execute(job, action, startTime, indexTxn, skip, sourceRemote) : await this.executeRegularAction(job, action, startTime, indexTxn, skip, sourceOperation, sourceRemote);
|
|
13328
|
+
const result = isDocumentAction ? await this.documentActionHandler.execute(job, action, startTime, indexTxn, stores, skip, sourceRemote) : await this.executeRegularAction(job, action, startTime, indexTxn, stores, skip, sourceOperation, sourceRemote);
|
|
13217
13329
|
const error = this.accumulateResultOrReturnError(result, generatedOperations, operationsWithContext);
|
|
13218
13330
|
if (error !== null) {
|
|
13219
13331
|
return {
|
|
@@ -13230,10 +13342,10 @@ class SimpleJobExecutor {
|
|
|
13230
13342
|
operationsWithContext
|
|
13231
13343
|
};
|
|
13232
13344
|
}
|
|
13233
|
-
async executeRegularAction(job, action, startTime, indexTxn, skip = 0, sourceOperation, sourceRemote = "") {
|
|
13345
|
+
async executeRegularAction(job, action, startTime, indexTxn, stores, skip = 0, sourceOperation, sourceRemote = "") {
|
|
13234
13346
|
let docMeta;
|
|
13235
13347
|
try {
|
|
13236
|
-
docMeta = await
|
|
13348
|
+
docMeta = await stores.documentMetaCache.getDocumentMeta(job.documentId, job.branch);
|
|
13237
13349
|
} catch (error) {
|
|
13238
13350
|
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
13239
13351
|
}
|
|
@@ -13241,11 +13353,11 @@ class SimpleJobExecutor {
|
|
|
13241
13353
|
return buildErrorResult(job, new DocumentDeletedError(job.documentId, docMeta.state.deletedAtUtcIso), startTime);
|
|
13242
13354
|
}
|
|
13243
13355
|
if (isUndoRedo(action) || action.type === "PRUNE" || action.type === "NOOP" && skip > 0) {
|
|
13244
|
-
|
|
13356
|
+
stores.writeCache.invalidate(job.documentId, job.scope, job.branch);
|
|
13245
13357
|
}
|
|
13246
13358
|
let document2;
|
|
13247
13359
|
try {
|
|
13248
|
-
document2 = await
|
|
13360
|
+
document2 = await stores.writeCache.getState(job.documentId, job.scope, job.branch);
|
|
13249
13361
|
} catch (error) {
|
|
13250
13362
|
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
13251
13363
|
}
|
|
@@ -13296,12 +13408,12 @@ ${error.stack}`;
|
|
|
13296
13408
|
header: updatedDocument.header
|
|
13297
13409
|
});
|
|
13298
13410
|
try {
|
|
13299
|
-
await
|
|
13411
|
+
await stores.operationStore.apply(job.documentId, document2.header.documentType, scope, job.branch, newOperation.index, (txn) => {
|
|
13300
13412
|
txn.addOperations(newOperation);
|
|
13301
13413
|
});
|
|
13302
13414
|
} catch (error) {
|
|
13303
13415
|
this.logger.error("Error writing @Operation to IOperationStore: @Error", newOperation, error);
|
|
13304
|
-
|
|
13416
|
+
stores.writeCache.invalidate(job.documentId, scope, job.branch);
|
|
13305
13417
|
return {
|
|
13306
13418
|
job,
|
|
13307
13419
|
success: false,
|
|
@@ -13313,7 +13425,7 @@ ${error.stack}`;
|
|
|
13313
13425
|
...updatedDocument.header.revision,
|
|
13314
13426
|
[scope]: newOperation.index + 1
|
|
13315
13427
|
};
|
|
13316
|
-
|
|
13428
|
+
stores.writeCache.putState(job.documentId, scope, job.branch, newOperation.index, updatedDocument);
|
|
13317
13429
|
indexTxn.write([
|
|
13318
13430
|
{
|
|
13319
13431
|
...newOperation,
|
|
@@ -13344,13 +13456,13 @@ ${error.stack}`;
|
|
|
13344
13456
|
duration: Date.now() - startTime
|
|
13345
13457
|
};
|
|
13346
13458
|
}
|
|
13347
|
-
async executeLoadJob(job, startTime, indexTxn) {
|
|
13459
|
+
async executeLoadJob(job, startTime, indexTxn, stores) {
|
|
13348
13460
|
if (job.operations.length === 0) {
|
|
13349
13461
|
return buildErrorResult(job, new Error("Load job must include at least one operation"), startTime);
|
|
13350
13462
|
}
|
|
13351
13463
|
let docMeta;
|
|
13352
13464
|
try {
|
|
13353
|
-
docMeta = await
|
|
13465
|
+
docMeta = await stores.documentMetaCache.getDocumentMeta(job.documentId, job.branch);
|
|
13354
13466
|
} catch {}
|
|
13355
13467
|
if (docMeta?.state.isDeleted) {
|
|
13356
13468
|
return buildErrorResult(job, new DocumentDeletedError(job.documentId, docMeta.state.deletedAtUtcIso), startTime);
|
|
@@ -13358,7 +13470,7 @@ ${error.stack}`;
|
|
|
13358
13470
|
const scope = job.scope;
|
|
13359
13471
|
let latestRevision = 0;
|
|
13360
13472
|
try {
|
|
13361
|
-
const revisions = await
|
|
13473
|
+
const revisions = await stores.operationStore.getRevisions(job.documentId, job.branch);
|
|
13362
13474
|
latestRevision = revisions.revision[scope] ?? 0;
|
|
13363
13475
|
} catch {
|
|
13364
13476
|
latestRevision = 0;
|
|
@@ -13374,7 +13486,7 @@ ${error.stack}`;
|
|
|
13374
13486
|
}
|
|
13375
13487
|
let conflictingOps = [];
|
|
13376
13488
|
try {
|
|
13377
|
-
const conflictingResult = await
|
|
13489
|
+
const conflictingResult = await stores.operationStore.getConflicting(job.documentId, scope, job.branch, minIncomingTimestamp);
|
|
13378
13490
|
conflictingOps = conflictingResult.results;
|
|
13379
13491
|
} catch {
|
|
13380
13492
|
conflictingOps = [];
|
|
@@ -13383,7 +13495,7 @@ ${error.stack}`;
|
|
|
13383
13495
|
if (conflictingOps.length > 0) {
|
|
13384
13496
|
const minConflictingIndex = Math.min(...conflictingOps.map((op) => op.index));
|
|
13385
13497
|
try {
|
|
13386
|
-
const allOpsResult = await
|
|
13498
|
+
const allOpsResult = await stores.operationStore.getSince(job.documentId, scope, job.branch, minConflictingIndex - 1);
|
|
13387
13499
|
allOpsFromMinConflictingIndex = allOpsResult.results;
|
|
13388
13500
|
} catch {
|
|
13389
13501
|
allOpsFromMinConflictingIndex = conflictingOps;
|
|
@@ -13444,7 +13556,7 @@ ${error.stack}`;
|
|
|
13444
13556
|
const actions2 = reshuffledOperations.map((operation) => operation.action);
|
|
13445
13557
|
const skipValues = reshuffledOperations.map((operation) => operation.skip);
|
|
13446
13558
|
const effectiveSourceRemote = skipCount > 0 ? "" : job.meta.sourceRemote || "";
|
|
13447
|
-
const result = await this.processActions(job, actions2, startTime, indexTxn, skipValues, reshuffledOperations, effectiveSourceRemote);
|
|
13559
|
+
const result = await this.processActions(job, actions2, startTime, indexTxn, stores, skipValues, reshuffledOperations, effectiveSourceRemote);
|
|
13448
13560
|
if (!result.success) {
|
|
13449
13561
|
return {
|
|
13450
13562
|
job,
|
|
@@ -13453,9 +13565,9 @@ ${error.stack}`;
|
|
|
13453
13565
|
duration: Date.now() - startTime
|
|
13454
13566
|
};
|
|
13455
13567
|
}
|
|
13456
|
-
|
|
13568
|
+
stores.writeCache.invalidate(job.documentId, scope, job.branch);
|
|
13457
13569
|
if (scope === "document") {
|
|
13458
|
-
|
|
13570
|
+
stores.documentMetaCache.invalidate(job.documentId, job.branch);
|
|
13459
13571
|
}
|
|
13460
13572
|
return {
|
|
13461
13573
|
job,
|
|
@@ -14404,14 +14516,23 @@ async function collectAllPages(firstPage, signal) {
|
|
|
14404
14516
|
|
|
14405
14517
|
class KyselyKeyframeStore {
|
|
14406
14518
|
db;
|
|
14519
|
+
trx;
|
|
14407
14520
|
constructor(db) {
|
|
14408
14521
|
this.db = db;
|
|
14409
14522
|
}
|
|
14523
|
+
get queryExecutor() {
|
|
14524
|
+
return this.trx ?? this.db;
|
|
14525
|
+
}
|
|
14526
|
+
withTransaction(trx) {
|
|
14527
|
+
const instance = new KyselyKeyframeStore(this.db);
|
|
14528
|
+
instance.trx = trx;
|
|
14529
|
+
return instance;
|
|
14530
|
+
}
|
|
14410
14531
|
async putKeyframe(documentId, scope, branch, revision, document2, signal) {
|
|
14411
14532
|
if (signal?.aborted) {
|
|
14412
14533
|
throw new Error("Operation aborted");
|
|
14413
14534
|
}
|
|
14414
|
-
await this.
|
|
14535
|
+
await this.queryExecutor.insertInto("Keyframe").values({
|
|
14415
14536
|
documentId,
|
|
14416
14537
|
documentType: document2.header.documentType,
|
|
14417
14538
|
scope,
|
|
@@ -14424,7 +14545,7 @@ class KyselyKeyframeStore {
|
|
|
14424
14545
|
if (signal?.aborted) {
|
|
14425
14546
|
throw new Error("Operation aborted");
|
|
14426
14547
|
}
|
|
14427
|
-
const row = await this.
|
|
14548
|
+
const row = await this.queryExecutor.selectFrom("Keyframe").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("revision", "<=", targetRevision).orderBy("revision", "desc").limit(1).executeTakeFirst();
|
|
14428
14549
|
if (!row) {
|
|
14429
14550
|
return;
|
|
14430
14551
|
}
|
|
@@ -14437,7 +14558,7 @@ class KyselyKeyframeStore {
|
|
|
14437
14558
|
if (signal?.aborted) {
|
|
14438
14559
|
throw new Error("Operation aborted");
|
|
14439
14560
|
}
|
|
14440
|
-
let query = this.
|
|
14561
|
+
let query = this.queryExecutor.deleteFrom("Keyframe").where("documentId", "=", documentId);
|
|
14441
14562
|
if (scope !== undefined && branch !== undefined) {
|
|
14442
14563
|
query = query.where("scope", "=", scope).where("branch", "=", branch);
|
|
14443
14564
|
} else if (scope !== undefined) {
|
|
@@ -14488,48 +14609,64 @@ class AtomicTransaction {
|
|
|
14488
14609
|
|
|
14489
14610
|
class KyselyOperationStore {
|
|
14490
14611
|
db;
|
|
14612
|
+
trx;
|
|
14491
14613
|
constructor(db) {
|
|
14492
14614
|
this.db = db;
|
|
14493
14615
|
}
|
|
14616
|
+
get queryExecutor() {
|
|
14617
|
+
return this.trx ?? this.db;
|
|
14618
|
+
}
|
|
14619
|
+
withTransaction(trx) {
|
|
14620
|
+
const instance = new KyselyOperationStore(this.db);
|
|
14621
|
+
instance.trx = trx;
|
|
14622
|
+
return instance;
|
|
14623
|
+
}
|
|
14494
14624
|
async apply(documentId, documentType, scope, branch, revision, fn, signal) {
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14625
|
+
if (this.trx) {
|
|
14626
|
+
await this.executeApply(this.trx, documentId, documentType, scope, branch, revision, fn, signal);
|
|
14627
|
+
} else {
|
|
14628
|
+
await this.db.transaction().execute(async (trx) => {
|
|
14629
|
+
await this.executeApply(trx, documentId, documentType, scope, branch, revision, fn, signal);
|
|
14630
|
+
});
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
async executeApply(trx, documentId, documentType, scope, branch, revision, fn, signal) {
|
|
14634
|
+
if (signal?.aborted) {
|
|
14635
|
+
throw new Error("Operation aborted");
|
|
14636
|
+
}
|
|
14637
|
+
const latestOp = await trx.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).orderBy("index", "desc").limit(1).executeTakeFirst();
|
|
14638
|
+
const currentRevision = latestOp ? latestOp.index : -1;
|
|
14639
|
+
if (currentRevision !== revision - 1) {
|
|
14640
|
+
throw new RevisionMismatchError(currentRevision + 1, revision);
|
|
14641
|
+
}
|
|
14642
|
+
const atomicTxn = new AtomicTransaction(documentId, documentType, scope, branch, revision);
|
|
14643
|
+
await fn(atomicTxn);
|
|
14644
|
+
const operations = atomicTxn.getOperations();
|
|
14645
|
+
if (operations.length > 0) {
|
|
14646
|
+
let prevOpId = latestOp?.opId || "";
|
|
14647
|
+
for (const op of operations) {
|
|
14648
|
+
op.prevOpId = prevOpId;
|
|
14649
|
+
prevOpId = op.opId;
|
|
14503
14650
|
}
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
prevOpId = op.opId;
|
|
14512
|
-
}
|
|
14513
|
-
try {
|
|
14514
|
-
await trx.insertInto("Operation").values(operations).execute();
|
|
14515
|
-
} catch (error) {
|
|
14516
|
-
if (error instanceof Error) {
|
|
14517
|
-
if (error.message.includes("unique constraint")) {
|
|
14518
|
-
const op = operations[0];
|
|
14519
|
-
throw new DuplicateOperationError(`${op.opId} at index ${op.index} with skip ${op.skip}`);
|
|
14520
|
-
}
|
|
14521
|
-
throw error;
|
|
14651
|
+
try {
|
|
14652
|
+
await trx.insertInto("Operation").values(operations).execute();
|
|
14653
|
+
} catch (error) {
|
|
14654
|
+
if (error instanceof Error) {
|
|
14655
|
+
if (error.message.includes("unique constraint")) {
|
|
14656
|
+
const op = operations[0];
|
|
14657
|
+
throw new DuplicateOperationError(`${op.opId} at index ${op.index} with skip ${op.skip}`);
|
|
14522
14658
|
}
|
|
14523
14659
|
throw error;
|
|
14524
14660
|
}
|
|
14661
|
+
throw error;
|
|
14525
14662
|
}
|
|
14526
|
-
}
|
|
14663
|
+
}
|
|
14527
14664
|
}
|
|
14528
14665
|
async getSince(documentId, scope, branch, revision, filter, paging, signal) {
|
|
14529
14666
|
if (signal?.aborted) {
|
|
14530
14667
|
throw new Error("Operation aborted");
|
|
14531
14668
|
}
|
|
14532
|
-
let query = this.
|
|
14669
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("index", ">", revision).orderBy("index", "asc");
|
|
14533
14670
|
if (filter) {
|
|
14534
14671
|
if (filter.actionTypes && filter.actionTypes.length > 0) {
|
|
14535
14672
|
const actionTypesArray = filter.actionTypes.map((t) => `'${t.replace(/'/g, "''")}'`).join(",");
|
|
@@ -14576,7 +14713,7 @@ class KyselyOperationStore {
|
|
|
14576
14713
|
if (signal?.aborted) {
|
|
14577
14714
|
throw new Error("Operation aborted");
|
|
14578
14715
|
}
|
|
14579
|
-
let query = this.
|
|
14716
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("id", ">", id).orderBy("id", "asc");
|
|
14580
14717
|
if (paging) {
|
|
14581
14718
|
const cursorValue = Number.parseInt(paging.cursor, 10);
|
|
14582
14719
|
if (cursorValue > 0) {
|
|
@@ -14608,7 +14745,7 @@ class KyselyOperationStore {
|
|
|
14608
14745
|
if (signal?.aborted) {
|
|
14609
14746
|
throw new Error("Operation aborted");
|
|
14610
14747
|
}
|
|
14611
|
-
let query = this.
|
|
14748
|
+
let query = this.queryExecutor.selectFrom("Operation").selectAll().where("documentId", "=", documentId).where("scope", "=", scope).where("branch", "=", branch).where("timestampUtcMs", ">=", new Date(minTimestamp)).orderBy("index", "asc");
|
|
14612
14749
|
if (paging) {
|
|
14613
14750
|
const cursorValue = Number.parseInt(paging.cursor, 10);
|
|
14614
14751
|
if (cursorValue > 0) {
|
|
@@ -14640,7 +14777,7 @@ class KyselyOperationStore {
|
|
|
14640
14777
|
if (signal?.aborted) {
|
|
14641
14778
|
throw new Error("Operation aborted");
|
|
14642
14779
|
}
|
|
14643
|
-
const scopeRevisions = await this.
|
|
14780
|
+
const scopeRevisions = await this.queryExecutor.selectFrom("Operation as o1").select(["o1.scope", "o1.index", "o1.timestampUtcMs"]).where("o1.documentId", "=", documentId).where("o1.branch", "=", branch).where((eb) => eb("o1.index", "=", eb.selectFrom("Operation as o2").select((eb2) => eb2.fn.max("o2.index").as("maxIndex")).where("o2.documentId", "=", eb.ref("o1.documentId")).where("o2.branch", "=", eb.ref("o1.branch")).where("o2.scope", "=", eb.ref("o1.scope")))).execute();
|
|
14644
14781
|
const revision = {};
|
|
14645
14782
|
let latestTimestamp = new Date(0).toISOString();
|
|
14646
14783
|
for (const row of scopeRevisions) {
|
|
@@ -18434,9 +18571,10 @@ class ReactorBuilder {
|
|
|
18434
18571
|
});
|
|
18435
18572
|
await documentMetaCache.startup();
|
|
18436
18573
|
const collectionMembershipCache = new CollectionMembershipCache(operationIndex);
|
|
18574
|
+
const executionScope = new KyselyExecutionScope(database, operationStore, operationIndex, keyframeStore, writeCache, documentMetaCache, collectionMembershipCache);
|
|
18437
18575
|
let executorManager = this.executorManager;
|
|
18438
18576
|
if (!executorManager) {
|
|
18439
|
-
executorManager = new SimpleJobExecutorManager(() => new SimpleJobExecutor(this.logger, documentModelRegistry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, this.executorConfig, this.signatureVerifier), eventBus, queue, jobTracker, this.logger, resolver);
|
|
18577
|
+
executorManager = new SimpleJobExecutorManager(() => new SimpleJobExecutor(this.logger, documentModelRegistry, operationStore, eventBus, writeCache, operationIndex, documentMetaCache, collectionMembershipCache, this.executorConfig, this.signatureVerifier, executionScope), eventBus, queue, jobTracker, this.logger, resolver);
|
|
18440
18578
|
}
|
|
18441
18579
|
await executorManager.start(this.executorConfig.maxConcurrency ?? 1);
|
|
18442
18580
|
const readModelInstances = Array.from(new Set([...this.readModels]));
|
|
@@ -18567,6 +18705,7 @@ class ReactorClientBuilder {
|
|
|
18567
18705
|
signatureVerifier;
|
|
18568
18706
|
subscriptionManager;
|
|
18569
18707
|
jobAwaiter;
|
|
18708
|
+
documentModelLoader;
|
|
18570
18709
|
withLogger(logger2) {
|
|
18571
18710
|
this.logger = logger2;
|
|
18572
18711
|
return this;
|
|
@@ -18605,6 +18744,10 @@ class ReactorClientBuilder {
|
|
|
18605
18744
|
this.jobAwaiter = jobAwaiter;
|
|
18606
18745
|
return this;
|
|
18607
18746
|
}
|
|
18747
|
+
withDocumentModelLoader(loader) {
|
|
18748
|
+
this.documentModelLoader = loader;
|
|
18749
|
+
return this;
|
|
18750
|
+
}
|
|
18608
18751
|
async build() {
|
|
18609
18752
|
const module = await this.buildModule();
|
|
18610
18753
|
return module.client;
|
|
@@ -18622,6 +18765,9 @@ class ReactorClientBuilder {
|
|
|
18622
18765
|
if (this.signatureVerifier) {
|
|
18623
18766
|
this.reactorBuilder.withSignatureVerifier(this.signatureVerifier);
|
|
18624
18767
|
}
|
|
18768
|
+
if (this.documentModelLoader) {
|
|
18769
|
+
this.reactorBuilder.withDocumentModelLoader(this.documentModelLoader);
|
|
18770
|
+
}
|
|
18625
18771
|
reactorModule = await this.reactorBuilder.buildModule();
|
|
18626
18772
|
reactor = reactorModule.reactor;
|
|
18627
18773
|
eventBus = reactorModule.eventBus;
|
|
@@ -24082,6 +24228,7 @@ __export(exports_src, {
|
|
|
24082
24228
|
useVetraPackages: () => useVetraPackages,
|
|
24083
24229
|
useVetraPackageManager: () => useVetraPackageManager,
|
|
24084
24230
|
useUserPermissions: () => useUserPermissions,
|
|
24231
|
+
useUser: () => useUser,
|
|
24085
24232
|
useSupportedDocumentTypesInReactor: () => useSupportedDocumentTypesInReactor,
|
|
24086
24233
|
useSubgraphModules: () => useSubgraphModules,
|
|
24087
24234
|
useSetPHDriveEditorConfig: () => useSetPHDriveEditorConfig,
|
|
@@ -24100,8 +24247,12 @@ __export(exports_src, {
|
|
|
24100
24247
|
useSelectedDocumentId: () => useSelectedDocumentId,
|
|
24101
24248
|
useSelectedDocument: () => useSelectedDocument,
|
|
24102
24249
|
useRevisionHistoryVisible: () => useRevisionHistoryVisible,
|
|
24250
|
+
useRenownInit: () => useRenownInit,
|
|
24251
|
+
useRenownAuth: () => useRenownAuth,
|
|
24252
|
+
useRenown: () => useRenown,
|
|
24103
24253
|
useRelationalQuery: () => useRelationalQuery,
|
|
24104
24254
|
useRelationalDb: () => useRelationalDb,
|
|
24255
|
+
usePendingInstallations: () => usePendingInstallations,
|
|
24105
24256
|
useParentFolderForSelectedNode: () => useParentFolderForSelectedNode,
|
|
24106
24257
|
usePHToast: () => usePHToast,
|
|
24107
24258
|
usePHModal: () => usePHModal,
|
|
@@ -24117,6 +24268,8 @@ __export(exports_src, {
|
|
|
24117
24268
|
useNodeParentFolderById: () => useNodeParentFolderById,
|
|
24118
24269
|
useNodeById: () => useNodeById,
|
|
24119
24270
|
useNodeActions: () => useNodeActions,
|
|
24271
|
+
useLoginStatus: () => useLoginStatus,
|
|
24272
|
+
useLoading: () => useLoading,
|
|
24120
24273
|
useIsExternalControlsEnabled: () => useIsExternalControlsEnabled,
|
|
24121
24274
|
useIsDragAndDropEnabled: () => useIsDragAndDropEnabled,
|
|
24122
24275
|
useInspectorEnabled: () => useInspectorEnabled,
|
|
@@ -24152,6 +24305,8 @@ __export(exports_src, {
|
|
|
24152
24305
|
useDocumentCache: () => useDocumentCache,
|
|
24153
24306
|
useDocumentById: () => useDocumentById,
|
|
24154
24307
|
useDocument: () => useDocument,
|
|
24308
|
+
useDismissedPackages: () => useDismissedPackages,
|
|
24309
|
+
useDid: () => useDid,
|
|
24155
24310
|
useDefaultDriveEditorModule: () => useDefaultDriveEditorModule,
|
|
24156
24311
|
useConnectionStates: () => useConnectionStates,
|
|
24157
24312
|
useConnectionState: () => useConnectionState,
|
|
@@ -24176,6 +24331,7 @@ __export(exports_src, {
|
|
|
24176
24331
|
setPHDriveEditorConfig: () => setPHDriveEditorConfig,
|
|
24177
24332
|
setPHDocumentEditorConfigByKey: () => setPHDocumentEditorConfigByKey,
|
|
24178
24333
|
setPHDocumentEditorConfig: () => setPHDocumentEditorConfig,
|
|
24334
|
+
setLoading: () => setLoading,
|
|
24179
24335
|
setGlobal: () => setGlobal,
|
|
24180
24336
|
setFeatures: () => setFeatures,
|
|
24181
24337
|
setDriveSharingType: () => setDriveSharingType,
|
|
@@ -24195,6 +24351,7 @@ __export(exports_src, {
|
|
|
24195
24351
|
makeDriveUrlComponent: () => makeDriveUrlComponent,
|
|
24196
24352
|
logout: () => logout,
|
|
24197
24353
|
login: () => login,
|
|
24354
|
+
loading: () => loading,
|
|
24198
24355
|
isInspectorEnabledSync: () => isInspectorEnabledSync,
|
|
24199
24356
|
isFolderNodeKind: () => isFolderNodeKind,
|
|
24200
24357
|
isFileNodeKind: () => isFileNodeKind,
|
|
@@ -24243,6 +24400,7 @@ __export(exports_src, {
|
|
|
24243
24400
|
baseDocumentModelsMap: () => baseDocumentModelsMap,
|
|
24244
24401
|
baseDocumentModels: () => baseDocumentModels,
|
|
24245
24402
|
addTrigger: () => addTrigger,
|
|
24403
|
+
addRenownEventHandler: () => addRenownEventHandler,
|
|
24246
24404
|
addRemoteDrive: () => addRemoteDrive,
|
|
24247
24405
|
addPromiseState: () => addPromiseState,
|
|
24248
24406
|
addFolder: () => addFolder,
|
|
@@ -24254,10 +24412,10 @@ __export(exports_src, {
|
|
|
24254
24412
|
SyncOperationStatus: () => SyncOperationStatus,
|
|
24255
24413
|
SpinnerIcon: () => SpinnerIcon,
|
|
24256
24414
|
RenownUserButton: () => RenownUserButton,
|
|
24257
|
-
RenownProvider: () => RenownProvider,
|
|
24258
24415
|
RenownLogo: () => RenownLogo,
|
|
24259
24416
|
RenownLoginButton: () => RenownLoginButton,
|
|
24260
24417
|
RenownAuthButton: () => RenownAuthButton,
|
|
24418
|
+
Renown: () => Renown2,
|
|
24261
24419
|
RemoteDocumentController: () => RemoteDocumentController,
|
|
24262
24420
|
RemoteClient: () => RemoteClient,
|
|
24263
24421
|
RelationalDbProcessor: () => RelationalDbProcessor,
|
|
@@ -24275,7 +24433,6 @@ __export(exports_src, {
|
|
|
24275
24433
|
InMemoryQueue: () => InMemoryQueue,
|
|
24276
24434
|
ISSUER_TYPE: () => ISSUER_TYPE,
|
|
24277
24435
|
GqlRequestChannel: () => GqlRequestChannel,
|
|
24278
|
-
ExternalLinkIcon: () => ExternalLinkIcon,
|
|
24279
24436
|
DocumentChangeType: () => DocumentChangeType,
|
|
24280
24437
|
DocumentCache: () => DocumentCache,
|
|
24281
24438
|
DisconnectIcon: () => DisconnectIcon,
|
|
@@ -24284,6 +24441,7 @@ __export(exports_src, {
|
|
|
24284
24441
|
CopyIcon: () => CopyIcon,
|
|
24285
24442
|
ConsoleLogger: () => ConsoleLogger,
|
|
24286
24443
|
ConflictError: () => ConflictError,
|
|
24444
|
+
ChevronDownIcon: () => ChevronDownIcon,
|
|
24287
24445
|
ChannelScheme: () => ChannelScheme,
|
|
24288
24446
|
CREDENTIAL_TYPES: () => CREDENTIAL_TYPES,
|
|
24289
24447
|
CREDENTIAL_SUBJECT_TYPE: () => CREDENTIAL_SUBJECT_TYPE,
|
|
@@ -24323,17 +24481,20 @@ import {
|
|
|
24323
24481
|
setSharingType
|
|
24324
24482
|
} from "document-drive";
|
|
24325
24483
|
import { documentModelDocumentModelModule } from "document-model";
|
|
24484
|
+
import { useCallback } from "react";
|
|
24485
|
+
import { useEffect, useState, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
24326
24486
|
import { useSyncExternalStore } from "react";
|
|
24327
|
-
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
24328
|
-
import { useEffect, useRef, useState } from "react";
|
|
24329
24487
|
import { logger as logger5 } from "document-drive";
|
|
24330
|
-
import {
|
|
24488
|
+
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
24489
|
+
import { logger as logger6 } from "document-drive";
|
|
24490
|
+
import { use, useCallback as useCallback2, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
24331
24491
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
24492
|
+
import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
24332
24493
|
import {
|
|
24333
24494
|
DocumentModelNotFoundError,
|
|
24334
24495
|
DocumentNotFoundError as DocumentNotFoundError2
|
|
24335
24496
|
} from "document-drive";
|
|
24336
|
-
import { useCallback as
|
|
24497
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
24337
24498
|
import { isFileNode as isFileNode2 } from "document-drive";
|
|
24338
24499
|
import { useMemo } from "react";
|
|
24339
24500
|
import {
|
|
@@ -24343,20 +24504,24 @@ import {
|
|
|
24343
24504
|
} from "document-model";
|
|
24344
24505
|
import { createState } from "document-model";
|
|
24345
24506
|
import { defaultBaseState as defaultBaseState2, generateId as generateId22 } from "document-model/core";
|
|
24346
|
-
import { logger as logger6 } from "document-drive";
|
|
24347
|
-
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
24348
24507
|
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
24349
24508
|
import { createRelationalDbLegacy } from "document-drive";
|
|
24350
24509
|
import { useMemo as useMemo2 } from "react";
|
|
24351
24510
|
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
24352
|
-
import { useCallback as
|
|
24353
|
-
import { useCallback as
|
|
24511
|
+
import { useCallback as useCallback5, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
24512
|
+
import { useCallback as useCallback6, useState as useState7 } from "react";
|
|
24354
24513
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
24514
|
+
import {
|
|
24515
|
+
Children,
|
|
24516
|
+
cloneElement,
|
|
24517
|
+
forwardRef,
|
|
24518
|
+
isValidElement
|
|
24519
|
+
} from "react";
|
|
24355
24520
|
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
24356
|
-
import { useCallback as
|
|
24521
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useRef as useRef5, useState as useState8 } from "react";
|
|
24357
24522
|
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
24358
|
-
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
24359
|
-
import {
|
|
24523
|
+
import { jsxDEV as jsxDEV4, Fragment } from "react/jsx-dev-runtime";
|
|
24524
|
+
import { useRef as useRef6 } from "react";
|
|
24360
24525
|
function asUint8Array(buf) {
|
|
24361
24526
|
if (globalThis.Buffer != null) {
|
|
24362
24527
|
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
@@ -27707,38 +27872,61 @@ function makePHEventFunctions(key) {
|
|
|
27707
27872
|
const setEventName = `ph:set${capitalCase(key)}`;
|
|
27708
27873
|
const updateEventName = `ph:${key}Updated`;
|
|
27709
27874
|
function setValue(value) {
|
|
27875
|
+
if (isServer) {
|
|
27876
|
+
return;
|
|
27877
|
+
}
|
|
27710
27878
|
const event = new CustomEvent(setEventName, {
|
|
27711
27879
|
detail: { [key]: value }
|
|
27712
27880
|
});
|
|
27713
27881
|
window.dispatchEvent(event);
|
|
27714
27882
|
}
|
|
27715
27883
|
function dispatchUpdatedEvent() {
|
|
27884
|
+
if (isServer) {
|
|
27885
|
+
return;
|
|
27886
|
+
}
|
|
27716
27887
|
const event = new CustomEvent(updateEventName);
|
|
27717
27888
|
window.dispatchEvent(event);
|
|
27718
27889
|
}
|
|
27719
27890
|
function handleSetValueEvent(event) {
|
|
27891
|
+
if (isServer) {
|
|
27892
|
+
return;
|
|
27893
|
+
}
|
|
27720
27894
|
const value = event.detail[key];
|
|
27721
|
-
if (!window.ph)
|
|
27722
|
-
|
|
27895
|
+
if (!window.ph) {
|
|
27896
|
+
window.ph = {};
|
|
27897
|
+
}
|
|
27723
27898
|
window.ph[key] = value;
|
|
27724
27899
|
dispatchUpdatedEvent();
|
|
27725
27900
|
}
|
|
27726
27901
|
function addEventHandler() {
|
|
27902
|
+
if (isServer) {
|
|
27903
|
+
return;
|
|
27904
|
+
}
|
|
27727
27905
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
27728
27906
|
}
|
|
27729
27907
|
function subscribeToValue(onStoreChange) {
|
|
27908
|
+
if (isServer)
|
|
27909
|
+
return () => {};
|
|
27730
27910
|
window.addEventListener(updateEventName, onStoreChange);
|
|
27731
27911
|
return () => {
|
|
27732
27912
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
27733
27913
|
};
|
|
27734
27914
|
}
|
|
27735
27915
|
function getSnapshot() {
|
|
27736
|
-
if (
|
|
27737
|
-
|
|
27916
|
+
if (isServer) {
|
|
27917
|
+
return;
|
|
27918
|
+
}
|
|
27919
|
+
if (!window.ph) {
|
|
27920
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase(key)}?`);
|
|
27921
|
+
return;
|
|
27922
|
+
}
|
|
27738
27923
|
return window.ph[key];
|
|
27739
27924
|
}
|
|
27925
|
+
function getServerSnapshot() {
|
|
27926
|
+
return;
|
|
27927
|
+
}
|
|
27740
27928
|
function useValue() {
|
|
27741
|
-
return useSyncExternalStore(subscribeToValue, getSnapshot);
|
|
27929
|
+
return useSyncExternalStore(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
27742
27930
|
}
|
|
27743
27931
|
return {
|
|
27744
27932
|
useValue,
|
|
@@ -27746,6 +27934,138 @@ function makePHEventFunctions(key) {
|
|
|
27746
27934
|
addEventHandler
|
|
27747
27935
|
};
|
|
27748
27936
|
}
|
|
27937
|
+
function useDid() {
|
|
27938
|
+
const renown = useRenown();
|
|
27939
|
+
return renown?.did;
|
|
27940
|
+
}
|
|
27941
|
+
function useUser() {
|
|
27942
|
+
const renown = useRenown();
|
|
27943
|
+
const [user, setUser] = useState(renown?.user);
|
|
27944
|
+
useEffect(() => {
|
|
27945
|
+
setUser(renown?.user);
|
|
27946
|
+
if (!renown)
|
|
27947
|
+
return;
|
|
27948
|
+
return renown.on("user", setUser);
|
|
27949
|
+
}, [renown]);
|
|
27950
|
+
return user;
|
|
27951
|
+
}
|
|
27952
|
+
function useLoginStatus() {
|
|
27953
|
+
const renown = useRenown();
|
|
27954
|
+
return useSyncExternalStore2((cb) => {
|
|
27955
|
+
if (!renown) {
|
|
27956
|
+
return () => {};
|
|
27957
|
+
}
|
|
27958
|
+
return renown.on("status", cb);
|
|
27959
|
+
}, () => renown === loading ? "loading" : renown?.status, () => {
|
|
27960
|
+
return;
|
|
27961
|
+
});
|
|
27962
|
+
}
|
|
27963
|
+
function openRenown(documentId) {
|
|
27964
|
+
const renown = window.ph?.renown;
|
|
27965
|
+
let renownUrl = renown?.baseUrl;
|
|
27966
|
+
if (!renownUrl) {
|
|
27967
|
+
logger5.warn("Renown instance not found, falling back to: ", RENOWN_URL);
|
|
27968
|
+
renownUrl = RENOWN_URL;
|
|
27969
|
+
}
|
|
27970
|
+
if (documentId) {
|
|
27971
|
+
window.open(`${renownUrl}/profile/${documentId}`, "_blank")?.focus();
|
|
27972
|
+
return;
|
|
27973
|
+
}
|
|
27974
|
+
const url = new URL(renownUrl);
|
|
27975
|
+
url.searchParams.set("app", renown?.did ?? "");
|
|
27976
|
+
url.searchParams.set("connect", renown?.did ?? "");
|
|
27977
|
+
url.searchParams.set("network", RENOWN_NETWORK_ID);
|
|
27978
|
+
url.searchParams.set("chain", RENOWN_CHAIN_ID);
|
|
27979
|
+
const returnUrl = new URL(window.location.pathname, window.location.origin);
|
|
27980
|
+
url.searchParams.set("returnUrl", returnUrl.toJSON());
|
|
27981
|
+
window.open(url, "_self")?.focus();
|
|
27982
|
+
}
|
|
27983
|
+
function consumeDidFromUrl() {
|
|
27984
|
+
if (typeof window === "undefined")
|
|
27985
|
+
return;
|
|
27986
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
27987
|
+
const userParam = urlParams.get("user");
|
|
27988
|
+
if (!userParam)
|
|
27989
|
+
return;
|
|
27990
|
+
const userDid = decodeURIComponent(userParam);
|
|
27991
|
+
const cleanUrl = new URL(window.location.href);
|
|
27992
|
+
cleanUrl.searchParams.delete("user");
|
|
27993
|
+
window.history.replaceState({}, "", cleanUrl.toString());
|
|
27994
|
+
return userDid;
|
|
27995
|
+
}
|
|
27996
|
+
async function login(userDid, renown) {
|
|
27997
|
+
if (!renown) {
|
|
27998
|
+
return;
|
|
27999
|
+
}
|
|
28000
|
+
const did = userDid ?? consumeDidFromUrl();
|
|
28001
|
+
try {
|
|
28002
|
+
const user = renown.user;
|
|
28003
|
+
if (user?.did && (user.did === did || !did)) {
|
|
28004
|
+
return user;
|
|
28005
|
+
}
|
|
28006
|
+
if (!did) {
|
|
28007
|
+
return;
|
|
28008
|
+
}
|
|
28009
|
+
return await renown.login(did);
|
|
28010
|
+
} catch (error) {
|
|
28011
|
+
logger5.error(error instanceof Error ? error.message : JSON.stringify(error));
|
|
28012
|
+
}
|
|
28013
|
+
}
|
|
28014
|
+
async function logout() {
|
|
28015
|
+
const renown = window.ph?.renown;
|
|
28016
|
+
await renown?.logout();
|
|
28017
|
+
const url = new URL(window.location.href);
|
|
28018
|
+
if (url.searchParams.has("user")) {
|
|
28019
|
+
url.searchParams.delete("user");
|
|
28020
|
+
window.history.replaceState(null, "", url.toString());
|
|
28021
|
+
}
|
|
28022
|
+
}
|
|
28023
|
+
function truncateAddress(address) {
|
|
28024
|
+
if (address.length <= 13)
|
|
28025
|
+
return address;
|
|
28026
|
+
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
28027
|
+
}
|
|
28028
|
+
function toRenownAuthStatus(loginStatus, user) {
|
|
28029
|
+
if (loginStatus === "authorized") {
|
|
28030
|
+
return user ? "authorized" : "checking";
|
|
28031
|
+
}
|
|
28032
|
+
return loginStatus;
|
|
28033
|
+
}
|
|
28034
|
+
function useRenownAuth() {
|
|
28035
|
+
const user = useUser();
|
|
28036
|
+
const loginStatus = useLoginStatus();
|
|
28037
|
+
const status = toRenownAuthStatus(loginStatus, user);
|
|
28038
|
+
const address = user?.address;
|
|
28039
|
+
const ensName = user?.ens?.name;
|
|
28040
|
+
const avatarUrl = user?.profile?.userImage ?? user?.ens?.avatarUrl;
|
|
28041
|
+
const profileId = user?.profile?.documentId;
|
|
28042
|
+
const displayName = ensName ?? user?.profile?.username ?? undefined;
|
|
28043
|
+
const displayAddress = address ? truncateAddress(address) : undefined;
|
|
28044
|
+
const login2 = useCallback(() => {
|
|
28045
|
+
openRenown();
|
|
28046
|
+
}, []);
|
|
28047
|
+
const logout2 = useCallback(async () => {
|
|
28048
|
+
await logout();
|
|
28049
|
+
}, []);
|
|
28050
|
+
const openProfile = useCallback(() => {
|
|
28051
|
+
if (profileId) {
|
|
28052
|
+
openRenown(profileId);
|
|
28053
|
+
}
|
|
28054
|
+
}, [profileId]);
|
|
28055
|
+
return {
|
|
28056
|
+
status,
|
|
28057
|
+
user,
|
|
28058
|
+
address,
|
|
28059
|
+
ensName,
|
|
28060
|
+
avatarUrl,
|
|
28061
|
+
profileId,
|
|
28062
|
+
displayName,
|
|
28063
|
+
displayAddress,
|
|
28064
|
+
login: login2,
|
|
28065
|
+
logout: logout2,
|
|
28066
|
+
openProfile
|
|
28067
|
+
};
|
|
28068
|
+
}
|
|
27749
28069
|
function useAllowedDocumentTypes() {
|
|
27750
28070
|
const definedAllowedDocumentTypes = allowedDocumentTypesEventFunctions.useValue();
|
|
27751
28071
|
return definedAllowedDocumentTypes;
|
|
@@ -27757,6 +28077,14 @@ function setVetraPackageManager(packageManager) {
|
|
|
27757
28077
|
updateReactorClientDocumentModels(packages);
|
|
27758
28078
|
});
|
|
27759
28079
|
}
|
|
28080
|
+
function usePendingInstallations() {
|
|
28081
|
+
const pm = useVetraPackageManager();
|
|
28082
|
+
return useSyncExternalStore3((cb) => pm ? pm.subscribePendingChanges(cb) : NOOP_UNSUBSCRIBE, () => pm?.getPendingInstallations() ?? EMPTY_PENDING);
|
|
28083
|
+
}
|
|
28084
|
+
function useDismissedPackages() {
|
|
28085
|
+
const pm = useVetraPackageManager();
|
|
28086
|
+
return useSyncExternalStore3((cb) => pm ? pm.subscribePendingChanges(cb) : NOOP_UNSUBSCRIBE, () => pm?.getDismissedPackages() ?? EMPTY_DISMISSED);
|
|
28087
|
+
}
|
|
27760
28088
|
function updateReactorClientDocumentModels(packages) {
|
|
27761
28089
|
const documentModelModules = packages.flatMap((pkg) => pkg.modules.documentModelModules).filter((module) => module !== undefined);
|
|
27762
28090
|
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
@@ -27788,52 +28116,6 @@ function useAllowedDocumentModelModules() {
|
|
|
27788
28116
|
return documentModelModules;
|
|
27789
28117
|
return documentModelModules?.filter((module) => allowedDocumentTypes.includes(module.documentModel.global.id));
|
|
27790
28118
|
}
|
|
27791
|
-
function useConnectionStates() {
|
|
27792
|
-
const syncManager = useSync();
|
|
27793
|
-
const [states, setStates] = useState(() => buildSnapshot(syncManager));
|
|
27794
|
-
const unsubscribesRef = useRef([]);
|
|
27795
|
-
useEffect(() => {
|
|
27796
|
-
if (!syncManager)
|
|
27797
|
-
return;
|
|
27798
|
-
function subscribe() {
|
|
27799
|
-
for (const unsub of unsubscribesRef.current) {
|
|
27800
|
-
unsub();
|
|
27801
|
-
}
|
|
27802
|
-
unsubscribesRef.current = [];
|
|
27803
|
-
const remotes = syncManager.list();
|
|
27804
|
-
for (const remote of remotes) {
|
|
27805
|
-
const unsub = remote.channel.onConnectionStateChange(() => {
|
|
27806
|
-
setStates(buildSnapshot(syncManager));
|
|
27807
|
-
});
|
|
27808
|
-
unsubscribesRef.current.push(unsub);
|
|
27809
|
-
}
|
|
27810
|
-
setStates(buildSnapshot(syncManager));
|
|
27811
|
-
}
|
|
27812
|
-
subscribe();
|
|
27813
|
-
const interval = setInterval(subscribe, 5000);
|
|
27814
|
-
return () => {
|
|
27815
|
-
clearInterval(interval);
|
|
27816
|
-
for (const unsub of unsubscribesRef.current) {
|
|
27817
|
-
unsub();
|
|
27818
|
-
}
|
|
27819
|
-
unsubscribesRef.current = [];
|
|
27820
|
-
};
|
|
27821
|
-
}, [syncManager]);
|
|
27822
|
-
return states;
|
|
27823
|
-
}
|
|
27824
|
-
function useConnectionState(remoteName) {
|
|
27825
|
-
const states = useConnectionStates();
|
|
27826
|
-
return states.get(remoteName);
|
|
27827
|
-
}
|
|
27828
|
-
function buildSnapshot(syncManager) {
|
|
27829
|
-
const map = new Map;
|
|
27830
|
-
if (!syncManager)
|
|
27831
|
-
return map;
|
|
27832
|
-
for (const remote of syncManager.list()) {
|
|
27833
|
-
map.set(remote.name, remote.channel.getConnectionState());
|
|
27834
|
-
}
|
|
27835
|
-
return map;
|
|
27836
|
-
}
|
|
27837
28119
|
function sortNodesByName(nodes) {
|
|
27838
28120
|
return nodes.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
27839
28121
|
}
|
|
@@ -27849,7 +28131,7 @@ function isFolderNodeKind(node) {
|
|
|
27849
28131
|
}
|
|
27850
28132
|
function useDispatch(document2) {
|
|
27851
28133
|
function dispatch(actionOrActions, onErrors, onSuccess) {
|
|
27852
|
-
dispatchActions(actionOrActions, document2, onErrors, onSuccess).catch(
|
|
28134
|
+
dispatchActions(actionOrActions, document2, onErrors, onSuccess).catch(logger6.error);
|
|
27853
28135
|
}
|
|
27854
28136
|
return [document2, dispatch];
|
|
27855
28137
|
}
|
|
@@ -27881,12 +28163,12 @@ function getDocumentQueryState(promise) {
|
|
|
27881
28163
|
}
|
|
27882
28164
|
function useDocument(id) {
|
|
27883
28165
|
const documentCache = useDocumentCache();
|
|
27884
|
-
const document2 =
|
|
28166
|
+
const document2 = useSyncExternalStore4((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : undefined);
|
|
27885
28167
|
return document2 ? use(document2) : undefined;
|
|
27886
28168
|
}
|
|
27887
28169
|
function useDocuments(ids) {
|
|
27888
28170
|
const documentCache = useDocumentCache();
|
|
27889
|
-
const documents =
|
|
28171
|
+
const documents = useSyncExternalStore4((cb) => ids?.length && documentCache ? documentCache.subscribe(ids, cb) : () => {}, () => ids?.length && documentCache ? documentCache.getBatch(ids) : undefined);
|
|
27890
28172
|
return documents ? use(documents) : [];
|
|
27891
28173
|
}
|
|
27892
28174
|
function useGetDocument() {
|
|
@@ -28227,6 +28509,52 @@ function usePHDocumentEditorConfigByKey(key) {
|
|
|
28227
28509
|
const useValueHook = phDocumentEditorConfigHooks[key];
|
|
28228
28510
|
return useValueHook();
|
|
28229
28511
|
}
|
|
28512
|
+
function useConnectionStates() {
|
|
28513
|
+
const syncManager = useSync();
|
|
28514
|
+
const [states, setStates] = useState3(() => buildSnapshot(syncManager));
|
|
28515
|
+
const unsubscribesRef = useRef([]);
|
|
28516
|
+
useEffect3(() => {
|
|
28517
|
+
if (!syncManager)
|
|
28518
|
+
return;
|
|
28519
|
+
function subscribe() {
|
|
28520
|
+
for (const unsub of unsubscribesRef.current) {
|
|
28521
|
+
unsub();
|
|
28522
|
+
}
|
|
28523
|
+
unsubscribesRef.current = [];
|
|
28524
|
+
const remotes = syncManager.list();
|
|
28525
|
+
for (const remote of remotes) {
|
|
28526
|
+
const unsub = remote.channel.onConnectionStateChange(() => {
|
|
28527
|
+
setStates(buildSnapshot(syncManager));
|
|
28528
|
+
});
|
|
28529
|
+
unsubscribesRef.current.push(unsub);
|
|
28530
|
+
}
|
|
28531
|
+
setStates(buildSnapshot(syncManager));
|
|
28532
|
+
}
|
|
28533
|
+
subscribe();
|
|
28534
|
+
const interval = setInterval(subscribe, 5000);
|
|
28535
|
+
return () => {
|
|
28536
|
+
clearInterval(interval);
|
|
28537
|
+
for (const unsub of unsubscribesRef.current) {
|
|
28538
|
+
unsub();
|
|
28539
|
+
}
|
|
28540
|
+
unsubscribesRef.current = [];
|
|
28541
|
+
};
|
|
28542
|
+
}, [syncManager]);
|
|
28543
|
+
return states;
|
|
28544
|
+
}
|
|
28545
|
+
function useConnectionState(remoteName) {
|
|
28546
|
+
const states = useConnectionStates();
|
|
28547
|
+
return states.get(remoteName);
|
|
28548
|
+
}
|
|
28549
|
+
function buildSnapshot(syncManager) {
|
|
28550
|
+
const map = new Map;
|
|
28551
|
+
if (!syncManager)
|
|
28552
|
+
return map;
|
|
28553
|
+
for (const remote of syncManager.list()) {
|
|
28554
|
+
map.set(remote.name, remote.channel.getConnectionState());
|
|
28555
|
+
}
|
|
28556
|
+
return map;
|
|
28557
|
+
}
|
|
28230
28558
|
function useDocumentOfType(documentId, documentType) {
|
|
28231
28559
|
const [document2, dispatch] = useDocumentById(documentId);
|
|
28232
28560
|
const documentModelModule = useDocumentModelModuleById(documentType);
|
|
@@ -28246,13 +28574,13 @@ function useDocumentOfType(documentId, documentType) {
|
|
|
28246
28574
|
function useDocumentOperations(documentId) {
|
|
28247
28575
|
const reactorClient = useReactorClient();
|
|
28248
28576
|
const hasFetchedRef = useRef2(false);
|
|
28249
|
-
const [state, setState] =
|
|
28577
|
+
const [state, setState] = useState4(() => ({
|
|
28250
28578
|
globalOperations: [],
|
|
28251
28579
|
localOperations: [],
|
|
28252
28580
|
isLoading: !!documentId,
|
|
28253
28581
|
error: undefined
|
|
28254
28582
|
}));
|
|
28255
|
-
const fetchOperations =
|
|
28583
|
+
const fetchOperations = useCallback4(async (retryCount = 0) => {
|
|
28256
28584
|
const MAX_RETRIES = 5;
|
|
28257
28585
|
const RETRY_DELAY_MS = 500;
|
|
28258
28586
|
if (!documentId || !reactorClient) {
|
|
@@ -28298,7 +28626,7 @@ function useDocumentOperations(documentId) {
|
|
|
28298
28626
|
});
|
|
28299
28627
|
hasFetchedRef.current = true;
|
|
28300
28628
|
}, [documentId, reactorClient]);
|
|
28301
|
-
|
|
28629
|
+
useEffect4(() => {
|
|
28302
28630
|
if (documentId && reactorClient) {
|
|
28303
28631
|
fetchOperations();
|
|
28304
28632
|
} else if (!documentId) {
|
|
@@ -28311,7 +28639,7 @@ function useDocumentOperations(documentId) {
|
|
|
28311
28639
|
hasFetchedRef.current = false;
|
|
28312
28640
|
}
|
|
28313
28641
|
}, [documentId, reactorClient, fetchOperations]);
|
|
28314
|
-
const refetch =
|
|
28642
|
+
const refetch = useCallback4(() => {
|
|
28315
28643
|
fetchOperations(0);
|
|
28316
28644
|
}, [fetchOperations]);
|
|
28317
28645
|
return { ...state, refetch };
|
|
@@ -28758,81 +29086,6 @@ function makeVetraPackageManifestModulesEntry(modules) {
|
|
|
28758
29086
|
return acc;
|
|
28759
29087
|
}, {});
|
|
28760
29088
|
}
|
|
28761
|
-
function openRenown(documentId) {
|
|
28762
|
-
if (documentId) {
|
|
28763
|
-
window.open(`${RENOWN_URL}/profile/${documentId}`, "_blank")?.focus();
|
|
28764
|
-
return;
|
|
28765
|
-
}
|
|
28766
|
-
const url = new URL(RENOWN_URL);
|
|
28767
|
-
url.searchParams.set("connect", window.ph?.renown?.did ?? "");
|
|
28768
|
-
url.searchParams.set("network", RENOWN_NETWORK_ID);
|
|
28769
|
-
url.searchParams.set("chain", RENOWN_CHAIN_ID);
|
|
28770
|
-
const returnUrl = new URL(window.location.pathname, window.location.origin);
|
|
28771
|
-
url.searchParams.set("returnUrl", returnUrl.toJSON());
|
|
28772
|
-
window.open(url, "_self")?.focus();
|
|
28773
|
-
}
|
|
28774
|
-
function consumeDidFromUrl() {
|
|
28775
|
-
if (typeof window === "undefined")
|
|
28776
|
-
return;
|
|
28777
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
28778
|
-
const userParam = urlParams.get("user");
|
|
28779
|
-
if (!userParam)
|
|
28780
|
-
return;
|
|
28781
|
-
const userDid = decodeURIComponent(userParam);
|
|
28782
|
-
const cleanUrl = new URL(window.location.href);
|
|
28783
|
-
cleanUrl.searchParams.delete("user");
|
|
28784
|
-
window.history.replaceState({}, "", cleanUrl.toString());
|
|
28785
|
-
return userDid;
|
|
28786
|
-
}
|
|
28787
|
-
async function login(userDid, renown) {
|
|
28788
|
-
if (!renown) {
|
|
28789
|
-
return;
|
|
28790
|
-
}
|
|
28791
|
-
const did = userDid ?? consumeDidFromUrl();
|
|
28792
|
-
try {
|
|
28793
|
-
const user = renown.user;
|
|
28794
|
-
if (user?.did && (user.did === did || !did)) {
|
|
28795
|
-
return user;
|
|
28796
|
-
}
|
|
28797
|
-
if (!did) {
|
|
28798
|
-
return;
|
|
28799
|
-
}
|
|
28800
|
-
return await renown.login(did);
|
|
28801
|
-
} catch (error) {
|
|
28802
|
-
logger6.error("@error", error);
|
|
28803
|
-
}
|
|
28804
|
-
}
|
|
28805
|
-
async function logout() {
|
|
28806
|
-
const renown = window.ph?.renown;
|
|
28807
|
-
await renown?.logout();
|
|
28808
|
-
const url = new URL(window.location.href);
|
|
28809
|
-
if (url.searchParams.has("user")) {
|
|
28810
|
-
url.searchParams.delete("user");
|
|
28811
|
-
window.history.replaceState(null, "", url.toString());
|
|
28812
|
-
}
|
|
28813
|
-
}
|
|
28814
|
-
function useUser() {
|
|
28815
|
-
const renown = useRenown();
|
|
28816
|
-
const [user, setUser] = useState4(() => renown?.user);
|
|
28817
|
-
useEffect4(() => {
|
|
28818
|
-
setUser(renown?.user);
|
|
28819
|
-
if (!renown)
|
|
28820
|
-
return;
|
|
28821
|
-
return renown.on("user", setUser);
|
|
28822
|
-
}, [renown]);
|
|
28823
|
-
return user;
|
|
28824
|
-
}
|
|
28825
|
-
function useLoginStatus() {
|
|
28826
|
-
const renown = useRenown();
|
|
28827
|
-
const [status, setStatus] = useState4(() => renown ? renown.status : "initializing");
|
|
28828
|
-
useEffect4(() => {
|
|
28829
|
-
setStatus(renown ? renown.status : "initializing");
|
|
28830
|
-
if (!renown)
|
|
28831
|
-
return;
|
|
28832
|
-
return renown.on("status", setStatus);
|
|
28833
|
-
}, [renown]);
|
|
28834
|
-
return status;
|
|
28835
|
-
}
|
|
28836
29089
|
function useGetSwitchboardLink(document2) {
|
|
28837
29090
|
const [drive] = useSelectedDrive();
|
|
28838
29091
|
const remotes = useSyncList();
|
|
@@ -28875,6 +29128,47 @@ function useUserPermissions() {
|
|
|
28875
29128
|
isAllowedToEditDocuments: allowList.includes(user?.address ?? "")
|
|
28876
29129
|
};
|
|
28877
29130
|
}
|
|
29131
|
+
function cdnUrlToApiUrl(cdnUrl) {
|
|
29132
|
+
return cdnUrl.replace(/\/-\/cdn\/?$/, "");
|
|
29133
|
+
}
|
|
29134
|
+
function mapPackageInfo(pkg) {
|
|
29135
|
+
return {
|
|
29136
|
+
name: pkg.name,
|
|
29137
|
+
description: pkg.manifest?.description,
|
|
29138
|
+
version: pkg.manifest?.version,
|
|
29139
|
+
category: pkg.manifest?.category,
|
|
29140
|
+
publisher: pkg.manifest?.publisher?.name,
|
|
29141
|
+
publisherUrl: pkg.manifest?.publisher?.url
|
|
29142
|
+
};
|
|
29143
|
+
}
|
|
29144
|
+
|
|
29145
|
+
class RegistryClient {
|
|
29146
|
+
apiUrl;
|
|
29147
|
+
constructor(cdnUrl) {
|
|
29148
|
+
this.apiUrl = cdnUrlToApiUrl(cdnUrl);
|
|
29149
|
+
}
|
|
29150
|
+
async getPackages() {
|
|
29151
|
+
const res = await fetch(`${this.apiUrl}/packages`);
|
|
29152
|
+
if (!res.ok)
|
|
29153
|
+
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29154
|
+
const data = await res.json();
|
|
29155
|
+
return data.map(mapPackageInfo);
|
|
29156
|
+
}
|
|
29157
|
+
async getPackagesByDocumentType(documentType) {
|
|
29158
|
+
const encodedType = encodeURIComponent(documentType);
|
|
29159
|
+
const res = await fetch(`${this.apiUrl}/packages/by-document-type?type=${encodedType}`);
|
|
29160
|
+
if (!res.ok)
|
|
29161
|
+
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29162
|
+
return await res.json();
|
|
29163
|
+
}
|
|
29164
|
+
async searchPackages(query) {
|
|
29165
|
+
const packages = await this.getPackages();
|
|
29166
|
+
if (!query)
|
|
29167
|
+
return packages;
|
|
29168
|
+
const lowerQuery = query.toLowerCase();
|
|
29169
|
+
return packages.filter((pkg) => pkg.name.toLowerCase().includes(lowerQuery) || pkg.description?.toLowerCase().includes(lowerQuery));
|
|
29170
|
+
}
|
|
29171
|
+
}
|
|
28878
29172
|
|
|
28879
29173
|
class BaseStorage {
|
|
28880
29174
|
#store;
|
|
@@ -28896,6 +29190,19 @@ class BaseStorage {
|
|
|
28896
29190
|
return this.#store.delete(this.#buildKey(key));
|
|
28897
29191
|
}
|
|
28898
29192
|
}
|
|
29193
|
+
function loadDismissedPackages() {
|
|
29194
|
+
try {
|
|
29195
|
+
const raw = localStorage.getItem(DISMISSED_STORAGE_KEY);
|
|
29196
|
+
if (raw)
|
|
29197
|
+
return JSON.parse(raw);
|
|
29198
|
+
} catch {}
|
|
29199
|
+
return [];
|
|
29200
|
+
}
|
|
29201
|
+
function persistDismissedPackages(dismissed) {
|
|
29202
|
+
try {
|
|
29203
|
+
localStorage.setItem(DISMISSED_STORAGE_KEY, JSON.stringify(dismissed));
|
|
29204
|
+
} catch {}
|
|
29205
|
+
}
|
|
28899
29206
|
function loadCSS(pkg, registryUrl) {
|
|
28900
29207
|
const head = document.getElementsByTagName("head")[0];
|
|
28901
29208
|
const existingStyle = head.querySelector(`link[data-package='${pkg}']`);
|
|
@@ -28916,10 +29223,13 @@ function removeCSS(pkg) {
|
|
|
28916
29223
|
style.remove();
|
|
28917
29224
|
}
|
|
28918
29225
|
}
|
|
29226
|
+
async function runtimeImport(url) {
|
|
29227
|
+
return new Function("u", "return import(u)")(url);
|
|
29228
|
+
}
|
|
28919
29229
|
async function loadExternalPackage(name4, registryUrl) {
|
|
28920
29230
|
registryUrl = registryUrl.endsWith("/") ? registryUrl : `${registryUrl}/`;
|
|
28921
29231
|
const url = `${registryUrl}${name4}/index.js`;
|
|
28922
|
-
const module = await
|
|
29232
|
+
const module = await runtimeImport(url);
|
|
28923
29233
|
loadCSS(name4, registryUrl);
|
|
28924
29234
|
return convertLegacyLibToVetraPackage(module);
|
|
28925
29235
|
}
|
|
@@ -28930,12 +29240,23 @@ class BrowserPackageManager {
|
|
|
28930
29240
|
#localPackageIds = new Set;
|
|
28931
29241
|
#subscribers = new Set;
|
|
28932
29242
|
#packagesMemo = [];
|
|
28933
|
-
|
|
29243
|
+
#registryCdnUrl;
|
|
29244
|
+
#registryClient;
|
|
29245
|
+
#documentModelRegistry;
|
|
29246
|
+
#pending = [];
|
|
29247
|
+
#dismissed = loadDismissedPackages();
|
|
29248
|
+
#deferredActions = new Map;
|
|
29249
|
+
#pendingListeners = new Set;
|
|
29250
|
+
constructor(namespace, registryCdnUrl) {
|
|
28934
29251
|
this.#storage = new BrowserLocalStorage(namespace + ":PH_PACKAGES");
|
|
28935
29252
|
const packages = this.#storage.get("packages");
|
|
28936
29253
|
if (!packages) {
|
|
28937
29254
|
this.#storage.set("packages", []);
|
|
28938
29255
|
}
|
|
29256
|
+
if (registryCdnUrl) {
|
|
29257
|
+
this.#registryCdnUrl = registryCdnUrl;
|
|
29258
|
+
this.#registryClient = new RegistryClient(registryCdnUrl);
|
|
29259
|
+
}
|
|
28939
29260
|
}
|
|
28940
29261
|
async init() {
|
|
28941
29262
|
const packages = this.#storage.get("packages");
|
|
@@ -28991,6 +29312,99 @@ class BrowserPackageManager {
|
|
|
28991
29312
|
handler({ packages });
|
|
28992
29313
|
});
|
|
28993
29314
|
}
|
|
29315
|
+
setDocumentModelRegistry(registry) {
|
|
29316
|
+
this.#documentModelRegistry = registry;
|
|
29317
|
+
}
|
|
29318
|
+
async load(documentType) {
|
|
29319
|
+
if (!this.#registryClient || !this.#registryCdnUrl) {
|
|
29320
|
+
throw new Error("Registry CDN URL not configured — cannot discover packages");
|
|
29321
|
+
}
|
|
29322
|
+
const packageNames = await this.#registryClient.getPackagesByDocumentType(documentType);
|
|
29323
|
+
if (packageNames.length === 0) {
|
|
29324
|
+
throw new Error(`No package found containing document type: ${documentType}`);
|
|
29325
|
+
}
|
|
29326
|
+
const packageName = packageNames.sort((a, b) => a.localeCompare(b))[0];
|
|
29327
|
+
this.#pending = [...this.#pending, { documentType, packageName }];
|
|
29328
|
+
this.#notifyPendingListeners();
|
|
29329
|
+
return new Promise((resolve, reject) => {
|
|
29330
|
+
this.#deferredActions.set(packageName, { resolve, reject });
|
|
29331
|
+
});
|
|
29332
|
+
}
|
|
29333
|
+
async approveInstallation(packageName) {
|
|
29334
|
+
const deferred = this.#deferredActions.get(packageName);
|
|
29335
|
+
if (!deferred)
|
|
29336
|
+
return;
|
|
29337
|
+
try {
|
|
29338
|
+
await this.addPackage(packageName, this.#registryCdnUrl);
|
|
29339
|
+
} catch (error) {
|
|
29340
|
+
this.#removePending(packageName);
|
|
29341
|
+
this.#deferredActions.delete(packageName);
|
|
29342
|
+
deferred.reject(error instanceof Error ? error : new Error(`Failed to install package: ${packageName}`));
|
|
29343
|
+
return;
|
|
29344
|
+
}
|
|
29345
|
+
const pendingEntries = this.#pending.filter((p) => p.packageName === packageName);
|
|
29346
|
+
this.#removePending(packageName);
|
|
29347
|
+
this.#deferredActions.delete(packageName);
|
|
29348
|
+
if (!this.#documentModelRegistry) {
|
|
29349
|
+
deferred.reject(new Error("Document model registry not available"));
|
|
29350
|
+
return;
|
|
29351
|
+
}
|
|
29352
|
+
for (const entry of pendingEntries) {
|
|
29353
|
+
try {
|
|
29354
|
+
const module = this.#documentModelRegistry.getModule(entry.documentType);
|
|
29355
|
+
deferred.resolve(module);
|
|
29356
|
+
return;
|
|
29357
|
+
} catch {}
|
|
29358
|
+
}
|
|
29359
|
+
deferred.reject(new Error(`Module not found after installing package: ${packageName}`));
|
|
29360
|
+
}
|
|
29361
|
+
rejectInstallation(packageName) {
|
|
29362
|
+
const deferred = this.#deferredActions.get(packageName);
|
|
29363
|
+
if (!deferred)
|
|
29364
|
+
return;
|
|
29365
|
+
const rejectedEntries = this.#pending.filter((p) => p.packageName === packageName);
|
|
29366
|
+
const documentTypes = rejectedEntries.map((e) => e.documentType);
|
|
29367
|
+
this.#addDismissed(packageName, documentTypes);
|
|
29368
|
+
this.#removePending(packageName);
|
|
29369
|
+
this.#deferredActions.delete(packageName);
|
|
29370
|
+
deferred.reject(new Error(`Installation rejected for package: ${packageName}`));
|
|
29371
|
+
}
|
|
29372
|
+
subscribePendingChanges(listener) {
|
|
29373
|
+
this.#pendingListeners.add(listener);
|
|
29374
|
+
return () => {
|
|
29375
|
+
this.#pendingListeners.delete(listener);
|
|
29376
|
+
};
|
|
29377
|
+
}
|
|
29378
|
+
getPendingInstallations() {
|
|
29379
|
+
return this.#pending;
|
|
29380
|
+
}
|
|
29381
|
+
getDismissedPackages() {
|
|
29382
|
+
return this.#dismissed;
|
|
29383
|
+
}
|
|
29384
|
+
removeDismissed(packageName) {
|
|
29385
|
+
this.#dismissed = this.#dismissed.filter((d) => d.packageName !== packageName);
|
|
29386
|
+
persistDismissedPackages(this.#dismissed);
|
|
29387
|
+
this.#notifyPendingListeners();
|
|
29388
|
+
}
|
|
29389
|
+
#addDismissed(packageName, documentTypes) {
|
|
29390
|
+
const existing = this.#dismissed.find((d) => d.packageName === packageName);
|
|
29391
|
+
if (existing) {
|
|
29392
|
+
const merged = new Set([...existing.documentTypes, ...documentTypes]);
|
|
29393
|
+
existing.documentTypes = [...merged];
|
|
29394
|
+
} else {
|
|
29395
|
+
this.#dismissed = [...this.#dismissed, { packageName, documentTypes }];
|
|
29396
|
+
}
|
|
29397
|
+
persistDismissedPackages(this.#dismissed);
|
|
29398
|
+
}
|
|
29399
|
+
#removePending(packageName) {
|
|
29400
|
+
this.#pending = this.#pending.filter((p) => p.packageName !== packageName);
|
|
29401
|
+
this.#notifyPendingListeners();
|
|
29402
|
+
}
|
|
29403
|
+
#notifyPendingListeners() {
|
|
29404
|
+
for (const listener of this.#pendingListeners) {
|
|
29405
|
+
listener();
|
|
29406
|
+
}
|
|
29407
|
+
}
|
|
28994
29408
|
}
|
|
28995
29409
|
async function dropTablesInSchema(pg, schema) {
|
|
28996
29410
|
await pg.exec(`
|
|
@@ -29016,40 +29430,6 @@ async function dropAllReactorStorage(pg) {
|
|
|
29016
29430
|
await dropTablesInSchema(pg, REACTOR_SCHEMA);
|
|
29017
29431
|
await dropTablesInSchema(pg, "public");
|
|
29018
29432
|
}
|
|
29019
|
-
function cdnUrlToApiUrl(cdnUrl) {
|
|
29020
|
-
return cdnUrl.replace(/\/-\/cdn\/?$/, "");
|
|
29021
|
-
}
|
|
29022
|
-
function mapPackageInfo(pkg) {
|
|
29023
|
-
return {
|
|
29024
|
-
name: pkg.name,
|
|
29025
|
-
description: pkg.manifest?.description,
|
|
29026
|
-
version: pkg.manifest?.version,
|
|
29027
|
-
category: pkg.manifest?.category,
|
|
29028
|
-
publisher: pkg.manifest?.publisher?.name,
|
|
29029
|
-
publisherUrl: pkg.manifest?.publisher?.url
|
|
29030
|
-
};
|
|
29031
|
-
}
|
|
29032
|
-
|
|
29033
|
-
class RegistryClient {
|
|
29034
|
-
apiUrl;
|
|
29035
|
-
constructor(cdnUrl) {
|
|
29036
|
-
this.apiUrl = cdnUrlToApiUrl(cdnUrl);
|
|
29037
|
-
}
|
|
29038
|
-
async getPackages() {
|
|
29039
|
-
const res = await fetch(`${this.apiUrl}/packages`);
|
|
29040
|
-
if (!res.ok)
|
|
29041
|
-
throw new Error(`Registry error: HTTP ${res.status}`);
|
|
29042
|
-
const data = await res.json();
|
|
29043
|
-
return data.map(mapPackageInfo);
|
|
29044
|
-
}
|
|
29045
|
-
async searchPackages(query) {
|
|
29046
|
-
const packages = await this.getPackages();
|
|
29047
|
-
if (!query)
|
|
29048
|
-
return packages;
|
|
29049
|
-
const lowerQuery = query.toLowerCase();
|
|
29050
|
-
return packages.filter((pkg) => pkg.name.toLowerCase().includes(lowerQuery) || pkg.description?.toLowerCase().includes(lowerQuery));
|
|
29051
|
-
}
|
|
29052
|
-
}
|
|
29053
29433
|
|
|
29054
29434
|
class ReactorClientDocumentCache {
|
|
29055
29435
|
client;
|
|
@@ -29355,7 +29735,7 @@ function split2(lst, le = false) {
|
|
|
29355
29735
|
}
|
|
29356
29736
|
function add(Ah, Al, Bh, Bl) {
|
|
29357
29737
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
29358
|
-
return { h: Ah + Bh + (l /
|
|
29738
|
+
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
29359
29739
|
}
|
|
29360
29740
|
function _abool2(value, title = "") {
|
|
29361
29741
|
if (typeof value !== "boolean") {
|
|
@@ -30166,7 +30546,7 @@ function edwards(params, extraOpts = {}) {
|
|
|
30166
30546
|
_abool2(zip215, "zip215");
|
|
30167
30547
|
const normed = copyBytes(bytes);
|
|
30168
30548
|
const lastByte = bytes[len - 1];
|
|
30169
|
-
normed[len - 1] = lastByte &
|
|
30549
|
+
normed[len - 1] = lastByte & ~128;
|
|
30170
30550
|
const y = bytesToNumberLE(normed);
|
|
30171
30551
|
const max = zip215 ? MASK : Fp.ORDER;
|
|
30172
30552
|
aInRange("point.y", y, _0n4, max);
|
|
@@ -31552,7 +31932,7 @@ function ripemd_f(group, x, y, z) {
|
|
|
31552
31932
|
return x ^ (y | ~z);
|
|
31553
31933
|
}
|
|
31554
31934
|
function keccakP(s, rounds = 24) {
|
|
31555
|
-
const B = new Uint32Array(
|
|
31935
|
+
const B = new Uint32Array(5 * 2);
|
|
31556
31936
|
for (let round = 24 - rounds;round < 24; round++) {
|
|
31557
31937
|
for (let x = 0;x < 10; x++)
|
|
31558
31938
|
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
@@ -31941,7 +32321,7 @@ function convertRadix2(data, from3, to, padding2) {
|
|
|
31941
32321
|
}
|
|
31942
32322
|
function radix(num) {
|
|
31943
32323
|
anumber2(num);
|
|
31944
|
-
const _256 =
|
|
32324
|
+
const _256 = 2 ** 8;
|
|
31945
32325
|
return {
|
|
31946
32326
|
encode: (bytes) => {
|
|
31947
32327
|
if (!isBytes2(bytes))
|
|
@@ -40558,7 +40938,7 @@ function useStableParams(params) {
|
|
|
40558
40938
|
function createProcessorQuery(ProcessorClass) {
|
|
40559
40939
|
function useQuery(driveId, queryCallback, parameters, options) {
|
|
40560
40940
|
const stableParams = useStableParams(parameters);
|
|
40561
|
-
const memoizedCallback =
|
|
40941
|
+
const memoizedCallback = useCallback5(queryCallback, [stableParams]);
|
|
40562
40942
|
return useRelationalQuery(ProcessorClass, driveId, memoizedCallback, stableParams, options);
|
|
40563
40943
|
}
|
|
40564
40944
|
return useQuery;
|
|
@@ -41092,41 +41472,6 @@ function CopyIcon({ size = 14, color = "#9EA0A1" }) {
|
|
|
41092
41472
|
]
|
|
41093
41473
|
}, undefined, true, undefined, this);
|
|
41094
41474
|
}
|
|
41095
|
-
function ExternalLinkIcon({
|
|
41096
|
-
size = 14,
|
|
41097
|
-
color = "currentColor"
|
|
41098
|
-
}) {
|
|
41099
|
-
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41100
|
-
width: size,
|
|
41101
|
-
height: size,
|
|
41102
|
-
viewBox: "0 0 16 16",
|
|
41103
|
-
fill: "none",
|
|
41104
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
41105
|
-
children: [
|
|
41106
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41107
|
-
d: "M12 8.66667V12.6667C12 13.0203 11.8595 13.3594 11.6095 13.6095C11.3594 13.8595 11.0203 14 10.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H7.33333",
|
|
41108
|
-
stroke: color,
|
|
41109
|
-
strokeWidth: "1.5",
|
|
41110
|
-
strokeLinecap: "round",
|
|
41111
|
-
strokeLinejoin: "round"
|
|
41112
|
-
}, undefined, false, undefined, this),
|
|
41113
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41114
|
-
d: "M10 2H14V6",
|
|
41115
|
-
stroke: color,
|
|
41116
|
-
strokeWidth: "1.5",
|
|
41117
|
-
strokeLinecap: "round",
|
|
41118
|
-
strokeLinejoin: "round"
|
|
41119
|
-
}, undefined, false, undefined, this),
|
|
41120
|
-
/* @__PURE__ */ jsxDEV("path", {
|
|
41121
|
-
d: "M6.66669 9.33333L14 2",
|
|
41122
|
-
stroke: color,
|
|
41123
|
-
strokeWidth: "1.5",
|
|
41124
|
-
strokeLinecap: "round",
|
|
41125
|
-
strokeLinejoin: "round"
|
|
41126
|
-
}, undefined, false, undefined, this)
|
|
41127
|
-
]
|
|
41128
|
-
}, undefined, true, undefined, this);
|
|
41129
|
-
}
|
|
41130
41475
|
function DisconnectIcon({ size = 14, color = "#EA4335" }) {
|
|
41131
41476
|
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41132
41477
|
width: size,
|
|
@@ -41229,6 +41574,27 @@ function SpinnerIcon({ size = 14, color = "currentColor" }) {
|
|
|
41229
41574
|
]
|
|
41230
41575
|
}, undefined, true, undefined, this);
|
|
41231
41576
|
}
|
|
41577
|
+
function ChevronDownIcon({
|
|
41578
|
+
size = 14,
|
|
41579
|
+
color = "currentColor",
|
|
41580
|
+
style
|
|
41581
|
+
}) {
|
|
41582
|
+
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41583
|
+
width: size,
|
|
41584
|
+
height: size,
|
|
41585
|
+
viewBox: "0 0 16 16",
|
|
41586
|
+
fill: "none",
|
|
41587
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41588
|
+
style,
|
|
41589
|
+
children: /* @__PURE__ */ jsxDEV("path", {
|
|
41590
|
+
d: "M4 6L8 10L12 6",
|
|
41591
|
+
stroke: color,
|
|
41592
|
+
strokeWidth: "1.5",
|
|
41593
|
+
strokeLinecap: "round",
|
|
41594
|
+
strokeLinejoin: "round"
|
|
41595
|
+
}, undefined, false, undefined, this)
|
|
41596
|
+
}, undefined, false, undefined, this);
|
|
41597
|
+
}
|
|
41232
41598
|
function UserIcon({ size = 24, color = "#6366f1" }) {
|
|
41233
41599
|
return /* @__PURE__ */ jsxDEV("svg", {
|
|
41234
41600
|
width: size,
|
|
@@ -41253,134 +41619,80 @@ function UserIcon({ size = 24, color = "#6366f1" }) {
|
|
|
41253
41619
|
]
|
|
41254
41620
|
}, undefined, true, undefined, this);
|
|
41255
41621
|
}
|
|
41622
|
+
function mergeProps(parentProps, childProps) {
|
|
41623
|
+
const merged = { ...parentProps };
|
|
41624
|
+
for (const key of Object.keys(childProps)) {
|
|
41625
|
+
const parentValue = parentProps[key];
|
|
41626
|
+
const childValue = childProps[key];
|
|
41627
|
+
if (key === "style") {
|
|
41628
|
+
merged[key] = { ...parentValue, ...childValue };
|
|
41629
|
+
} else if (key === "className") {
|
|
41630
|
+
merged[key] = [parentValue, childValue].filter(Boolean).join(" ");
|
|
41631
|
+
} else if (typeof parentValue === "function" && typeof childValue === "function") {
|
|
41632
|
+
merged[key] = (...args) => {
|
|
41633
|
+
childValue(...args);
|
|
41634
|
+
parentValue(...args);
|
|
41635
|
+
};
|
|
41636
|
+
} else if (childValue !== undefined) {
|
|
41637
|
+
merged[key] = childValue;
|
|
41638
|
+
}
|
|
41639
|
+
}
|
|
41640
|
+
return merged;
|
|
41641
|
+
}
|
|
41256
41642
|
function RenownLoginButton({
|
|
41257
41643
|
onLogin: onLoginProp,
|
|
41258
41644
|
darkMode = false,
|
|
41259
41645
|
style,
|
|
41260
41646
|
className,
|
|
41261
|
-
|
|
41262
|
-
|
|
41647
|
+
asChild = false,
|
|
41648
|
+
children
|
|
41263
41649
|
}) {
|
|
41264
41650
|
const onLogin = onLoginProp ?? (() => openRenown());
|
|
41265
|
-
const [isOpen, setIsOpen] = useState7(false);
|
|
41266
41651
|
const [isLoading, setIsLoading] = useState7(false);
|
|
41267
41652
|
const [isHovered, setIsHovered] = useState7(false);
|
|
41268
|
-
const
|
|
41269
|
-
const
|
|
41270
|
-
const
|
|
41271
|
-
|
|
41272
|
-
if (!wrapperRef.current)
|
|
41273
|
-
return;
|
|
41274
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
41275
|
-
const spaceAbove = rect.top;
|
|
41276
|
-
setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);
|
|
41277
|
-
}, []);
|
|
41278
|
-
const handleMouseEnter = useCallback5(() => {
|
|
41279
|
-
setIsHovered(true);
|
|
41280
|
-
if (!showPopover)
|
|
41281
|
-
return;
|
|
41282
|
-
if (closeTimeoutRef.current) {
|
|
41283
|
-
clearTimeout(closeTimeoutRef.current);
|
|
41284
|
-
closeTimeoutRef.current = null;
|
|
41285
|
-
}
|
|
41286
|
-
calculatePosition();
|
|
41287
|
-
setIsOpen(true);
|
|
41288
|
-
}, [calculatePosition, showPopover]);
|
|
41289
|
-
const handleMouseLeave = useCallback5(() => {
|
|
41290
|
-
closeTimeoutRef.current = setTimeout(() => {
|
|
41291
|
-
setIsOpen(false);
|
|
41292
|
-
setIsHovered(false);
|
|
41293
|
-
}, 150);
|
|
41294
|
-
}, []);
|
|
41295
|
-
useEffect7(() => {
|
|
41296
|
-
return () => {
|
|
41297
|
-
if (closeTimeoutRef.current) {
|
|
41298
|
-
clearTimeout(closeTimeoutRef.current);
|
|
41299
|
-
}
|
|
41300
|
-
};
|
|
41301
|
-
}, []);
|
|
41302
|
-
const handleConnect = () => {
|
|
41303
|
-
setIsLoading(true);
|
|
41304
|
-
onLogin();
|
|
41305
|
-
};
|
|
41306
|
-
const handleDirectClick = () => {
|
|
41307
|
-
if (!showPopover && !isLoading) {
|
|
41653
|
+
const handleMouseEnter = useCallback6(() => setIsHovered(true), []);
|
|
41654
|
+
const handleMouseLeave = useCallback6(() => setIsHovered(false), []);
|
|
41655
|
+
const handleClick = () => {
|
|
41656
|
+
if (!isLoading) {
|
|
41308
41657
|
setIsLoading(true);
|
|
41309
41658
|
onLogin();
|
|
41310
41659
|
}
|
|
41311
41660
|
};
|
|
41661
|
+
const themeStyles = darkMode ? darkStyles : lightStyles;
|
|
41312
41662
|
const triggerStyle = {
|
|
41313
41663
|
...styles.trigger,
|
|
41314
|
-
|
|
41664
|
+
...themeStyles.trigger,
|
|
41665
|
+
...isHovered && !isLoading ? themeStyles.triggerHover : {},
|
|
41666
|
+
cursor: isLoading ? "wait" : "pointer",
|
|
41315
41667
|
...style
|
|
41316
41668
|
};
|
|
41317
|
-
const
|
|
41318
|
-
|
|
41319
|
-
|
|
41320
|
-
...
|
|
41321
|
-
|
|
41322
|
-
}
|
|
41323
|
-
|
|
41324
|
-
|
|
41325
|
-
|
|
41326
|
-
|
|
41327
|
-
|
|
41328
|
-
|
|
41329
|
-
|
|
41669
|
+
const triggerElement = asChild ? /* @__PURE__ */ jsxDEV2(Slot, {
|
|
41670
|
+
onClick: handleClick,
|
|
41671
|
+
"data-renown-state": "login",
|
|
41672
|
+
...isLoading ? { "data-loading": "" } : {},
|
|
41673
|
+
children
|
|
41674
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("button", {
|
|
41675
|
+
type: "button",
|
|
41676
|
+
style: triggerStyle,
|
|
41677
|
+
"aria-label": "Log in with Renown",
|
|
41678
|
+
onClick: handleClick,
|
|
41679
|
+
"data-renown-state": "login",
|
|
41680
|
+
...isLoading ? { "data-loading": "" } : {},
|
|
41681
|
+
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41682
|
+
size: 16
|
|
41683
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("span", {
|
|
41684
|
+
children: "Log in"
|
|
41685
|
+
}, undefined, false, undefined, this)
|
|
41686
|
+
}, undefined, false, undefined, this);
|
|
41330
41687
|
return /* @__PURE__ */ jsxDEV2("div", {
|
|
41331
|
-
ref: wrapperRef,
|
|
41332
41688
|
style: styles.wrapper,
|
|
41333
41689
|
className,
|
|
41334
41690
|
onMouseEnter: handleMouseEnter,
|
|
41335
41691
|
onMouseLeave: handleMouseLeave,
|
|
41336
|
-
children:
|
|
41337
|
-
|
|
41338
|
-
onMouseEnter: handleMouseEnter,
|
|
41339
|
-
onMouseLeave: handleMouseLeave,
|
|
41340
|
-
isLoading
|
|
41341
|
-
}) : /* @__PURE__ */ jsxDEV2("button", {
|
|
41342
|
-
type: "button",
|
|
41343
|
-
style: triggerStyle,
|
|
41344
|
-
"aria-label": showPopover ? "Open Renown Login" : "Login with Renown",
|
|
41345
|
-
onClick: showPopover ? undefined : handleDirectClick,
|
|
41346
|
-
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41347
|
-
size: 42
|
|
41348
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("img", {
|
|
41349
|
-
width: 42,
|
|
41350
|
-
height: 42,
|
|
41351
|
-
src: isHovered ? renownShortHoverDataUrl : renownShortDataUrl,
|
|
41352
|
-
alt: "Renown Login",
|
|
41353
|
-
style: triggerImageStyle
|
|
41354
|
-
}, undefined, false, undefined, this)
|
|
41355
|
-
}, undefined, false, undefined, this),
|
|
41356
|
-
isOpen && showPopover && /* @__PURE__ */ jsxDEV2("div", {
|
|
41357
|
-
style: popoverStyle,
|
|
41358
|
-
children: /* @__PURE__ */ jsxDEV2("div", {
|
|
41359
|
-
style: styles.popoverContent,
|
|
41360
|
-
children: [
|
|
41361
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
41362
|
-
style: styles.logoContainer,
|
|
41363
|
-
children: /* @__PURE__ */ jsxDEV2(RenownLogo, {
|
|
41364
|
-
width: 83,
|
|
41365
|
-
height: 22,
|
|
41366
|
-
color: logoColor
|
|
41367
|
-
}, undefined, false, undefined, this)
|
|
41368
|
-
}, undefined, false, undefined, this),
|
|
41369
|
-
/* @__PURE__ */ jsxDEV2("button", {
|
|
41370
|
-
type: "button",
|
|
41371
|
-
onClick: allowLogin ? handleConnect : undefined,
|
|
41372
|
-
style: connectButtonStyle,
|
|
41373
|
-
children: isLoading ? /* @__PURE__ */ jsxDEV2(SpinnerIcon, {
|
|
41374
|
-
size: 14
|
|
41375
|
-
}, undefined, false, undefined, this) : "Connect"
|
|
41376
|
-
}, undefined, false, undefined, this)
|
|
41377
|
-
]
|
|
41378
|
-
}, undefined, true, undefined, this)
|
|
41379
|
-
}, undefined, false, undefined, this)
|
|
41380
|
-
]
|
|
41381
|
-
}, undefined, true, undefined, this);
|
|
41692
|
+
children: triggerElement
|
|
41693
|
+
}, undefined, false, undefined, this);
|
|
41382
41694
|
}
|
|
41383
|
-
function
|
|
41695
|
+
function truncateAddress2(address) {
|
|
41384
41696
|
if (address.length <= 13)
|
|
41385
41697
|
return address;
|
|
41386
41698
|
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
@@ -41393,27 +41705,34 @@ function RenownUserButton({
|
|
|
41393
41705
|
onDisconnect: onDisconnectProp,
|
|
41394
41706
|
style,
|
|
41395
41707
|
className,
|
|
41396
|
-
|
|
41708
|
+
asChild = false,
|
|
41709
|
+
children,
|
|
41710
|
+
menuItems
|
|
41397
41711
|
}) {
|
|
41398
41712
|
const user = useUser();
|
|
41399
41713
|
const address = addressProp ?? user?.address ?? "";
|
|
41400
|
-
const username = usernameProp ?? user?.ens?.name;
|
|
41401
|
-
const avatarUrl = avatarUrlProp ?? user?.ens?.avatarUrl;
|
|
41714
|
+
const username = usernameProp ?? user?.profile?.username ?? user?.ens?.name;
|
|
41715
|
+
const avatarUrl = avatarUrlProp ?? user?.profile?.userImage ?? user?.ens?.avatarUrl;
|
|
41402
41716
|
const userId = userIdProp ?? user?.profile?.documentId;
|
|
41403
41717
|
const onDisconnect = onDisconnectProp ?? (() => void logout());
|
|
41718
|
+
const displayName = username ?? (address ? truncateAddress2(address) : "Account");
|
|
41719
|
+
const profileId = userId ?? address;
|
|
41404
41720
|
const [isOpen, setIsOpen] = useState8(false);
|
|
41721
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
41405
41722
|
const [isCopied, setIsCopied] = useState8(false);
|
|
41406
41723
|
const [showAbove, setShowAbove] = useState8(true);
|
|
41407
|
-
const
|
|
41408
|
-
const
|
|
41409
|
-
const
|
|
41724
|
+
const [hoveredItem, setHoveredItem] = useState8(null);
|
|
41725
|
+
const wrapperRef = useRef5(null);
|
|
41726
|
+
const closeTimeoutRef = useRef5(null);
|
|
41727
|
+
const calculatePosition = useCallback7(() => {
|
|
41410
41728
|
if (!wrapperRef.current)
|
|
41411
41729
|
return;
|
|
41412
41730
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
41413
41731
|
const spaceAbove = rect.top;
|
|
41414
|
-
setShowAbove(spaceAbove >=
|
|
41732
|
+
setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);
|
|
41415
41733
|
}, []);
|
|
41416
|
-
const handleMouseEnter =
|
|
41734
|
+
const handleMouseEnter = useCallback7(() => {
|
|
41735
|
+
setIsHovered(true);
|
|
41417
41736
|
if (closeTimeoutRef.current) {
|
|
41418
41737
|
clearTimeout(closeTimeoutRef.current);
|
|
41419
41738
|
closeTimeoutRef.current = null;
|
|
@@ -41421,19 +41740,21 @@ function RenownUserButton({
|
|
|
41421
41740
|
calculatePosition();
|
|
41422
41741
|
setIsOpen(true);
|
|
41423
41742
|
}, [calculatePosition]);
|
|
41424
|
-
const handleMouseLeave =
|
|
41743
|
+
const handleMouseLeave = useCallback7(() => {
|
|
41425
41744
|
closeTimeoutRef.current = setTimeout(() => {
|
|
41426
41745
|
setIsOpen(false);
|
|
41746
|
+
setIsHovered(false);
|
|
41747
|
+
setHoveredItem(null);
|
|
41427
41748
|
}, 150);
|
|
41428
41749
|
}, []);
|
|
41429
|
-
|
|
41750
|
+
useEffect7(() => {
|
|
41430
41751
|
return () => {
|
|
41431
41752
|
if (closeTimeoutRef.current) {
|
|
41432
41753
|
clearTimeout(closeTimeoutRef.current);
|
|
41433
41754
|
}
|
|
41434
41755
|
};
|
|
41435
41756
|
}, []);
|
|
41436
|
-
const copyToClipboard =
|
|
41757
|
+
const copyToClipboard = useCallback7(async () => {
|
|
41437
41758
|
try {
|
|
41438
41759
|
await navigator.clipboard.writeText(address);
|
|
41439
41760
|
setIsCopied(true);
|
|
@@ -41442,6 +41763,43 @@ function RenownUserButton({
|
|
|
41442
41763
|
console.error("Failed to copy address:", err);
|
|
41443
41764
|
}
|
|
41444
41765
|
}, [address]);
|
|
41766
|
+
const triggerElement = asChild ? /* @__PURE__ */ jsxDEV3(Slot, {
|
|
41767
|
+
"data-renown-state": "authenticated",
|
|
41768
|
+
children
|
|
41769
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("button", {
|
|
41770
|
+
type: "button",
|
|
41771
|
+
style: {
|
|
41772
|
+
...styles2.trigger,
|
|
41773
|
+
...isHovered ? styles2.triggerHover : {},
|
|
41774
|
+
...style
|
|
41775
|
+
},
|
|
41776
|
+
"aria-label": "Open account menu",
|
|
41777
|
+
"data-renown-state": "authenticated",
|
|
41778
|
+
children: [
|
|
41779
|
+
avatarUrl ? /* @__PURE__ */ jsxDEV3("img", {
|
|
41780
|
+
src: avatarUrl,
|
|
41781
|
+
alt: "Avatar",
|
|
41782
|
+
style: styles2.avatar
|
|
41783
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
|
|
41784
|
+
style: styles2.avatarPlaceholder,
|
|
41785
|
+
children: /* @__PURE__ */ jsxDEV3("span", {
|
|
41786
|
+
style: styles2.avatarInitial,
|
|
41787
|
+
children: (displayName || "U")[0].toUpperCase()
|
|
41788
|
+
}, undefined, false, undefined, this)
|
|
41789
|
+
}, undefined, false, undefined, this),
|
|
41790
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
41791
|
+
style: styles2.displayName,
|
|
41792
|
+
children: displayName
|
|
41793
|
+
}, undefined, false, undefined, this),
|
|
41794
|
+
/* @__PURE__ */ jsxDEV3(ChevronDownIcon, {
|
|
41795
|
+
size: 14,
|
|
41796
|
+
style: {
|
|
41797
|
+
...styles2.chevron,
|
|
41798
|
+
...isOpen ? styles2.chevronOpen : {}
|
|
41799
|
+
}
|
|
41800
|
+
}, undefined, false, undefined, this)
|
|
41801
|
+
]
|
|
41802
|
+
}, undefined, true, undefined, this);
|
|
41445
41803
|
return /* @__PURE__ */ jsxDEV3("div", {
|
|
41446
41804
|
ref: wrapperRef,
|
|
41447
41805
|
style: styles2.wrapper,
|
|
@@ -41449,46 +41807,25 @@ function RenownUserButton({
|
|
|
41449
41807
|
onMouseEnter: handleMouseEnter,
|
|
41450
41808
|
onMouseLeave: handleMouseLeave,
|
|
41451
41809
|
children: [
|
|
41452
|
-
|
|
41453
|
-
onMouseEnter: handleMouseEnter,
|
|
41454
|
-
onMouseLeave: handleMouseLeave,
|
|
41455
|
-
address,
|
|
41456
|
-
username,
|
|
41457
|
-
avatarUrl
|
|
41458
|
-
}) : /* @__PURE__ */ jsxDEV3("button", {
|
|
41459
|
-
type: "button",
|
|
41460
|
-
style: { ...styles2.trigger, ...style },
|
|
41461
|
-
"aria-label": "Open account menu",
|
|
41462
|
-
children: avatarUrl ? /* @__PURE__ */ jsxDEV3("img", {
|
|
41463
|
-
src: avatarUrl,
|
|
41464
|
-
alt: "Avatar",
|
|
41465
|
-
style: styles2.avatar
|
|
41466
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
|
|
41467
|
-
style: styles2.avatarPlaceholder,
|
|
41468
|
-
children: /* @__PURE__ */ jsxDEV3(UserIcon, {
|
|
41469
|
-
size: 24,
|
|
41470
|
-
color: "#9ca3af"
|
|
41471
|
-
}, undefined, false, undefined, this)
|
|
41472
|
-
}, undefined, false, undefined, this)
|
|
41473
|
-
}, undefined, false, undefined, this),
|
|
41810
|
+
triggerElement,
|
|
41474
41811
|
isOpen && /* @__PURE__ */ jsxDEV3("div", {
|
|
41475
41812
|
style: {
|
|
41476
41813
|
...styles2.popoverBase,
|
|
41477
|
-
...showAbove ? { bottom: `calc(100% + ${
|
|
41814
|
+
...showAbove ? { bottom: `calc(100% + ${POPOVER_GAP}px)` } : { top: `calc(100% + ${POPOVER_GAP}px)` }
|
|
41478
41815
|
},
|
|
41479
41816
|
children: [
|
|
41480
41817
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41481
|
-
style: styles2.
|
|
41818
|
+
style: styles2.header,
|
|
41482
41819
|
children: [
|
|
41483
41820
|
username && /* @__PURE__ */ jsxDEV3("div", {
|
|
41484
|
-
style: styles2.
|
|
41821
|
+
style: styles2.headerUsername,
|
|
41485
41822
|
children: username
|
|
41486
41823
|
}, undefined, false, undefined, this),
|
|
41487
|
-
/* @__PURE__ */ jsxDEV3("div", {
|
|
41824
|
+
address && /* @__PURE__ */ jsxDEV3("div", {
|
|
41488
41825
|
style: styles2.addressRow,
|
|
41489
41826
|
children: /* @__PURE__ */ jsxDEV3("button", {
|
|
41490
41827
|
type: "button",
|
|
41491
|
-
onClick: copyToClipboard,
|
|
41828
|
+
onClick: () => void copyToClipboard(),
|
|
41492
41829
|
style: styles2.addressButton,
|
|
41493
41830
|
children: /* @__PURE__ */ jsxDEV3("div", {
|
|
41494
41831
|
style: {
|
|
@@ -41500,20 +41837,26 @@ function RenownUserButton({
|
|
|
41500
41837
|
},
|
|
41501
41838
|
children: [
|
|
41502
41839
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41503
|
-
style: {
|
|
41840
|
+
style: {
|
|
41841
|
+
...styles2.addressText,
|
|
41842
|
+
opacity: isCopied ? 0 : 1
|
|
41843
|
+
},
|
|
41504
41844
|
children: [
|
|
41505
41845
|
/* @__PURE__ */ jsxDEV3("span", {
|
|
41506
|
-
children:
|
|
41846
|
+
children: truncateAddress2(address)
|
|
41507
41847
|
}, undefined, false, undefined, this),
|
|
41508
41848
|
/* @__PURE__ */ jsxDEV3(CopyIcon, {
|
|
41509
|
-
size:
|
|
41510
|
-
color: "#
|
|
41849
|
+
size: 12,
|
|
41850
|
+
color: "#9ca3af"
|
|
41511
41851
|
}, undefined, false, undefined, this)
|
|
41512
41852
|
]
|
|
41513
41853
|
}, undefined, true, undefined, this),
|
|
41514
41854
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41515
|
-
style: {
|
|
41516
|
-
|
|
41855
|
+
style: {
|
|
41856
|
+
...styles2.copiedText,
|
|
41857
|
+
opacity: isCopied ? 1 : 0
|
|
41858
|
+
},
|
|
41859
|
+
children: "Copied!"
|
|
41517
41860
|
}, undefined, false, undefined, this)
|
|
41518
41861
|
]
|
|
41519
41862
|
}, undefined, true, undefined, this)
|
|
@@ -41521,35 +41864,64 @@ function RenownUserButton({
|
|
|
41521
41864
|
}, undefined, false, undefined, this)
|
|
41522
41865
|
]
|
|
41523
41866
|
}, undefined, true, undefined, this),
|
|
41524
|
-
|
|
41525
|
-
style: styles2.
|
|
41526
|
-
children:
|
|
41527
|
-
|
|
41528
|
-
|
|
41529
|
-
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41533
|
-
|
|
41534
|
-
|
|
41535
|
-
|
|
41536
|
-
|
|
41867
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
41868
|
+
style: styles2.menuSection,
|
|
41869
|
+
children: [
|
|
41870
|
+
profileId && /* @__PURE__ */ jsxDEV3("button", {
|
|
41871
|
+
type: "button",
|
|
41872
|
+
onClick: () => openRenown(profileId),
|
|
41873
|
+
onMouseEnter: () => setHoveredItem("profile"),
|
|
41874
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
41875
|
+
style: {
|
|
41876
|
+
...styles2.menuItem,
|
|
41877
|
+
...hoveredItem === "profile" ? styles2.menuItemHover : {}
|
|
41878
|
+
},
|
|
41879
|
+
children: [
|
|
41880
|
+
/* @__PURE__ */ jsxDEV3(UserIcon, {
|
|
41881
|
+
size: 14,
|
|
41882
|
+
color: "#6b7280"
|
|
41883
|
+
}, undefined, false, undefined, this),
|
|
41884
|
+
"View Profile"
|
|
41885
|
+
]
|
|
41886
|
+
}, undefined, true, undefined, this),
|
|
41887
|
+
menuItems?.map((item) => /* @__PURE__ */ jsxDEV3("button", {
|
|
41888
|
+
type: "button",
|
|
41889
|
+
onClick: item.onClick,
|
|
41890
|
+
onMouseEnter: () => setHoveredItem(item.label),
|
|
41891
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
41892
|
+
style: {
|
|
41893
|
+
...styles2.menuItem,
|
|
41894
|
+
...hoveredItem === item.label ? styles2.menuItemHover : {},
|
|
41895
|
+
...item.style
|
|
41896
|
+
},
|
|
41897
|
+
children: [
|
|
41898
|
+
item.icon,
|
|
41899
|
+
item.label
|
|
41900
|
+
]
|
|
41901
|
+
}, item.label, true, undefined, this))
|
|
41902
|
+
]
|
|
41903
|
+
}, undefined, true, undefined, this),
|
|
41904
|
+
/* @__PURE__ */ jsxDEV3("hr", {
|
|
41905
|
+
style: styles2.separator
|
|
41537
41906
|
}, undefined, false, undefined, this),
|
|
41538
41907
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
41539
|
-
style: styles2.
|
|
41908
|
+
style: styles2.menuSection,
|
|
41540
41909
|
children: /* @__PURE__ */ jsxDEV3("button", {
|
|
41541
41910
|
type: "button",
|
|
41542
41911
|
onClick: onDisconnect,
|
|
41912
|
+
onMouseEnter: () => setHoveredItem("disconnect"),
|
|
41913
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
41543
41914
|
style: {
|
|
41544
41915
|
...styles2.menuItem,
|
|
41545
|
-
...styles2.disconnectItem
|
|
41916
|
+
...styles2.disconnectItem,
|
|
41917
|
+
...hoveredItem === "disconnect" ? styles2.menuItemHover : {}
|
|
41546
41918
|
},
|
|
41547
41919
|
children: [
|
|
41548
41920
|
/* @__PURE__ */ jsxDEV3(DisconnectIcon, {
|
|
41549
41921
|
size: 14,
|
|
41550
|
-
color: "#
|
|
41922
|
+
color: "#dc2626"
|
|
41551
41923
|
}, undefined, false, undefined, this),
|
|
41552
|
-
"
|
|
41924
|
+
"Log out"
|
|
41553
41925
|
]
|
|
41554
41926
|
}, undefined, true, undefined, this)
|
|
41555
41927
|
}, undefined, false, undefined, this)
|
|
@@ -41560,23 +41932,23 @@ function RenownUserButton({
|
|
|
41560
41932
|
}
|
|
41561
41933
|
function RenownAuthButton({
|
|
41562
41934
|
className = "",
|
|
41563
|
-
|
|
41564
|
-
|
|
41565
|
-
|
|
41935
|
+
darkMode,
|
|
41936
|
+
loginContent,
|
|
41937
|
+
userContent,
|
|
41938
|
+
loadingContent,
|
|
41939
|
+
children
|
|
41566
41940
|
}) {
|
|
41567
|
-
const
|
|
41568
|
-
|
|
41569
|
-
|
|
41570
|
-
|
|
41571
|
-
|
|
41572
|
-
|
|
41573
|
-
|
|
41574
|
-
|
|
41575
|
-
if (isLoading) {
|
|
41576
|
-
if (renderLoading) {
|
|
41941
|
+
const auth = useRenownAuth();
|
|
41942
|
+
if (children) {
|
|
41943
|
+
return /* @__PURE__ */ jsxDEV4(Fragment, {
|
|
41944
|
+
children: children(auth)
|
|
41945
|
+
}, undefined, false, undefined, this);
|
|
41946
|
+
}
|
|
41947
|
+
if (auth.status === "loading" || auth.status === "checking") {
|
|
41948
|
+
if (loadingContent) {
|
|
41577
41949
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41578
41950
|
className,
|
|
41579
|
-
children:
|
|
41951
|
+
children: loadingContent
|
|
41580
41952
|
}, undefined, false, undefined, this);
|
|
41581
41953
|
}
|
|
41582
41954
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
@@ -41584,24 +41956,44 @@ function RenownAuthButton({
|
|
|
41584
41956
|
children: [
|
|
41585
41957
|
/* @__PURE__ */ jsxDEV4("div", {
|
|
41586
41958
|
style: {
|
|
41587
|
-
|
|
41588
|
-
|
|
41589
|
-
|
|
41590
|
-
|
|
41959
|
+
display: "flex",
|
|
41960
|
+
alignItems: "center",
|
|
41961
|
+
gap: "8px",
|
|
41962
|
+
padding: "6px 12px",
|
|
41963
|
+
borderRadius: "8px",
|
|
41964
|
+
border: "1px solid #e5e7eb",
|
|
41591
41965
|
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
|
|
41592
|
-
}
|
|
41593
|
-
|
|
41966
|
+
},
|
|
41967
|
+
children: [
|
|
41968
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
41969
|
+
style: {
|
|
41970
|
+
width: "28px",
|
|
41971
|
+
height: "28px",
|
|
41972
|
+
borderRadius: "50%",
|
|
41973
|
+
backgroundColor: "#e5e7eb"
|
|
41974
|
+
}
|
|
41975
|
+
}, undefined, false, undefined, this),
|
|
41976
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
41977
|
+
style: {
|
|
41978
|
+
width: "80px",
|
|
41979
|
+
height: "14px",
|
|
41980
|
+
borderRadius: "4px",
|
|
41981
|
+
backgroundColor: "#e5e7eb"
|
|
41982
|
+
}
|
|
41983
|
+
}, undefined, false, undefined, this)
|
|
41984
|
+
]
|
|
41985
|
+
}, undefined, true, undefined, this),
|
|
41594
41986
|
/* @__PURE__ */ jsxDEV4("style", {
|
|
41595
41987
|
children: `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }`
|
|
41596
41988
|
}, undefined, false, undefined, this)
|
|
41597
41989
|
]
|
|
41598
41990
|
}, undefined, true, undefined, this);
|
|
41599
41991
|
}
|
|
41600
|
-
if (
|
|
41601
|
-
if (
|
|
41992
|
+
if (auth.status === "authorized") {
|
|
41993
|
+
if (userContent) {
|
|
41602
41994
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41603
41995
|
className,
|
|
41604
|
-
children:
|
|
41996
|
+
children: userContent
|
|
41605
41997
|
}, undefined, false, undefined, this);
|
|
41606
41998
|
}
|
|
41607
41999
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
@@ -41609,54 +42001,52 @@ function RenownAuthButton({
|
|
|
41609
42001
|
children: /* @__PURE__ */ jsxDEV4(RenownUserButton, {}, undefined, false, undefined, this)
|
|
41610
42002
|
}, undefined, false, undefined, this);
|
|
41611
42003
|
}
|
|
41612
|
-
if (
|
|
42004
|
+
if (loginContent) {
|
|
41613
42005
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41614
42006
|
className,
|
|
41615
|
-
children:
|
|
42007
|
+
children: loginContent
|
|
41616
42008
|
}, undefined, false, undefined, this);
|
|
41617
42009
|
}
|
|
41618
42010
|
return /* @__PURE__ */ jsxDEV4("div", {
|
|
41619
42011
|
className,
|
|
41620
|
-
children: /* @__PURE__ */ jsxDEV4(RenownLoginButton, {
|
|
42012
|
+
children: /* @__PURE__ */ jsxDEV4(RenownLoginButton, {
|
|
42013
|
+
darkMode
|
|
42014
|
+
}, undefined, false, undefined, this)
|
|
41621
42015
|
}, undefined, false, undefined, this);
|
|
41622
42016
|
}
|
|
41623
|
-
function
|
|
42017
|
+
async function initRenown(appName, namespace, url) {
|
|
42018
|
+
addRenownEventHandler();
|
|
42019
|
+
setRenown(loading);
|
|
42020
|
+
const builder = new RenownBuilder(appName, {
|
|
42021
|
+
basename: namespace,
|
|
42022
|
+
baseUrl: url
|
|
42023
|
+
});
|
|
42024
|
+
const renown = await builder.build();
|
|
42025
|
+
setRenown(renown);
|
|
42026
|
+
await login(undefined, renown);
|
|
42027
|
+
return renown;
|
|
42028
|
+
}
|
|
42029
|
+
function useRenownInit({
|
|
41624
42030
|
appName,
|
|
41625
|
-
|
|
41626
|
-
|
|
41627
|
-
children
|
|
42031
|
+
namespace,
|
|
42032
|
+
url
|
|
41628
42033
|
}) {
|
|
41629
|
-
const
|
|
41630
|
-
const
|
|
42034
|
+
const promiseRef = useRef6(Promise.withResolvers());
|
|
42035
|
+
const initRef = useRef6(false);
|
|
42036
|
+
if (typeof window === "undefined") {
|
|
42037
|
+
promiseRef.current.reject(new Error("window is undefined"));
|
|
42038
|
+
return promiseRef.current.promise;
|
|
42039
|
+
}
|
|
41631
42040
|
if (initRef.current) {
|
|
41632
|
-
|
|
41633
|
-
if (appName !== initial.appName) {
|
|
41634
|
-
console.warn("RenownProvider: 'appName' changed after mount. This prop is only read once during initialization.");
|
|
41635
|
-
}
|
|
41636
|
-
if (basename !== initial.basename) {
|
|
41637
|
-
console.warn("RenownProvider: 'basename' changed after mount. This prop is only read once during initialization.");
|
|
41638
|
-
}
|
|
41639
|
-
if (baseUrl !== initial.baseUrl) {
|
|
41640
|
-
console.warn("RenownProvider: 'baseUrl' changed after mount. This prop is only read once during initialization.");
|
|
41641
|
-
}
|
|
42041
|
+
return promiseRef.current.promise;
|
|
41642
42042
|
}
|
|
41643
|
-
|
|
41644
|
-
|
|
41645
|
-
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
addRenownEventHandler();
|
|
41651
|
-
const init = async () => {
|
|
41652
|
-
const builder = new RenownBuilder(appName, { basename, baseUrl });
|
|
41653
|
-
const instance = await builder.build();
|
|
41654
|
-
setRenown(instance);
|
|
41655
|
-
await login(undefined, instance);
|
|
41656
|
-
};
|
|
41657
|
-
init().catch(console.error);
|
|
41658
|
-
}, []);
|
|
41659
|
-
return children;
|
|
42043
|
+
initRef.current = true;
|
|
42044
|
+
initRenown(appName, namespace, url).then(promiseRef.current.resolve).catch(promiseRef.current.reject);
|
|
42045
|
+
return promiseRef.current.promise;
|
|
42046
|
+
}
|
|
42047
|
+
function Renown2({ onError, ...initOptions }) {
|
|
42048
|
+
useRenownInit(initOptions).catch(onError ?? console.error);
|
|
42049
|
+
return null;
|
|
41660
42050
|
}
|
|
41661
42051
|
var __create2, __getProtoOf2, __defProp3, __getOwnPropNames2, __getOwnPropDesc2, __hasOwnProp2, __toESM2 = (mod, isNodeMode, target) => {
|
|
41662
42052
|
target = mod != null ? __create2(__getProtoOf2(mod)) : {};
|
|
@@ -42222,13 +42612,13 @@ ${String(result)}`);
|
|
|
42222
42612
|
return t;
|
|
42223
42613
|
};
|
|
42224
42614
|
return __assign.apply(this, arguments);
|
|
42225
|
-
}, docCache, fragmentSourceMap, printFragmentWarnings = true, experimentalFragmentVariables = false, extras, PropagationMode2, PhDocumentFieldsFragmentDoc, GetDocumentModelsDocument, GetDocumentDocument, GetDocumentChildrenDocument, GetDocumentParentsDocument, FindDocumentsDocument, GetDocumentOperationsDocument, GetJobStatusDocument, CreateDocumentDocument, CreateEmptyDocumentDocument, MutateDocumentDocument, MutateDocumentAsyncDocument, RenameDocumentDocument, AddChildrenDocument, RemoveChildrenDocument, MoveChildrenDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangesDocument, JobChangesDocument, PollSyncEnvelopesDocument, TouchChannelDocument, PushSyncEnvelopesDocument, defaultWrapper = (action, _operationName, _operationType, _variables) => action(), SPLIT_LOWER_UPPER_RE, SPLIT_UPPER_UPPER_RE, SPLIT_SEPARATE_NUMBER_RE, DEFAULT_STRIP_REGEXP, SPLIT_REPLACE_VALUE = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS = "", isExternalControlsEnabledEventFunctions, setIsExternalControlsEnabled, useIsExternalControlsEnabled, addIsExternalControlsEnabledEventHandler, isDragAndDropEnabledEventFunctions, setIsDragAndDropEnabled, useIsDragAndDropEnabled, addIsDragAndDropEnabledEventHandler, allowedDocumentTypesEventFunctions, setAllowedDocumentTypes, addAllowedDocumentTypesEventHandler, phDriveEditorConfigSetters, phDocumentEditorConfigSetters, phDriveEditorConfigHooks, phDocumentEditorConfigHooks, vetraPackageManagerFunctions, useVetraPackageManager, useVetraPackages = () => {
|
|
42615
|
+
}, docCache, fragmentSourceMap, printFragmentWarnings = true, experimentalFragmentVariables = false, extras, PropagationMode2, PhDocumentFieldsFragmentDoc, GetDocumentModelsDocument, GetDocumentDocument, GetDocumentChildrenDocument, GetDocumentParentsDocument, FindDocumentsDocument, GetDocumentOperationsDocument, GetJobStatusDocument, CreateDocumentDocument, CreateEmptyDocumentDocument, MutateDocumentDocument, MutateDocumentAsyncDocument, RenameDocumentDocument, AddChildrenDocument, RemoveChildrenDocument, MoveChildrenDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangesDocument, JobChangesDocument, PollSyncEnvelopesDocument, TouchChannelDocument, PushSyncEnvelopesDocument, defaultWrapper = (action, _operationName, _operationType, _variables) => action(), SPLIT_LOWER_UPPER_RE, SPLIT_UPPER_UPPER_RE, SPLIT_SEPARATE_NUMBER_RE, DEFAULT_STRIP_REGEXP, SPLIT_REPLACE_VALUE = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS = "", isServer, useLoading, setLoading, addLoadingEventHandler, loading = null, renownEventFunctions, addRenownEventHandler, useRenown, setRenown, RENOWN_URL = "https://www.renown.id", RENOWN_NETWORK_ID = "eip155", RENOWN_CHAIN_ID = "1", DOMAIN_TYPE, VERIFIABLE_CREDENTIAL_EIP712_TYPE, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, ISSUER_TYPE, CREDENTIAL_TYPES, isExternalControlsEnabledEventFunctions, setIsExternalControlsEnabled, useIsExternalControlsEnabled, addIsExternalControlsEnabledEventHandler, isDragAndDropEnabledEventFunctions, setIsDragAndDropEnabled, useIsDragAndDropEnabled, addIsDragAndDropEnabledEventHandler, allowedDocumentTypesEventFunctions, setAllowedDocumentTypes, addAllowedDocumentTypesEventHandler, phDriveEditorConfigSetters, phDocumentEditorConfigSetters, phDriveEditorConfigHooks, phDocumentEditorConfigHooks, vetraPackageManagerFunctions, useVetraPackageManager, useVetraPackages = () => {
|
|
42226
42616
|
const packageManager = useVetraPackageManager();
|
|
42227
|
-
return
|
|
42228
|
-
}, addVetraPackageManagerEventHandler, reactorClientModuleEventFunctions, reactorClientEventFunctions, useReactorClientModule, setReactorClientModule, addReactorClientModuleEventHandler, useReactorClient, setReactorClient, addReactorClientEventHandler, useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager, useSyncList = () => {
|
|
42617
|
+
return useSyncExternalStore3((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);
|
|
42618
|
+
}, addVetraPackageManagerEventHandler, EMPTY_PENDING, EMPTY_DISMISSED, NOOP_UNSUBSCRIBE = () => {}, documentEventFunctions, useDocumentCache, setDocumentCache, addDocumentCacheEventHandler, base64, locales, defaultLocale, initialMulticharmap, initialCharmap, slug_default, drivesEventFunctions, useDrives, setDrives, addDrivesEventHandler, selectedDriveIdEventFunctions, useSelectedDriveId, setSelectedDriveId, addSelectedDriveIdEventHandler, selectedNodeIdEventFunctions, useSelectedNodeId, setSelectedNodeId, addSelectedNodeIdEventHandler, useRouterBasename, setRouterBasename, addRouterBasenameEventHandler, useVersion, setVersion, addVersionEventHandler, useRequiresHardRefresh, setRequiresHardRefresh, addRequiresHardRefreshEventHandler, useWarnOutdatedApp, setWarnOutdatedApp, addWarnOutdatedAppEventHandler, useStudioMode, setStudioMode, addStudioModeEventHandler, useBasePath, setBasePath, addBasePathEventHandler, useVersionCheckInterval, setVersionCheckInterval, addVersionCheckIntervalEventHandler, useCliVersion, setCliVersion, addCliVersionEventHandler, useFileUploadOperationsChunkSize, setFileUploadOperationsChunkSize, addFileUploadOperationsChunkSizeEventHandler, useIsDocumentModelSelectionSettingsEnabled, setIsDocumentModelSelectionSettingsEnabled, addIsDocumentModelSelectionSettingsEnabledEventHandler, useGaTrackingId, setGaTrackingId, addGaTrackingIdEventHandler, useDefaultDrivesUrl, setDefaultDrivesUrl, addDefaultDrivesUrlEventHandler, useDrivesPreserveStrategy, setDrivesPreserveStrategy, addDrivesPreserveStrategyEventHandler, useIsLocalDrivesEnabled, setIsLocalDrivesEnabled, addIsLocalDrivesEnabledEventHandler, useIsAddDriveEnabled, setIsAddDriveEnabled, addIsAddDriveEnabledEventHandler, useIsPublicDrivesEnabled, setIsPublicDrivesEnabled, addIsPublicDrivesEnabledEventHandler, useIsAddPublicDrivesEnabled, setIsAddPublicDrivesEnabled, addIsAddPublicDrivesEnabledEventHandler, useIsDeletePublicDrivesEnabled, setIsDeletePublicDrivesEnabled, addIsDeletePublicDrivesEnabledEventHandler, useIsCloudDrivesEnabled, setIsCloudDrivesEnabled, addIsCloudDrivesEnabledEventHandler, useIsAddCloudDrivesEnabled, setIsAddCloudDrivesEnabled, addIsAddCloudDrivesEnabledEventHandler, useIsDeleteCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, addIsDeleteCloudDrivesEnabledEventHandler, useLocalDrivesEnabled, setLocalDrivesEnabled, addLocalDrivesEnabledEventHandler, useIsAddLocalDrivesEnabled, setIsAddLocalDrivesEnabled, addIsAddLocalDrivesEnabledEventHandler, useIsDeleteLocalDrivesEnabled, setIsDeleteLocalDrivesEnabled, addIsDeleteLocalDrivesEnabledEventHandler, useIsEditorDebugModeEnabled, setIsEditorDebugModeEnabled, addIsEditorDebugModeEnabledEventHandler, useIsEditorReadModeEnabled, setIsEditorReadModeEnabled, addIsEditorReadModeEnabledEventHandler, useIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsDatabaseWorkerEnabled, addIsAnalyticsDatabaseWorkerEnabledEventHandler, useIsDiffAnalyticsEnabled, setIsDiffAnalyticsEnabled, addIsDiffAnalyticsEnabledEventHandler, useIsDriveAnalyticsEnabled, setIsDriveAnalyticsEnabled, addIsDriveAnalyticsEnabledEventHandler, useRenownUrl, setRenownUrl, addRenownUrlEventHandler, useRenownNetworkId, setRenownNetworkId, addRenownNetworkIdEventHandler, useRenownChainId, setRenownChainId, addRenownChainIdEventHandler, useSentryRelease, setSentryRelease, addSentryReleaseEventHandler, useSentryDsn, setSentryDsn, addSentryDsnEventHandler, useSentryEnv, setSentryEnv, addSentryEnvEventHandler, useIsSentryTracingEnabled, setIsSentryTracingEnabled, addIsSentryTracingEnabledEventHandler, useIsExternalProcessorsEnabled, setIsExternalProcessorsEnabled, addIsExternalProcessorsEnabledEventHandler, useIsExternalPackagesEnabled, setIsExternalPackagesEnabled, addIsExternalPackagesEnabledEventHandler, enabledEditorsEventFunctions, setEnabledEditors, useEnabledEditors, addEnabledEditorsEventHandler, disabledEditorsEventFunctions, setDisabledEditors, useDisabledEditors, addDisabledEditorsEventHandler, isRelationalProcessorsEnabled, setIsRelationalProcessorsEnabled, useIsRelationalProcessorsEnabled, addIsRelationalProcessorsEnabledEventHandler, isExternalRelationalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, addIsExternalRelationalProcessorsEnabledEventHandler, isAnalyticsEnabledEventFunctions, setIsAnalyticsEnabled, useIsAnalyticsEnabled, addIsAnalyticsEnabledEventHandler, isAnalyticsExternalProcessorsEnabled, setIsAnalyticsExternalProcessorsEnabled, useIsAnalyticsExternalProcessorsEnabled, addIsAnalyticsExternalProcessorsEnabledEventHandler, analyticsDatabaseNameEventFunctions, setAnalyticsDatabaseName, useAnalyticsDatabaseName, addAnalyticsDatabaseNameEventHandler, logLevelEventFunctions, setLogLevel2, useLogLevel, addLogLevelEventHandler, allowListEventFunctions, setAllowList, useAllowList, addAllowListEventHandler, nonUserConfigSetters, phGlobalConfigSetters, nonUserConfigHooks, phGlobalConfigHooks, reactorClientModuleEventFunctions, reactorClientEventFunctions, useReactorClientModule, setReactorClientModule, addReactorClientModuleEventHandler, useReactorClient, setReactorClient, addReactorClientEventHandler, useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager, useSyncList = () => {
|
|
42229
42619
|
const sync = useSync();
|
|
42230
42620
|
return sync?.list() ?? [];
|
|
42231
|
-
},
|
|
42621
|
+
}, featuresEventFunctions, useFeatures, setFeatures, addFeaturesEventHandler, modalEventFunctions, usePHModal, setPHModal, addModalEventHandler, revisionHistoryEventFunctions, useRevisionHistoryVisible, setRevisionHistoryVisible, addRevisionHistoryVisibleEventHandler, selectedTimelineItemEventFunctions, useSelectedTimelineItem, setSelectedTimelineItem, addSelectedTimelineItemEventHandler, selectedTimelineRevisionEventFunctions, useSelectedTimelineRevision, setSelectedTimelineRevision, addSelectedTimelineRevisionEventHandler, toastEventFunctions, usePHToast, setPHToast, addToastEventHandler, FEATURE_INSPECTOR_ENABLED = "FEATURE_INSPECTOR_ENABLED", FEATURE_INSPECTOR_ENABLED_DEFAULT = false, syncStatusToUI, validateDocument = (document2) => {
|
|
42232
42622
|
const errors2 = [];
|
|
42233
42623
|
if (document2.header.documentType !== "powerhouse/document-model") {
|
|
42234
42624
|
return errors2;
|
|
@@ -42280,7 +42670,7 @@ ${String(result)}`);
|
|
|
42280
42670
|
return operationDate >= startDate && operationDate <= endDate;
|
|
42281
42671
|
});
|
|
42282
42672
|
return operation ? operation.index : 0;
|
|
42283
|
-
}, lzString,
|
|
42673
|
+
}, lzString, useOnDropFile = (documentTypesOverride) => {
|
|
42284
42674
|
const selectedDriveId = useSelectedDriveId();
|
|
42285
42675
|
const selectedFolder = useSelectedFolder();
|
|
42286
42676
|
const documentTypes = useDocumentTypes();
|
|
@@ -42294,7 +42684,7 @@ ${String(result)}`);
|
|
|
42294
42684
|
return await addFileWithProgress(file, selectedDriveId, fileName, targetNodeId, onProgress, documentTypesOverride ?? documentTypes, resolveConflict);
|
|
42295
42685
|
};
|
|
42296
42686
|
return onDropFile;
|
|
42297
|
-
}, store, BrowserLocalStorage, PGLITE_UPDATE_EVENT = "ph:pglite-update", defaultPGliteState, usePGliteDB = () => {
|
|
42687
|
+
}, store, BrowserLocalStorage, DISMISSED_STORAGE_KEY = "ph-connect-dismissed-packages", PGLITE_UPDATE_EVENT = "ph:pglite-update", defaultPGliteState, usePGliteDB = () => {
|
|
42298
42688
|
const [state, setState] = useState5(() => window.powerhouse?.pglite ?? defaultPGliteState);
|
|
42299
42689
|
useEffect5(() => {
|
|
42300
42690
|
const handlePgliteUpdate = () => setState(window.powerhouse?.pglite ?? defaultPGliteState);
|
|
@@ -42320,7 +42710,7 @@ ${String(result)}`);
|
|
|
42320
42710
|
const pglite = usePGliteDB();
|
|
42321
42711
|
const setPGlite = useSetPGliteDB();
|
|
42322
42712
|
return [pglite, setPGlite];
|
|
42323
|
-
}, DEFAULT_RENOWN_URL = "https://www.renown.id", crypto2, isLE, swap32IfBE, hasHexBuiltin, hexes, asciis, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, U32_MASK64, _32n, shrSH = (h, _l, s) => h >>> s, shrSL = (h, l, s) => h << 32 - s | l >>> s, rotrSH = (h, l, s) => h >>> s | l << 32 - s, rotrSL = (h, l, s) => h << 32 - s | l >>> s, rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32, rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s, add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low /
|
|
42713
|
+
}, DEFAULT_RENOWN_URL = "https://www.renown.id", crypto2, isLE, swap32IfBE, hasHexBuiltin, hexes, asciis, HashMD, SHA256_IV, SHA384_IV, SHA512_IV, U32_MASK64, _32n, shrSH = (h, _l, s) => h >>> s, shrSL = (h, l, s) => h << 32 - s | l >>> s, rotrSH = (h, l, s) => h >>> s | l << 32 - s, rotrSL = (h, l, s) => h << 32 - s | l >>> s, rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32, rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s, add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0, add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0), add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0, add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0), add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0, SHA256_K, SHA256_W, SHA256, K512, SHA512_Kh, SHA512_Kl, SHA512_W_H, SHA512_W_L, SHA512, SHA384, sha2562, sha5122, sha384, _0n, _1n, isPosBig = (n) => typeof n === "bigint" && _0n <= n, bitMask = (n) => (_1n << BigInt(n)) - _1n, notImplemented = () => {
|
|
42324
42714
|
throw new Error("not implemented");
|
|
42325
42715
|
}, _0n2, _1n2, _2n, _3n, _4n, _5n, _7n, _8n, _9n, _16n, isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2, FIELD_FIELDS, _0n3, _1n3, pointPrecomputes, pointWindowSizes, _0n4, _1n4, _2n2, _8n2, _0n5, _1n5, _2n3, _3n2, _5n2, _8n3, ed25519_CURVE_p, ed25519_CURVE, ED25519_SQRT_M1, Fp, Fn, ed25519Defaults, ed25519, SQRT_M1, SQRT_AD_MINUS_ONE, INVSQRT_A_MINUS_D, ONE_MINUS_D_SQ, D_MINUS_ONE_SQ, invertSqrt = (number) => uvRatio(_1n5, number), MAX_255B, bytes255ToNumberLE = (bytes) => ed25519.Point.Fp.create(bytesToNumberLE(bytes) & MAX_255B), _RistrettoPoint, import_multibase, HMAC, hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(), divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n4) / den, DERErr, DER, _0n6, _1n6, _2n4, _3n3, _4n2, secp256k1_CURVE, secp256k1_ENDO, _2n5, Fpk1, secp256k1, p256_CURVE, p384_CURVE, p521_CURVE, Fp256, Fp384, Fp521, p256, p384, p521, p2562, sha2563, Rho160, Id160, Pi160, idxLR, idxL, idxR, shifts160, shiftsL160, shiftsR160, Kl160, Kr160, BUF_160, RIPEMD160, ripemd160, ripemd1602, _0n7, _1n7, _2n6, _7n2, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256, import_canonicalize, PCT_ENCODED = "(?:%[0-9a-fA-F]{2})", ID_CHAR, METHOD = "([a-z0-9]+)", METHOD_ID, PARAM_CHAR = "[a-zA-Z0-9_.:%-]", PARAM, PARAMS, PATH = `(/[^#?]*)?`, QUERY = `([?][^#]*)?`, FRAGMENT = `(#.*)?`, DID_MATCHER, EMPTY_RESULT, gcd = (a, b) => b === 0 ? a : gcd(b, a % b), radix2carry = (from3, to) => from3 + (to - gcd(from3, to)), powers, base162, base322, base32nopad, base32hex2, base32hexnopad, base32crockford, hasBase64Builtin, decodeBase64Builtin = (s, isUrl) => {
|
|
42326
42716
|
astr("base64", s);
|
|
@@ -43095,7 +43485,7 @@ ${String(result)}`);
|
|
|
43095
43485
|
}, MAX_RETRIES = 5, RETRY_DELAY = 200, isRelationNotExistError = (error) => {
|
|
43096
43486
|
const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : String(error);
|
|
43097
43487
|
return errorMessage.toLowerCase().includes("relation") && errorMessage.toLowerCase().includes("does not exist");
|
|
43098
|
-
}, import_lodash, ConflictError,
|
|
43488
|
+
}, import_lodash, ConflictError, Slot, lightStyles, darkStyles, styles, POPOVER_GAP = 4, POPOVER_HEIGHT = 150, styles2;
|
|
43099
43489
|
var init_src2 = __esm(() => {
|
|
43100
43490
|
init_src();
|
|
43101
43491
|
init_src();
|
|
@@ -47452,6 +47842,52 @@ spurious results.`);
|
|
|
47452
47842
|
SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
47453
47843
|
SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
47454
47844
|
DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
47845
|
+
isServer = typeof window === "undefined";
|
|
47846
|
+
({
|
|
47847
|
+
useValue: useLoading,
|
|
47848
|
+
setValue: setLoading,
|
|
47849
|
+
addEventHandler: addLoadingEventHandler
|
|
47850
|
+
} = makePHEventFunctions("loading"));
|
|
47851
|
+
renownEventFunctions = makePHEventFunctions("renown");
|
|
47852
|
+
addRenownEventHandler = renownEventFunctions.addEventHandler;
|
|
47853
|
+
useRenown = renownEventFunctions.useValue;
|
|
47854
|
+
setRenown = renownEventFunctions.setValue;
|
|
47855
|
+
DOMAIN_TYPE = [
|
|
47856
|
+
{ name: "name", type: "string" },
|
|
47857
|
+
{ name: "version", type: "string" },
|
|
47858
|
+
{ name: "chainId", type: "uint256" },
|
|
47859
|
+
{ name: "verifyingContract", type: "address" }
|
|
47860
|
+
];
|
|
47861
|
+
VERIFIABLE_CREDENTIAL_EIP712_TYPE = [
|
|
47862
|
+
{ name: "@context", type: "string[]" },
|
|
47863
|
+
{ name: "type", type: "string[]" },
|
|
47864
|
+
{ name: "id", type: "string" },
|
|
47865
|
+
{ name: "issuer", type: "Issuer" },
|
|
47866
|
+
{ name: "credentialSubject", type: "CredentialSubject" },
|
|
47867
|
+
{ name: "credentialSchema", type: "CredentialSchema" },
|
|
47868
|
+
{ name: "issuanceDate", type: "string" },
|
|
47869
|
+
{ name: "expirationDate", type: "string" }
|
|
47870
|
+
];
|
|
47871
|
+
CREDENTIAL_SCHEMA_EIP712_TYPE = [
|
|
47872
|
+
{ name: "id", type: "string" },
|
|
47873
|
+
{ name: "type", type: "string" }
|
|
47874
|
+
];
|
|
47875
|
+
CREDENTIAL_SUBJECT_TYPE = [
|
|
47876
|
+
{ name: "app", type: "string" },
|
|
47877
|
+
{ name: "id", type: "string" },
|
|
47878
|
+
{ name: "name", type: "string" }
|
|
47879
|
+
];
|
|
47880
|
+
ISSUER_TYPE = [
|
|
47881
|
+
{ name: "id", type: "string" },
|
|
47882
|
+
{ name: "ethereumAddress", type: "string" }
|
|
47883
|
+
];
|
|
47884
|
+
CREDENTIAL_TYPES = {
|
|
47885
|
+
EIP712Domain: DOMAIN_TYPE,
|
|
47886
|
+
VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,
|
|
47887
|
+
CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,
|
|
47888
|
+
CredentialSubject: CREDENTIAL_SUBJECT_TYPE,
|
|
47889
|
+
Issuer: ISSUER_TYPE
|
|
47890
|
+
};
|
|
47455
47891
|
isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
|
|
47456
47892
|
setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;
|
|
47457
47893
|
useIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.useValue;
|
|
@@ -47480,14 +47916,8 @@ spurious results.`);
|
|
|
47480
47916
|
vetraPackageManagerFunctions = makePHEventFunctions("vetraPackageManager");
|
|
47481
47917
|
useVetraPackageManager = vetraPackageManagerFunctions.useValue;
|
|
47482
47918
|
addVetraPackageManagerEventHandler = vetraPackageManagerFunctions.addEventHandler;
|
|
47483
|
-
|
|
47484
|
-
|
|
47485
|
-
useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
47486
|
-
setReactorClientModule = reactorClientModuleEventFunctions.setValue;
|
|
47487
|
-
addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;
|
|
47488
|
-
useReactorClient = reactorClientEventFunctions.useValue;
|
|
47489
|
-
setReactorClient = reactorClientEventFunctions.setValue;
|
|
47490
|
-
addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;
|
|
47919
|
+
EMPTY_PENDING = [];
|
|
47920
|
+
EMPTY_DISMISSED = [];
|
|
47491
47921
|
documentEventFunctions = makePHEventFunctions("documentCache");
|
|
47492
47922
|
useDocumentCache = documentEventFunctions.useValue;
|
|
47493
47923
|
setDocumentCache = documentEventFunctions.setValue;
|
|
@@ -48535,6 +48965,14 @@ spurious results.`);
|
|
|
48535
48965
|
...phDocumentEditorConfigHooks,
|
|
48536
48966
|
...nonUserConfigHooks
|
|
48537
48967
|
};
|
|
48968
|
+
reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
|
|
48969
|
+
reactorClientEventFunctions = makePHEventFunctions("reactorClient");
|
|
48970
|
+
useReactorClientModule = reactorClientModuleEventFunctions.useValue;
|
|
48971
|
+
setReactorClientModule = reactorClientModuleEventFunctions.setValue;
|
|
48972
|
+
addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;
|
|
48973
|
+
useReactorClient = reactorClientEventFunctions.useValue;
|
|
48974
|
+
setReactorClient = reactorClientEventFunctions.setValue;
|
|
48975
|
+
addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;
|
|
48538
48976
|
featuresEventFunctions = makePHEventFunctions("features");
|
|
48539
48977
|
useFeatures = featuresEventFunctions.useValue;
|
|
48540
48978
|
setFeatures = featuresEventFunctions.setValue;
|
|
@@ -48567,51 +49005,6 @@ spurious results.`);
|
|
|
48567
49005
|
[SyncStatus.Error]: "ERROR"
|
|
48568
49006
|
};
|
|
48569
49007
|
lzString = __toESM2(require_lz_string(), 1);
|
|
48570
|
-
DOMAIN_TYPE = [
|
|
48571
|
-
{ name: "name", type: "string" },
|
|
48572
|
-
{ name: "version", type: "string" },
|
|
48573
|
-
{ name: "chainId", type: "uint256" },
|
|
48574
|
-
{ name: "verifyingContract", type: "address" }
|
|
48575
|
-
];
|
|
48576
|
-
VERIFIABLE_CREDENTIAL_EIP712_TYPE = [
|
|
48577
|
-
{ name: "@context", type: "string[]" },
|
|
48578
|
-
{ name: "type", type: "string[]" },
|
|
48579
|
-
{ name: "id", type: "string" },
|
|
48580
|
-
{ name: "issuer", type: "Issuer" },
|
|
48581
|
-
{ name: "credentialSubject", type: "CredentialSubject" },
|
|
48582
|
-
{ name: "credentialSchema", type: "CredentialSchema" },
|
|
48583
|
-
{ name: "issuanceDate", type: "string" },
|
|
48584
|
-
{ name: "expirationDate", type: "string" }
|
|
48585
|
-
];
|
|
48586
|
-
CREDENTIAL_SCHEMA_EIP712_TYPE = [
|
|
48587
|
-
{ name: "id", type: "string" },
|
|
48588
|
-
{ name: "type", type: "string" }
|
|
48589
|
-
];
|
|
48590
|
-
CREDENTIAL_SUBJECT_TYPE = [
|
|
48591
|
-
{ name: "app", type: "string" },
|
|
48592
|
-
{ name: "id", type: "string" },
|
|
48593
|
-
{ name: "name", type: "string" }
|
|
48594
|
-
];
|
|
48595
|
-
ISSUER_TYPE = [
|
|
48596
|
-
{ name: "id", type: "string" },
|
|
48597
|
-
{ name: "ethereumAddress", type: "string" }
|
|
48598
|
-
];
|
|
48599
|
-
CREDENTIAL_TYPES = {
|
|
48600
|
-
EIP712Domain: DOMAIN_TYPE,
|
|
48601
|
-
VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,
|
|
48602
|
-
CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,
|
|
48603
|
-
CredentialSubject: CREDENTIAL_SUBJECT_TYPE,
|
|
48604
|
-
Issuer: ISSUER_TYPE
|
|
48605
|
-
};
|
|
48606
|
-
({
|
|
48607
|
-
useValue: useLoading,
|
|
48608
|
-
setValue: setLoading,
|
|
48609
|
-
addEventHandler: addLoadingEventHandler
|
|
48610
|
-
} = makePHEventFunctions("loading"));
|
|
48611
|
-
renownEventFunctions = makePHEventFunctions("renown");
|
|
48612
|
-
useRenown = renownEventFunctions.useValue;
|
|
48613
|
-
setRenown = renownEventFunctions.setValue;
|
|
48614
|
-
addRenownEventHandler = renownEventFunctions.addEventHandler;
|
|
48615
49008
|
store = {
|
|
48616
49009
|
get: function(key) {
|
|
48617
49010
|
const value = localStorage.getItem(key);
|
|
@@ -48784,7 +49177,7 @@ spurious results.`);
|
|
|
48784
49177
|
1541459225,
|
|
48785
49178
|
327033209
|
|
48786
49179
|
]);
|
|
48787
|
-
U32_MASK64 = /* @__PURE__ */ BigInt(
|
|
49180
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
48788
49181
|
_32n = /* @__PURE__ */ BigInt(32);
|
|
48789
49182
|
SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
48790
49183
|
1116352408,
|
|
@@ -49334,7 +49727,7 @@ spurious results.`);
|
|
|
49334
49727
|
this.iHash.update(pad);
|
|
49335
49728
|
this.oHash = hash.create();
|
|
49336
49729
|
for (let i = 0;i < pad.length; i++)
|
|
49337
|
-
pad[i] ^=
|
|
49730
|
+
pad[i] ^= 54 ^ 92;
|
|
49338
49731
|
this.oHash.update(pad);
|
|
49339
49732
|
clean(pad);
|
|
49340
49733
|
}
|
|
@@ -49599,11 +49992,11 @@ spurious results.`);
|
|
|
49599
49992
|
RIPEMD160 = class RIPEMD160 extends HashMD {
|
|
49600
49993
|
constructor() {
|
|
49601
49994
|
super(64, 20, 8, true);
|
|
49602
|
-
this.h0 = 1732584193;
|
|
49603
|
-
this.h1 =
|
|
49604
|
-
this.h2 =
|
|
49605
|
-
this.h3 = 271733878;
|
|
49606
|
-
this.h4 =
|
|
49995
|
+
this.h0 = 1732584193 | 0;
|
|
49996
|
+
this.h1 = 4023233417 | 0;
|
|
49997
|
+
this.h2 = 2562383102 | 0;
|
|
49998
|
+
this.h3 = 271733878 | 0;
|
|
49999
|
+
this.h4 = 3285377520 | 0;
|
|
49607
50000
|
}
|
|
49608
50001
|
get() {
|
|
49609
50002
|
const { h0, h1, h2, h3, h4 } = this;
|
|
@@ -49781,7 +50174,7 @@ spurious results.`);
|
|
|
49781
50174
|
return to;
|
|
49782
50175
|
}
|
|
49783
50176
|
};
|
|
49784
|
-
keccak_256 = /* @__PURE__ */ (() => gen(1, 136,
|
|
50177
|
+
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
49785
50178
|
import_canonicalize = __toESM2(require_canonicalize(), 1);
|
|
49786
50179
|
ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
|
|
49787
50180
|
METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
|
|
@@ -54632,72 +55025,63 @@ spurious results.`);
|
|
|
54632
55025
|
this.name = "ConflictError";
|
|
54633
55026
|
}
|
|
54634
55027
|
};
|
|
54635
|
-
|
|
55028
|
+
Slot = forwardRef(({ children, ...props }, ref) => {
|
|
55029
|
+
const child = Children.only(children);
|
|
55030
|
+
if (!isValidElement(child)) {
|
|
55031
|
+
return null;
|
|
55032
|
+
}
|
|
55033
|
+
const childElement = child;
|
|
55034
|
+
const mergedProps = mergeProps(props, childElement.props);
|
|
55035
|
+
if (ref) {
|
|
55036
|
+
mergedProps.ref = ref;
|
|
55037
|
+
}
|
|
55038
|
+
return cloneElement(childElement, mergedProps);
|
|
55039
|
+
});
|
|
55040
|
+
Slot.displayName = "Slot";
|
|
55041
|
+
lightStyles = {
|
|
54636
55042
|
trigger: {
|
|
54637
|
-
|
|
54638
|
-
|
|
54639
|
-
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
background: "transparent",
|
|
54643
|
-
cursor: "pointer"
|
|
54644
|
-
},
|
|
54645
|
-
popoverBase: {
|
|
54646
|
-
position: "absolute",
|
|
54647
|
-
left: 0,
|
|
54648
|
-
borderRadius: "8px",
|
|
54649
|
-
width: "208px",
|
|
54650
|
-
zIndex: 1000
|
|
54651
|
-
},
|
|
54652
|
-
popoverLight: {
|
|
54653
|
-
backgroundColor: "white",
|
|
54654
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
|
|
55043
|
+
backgroundColor: "#ffffff",
|
|
55044
|
+
borderWidth: "1px",
|
|
55045
|
+
borderStyle: "solid",
|
|
55046
|
+
borderColor: "#d1d5db",
|
|
55047
|
+
color: "#111827"
|
|
54655
55048
|
},
|
|
54656
|
-
|
|
55049
|
+
triggerHover: {
|
|
55050
|
+
backgroundColor: "#ecf3f8",
|
|
55051
|
+
borderColor: "#9ca3af"
|
|
55052
|
+
}
|
|
55053
|
+
};
|
|
55054
|
+
darkStyles = {
|
|
55055
|
+
trigger: {
|
|
54657
55056
|
backgroundColor: "#1f2937",
|
|
54658
|
-
|
|
54659
|
-
|
|
54660
|
-
|
|
54661
|
-
|
|
55057
|
+
borderWidth: "1px",
|
|
55058
|
+
borderStyle: "solid",
|
|
55059
|
+
borderColor: "#4b5563",
|
|
55060
|
+
color: "#ecf3f8"
|
|
54662
55061
|
},
|
|
54663
|
-
|
|
54664
|
-
|
|
54665
|
-
|
|
54666
|
-
|
|
54667
|
-
|
|
54668
|
-
|
|
54669
|
-
|
|
55062
|
+
triggerHover: {
|
|
55063
|
+
backgroundColor: "#374151",
|
|
55064
|
+
borderColor: "#6b7280"
|
|
55065
|
+
}
|
|
55066
|
+
};
|
|
55067
|
+
styles = {
|
|
55068
|
+
wrapper: {
|
|
55069
|
+
position: "relative",
|
|
55070
|
+
display: "inline-block"
|
|
54670
55071
|
},
|
|
54671
|
-
|
|
55072
|
+
trigger: {
|
|
54672
55073
|
display: "flex",
|
|
54673
55074
|
alignItems: "center",
|
|
54674
55075
|
justifyContent: "center",
|
|
54675
|
-
|
|
54676
|
-
|
|
55076
|
+
gap: "8px",
|
|
55077
|
+
padding: "8px 32px",
|
|
54677
55078
|
borderRadius: "8px",
|
|
54678
|
-
backgroundColor: "transparent",
|
|
54679
|
-
fontSize: "14px",
|
|
54680
55079
|
cursor: "pointer",
|
|
54681
|
-
|
|
54682
|
-
|
|
54683
|
-
|
|
54684
|
-
|
|
54685
|
-
|
|
54686
|
-
},
|
|
54687
|
-
connectButtonDark: {
|
|
54688
|
-
border: "1px solid #4b5563",
|
|
54689
|
-
color: "#f9fafb"
|
|
54690
|
-
},
|
|
54691
|
-
wrapper: {
|
|
54692
|
-
position: "relative",
|
|
54693
|
-
display: "inline-block"
|
|
54694
|
-
},
|
|
54695
|
-
triggerImageLight: {
|
|
54696
|
-
display: "block"
|
|
54697
|
-
},
|
|
54698
|
-
triggerImageDark: {
|
|
54699
|
-
display: "block",
|
|
54700
|
-
filter: "invert(1)"
|
|
55080
|
+
fontSize: "14px",
|
|
55081
|
+
fontWeight: 500,
|
|
55082
|
+
fontFamily: "inherit",
|
|
55083
|
+
lineHeight: "20px",
|
|
55084
|
+
transition: "background-color 150ms, border-color 150ms"
|
|
54701
55085
|
}
|
|
54702
55086
|
};
|
|
54703
55087
|
styles2 = {
|
|
@@ -54708,56 +55092,89 @@ spurious results.`);
|
|
|
54708
55092
|
trigger: {
|
|
54709
55093
|
display: "flex",
|
|
54710
55094
|
alignItems: "center",
|
|
54711
|
-
|
|
54712
|
-
padding:
|
|
54713
|
-
|
|
54714
|
-
|
|
55095
|
+
gap: "8px",
|
|
55096
|
+
padding: "6px 12px",
|
|
55097
|
+
borderWidth: "1px",
|
|
55098
|
+
borderStyle: "solid",
|
|
55099
|
+
borderColor: "#e5e7eb",
|
|
55100
|
+
backgroundColor: "#ffffff",
|
|
54715
55101
|
cursor: "pointer",
|
|
54716
|
-
borderRadius: "
|
|
54717
|
-
|
|
55102
|
+
borderRadius: "8px",
|
|
55103
|
+
fontSize: "12px",
|
|
55104
|
+
fontWeight: 500,
|
|
55105
|
+
fontFamily: "inherit",
|
|
55106
|
+
color: "#111827",
|
|
55107
|
+
transition: "background-color 150ms, border-color 150ms"
|
|
55108
|
+
},
|
|
55109
|
+
triggerHover: {
|
|
55110
|
+
backgroundColor: "#f9fafb",
|
|
55111
|
+
borderColor: "#9ca3af"
|
|
54718
55112
|
},
|
|
54719
55113
|
avatar: {
|
|
54720
|
-
width: "
|
|
54721
|
-
height: "
|
|
55114
|
+
width: "28px",
|
|
55115
|
+
height: "28px",
|
|
54722
55116
|
borderRadius: "50%",
|
|
54723
|
-
objectFit: "cover"
|
|
55117
|
+
objectFit: "cover",
|
|
55118
|
+
flexShrink: 0
|
|
54724
55119
|
},
|
|
54725
55120
|
avatarPlaceholder: {
|
|
54726
|
-
width: "
|
|
54727
|
-
height: "
|
|
55121
|
+
width: "28px",
|
|
55122
|
+
height: "28px",
|
|
54728
55123
|
borderRadius: "50%",
|
|
54729
|
-
|
|
55124
|
+
background: "linear-gradient(135deg, #8b5cf6, #3b82f6)",
|
|
54730
55125
|
display: "flex",
|
|
54731
55126
|
alignItems: "center",
|
|
54732
|
-
justifyContent: "center"
|
|
55127
|
+
justifyContent: "center",
|
|
55128
|
+
flexShrink: 0
|
|
55129
|
+
},
|
|
55130
|
+
avatarInitial: {
|
|
55131
|
+
fontSize: "12px",
|
|
55132
|
+
fontWeight: 700,
|
|
55133
|
+
color: "#ffffff",
|
|
55134
|
+
lineHeight: 1
|
|
55135
|
+
},
|
|
55136
|
+
displayName: {
|
|
55137
|
+
maxWidth: "120px",
|
|
55138
|
+
overflow: "hidden",
|
|
55139
|
+
textOverflow: "ellipsis",
|
|
55140
|
+
whiteSpace: "nowrap"
|
|
55141
|
+
},
|
|
55142
|
+
chevron: {
|
|
55143
|
+
flexShrink: 0,
|
|
55144
|
+
transition: "transform 150ms",
|
|
55145
|
+
color: "#6b7280"
|
|
55146
|
+
},
|
|
55147
|
+
chevronOpen: {
|
|
55148
|
+
transform: "rotate(180deg)"
|
|
54733
55149
|
},
|
|
54734
55150
|
popoverBase: {
|
|
54735
55151
|
position: "absolute",
|
|
54736
|
-
|
|
54737
|
-
backgroundColor: "
|
|
55152
|
+
right: 0,
|
|
55153
|
+
backgroundColor: "#ffffff",
|
|
54738
55154
|
borderRadius: "8px",
|
|
54739
|
-
boxShadow: "0 4px
|
|
54740
|
-
width: "
|
|
55155
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",
|
|
55156
|
+
width: "100%",
|
|
54741
55157
|
zIndex: 1000,
|
|
54742
|
-
color: "#111827"
|
|
55158
|
+
color: "#111827",
|
|
55159
|
+
borderWidth: "1px",
|
|
55160
|
+
borderStyle: "solid",
|
|
55161
|
+
borderColor: "#e5e7eb",
|
|
55162
|
+
overflow: "hidden"
|
|
54743
55163
|
},
|
|
54744
|
-
|
|
54745
|
-
padding: "
|
|
55164
|
+
header: {
|
|
55165
|
+
padding: "12px 16px",
|
|
54746
55166
|
borderBottom: "1px solid #e5e7eb"
|
|
54747
55167
|
},
|
|
54748
|
-
|
|
54749
|
-
padding: "8px 12px",
|
|
54750
|
-
borderBottom: "none"
|
|
54751
|
-
},
|
|
54752
|
-
username: {
|
|
55168
|
+
headerUsername: {
|
|
54753
55169
|
fontSize: "14px",
|
|
54754
|
-
fontWeight:
|
|
54755
|
-
color: "#111827"
|
|
55170
|
+
fontWeight: 600,
|
|
55171
|
+
color: "#111827",
|
|
55172
|
+
margin: 0
|
|
54756
55173
|
},
|
|
54757
55174
|
addressRow: {
|
|
54758
55175
|
display: "flex",
|
|
54759
55176
|
alignItems: "center",
|
|
54760
|
-
gap: "
|
|
55177
|
+
gap: "4px",
|
|
54761
55178
|
marginTop: "4px"
|
|
54762
55179
|
},
|
|
54763
55180
|
addressButton: {
|
|
@@ -54766,19 +55183,21 @@ spurious results.`);
|
|
|
54766
55183
|
gap: "4px",
|
|
54767
55184
|
padding: 0,
|
|
54768
55185
|
border: "none",
|
|
54769
|
-
|
|
55186
|
+
backgroundColor: "transparent",
|
|
54770
55187
|
cursor: "pointer",
|
|
54771
55188
|
fontSize: "12px",
|
|
54772
|
-
color: "#
|
|
55189
|
+
color: "#6b7280",
|
|
55190
|
+
fontFamily: "inherit",
|
|
54773
55191
|
position: "relative",
|
|
54774
55192
|
width: "100%"
|
|
54775
55193
|
},
|
|
54776
55194
|
copiedText: {
|
|
54777
55195
|
fontSize: "12px",
|
|
54778
|
-
color: "#
|
|
55196
|
+
color: "#059669",
|
|
54779
55197
|
position: "absolute",
|
|
54780
55198
|
left: 0,
|
|
54781
|
-
transition: "opacity 150ms"
|
|
55199
|
+
transition: "opacity 150ms",
|
|
55200
|
+
fontWeight: 500
|
|
54782
55201
|
},
|
|
54783
55202
|
addressText: {
|
|
54784
55203
|
display: "flex",
|
|
@@ -54786,21 +55205,35 @@ spurious results.`);
|
|
|
54786
55205
|
gap: "4px",
|
|
54787
55206
|
transition: "opacity 150ms"
|
|
54788
55207
|
},
|
|
55208
|
+
menuSection: {
|
|
55209
|
+
padding: "4px 0"
|
|
55210
|
+
},
|
|
54789
55211
|
menuItem: {
|
|
54790
55212
|
display: "flex",
|
|
54791
55213
|
alignItems: "center",
|
|
54792
55214
|
gap: "8px",
|
|
54793
55215
|
width: "100%",
|
|
54794
|
-
padding:
|
|
55216
|
+
padding: "8px 16px",
|
|
54795
55217
|
border: "none",
|
|
54796
|
-
|
|
55218
|
+
backgroundColor: "transparent",
|
|
54797
55219
|
cursor: "pointer",
|
|
54798
55220
|
fontSize: "14px",
|
|
54799
|
-
color: "#
|
|
54800
|
-
textDecoration: "none"
|
|
55221
|
+
color: "#374151",
|
|
55222
|
+
textDecoration: "none",
|
|
55223
|
+
fontFamily: "inherit",
|
|
55224
|
+
transition: "background-color 150ms"
|
|
55225
|
+
},
|
|
55226
|
+
menuItemHover: {
|
|
55227
|
+
backgroundColor: "#f3f4f6"
|
|
54801
55228
|
},
|
|
54802
55229
|
disconnectItem: {
|
|
54803
|
-
color: "#
|
|
55230
|
+
color: "#dc2626"
|
|
55231
|
+
},
|
|
55232
|
+
separator: {
|
|
55233
|
+
height: "1px",
|
|
55234
|
+
backgroundColor: "#e5e7eb",
|
|
55235
|
+
margin: 0,
|
|
55236
|
+
border: "none"
|
|
54804
55237
|
}
|
|
54805
55238
|
};
|
|
54806
55239
|
});
|
|
@@ -65726,7 +66159,7 @@ var init_common2 = __esm(() => {
|
|
|
65726
66159
|
});
|
|
65727
66160
|
|
|
65728
66161
|
// ../../packages/renown/dist/src/common.js
|
|
65729
|
-
class
|
|
66162
|
+
class Renown3 {
|
|
65730
66163
|
#baseUrl;
|
|
65731
66164
|
#store;
|
|
65732
66165
|
#eventEmitter;
|
|
@@ -65976,7 +66409,7 @@ class BaseRenownBuilder2 {
|
|
|
65976
66409
|
const storage = this.#storage ?? new RenownMemoryStorage2;
|
|
65977
66410
|
const eventEmitter = this.#eventEmitter ?? new MemoryEventEmitter2;
|
|
65978
66411
|
const baseUrl = this.#baseUrl ?? DEFAULT_RENOWN_URL2;
|
|
65979
|
-
const renown = new
|
|
66412
|
+
const renown = new Renown3(storage, eventEmitter, crypto4, this.#appName, baseUrl, this.#profileFetcher ?? fetchRenownProfile2);
|
|
65980
66413
|
if (renown.user) {
|
|
65981
66414
|
try {
|
|
65982
66415
|
await renown.login(renown.user.did);
|
|
@@ -79602,7 +80035,7 @@ var init_dist2 = __esm(() => {
|
|
|
79602
80035
|
|
|
79603
80036
|
// src/utils/reactor.ts
|
|
79604
80037
|
import { PGlite as PGlite2 } from "@electric-sql/pglite";
|
|
79605
|
-
async function createBrowserReactor(documentModelModules, upgradeManifests, renown) {
|
|
80038
|
+
async function createBrowserReactor(documentModelModules, upgradeManifests, renown, documentModelLoader) {
|
|
79606
80039
|
const signerConfig = {
|
|
79607
80040
|
signer: renown.signer,
|
|
79608
80041
|
verifier: createSignatureVerifier()
|
|
@@ -79620,6 +80053,9 @@ async function createBrowserReactor(documentModelModules, upgradeManifests, reno
|
|
|
79620
80053
|
const builder = new ReactorClientBuilder().withLogger(logger7).withSigner(signerConfig).withReactorBuilder(new ReactorBuilder().withDocumentModels(documentModelModules).withUpgradeManifests(upgradeManifests).withChannelScheme(ChannelScheme.CONNECT).withJwtHandler(jwtHandler).withKysely(new Kysely3({
|
|
79621
80054
|
dialect: new PGliteDialect3(pg)
|
|
79622
80055
|
})));
|
|
80056
|
+
if (documentModelLoader) {
|
|
80057
|
+
builder.withDocumentModelLoader(documentModelLoader);
|
|
80058
|
+
}
|
|
79623
80059
|
const module = await builder.buildModule();
|
|
79624
80060
|
return {
|
|
79625
80061
|
...module,
|
|
@@ -79649,6 +80085,41 @@ var init_reactor = __esm(() => {
|
|
|
79649
80085
|
init_dist2();
|
|
79650
80086
|
});
|
|
79651
80087
|
|
|
80088
|
+
// src/utils/registry-url.ts
|
|
80089
|
+
function loadPersistedState() {
|
|
80090
|
+
try {
|
|
80091
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
80092
|
+
if (raw)
|
|
80093
|
+
return JSON.parse(raw);
|
|
80094
|
+
} catch {}
|
|
80095
|
+
return null;
|
|
80096
|
+
}
|
|
80097
|
+
function getConfiguredRegistryUrls() {
|
|
80098
|
+
const registry = connectConfig.packagesRegistry;
|
|
80099
|
+
if (!registry)
|
|
80100
|
+
return [];
|
|
80101
|
+
return registry.split(",").map((u) => u.trim()).filter(Boolean);
|
|
80102
|
+
}
|
|
80103
|
+
function getDefaultRegistryCdnUrl() {
|
|
80104
|
+
const persisted = loadPersistedState();
|
|
80105
|
+
const urls = getConfiguredRegistryUrls();
|
|
80106
|
+
if (persisted) {
|
|
80107
|
+
if (persisted.selectedRegistryId === "custom") {
|
|
80108
|
+
if (persisted.customRegistryUrl)
|
|
80109
|
+
return persisted.customRegistryUrl;
|
|
80110
|
+
} else {
|
|
80111
|
+
const index = parseInt(persisted.selectedRegistryId.replace("registry-", ""), 10);
|
|
80112
|
+
if (!isNaN(index) && urls[index])
|
|
80113
|
+
return urls[index];
|
|
80114
|
+
}
|
|
80115
|
+
}
|
|
80116
|
+
return urls[0];
|
|
80117
|
+
}
|
|
80118
|
+
var STORAGE_KEY = "ph-connect-registry-selection";
|
|
80119
|
+
var init_registry_url = __esm(() => {
|
|
80120
|
+
init_connect_config();
|
|
80121
|
+
});
|
|
80122
|
+
|
|
79652
80123
|
// src/utils/registerServiceWorker.ts
|
|
79653
80124
|
class ServiceWorkerManager {
|
|
79654
80125
|
ready = false;
|
|
@@ -79751,6 +80222,7 @@ var init_utils6 = __esm(() => {
|
|
|
79751
80222
|
init_openUrl();
|
|
79752
80223
|
init_package_json();
|
|
79753
80224
|
init_reactor();
|
|
80225
|
+
init_registry_url();
|
|
79754
80226
|
init_registerServiceWorker();
|
|
79755
80227
|
});
|
|
79756
80228
|
|
|
@@ -108584,7 +109056,7 @@ function createV6CompatibleWrapCreateMemoryRouter(createRouterFunction, version5
|
|
|
108584
109056
|
function createReactRouterV6CompatibleTracingIntegration(options, version5) {
|
|
108585
109057
|
const integration = browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });
|
|
108586
109058
|
const {
|
|
108587
|
-
useEffect:
|
|
109059
|
+
useEffect: useEffect9,
|
|
108588
109060
|
useLocation,
|
|
108589
109061
|
useNavigationType,
|
|
108590
109062
|
createRoutesFromChildren,
|
|
@@ -108615,7 +109087,7 @@ function createReactRouterV6CompatibleTracingIntegration(options, version5) {
|
|
|
108615
109087
|
} else {
|
|
108616
109088
|
_lazyRouteTimeout = configuredMaxWait;
|
|
108617
109089
|
}
|
|
108618
|
-
_useEffect =
|
|
109090
|
+
_useEffect = useEffect9;
|
|
108619
109091
|
_useLocation = useLocation;
|
|
108620
109092
|
_useNavigationType = useNavigationType;
|
|
108621
109093
|
_matchRoutes2 = matchRoutes2;
|
|
@@ -136258,7 +136730,7 @@ ${typeDefsDoc}`;
|
|
|
136258
136730
|
|
|
136259
136731
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/context/schema-context.js
|
|
136260
136732
|
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
136261
|
-
import { createContext, useContext, useEffect as
|
|
136733
|
+
import { createContext, useContext, useEffect as useEffect10, useState as useState11 } from "react";
|
|
136262
136734
|
function makeSharedSchemaSdl(existingSchemaSdl, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl) {
|
|
136263
136735
|
const existingSchema = buildSchema(existingSchemaSdl);
|
|
136264
136736
|
const sdls = [
|
|
@@ -136332,7 +136804,7 @@ function parseSharedSchemaSdl(initialSchema2, globalStateSchemaSdl, localStateSc
|
|
|
136332
136804
|
function SchemaContextProvider(props) {
|
|
136333
136805
|
const { children, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl } = props;
|
|
136334
136806
|
const [sharedSchemaSdl, setSharedSchemaSdl] = useState11(() => parseSharedSchemaSdl(printSchema(initialSchema), globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl));
|
|
136335
|
-
|
|
136807
|
+
useEffect10(() => {
|
|
136336
136808
|
setSharedSchemaSdl((prev) => parseSharedSchemaSdl(prev.sharedSchema, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl));
|
|
136337
136809
|
}, [globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl]);
|
|
136338
136810
|
return _jsx2(SchemaContext.Provider, { value: sharedSchemaSdl, children });
|
|
@@ -145545,7 +146017,7 @@ var init_dist4 = () => {};
|
|
|
145545
146017
|
|
|
145546
146018
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
145547
146019
|
import * as React7 from "react";
|
|
145548
|
-
import { Fragment as
|
|
146020
|
+
import { Fragment as Fragment22, jsx } from "react/jsx-runtime";
|
|
145549
146021
|
function isPromiseLike(value) {
|
|
145550
146022
|
return typeof value === "object" && value !== null && "then" in value;
|
|
145551
146023
|
}
|
|
@@ -145587,7 +146059,7 @@ function createSlotClone(ownerName) {
|
|
|
145587
146059
|
}
|
|
145588
146060
|
if (React7.isValidElement(children)) {
|
|
145589
146061
|
const childrenRef = getElementRef(children);
|
|
145590
|
-
const props2 =
|
|
146062
|
+
const props2 = mergeProps2(slotProps, children.props);
|
|
145591
146063
|
if (children.type !== React7.Fragment) {
|
|
145592
146064
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
145593
146065
|
}
|
|
@@ -145601,7 +146073,7 @@ function createSlotClone(ownerName) {
|
|
|
145601
146073
|
function isSlottable(child) {
|
|
145602
146074
|
return React7.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
145603
146075
|
}
|
|
145604
|
-
function
|
|
146076
|
+
function mergeProps2(slotProps, childProps) {
|
|
145605
146077
|
const overrideProps = { ...childProps };
|
|
145606
146078
|
for (const propName in childProps) {
|
|
145607
146079
|
const slotPropValue = slotProps[propName];
|
|
@@ -145638,12 +146110,12 @@ function getElementRef(element) {
|
|
|
145638
146110
|
}
|
|
145639
146111
|
return element.props.ref || element.ref;
|
|
145640
146112
|
}
|
|
145641
|
-
var REACT_LAZY_TYPE, use2,
|
|
146113
|
+
var REACT_LAZY_TYPE, use2, Slot2, SLOTTABLE_IDENTIFIER;
|
|
145642
146114
|
var init_dist5 = __esm(() => {
|
|
145643
146115
|
init_dist4();
|
|
145644
146116
|
REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
145645
146117
|
use2 = React7[" use ".trim().toString()];
|
|
145646
|
-
|
|
146118
|
+
Slot2 = /* @__PURE__ */ createSlot("Slot");
|
|
145647
146119
|
SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
145648
146120
|
});
|
|
145649
146121
|
|
|
@@ -145738,10 +146210,10 @@ var init_dist6 = __esm(() => {
|
|
|
145738
146210
|
"ul"
|
|
145739
146211
|
];
|
|
145740
146212
|
Primitive = NODES.reduce((primitive, node) => {
|
|
145741
|
-
const
|
|
146213
|
+
const Slot3 = createSlot(`Primitive.${node}`);
|
|
145742
146214
|
const Node2 = React10.forwardRef((props, forwardedRef) => {
|
|
145743
146215
|
const { asChild, ...primitiveProps } = props;
|
|
145744
|
-
const Comp = asChild ?
|
|
146216
|
+
const Comp = asChild ? Slot3 : node;
|
|
145745
146217
|
if (typeof window !== "undefined") {
|
|
145746
146218
|
window[Symbol.for("radix-ui")] = true;
|
|
145747
146219
|
}
|
|
@@ -145885,7 +146357,7 @@ var init_form = __esm(() => {
|
|
|
145885
146357
|
FormLabel.displayName = "FormLabel";
|
|
145886
146358
|
FormControl = React13.forwardRef(({ ...props }, ref) => {
|
|
145887
146359
|
const { error: error50, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
145888
|
-
return _jsx4(
|
|
146360
|
+
return _jsx4(Slot2, { ref, id: formItemId, "aria-describedby": !error50 ? formDescriptionId : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error50, ...props });
|
|
145889
146361
|
});
|
|
145890
146362
|
FormControl.displayName = "FormControl";
|
|
145891
146363
|
FormDescription = React13.forwardRef(({ className, ...props }, ref) => {
|
|
@@ -145907,18 +146379,18 @@ var init_form = __esm(() => {
|
|
|
145907
146379
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/text-area.js
|
|
145908
146380
|
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
145909
146381
|
import * as React14 from "react";
|
|
145910
|
-
import { forwardRef as
|
|
146382
|
+
import { forwardRef as forwardRef7, useImperativeHandle, useRef as useRef9, useCallback as useCallback8 } from "react";
|
|
145911
146383
|
var Textarea;
|
|
145912
146384
|
var init_text_area = __esm(() => {
|
|
145913
146385
|
init_style();
|
|
145914
|
-
Textarea =
|
|
145915
|
-
const textareaRef =
|
|
145916
|
-
const adjustHeight =
|
|
146386
|
+
Textarea = forwardRef7(({ className, ...props }, ref) => {
|
|
146387
|
+
const textareaRef = useRef9(null);
|
|
146388
|
+
const adjustHeight = useCallback8((textarea) => {
|
|
145917
146389
|
textarea.style.height = "auto";
|
|
145918
146390
|
const newHeight = Math.max(textarea.scrollHeight, textarea.offsetHeight);
|
|
145919
146391
|
textarea.style.height = `${newHeight}px`;
|
|
145920
146392
|
}, []);
|
|
145921
|
-
const handleInput =
|
|
146393
|
+
const handleInput = useCallback8((e3) => {
|
|
145922
146394
|
adjustHeight(e3.currentTarget);
|
|
145923
146395
|
}, [adjustHeight]);
|
|
145924
146396
|
React14.useEffect(() => {
|
|
@@ -145937,7 +146409,7 @@ var init_text_area = __esm(() => {
|
|
|
145937
146409
|
|
|
145938
146410
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/text-field.js
|
|
145939
146411
|
import { jsx as _jsx6, jsxs as _jsxs } from "react/jsx-runtime";
|
|
145940
|
-
import { forwardRef as
|
|
146412
|
+
import { forwardRef as forwardRef8, useCallback as useCallback10, useEffect as useEffect12, useId as useId2, useImperativeHandle as useImperativeHandle2, useRef as useRef10 } from "react";
|
|
145941
146413
|
var TextField;
|
|
145942
146414
|
var init_text_field = __esm(() => {
|
|
145943
146415
|
init_zod2();
|
|
@@ -145947,10 +146419,10 @@ var init_text_field = __esm(() => {
|
|
|
145947
146419
|
init_helpers3();
|
|
145948
146420
|
init_form();
|
|
145949
146421
|
init_text_area();
|
|
145950
|
-
TextField =
|
|
145951
|
-
const textareaRef =
|
|
146422
|
+
TextField = forwardRef8(({ name: name6, value, onSubmit, label, placeholder, unique, className = "", rows = 1, focusOnMount = false, required: required2 = false, allowEmpty = false, shouldReset = false, onChange }, ref) => {
|
|
146423
|
+
const textareaRef = useRef10(null);
|
|
145952
146424
|
const id = useId2();
|
|
145953
|
-
|
|
146425
|
+
useEffect12(() => {
|
|
145954
146426
|
if (focusOnMount && textareaRef.current) {
|
|
145955
146427
|
textareaRef.current.focus();
|
|
145956
146428
|
}
|
|
@@ -145964,7 +146436,7 @@ var init_text_field = __esm(() => {
|
|
|
145964
146436
|
[name6]: value ?? ""
|
|
145965
146437
|
}
|
|
145966
146438
|
});
|
|
145967
|
-
const handleSubmit =
|
|
146439
|
+
const handleSubmit = useCallback10((values) => {
|
|
145968
146440
|
const newValue = values[name6];
|
|
145969
146441
|
if (newValue === undefined || value === newValue)
|
|
145970
146442
|
return;
|
|
@@ -145972,7 +146444,7 @@ var init_text_field = __esm(() => {
|
|
|
145972
146444
|
if (shouldReset)
|
|
145973
146445
|
form.reset({ [name6]: "" });
|
|
145974
146446
|
}, [name6, value, onSubmit, form, shouldReset]);
|
|
145975
|
-
const handleBlur =
|
|
146447
|
+
const handleBlur = useCallback10(async () => {
|
|
145976
146448
|
const currentValue = form.getValues()[name6] ?? "";
|
|
145977
146449
|
if (value === null || value === undefined) {
|
|
145978
146450
|
if (!currentValue || currentValue.trim() === "")
|
|
@@ -145987,20 +146459,20 @@ var init_text_field = __esm(() => {
|
|
|
145987
146459
|
}
|
|
145988
146460
|
} catch (e3) {}
|
|
145989
146461
|
}, [form, handleSubmit, name6, value]);
|
|
145990
|
-
const onEnterKeyDown =
|
|
146462
|
+
const onEnterKeyDown = useCallback10((e3) => {
|
|
145991
146463
|
if (e3.key === "Enter") {
|
|
145992
146464
|
e3.preventDefault();
|
|
145993
146465
|
e3.target.blur();
|
|
145994
146466
|
}
|
|
145995
146467
|
}, []);
|
|
145996
|
-
const handleChange =
|
|
146468
|
+
const handleChange = useCallback10((e3) => {
|
|
145997
146469
|
const newValue = e3.target.value;
|
|
145998
146470
|
onChange?.(newValue);
|
|
145999
146471
|
}, [onChange]);
|
|
146000
146472
|
useImperativeHandle2(ref, () => ({
|
|
146001
146473
|
focus: () => textareaRef.current?.focus()
|
|
146002
146474
|
}));
|
|
146003
|
-
|
|
146475
|
+
useEffect12(() => {
|
|
146004
146476
|
form.reset({ [name6]: value ?? "" });
|
|
146005
146477
|
}, [form, name6, value]);
|
|
146006
146478
|
return _jsx6(Form2, { ...form, children: _jsx6(FormField, { control: form.control, name: name6, render: ({ field }) => _jsxs(FormItem, { className: "grid h-full grid-rows-[auto,1fr] gap-2 overflow-visible", children: [!!label && _jsx6(FormLabel, { htmlFor: name6, className: "text-sm font-medium text-gray-700", children: label }), _jsx6(FormControl, { children: _jsx6(Textarea, { ...field, id, name: name6, ref: (node) => {
|
|
@@ -146018,13 +146490,13 @@ var init_text_field = __esm(() => {
|
|
|
146018
146490
|
|
|
146019
146491
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/model-metadata-form.js
|
|
146020
146492
|
import { jsx as _jsx7, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
146021
|
-
import { useCallback as
|
|
146493
|
+
import { useCallback as useCallback11 } from "react";
|
|
146022
146494
|
function ModelMetadata(props) {
|
|
146023
146495
|
return _jsxs2("div", { children: [_jsx7(ModelNameForm, { ...props }), _jsx7("div", { className: "flex h-full flex-col gap-4", children: _jsxs2("div", { className: "grid flex-1 grid-cols-3 items-start gap-4", children: [_jsxs2("div", { className: "col-span-2 flex h-full flex-col gap-4", children: [_jsx7("div", { className: "shrink-0", children: _jsx7(DocumentTypeForm, { ...props }) }), _jsx7("div", { className: "min-h-0 flex-1", children: _jsx7(DescriptionForm, { ...props }) })] }), _jsxs2("div", { className: "col-span-1 flex flex-col gap-4", children: [_jsx7(AuthorNameForm, { ...props }), _jsx7(AuthorWebsiteForm, { ...props }), _jsx7(ModelExtensionForm, { ...props })] })] }) })] });
|
|
146024
146496
|
}
|
|
146025
146497
|
function ModelNameForm(props) {
|
|
146026
146498
|
const { name: name6, globalStateSchema, localStateSchema, setModelName, setStateSchema } = props;
|
|
146027
|
-
const onSubmit =
|
|
146499
|
+
const onSubmit = useCallback11((newName) => {
|
|
146028
146500
|
if (name6 === newName) {
|
|
146029
146501
|
return;
|
|
146030
146502
|
}
|
|
@@ -146116,10 +146588,10 @@ var init_module_form = __esm(() => {
|
|
|
146116
146588
|
|
|
146117
146589
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-form.js
|
|
146118
146590
|
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
146119
|
-
import { useCallback as
|
|
146591
|
+
import { useCallback as useCallback12 } from "react";
|
|
146120
146592
|
function OperationForm({ operation, module, focusOnMount, allOperationNames, onAddOperationAndInitialSchema, updateOperationName, deleteOperation }) {
|
|
146121
146593
|
const isEdit = !!operation;
|
|
146122
|
-
const handleSubmit =
|
|
146594
|
+
const handleSubmit = useCallback12(async (name6) => {
|
|
146123
146595
|
if (isEdit && name6 === "") {
|
|
146124
146596
|
deleteOperation(operation.id);
|
|
146125
146597
|
return;
|
|
@@ -146141,7 +146613,7 @@ function OperationForm({ operation, module, focusOnMount, allOperationNames, onA
|
|
|
146141
146613
|
updateOperationName,
|
|
146142
146614
|
onAddOperationAndInitialSchema
|
|
146143
146615
|
]);
|
|
146144
|
-
const handleChange =
|
|
146616
|
+
const handleChange = useCallback12((value) => {
|
|
146145
146617
|
if (isEdit && value === "") {
|
|
146146
146618
|
deleteOperation(operation.id);
|
|
146147
146619
|
}
|
|
@@ -146207,10 +146679,10 @@ var init_linting = __esm(() => {
|
|
|
146207
146679
|
|
|
146208
146680
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-description-form.js
|
|
146209
146681
|
import { jsx as _jsx10 } from "react/jsx-runtime";
|
|
146210
|
-
import { useEffect as
|
|
146682
|
+
import { useEffect as useEffect13, useRef as useRef11 } from "react";
|
|
146211
146683
|
function OperationDescriptionForm({ operation, focusOnMount, setOperationDescription }) {
|
|
146212
|
-
const textFieldRef =
|
|
146213
|
-
|
|
146684
|
+
const textFieldRef = useRef11(null);
|
|
146685
|
+
useEffect13(() => {
|
|
146214
146686
|
if (focusOnMount && textFieldRef.current) {
|
|
146215
146687
|
textFieldRef.current.focus();
|
|
146216
146688
|
}
|
|
@@ -146223,12 +146695,12 @@ var init_operation_description_form = __esm(() => {
|
|
|
146223
146695
|
|
|
146224
146696
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-error-form.js
|
|
146225
146697
|
import { jsx as _jsx11 } from "react/jsx-runtime";
|
|
146226
|
-
import { useCallback as
|
|
146698
|
+
import { useCallback as useCallback13, useRef as useRef12 } from "react";
|
|
146227
146699
|
function OperationErrorForm({ operation, error: error50, focusOnMount, onSubmit, onAddOperationError, deleteOperationError, setOperationErrorName }) {
|
|
146228
|
-
const textFieldRef =
|
|
146700
|
+
const textFieldRef = useRef12(null);
|
|
146229
146701
|
const isEdit = !!error50;
|
|
146230
146702
|
const allOperationErrorNames = operation.errors.map((o3) => o3.name).filter((n5) => n5 !== null);
|
|
146231
|
-
const handleSubmit =
|
|
146703
|
+
const handleSubmit = useCallback13((name6) => {
|
|
146232
146704
|
if (isEdit && name6 === "") {
|
|
146233
146705
|
deleteOperationError(error50.id);
|
|
146234
146706
|
return;
|
|
@@ -146249,7 +146721,7 @@ function OperationErrorForm({ operation, error: error50, focusOnMount, onSubmit,
|
|
|
146249
146721
|
onAddOperationError,
|
|
146250
146722
|
onSubmit
|
|
146251
146723
|
]);
|
|
146252
|
-
const handleChange =
|
|
146724
|
+
const handleChange = useCallback13((value) => {
|
|
146253
146725
|
if (isEdit && value === "") {
|
|
146254
146726
|
deleteOperationError(error50.id);
|
|
146255
146727
|
}
|
|
@@ -146263,18 +146735,18 @@ var init_operation_error_form = __esm(() => {
|
|
|
146263
146735
|
|
|
146264
146736
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation-errors.js
|
|
146265
146737
|
import { jsx as _jsx12, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
146266
|
-
import { useCallback as
|
|
146738
|
+
import { useCallback as useCallback14, useId as useId3, useState as useState12 } from "react";
|
|
146267
146739
|
function OperationErrors({ operation, addOperationError, deleteOperationError, setOperationErrorName }) {
|
|
146268
146740
|
const addErrorFormId = useId3();
|
|
146269
146741
|
const [shouldFocusAddForm, setShouldFocusAddForm] = useState12(false);
|
|
146270
|
-
const onAddOperationError =
|
|
146742
|
+
const onAddOperationError = useCallback14(async (operationId, error50) => {
|
|
146271
146743
|
const errorId = await addOperationError(operationId, error50);
|
|
146272
146744
|
if (errorId) {
|
|
146273
146745
|
setShouldFocusAddForm(true);
|
|
146274
146746
|
}
|
|
146275
146747
|
return errorId;
|
|
146276
146748
|
}, [addOperationError, setShouldFocusAddForm]);
|
|
146277
|
-
const onAddOperationErrorSubmit =
|
|
146749
|
+
const onAddOperationErrorSubmit = useCallback14(() => setShouldFocusAddForm(false), [setShouldFocusAddForm]);
|
|
146278
146750
|
return _jsxs3("ul", { className: "ml-4 list-disc", children: [operation.errors.map((error50) => _jsx12("li", { children: _jsx12(OperationErrorForm, { error: error50, operation, onAddOperationError, deleteOperationError, setOperationErrorName }) }, error50.id)), _jsx12("li", { children: _jsx12(OperationErrorForm, { operation, onAddOperationError, deleteOperationError, setOperationErrorName, focusOnMount: shouldFocusAddForm, onSubmit: onAddOperationErrorSubmit }, `${addErrorFormId}-${shouldFocusAddForm}`) })] });
|
|
146279
146751
|
}
|
|
146280
146752
|
var init_operation_errors = __esm(() => {
|
|
@@ -171905,14 +172377,14 @@ var init_factories = __esm(() => {
|
|
|
171905
172377
|
});
|
|
171906
172378
|
|
|
171907
172379
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/code-editors/hooks.js
|
|
171908
|
-
import { useEffect as
|
|
172380
|
+
import { useEffect as useEffect14, useRef as useRef13 } from "react";
|
|
171909
172381
|
function useEditorRefs() {
|
|
171910
|
-
const editorRef =
|
|
171911
|
-
const viewRef =
|
|
171912
|
-
const updateListenerCompartment =
|
|
171913
|
-
const focusHandlerCompartment =
|
|
171914
|
-
const pasteHandlerCompartment =
|
|
171915
|
-
const timeoutRef =
|
|
172382
|
+
const editorRef = useRef13(null);
|
|
172383
|
+
const viewRef = useRef13(null);
|
|
172384
|
+
const updateListenerCompartment = useRef13(new Compartment);
|
|
172385
|
+
const focusHandlerCompartment = useRef13(new Compartment);
|
|
172386
|
+
const pasteHandlerCompartment = useRef13(new Compartment);
|
|
172387
|
+
const timeoutRef = useRef13(null);
|
|
171916
172388
|
return {
|
|
171917
172389
|
editorRef,
|
|
171918
172390
|
viewRef,
|
|
@@ -171923,7 +172395,7 @@ function useEditorRefs() {
|
|
|
171923
172395
|
};
|
|
171924
172396
|
}
|
|
171925
172397
|
function useEditorCleanup(viewRef) {
|
|
171926
|
-
|
|
172398
|
+
useEffect14(() => {
|
|
171927
172399
|
return () => {
|
|
171928
172400
|
if (viewRef.current) {
|
|
171929
172401
|
viewRef.current.destroy();
|
|
@@ -171933,7 +172405,7 @@ function useEditorCleanup(viewRef) {
|
|
|
171933
172405
|
}, []);
|
|
171934
172406
|
}
|
|
171935
172407
|
function useHandlerReconfiguration(view, readonly4, timeoutRef, updateDocumentInModel, compartments) {
|
|
171936
|
-
|
|
172408
|
+
useEffect14(() => {
|
|
171937
172409
|
if (!view)
|
|
171938
172410
|
return;
|
|
171939
172411
|
view.dispatch({
|
|
@@ -171947,7 +172419,7 @@ function useHandlerReconfiguration(view, readonly4, timeoutRef, updateDocumentIn
|
|
|
171947
172419
|
}, [readonly4, updateDocumentInModel]);
|
|
171948
172420
|
}
|
|
171949
172421
|
function useDocumentSync(view, doc3) {
|
|
171950
|
-
|
|
172422
|
+
useEffect14(() => {
|
|
171951
172423
|
if (!view)
|
|
171952
172424
|
return;
|
|
171953
172425
|
const currentDoc = view.state.doc.toString();
|
|
@@ -179263,7 +179735,7 @@ __export(exports_graphql_editor, {
|
|
|
179263
179735
|
default: () => graphql_editor_default
|
|
179264
179736
|
});
|
|
179265
179737
|
import { jsx as _jsx13 } from "react/jsx-runtime";
|
|
179266
|
-
import { memo as memo2, useEffect as
|
|
179738
|
+
import { memo as memo2, useEffect as useEffect15, useRef as useRef14 } from "react";
|
|
179267
179739
|
var GraphqlEditor, graphql_editor_default;
|
|
179268
179740
|
var init_graphql_editor = __esm(() => {
|
|
179269
179741
|
init_dist11();
|
|
@@ -179280,10 +179752,10 @@ var init_graphql_editor = __esm(() => {
|
|
|
179280
179752
|
GraphqlEditor = memo2(function GraphqlEditor2(props) {
|
|
179281
179753
|
const { doc: doc3, readonly: readonly4 = false, updateDocumentInModel, customLinter } = props;
|
|
179282
179754
|
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef } = useEditorRefs();
|
|
179283
|
-
const graphqlCompartment =
|
|
179284
|
-
const linterCompartment =
|
|
179755
|
+
const graphqlCompartment = useRef14(new Compartment);
|
|
179756
|
+
const linterCompartment = useRef14(new Compartment);
|
|
179285
179757
|
const { sharedSchema } = useSchemaContext();
|
|
179286
|
-
|
|
179758
|
+
useEffect15(() => {
|
|
179287
179759
|
if (!viewRef.current) {
|
|
179288
179760
|
const schema18 = buildSchema(sharedSchema);
|
|
179289
179761
|
viewRef.current = new EditorView({
|
|
@@ -179307,7 +179779,7 @@ var init_graphql_editor = __esm(() => {
|
|
|
179307
179779
|
}
|
|
179308
179780
|
}, []);
|
|
179309
179781
|
useEditorCleanup(viewRef);
|
|
179310
|
-
|
|
179782
|
+
useEffect15(() => {
|
|
179311
179783
|
const view = viewRef.current;
|
|
179312
179784
|
if (!view)
|
|
179313
179785
|
return;
|
|
@@ -179337,13 +179809,13 @@ var init_graphql_editor = __esm(() => {
|
|
|
179337
179809
|
|
|
179338
179810
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operation.js
|
|
179339
179811
|
import { jsx as _jsx14, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
179340
|
-
import { lazy as lazy2, Suspense, useCallback as
|
|
179812
|
+
import { lazy as lazy2, Suspense, useCallback as useCallback15 } from "react";
|
|
179341
179813
|
function Operation(props) {
|
|
179342
179814
|
const { operation, module, allOperationNames, lastCreatedOperationId, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired } = props;
|
|
179343
179815
|
const noInputRequired = isEmptyOperationSchema(operation.schema);
|
|
179344
|
-
const handleToggleNoInput =
|
|
179345
|
-
const handleUpdateDocument =
|
|
179346
|
-
const customLinter =
|
|
179816
|
+
const handleToggleNoInput = useCallback15((checked) => toggleNoInputRequired(operation.id, checked), [operation.id, toggleNoInputRequired]);
|
|
179817
|
+
const handleUpdateDocument = useCallback15((newDoc) => updateOperationSchema(operation.id, newDoc), [operation.id, updateOperationSchema]);
|
|
179818
|
+
const customLinter = useCallback15((doc3) => operation.name ? ensureValidOperationSchemaInputName(doc3, operation.name) : [], [operation.name]);
|
|
179347
179819
|
return _jsxs4("div", { className: "mt-4 grid grid-cols-2 gap-x-12", style: {
|
|
179348
179820
|
gridTemplateAreas: `
|
|
179349
179821
|
"left editor"
|
|
@@ -179364,12 +179836,12 @@ var init_operation = __esm(() => {
|
|
|
179364
179836
|
|
|
179365
179837
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/operations.js
|
|
179366
179838
|
import { jsx as _jsx15, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
179367
|
-
import { useCallback as
|
|
179839
|
+
import { useCallback as useCallback16, useId as useId4, useState as useState13 } from "react";
|
|
179368
179840
|
function Operations({ module, allOperations, shouldFocusNewOperation, updateOperationName, deleteOperation, addOperationAndInitialSchema, addOperationError, deleteOperationError, setOperationErrorName, updateOperationSchema, setOperationDescription, toggleNoInputRequired }) {
|
|
179369
179841
|
const [lastCreatedOperationId, setLastCreatedOperationId] = useState13(null);
|
|
179370
179842
|
const addOperationFormId = useId4();
|
|
179371
179843
|
const allOperationNames = allOperations.map((o3) => o3.name).filter((n5) => n5 !== null);
|
|
179372
|
-
const onAddOperationAndInitialSchema =
|
|
179844
|
+
const onAddOperationAndInitialSchema = useCallback16(async (moduleId, name6) => {
|
|
179373
179845
|
const operationId = await addOperationAndInitialSchema(moduleId, name6);
|
|
179374
179846
|
if (operationId) {
|
|
179375
179847
|
setLastCreatedOperationId(operationId);
|
|
@@ -179398,11 +179870,11 @@ var init_module = __esm(() => {
|
|
|
179398
179870
|
|
|
179399
179871
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/modules.js
|
|
179400
179872
|
import { jsx as _jsx17, jsxs as _jsxs7 } from "react/jsx-runtime";
|
|
179401
|
-
import { useCallback as
|
|
179873
|
+
import { useCallback as useCallback17, useRef as useRef15, useState as useState14 } from "react";
|
|
179402
179874
|
function Modules({ modules, allOperations, addModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired }) {
|
|
179403
179875
|
const [lastCreatedModuleId, setLastCreatedModuleId] = useState14(null);
|
|
179404
|
-
const focusTrapRef =
|
|
179405
|
-
const onAddModule =
|
|
179876
|
+
const focusTrapRef = useRef15(null);
|
|
179877
|
+
const onAddModule = useCallback17(async (name6) => {
|
|
179406
179878
|
const moduleId = await addModule(name6);
|
|
179407
179879
|
if (moduleId) {
|
|
179408
179880
|
setLastCreatedModuleId(moduleId);
|
|
@@ -179434,11 +179906,11 @@ var init_useDocumentModelDocument = __esm(() => {
|
|
|
179434
179906
|
|
|
179435
179907
|
// ../../packages/powerhouse-vetra-packages/dist/editors/document-model-editor/components/button.js
|
|
179436
179908
|
import { jsx as _jsx18 } from "react/jsx-runtime";
|
|
179437
|
-
import { forwardRef as
|
|
179909
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
179438
179910
|
var Button;
|
|
179439
179911
|
var init_button = __esm(() => {
|
|
179440
179912
|
init_style();
|
|
179441
|
-
Button =
|
|
179913
|
+
Button = forwardRef9((props, ref) => {
|
|
179442
179914
|
const { className, ...rest } = props;
|
|
179443
179915
|
return _jsx18("button", { ref, ...rest, className: cn2("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className) });
|
|
179444
179916
|
});
|
|
@@ -179545,10 +180017,10 @@ var init_dist22 = () => {};
|
|
|
179545
180017
|
|
|
179546
180018
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
179547
180019
|
import * as React16 from "react";
|
|
179548
|
-
import { Fragment as
|
|
180020
|
+
import { Fragment as Fragment23, jsx as jsx5 } from "react/jsx-runtime";
|
|
179549
180021
|
function createSlot2(ownerName) {
|
|
179550
180022
|
const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName);
|
|
179551
|
-
const
|
|
180023
|
+
const Slot22 = React16.forwardRef((props, forwardedRef) => {
|
|
179552
180024
|
const { children, ...slotProps } = props;
|
|
179553
180025
|
const childrenArray = React16.Children.toArray(children);
|
|
179554
180026
|
const slottable = childrenArray.find(isSlottable2);
|
|
@@ -179567,15 +180039,15 @@ function createSlot2(ownerName) {
|
|
|
179567
180039
|
}
|
|
179568
180040
|
return /* @__PURE__ */ jsx5(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
179569
180041
|
});
|
|
179570
|
-
|
|
179571
|
-
return
|
|
180042
|
+
Slot22.displayName = `${ownerName}.Slot`;
|
|
180043
|
+
return Slot22;
|
|
179572
180044
|
}
|
|
179573
180045
|
function createSlotClone2(ownerName) {
|
|
179574
180046
|
const SlotClone = React16.forwardRef((props, forwardedRef) => {
|
|
179575
180047
|
const { children, ...slotProps } = props;
|
|
179576
180048
|
if (React16.isValidElement(children)) {
|
|
179577
180049
|
const childrenRef = getElementRef2(children);
|
|
179578
|
-
const props2 =
|
|
180050
|
+
const props2 = mergeProps3(slotProps, children.props);
|
|
179579
180051
|
if (children.type !== React16.Fragment) {
|
|
179580
180052
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
179581
180053
|
}
|
|
@@ -179589,7 +180061,7 @@ function createSlotClone2(ownerName) {
|
|
|
179589
180061
|
function isSlottable2(child) {
|
|
179590
180062
|
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2;
|
|
179591
180063
|
}
|
|
179592
|
-
function
|
|
180064
|
+
function mergeProps3(slotProps, childProps) {
|
|
179593
180065
|
const overrideProps = { ...childProps };
|
|
179594
180066
|
for (const propName in childProps) {
|
|
179595
180067
|
const slotPropValue = slotProps[propName];
|
|
@@ -180052,10 +180524,10 @@ var init_dist27 = __esm(() => {
|
|
|
180052
180524
|
"ul"
|
|
180053
180525
|
];
|
|
180054
180526
|
Primitive2 = NODES2.reduce((primitive, node) => {
|
|
180055
|
-
const
|
|
180527
|
+
const Slot3 = createSlot2(`Primitive.${node}`);
|
|
180056
180528
|
const Node2 = React20.forwardRef((props, forwardedRef) => {
|
|
180057
180529
|
const { asChild, ...primitiveProps } = props;
|
|
180058
|
-
const Comp = asChild ?
|
|
180530
|
+
const Comp = asChild ? Slot3 : node;
|
|
180059
180531
|
if (typeof window !== "undefined") {
|
|
180060
180532
|
window[Symbol.for("radix-ui")] = true;
|
|
180061
180533
|
}
|
|
@@ -180760,7 +181232,7 @@ __export(exports_json_editor, {
|
|
|
180760
181232
|
default: () => json_editor_default
|
|
180761
181233
|
});
|
|
180762
181234
|
import { jsx as _jsx21 } from "react/jsx-runtime";
|
|
180763
|
-
import { memo as memo3, useEffect as
|
|
181235
|
+
import { memo as memo3, useEffect as useEffect22 } from "react";
|
|
180764
181236
|
var JSONEditor, json_editor_default;
|
|
180765
181237
|
var init_json_editor = __esm(() => {
|
|
180766
181238
|
init_dist35();
|
|
@@ -180774,7 +181246,7 @@ var init_json_editor = __esm(() => {
|
|
|
180774
181246
|
JSONEditor = memo3(function JSONEditor2(props) {
|
|
180775
181247
|
const { doc: doc3, readonly: readonly4 = false, updateDocumentInModel } = props;
|
|
180776
181248
|
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef } = useEditorRefs();
|
|
180777
|
-
|
|
181249
|
+
useEffect22(() => {
|
|
180778
181250
|
if (!viewRef.current) {
|
|
180779
181251
|
viewRef.current = new EditorView({
|
|
180780
181252
|
state: EditorState.create({
|
|
@@ -180817,12 +181289,12 @@ __export(exports_state_schemas, {
|
|
|
180817
181289
|
import { jsxs as _jsxs9, jsx as _jsx22 } from "react/jsx-runtime";
|
|
180818
181290
|
import { cn as cn3 } from "@powerhousedao/design-system";
|
|
180819
181291
|
import { Checkbox } from "@powerhousedao/design-system/ui/components/checkbox/checkbox.js";
|
|
180820
|
-
import { lazy as lazy3, Suspense as Suspense2, useCallback as
|
|
181292
|
+
import { lazy as lazy3, Suspense as Suspense2, useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo8, useRef as useRef22, useState as useState19 } from "react";
|
|
180821
181293
|
function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, setInitialState, scope }) {
|
|
180822
181294
|
const { sharedSchema: sharedSchemaSdl, error: sharedSchemaError } = useSchemaContext();
|
|
180823
181295
|
const [showStandardLib, setShowStandardLib] = useState19(false);
|
|
180824
181296
|
const [syncWithSchema, setSyncWithSchema] = useState19(true);
|
|
180825
|
-
const customLinter =
|
|
181297
|
+
const customLinter = useCallback21((doc3) => ensureValidStateSchemaName(doc3, modelName, scope), [modelName, scope]);
|
|
180826
181298
|
const schemaErrors = useMemo8(() => {
|
|
180827
181299
|
const errors5 = ensureValidStateSchemaName(stateSchema, modelName, scope);
|
|
180828
181300
|
if (sharedSchemaError) {
|
|
@@ -180830,12 +181302,12 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180830
181302
|
}
|
|
180831
181303
|
return errors5;
|
|
180832
181304
|
}, [stateSchema, modelName, scope, sharedSchemaError]);
|
|
180833
|
-
const handleToggleStandardLib =
|
|
181305
|
+
const handleToggleStandardLib = useCallback21(() => {
|
|
180834
181306
|
setShowStandardLib((prev) => !prev);
|
|
180835
181307
|
}, []);
|
|
180836
|
-
const handleSchemaUpdate =
|
|
180837
|
-
const handleInitialStateUpdate =
|
|
180838
|
-
const hasSyncedRef =
|
|
181308
|
+
const handleSchemaUpdate = useCallback21((newDoc) => setStateSchema(newDoc, scope), [setStateSchema, scope]);
|
|
181309
|
+
const handleInitialStateUpdate = useCallback21((newDoc) => setInitialState(newDoc, scope), [setInitialState, scope]);
|
|
181310
|
+
const hasSyncedRef = useRef22(false);
|
|
180839
181311
|
const { initialValueErrors, fixedState } = useMemo8(() => {
|
|
180840
181312
|
const existingValue = initialValue || "{}";
|
|
180841
181313
|
const sharedSchemaDocumentNode = safeParseSdl(sharedSchemaSdl);
|
|
@@ -180860,7 +181332,7 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180860
181332
|
}
|
|
180861
181333
|
return { initialValueErrors: errors5, fixedState: null };
|
|
180862
181334
|
}, [sharedSchemaSdl, initialValue, syncWithSchema, scope, modelName]);
|
|
180863
|
-
|
|
181335
|
+
useEffect23(() => {
|
|
180864
181336
|
if (fixedState && !hasSyncedRef.current) {
|
|
180865
181337
|
hasSyncedRef.current = true;
|
|
180866
181338
|
setInitialState(fixedState, scope);
|
|
@@ -180871,7 +181343,7 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, set
|
|
|
180871
181343
|
return _jsxs9("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs9("div", { children: [_jsxs9("h3", { className: "mb-2 text-lg capitalize", children: [scope, " state schema *"] }), _jsxs9(Button, { onClick: handleToggleStandardLib, className: "mb-2 flex w-fit items-center gap-2", children: [showStandardLib ? "Hide" : "Show", " standard library", _jsx22("svg", { className: cn3("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"), xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: _jsx22("path", { d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z", fill: "black" }) })] }), _jsxs9(Suspense2, { children: [showStandardLib && _jsx22(GraphqlEditor4, { doc: typeDefsDoc, readonly: true }), _jsx22(GraphqlEditor4, { doc: stateSchema, updateDocumentInModel: handleSchemaUpdate, customLinter }), schemaErrors.length > 0 && _jsx22("p", { className: "mt-2 text-sm text-red-600", children: schemaErrors[0].message })] })] }), _jsxs9("div", { children: [_jsxs9("div", { className: "flex flex-col items-end", children: [_jsxs9("h3", { className: "mb-2 text-right text-lg capitalize", children: [scope, " state initial value *"] }), _jsx22(Checkbox, { value: syncWithSchema, onChange: setSyncWithSchema, className: "mb-2 w-fit whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 pl-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", label: _jsxs9("div", { className: "flex items-center gap-2 py-2 pr-2", children: ["Sync with schema", " ", _jsx22("svg", { className: "inline-block", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: _jsx22("path", { d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z", fill: "#343839" }) })] }) })] }), _jsxs9(Suspense2, { children: [_jsx22(JSONEditor3, { doc: initialValue, updateDocumentInModel: handleInitialStateUpdate }), initialValueErrors.map((error50, index) => _jsx22("p", { className: "mt-2 text-sm text-red-600", children: error50 instanceof StateValidationError ? _jsx22(StateValidationErrorMessage, { error: error50 }) : error50.message }, index))] })] })] });
|
|
180872
181344
|
}
|
|
180873
181345
|
function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, currentScope, onScopeChange }) {
|
|
180874
|
-
const handleAddLocalState =
|
|
181346
|
+
const handleAddLocalState = useCallback21(() => {
|
|
180875
181347
|
const initialDoc = makeInitialSchemaDoc(modelName, "local");
|
|
180876
181348
|
setStateSchema(initialDoc, "local");
|
|
180877
181349
|
setInitialState("", "local");
|
|
@@ -180901,7 +181373,7 @@ import { jsx as _jsx23, jsxs as _jsxs10 } from "react/jsx-runtime";
|
|
|
180901
181373
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
180902
181374
|
import { addModule, addOperation, addOperationError, deleteModule, deleteOperation, deleteOperationError, setAuthorName, setAuthorWebsite, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleName, setOperationDescription, setOperationErrorName, setOperationName, setOperationSchema, setStateSchema } from "document-model";
|
|
180903
181375
|
import { generateId as generateId3 } from "document-model/core";
|
|
180904
|
-
import { lazy as lazy4, Suspense as Suspense3, useEffect as
|
|
181376
|
+
import { lazy as lazy4, Suspense as Suspense3, useEffect as useEffect24, useRef as useRef23, useState as useState20 } from "react";
|
|
180905
181377
|
function Editor() {
|
|
180906
181378
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
180907
181379
|
const toast3 = usePHToast();
|
|
@@ -180911,8 +181383,8 @@ function Editor() {
|
|
|
180911
181383
|
const { name: modelName, id: documentType, extension, description, author: { name: authorName, website: authorWebsite } } = document2.state.global;
|
|
180912
181384
|
const { state: { global: { schema: globalStateSchema, initialValue: globalStateInitialValue }, local: { schema: localStateSchema, initialValue: localStateInitialValue } }, modules } = document2.state.global.specifications[0];
|
|
180913
181385
|
const operations = modules.flatMap((module) => module.operations);
|
|
180914
|
-
const shouldSetInitialName =
|
|
180915
|
-
|
|
181386
|
+
const shouldSetInitialName = useRef23(!modelName && !!documentNodeName && operations.length === 0);
|
|
181387
|
+
useEffect24(() => {
|
|
180916
181388
|
if (!shouldSetInitialName.current || !documentNodeName)
|
|
180917
181389
|
return;
|
|
180918
181390
|
const initialSchemaDoc2 = initializeModelSchema(documentNodeName);
|
|
@@ -182009,9 +182481,9 @@ var init_esm12 = __esm(() => {
|
|
|
182009
182481
|
import { jsx as _jsx25 } from "react/jsx-runtime";
|
|
182010
182482
|
import { useWindowSize } from "@powerhousedao/design-system";
|
|
182011
182483
|
import { FileItem } from "@powerhousedao/design-system/connect";
|
|
182012
|
-
import React33, { useRef as
|
|
182484
|
+
import React33, { useRef as useRef24 } from "react";
|
|
182013
182485
|
function FileContentView() {
|
|
182014
|
-
const parentRef =
|
|
182486
|
+
const parentRef = useRef24(null);
|
|
182015
182487
|
const windowSize = useWindowSize();
|
|
182016
182488
|
const availableWidth = windowSize.innerWidth - USED_SPACE;
|
|
182017
182489
|
const nodes = useNodesInSelectedDriveOrFolder();
|
|
@@ -182183,17 +182655,17 @@ var init_editors = __esm(() => {
|
|
|
182183
182655
|
|
|
182184
182656
|
// ../../packages/reactor-browser/dist/src/connect.js
|
|
182185
182657
|
import { logger as logger9 } from "document-drive";
|
|
182186
|
-
import { useSyncExternalStore as
|
|
182187
|
-
import { use as use3, useCallback as
|
|
182188
|
-
import { useEffect as
|
|
182658
|
+
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
182659
|
+
import { use as use3, useCallback as useCallback22, useSyncExternalStore as useSyncExternalStore22 } from "react";
|
|
182660
|
+
import { useEffect as useEffect26, useState as useState22, useSyncExternalStore as useSyncExternalStore32 } from "react";
|
|
182189
182661
|
import { logger as logger52 } from "document-drive";
|
|
182190
182662
|
import { logger as logger42 } from "document-drive";
|
|
182191
182663
|
import { logger as logger23 } from "document-drive";
|
|
182192
182664
|
import { logger as logger32 } from "document-drive";
|
|
182193
182665
|
import { buildSignedAction as buildSignedAction2 } from "document-model/core";
|
|
182194
|
-
import { useSyncExternalStore as
|
|
182195
|
-
import { useEffect as
|
|
182196
|
-
import { useEffect as useEffect32, useRef as
|
|
182666
|
+
import { useSyncExternalStore as useSyncExternalStore42 } from "react";
|
|
182667
|
+
import { useEffect as useEffect27, useState as useState23 } from "react";
|
|
182668
|
+
import { useEffect as useEffect32, useRef as useRef25, useState as useState32 } from "react";
|
|
182197
182669
|
function consumeDidFromUrl2() {
|
|
182198
182670
|
if (typeof window === "undefined")
|
|
182199
182671
|
return;
|
|
@@ -182222,7 +182694,7 @@ async function login2(userDid, renown) {
|
|
|
182222
182694
|
}
|
|
182223
182695
|
return await renown.login(did);
|
|
182224
182696
|
} catch (error50) {
|
|
182225
|
-
logger9.error(
|
|
182697
|
+
logger9.error(error50 instanceof Error ? error50.message : JSON.stringify(error50));
|
|
182226
182698
|
}
|
|
182227
182699
|
}
|
|
182228
182700
|
function split6(value) {
|
|
@@ -182295,38 +182767,61 @@ function makePHEventFunctions2(key) {
|
|
|
182295
182767
|
const setEventName = `ph:set${capitalCase2(key)}`;
|
|
182296
182768
|
const updateEventName = `ph:${key}Updated`;
|
|
182297
182769
|
function setValue(value) {
|
|
182770
|
+
if (isServer2) {
|
|
182771
|
+
return;
|
|
182772
|
+
}
|
|
182298
182773
|
const event = new CustomEvent(setEventName, {
|
|
182299
182774
|
detail: { [key]: value }
|
|
182300
182775
|
});
|
|
182301
182776
|
window.dispatchEvent(event);
|
|
182302
182777
|
}
|
|
182303
182778
|
function dispatchUpdatedEvent() {
|
|
182779
|
+
if (isServer2) {
|
|
182780
|
+
return;
|
|
182781
|
+
}
|
|
182304
182782
|
const event = new CustomEvent(updateEventName);
|
|
182305
182783
|
window.dispatchEvent(event);
|
|
182306
182784
|
}
|
|
182307
182785
|
function handleSetValueEvent(event) {
|
|
182786
|
+
if (isServer2) {
|
|
182787
|
+
return;
|
|
182788
|
+
}
|
|
182308
182789
|
const value = event.detail[key];
|
|
182309
|
-
if (!window.ph)
|
|
182310
|
-
|
|
182790
|
+
if (!window.ph) {
|
|
182791
|
+
window.ph = {};
|
|
182792
|
+
}
|
|
182311
182793
|
window.ph[key] = value;
|
|
182312
182794
|
dispatchUpdatedEvent();
|
|
182313
182795
|
}
|
|
182314
182796
|
function addEventHandler() {
|
|
182797
|
+
if (isServer2) {
|
|
182798
|
+
return;
|
|
182799
|
+
}
|
|
182315
182800
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
182316
182801
|
}
|
|
182317
182802
|
function subscribeToValue(onStoreChange) {
|
|
182803
|
+
if (isServer2)
|
|
182804
|
+
return () => {};
|
|
182318
182805
|
window.addEventListener(updateEventName, onStoreChange);
|
|
182319
182806
|
return () => {
|
|
182320
182807
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
182321
182808
|
};
|
|
182322
182809
|
}
|
|
182323
182810
|
function getSnapshot() {
|
|
182324
|
-
if (
|
|
182325
|
-
|
|
182811
|
+
if (isServer2) {
|
|
182812
|
+
return;
|
|
182813
|
+
}
|
|
182814
|
+
if (!window.ph) {
|
|
182815
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase2(key)}?`);
|
|
182816
|
+
return;
|
|
182817
|
+
}
|
|
182326
182818
|
return window.ph[key];
|
|
182327
182819
|
}
|
|
182820
|
+
function getServerSnapshot() {
|
|
182821
|
+
return;
|
|
182822
|
+
}
|
|
182328
182823
|
function useValue() {
|
|
182329
|
-
return
|
|
182824
|
+
return useSyncExternalStore5(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
182330
182825
|
}
|
|
182331
182826
|
return {
|
|
182332
182827
|
useValue,
|
|
@@ -182467,8 +182962,8 @@ class DocumentCache2 {
|
|
|
182467
182962
|
}
|
|
182468
182963
|
function useUser2() {
|
|
182469
182964
|
const renown = useRenown2();
|
|
182470
|
-
const [user, setUser2] = useState22(
|
|
182471
|
-
|
|
182965
|
+
const [user, setUser2] = useState22(renown?.user);
|
|
182966
|
+
useEffect26(() => {
|
|
182472
182967
|
setUser2(renown?.user);
|
|
182473
182968
|
if (!renown)
|
|
182474
182969
|
return;
|
|
@@ -182688,7 +183183,7 @@ function setDefaultPHGlobalConfig(config20) {
|
|
|
182688
183183
|
function useConnectionStates2() {
|
|
182689
183184
|
const syncManager = useSync2();
|
|
182690
183185
|
const [states, setStates] = useState32(() => buildSnapshot2(syncManager));
|
|
182691
|
-
const unsubscribesRef =
|
|
183186
|
+
const unsubscribesRef = useRef25([]);
|
|
182692
183187
|
useEffect32(() => {
|
|
182693
183188
|
if (!syncManager)
|
|
182694
183189
|
return;
|
|
@@ -182727,16 +183222,17 @@ function buildSnapshot2(syncManager) {
|
|
|
182727
183222
|
}
|
|
182728
183223
|
return map2;
|
|
182729
183224
|
}
|
|
182730
|
-
var SPLIT_LOWER_UPPER_RE3, SPLIT_UPPER_UPPER_RE3, SPLIT_SEPARATE_NUMBER_RE3, DEFAULT_STRIP_REGEXP3, SPLIT_REPLACE_VALUE3 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS3 = "", isExternalControlsEnabledEventFunctions2, setIsExternalControlsEnabled2, useIsExternalControlsEnabled2, addIsExternalControlsEnabledEventHandler2, isDragAndDropEnabledEventFunctions2, setIsDragAndDropEnabled2, useIsDragAndDropEnabled2, addIsDragAndDropEnabledEventHandler2, allowedDocumentTypesEventFunctions2, setAllowedDocumentTypes2, addAllowedDocumentTypesEventHandler2, phDriveEditorConfigSetters2, phDocumentEditorConfigSetters2, phDriveEditorConfigHooks2, phDocumentEditorConfigHooks2, useRouterBasename2, setRouterBasename2, addRouterBasenameEventHandler2, useVersion2, setVersion2, addVersionEventHandler2, useRequiresHardRefresh2, setRequiresHardRefresh2, addRequiresHardRefreshEventHandler2, useWarnOutdatedApp2, setWarnOutdatedApp2, addWarnOutdatedAppEventHandler2, useStudioMode2, setStudioMode2, addStudioModeEventHandler2, useBasePath2, setBasePath2, addBasePathEventHandler2, useVersionCheckInterval2, setVersionCheckInterval2, addVersionCheckIntervalEventHandler2, useCliVersion2, setCliVersion2, addCliVersionEventHandler2, useFileUploadOperationsChunkSize2, setFileUploadOperationsChunkSize2, addFileUploadOperationsChunkSizeEventHandler2, useIsDocumentModelSelectionSettingsEnabled2, setIsDocumentModelSelectionSettingsEnabled2, addIsDocumentModelSelectionSettingsEnabledEventHandler2, useGaTrackingId2, setGaTrackingId2, addGaTrackingIdEventHandler2, useDefaultDrivesUrl2, setDefaultDrivesUrl2, addDefaultDrivesUrlEventHandler2, useDrivesPreserveStrategy2, setDrivesPreserveStrategy2, addDrivesPreserveStrategyEventHandler2, useIsLocalDrivesEnabled2, setIsLocalDrivesEnabled2, addIsLocalDrivesEnabledEventHandler2, useIsAddDriveEnabled2, setIsAddDriveEnabled2, addIsAddDriveEnabledEventHandler2, useIsPublicDrivesEnabled2, setIsPublicDrivesEnabled2, addIsPublicDrivesEnabledEventHandler2, useIsAddPublicDrivesEnabled2, setIsAddPublicDrivesEnabled2, addIsAddPublicDrivesEnabledEventHandler2, useIsDeletePublicDrivesEnabled2, setIsDeletePublicDrivesEnabled2, addIsDeletePublicDrivesEnabledEventHandler2, useIsCloudDrivesEnabled2, setIsCloudDrivesEnabled2, addIsCloudDrivesEnabledEventHandler2, useIsAddCloudDrivesEnabled2, setIsAddCloudDrivesEnabled2, addIsAddCloudDrivesEnabledEventHandler2, useIsDeleteCloudDrivesEnabled2, setIsDeleteCloudDrivesEnabled2, addIsDeleteCloudDrivesEnabledEventHandler2, useLocalDrivesEnabled2, setLocalDrivesEnabled2, addLocalDrivesEnabledEventHandler2, useIsAddLocalDrivesEnabled2, setIsAddLocalDrivesEnabled2, addIsAddLocalDrivesEnabledEventHandler2, useIsDeleteLocalDrivesEnabled2, setIsDeleteLocalDrivesEnabled2, addIsDeleteLocalDrivesEnabledEventHandler2, useIsEditorDebugModeEnabled2, setIsEditorDebugModeEnabled2, addIsEditorDebugModeEnabledEventHandler2, useIsEditorReadModeEnabled2, setIsEditorReadModeEnabled2, addIsEditorReadModeEnabledEventHandler2, useIsAnalyticsDatabaseWorkerEnabled2, setIsAnalyticsDatabaseWorkerEnabled2, addIsAnalyticsDatabaseWorkerEnabledEventHandler2, useIsDiffAnalyticsEnabled2, setIsDiffAnalyticsEnabled2, addIsDiffAnalyticsEnabledEventHandler2, useIsDriveAnalyticsEnabled2, setIsDriveAnalyticsEnabled2, addIsDriveAnalyticsEnabledEventHandler2, useRenownUrl2, setRenownUrl2, addRenownUrlEventHandler2, useRenownNetworkId2, setRenownNetworkId2, addRenownNetworkIdEventHandler2, useRenownChainId2, setRenownChainId2, addRenownChainIdEventHandler2, useSentryRelease2, setSentryRelease2, addSentryReleaseEventHandler2, useSentryDsn2, setSentryDsn2, addSentryDsnEventHandler2, useSentryEnv2, setSentryEnv2, addSentryEnvEventHandler2, useIsSentryTracingEnabled2, setIsSentryTracingEnabled2, addIsSentryTracingEnabledEventHandler2, useIsExternalProcessorsEnabled2, setIsExternalProcessorsEnabled2, addIsExternalProcessorsEnabledEventHandler2, useIsExternalPackagesEnabled2, setIsExternalPackagesEnabled2, addIsExternalPackagesEnabledEventHandler2, enabledEditorsEventFunctions2, setEnabledEditors2, useEnabledEditors2, addEnabledEditorsEventHandler2, disabledEditorsEventFunctions2, setDisabledEditors2, useDisabledEditors2, addDisabledEditorsEventHandler2, isRelationalProcessorsEnabled2, setIsRelationalProcessorsEnabled2, useIsRelationalProcessorsEnabled2, addIsRelationalProcessorsEnabledEventHandler2, isExternalRelationalProcessorsEnabled2, setIsExternalRelationalProcessorsEnabled2, useIsExternalRelationalProcessorsEnabled2, addIsExternalRelationalProcessorsEnabledEventHandler2, isAnalyticsEnabledEventFunctions2, setIsAnalyticsEnabled2, useIsAnalyticsEnabled2, addIsAnalyticsEnabledEventHandler2, isAnalyticsExternalProcessorsEnabled2, setIsAnalyticsExternalProcessorsEnabled2, useIsAnalyticsExternalProcessorsEnabled2, addIsAnalyticsExternalProcessorsEnabledEventHandler2, analyticsDatabaseNameEventFunctions2, setAnalyticsDatabaseName2, useAnalyticsDatabaseName2, addAnalyticsDatabaseNameEventHandler2, logLevelEventFunctions2, setLogLevel3, useLogLevel2, addLogLevelEventHandler2, allowListEventFunctions2, setAllowList2, useAllowList2, addAllowListEventHandler2, nonUserConfigSetters2, phGlobalConfigSetters2, nonUserConfigHooks2, phGlobalConfigHooks2, featuresEventFunctions2, useFeatures2, setFeatures2, addFeaturesEventHandler2, documentEventFunctions2, useDocumentCache2, setDocumentCache2, addDocumentCacheEventHandler2, drivesEventFunctions2, useDrives2, setDrives2, addDrivesEventHandler2, useLoading2, setLoading2, addLoadingEventHandler2, modalEventFunctions2, usePHModal2, setPHModal2, addModalEventHandler2, reactorClientModuleEventFunctions2, reactorClientEventFunctions2, useReactorClientModule2, setReactorClientModule2, addReactorClientModuleEventHandler2, useReactorClient2, setReactorClient2, addReactorClientEventHandler2, useSync2 = () => useReactorClientModule2()?.reactorModule?.syncModule?.syncManager, useSyncList2 = () => {
|
|
183225
|
+
var SPLIT_LOWER_UPPER_RE3, SPLIT_UPPER_UPPER_RE3, SPLIT_SEPARATE_NUMBER_RE3, DEFAULT_STRIP_REGEXP3, SPLIT_REPLACE_VALUE3 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS3 = "", isServer2, isExternalControlsEnabledEventFunctions2, setIsExternalControlsEnabled2, useIsExternalControlsEnabled2, addIsExternalControlsEnabledEventHandler2, isDragAndDropEnabledEventFunctions2, setIsDragAndDropEnabled2, useIsDragAndDropEnabled2, addIsDragAndDropEnabledEventHandler2, allowedDocumentTypesEventFunctions2, setAllowedDocumentTypes2, addAllowedDocumentTypesEventHandler2, phDriveEditorConfigSetters2, phDocumentEditorConfigSetters2, phDriveEditorConfigHooks2, phDocumentEditorConfigHooks2, useRouterBasename2, setRouterBasename2, addRouterBasenameEventHandler2, useVersion2, setVersion2, addVersionEventHandler2, useRequiresHardRefresh2, setRequiresHardRefresh2, addRequiresHardRefreshEventHandler2, useWarnOutdatedApp2, setWarnOutdatedApp2, addWarnOutdatedAppEventHandler2, useStudioMode2, setStudioMode2, addStudioModeEventHandler2, useBasePath2, setBasePath2, addBasePathEventHandler2, useVersionCheckInterval2, setVersionCheckInterval2, addVersionCheckIntervalEventHandler2, useCliVersion2, setCliVersion2, addCliVersionEventHandler2, useFileUploadOperationsChunkSize2, setFileUploadOperationsChunkSize2, addFileUploadOperationsChunkSizeEventHandler2, useIsDocumentModelSelectionSettingsEnabled2, setIsDocumentModelSelectionSettingsEnabled2, addIsDocumentModelSelectionSettingsEnabledEventHandler2, useGaTrackingId2, setGaTrackingId2, addGaTrackingIdEventHandler2, useDefaultDrivesUrl2, setDefaultDrivesUrl2, addDefaultDrivesUrlEventHandler2, useDrivesPreserveStrategy2, setDrivesPreserveStrategy2, addDrivesPreserveStrategyEventHandler2, useIsLocalDrivesEnabled2, setIsLocalDrivesEnabled2, addIsLocalDrivesEnabledEventHandler2, useIsAddDriveEnabled2, setIsAddDriveEnabled2, addIsAddDriveEnabledEventHandler2, useIsPublicDrivesEnabled2, setIsPublicDrivesEnabled2, addIsPublicDrivesEnabledEventHandler2, useIsAddPublicDrivesEnabled2, setIsAddPublicDrivesEnabled2, addIsAddPublicDrivesEnabledEventHandler2, useIsDeletePublicDrivesEnabled2, setIsDeletePublicDrivesEnabled2, addIsDeletePublicDrivesEnabledEventHandler2, useIsCloudDrivesEnabled2, setIsCloudDrivesEnabled2, addIsCloudDrivesEnabledEventHandler2, useIsAddCloudDrivesEnabled2, setIsAddCloudDrivesEnabled2, addIsAddCloudDrivesEnabledEventHandler2, useIsDeleteCloudDrivesEnabled2, setIsDeleteCloudDrivesEnabled2, addIsDeleteCloudDrivesEnabledEventHandler2, useLocalDrivesEnabled2, setLocalDrivesEnabled2, addLocalDrivesEnabledEventHandler2, useIsAddLocalDrivesEnabled2, setIsAddLocalDrivesEnabled2, addIsAddLocalDrivesEnabledEventHandler2, useIsDeleteLocalDrivesEnabled2, setIsDeleteLocalDrivesEnabled2, addIsDeleteLocalDrivesEnabledEventHandler2, useIsEditorDebugModeEnabled2, setIsEditorDebugModeEnabled2, addIsEditorDebugModeEnabledEventHandler2, useIsEditorReadModeEnabled2, setIsEditorReadModeEnabled2, addIsEditorReadModeEnabledEventHandler2, useIsAnalyticsDatabaseWorkerEnabled2, setIsAnalyticsDatabaseWorkerEnabled2, addIsAnalyticsDatabaseWorkerEnabledEventHandler2, useIsDiffAnalyticsEnabled2, setIsDiffAnalyticsEnabled2, addIsDiffAnalyticsEnabledEventHandler2, useIsDriveAnalyticsEnabled2, setIsDriveAnalyticsEnabled2, addIsDriveAnalyticsEnabledEventHandler2, useRenownUrl2, setRenownUrl2, addRenownUrlEventHandler2, useRenownNetworkId2, setRenownNetworkId2, addRenownNetworkIdEventHandler2, useRenownChainId2, setRenownChainId2, addRenownChainIdEventHandler2, useSentryRelease2, setSentryRelease2, addSentryReleaseEventHandler2, useSentryDsn2, setSentryDsn2, addSentryDsnEventHandler2, useSentryEnv2, setSentryEnv2, addSentryEnvEventHandler2, useIsSentryTracingEnabled2, setIsSentryTracingEnabled2, addIsSentryTracingEnabledEventHandler2, useIsExternalProcessorsEnabled2, setIsExternalProcessorsEnabled2, addIsExternalProcessorsEnabledEventHandler2, useIsExternalPackagesEnabled2, setIsExternalPackagesEnabled2, addIsExternalPackagesEnabledEventHandler2, enabledEditorsEventFunctions2, setEnabledEditors2, useEnabledEditors2, addEnabledEditorsEventHandler2, disabledEditorsEventFunctions2, setDisabledEditors2, useDisabledEditors2, addDisabledEditorsEventHandler2, isRelationalProcessorsEnabled2, setIsRelationalProcessorsEnabled2, useIsRelationalProcessorsEnabled2, addIsRelationalProcessorsEnabledEventHandler2, isExternalRelationalProcessorsEnabled2, setIsExternalRelationalProcessorsEnabled2, useIsExternalRelationalProcessorsEnabled2, addIsExternalRelationalProcessorsEnabledEventHandler2, isAnalyticsEnabledEventFunctions2, setIsAnalyticsEnabled2, useIsAnalyticsEnabled2, addIsAnalyticsEnabledEventHandler2, isAnalyticsExternalProcessorsEnabled2, setIsAnalyticsExternalProcessorsEnabled2, useIsAnalyticsExternalProcessorsEnabled2, addIsAnalyticsExternalProcessorsEnabledEventHandler2, analyticsDatabaseNameEventFunctions2, setAnalyticsDatabaseName2, useAnalyticsDatabaseName2, addAnalyticsDatabaseNameEventHandler2, logLevelEventFunctions2, setLogLevel3, useLogLevel2, addLogLevelEventHandler2, allowListEventFunctions2, setAllowList2, useAllowList2, addAllowListEventHandler2, nonUserConfigSetters2, phGlobalConfigSetters2, nonUserConfigHooks2, phGlobalConfigHooks2, featuresEventFunctions2, useFeatures2, setFeatures2, addFeaturesEventHandler2, documentEventFunctions2, useDocumentCache2, setDocumentCache2, addDocumentCacheEventHandler2, drivesEventFunctions2, useDrives2, setDrives2, addDrivesEventHandler2, useLoading2, setLoading2, addLoadingEventHandler2, modalEventFunctions2, usePHModal2, setPHModal2, addModalEventHandler2, reactorClientModuleEventFunctions2, reactorClientEventFunctions2, useReactorClientModule2, setReactorClientModule2, addReactorClientModuleEventHandler2, useReactorClient2, setReactorClient2, addReactorClientEventHandler2, useSync2 = () => useReactorClientModule2()?.reactorModule?.syncModule?.syncManager, useSyncList2 = () => {
|
|
182731
183226
|
const sync = useSync2();
|
|
182732
183227
|
return sync?.list() ?? [];
|
|
182733
|
-
}, useDatabase = () => useReactorClientModule2()?.reactorModule?.database, usePGlite = () => useReactorClientModule2()?.pg, renownEventFunctions2, useRenown2, setRenown2,
|
|
183228
|
+
}, useDatabase = () => useReactorClientModule2()?.reactorModule?.database, usePGlite = () => useReactorClientModule2()?.pg, renownEventFunctions2, addRenownEventHandler2, useRenown2, setRenown2, revisionHistoryEventFunctions2, useRevisionHistoryVisible2, setRevisionHistoryVisible2, addRevisionHistoryVisibleEventHandler2, base6411, locales2, defaultLocale2, initialMulticharmap2, initialCharmap2, slug_default2, selectedDriveIdEventFunctions2, useSelectedDriveId2, setSelectedDriveId2, addSelectedDriveIdEventHandler2, selectedNodeIdEventFunctions2, useSelectedNodeId2, setSelectedNodeId2, addSelectedNodeIdEventHandler2, selectedTimelineItemEventFunctions2, useSelectedTimelineItem2, setSelectedTimelineItem2, addSelectedTimelineItemEventHandler2, selectedTimelineRevisionEventFunctions2, useSelectedTimelineRevision2, setSelectedTimelineRevision2, addSelectedTimelineRevisionEventHandler2, toastEventFunctions2, usePHToast2, setPHToast2, addToastEventHandler2, vetraPackageManagerFunctions2, useVetraPackageManager2, addVetraPackageManagerEventHandler2, phGlobalEventHandlerRegisterFunctions;
|
|
182734
183229
|
var init_connect2 = __esm(() => {
|
|
182735
183230
|
init_src();
|
|
182736
183231
|
SPLIT_LOWER_UPPER_RE3 = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
182737
183232
|
SPLIT_UPPER_UPPER_RE3 = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
182738
183233
|
SPLIT_SEPARATE_NUMBER_RE3 = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
182739
183234
|
DEFAULT_STRIP_REGEXP3 = /[^\p{L}\d]+/giu;
|
|
183235
|
+
isServer2 = typeof window === "undefined";
|
|
182740
183236
|
isExternalControlsEnabledEventFunctions2 = makePHEventFunctions2("isExternalControlsEnabled");
|
|
182741
183237
|
setIsExternalControlsEnabled2 = isExternalControlsEnabledEventFunctions2.setValue;
|
|
182742
183238
|
useIsExternalControlsEnabled2 = isExternalControlsEnabledEventFunctions2.useValue;
|
|
@@ -183124,9 +183620,9 @@ var init_connect2 = __esm(() => {
|
|
|
183124
183620
|
setReactorClient2 = reactorClientEventFunctions2.setValue;
|
|
183125
183621
|
addReactorClientEventHandler2 = reactorClientEventFunctions2.addEventHandler;
|
|
183126
183622
|
renownEventFunctions2 = makePHEventFunctions2("renown");
|
|
183623
|
+
addRenownEventHandler2 = renownEventFunctions2.addEventHandler;
|
|
183127
183624
|
useRenown2 = renownEventFunctions2.useValue;
|
|
183128
183625
|
setRenown2 = renownEventFunctions2.setValue;
|
|
183129
|
-
addRenownEventHandler2 = renownEventFunctions2.addEventHandler;
|
|
183130
183626
|
revisionHistoryEventFunctions2 = makePHEventFunctions2("revisionHistoryVisible");
|
|
183131
183627
|
useRevisionHistoryVisible2 = revisionHistoryEventFunctions2.useValue;
|
|
183132
183628
|
setRevisionHistoryVisible2 = revisionHistoryEventFunctions2.setValue;
|
|
@@ -185628,7 +186124,7 @@ import { logger as logger43 } from "document-drive";
|
|
|
185628
186124
|
import { logger as logger24 } from "document-drive";
|
|
185629
186125
|
import { logger as logger33 } from "document-drive";
|
|
185630
186126
|
import { buildSignedAction as buildSignedAction3 } from "document-model/core";
|
|
185631
|
-
import { use as use4, useCallback as useCallback32, useSyncExternalStore as
|
|
186127
|
+
import { use as use4, useCallback as useCallback32, useSyncExternalStore as useSyncExternalStore43 } from "react";
|
|
185632
186128
|
import { useSyncExternalStore as useSyncExternalStore33 } from "react";
|
|
185633
186129
|
|
|
185634
186130
|
class AnalyticsProfiler {
|
|
@@ -198102,7 +198598,7 @@ function createRetryer(config20) {
|
|
|
198102
198598
|
if (isResolved()) {
|
|
198103
198599
|
return;
|
|
198104
198600
|
}
|
|
198105
|
-
const retry = config20.retry ?? (
|
|
198601
|
+
const retry = config20.retry ?? (isServer3 ? 0 : 3);
|
|
198106
198602
|
const retryDelay = config20.retryDelay ?? defaultRetryDelay;
|
|
198107
198603
|
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error50) : retryDelay;
|
|
198108
198604
|
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error50);
|
|
@@ -198370,7 +198866,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
198370
198866
|
throw result.error;
|
|
198371
198867
|
}
|
|
198372
198868
|
client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
|
|
198373
|
-
if (defaultedOptions.experimental_prefetchInRender && !
|
|
198869
|
+
if (defaultedOptions.experimental_prefetchInRender && !isServer3 && willFetch(result, isRestoring)) {
|
|
198374
198870
|
const promise2 = isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise;
|
|
198375
198871
|
promise2?.catch(noop4).finally(() => {
|
|
198376
198872
|
observer.updateResult();
|
|
@@ -199029,38 +199525,61 @@ function makePHEventFunctions3(key) {
|
|
|
199029
199525
|
const setEventName = `ph:set${capitalCase3(key)}`;
|
|
199030
199526
|
const updateEventName = `ph:${key}Updated`;
|
|
199031
199527
|
function setValue(value) {
|
|
199528
|
+
if (isServer22) {
|
|
199529
|
+
return;
|
|
199530
|
+
}
|
|
199032
199531
|
const event = new CustomEvent(setEventName, {
|
|
199033
199532
|
detail: { [key]: value }
|
|
199034
199533
|
});
|
|
199035
199534
|
window.dispatchEvent(event);
|
|
199036
199535
|
}
|
|
199037
199536
|
function dispatchUpdatedEvent() {
|
|
199537
|
+
if (isServer22) {
|
|
199538
|
+
return;
|
|
199539
|
+
}
|
|
199038
199540
|
const event = new CustomEvent(updateEventName);
|
|
199039
199541
|
window.dispatchEvent(event);
|
|
199040
199542
|
}
|
|
199041
199543
|
function handleSetValueEvent(event) {
|
|
199544
|
+
if (isServer22) {
|
|
199545
|
+
return;
|
|
199546
|
+
}
|
|
199042
199547
|
const value = event.detail[key];
|
|
199043
|
-
if (!window.ph)
|
|
199044
|
-
|
|
199548
|
+
if (!window.ph) {
|
|
199549
|
+
window.ph = {};
|
|
199550
|
+
}
|
|
199045
199551
|
window.ph[key] = value;
|
|
199046
199552
|
dispatchUpdatedEvent();
|
|
199047
199553
|
}
|
|
199048
199554
|
function addEventHandler() {
|
|
199555
|
+
if (isServer22) {
|
|
199556
|
+
return;
|
|
199557
|
+
}
|
|
199049
199558
|
window.addEventListener(setEventName, handleSetValueEvent);
|
|
199050
199559
|
}
|
|
199051
199560
|
function subscribeToValue(onStoreChange) {
|
|
199561
|
+
if (isServer22)
|
|
199562
|
+
return () => {};
|
|
199052
199563
|
window.addEventListener(updateEventName, onStoreChange);
|
|
199053
199564
|
return () => {
|
|
199054
199565
|
window.removeEventListener(updateEventName, onStoreChange);
|
|
199055
199566
|
};
|
|
199056
199567
|
}
|
|
199057
199568
|
function getSnapshot() {
|
|
199058
|
-
if (
|
|
199059
|
-
|
|
199569
|
+
if (isServer22) {
|
|
199570
|
+
return;
|
|
199571
|
+
}
|
|
199572
|
+
if (!window.ph) {
|
|
199573
|
+
console.warn(`ph global store is not initialized. Did you call set${capitalCase3(key)}?`);
|
|
199574
|
+
return;
|
|
199575
|
+
}
|
|
199060
199576
|
return window.ph[key];
|
|
199061
199577
|
}
|
|
199578
|
+
function getServerSnapshot() {
|
|
199579
|
+
return;
|
|
199580
|
+
}
|
|
199062
199581
|
function useValue() {
|
|
199063
|
-
return useSyncExternalStore33(subscribeToValue, getSnapshot);
|
|
199582
|
+
return useSyncExternalStore33(subscribeToValue, getSnapshot, getServerSnapshot);
|
|
199064
199583
|
}
|
|
199065
199584
|
return {
|
|
199066
199585
|
useValue,
|
|
@@ -199070,7 +199589,7 @@ function makePHEventFunctions3(key) {
|
|
|
199070
199589
|
}
|
|
199071
199590
|
function useDocument2(id) {
|
|
199072
199591
|
const documentCache = useDocumentCache3();
|
|
199073
|
-
const document2 =
|
|
199592
|
+
const document2 = useSyncExternalStore43((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : undefined);
|
|
199074
199593
|
return document2 ? use4(document2) : undefined;
|
|
199075
199594
|
}
|
|
199076
199595
|
function useDocumentById2(id) {
|
|
@@ -201877,7 +202396,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
201877
202396
|
clearInterval(intervalId) {
|
|
201878
202397
|
this.#provider.clearInterval(intervalId);
|
|
201879
202398
|
}
|
|
201880
|
-
}, timeoutManager,
|
|
202399
|
+
}, timeoutManager, isServer3, hasOwn, skipToken, FocusManager, focusManager, defaultScheduler, notifyManager, OnlineManager, onlineManager, CancelledError, Removable = class {
|
|
201881
202400
|
#gcTimeout;
|
|
201882
202401
|
destroy() {
|
|
201883
202402
|
this.clearGcTimeout();
|
|
@@ -201891,7 +202410,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
201891
202410
|
}
|
|
201892
202411
|
}
|
|
201893
202412
|
updateGcTime(newGcTime) {
|
|
201894
|
-
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (
|
|
202413
|
+
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer3 ? Infinity : 5 * 60 * 1000));
|
|
201895
202414
|
}
|
|
201896
202415
|
clearGcTimeout() {
|
|
201897
202416
|
if (this.#gcTimeout) {
|
|
@@ -202208,7 +202727,7 @@ var __defProp6, __export4 = (target, all) => {
|
|
|
202208
202727
|
}
|
|
202209
202728
|
}, willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring, shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending, fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
202210
202729
|
errorResetBoundary.clearReset();
|
|
202211
|
-
}), logger11, defaultQueryClient, analyticsOptionsKey, analyticsStoreKey, analyticsEngineKey, DEBOUNCE_INTERVAL = 200, SPLIT_LOWER_UPPER_RE4, SPLIT_UPPER_UPPER_RE4, SPLIT_SEPARATE_NUMBER_RE4, DEFAULT_STRIP_REGEXP4, SPLIT_REPLACE_VALUE4 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS4 = "", documentEventFunctions3, useDocumentCache3, setDocumentCache3, addDocumentCacheEventHandler3, LuxonError5, InvalidDateTimeError5, InvalidIntervalError5, InvalidDurationError5, ConflictingSpecificationError5, InvalidUnitError5, InvalidArgumentError5, ZoneIsAbstractError5, n52 = "numeric", s5 = "short", l5 = "long", DATE_SHORT5, DATE_MED5, DATE_MED_WITH_WEEKDAY5, DATE_FULL5, DATE_HUGE5, TIME_SIMPLE5, TIME_WITH_SECONDS5, TIME_WITH_SHORT_OFFSET5, TIME_WITH_LONG_OFFSET5, TIME_24_SIMPLE5, TIME_24_WITH_SECONDS5, TIME_24_WITH_SHORT_OFFSET5, TIME_24_WITH_LONG_OFFSET5, DATETIME_SHORT5, DATETIME_SHORT_WITH_SECONDS5, DATETIME_MED5, DATETIME_MED_WITH_SECONDS5, DATETIME_MED_WITH_WEEKDAY5, DATETIME_FULL5, DATETIME_FULL_WITH_SECONDS5, DATETIME_HUGE5, DATETIME_HUGE_WITH_SECONDS5, singleton$15 = null, SystemZone5, dtfCache5, typeToPos5, ianaZoneCache5, IANAZone5, intlLFCache5, intlDTCache5, intlNumCache5, intlRelCache5, sysLocaleCache5 = null, intlResolvedOptionsCache5, weekInfoCache5, fallbackWeekSettings5, singleton5 = null, FixedOffsetZone5, InvalidZone5, numberingSystems5, numberingSystemsUTF165, hanidecChars5, digitRegexCache5, now5 = () => Date.now(), defaultZone5 = "system", defaultLocale5 = null, defaultNumberingSystem5 = null, defaultOutputCalendar5 = null, twoDigitCutoffYear5 = 60, throwOnInvalid5, defaultWeekSettings5 = null, nonLeapLadder5, leapLadder5, monthsLong5, monthsShort5, monthsNarrow5, weekdaysLong5, weekdaysShort5, weekdaysNarrow5, meridiems5, erasLong5, erasShort5, erasNarrow5, macroTokenToFormatOpts5, ianaRegex5, offsetRegex5, isoExtendedZone5, isoTimeBaseRegex5, isoTimeRegex5, isoTimeExtensionRegex5, isoYmdRegex5, isoWeekRegex5, isoOrdinalRegex5, extractISOWeekData5, extractISOOrdinalData5, sqlYmdRegex5, sqlTimeRegex5, sqlTimeExtensionRegex5, isoTimeOnly5, isoDuration5, obsOffsets5, rfc28225, rfc11235, rfc8505, ascii52, isoYmdWithTimeExtensionRegex5, isoWeekWithTimeExtensionRegex5, isoOrdinalWithTimeExtensionRegex5, isoTimeCombinedRegex5, extractISOYmdTimeAndOffset5, extractISOWeekTimeAndOffset5, extractISOOrdinalDateAndTime5, extractISOTimeAndOffset5, extractISOTimeOnly5, sqlYmdWithTimeExtensionRegex5, sqlTimeCombinedRegex5, extractISOTimeOffsetAndIANAZone5, INVALID$25 = "Invalid Duration", lowOrderMatrix5, casualMatrix5, daysInYearAccurate5, daysInMonthAccurate5, accurateMatrix5, orderedUnits$15, reverseUnits5, Duration5, INVALID$15 = "Invalid Interval", Interval5, MISSING_FTP5 = "missing Intl.DateTimeFormat.formatToParts support", NBSP5, spaceOrNBSP5, spaceOrNBSPRegExp5, partTypeStyleToTokenVal5, dummyDateTimeCache5 = null, INVALID5 = "Invalid DateTime", MAX_DATE5 = 8640000000000000, defaultUnitValues5, defaultWeekUnitValues5, defaultOrdinalUnitValues5, orderedUnits5, orderedWeekUnits5, orderedOrdinalUnits5, zoneOffsetTs5, zoneOffsetGuessCache5, DateTime5, getBarSize = (value) => {
|
|
202730
|
+
}), logger11, defaultQueryClient, analyticsOptionsKey, analyticsStoreKey, analyticsEngineKey, DEBOUNCE_INTERVAL = 200, SPLIT_LOWER_UPPER_RE4, SPLIT_UPPER_UPPER_RE4, SPLIT_SEPARATE_NUMBER_RE4, DEFAULT_STRIP_REGEXP4, SPLIT_REPLACE_VALUE4 = "$1\x00$2", DEFAULT_PREFIX_SUFFIX_CHARACTERS4 = "", isServer22, documentEventFunctions3, useDocumentCache3, setDocumentCache3, addDocumentCacheEventHandler3, LuxonError5, InvalidDateTimeError5, InvalidIntervalError5, InvalidDurationError5, ConflictingSpecificationError5, InvalidUnitError5, InvalidArgumentError5, ZoneIsAbstractError5, n52 = "numeric", s5 = "short", l5 = "long", DATE_SHORT5, DATE_MED5, DATE_MED_WITH_WEEKDAY5, DATE_FULL5, DATE_HUGE5, TIME_SIMPLE5, TIME_WITH_SECONDS5, TIME_WITH_SHORT_OFFSET5, TIME_WITH_LONG_OFFSET5, TIME_24_SIMPLE5, TIME_24_WITH_SECONDS5, TIME_24_WITH_SHORT_OFFSET5, TIME_24_WITH_LONG_OFFSET5, DATETIME_SHORT5, DATETIME_SHORT_WITH_SECONDS5, DATETIME_MED5, DATETIME_MED_WITH_SECONDS5, DATETIME_MED_WITH_WEEKDAY5, DATETIME_FULL5, DATETIME_FULL_WITH_SECONDS5, DATETIME_HUGE5, DATETIME_HUGE_WITH_SECONDS5, singleton$15 = null, SystemZone5, dtfCache5, typeToPos5, ianaZoneCache5, IANAZone5, intlLFCache5, intlDTCache5, intlNumCache5, intlRelCache5, sysLocaleCache5 = null, intlResolvedOptionsCache5, weekInfoCache5, fallbackWeekSettings5, singleton5 = null, FixedOffsetZone5, InvalidZone5, numberingSystems5, numberingSystemsUTF165, hanidecChars5, digitRegexCache5, now5 = () => Date.now(), defaultZone5 = "system", defaultLocale5 = null, defaultNumberingSystem5 = null, defaultOutputCalendar5 = null, twoDigitCutoffYear5 = 60, throwOnInvalid5, defaultWeekSettings5 = null, nonLeapLadder5, leapLadder5, monthsLong5, monthsShort5, monthsNarrow5, weekdaysLong5, weekdaysShort5, weekdaysNarrow5, meridiems5, erasLong5, erasShort5, erasNarrow5, macroTokenToFormatOpts5, ianaRegex5, offsetRegex5, isoExtendedZone5, isoTimeBaseRegex5, isoTimeRegex5, isoTimeExtensionRegex5, isoYmdRegex5, isoWeekRegex5, isoOrdinalRegex5, extractISOWeekData5, extractISOOrdinalData5, sqlYmdRegex5, sqlTimeRegex5, sqlTimeExtensionRegex5, isoTimeOnly5, isoDuration5, obsOffsets5, rfc28225, rfc11235, rfc8505, ascii52, isoYmdWithTimeExtensionRegex5, isoWeekWithTimeExtensionRegex5, isoOrdinalWithTimeExtensionRegex5, isoTimeCombinedRegex5, extractISOYmdTimeAndOffset5, extractISOWeekTimeAndOffset5, extractISOOrdinalDateAndTime5, extractISOTimeAndOffset5, extractISOTimeOnly5, sqlYmdWithTimeExtensionRegex5, sqlTimeCombinedRegex5, extractISOTimeOffsetAndIANAZone5, INVALID$25 = "Invalid Duration", lowOrderMatrix5, casualMatrix5, daysInYearAccurate5, daysInMonthAccurate5, accurateMatrix5, orderedUnits$15, reverseUnits5, Duration5, INVALID$15 = "Invalid Interval", Interval5, MISSING_FTP5 = "missing Intl.DateTimeFormat.formatToParts support", NBSP5, spaceOrNBSP5, spaceOrNBSPRegExp5, partTypeStyleToTokenVal5, dummyDateTimeCache5 = null, INVALID5 = "Invalid DateTime", MAX_DATE5 = 8640000000000000, defaultUnitValues5, defaultWeekUnitValues5, defaultOrdinalUnitValues5, orderedUnits5, orderedWeekUnits5, orderedOrdinalUnits5, zoneOffsetTs5, zoneOffsetGuessCache5, DateTime5, getBarSize = (value) => {
|
|
202212
202731
|
if (value <= 0)
|
|
202213
202732
|
return 0;
|
|
202214
202733
|
if (value > 0 && value <= 50)
|
|
@@ -248886,7 +249405,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248886
249405
|
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
248887
249406
|
};
|
|
248888
249407
|
timeoutManager = new TimeoutManager;
|
|
248889
|
-
|
|
249408
|
+
isServer3 = typeof window === "undefined" || "Deno" in globalThis;
|
|
248890
249409
|
hasOwn = Object.prototype.hasOwnProperty;
|
|
248891
249410
|
skipToken = /* @__PURE__ */ Symbol();
|
|
248892
249411
|
FocusManager = class extends Subscribable {
|
|
@@ -248896,7 +249415,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248896
249415
|
constructor() {
|
|
248897
249416
|
super();
|
|
248898
249417
|
this.#setup = (onFocus) => {
|
|
248899
|
-
if (!
|
|
249418
|
+
if (!isServer3 && window.addEventListener) {
|
|
248900
249419
|
const listener = () => onFocus();
|
|
248901
249420
|
window.addEventListener("visibilitychange", listener, false);
|
|
248902
249421
|
return () => {
|
|
@@ -248958,7 +249477,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
248958
249477
|
constructor() {
|
|
248959
249478
|
super();
|
|
248960
249479
|
this.#setup = (onOnline) => {
|
|
248961
|
-
if (!
|
|
249480
|
+
if (!isServer3 && window.addEventListener) {
|
|
248962
249481
|
const onlineListener = () => onOnline(true);
|
|
248963
249482
|
const offlineListener = () => onOnline(false);
|
|
248964
249483
|
window.addEventListener("online", onlineListener, false);
|
|
@@ -249502,7 +250021,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
249502
250021
|
#updateStaleTimeout() {
|
|
249503
250022
|
this.#clearStaleTimeout();
|
|
249504
250023
|
const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
|
|
249505
|
-
if (
|
|
250024
|
+
if (isServer3 || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
249506
250025
|
return;
|
|
249507
250026
|
}
|
|
249508
250027
|
const time3 = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
|
|
@@ -249519,7 +250038,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
249519
250038
|
#updateRefetchInterval(nextInterval) {
|
|
249520
250039
|
this.#clearRefetchInterval();
|
|
249521
250040
|
this.#currentRefetchInterval = nextInterval;
|
|
249522
|
-
if (
|
|
250041
|
+
if (isServer3 || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
249523
250042
|
return;
|
|
249524
250043
|
}
|
|
249525
250044
|
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
@@ -250259,6 +250778,7 @@ https://github.com/browserify/crypto-browserify`);
|
|
|
250259
250778
|
SPLIT_UPPER_UPPER_RE4 = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
250260
250779
|
SPLIT_SEPARATE_NUMBER_RE4 = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
250261
250780
|
DEFAULT_STRIP_REGEXP4 = /[^\p{L}\d]+/giu;
|
|
250781
|
+
isServer22 = typeof window === "undefined";
|
|
250262
250782
|
documentEventFunctions3 = makePHEventFunctions3("documentCache");
|
|
250263
250783
|
useDocumentCache3 = documentEventFunctions3.useValue;
|
|
250264
250784
|
setDocumentCache3 = documentEventFunctions3.setValue;
|
|
@@ -252454,7 +252974,8 @@ async function createReactor() {
|
|
|
252454
252974
|
basename: phGlobalConfigFromEnv.routerBasename,
|
|
252455
252975
|
baseUrl: phGlobalConfigFromEnv.renownUrl
|
|
252456
252976
|
}).withCrypto(renownCrypto).build();
|
|
252457
|
-
const
|
|
252977
|
+
const registryCdnUrl = getDefaultRegistryCdnUrl();
|
|
252978
|
+
const packageManager = new BrowserPackageManager(phGlobalConfigFromEnv.routerBasename ?? "", registryCdnUrl);
|
|
252458
252979
|
const commonPackage = await loadCommonPackage();
|
|
252459
252980
|
await packageManager.addLocalPackage("common", commonPackage);
|
|
252460
252981
|
try {
|
|
@@ -252473,7 +252994,10 @@ async function createReactor() {
|
|
|
252473
252994
|
setVetraPackageManager(packageManager);
|
|
252474
252995
|
const documentModelModules = packageManager.packages.flatMap((pkg) => pkg.modules.documentModelModules).filter((module, index, modules) => module !== undefined && modules.findIndex((m2) => m2?.documentType === module.documentType && m2.version === module.version) === index);
|
|
252475
252996
|
const upgradeManifests = packageManager.packages.flatMap((pkg) => pkg.upgradeManifests);
|
|
252476
|
-
const reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown);
|
|
252997
|
+
const reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, registryCdnUrl ? packageManager : undefined);
|
|
252998
|
+
if (reactorClientModule.reactorModule) {
|
|
252999
|
+
packageManager.setDocumentModelRegistry(reactorClientModule.reactorModule.documentModelRegistry);
|
|
253000
|
+
}
|
|
252477
253001
|
const drives = await getDrives(reactorClientModule.client);
|
|
252478
253002
|
const path2 = window.location.pathname;
|
|
252479
253003
|
const driveSlug = extractDriveSlugFromPath(path2);
|
|
@@ -252563,10 +253087,10 @@ var init_reactor2 = __esm(() => {
|
|
|
252563
253087
|
});
|
|
252564
253088
|
|
|
252565
253089
|
// src/store/user.ts
|
|
252566
|
-
import { useEffect as
|
|
253090
|
+
import { useEffect as useEffect35 } from "react";
|
|
252567
253091
|
function useSetSentryUser() {
|
|
252568
253092
|
const user = useUser2();
|
|
252569
|
-
|
|
253093
|
+
useEffect35(() => {
|
|
252570
253094
|
let sentryUser = null;
|
|
252571
253095
|
if (user) {
|
|
252572
253096
|
const { credential, ...rest } = user;
|