@overmap-ai/core 1.0.78-attachment-model-improvements.7 → 1.0.78-attachment-model-improvements.8
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/overmap-core.js +65 -65
- package/dist/overmap-core.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3659,9 +3659,9 @@ class j extends z {
|
|
|
3659
3659
|
const { addOne: n, updateOne: i, deleteOne: a } = this.actions;
|
|
3660
3660
|
let r, o = null, c = null;
|
|
3661
3661
|
if ("file" in e) {
|
|
3662
|
-
const { file: b, ...
|
|
3662
|
+
const { file: b, ...R } = e;
|
|
3663
3663
|
o = await this.client.files.getFilePayload(b), c = URL.createObjectURL(b), r = {
|
|
3664
|
-
...
|
|
3664
|
+
...R,
|
|
3665
3665
|
file_sha1: o.sha1,
|
|
3666
3666
|
file_type: o.file_type,
|
|
3667
3667
|
file_name: b.name,
|
|
@@ -3690,9 +3690,9 @@ class j extends z {
|
|
|
3690
3690
|
}).finally(() => {
|
|
3691
3691
|
c && URL.revokeObjectURL(c);
|
|
3692
3692
|
});
|
|
3693
|
-
const y = m.then(({ instance: b }) => b), T = m.then(async ({ instance: b, presigned_url:
|
|
3693
|
+
const y = m.then(({ instance: b }) => b), T = m.then(async ({ instance: b, presigned_url: R }) => {
|
|
3694
3694
|
try {
|
|
3695
|
-
return
|
|
3695
|
+
return R && await this.client.files.processPresignedUrl(b.file_sha1, R), b.file_sha1;
|
|
3696
3696
|
} catch (M) {
|
|
3697
3697
|
throw console.error("Upload to s3 using presigned url failed.", M), M;
|
|
3698
3698
|
}
|
|
@@ -3702,13 +3702,13 @@ class j extends z {
|
|
|
3702
3702
|
async bulkAdd(e, n) {
|
|
3703
3703
|
const { addMany: i, updateMany: a, deleteMany: r } = this.actions, o = (/* @__PURE__ */ new Date()).toISOString(), c = [], d = /* @__PURE__ */ new Set(), u = et(e, Math.min(n ?? e.length, Qe)), m = [];
|
|
3704
3704
|
console.log("BaseOfflineFileModelApiService", "pre batches");
|
|
3705
|
-
for (const
|
|
3706
|
-
const M = [],
|
|
3707
|
-
for (const q of
|
|
3705
|
+
for (const R of u) {
|
|
3706
|
+
const M = [], E = {};
|
|
3707
|
+
for (const q of R) {
|
|
3708
3708
|
let $;
|
|
3709
3709
|
if ("file" in q) {
|
|
3710
3710
|
const { file: B, ...U } = q, L = await this.client.files.getFilePayload(B);
|
|
3711
|
-
L.sha1 in
|
|
3711
|
+
L.sha1 in E || (E[L.sha1] = L);
|
|
3712
3712
|
const Wt = URL.createObjectURL(B);
|
|
3713
3713
|
d.add(Wt), $ = {
|
|
3714
3714
|
...U,
|
|
@@ -3728,35 +3728,35 @@ class j extends z {
|
|
|
3728
3728
|
const w = {
|
|
3729
3729
|
payloads: M,
|
|
3730
3730
|
submitted_at: o,
|
|
3731
|
-
files: Object.values(
|
|
3731
|
+
files: Object.values(E)
|
|
3732
3732
|
};
|
|
3733
3733
|
m.push(w);
|
|
3734
3734
|
}
|
|
3735
3735
|
this.dispatch(i(c)), console.log("BaseOfflineFileModelApiService", "pre requests");
|
|
3736
|
-
const y = m.map((
|
|
3737
|
-
const { payloads: M } =
|
|
3736
|
+
const y = m.map((R) => {
|
|
3737
|
+
const { payloads: M } = R, E = M.flatMap((q) => this.getBlockers(q)), w = [].concat(M.map((q) => q.uuid)).concat(M.map((q) => q.file_sha1));
|
|
3738
3738
|
return this.enqueueRequest({
|
|
3739
3739
|
description: S(l.POST, this.name, !0),
|
|
3740
3740
|
method: l.POST,
|
|
3741
3741
|
url: `${this.url}/bulk/`,
|
|
3742
|
-
payload:
|
|
3743
|
-
blockers:
|
|
3742
|
+
payload: R,
|
|
3743
|
+
blockers: E,
|
|
3744
3744
|
blocks: w
|
|
3745
3745
|
});
|
|
3746
3746
|
});
|
|
3747
|
-
Promise.all(y).then((
|
|
3748
|
-
const M =
|
|
3747
|
+
Promise.all(y).then((R) => {
|
|
3748
|
+
const M = R.flatMap((E) => E.instances);
|
|
3749
3749
|
this.dispatch(a(M));
|
|
3750
|
-
}).catch((
|
|
3751
|
-
throw this.dispatch(r(c.map((M) => this.getId(M)))),
|
|
3750
|
+
}).catch((R) => {
|
|
3751
|
+
throw this.dispatch(r(c.map((M) => this.getId(M)))), console.error(R), R;
|
|
3752
3752
|
}).finally(() => {
|
|
3753
|
-
for (const
|
|
3754
|
-
URL.revokeObjectURL(
|
|
3753
|
+
for (const R of d)
|
|
3754
|
+
URL.revokeObjectURL(R);
|
|
3755
3755
|
});
|
|
3756
|
-
const T = Promise.all(y).then((
|
|
3756
|
+
const T = Promise.all(y).then((R) => R.flatMap(({ instances: M }) => M)), b = Promise.all(y).then(async (R) => {
|
|
3757
3757
|
const M = [];
|
|
3758
|
-
for (const { presigned_urls:
|
|
3759
|
-
const w = this.client.files.processPresignedUrls(
|
|
3758
|
+
for (const { presigned_urls: E } of R) {
|
|
3759
|
+
const w = this.client.files.processPresignedUrls(E);
|
|
3760
3760
|
for (const [q, $] of Object.entries(w))
|
|
3761
3761
|
try {
|
|
3762
3762
|
await $, M.push(q);
|
|
@@ -4139,10 +4139,10 @@ class mP extends z {
|
|
|
4139
4139
|
}), [u, m];
|
|
4140
4140
|
}
|
|
4141
4141
|
bulkAdd(e, n) {
|
|
4142
|
-
var
|
|
4143
|
-
const { values: i, payloads: a } = e, { addMany: r, setMany: o, deleteMany: c } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), u = ((
|
|
4142
|
+
var R;
|
|
4143
|
+
const { values: i, payloads: a } = e, { addMany: r, setMany: o, deleteMany: c } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), u = ((R = this.client.store.getState().userReducer.currentUser) == null ? void 0 : R.id) ?? null, m = [], y = et(a, Math.min(n ?? a.length, Qe)), T = [];
|
|
4144
4144
|
for (const M of y) {
|
|
4145
|
-
const
|
|
4145
|
+
const E = [];
|
|
4146
4146
|
for (const w of M) {
|
|
4147
4147
|
const q = g({
|
|
4148
4148
|
...w,
|
|
@@ -4150,7 +4150,7 @@ class mP extends z {
|
|
|
4150
4150
|
created_by: u,
|
|
4151
4151
|
submitted_at: d
|
|
4152
4152
|
});
|
|
4153
|
-
m.push(q),
|
|
4153
|
+
m.push(q), E.push({
|
|
4154
4154
|
uuid: q.uuid,
|
|
4155
4155
|
asset: w.asset,
|
|
4156
4156
|
fields_revision: w.fields_revision,
|
|
@@ -4162,13 +4162,13 @@ class mP extends z {
|
|
|
4162
4162
|
T.push({
|
|
4163
4163
|
submitted_at: d,
|
|
4164
4164
|
values: i,
|
|
4165
|
-
field_values:
|
|
4165
|
+
field_values: E
|
|
4166
4166
|
});
|
|
4167
4167
|
}
|
|
4168
4168
|
this.dispatch(r(m));
|
|
4169
4169
|
const b = [];
|
|
4170
4170
|
for (const M of T) {
|
|
4171
|
-
const { field_values:
|
|
4171
|
+
const { field_values: E } = M, w = E.map(({ asset: B }) => B), q = E.map(({ fields_revision: B }) => B), $ = E.map(({ asset_procedure: B }) => B), V = E.map(({ uuid: B }) => B), Je = this.enqueueRequest({
|
|
4172
4172
|
description: S(l.POST, this.name, !0),
|
|
4173
4173
|
method: l.POST,
|
|
4174
4174
|
url: `${this.url}/bulk/`,
|
|
@@ -4705,10 +4705,10 @@ class OP extends z {
|
|
|
4705
4705
|
}), [u, m];
|
|
4706
4706
|
}
|
|
4707
4707
|
bulkAdd(e, n) {
|
|
4708
|
-
var
|
|
4709
|
-
const { payloads: i, values: a } = e, { addMany: r, setMany: o, deleteMany: c } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), u = ((
|
|
4708
|
+
var R;
|
|
4709
|
+
const { payloads: i, values: a } = e, { addMany: r, setMany: o, deleteMany: c } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), u = ((R = this.client.store.getState().userReducer.currentUser) == null ? void 0 : R.id) ?? null, m = [], y = et(i, Math.min(n ?? i.length, Qe)), T = [];
|
|
4710
4710
|
for (const M of y) {
|
|
4711
|
-
const
|
|
4711
|
+
const E = [];
|
|
4712
4712
|
for (const w of M) {
|
|
4713
4713
|
const q = g({
|
|
4714
4714
|
...w,
|
|
@@ -4716,7 +4716,7 @@ class OP extends z {
|
|
|
4716
4716
|
created_by: u,
|
|
4717
4717
|
submitted_at: d
|
|
4718
4718
|
});
|
|
4719
|
-
m.push(q),
|
|
4719
|
+
m.push(q), E.push({
|
|
4720
4720
|
uuid: q.uuid,
|
|
4721
4721
|
asset: w.asset,
|
|
4722
4722
|
fields_revision: w.fields_revision,
|
|
@@ -4729,13 +4729,13 @@ class OP extends z {
|
|
|
4729
4729
|
T.push({
|
|
4730
4730
|
submitted_at: d,
|
|
4731
4731
|
values: a,
|
|
4732
|
-
field_values:
|
|
4732
|
+
field_values: E
|
|
4733
4733
|
});
|
|
4734
4734
|
}
|
|
4735
4735
|
this.dispatch(r(m));
|
|
4736
4736
|
const b = [];
|
|
4737
4737
|
for (const M of T) {
|
|
4738
|
-
const { field_values:
|
|
4738
|
+
const { field_values: E } = M, w = E.map(({ asset: B }) => B), q = E.map(({ fields_revision: B }) => B), $ = E.map(({ asset_procedure: B }) => B), V = E.map(({ uuid: B }) => B), Je = this.enqueueRequest({
|
|
4739
4739
|
description: S(l.POST, this.name, !0),
|
|
4740
4740
|
method: l.POST,
|
|
4741
4741
|
url: `${this.url}/bulk/`,
|
|
@@ -5010,15 +5010,15 @@ class gP extends z {
|
|
|
5010
5010
|
}), c = [];
|
|
5011
5011
|
let d = null;
|
|
5012
5012
|
for (const u of o) {
|
|
5013
|
-
const { batchId: m, payload: y } = u, T = y.assets.map(({ uuid: w }) => w), b = y.assets.map(({ asset_type: w }) => w),
|
|
5013
|
+
const { batchId: m, payload: y } = u, T = y.assets.map(({ uuid: w }) => w), b = y.assets.map(({ asset_type: w }) => w), R = y.assets.map(({ project: w }) => w), M = y.assets.map(({ status: w }) => w), E = this.enqueueRequest({
|
|
5014
5014
|
description: S(l.POST, this.name, !0),
|
|
5015
5015
|
method: l.POST,
|
|
5016
5016
|
url: `${this.url}/bulk/`,
|
|
5017
5017
|
payload: y,
|
|
5018
|
-
blockers: (d ? [d] : []).concat(b).concat(
|
|
5018
|
+
blockers: (d ? [d] : []).concat(b).concat(R).concat(M),
|
|
5019
5019
|
blocks: [m].concat(T)
|
|
5020
5020
|
});
|
|
5021
|
-
d = u.batchId, c.push(
|
|
5021
|
+
d = u.batchId, c.push(E);
|
|
5022
5022
|
}
|
|
5023
5023
|
return Promise.all(c).then((u) => {
|
|
5024
5024
|
const m = u.flat();
|
|
@@ -5044,17 +5044,17 @@ class gP extends z {
|
|
|
5044
5044
|
const u = et(e, Math.min(n ?? e.length, Qe)), m = [];
|
|
5045
5045
|
let y = null;
|
|
5046
5046
|
for (const T of u) {
|
|
5047
|
-
const b = Xe(),
|
|
5047
|
+
const b = Xe(), R = k(T), M = T.map(({ status: w }) => w).filter(Boolean), E = this.enqueueRequest({
|
|
5048
5048
|
description: S(l.PATCH, this.name, !0),
|
|
5049
5049
|
method: l.PATCH,
|
|
5050
5050
|
url: `${this.url}/bulk/`,
|
|
5051
5051
|
payload: {
|
|
5052
5052
|
payloads: T
|
|
5053
5053
|
},
|
|
5054
|
-
blockers: (y ? [y] : []).concat(
|
|
5055
|
-
blocks: [b].concat(
|
|
5054
|
+
blockers: (y ? [y] : []).concat(R).concat(M),
|
|
5055
|
+
blocks: [b].concat(R)
|
|
5056
5056
|
});
|
|
5057
|
-
m.push(
|
|
5057
|
+
m.push(E), y = b;
|
|
5058
5058
|
}
|
|
5059
5059
|
return Promise.all(m).then((T) => {
|
|
5060
5060
|
this.dispatch(a(T.flat()));
|
|
@@ -5591,20 +5591,20 @@ class RP extends z {
|
|
|
5591
5591
|
bulkAdd(e, n) {
|
|
5592
5592
|
var b;
|
|
5593
5593
|
const { payloads: i, values: a } = e, { addMany: r, setMany: o, deleteMany: c } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), u = [], m = et(i, Math.min(n ?? i.length, Qe)), y = [];
|
|
5594
|
-
for (const
|
|
5594
|
+
for (const R of m) {
|
|
5595
5595
|
const M = [];
|
|
5596
|
-
for (const
|
|
5596
|
+
for (const E of R) {
|
|
5597
5597
|
const w = g({
|
|
5598
|
-
...
|
|
5599
|
-
values:
|
|
5598
|
+
...E,
|
|
5599
|
+
values: E.values,
|
|
5600
5600
|
created_by: ((b = this.client.store.getState().userReducer.currentUser) == null ? void 0 : b.id) ?? null,
|
|
5601
5601
|
submitted_at: d
|
|
5602
5602
|
});
|
|
5603
5603
|
u.push(w), M.push({
|
|
5604
5604
|
uuid: w.uuid,
|
|
5605
|
-
asset:
|
|
5606
|
-
fields_revision:
|
|
5607
|
-
published_at:
|
|
5605
|
+
asset: E.asset,
|
|
5606
|
+
fields_revision: E.fields_revision,
|
|
5607
|
+
published_at: E.published_at,
|
|
5608
5608
|
values: w.values
|
|
5609
5609
|
});
|
|
5610
5610
|
}
|
|
@@ -5616,19 +5616,19 @@ class RP extends z {
|
|
|
5616
5616
|
}
|
|
5617
5617
|
this.dispatch(r(u));
|
|
5618
5618
|
const T = [];
|
|
5619
|
-
for (const
|
|
5620
|
-
const { field_values: M } =
|
|
5619
|
+
for (const R of y) {
|
|
5620
|
+
const { field_values: M } = R, E = M.map(({ asset: V }) => V), w = M.map(({ fields_revision: V }) => V), q = M.map(({ uuid: V }) => V), $ = this.enqueueRequest({
|
|
5621
5621
|
description: S(l.POST, this.name, !0),
|
|
5622
5622
|
method: l.POST,
|
|
5623
5623
|
url: `${this.url}/bulk/`,
|
|
5624
|
-
payload:
|
|
5625
|
-
blockers:
|
|
5624
|
+
payload: R,
|
|
5625
|
+
blockers: E.concat(w),
|
|
5626
5626
|
blocks: q
|
|
5627
5627
|
});
|
|
5628
5628
|
T.push($);
|
|
5629
5629
|
}
|
|
5630
|
-
return Promise.all(T).then((
|
|
5631
|
-
this.dispatch(o(
|
|
5630
|
+
return Promise.all(T).then((R) => {
|
|
5631
|
+
this.dispatch(o(R.flat()));
|
|
5632
5632
|
}).catch(() => {
|
|
5633
5633
|
this.dispatch(c(k(u)));
|
|
5634
5634
|
}), [u, T];
|
|
@@ -6478,7 +6478,7 @@ class jP extends rt {
|
|
|
6478
6478
|
if ("warning" in n) {
|
|
6479
6479
|
if (n.warning === "already_uploaded")
|
|
6480
6480
|
return Promise.resolve(void 0);
|
|
6481
|
-
throw new Error(n.warning);
|
|
6481
|
+
throw console.error(n.warning), new Error(n.warning);
|
|
6482
6482
|
}
|
|
6483
6483
|
return this.enqueueRequest({
|
|
6484
6484
|
url: n.url,
|
|
@@ -7554,17 +7554,17 @@ class JP extends z {
|
|
|
7554
7554
|
const u = et(e, Math.min(n ?? e.length, Qe)), m = [];
|
|
7555
7555
|
let y = null;
|
|
7556
7556
|
for (const T of u) {
|
|
7557
|
-
const b = Xe(),
|
|
7557
|
+
const b = Xe(), R = k(T), M = T.map(({ status: w }) => w).filter(Boolean), E = this.enqueueRequest({
|
|
7558
7558
|
description: S(l.PATCH, this.name, !0),
|
|
7559
7559
|
method: l.PATCH,
|
|
7560
7560
|
url: `${this.url}/bulk/`,
|
|
7561
7561
|
payload: {
|
|
7562
7562
|
payloads: T
|
|
7563
7563
|
},
|
|
7564
|
-
blockers: (y ? [y] : []).concat(
|
|
7565
|
-
blocks: [b].concat(
|
|
7564
|
+
blockers: (y ? [y] : []).concat(R).concat(M),
|
|
7565
|
+
blocks: [b].concat(R)
|
|
7566
7566
|
});
|
|
7567
|
-
m.push(
|
|
7567
|
+
m.push(E), y = b;
|
|
7568
7568
|
}
|
|
7569
7569
|
return Promise.all(m).then((T) => {
|
|
7570
7570
|
this.dispatch(a(T.flat()));
|
|
@@ -9143,28 +9143,28 @@ async function or(t, s, e, n, i) {
|
|
|
9143
9143
|
attachmentHash: y,
|
|
9144
9144
|
isExternalUrl: T,
|
|
9145
9145
|
isAuthNeeded: b,
|
|
9146
|
-
isResponseBlob:
|
|
9146
|
+
isResponseBlob: R
|
|
9147
9147
|
} = {
|
|
9148
9148
|
...r,
|
|
9149
9149
|
...s
|
|
9150
9150
|
};
|
|
9151
9151
|
let M = s.url;
|
|
9152
|
-
const
|
|
9153
|
-
if (y && !
|
|
9152
|
+
const E = y ? await e.files.fetchCache(y) : void 0;
|
|
9153
|
+
if (y && !E)
|
|
9154
9154
|
throw new Error(`Cannot upload file ${y} because it's not cached.`);
|
|
9155
9155
|
!T && !M.startsWith("http") && (!M.startsWith("/") && !M.startsWith("blob:") && (M = "/" + M), M = t + M);
|
|
9156
9156
|
const w = (B) => {
|
|
9157
9157
|
if (y) {
|
|
9158
9158
|
if (!o) throw new Error(`No S3 URL for file ${y}`);
|
|
9159
9159
|
if ("warning" in o) throw new Error(`S3 URL warning for file ${y}`);
|
|
9160
|
-
if (!
|
|
9160
|
+
if (!E) throw new Error(`No file for file ${y}`);
|
|
9161
9161
|
const U = o.fields["x-amz-checksum-sha1"];
|
|
9162
9162
|
if (!U) throw new Error(`No checksum for file ${y}`);
|
|
9163
|
-
return B.set("x-amz-checksum-sha1", U).field({ ...c, ...o.fields }).attach("file",
|
|
9163
|
+
return B.set("x-amz-checksum-sha1", U).field({ ...c, ...o.fields }).attach("file", E);
|
|
9164
9164
|
}
|
|
9165
9165
|
return B.send(c);
|
|
9166
9166
|
}, $ = {
|
|
9167
|
-
[l.GET]: () =>
|
|
9167
|
+
[l.GET]: () => R ? tt.get(M.toString()).responseType("blob") : tt.get(M.toString()),
|
|
9168
9168
|
[l.POST]: () => {
|
|
9169
9169
|
const B = tt.post(M.toString());
|
|
9170
9170
|
return w(B);
|
|
@@ -4,11 +4,11 @@ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
|
|
|
4
4
|
Action:`,s);const p=at();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const r=at();if(!r)throw new Error("Outbox coordinator not set");return r.registerRetry(s.payload.uuid),!1}function wF(t,s,e){var n;return(n=at())==null?void 0:n.peek()}function EF(t,s){return lt().dispatch(eT(new Date().getTime())),Kn}const dt="An unknown error occurred",vF=500,YI=["non_field_errors","detail"];function VF(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?YI.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?YI.includes(a)?c.join(`
|
|
5
5
|
`):c.map(d=>`${a}: ${d}`).join(`
|
|
6
6
|
`):`${a}: ${JSON.stringify(c)}`).join(`
|
|
7
|
-
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>vF?dt:e}class C extends Error{constructor(e){super(dt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??VF(n,a)??dt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function ZI(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class BF extends CI{constructor(s){super(s)}}class it extends CI{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class zF extends it{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(da(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ua(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ra(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(ca(n)),n}}function nt(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends it{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class q extends v{constructor(){super(...arguments);y(this,"pageSize",qI)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,l=null,r=null;if("file"in e){const{file:b,...w}=e;l=await this.client.files.getFilePayload(b),r=URL.createObjectURL(b),d={...w,file_sha1:l.sha1,file_type:l.file_type,file_name:b.name,file_extension:l.extension,file_url:r}}else d=e;const u=this.buildModel(d),h=this.buildPayload(u);this.dispatch(n(u));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...h,...l?{file:l}:{}},blockers:this.getBlockers(h),blocks:[this.getId(u)]});p.then(({instance:b})=>{this.dispatch(a(b))}).catch(b=>{throw this.dispatch(c(this.getId(u))),b}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=p.then(({instance:b})=>b),I=p.then(async({instance:b,presigned_url:w})=>{try{return w&&await this.client.files.processPresignedUrl(b.file_sha1,w),b.file_sha1}catch(M){throw console.error("Upload to s3 using presigned url failed.",M),M}});return[u,A,I]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=[],u=new Set,h=nt(e,Math.min(n??e.length,Qe)),p=[];console.log("BaseOfflineFileModelApiService","pre batches");for(const w of h){const M=[],R={};for(const z of w){let U;if("file"in z){const{file:V,...N}=z,Je=await this.client.files.getFilePayload(V);Je.sha1 in R||(R[Je.sha1]=Je);const dO=URL.createObjectURL(V);u.add(dO),U={...N,file_sha1:Je.sha1,file_type:Je.file_type,file_name:V.name,file_extension:Je.extension,file_url:dO}}else U=z;const D=this.buildModel(U);r.push(D);const xe=this.buildPayload(D);M.push(xe)}const _={payloads:M,submitted_at:l,files:Object.values(R)};p.push(_)}this.dispatch(a(r)),console.log("BaseOfflineFileModelApiService","pre requests");const A=p.map(w=>{const{payloads:M}=w,R=M.flatMap(z=>this.getBlockers(z)),_=[].concat(M.map(z=>z.uuid)).concat(M.map(z=>z.file_sha1));return this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:w,blockers:R,blocks:_})});Promise.all(A).then(w=>{const M=w.flatMap(R=>R.instances);this.dispatch(c(M))}).catch(w=>{throw this.dispatch(d(r.map(M=>this.getId(M)))),w}).finally(()=>{for(const w of u)URL.revokeObjectURL(w)});const I=Promise.all(A).then(w=>w.flatMap(({instances:M})=>M)),b=Promise.all(A).then(async w=>{const M=[];for(const{presigned_urls:R}of w){const _=this.client.files.processPresignedUrls(R);for(const[z,U]of Object.entries(_))try{await U,M.push(z)}catch(D){throw console.error("Upload to s3 using presigned url failed.",D),D}}return M});return console.log("BaseOfflineFileModelApiService","pre return"),[r,I,b]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const r=this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),r}}class jF extends q{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:ma,addMany:xt,setOne:ya,setMany:pa,updateOne:Aa,updateMany:fa,deleteOne:Sa,deleteMany:es,initialize:ha});y(this,"selectors",{selectById:Ia,selectByIds:Oa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class DF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ma,addMany:_a,setOne:Ra,setMany:wa,updateOne:Ea,updateMany:va,deleteOne:Va,deleteMany:Ba,initialize:ba});y(this,"selectors",{selectById:Da,selectByIds:qa})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}buildModel(e){var A;const{store:n}=this.client,{asset_procedure_type:a,file_sha1:c,file_extension:d,file_name:l,file_type:r,file_url:u}=e,h=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,p=new Date().toISOString();return P({file_url:u,file_sha1:c,file_extension:d,file_name:l,file_type:r,created_by:h,submitted_at:p,asset_procedure_type:a})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class qF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Ua,addMany:La,setOne:Na,setMany:Ga,updateOne:ka,updateMany:Ha,deleteOne:Ka,deleteMany:Wa,initialize:Ca});y(this,"selectors",{selectById:Ja,selectByIds:Xa})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class $F extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:ec,addMany:tc,setOne:sc,setMany:ic,updateOne:nc,updateMany:ac,deleteOne:cc,deleteMany:dc,initialize:xa});y(this,"selectors",{selectById:lc,selectByIds:oc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class CF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:yc,addMany:rs,setOne:pc,setMany:Ac,updateOne:fc,updateMany:Sc,deleteOne:Tc,deleteMany:us,initialize:mc});y(this,"selectors",{selectById:Pc,selectByIds:Fc})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class UF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:_c,addMany:Rc,setOne:wc,setMany:Ec,updateOne:vc,updateMany:Vc,deleteOne:Bc,deleteMany:zc,initialize:Mc});y(this,"selectors",{selectById:qc,selectByIds:$c})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{values:a,payloads:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=nt(c,Math.min(n??c.length,Qe)),I=[];for(const M of A){const R=[];for(const _ of M){const z=P({..._,values:_.values,created_by:h,submitted_at:u});p.push(z),R.push({uuid:z.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,published_at:_.published_at,values:z.values})}I.push({submitted_at:u,values:a,field_values:R})}this.dispatch(d(p));const b=[];for(const M of I){const{field_values:R}=M,_=R.map(({asset:V})=>V),z=R.map(({fields_revision:V})=>V),U=R.map(({asset_procedure:V})=>V),D=R.map(({uuid:V})=>V),xe=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:M,blockers:_.concat(z).concat(U),blocks:D});b.push(xe)}return Promise.all(b).then(M=>{this.dispatch(l(M.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,b]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=gc(e)(l);this.dispatch(a(e)),this.dispatch(us(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(rs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class LF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Lc,addMany:ms,setOne:Hc,setMany:Kc,updateOne:Nc,updateMany:Gc,deleteOne:kc,deleteMany:ys,initialize:Uc});y(this,"selectors",{selectById:Jc,selectByIds:Xc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_procedure_type,e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class NF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:ed,addMany:td,setOne:cd,setMany:dd,updateOne:sd,updateMany:id,deleteOne:nd,deleteMany:ad,initialize:xc});y(this,"selectors",{selectById:ld,selectByIds:od})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=Zc(e)(l);this.dispatch(a(e)),this.dispatch(ys(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ms(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class GF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:yd,addMany:pd,setOne:Ad,setMany:fd,updateOne:Sd,updateMany:Td,deleteOne:Id,deleteMany:Od,initialize:md});y(this,"selectors",{selectById:Fd,selectByIds:gd})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class kF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:Rd,addMany:wd,setOne:Ed,setMany:vd,updateOne:Vd,updateMany:Bd,deleteOne:zd,deleteMany:jd,initialize:_d});y(this,"selectors",{selectById:Dd,selectByIds:qd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_step],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const l=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(c)),r}),[d,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(d)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class HF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Ld,addMany:Ps,setOne:Nd,setMany:Gd,updateOne:kd,updateMany:Hd,deleteOne:Kd,deleteMany:Fs,initialize:Ud});y(this,"selectors",{selectById:Yd,selectByIds:Zd})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class KF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:er,addMany:tr,setOne:sr,setMany:ir,updateOne:nr,updateMany:ar,deleteOne:cr,deleteMany:dr,initialize:xd});y(this,"selectors",{selectById:ur,selectByIds:lr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=nt(a,Math.min(n??a.length,Qe)),I=[];for(const M of A){const R=[];for(const _ of M){const z=P({..._,values:_.values,created_by:h,submitted_at:u});p.push(z),R.push({uuid:z.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,asset_procedure_step:_.asset_procedure_step,published_at:_.published_at,values:z.values})}I.push({submitted_at:u,values:c,field_values:R})}this.dispatch(d(p));const b=[];for(const M of I){const{field_values:R}=M,_=R.map(({asset:V})=>V),z=R.map(({fields_revision:V})=>V),U=R.map(({asset_procedure:V})=>V),D=R.map(({uuid:V})=>V),xe=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:M,blockers:_.concat(z).concat(U),blocks:D});b.push(xe)}return Promise.all(b).then(M=>{this.dispatch(l(M.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,b]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Jd(e)(l);this.dispatch(a(e)),this.dispatch(Fs(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ps(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class WF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Ar,addMany:fr,setOne:yr,setMany:pr,updateOne:Sr,updateMany:Tr,deleteOne:Ir,deleteMany:Or,initialize:mr});y(this,"selectors",{selectById:Fr,selectByIds:gr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:d,deleteOne:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=br(e)(u);this.dispatch(l(e)),this.dispatch(a(B(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(d(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class YF extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:Rr,addMany:ws,setOne:Vr,setMany:Br,updateOne:wr,updateMany:Er,deleteOne:vr,deleteMany:Es,initialize:_r});y(this,"selectors",{selectById:Dr,selectByIds:qr})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset with uuid ${e} found in the store`);const u=Pa(e)(l),h=Dy(e)(l);this.dispatch(c(e)),this.dispatch(es(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(xt(u)),this.dispatch(et(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Xe.v4(),l=nt(e,Math.min(n??e.length,Qe)).map(h=>{const p=h.map(A=>P(A));return{batchId:Xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),r=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,I=A.assets.map(({uuid:_})=>_),b=A.assets.map(({asset_type:_})=>_),w=A.assets.map(({project:_})=>_),M=A.assets.map(({status:_})=>_),R=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:(u?[u]:[]).concat(b).concat(w).concat(M),blocks:[p].concat(I)});u=h.batchId,r.push(R)}return Promise.all(r).then(h=>{const p=h.flat();this.dispatch(a(p))}),r}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=B(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Zt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} assets that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=nt(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const b=Xe.v4(),w=B(I),M=I.map(({status:_})=>_).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(M),blocks:[b].concat(w)});p.push(R),A=b}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class ZF extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Lr,addMany:Nr,setOne:Gr,setMany:kr,updateOne:Hr,updateMany:Kr,deleteOne:Wr,deleteMany:Yr,initialize:Ur});y(this,"selectors",{selectById:Qr,selectByIds:xr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_stage],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=e.map(b=>P(b)),h=u.map(b=>({...b,created_by:r,submitted_at:l})),p=h.map(({uuid:b})=>b);this.dispatch(a(h));const A=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:u},blockers:[...e.map(b=>b.asset_procedure),...e.map(b=>b.asset_stage),...e.map(b=>b.asset)],blocks:p});return A.then(b=>{this.dispatch(c(b))}).catch(()=>{this.dispatch(d(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class JF extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:nu,addMany:au,setOne:su,setMany:iu,updateOne:cu,updateMany:du,deleteOne:ru,deleteMany:uu,initialize:tu});y(this,"selectors",{selectById:ou,selectByIds:hu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class XF extends q{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:pu,addMany:Ds,setOne:Au,setMany:fu,updateOne:Su,updateMany:Tu,deleteOne:Iu,deleteMany:qs,initialize:yu});y(this,"selectors",{selectById:Pu,selectByIds:Fu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class QF extends q{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:Ru,addMany:wu,setOne:Eu,setMany:vu,updateOne:Vu,updateMany:Bu,deleteOne:zu,deleteMany:ju,initialize:_u});y(this,"selectors",{selectById:qu,selectByIds:$u})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class xF extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Nu,addMany:Gu,setOne:ku,setMany:Hu,updateOne:Ku,updateMany:Wu,deleteOne:Yu,deleteMany:Zu,initialize:Lu});y(this,"selectors",{selectById:Xu,selectByIds:Qu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class eg extends q{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:sl,addMany:Gs,setOne:il,setMany:nl,updateOne:al,updateMany:cl,deleteOne:dl,deleteMany:ks,initialize:tl});y(this,"selectors",{selectById:ul,selectByIds:ll})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class tg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:pl,addMany:Al,setOne:fl,setMany:Sl,updateOne:Tl,updateMany:Il,deleteOne:Ol,deleteMany:Pl,initialize:yl});y(this,"selectors",{selectById:gl,selectByIds:bl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var b;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=[],p=nt(a,Math.min(n??a.length,Qe)),A=[];for(const w of p){const M=[];for(const R of w){const _=P({...R,values:R.values,created_by:((b=this.client.store.getState().userReducer.currentUser)==null?void 0:b.id)??null,submitted_at:u});h.push(_),M.push({uuid:_.uuid,asset:R.asset,fields_revision:R.fields_revision,published_at:R.published_at,values:_.values})}A.push({submitted_at:u,values:c,field_values:M})}this.dispatch(d(h));const I=[];for(const w of A){const{field_values:M}=w,R=M.map(({asset:D})=>D),_=M.map(({fields_revision:D})=>D),z=M.map(({uuid:D})=>D),U=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:w,blockers:R.concat(_),blocks:z});I.push(U)}return Promise.all(I).then(w=>{this.dispatch(l(w.flat()))}).catch(()=>{this.dispatch(r(B(h)))}),[h,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.asset],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=ol(e)(l);this.dispatch(a(e)),this.dispatch(ks(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Gs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class sg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:wl,addMany:El,setOne:vl,setMany:Vl,updateOne:Bl,updateMany:zl,deleteOne:jl,deleteMany:Dl,initialize:Rl});y(this,"selectors",{selectById:$l,selectByIds:Cl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ig extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Gl,addMany:kl,setOne:Hl,setMany:Kl,updateOne:Wl,updateMany:Yl,deleteOne:Zl,deleteMany:Jl,initialize:Nl});y(this,"selectors",{selectById:Ql,selectByIds:xl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ng extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:ao,addMany:co,setOne:io,setMany:no,updateOne:ro,updateMany:uo,deleteOne:lo,deleteMany:oo,initialize:so});y(this,"selectors",{selectById:mo,selectByIds:yo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=jr(e)(l),h=gu(e)(l);this.dispatch(a(e)),this.dispatch(Es(B(u))),this.dispatch(qs(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(ws(u)),this.dispatch(Ds(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ag extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:So,addMany:To,setOne:Io,setMany:Oo,updateOne:Po,updateMany:Fo,deleteOne:go,deleteMany:bo,initialize:fo});y(this,"selectors",{selectById:_o,selectByIds:Ro})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class cg extends q{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:jo,addMany:Do,setOne:qo,setMany:$o,updateOne:Co,updateMany:Uo,deleteOne:Lo,deleteMany:No,initialize:zo});y(this,"selectors",{selectById:ko,selectByIds:Ho})}getId(e){return e.uuid}getBlockers(e){throw[e.document]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[a,c,d]=await super.bulkAdd(e,n),l={};for(const{file_sha1:r,uuid:u}of a)r in l||(l[r]=[]),l[r].push(u);return d.then(r=>{const u=r.flatMap(h=>l[h]??[]);for(const h of u)this.makeReadable(h)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class dg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:Zo,addMany:Jo,setOne:Xo,setMany:Qo,updateOne:xo,updateMany:eh,deleteOne:th,deleteMany:sh,initialize:Yo});y(this,"selectors",{selectById:nh,selectByIds:ah})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:u.parent_document?[u.parent_document]:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:d,deleteMany:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=ch(e)(u);this.dispatch(a(e)),this.dispatch(l(B(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(d(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class rt extends it{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class rg extends rt{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:uh,addMany:lh,setOne:oh,setMany:hh,updateOne:mh,updateMany:yh,deleteOne:ph,deleteMany:Ah,initialize:rh});y(this,"selectors",{selectById:Sh,selectByIds:Th})}async add(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ug extends it{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const At={},zn=new Set;class lg extends it{constructor(){super(...arguments);y(this,"host");y(this,"dbPromise",mO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async getDB(){return await this.dbPromise}async addCache(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Tt(e);if(zn.has(n))return;const a=await this.getDB();!!await a.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,n),zn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),zn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async getPresignedUploadUrl(e){const{sha1:n,file_type:a,size:c,extension:d}=await this.getFilePayload(e),l=Wt(n,d),r={sha1:n,file_type:a,extension:d,size:c};return await this.enqueueRequest({description:"Create S3 upload url",method:m.POST,url:"/authentication/files/presigned-upload-url/",payload:r,blockers:[],blocks:[`s3-${l}`]})}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=Wt(e,Yt(n)),c={file_name:n.name,file_sha1:e,file:a},d=await this.getPresignedUploadUrl(n);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const l=d.url,r=this.enqueueRequest({url:l,description:"Upload file",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:d});return[c,r]}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let l;c in At?l=At[c]:Jn(e)?(l=Zn(e,a),At[c]=l):(l=new Promise(h=>{this.performRequest({method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const A=new File([p],a,{type:p.type});h(A)})}),At[c]=l);let r;try{r=await l}catch(h){throw h instanceof C&&delete At[c],h}const u=await Tt(r);if(u!==n){const h=`The hash of the file returned from the server (${u}) does not match the
|
|
7
|
+
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>vF?dt:e}class C extends Error{constructor(e){super(dt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??VF(n,a)??dt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function ZI(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class BF extends CI{constructor(s){super(s)}}class it extends CI{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class zF extends it{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(da(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ua(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ra(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(ca(n)),n}}function nt(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends it{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class q extends v{constructor(){super(...arguments);y(this,"pageSize",qI)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,l=null,r=null;if("file"in e){const{file:b,...R}=e;l=await this.client.files.getFilePayload(b),r=URL.createObjectURL(b),d={...R,file_sha1:l.sha1,file_type:l.file_type,file_name:b.name,file_extension:l.extension,file_url:r}}else d=e;const u=this.buildModel(d),h=this.buildPayload(u);this.dispatch(n(u));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...h,...l?{file:l}:{}},blockers:this.getBlockers(h),blocks:[this.getId(u)]});p.then(({instance:b})=>{this.dispatch(a(b))}).catch(b=>{throw this.dispatch(c(this.getId(u))),b}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=p.then(({instance:b})=>b),I=p.then(async({instance:b,presigned_url:R})=>{try{return R&&await this.client.files.processPresignedUrl(b.file_sha1,R),b.file_sha1}catch(M){throw console.error("Upload to s3 using presigned url failed.",M),M}});return[u,A,I]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=[],u=new Set,h=nt(e,Math.min(n??e.length,Qe)),p=[];console.log("BaseOfflineFileModelApiService","pre batches");for(const R of h){const M=[],w={};for(const z of R){let U;if("file"in z){const{file:V,...N}=z,Je=await this.client.files.getFilePayload(V);Je.sha1 in w||(w[Je.sha1]=Je);const dO=URL.createObjectURL(V);u.add(dO),U={...N,file_sha1:Je.sha1,file_type:Je.file_type,file_name:V.name,file_extension:Je.extension,file_url:dO}}else U=z;const D=this.buildModel(U);r.push(D);const xe=this.buildPayload(D);M.push(xe)}const _={payloads:M,submitted_at:l,files:Object.values(w)};p.push(_)}this.dispatch(a(r)),console.log("BaseOfflineFileModelApiService","pre requests");const A=p.map(R=>{const{payloads:M}=R,w=M.flatMap(z=>this.getBlockers(z)),_=[].concat(M.map(z=>z.uuid)).concat(M.map(z=>z.file_sha1));return this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:R,blockers:w,blocks:_})});Promise.all(A).then(R=>{const M=R.flatMap(w=>w.instances);this.dispatch(c(M))}).catch(R=>{throw this.dispatch(d(r.map(M=>this.getId(M)))),console.error(R),R}).finally(()=>{for(const R of u)URL.revokeObjectURL(R)});const I=Promise.all(A).then(R=>R.flatMap(({instances:M})=>M)),b=Promise.all(A).then(async R=>{const M=[];for(const{presigned_urls:w}of R){const _=this.client.files.processPresignedUrls(w);for(const[z,U]of Object.entries(_))try{await U,M.push(z)}catch(D){throw console.error("Upload to s3 using presigned url failed.",D),D}}return M});return console.log("BaseOfflineFileModelApiService","pre return"),[r,I,b]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const r=this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),r}}class jF extends q{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:ma,addMany:xt,setOne:ya,setMany:pa,updateOne:Aa,updateMany:fa,deleteOne:Sa,deleteMany:es,initialize:ha});y(this,"selectors",{selectById:Ia,selectByIds:Oa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class DF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ma,addMany:_a,setOne:Ra,setMany:wa,updateOne:Ea,updateMany:va,deleteOne:Va,deleteMany:Ba,initialize:ba});y(this,"selectors",{selectById:Da,selectByIds:qa})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}buildModel(e){var A;const{store:n}=this.client,{asset_procedure_type:a,file_sha1:c,file_extension:d,file_name:l,file_type:r,file_url:u}=e,h=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,p=new Date().toISOString();return P({file_url:u,file_sha1:c,file_extension:d,file_name:l,file_type:r,created_by:h,submitted_at:p,asset_procedure_type:a})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class qF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Ua,addMany:La,setOne:Na,setMany:Ga,updateOne:ka,updateMany:Ha,deleteOne:Ka,deleteMany:Wa,initialize:Ca});y(this,"selectors",{selectById:Ja,selectByIds:Xa})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class $F extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:ec,addMany:tc,setOne:sc,setMany:ic,updateOne:nc,updateMany:ac,deleteOne:cc,deleteMany:dc,initialize:xa});y(this,"selectors",{selectById:lc,selectByIds:oc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class CF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:yc,addMany:rs,setOne:pc,setMany:Ac,updateOne:fc,updateMany:Sc,deleteOne:Tc,deleteMany:us,initialize:mc});y(this,"selectors",{selectById:Pc,selectByIds:Fc})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class UF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:_c,addMany:Rc,setOne:wc,setMany:Ec,updateOne:vc,updateMany:Vc,deleteOne:Bc,deleteMany:zc,initialize:Mc});y(this,"selectors",{selectById:qc,selectByIds:$c})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var R;const{values:a,payloads:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((R=this.client.store.getState().userReducer.currentUser)==null?void 0:R.id)??null,p=[],A=nt(c,Math.min(n??c.length,Qe)),I=[];for(const M of A){const w=[];for(const _ of M){const z=P({..._,values:_.values,created_by:h,submitted_at:u});p.push(z),w.push({uuid:z.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,published_at:_.published_at,values:z.values})}I.push({submitted_at:u,values:a,field_values:w})}this.dispatch(d(p));const b=[];for(const M of I){const{field_values:w}=M,_=w.map(({asset:V})=>V),z=w.map(({fields_revision:V})=>V),U=w.map(({asset_procedure:V})=>V),D=w.map(({uuid:V})=>V),xe=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:M,blockers:_.concat(z).concat(U),blocks:D});b.push(xe)}return Promise.all(b).then(M=>{this.dispatch(l(M.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,b]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=gc(e)(l);this.dispatch(a(e)),this.dispatch(us(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(rs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class LF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Lc,addMany:ms,setOne:Hc,setMany:Kc,updateOne:Nc,updateMany:Gc,deleteOne:kc,deleteMany:ys,initialize:Uc});y(this,"selectors",{selectById:Jc,selectByIds:Xc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_procedure_type,e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class NF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:ed,addMany:td,setOne:cd,setMany:dd,updateOne:sd,updateMany:id,deleteOne:nd,deleteMany:ad,initialize:xc});y(this,"selectors",{selectById:ld,selectByIds:od})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=Zc(e)(l);this.dispatch(a(e)),this.dispatch(ys(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ms(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class GF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:yd,addMany:pd,setOne:Ad,setMany:fd,updateOne:Sd,updateMany:Td,deleteOne:Id,deleteMany:Od,initialize:md});y(this,"selectors",{selectById:Fd,selectByIds:gd})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class kF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:Rd,addMany:wd,setOne:Ed,setMany:vd,updateOne:Vd,updateMany:Bd,deleteOne:zd,deleteMany:jd,initialize:_d});y(this,"selectors",{selectById:Dd,selectByIds:qd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_step],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const l=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(c)),r}),[d,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(d)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class HF extends q{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Ld,addMany:Ps,setOne:Nd,setMany:Gd,updateOne:kd,updateMany:Hd,deleteOne:Kd,deleteMany:Fs,initialize:Ud});y(this,"selectors",{selectById:Yd,selectByIds:Zd})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class KF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:er,addMany:tr,setOne:sr,setMany:ir,updateOne:nr,updateMany:ar,deleteOne:cr,deleteMany:dr,initialize:xd});y(this,"selectors",{selectById:ur,selectByIds:lr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var R;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((R=this.client.store.getState().userReducer.currentUser)==null?void 0:R.id)??null,p=[],A=nt(a,Math.min(n??a.length,Qe)),I=[];for(const M of A){const w=[];for(const _ of M){const z=P({..._,values:_.values,created_by:h,submitted_at:u});p.push(z),w.push({uuid:z.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,asset_procedure_step:_.asset_procedure_step,published_at:_.published_at,values:z.values})}I.push({submitted_at:u,values:c,field_values:w})}this.dispatch(d(p));const b=[];for(const M of I){const{field_values:w}=M,_=w.map(({asset:V})=>V),z=w.map(({fields_revision:V})=>V),U=w.map(({asset_procedure:V})=>V),D=w.map(({uuid:V})=>V),xe=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:M,blockers:_.concat(z).concat(U),blocks:D});b.push(xe)}return Promise.all(b).then(M=>{this.dispatch(l(M.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,b]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Jd(e)(l);this.dispatch(a(e)),this.dispatch(Fs(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ps(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class WF extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Ar,addMany:fr,setOne:yr,setMany:pr,updateOne:Sr,updateMany:Tr,deleteOne:Ir,deleteMany:Or,initialize:mr});y(this,"selectors",{selectById:Fr,selectByIds:gr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:d,deleteOne:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=br(e)(u);this.dispatch(l(e)),this.dispatch(a(B(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(d(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class YF extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:Rr,addMany:ws,setOne:Vr,setMany:Br,updateOne:wr,updateMany:Er,deleteOne:vr,deleteMany:Es,initialize:_r});y(this,"selectors",{selectById:Dr,selectByIds:qr})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset with uuid ${e} found in the store`);const u=Pa(e)(l),h=Dy(e)(l);this.dispatch(c(e)),this.dispatch(es(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(xt(u)),this.dispatch(et(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Xe.v4(),l=nt(e,Math.min(n??e.length,Qe)).map(h=>{const p=h.map(A=>P(A));return{batchId:Xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),r=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,I=A.assets.map(({uuid:_})=>_),b=A.assets.map(({asset_type:_})=>_),R=A.assets.map(({project:_})=>_),M=A.assets.map(({status:_})=>_),w=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:(u?[u]:[]).concat(b).concat(R).concat(M),blocks:[p].concat(I)});u=h.batchId,r.push(w)}return Promise.all(r).then(h=>{const p=h.flat();this.dispatch(a(p))}),r}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=B(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Zt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} assets that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=nt(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const b=Xe.v4(),R=B(I),M=I.map(({status:_})=>_).filter(Boolean),w=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(R).concat(M),blocks:[b].concat(R)});p.push(w),A=b}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class ZF extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Lr,addMany:Nr,setOne:Gr,setMany:kr,updateOne:Hr,updateMany:Kr,deleteOne:Wr,deleteMany:Yr,initialize:Ur});y(this,"selectors",{selectById:Qr,selectByIds:xr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_stage],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=e.map(b=>P(b)),h=u.map(b=>({...b,created_by:r,submitted_at:l})),p=h.map(({uuid:b})=>b);this.dispatch(a(h));const A=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:u},blockers:[...e.map(b=>b.asset_procedure),...e.map(b=>b.asset_stage),...e.map(b=>b.asset)],blocks:p});return A.then(b=>{this.dispatch(c(b))}).catch(()=>{this.dispatch(d(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class JF extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:nu,addMany:au,setOne:su,setMany:iu,updateOne:cu,updateMany:du,deleteOne:ru,deleteMany:uu,initialize:tu});y(this,"selectors",{selectById:ou,selectByIds:hu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class XF extends q{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:pu,addMany:Ds,setOne:Au,setMany:fu,updateOne:Su,updateMany:Tu,deleteOne:Iu,deleteMany:qs,initialize:yu});y(this,"selectors",{selectById:Pu,selectByIds:Fu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class QF extends q{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:Ru,addMany:wu,setOne:Eu,setMany:vu,updateOne:Vu,updateMany:Bu,deleteOne:zu,deleteMany:ju,initialize:_u});y(this,"selectors",{selectById:qu,selectByIds:$u})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class xF extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Nu,addMany:Gu,setOne:ku,setMany:Hu,updateOne:Ku,updateMany:Wu,deleteOne:Yu,deleteMany:Zu,initialize:Lu});y(this,"selectors",{selectById:Xu,selectByIds:Qu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class eg extends q{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:sl,addMany:Gs,setOne:il,setMany:nl,updateOne:al,updateMany:cl,deleteOne:dl,deleteMany:ks,initialize:tl});y(this,"selectors",{selectById:ul,selectByIds:ll})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class tg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:pl,addMany:Al,setOne:fl,setMany:Sl,updateOne:Tl,updateMany:Il,deleteOne:Ol,deleteMany:Pl,initialize:yl});y(this,"selectors",{selectById:gl,selectByIds:bl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var b;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=[],p=nt(a,Math.min(n??a.length,Qe)),A=[];for(const R of p){const M=[];for(const w of R){const _=P({...w,values:w.values,created_by:((b=this.client.store.getState().userReducer.currentUser)==null?void 0:b.id)??null,submitted_at:u});h.push(_),M.push({uuid:_.uuid,asset:w.asset,fields_revision:w.fields_revision,published_at:w.published_at,values:_.values})}A.push({submitted_at:u,values:c,field_values:M})}this.dispatch(d(h));const I=[];for(const R of A){const{field_values:M}=R,w=M.map(({asset:D})=>D),_=M.map(({fields_revision:D})=>D),z=M.map(({uuid:D})=>D),U=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:R,blockers:w.concat(_),blocks:z});I.push(U)}return Promise.all(I).then(R=>{this.dispatch(l(R.flat()))}).catch(()=>{this.dispatch(r(B(h)))}),[h,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.asset],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=ol(e)(l);this.dispatch(a(e)),this.dispatch(ks(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Gs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class sg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:wl,addMany:El,setOne:vl,setMany:Vl,updateOne:Bl,updateMany:zl,deleteOne:jl,deleteMany:Dl,initialize:Rl});y(this,"selectors",{selectById:$l,selectByIds:Cl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ig extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Gl,addMany:kl,setOne:Hl,setMany:Kl,updateOne:Wl,updateMany:Yl,deleteOne:Zl,deleteMany:Jl,initialize:Nl});y(this,"selectors",{selectById:Ql,selectByIds:xl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ng extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:ao,addMany:co,setOne:io,setMany:no,updateOne:ro,updateMany:uo,deleteOne:lo,deleteMany:oo,initialize:so});y(this,"selectors",{selectById:mo,selectByIds:yo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=jr(e)(l),h=gu(e)(l);this.dispatch(a(e)),this.dispatch(Es(B(u))),this.dispatch(qs(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(ws(u)),this.dispatch(Ds(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ag extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:So,addMany:To,setOne:Io,setMany:Oo,updateOne:Po,updateMany:Fo,deleteOne:go,deleteMany:bo,initialize:fo});y(this,"selectors",{selectById:_o,selectByIds:Ro})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class cg extends q{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:jo,addMany:Do,setOne:qo,setMany:$o,updateOne:Co,updateMany:Uo,deleteOne:Lo,deleteMany:No,initialize:zo});y(this,"selectors",{selectById:ko,selectByIds:Ho})}getId(e){return e.uuid}getBlockers(e){throw[e.document]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[a,c,d]=await super.bulkAdd(e,n),l={};for(const{file_sha1:r,uuid:u}of a)r in l||(l[r]=[]),l[r].push(u);return d.then(r=>{const u=r.flatMap(h=>l[h]??[]);for(const h of u)this.makeReadable(h)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class dg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:Zo,addMany:Jo,setOne:Xo,setMany:Qo,updateOne:xo,updateMany:eh,deleteOne:th,deleteMany:sh,initialize:Yo});y(this,"selectors",{selectById:nh,selectByIds:ah})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:u.parent_document?[u.parent_document]:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:d,deleteMany:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=ch(e)(u);this.dispatch(a(e)),this.dispatch(l(B(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(d(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class rt extends it{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class rg extends rt{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:uh,addMany:lh,setOne:oh,setMany:hh,updateOne:mh,updateMany:yh,deleteOne:ph,deleteMany:Ah,initialize:rh});y(this,"selectors",{selectById:Sh,selectByIds:Th})}async add(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ug extends it{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const At={},zn=new Set;class lg extends it{constructor(){super(...arguments);y(this,"host");y(this,"dbPromise",mO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async getDB(){return await this.dbPromise}async addCache(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Tt(e);if(zn.has(n))return;const a=await this.getDB();!!await a.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,n),zn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),zn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async getPresignedUploadUrl(e){const{sha1:n,file_type:a,size:c,extension:d}=await this.getFilePayload(e),l=Wt(n,d),r={sha1:n,file_type:a,extension:d,size:c};return await this.enqueueRequest({description:"Create S3 upload url",method:m.POST,url:"/authentication/files/presigned-upload-url/",payload:r,blockers:[],blocks:[`s3-${l}`]})}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=Wt(e,Yt(n)),c={file_name:n.name,file_sha1:e,file:a},d=await this.getPresignedUploadUrl(n);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const l=d.url,r=this.enqueueRequest({url:l,description:"Upload file",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:d});return[c,r]}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let l;c in At?l=At[c]:Jn(e)?(l=Zn(e,a),At[c]=l):(l=new Promise(h=>{this.performRequest({method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const A=new File([p],a,{type:p.type});h(A)})}),At[c]=l);let r;try{r=await l}catch(h){throw h instanceof C&&delete At[c],h}const u=await Tt(r);if(u!==n){const h=`The hash of the file returned from the server (${u}) does not match the
|
|
8
8
|
expected hash (${n}). This can happen if you're using a local development server and the
|
|
9
9
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
10
10
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
11
11
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
12
12
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
13
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(h)}return await this.addCache(r),r}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.processPresignedUrl(a,c);return n}async getFilePayload(e){const a={sha1:await Tt(e),file_type:e.type,extension:Yt(e),size:e.size};return await this.client.files.addCache(e),a}}class og extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Mh,addMany:_h,setOne:Rh,setMany:wh,updateOne:Eh,updateMany:vh,deleteOne:Vh,deleteMany:Bh,initialize:bh});y(this,"selectors",{selectById:jh,selectByIds:Dh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.form],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class hg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:Uh,addMany:Lh,setOne:Nh,setMany:Gh,updateOne:kh,updateMany:Hh,deleteOne:Kh,deleteMany:Wh,initialize:Ch});y(this,"selectors",{selectById:Zh,selectByIds:Jh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.form_submission,e.form_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class mg extends q{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:em,addMany:tm,setOne:sm,setMany:im,updateOne:nm,updateMany:am,deleteOne:cm,deleteMany:dm,initialize:xh});y(this,"selectors",{selectById:um,selectByIds:lm})}getId(e){return e.uuid}getBlockers(e){throw[e.form_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:hi,addMany:mi,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:yi,deleteMany:pi,initialize:mm});y(this,"selectors",{selectById:Sm,selectByIds:Tm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class pg extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:gm,addMany:bm,setOne:Mm,setMany:_m,updateOne:Rm,updateMany:wm,deleteOne:Em,deleteMany:vm,initialize:Fm});y(this,"selectors",{selectById:zm,selectByIds:jm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=P({...e,submitted_at:l,created_by:r}),h=P({...n,form:u.uuid,submitted_at:l,created_by:r});this.dispatch(c(u)),this.dispatch(hi(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...E(u),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[u.uuid,h.uuid]});return p.catch(I=>{throw this.dispatch(d(u.uuid)),this.dispatch(yi(h.uuid)),I}),[u,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error("Expected form to exist");const u=ay(e)(l),h=Im(e)(l);this.dispatch(a(e)),this.dispatch(_i(B(u))),this.dispatch(pi(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(mi(h)),this.dispatch(Mi(u)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ag extends q{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:$m,addMany:Ii,setOne:Cm,setMany:Um,updateOne:Lm,updateMany:Nm,deleteOne:Gm,deleteMany:Oi,initialize:qm});y(this,"selectors",{selectById:km,selectByIds:Hm})}getId(e){return e.uuid}getBlockers(e){throw[e.form_submission]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,d=n.getState(),l=gi(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class fg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:Qm,addMany:Mi,setOne:Jm,setMany:Xm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:_i,initialize:Zm});y(this,"selectors",{selectById:iy,selectByIds:ny})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Km(e)(l);this.dispatch(a(e)),this.dispatch(Oi(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ii(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Sg extends q{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:oy,addMany:hy,setOne:uy,setMany:ly,updateOne:my,updateMany:yy,deleteOne:py,deleteMany:Ay,initialize:ry});y(this,"selectors",{selectById:Sy,selectByIds:Ty})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Tg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:_y,addMany:et,setOne:gy,setMany:Fy,updateOne:by,updateMany:My,deleteOne:Ry,deleteMany:tt,initialize:Py});y(this,"selectors",{selectById:Ey,selectByIds:vy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=P({...e,submitted_at:l,created_by:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ig extends q{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:Uy,addMany:Bi,setOne:Ly,setMany:Ny,updateOne:Gy,updateMany:ky,deleteOne:Hy,deleteMany:zi,initialize:Cy});y(this,"selectors",{selectById:Yy,selectByIds:Zy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Og extends q{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:xy,addMany:ep,setOne:tp,setMany:sp,updateOne:ip,updateMany:np,deleteOne:ap,deleteMany:cp,initialize:Qy});y(this,"selectors",{selectById:rp,selectByIds:up})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Pg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:mp,addMany:yp,setOne:pp,setMany:Ap,updateOne:fp,updateMany:Sp,deleteOne:Tp,deleteMany:Ip,initialize:hp});y(this,"selectors",{selectById:Op,selectByIds:Pp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=P({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.issue],blocks:[l.uuid]});return r.then(u=>{this.dispatch(c(u))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Fg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Mp,addMany:Li,setOne:_p,setMany:Rp,updateOne:wp,updateMany:Ep,deleteOne:vp,deleteMany:Ni,initialize:bp});y(this,"selectors",{selectById:Bp,selectByIds:zp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=n.getState(),r=new Date().toISOString(),u=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=P({...e,submitted_at:r,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,h.status],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(I=>{throw this.dispatch(d(h.uuid)),I}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...d,...e};this.dispatch(n(l));const r={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==d[A])switch(A){case $.PRIORITY:r[A]=e[A];break;case $.DUE_DATE:r[A]=e[A];break;case $.DESCRIPTION:r[A]=e[A];break;case $.TITLE:r[A]=e[A];break;case $.STATUS:{const I=e[A],b=dn(I)(c);if(!b)throw new Error(`Trying to update issue type status with ${I} which does not exist in store`);r[A]={name:b.name,color:b.color,uuid:b.uuid};break}case $.ASSIGNED_TO:{const I=e[A];if(I===null)r[A]=null;else{const b=$t(I)(c);if(!b)throw new Error(`Trying to update assigned to with ${I} which does not exist in store.`);r[A]={full_name:b.username,id:b.id}}break}}const u=P({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:r});this.dispatch(un(u));const h=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(d)),this.dispatch(on(u.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=B(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Zt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} issues that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=nt(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const b=Xe.v4(),w=B(I),M=I.map(({status:_})=>_).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(M),blocks:[b].concat(w)});p.push(R),A=b}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No issue with uuid ${e} found in the store`);const u=Vy(e)(l),h=jy(e)(l),p=Wy(e)(l),A=rS(e)(l);this.dispatch(a(e)),this.dispatch(zi(B(p))),this.dispatch(hn(B(A))),this.dispatch(tt(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(c(r)),this.dispatch(Bi(p)),this.dispatch(ln(A)),this.dispatch(et(u)),this.dispatch(et(h)),I}}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l),u=By(e)(l),h=zy(e)(l);this.dispatch(c(e)),this.dispatch(tt(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(et(u)),this.dispatch(et(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class gg extends q{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:Cp,addMany:Up,setOne:Lp,setMany:Np,updateOne:Gp,updateMany:kp,deleteOne:Hp,deleteMany:Kp,initialize:$p});y(this,"selectors",{selectById:Yp,selectByIds:Zp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends q{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:xp,addMany:eA,setOne:tA,setMany:sA,updateOne:iA,updateMany:nA,deleteOne:aA,deleteMany:cA,initialize:Qp});y(this,"selectors",{selectById:rA,selectByIds:uA})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Mg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:_A,addMany:RA,setOne:wA,setMany:EA,updateOne:vA,updateMany:VA,deleteOne:BA,deleteMany:zA,initialize:MA});y(this,"selectors",{selectById:DA,selectByIds:qA})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends q{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:LA,addMany:Ji,setOne:NA,setMany:GA,updateOne:kA,updateMany:HA,deleteOne:KA,deleteMany:Xi,initialize:UA});y(this,"selectors",{selectById:YA,selectByIds:ZA})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Rg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:mA,addMany:yA,setOne:pA,setMany:AA,updateOne:fA,updateMany:SA,deleteOne:TA,deleteMany:IA,initialize:hA});y(this,"selectors",{selectById:PA,selectByIds:FA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.issue],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=JA(e)(l);this.dispatch(a(e)),this.dispatch(Xi(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ji(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class wg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:ef,addMany:tf,setOne:sf,setMany:nf,updateOne:af,updateMany:cf,deleteOne:df,deleteMany:rf,initialize:xA});y(this,"selectors",{selectById:lf,selectByIds:of})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:pf,addMany:Af,setOne:ff,setMany:Sf,updateOne:Tf,updateMany:If,deleteOne:Of,deleteMany:Pf,initialize:yf});y(this,"selectors",{selectById:gf,selectByIds:bf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue,e.issue_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class vg extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:wf,addMany:Ef,setOne:vf,setMany:Vf,updateOne:Bf,updateMany:zf,deleteOne:jf,deleteMany:Df,initialize:Rf});y(this,"selectors",{selectById:$f,selectByIds:Cf})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,submitted_at:u,created_by:r});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=jp(e)(l);this.dispatch(a(e)),this.dispatch(Ni(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Li(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:Gf,addMany:kf,setOne:Hf,setMany:Kf,updateOne:Wf,updateMany:Yf,deleteOne:Zf,deleteMany:Jf,initialize:Nf});y(this,"selectors",{selectById:dn,selectByIds:Qf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Bg extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:un,addMany:ln,setOne:sS,setMany:iS,updateOne:nS,updateMany:aS,deleteOne:on,deleteMany:hn,initialize:tS});y(this,"selectors",{selectById:cS,selectByIds:dS})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const zg=1800;function jg(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class Dg extends BF{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(vo(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=yO(e).exp??n}catch{a=n}return a-n<zg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof C&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??dt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new C({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new C({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=Xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(jg(a))})}}class qg extends rt{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:FS,addMany:gS,setOne:bS,setMany:MS,updateOne:_S,updateMany:RS,deleteOne:wS,deleteMany:ES,initialize:PS});y(this,"selectors",{selectById:VS,selectByIds:BS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l),u=$t(r.user)(l);this.dispatch(a(r.uuid)),this.dispatch(fn(r.user));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${r.uuid}/`,blockers:[r.uuid],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(An(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class $g extends rt{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:US,addMany:CS,setOne:$S,setMany:qS,updateOne:NS,updateMany:LS,deleteOne:GS,deleteMany:kS,initialize:DS});y(this,"selectors",{selectById:WS,selectByIds:YS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class Cg extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:nT,addMany:aT,setOne:cT,setMany:dT,updateOne:rT,updateMany:uT,deleteOne:lT,deleteMany:oT,initialize:iT});y(this,"selectors",{selectById:mT,selectByIds:yT})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(d(l.uuid)),h}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:r.map(p=>E(p))},blockers:r.flatMap(p=>[p.project,p.organization_access]),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(d(p))}).catch(p=>{throw this.dispatch(c(r.map(A=>A.uuid))),p}),[r,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Ug extends q{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:fT,addMany:ST,setOne:TT,setMany:IT,updateOne:OT,updateMany:PT,deleteOne:FT,deleteMany:gT,initialize:AT});y(this,"selectors",{selectById:MT,selectByIds:_T})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends q{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:BT,addMany:zT,setOne:vT,setMany:VT,updateOne:jT,updateMany:DT,deleteOne:qT,deleteMany:$T,initialize:ET});y(this,"selectors",{selectById:LT,selectByIds:NT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ng extends rt{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:ZT,addMany:YT,setOne:WT,setMany:KT,updateOne:XT,updateMany:JT,deleteOne:QT,deleteMany:xT,initialize:HT});y(this,"selectors",{selectById:sI,selectByIds:iI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:dI,addMany:rI,setOne:uI,setMany:lI,updateOne:oI,updateMany:hI,deleteOne:mI,deleteMany:yI,initialize:cI});y(this,"selectors",{selectById:fI,selectByIds:SI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.team],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:r.map(p=>E(p))},blockers:r.map(p=>p.team),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(d(r.map(p=>p.uuid)))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class kg extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:OI,addMany:PI,setOne:FI,setMany:gI,updateOne:bI,updateMany:MI,deleteOne:_I,deleteMany:RI,initialize:II});y(this,"selectors",{selectById:EI,selectByIds:vI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,submitted_at:new Date().toISOString(),created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Hg extends rt{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:An,addMany:yS,setOne:mS,setMany:hS,updateOne:AS,updateMany:pS,deleteOne:fn,deleteMany:fS,initialize:oS});y(this,"selectors",{selectById:$t,selectByIds:IS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:d,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function jn(t,s,e,n,a){const c=n instanceof it;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:r,headers:u,method:h,queryParams:p,attachmentHash:A,isExternalUrl:I,isAuthNeeded:b,isResponseBlob:w}={...d,...s};let M=s.url;const R=A?await e.files.fetchCache(A):void 0;if(A&&!R)throw new Error(`Cannot upload file ${A} because it's not cached.`);!I&&!M.startsWith("http")&&(!M.startsWith("/")&&!M.startsWith("blob:")&&(M="/"+M),M=t+M);const _=V=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!R)throw new Error(`No file for file ${A}`);const N=l.fields["x-amz-checksum-sha1"];if(!N)throw new Error(`No checksum for file ${A}`);return V.set("x-amz-checksum-sha1",N).field({...r,...l.fields}).attach("file",R)}return V.send(r)},U={[m.GET]:()=>w?ct.get(M.toString()).responseType("blob"):ct.get(M.toString()),[m.POST]:()=>{const V=ct.post(M.toString());return _(V)},[m.PATCH]:()=>{const V=ct.patch(M.toString());return _(V)},[m.PUT]:()=>{const V=ct.put(M.toString());return _(V)},[m.DELETE]:()=>{const V=ct.delete(M.toString());return _(V)}}[h];let D=U();const xe=()=>{console.debug("aborting request:",s.url),D.abort()};if(a==null||a.addEventListener("abort",xe),b&&c){const V=n.auth.getAuthHeader();D=D.set("Authorization",V)}u&&(D=D.set(u));try{return await D.query(p)}catch(V){const N=ZI(V),Je=N==null?void 0:N.status;if(c&&Je===401)return await n.auth.handleUnauthorized(D,N),D.query(p);throw new C({response:N,innerError:V,discard:Bn.includes(Je)})}finally{a==null||a.removeEventListener("abort",xe)}}class Kg{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Gt,d={...e,uuid:e.uuid??Xe.v4()};return jn(s,d,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??dt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof C)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof C)throw a;return a})}_enqueueRequest(s,e,n){const a=new Gt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(QS(c)),l=u=>{if(u)a.resolve(u.body);else{const h=new C({message:"Could not get a response from the server.",response:u,discard:!0});a.reject(h)}},r=u=>{u instanceof C?u.options.discard=!0:(console.error("Received an unexpected error while processing a request:",u,`
|
|
13
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(h)}return await this.addCache(r),r}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(n.warning),new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.processPresignedUrl(a,c);return n}async getFilePayload(e){const a={sha1:await Tt(e),file_type:e.type,extension:Yt(e),size:e.size};return await this.client.files.addCache(e),a}}class og extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Mh,addMany:_h,setOne:Rh,setMany:wh,updateOne:Eh,updateMany:vh,deleteOne:Vh,deleteMany:Bh,initialize:bh});y(this,"selectors",{selectById:jh,selectByIds:Dh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.form],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class hg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:Uh,addMany:Lh,setOne:Nh,setMany:Gh,updateOne:kh,updateMany:Hh,deleteOne:Kh,deleteMany:Wh,initialize:Ch});y(this,"selectors",{selectById:Zh,selectByIds:Jh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.form_submission,e.form_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class mg extends q{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:em,addMany:tm,setOne:sm,setMany:im,updateOne:nm,updateMany:am,deleteOne:cm,deleteMany:dm,initialize:xh});y(this,"selectors",{selectById:um,selectByIds:lm})}getId(e){return e.uuid}getBlockers(e){throw[e.form_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:hi,addMany:mi,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:yi,deleteMany:pi,initialize:mm});y(this,"selectors",{selectById:Sm,selectByIds:Tm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class pg extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:gm,addMany:bm,setOne:Mm,setMany:_m,updateOne:Rm,updateMany:wm,deleteOne:Em,deleteMany:vm,initialize:Fm});y(this,"selectors",{selectById:zm,selectByIds:jm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=P({...e,submitted_at:l,created_by:r}),h=P({...n,form:u.uuid,submitted_at:l,created_by:r});this.dispatch(c(u)),this.dispatch(hi(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...E(u),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[u.uuid,h.uuid]});return p.catch(I=>{throw this.dispatch(d(u.uuid)),this.dispatch(yi(h.uuid)),I}),[u,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error("Expected form to exist");const u=ay(e)(l),h=Im(e)(l);this.dispatch(a(e)),this.dispatch(_i(B(u))),this.dispatch(pi(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(mi(h)),this.dispatch(Mi(u)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ag extends q{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:$m,addMany:Ii,setOne:Cm,setMany:Um,updateOne:Lm,updateMany:Nm,deleteOne:Gm,deleteMany:Oi,initialize:qm});y(this,"selectors",{selectById:km,selectByIds:Hm})}getId(e){return e.uuid}getBlockers(e){throw[e.form_submission]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,d=n.getState(),l=gi(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class fg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:Qm,addMany:Mi,setOne:Jm,setMany:Xm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:_i,initialize:Zm});y(this,"selectors",{selectById:iy,selectByIds:ny})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Km(e)(l);this.dispatch(a(e)),this.dispatch(Oi(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ii(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Sg extends q{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:oy,addMany:hy,setOne:uy,setMany:ly,updateOne:my,updateMany:yy,deleteOne:py,deleteMany:Ay,initialize:ry});y(this,"selectors",{selectById:Sy,selectByIds:Ty})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Tg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:_y,addMany:et,setOne:gy,setMany:Fy,updateOne:by,updateMany:My,deleteOne:Ry,deleteMany:tt,initialize:Py});y(this,"selectors",{selectById:Ey,selectByIds:vy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=P({...e,submitted_at:l,created_by:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ig extends q{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:Uy,addMany:Bi,setOne:Ly,setMany:Ny,updateOne:Gy,updateMany:ky,deleteOne:Hy,deleteMany:zi,initialize:Cy});y(this,"selectors",{selectById:Yy,selectByIds:Zy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Og extends q{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:xy,addMany:ep,setOne:tp,setMany:sp,updateOne:ip,updateMany:np,deleteOne:ap,deleteMany:cp,initialize:Qy});y(this,"selectors",{selectById:rp,selectByIds:up})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Pg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:mp,addMany:yp,setOne:pp,setMany:Ap,updateOne:fp,updateMany:Sp,deleteOne:Tp,deleteMany:Ip,initialize:hp});y(this,"selectors",{selectById:Op,selectByIds:Pp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=P({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.issue],blocks:[l.uuid]});return r.then(u=>{this.dispatch(c(u))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Fg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Mp,addMany:Li,setOne:_p,setMany:Rp,updateOne:wp,updateMany:Ep,deleteOne:vp,deleteMany:Ni,initialize:bp});y(this,"selectors",{selectById:Bp,selectByIds:zp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=n.getState(),r=new Date().toISOString(),u=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=P({...e,submitted_at:r,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,h.status],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(I=>{throw this.dispatch(d(h.uuid)),I}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...d,...e};this.dispatch(n(l));const r={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==d[A])switch(A){case $.PRIORITY:r[A]=e[A];break;case $.DUE_DATE:r[A]=e[A];break;case $.DESCRIPTION:r[A]=e[A];break;case $.TITLE:r[A]=e[A];break;case $.STATUS:{const I=e[A],b=dn(I)(c);if(!b)throw new Error(`Trying to update issue type status with ${I} which does not exist in store`);r[A]={name:b.name,color:b.color,uuid:b.uuid};break}case $.ASSIGNED_TO:{const I=e[A];if(I===null)r[A]=null;else{const b=$t(I)(c);if(!b)throw new Error(`Trying to update assigned to with ${I} which does not exist in store.`);r[A]={full_name:b.username,id:b.id}}break}}const u=P({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:r});this.dispatch(un(u));const h=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(d)),this.dispatch(on(u.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=B(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Zt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} issues that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=nt(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const b=Xe.v4(),R=B(I),M=I.map(({status:_})=>_).filter(Boolean),w=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(R).concat(M),blocks:[b].concat(R)});p.push(w),A=b}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No issue with uuid ${e} found in the store`);const u=Vy(e)(l),h=jy(e)(l),p=Wy(e)(l),A=rS(e)(l);this.dispatch(a(e)),this.dispatch(zi(B(p))),this.dispatch(hn(B(A))),this.dispatch(tt(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(c(r)),this.dispatch(Bi(p)),this.dispatch(ln(A)),this.dispatch(et(u)),this.dispatch(et(h)),I}}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l),u=By(e)(l),h=zy(e)(l);this.dispatch(c(e)),this.dispatch(tt(B(u))),this.dispatch(tt(B(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(et(u)),this.dispatch(et(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class gg extends q{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:Cp,addMany:Up,setOne:Lp,setMany:Np,updateOne:Gp,updateMany:kp,deleteOne:Hp,deleteMany:Kp,initialize:$p});y(this,"selectors",{selectById:Yp,selectByIds:Zp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends q{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:xp,addMany:eA,setOne:tA,setMany:sA,updateOne:iA,updateMany:nA,deleteOne:aA,deleteMany:cA,initialize:Qp});y(this,"selectors",{selectById:rA,selectByIds:uA})}getId(e){return e.uuid}getBlockers(e){throw[e.fields_revision]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Mg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:_A,addMany:RA,setOne:wA,setMany:EA,updateOne:vA,updateMany:VA,deleteOne:BA,deleteMany:zA,initialize:MA});y(this,"selectors",{selectById:DA,selectByIds:qA})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends q{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:LA,addMany:Ji,setOne:NA,setMany:GA,updateOne:kA,updateMany:HA,deleteOne:KA,deleteMany:Xi,initialize:UA});y(this,"selectors",{selectById:YA,selectByIds:ZA})}getId(e){return e.uuid}getBlockers(e){throw[e.field_values]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Rg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:mA,addMany:yA,setOne:pA,setMany:AA,updateOne:fA,updateMany:SA,deleteOne:TA,deleteMany:IA,initialize:hA});y(this,"selectors",{selectById:PA,selectByIds:FA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.issue],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=JA(e)(l);this.dispatch(a(e)),this.dispatch(Xi(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ji(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class wg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:ef,addMany:tf,setOne:sf,setMany:nf,updateOne:af,updateMany:cf,deleteOne:df,deleteMany:rf,initialize:xA});y(this,"selectors",{selectById:lf,selectByIds:of})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:pf,addMany:Af,setOne:ff,setMany:Sf,updateOne:Tf,updateMany:If,deleteOne:Of,deleteMany:Pf,initialize:yf});y(this,"selectors",{selectById:gf,selectByIds:bf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue,e.issue_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class vg extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:wf,addMany:Ef,setOne:vf,setMany:Vf,updateOne:Bf,updateMany:zf,deleteOne:jf,deleteMany:Df,initialize:Rf});y(this,"selectors",{selectById:$f,selectByIds:Cf})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,submitted_at:u,created_by:r});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=jp(e)(l);this.dispatch(a(e)),this.dispatch(Ni(B(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Li(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:Gf,addMany:kf,setOne:Hf,setMany:Kf,updateOne:Wf,updateMany:Yf,deleteOne:Zf,deleteMany:Jf,initialize:Nf});y(this,"selectors",{selectById:dn,selectByIds:Qf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Bg extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:un,addMany:ln,setOne:sS,setMany:iS,updateOne:nS,updateMany:aS,deleteOne:on,deleteMany:hn,initialize:tS});y(this,"selectors",{selectById:cS,selectByIds:dS})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const zg=1800;function jg(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class Dg extends BF{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(vo(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=yO(e).exp??n}catch{a=n}return a-n<zg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof C&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??dt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new C({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new C({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=Xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(jg(a))})}}class qg extends rt{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:FS,addMany:gS,setOne:bS,setMany:MS,updateOne:_S,updateMany:RS,deleteOne:wS,deleteMany:ES,initialize:PS});y(this,"selectors",{selectById:VS,selectByIds:BS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l),u=$t(r.user)(l);this.dispatch(a(r.uuid)),this.dispatch(fn(r.user));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${r.uuid}/`,blockers:[r.uuid],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(An(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class $g extends rt{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:US,addMany:CS,setOne:$S,setMany:qS,updateOne:NS,updateMany:LS,deleteOne:GS,deleteMany:kS,initialize:DS});y(this,"selectors",{selectById:WS,selectByIds:YS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class Cg extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:nT,addMany:aT,setOne:cT,setMany:dT,updateOne:rT,updateMany:uT,deleteOne:lT,deleteMany:oT,initialize:iT});y(this,"selectors",{selectById:mT,selectByIds:yT})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(d(l.uuid)),h}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:r.map(p=>E(p))},blockers:r.flatMap(p=>[p.project,p.organization_access]),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(d(p))}).catch(p=>{throw this.dispatch(c(r.map(A=>A.uuid))),p}),[r,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Ug extends q{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:fT,addMany:ST,setOne:TT,setMany:IT,updateOne:OT,updateMany:PT,deleteOne:FT,deleteMany:gT,initialize:AT});y(this,"selectors",{selectById:MT,selectByIds:_T})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends q{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:BT,addMany:zT,setOne:vT,setMany:VT,updateOne:jT,updateMany:DT,deleteOne:qT,deleteMany:$T,initialize:ET});y(this,"selectors",{selectById:LT,selectByIds:NT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ng extends rt{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:ZT,addMany:YT,setOne:WT,setMany:KT,updateOne:XT,updateMany:JT,deleteOne:QT,deleteMany:xT,initialize:HT});y(this,"selectors",{selectById:sI,selectByIds:iI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:dI,addMany:rI,setOne:uI,setMany:lI,updateOne:oI,updateMany:hI,deleteOne:mI,deleteMany:yI,initialize:cI});y(this,"selectors",{selectById:fI,selectByIds:SI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.team],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:r.map(p=>E(p))},blockers:r.map(p=>p.team),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(d(r.map(p=>p.uuid)))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class kg extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:OI,addMany:PI,setOne:FI,setMany:gI,updateOne:bI,updateMany:MI,deleteOne:_I,deleteMany:RI,initialize:II});y(this,"selectors",{selectById:EI,selectByIds:vI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,submitted_at:new Date().toISOString(),created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Hg extends rt{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:An,addMany:yS,setOne:mS,setMany:hS,updateOne:AS,updateMany:pS,deleteOne:fn,deleteMany:fS,initialize:oS});y(this,"selectors",{selectById:$t,selectByIds:IS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:d,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function jn(t,s,e,n,a){const c=n instanceof it;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:r,headers:u,method:h,queryParams:p,attachmentHash:A,isExternalUrl:I,isAuthNeeded:b,isResponseBlob:R}={...d,...s};let M=s.url;const w=A?await e.files.fetchCache(A):void 0;if(A&&!w)throw new Error(`Cannot upload file ${A} because it's not cached.`);!I&&!M.startsWith("http")&&(!M.startsWith("/")&&!M.startsWith("blob:")&&(M="/"+M),M=t+M);const _=V=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!w)throw new Error(`No file for file ${A}`);const N=l.fields["x-amz-checksum-sha1"];if(!N)throw new Error(`No checksum for file ${A}`);return V.set("x-amz-checksum-sha1",N).field({...r,...l.fields}).attach("file",w)}return V.send(r)},U={[m.GET]:()=>R?ct.get(M.toString()).responseType("blob"):ct.get(M.toString()),[m.POST]:()=>{const V=ct.post(M.toString());return _(V)},[m.PATCH]:()=>{const V=ct.patch(M.toString());return _(V)},[m.PUT]:()=>{const V=ct.put(M.toString());return _(V)},[m.DELETE]:()=>{const V=ct.delete(M.toString());return _(V)}}[h];let D=U();const xe=()=>{console.debug("aborting request:",s.url),D.abort()};if(a==null||a.addEventListener("abort",xe),b&&c){const V=n.auth.getAuthHeader();D=D.set("Authorization",V)}u&&(D=D.set(u));try{return await D.query(p)}catch(V){const N=ZI(V),Je=N==null?void 0:N.status;if(c&&Je===401)return await n.auth.handleUnauthorized(D,N),D.query(p);throw new C({response:N,innerError:V,discard:Bn.includes(Je)})}finally{a==null||a.removeEventListener("abort",xe)}}class Kg{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Gt,d={...e,uuid:e.uuid??Xe.v4()};return jn(s,d,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??dt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof C)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof C)throw a;return a})}_enqueueRequest(s,e,n){const a=new Gt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(QS(c)),l=u=>{if(u)a.resolve(u.body);else{const h=new C({message:"Could not get a response from the server.",response:u,discard:!0});a.reject(h)}},r=u=>{u instanceof C?u.options.discard=!0:(console.error("Received an unexpected error while processing a request:",u,`
|
|
14
14
|
Converting error to APIError and discarding.`),u=new C({message:"An error occurred while processing the request.",innerError:u,discard:!0})),a.reject(u)};return d.then(l,r),a}async performPagination(s,e,n,a,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=d,r=[];let u=await this.performRequest(s,d,a,c);for(r.push(u.results);u.next;)u=await this.performRequest(s,{url:u.next,method:l},a,c),r.push(u.results);return r}}class ut{constructor(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new pO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new ut;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==a.payload.uuid&&d.payload.blocks.some(l=>a.payload.blockers.includes(l))&&ut._addDependency(a.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){ut._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(n.payload.blocks);s.payload.blockers.some(c=>a.has(c))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(s.payload.blocks);n.payload.blockers.some(c=>a.has(c))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let JI;function XI(t){JI=t}function lt(){return JI}let QI;function xI(t){QI=t}function eO(){return QI}let Dn=null;function at(){const t=lt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Dn)return Dn;const s=t.getState().offline.outbox,e=ut._fromOutbox(s);return Dn=e,e}const Wg=(t,s)=>{const e=new s(t);return xI(e),XI(t),e};class Yg{constructor(s){y(this,"_all");y(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class qn{constructor(){y(this,"next");this.next=null}then(s){return new Yg(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s.payload.url),!lt())throw new Error("Client store not set");const n=eO();if(!n)throw new Error("Client SDK not set");return KI(s,n)}}}class tO extends qn{async run(s){return super.run(s)}}class sO extends qn{async run(s){return super.run(s)}}const iO=new tO().then(new sO).compile();function nO(t){var s;return(s=iO[0])==null?void 0:s.run(t)}var aO=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(aO||{});i.ALL_MIDDLEWARE=iO,i.APIError=C,i.AgentService=zF,i.AssetAttachmentService=jF,i.AssetProcedureService=LF,i.AssetProcedureStepFieldValuesAttachmentService=HF,i.AssetProcedureStepFieldValuesService=KF,i.AssetProcedureStepFieldsAttachmentService=GF,i.AssetProcedureStepFieldsService=kF,i.AssetProcedureStepService=WF,i.AssetProcedureTypeAttachmentService=DF,i.AssetProcedureTypeFieldValuesAttachmentService=CF,i.AssetProcedureTypeFieldValuesService=UF,i.AssetProcedureTypeFieldsAttachmentService=qF,i.AssetProcedureTypeFieldsService=$F,i.AssetProcedureTypeService=NF,i.AssetService=YF,i.AssetStageCompletionService=ZF,i.AssetStageService=JF,i.AssetStatusType=Gn,i.AssetTypeAttachmentService=XF,i.AssetTypeFieldValuesAttachmentService=eg,i.AssetTypeFieldValuesService=tg,i.AssetTypeFieldsAttachmentService=QF,i.AssetTypeFieldsService=xF,i.AssetTypeIdentifierService=sg,i.AssetTypeIdentifierValueService=ig,i.AssetTypeService=ng,i.AssetTypeStatusService=ag,i.AttachmentModel=kn,i.BaseApiService=it,i.BaseModelApiService=rt,i.BaseOfflineFileModelApiService=q,i.BaseOfflineModelApiService=v,i.BaseSDK=Kg,i.COMMON_AUTO_FIELDS=Qn,i.DEFAULT_ISSUE_PRIORITY=AO,i.DEFAULT_PAGE_SIZE=DI,i.DISCARD_HTTP_STATUSES=Bn,i.DeferredPromise=Gt,i.DocumentAttachmentService=cg,i.DocumentService=dg,i.EMPTY_ARRAY=Un,i.EMPTY_OBJECT=Ln,i.EmailDomainsService=rg,i.EmailVerificationService=ug,i.FILE_MODEL_DEFAULT_PAGE_SIZE=qI,i.FileService=lg,i.FormIdentifierService=og,i.FormIdentifierValueService=hg,i.FormRevisionAttachmentService=mg,i.FormRevisionService=yg,i.FormService=pg,i.FormSubmissionAttachmentService=Ag,i.FormSubmissionService=fg,i.GeoImageService=Sg,i.HttpMethod=m,i.IssueAssociationService=Tg,i.IssueAttachmentService=Ig,i.IssueCommentAttachmentService=Og,i.IssueCommentService=Pg,i.IssuePriority=Nt,i.IssueService=Fg,i.IssueStatusType=Hn,i.IssueTypeAttachmentService=gg,i.IssueTypeFieldValuesAttachmentService=_g,i.IssueTypeFieldValuesService=Rg,i.IssueTypeFieldsAttachmentService=bg,i.IssueTypeFieldsService=Mg,i.IssueTypeIdentifierService=wg,i.IssueTypeIdentifierValueService=Eg,i.IssueTypeService=vg,i.IssueTypeStatusService=Vg,i.IssueUpdateChange=$,i.IssueUpdateService=Bg,i.JWTService=Dg,i.MAX_SERVICE_BATCH_SIZE=Qe,i.OUTBOX_RETRY_DELAY=Kn,i.OfflineAnalyticsMiddleware=tO,i.OfflineMiddleware=qn,i.OrganizationAccessLevel=Nn,i.OrganizationAccessService=qg,i.OrganizationService=$g,i.OutboxCoordinator=ut,i.ProjectAccessService=Cg,i.ProjectAttachmentService=Ug,i.ProjectFileService=Lg,i.ProjectService=Ng,i.RESET_ORGANIZATION_STATE=g,i.RESET_PROJECT_STATE=j,i.RESET_STATE=O,i.RateLimitingMiddleware=sO,i.SelectorBuilder=qO,i.TeamMembershipService=Gg,i.TeamService=kg,i.UNKNOWN_ERROR_MESSAGE=dt,i.UserService=Hg,i.VERSION_REDUCER_KEY=ot,i.VerificationCodeType=aO,i._setLatestRetryTime=eT,i.addAsset=Rr,i.addAssetAttachment=ma,i.addAssetAttachments=xt,i.addAssetProcedure=Lc,i.addAssetProcedureStep=Ar,i.addAssetProcedureStepFieldValues=er,i.addAssetProcedureStepFieldValuesAttachment=Ld,i.addAssetProcedureStepFieldValuesAttachments=Ps,i.addAssetProcedureStepFieldValuesMany=tr,i.addAssetProcedureStepFields=Rd,i.addAssetProcedureStepFieldsAttachment=yd,i.addAssetProcedureStepFieldsAttachments=pd,i.addAssetProcedureStepFieldsMany=wd,i.addAssetProcedureSteps=fr,i.addAssetProcedureType=ed,i.addAssetProcedureTypeAttachment=Ma,i.addAssetProcedureTypeAttachments=_a,i.addAssetProcedureTypeFieldValues=_c,i.addAssetProcedureTypeFieldValuesAttachment=yc,i.addAssetProcedureTypeFieldValuesAttachments=rs,i.addAssetProcedureTypeFieldValuesMany=Rc,i.addAssetProcedureTypeFields=ec,i.addAssetProcedureTypeFieldsAttachment=Ua,i.addAssetProcedureTypeFieldsAttachments=La,i.addAssetProcedureTypeFieldsMany=tc,i.addAssetProcedureTypes=td,i.addAssetProcedures=ms,i.addAssetStage=nu,i.addAssetStageCompletion=Lr,i.addAssetStageCompletions=Nr,i.addAssetStages=au,i.addAssetType=ao,i.addAssetTypeAttachment=pu,i.addAssetTypeAttachments=Ds,i.addAssetTypeFieldValues=pl,i.addAssetTypeFieldValuesAttachment=sl,i.addAssetTypeFieldValuesAttachments=Gs,i.addAssetTypeFieldValuesMany=Al,i.addAssetTypeFields=Nu,i.addAssetTypeFieldsAttachment=Ru,i.addAssetTypeFieldsAttachments=wu,i.addAssetTypeFieldsMany=Gu,i.addAssetTypeIdentifier=wl,i.addAssetTypeIdentifierValue=Gl,i.addAssetTypeIdentifierValues=kl,i.addAssetTypeIdentifiers=El,i.addAssetTypeStatus=So,i.addAssetTypeStatuses=To,i.addAssetTypes=co,i.addAssets=ws,i.addConversation=da,i.addConversations=$O,i.addDocument=Zo,i.addDocumentAttachment=jo,i.addDocumentAttachments=Do,i.addDocuments=Jo,i.addEmailDomain=uh,i.addEmailDomains=lh,i.addForm=gm,i.addFormIdentifier=Mh,i.addFormIdentifierValue=Uh,i.addFormIdentifierValues=Lh,i.addFormIdentifiers=_h,i.addFormRevision=hi,i.addFormRevisionAttachment=em,i.addFormRevisionAttachments=tm,i.addFormRevisions=mi,i.addFormSubmission=Qm,i.addFormSubmissionAttachment=$m,i.addFormSubmissionAttachments=Ii,i.addFormSubmissions=Mi,i.addForms=bm,i.addGeoImage=oy,i.addGeoImages=hy,i.addIssue=Mp,i.addIssueAssociation=_y,i.addIssueAssociations=et,i.addIssueAttachment=Uy,i.addIssueAttachments=Bi,i.addIssueComment=mp,i.addIssueCommentAttachment=xy,i.addIssueCommentAttachments=ep,i.addIssueComments=yp,i.addIssueType=wf,i.addIssueTypeAttachment=Cp,i.addIssueTypeAttachments=Up,i.addIssueTypeFieldValues=mA,i.addIssueTypeFieldValuesAttachment=LA,i.addIssueTypeFieldValuesAttachments=Ji,i.addIssueTypeFieldValuesMany=yA,i.addIssueTypeFields=_A,i.addIssueTypeFieldsAttachment=xp,i.addIssueTypeFieldsAttachments=eA,i.addIssueTypeFieldsMany=RA,i.addIssueTypeIdentifier=ef,i.addIssueTypeIdentifierValue=pf,i.addIssueTypeIdentifierValues=Af,i.addIssueTypeIdentifiers=tf,i.addIssueTypeStatus=Gf,i.addIssueTypeStatuses=kf,i.addIssueTypes=Ef,i.addIssueUpdate=un,i.addIssueUpdates=ln,i.addIssues=Li,i.addOrganization=US,i.addOrganizationAccess=FS,i.addOrganizationAccesses=gS,i.addOrganizations=CS,i.addProject=ZT,i.addProjectAccess=nT,i.addProjectAccesses=aT,i.addProjectAttachment=fT,i.addProjectAttachments=ST,i.addProjectFile=BT,i.addProjectFiles=zT,i.addProjects=YT,i.addTeam=OI,i.addTeamMembership=dI,i.addTeamMemberships=rI,i.addTeams=PI,i.addUser=An,i.addUsers=yS,i.agentsReducer=la,i.agentsSlice=Jt,i.areArraysEqual=IO,i.assetAttachmentReducer=Fa,i.assetAttachmentSlice=Qt,i.assetProcedureReducer=Wc,i.assetProcedureSlice=hs,i.assetProcedureStepFieldValuesAttachmentReducer=Xd,i.assetProcedureStepFieldValuesAttachmentSlice=Os,i.assetProcedureStepFieldValuesReducer=or,i.assetProcedureStepFieldValuesSlice=bs,i.assetProcedureStepFieldsAttachmentReducer=bd,i.assetProcedureStepFieldsAttachmentSlice=fs,i.assetProcedureStepFieldsReducer=$d,i.assetProcedureStepFieldsSlice=Ts,i.assetProcedureStepReducer=Pr,i.assetProcedureStepSlice=Ms,i.assetProcedureTypeAttachmentReducer=za,i.assetProcedureTypeAttachmentSlice=ss,i.assetProcedureTypeFieldValuesAttachmentReducer=Ic,i.assetProcedureTypeFieldValuesAttachmentSlice=ds,i.assetProcedureTypeFieldValuesReducer=jc,i.assetProcedureTypeFieldValuesSlice=os,i.assetProcedureTypeFieldsAttachmentReducer=Ya,i.assetProcedureTypeFieldsAttachmentSlice=ns,i.assetProcedureTypeFieldsReducer=rc,i.assetProcedureTypeFieldsSlice=cs,i.assetProcedureTypeReducer=rd,i.assetProcedureTypeSlice=ps,i.assetReducer=$r,i.assetSlice=Rs,i.assetStageCompletionReducer=Zr,i.assetStageCompletionSlice=vs,i.assetStageReducer=lu,i.assetStageSlice=Vs,i.assetTypeAttachmentReducer=bu,i.assetTypeAttachmentSlice=js,i.assetTypeFieldValuesAttachmentReducer=hl,i.assetTypeFieldValuesAttachmentSlice=Ns,i.assetTypeFieldValuesReducer=Ml,i.assetTypeFieldValuesSlice=Ks,i.assetTypeFieldsAttachmentReducer=Cu,i.assetTypeFieldsAttachmentSlice=Cs,i.assetTypeFieldsReducer=xu,i.assetTypeFieldsSlice=Ls,i.assetTypeIdentifierReducer=Ul,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=eo,i.assetTypeIdentifierValueSlice=Zs,i.assetTypeReducer=po,i.assetTypeSlice=Js,i.assetTypeStatusReducer=wo,i.assetTypeStatusSlice=Qs,i.assetTypeStatusSortFn=ta,i.authReducer=Vo,i.authSlice=wt,i.baseReducer=TF,i.baseReducers=Vn,i.clearTokens=PP,i.createModelAdapter=F,i.createOfflineAction=JS,i.createPayload=E,i.createSelectionAdapter=fO,i.deleteAsset=vr,i.deleteAssetAttachment=Sa,i.deleteAssetAttachments=es,i.deleteAssetProcedure=kc,i.deleteAssetProcedureStep=Ir,i.deleteAssetProcedureStepFieldValues=cr,i.deleteAssetProcedureStepFieldValuesAttachment=Kd,i.deleteAssetProcedureStepFieldValuesAttachments=Fs,i.deleteAssetProcedureStepFieldValuesMany=dr,i.deleteAssetProcedureStepFields=zd,i.deleteAssetProcedureStepFieldsAttachment=Id,i.deleteAssetProcedureStepFieldsAttachments=Od,i.deleteAssetProcedureStepFieldsMany=jd,i.deleteAssetProcedureSteps=Or,i.deleteAssetProcedureType=nd,i.deleteAssetProcedureTypeAttachment=Va,i.deleteAssetProcedureTypeAttachments=Ba,i.deleteAssetProcedureTypeFieldValues=Bc,i.deleteAssetProcedureTypeFieldValuesAttachment=Tc,i.deleteAssetProcedureTypeFieldValuesAttachments=us,i.deleteAssetProcedureTypeFieldValuesMany=zc,i.deleteAssetProcedureTypeFields=cc,i.deleteAssetProcedureTypeFieldsAttachment=Ka,i.deleteAssetProcedureTypeFieldsAttachments=Wa,i.deleteAssetProcedureTypeFieldsMany=dc,i.deleteAssetProcedureTypes=ad,i.deleteAssetProcedures=ys,i.deleteAssetStage=ru,i.deleteAssetStageCompletion=Wr,i.deleteAssetStageCompletions=Yr,i.deleteAssetStages=uu,i.deleteAssetType=lo,i.deleteAssetTypeAttachment=Iu,i.deleteAssetTypeAttachments=qs,i.deleteAssetTypeFieldValues=Ol,i.deleteAssetTypeFieldValuesAttachment=dl,i.deleteAssetTypeFieldValuesAttachments=ks,i.deleteAssetTypeFieldValuesMany=Pl,i.deleteAssetTypeFields=Yu,i.deleteAssetTypeFieldsAttachment=zu,i.deleteAssetTypeFieldsAttachments=ju,i.deleteAssetTypeFieldsMany=Zu,i.deleteAssetTypeIdentifier=jl,i.deleteAssetTypeIdentifierValue=Zl,i.deleteAssetTypeIdentifierValues=Jl,i.deleteAssetTypeIdentifiers=Dl,i.deleteAssetTypeStatus=go,i.deleteAssetTypeStatuses=bo,i.deleteAssetTypes=oo,i.deleteAssets=Es,i.deleteConversation=LO,i.deleteConversations=NO,i.deleteDocument=th,i.deleteDocumentAttachment=Lo,i.deleteDocumentAttachments=No,i.deleteDocuments=sh,i.deleteEmailDomain=ph,i.deleteEmailDomains=Ah,i.deleteForm=Em,i.deleteFormIdentifier=Vh,i.deleteFormIdentifierValue=Kh,i.deleteFormIdentifierValues=Wh,i.deleteFormIdentifiers=Bh,i.deleteFormRevision=yi,i.deleteFormRevisionAttachment=cm,i.deleteFormRevisionAttachments=dm,i.deleteFormRevisions=pi,i.deleteFormSubmission=ty,i.deleteFormSubmissionAttachment=Gm,i.deleteFormSubmissionAttachments=Oi,i.deleteFormSubmissions=_i,i.deleteForms=vm,i.deleteGeoImage=py,i.deleteGeoImages=Ay,i.deleteIssue=vp,i.deleteIssueAssociation=Ry,i.deleteIssueAssociations=tt,i.deleteIssueAttachment=Hy,i.deleteIssueAttachments=zi,i.deleteIssueComment=Tp,i.deleteIssueCommentAttachment=ap,i.deleteIssueCommentAttachments=cp,i.deleteIssueComments=Ip,i.deleteIssueType=jf,i.deleteIssueTypeAttachment=Hp,i.deleteIssueTypeAttachments=Kp,i.deleteIssueTypeFieldValues=TA,i.deleteIssueTypeFieldValuesAttachment=KA,i.deleteIssueTypeFieldValuesAttachments=Xi,i.deleteIssueTypeFieldValuesMany=IA,i.deleteIssueTypeFields=BA,i.deleteIssueTypeFieldsAttachment=aA,i.deleteIssueTypeFieldsAttachments=cA,i.deleteIssueTypeFieldsMany=zA,i.deleteIssueTypeIdentifier=df,i.deleteIssueTypeIdentifierValue=Of,i.deleteIssueTypeIdentifierValues=Pf,i.deleteIssueTypeIdentifiers=rf,i.deleteIssueTypeStatus=Zf,i.deleteIssueTypeStatuses=Jf,i.deleteIssueTypes=Df,i.deleteIssueUpdate=on,i.deleteIssueUpdates=hn,i.deleteIssues=Ni,i.deleteOrganization=GS,i.deleteOrganizationAccess=wS,i.deleteOrganizationAccesses=ES,i.deleteOrganizations=kS,i.deleteProject=QT,i.deleteProjectAccess=lT,i.deleteProjectAccesses=oT,i.deleteProjectAttachment=FT,i.deleteProjectAttachments=gT,i.deleteProjectFile=qT,i.deleteProjectFiles=$T,i.deleteProjects=xT,i.deleteTeam=_I,i.deleteTeamMembership=mI,i.deleteTeamMemberships=yI,i.deleteTeams=RI,i.deleteUser=fn,i.deleteUsers=fS,i.dequeue=HI,i.discard=WI,i.documentAttachmentReducer=Ko,i.documentAttachmentSlice=ei,i.documentSlice=si,i.documentsReducer=ih,i.downloadFile=_O,i.emailDomainsReducer=Ih,i.emailDomainsSlice=ni,i.emailRegex=zO,i.enqueue=kI,i.enqueueRequest=QS,i.extractResponseFromError=ZI,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=St,i.fetchBlobFromObjectUrl=Yn,i.fetchFileFromObjectUrl=Zn,i.fileReducer=Fh,i.fileSlice=ci,i.formIdentifierReducer=qh,i.formIdentifierSlice=di,i.formIdentifierValueReducer=Xh,i.formIdentifierValueSlice=ui,i.formReducer=Vm,i.formRevisionAttachmentReducer=om,i.formRevisionAttachmentSlice=li,i.formRevisionReducer=Om,i.formRevisionsSlice=oi,i.formSlice=fi,i.formSubmissionAttachmentReducer=Wm,i.formSubmissionAttachmentSlice=Ti,i.formSubmissionReducer=cy,i.formSubmissionSlice=bi,i.geoImageReducer=Iy,i.geoImageSlice=wi,i.getAssetProcedureStepSubTree=ea,i.getAssetProcedureStepTrees=jO,i.getClientSDK=eO,i.getClientStore=lt,i.getDocumentSubTree=na,i.getDocumentTrees=DO,i.getFileExtension=Yt,i.getLocalDateString=Wn,i.getLocalRelativeDateString=gO,i.getOutboxCoordinator=at,i.getRenamedFile=MO,i.getRequestDescription=T,i.getS3FileKey=Wt,i.hashFile=Tt,i.initSDK=Wg,i.initializeAssetAttachments=ha,i.initializeAssetProcedureStepFieldValues=xd,i.initializeAssetProcedureStepFieldValuesAttachments=Ud,i.initializeAssetProcedureStepFields=_d,i.initializeAssetProcedureStepFieldsAttachments=md,i.initializeAssetProcedureSteps=mr,i.initializeAssetProcedureTypeAttachments=ba,i.initializeAssetProcedureTypeFieldValues=Mc,i.initializeAssetProcedureTypeFieldValuesAttachments=mc,i.initializeAssetProcedureTypeFields=xa,i.initializeAssetProcedureTypeFieldsAttachments=Ca,i.initializeAssetProcedureTypes=xc,i.initializeAssetProcedures=Uc,i.initializeAssetStageCompletions=Ur,i.initializeAssetStages=tu,i.initializeAssetTypeAttachments=yu,i.initializeAssetTypeFieldValues=yl,i.initializeAssetTypeFieldValuesAttachments=tl,i.initializeAssetTypeFields=Lu,i.initializeAssetTypeFieldsAttachments=_u,i.initializeAssetTypeIdentifierValues=Nl,i.initializeAssetTypeIdentifiers=Rl,i.initializeAssetTypeStatuses=fo,i.initializeAssetTypes=so,i.initializeAssets=_r,i.initializeConversations=ca,i.initializeDocumentAttachments=zo,i.initializeDocuments=Yo,i.initializeEmailDomains=rh,i.initializeFormIdentifierValues=Ch,i.initializeFormIdentifiers=bh,i.initializeFormRevisionAttachments=xh,i.initializeFormRevisions=mm,i.initializeFormSubmissionAttachments=qm,i.initializeFormSubmissions=Zm,i.initializeForms=Fm,i.initializeGeoImages=ry,i.initializeIssueAssociations=Py,i.initializeIssueAttachments=Cy,i.initializeIssueCommentAttachments=Qy,i.initializeIssueComments=hp,i.initializeIssueTypeAttachments=$p,i.initializeIssueTypeFieldValues=hA,i.initializeIssueTypeFieldValuesAttachments=UA,i.initializeIssueTypeFields=MA,i.initializeIssueTypeFieldsAttachments=Qp,i.initializeIssueTypeIdentifierValues=yf,i.initializeIssueTypeIdentifiers=xA,i.initializeIssueTypeStatuses=Nf,i.initializeIssueTypes=Rf,i.initializeIssueUpdates=tS,i.initializeIssues=bp,i.initializeOrganizationAccesses=PS,i.initializeOrganizations=DS,i.initializeProjectAccesses=iT,i.initializeProjectAttachments=AT,i.initializeProjectFiles=ET,i.initializeProjects=HT,i.initializeTeamMemberships=cI,i.initializeTeams=II,i.initializeUsers=oS,i.isObjectUrl=Jn,i.isToday=FO,i.issueAssociationReducer=qy,i.issueAssociationSlice=vi,i.issueAttachmentReducer=Jy,i.issueAttachmentSlice=Vi,i.issueCommentAttachmentReducer=lp,i.issueCommentAttachmentSlice=Di,i.issueCommentReducer=Fp,i.issueCommentSlice=$i,i.issueReducer=Dp,i.issueSlice=Ui,i.issueTypeAttachmentReducer=Jp,i.issueTypeAttachmentSlice=Gi,i.issueTypeFieldValuesAttachmentReducer=XA,i.issueTypeFieldValuesAttachmentSlice=Zi,i.issueTypeFieldValuesReducer=gA,i.issueTypeFieldValuesSlice=Wi,i.issueTypeFieldsAttachmentReducer=lA,i.issueTypeFieldsAttachmentSlice=Hi,i.issueTypeFieldsReducer=$A,i.issueTypeFieldsSlice=Yi,i.issueTypeIdentifierReducer=hf,i.issueTypeIdentifierSlice=xi,i.issueTypeIdentifierValueReducer=Mf,i.issueTypeIdentifierValueSlice=tn,i.issueTypeReducer=Uf,i.issueTypeSlice=sn,i.issueTypeStatusReducer=xf,i.issueTypeStatusSlice=an,i.issueTypeStatusSortFn=sa,i.issueUpdateReducer=uS,i.issueUpdateSlice=rn,i.logOnlyOnce=RO,i.markAsDeleted=xS,i.markForDeletion=aF,i.memoize=Ht,i.organizationAccessReducer=vS,i.organizationAccessSlice=Tn,i.organizationReducer=ZS,i.organizationSlice=In,i.outboxReducer=tT,i.outboxSlice=On,i.overmapEnhancer=RF,i.overmapReducer=IF,i.overmapReducers=jI,i.performRequest=jn,i.performRequestFromAction=KI,i.projectAccessReducer=hT,i.projectAccessSlice=Pn,i.projectAttachmentReducer=RT,i.projectAttachmentSlice=gn,i.projectFileReducer=GT,i.projectFileSlice=Mn,i.projectReducer=eI,i.projectSlice=_n,i.rehydratedReducer=nI,i.rehydratedSlice=Rn,i.restructureSelectorWithArgs=f,i.runMiddleware=nO,i.selectAccessToken=FP,i.selectAccessesByUserOfProject=dF,i.selectAccessibleProjects=lF,i.selectActiveOrganizationAccess=tF,i.selectAllDocumentAttachments=ti,i.selectAssetAttachmentById=Ia,i.selectAssetAttachmentMapping=Ta,i.selectAssetAttachments=ts,i.selectAssetAttachmentsByIds=Oa,i.selectAssetById=Dr,i.selectAssetProcedureById=Jc,i.selectAssetProcedureStepById=Fr,i.selectAssetProcedureStepFieldValues=ht,i.selectAssetProcedureStepFieldValuesAttachmentById=Yd,i.selectAssetProcedureStepFieldValuesAttachments=gs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Zd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Wd,i.selectAssetProcedureStepFieldValuesById=ur,i.selectAssetProcedureStepFieldValuesByIds=lr,i.selectAssetProcedureStepFieldValuesMapping=rr,i.selectAssetProcedureStepFieldValuesOfAsset=iP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=nP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=aP,i.selectAssetProcedureStepFields=gt,i.selectAssetProcedureStepFieldsAttachmentById=Fd,i.selectAssetProcedureStepFieldsAttachments=Ss,i.selectAssetProcedureStepFieldsAttachmentsByIds=gd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Pd,i.selectAssetProcedureStepFieldsById=Dd,i.selectAssetProcedureStepFieldsByIds=qd,i.selectAssetProcedureStepFieldsMapping=Is,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=eP,i.selectAssetProcedureStepMapping=bt,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=gr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=cP,i.selectAssetProcedureStepsOfAssetProcedureType=dP,i.selectAssetProcedureTypeAttachmentById=Da,i.selectAssetProcedureTypeAttachmentMapping=ja,i.selectAssetProcedureTypeAttachments=is,i.selectAssetProcedureTypeAttachmentsByIds=qa,i.selectAssetProcedureTypeById=ld,i.selectAssetProcedureTypeFieldValues=Pt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Pc,i.selectAssetProcedureTypeFieldValuesAttachments=ls,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Fc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Oc,i.selectAssetProcedureTypeFieldValuesById=qc,i.selectAssetProcedureTypeFieldValuesByIds=$c,i.selectAssetProcedureTypeFieldValuesMapping=Dc,i.selectAssetProcedureTypeFieldValuesOfAsset=ZO,i.selectAssetProcedureTypeFields=Ot,i.selectAssetProcedureTypeFieldsAttachmentById=Ja,i.selectAssetProcedureTypeFieldsAttachments=as,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Xa,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Za,i.selectAssetProcedureTypeFieldsById=lc,i.selectAssetProcedureTypeFieldsByIds=oc,i.selectAssetProcedureTypeFieldsMapping=uc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=WO,i.selectAssetProcedureTypes=As,i.selectAssetProcedureTypesByIds=od,i.selectAssetProcedureTypesMapping=ud,i.selectAssetProcedureTypesOfOrganization=QO,i.selectAssetProcedures=Ft,i.selectAssetProceduresByIds=Xc,i.selectAssetProceduresMapping=Yc,i.selectAssetProceduresOfAssetProcedureType=Zc,i.selectAssetProceduresOfAssetType=XO,i.selectAssetStageById=ou,i.selectAssetStageCompletionById=Qr,i.selectAssetStageCompletionMapping=Jr,i.selectAssetStageCompletions=Xr,i.selectAssetStageCompletionsByIds=xr,i.selectAssetStages=zs,i.selectAssetStagesByIds=hu,i.selectAssetStagesMappingOfAssetProcedureType=uP,i.selectAssetStagesOfAssetProcedureType=lP,i.selectAssetTypeAttachmentById=Pu,i.selectAssetTypeAttachmentMapping=Ou,i.selectAssetTypeAttachments=$s,i.selectAssetTypeAttachmentsByIds=Fu,i.selectAssetTypeById=mo,i.selectAssetTypeFieldValues=_t,i.selectAssetTypeFieldValuesAttachmentById=ul,i.selectAssetTypeFieldValuesAttachments=Hs,i.selectAssetTypeFieldValuesAttachmentsByIds=ll,i.selectAssetTypeFieldValuesAttachmentsMapping=rl,i.selectAssetTypeFieldValuesById=gl,i.selectAssetTypeFieldValuesByIds=bl,i.selectAssetTypeFieldValuesMapping=Fl,i.selectAssetTypeFieldValuesOfAsset=yP,i.selectAssetTypeFields=mt,i.selectAssetTypeFieldsAttachmentById=qu,i.selectAssetTypeFieldsAttachments=Us,i.selectAssetTypeFieldsAttachmentsByIds=$u,i.selectAssetTypeFieldsAttachmentsMapping=Du,i.selectAssetTypeFieldsById=Xu,i.selectAssetTypeFieldsByIds=Qu,i.selectAssetTypeFieldsMapping=Ju,i.selectAssetTypeFieldsOfAssetType=hP,i.selectAssetTypeIdentifierById=$l,i.selectAssetTypeIdentifierMapping=ql,i.selectAssetTypeIdentifierValueById=Ql,i.selectAssetTypeIdentifierValueMapping=Xl,i.selectAssetTypeIdentifierValues=Rt,i.selectAssetTypeIdentifierValuesByIds=xl,i.selectAssetTypeIdentifierValuesOfAsset=fP,i.selectAssetTypeIdentifierValuesOfIdentifier=SP,i.selectAssetTypeIdentifiers=Ys,i.selectAssetTypeIdentifiersByIds=Cl,i.selectAssetTypeIdentifiersOfAssetType=AP,i.selectAssetTypeStatusById=_o,i.selectAssetTypeStatusMapping=Mo,i.selectAssetTypeStatuses=xs,i.selectAssetTypeStatusesByIds=Ro,i.selectAssetTypeStatusesOfAssetType=IP,i.selectAssetTypeValuesOfAssetType=pP,i.selectAssetTypes=Xs,i.selectAssetTypesByIds=yo,i.selectAssetTypesMapping=ho,i.selectAssetTypesOfOrganization=TP,i.selectAssets=Mt,i.selectAssetsByIds=qr,i.selectAssetsMapping=zr,i.selectAssetsOfAssetType=jr,i.selectAssetsOfProject=rP,i.selectAttachmentsOfAsset=Pa,i.selectAttachmentsOfAssetProcedureStepFieldValues=Jd,i.selectAttachmentsOfAssetProcedureStepFields=xO,i.selectAttachmentsOfAssetProcedureType=HO,i.selectAttachmentsOfAssetProcedureTypeFieldValues=gc,i.selectAttachmentsOfAssetProcedureTypeFields=KO,i.selectAttachmentsOfAssetType=gu,i.selectAttachmentsOfAssetTypeFieldValues=ol,i.selectAttachmentsOfAssetTypeFields=oP,i.selectAttachmentsOfDocument=bP,i.selectAttachmentsOfFormRevision=jP,i.selectAttachmentsOfFormSubmission=Km,i.selectAttachmentsOfIssue=Wy,i.selectAttachmentsOfIssueComment=CP,i.selectAttachmentsOfIssueType=NP,i.selectAttachmentsOfIssueTypeFieldValues=JA,i.selectAttachmentsOfIssueTypeFields=GP,i.selectAttachmentsOfProject=uF,i.selectCommentsOfIssue=UP,i.selectConversation=kO,i.selectConversationMapping=Xt,i.selectConversations=GO,i.selectCurrentUser=TS,i.selectDeletedRequests=iF,i.selectDescendantsOfAssetProcedureStep=br,i.selectDescendantsOfDocument=ch,i.selectDocumentAttachmentById=ko,i.selectDocumentAttachmentMapping=Go,i.selectDocumentAttachmentsByIds=Ho,i.selectDocumentById=nh,i.selectDocuments=Et,i.selectDocumentsByIds=ah,i.selectDocumentsMapping=ii,i.selectEmailDomainById=Sh,i.selectEmailDomains=ai,i.selectEmailDomainsAsMapping=fh,i.selectEmailDomainsByIds=Th,i.selectEmailDomainsOfOrganization=RP,i.selectFieldValuesOfAssetProcedure=JO,i.selectFormById=zm,i.selectFormIdentifierById=jh,i.selectFormIdentifierMapping=zh,i.selectFormIdentifierValueById=Zh,i.selectFormIdentifierValueMapping=Yh,i.selectFormIdentifierValues=vt,i.selectFormIdentifierValuesByIds=Jh,i.selectFormIdentifierValuesOfFormSubmission=BP,i.selectFormIdentifierValuesOfIdentifier=zP,i.selectFormIdentifiers=ri,i.selectFormIdentifiersByIds=Dh,i.selectFormIdentifiersOfForm=VP,i.selectFormMapping=Bm,i.selectFormRevisionAttachmentById=um,i.selectFormRevisionAttachments=rm,i.selectFormRevisionAttachmentsByIds=lm,i.selectFormRevisionAttachmentsMapping=Vt,i.selectFormRevisionById=Sm,i.selectFormRevisionMapping=Ai,i.selectFormRevisions=Bt,i.selectFormRevisionsByIds=Tm,i.selectFormRevisionsOfForm=Im,i.selectFormSubmissionAttachemntsByIds=gi,i.selectFormSubmissionAttachmentById=km,i.selectFormSubmissionAttachments=Fi,i.selectFormSubmissionAttachmentsByIds=Hm,i.selectFormSubmissionAttachmentsMapping=Pi,i.selectFormSubmissionById=iy,i.selectFormSubmissions=sy,i.selectFormSubmissionsByIds=ny,i.selectFormSubmissionsMapping=Ri,i.selectFormSubmissionsOfForm=ay,i.selectForms=Si,i.selectFormsByIds=jm,i.selectFormsOfOrganization=qP,i.selectGeoImageById=Sy,i.selectGeoImageMapping=fy,i.selectGeoImages=Ei,i.selectGeoImagesByIds=Ty,i.selectGeoImagesOfProject=$P,i.selectIsLoggedIn=gP,i.selectIssueAssociationById=Ey,i.selectIssueAssociationMapping=wy,i.selectIssueAssociations=st,i.selectIssueAssociationsByIds=vy,i.selectIssueAssociationsOfAsset=Dy,i.selectIssueAssociationsOfIssue=jy,i.selectIssueAssociationsOfIssues=zy,i.selectIssueAssociationsToIssue=Vy,i.selectIssueAssociationsToIssues=By,i.selectIssueAttachmentById=Yy,i.selectIssueAttachmentMapping=Ky,i.selectIssueAttachments=ji,i.selectIssueAttachmentsByIds=Zy,i.selectIssueById=Bp,i.selectIssueCommentAttachmentById=rp,i.selectIssueCommentAttachmentMapping=dp,i.selectIssueCommentAttachments=qi,i.selectIssueCommentAttachmentsByIds=up,i.selectIssueCommentById=Op,i.selectIssueCommentMapping=Ci,i.selectIssueCommentsByIds=Pp,i.selectIssueMapping=Vp,i.selectIssueTypeAttachmentById=Yp,i.selectIssueTypeAttachmentMapping=Wp,i.selectIssueTypeAttachments=ki,i.selectIssueTypeAttachmentsByIds=Zp,i.selectIssueTypeById=$f,i.selectIssueTypeFieldValues=jt,i.selectIssueTypeFieldValuesAttachmentById=YA,i.selectIssueTypeFieldValuesAttachments=Qi,i.selectIssueTypeFieldValuesAttachmentsByIds=ZA,i.selectIssueTypeFieldValuesAttachmentsMapping=WA,i.selectIssueTypeFieldValuesById=PA,i.selectIssueTypeFieldValuesByIds=FA,i.selectIssueTypeFieldValuesMapping=OA,i.selectIssueTypeFieldValuesOfIssue=kP,i.selectIssueTypeFields=yt,i.selectIssueTypeFieldsAttachmentById=rA,i.selectIssueTypeFieldsAttachments=Ki,i.selectIssueTypeFieldsAttachmentsByIds=uA,i.selectIssueTypeFieldsAttachmentsMapping=dA,i.selectIssueTypeFieldsById=DA,i.selectIssueTypeFieldsByIds=qA,i.selectIssueTypeFieldsMapping=jA,i.selectIssueTypeFieldsOfIssueType=HP,i.selectIssueTypeIdentifierById=lf,i.selectIssueTypeIdentifierMapping=uf,i.selectIssueTypeIdentifierValueById=gf,i.selectIssueTypeIdentifierValueMapping=Ff,i.selectIssueTypeIdentifierValues=Dt,i.selectIssueTypeIdentifierValuesByIds=bf,i.selectIssueTypeIdentifierValuesOfIdentifier=JP,i.selectIssueTypeIdentifierValuesOfIssue=ZP,i.selectIssueTypeIdentifiers=en,i.selectIssueTypeIdentifiersByIds=of,i.selectIssueTypeIdentifiersOfIssueType=YP,i.selectIssueTypeMapping=qf,i.selectIssueTypeStatusById=dn,i.selectIssueTypeStatusMapping=Xf,i.selectIssueTypeStatuses=cn,i.selectIssueTypeStatusesByIds=Qf,i.selectIssueTypeStatusesOfIssueType=QP,i.selectIssueTypeValuesOfIssueType=WP,i.selectIssueTypes=nn,i.selectIssueTypesByIds=Cf,i.selectIssueTypesOfOrganization=XP,i.selectIssueUpdateById=cS,i.selectIssueUpdateMapping=mn,i.selectIssueUpdates=yn,i.selectIssueUpdatesByIds=dS,i.selectIssueUpdatesOfIssue=rS,i.selectIssues=zt,i.selectIssuesByIds=zp,i.selectIssuesOfIssueType=jp,i.selectIssuesOfProject=LP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=tP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=YO,i.selectLatestAssetTypeFieldsOfAssetType=mP,i.selectLatestFieldsByAssetProcedureStep=sP,i.selectLatestFormRevisionOfForm=DP,i.selectLatestIssueTypeFieldsOfIssueType=KP,i.selectLatestRetryTime=nF,i.selectMembershipsByUserOfTeam=pF,i.selectOrganizationAccessById=VS,i.selectOrganizationAccessMapping=Ct,i.selectOrganizationAccessUserMapping=zS,i.selectOrganizationAccessesByIds=BS,i.selectOrganizationById=WS,i.selectOrganizationDocuments=_P,i.selectOrganizations=KS,i.selectOrganizationsByIds=YS,i.selectOrganizationsMapping=HS,i.selectProjectAccessById=mT,i.selectProjectAccessMapping=Fn,i.selectProjectAccesses=pt,i.selectProjectAccessesByIds=yT,i.selectProjectAccessesOfProject=cF,i.selectProjectAttachmentById=MT,i.selectProjectAttachmentMapping=bT,i.selectProjectAttachments=bn,i.selectProjectAttachmentsByIds=_T,i.selectProjectById=sI,i.selectProjectDocuments=MP,i.selectProjectFileById=LT,i.selectProjectFileMapping=CT,i.selectProjectFiles=UT,i.selectProjectFilesByIds=NT,i.selectProjectMapping=tI,i.selectProjects=Ut,i.selectProjectsByIds=iI,i.selectProjectsOfOrganization=oF,i.selectRehydrated=yF,i.selectStageMapping=Bs,i.selectTeamById=EI,i.selectTeamMembershipById=fI,i.selectTeamMemberships=Lt,i.selectTeamMembershipsByIds=SI,i.selectTeamMembershipsMapping=AI,i.selectTeams=vn,i.selectTeamsByIds=vI,i.selectTeamsMapping=wI,i.selectTeamsOfOrganization=fF,i.selectUploadUrl=vP,i.selectUserById=$t,i.selectUsers=qt,i.selectUsersByIds=IS,i.selectUsersMapping=Sn,i.selectUsersOfOrganization=sF,i.selectUsersOfProject=rF,i.selectUsersOfTeam=AF,i.setAsset=Vr,i.setAssetAttachment=ya,i.setAssetAttachments=pa,i.setAssetProcedure=Hc,i.setAssetProcedureStep=yr,i.setAssetProcedureStepFieldValues=sr,i.setAssetProcedureStepFieldValuesAttachment=Nd,i.setAssetProcedureStepFieldValuesAttachments=Gd,i.setAssetProcedureStepFieldValuesMany=ir,i.setAssetProcedureStepFields=Ed,i.setAssetProcedureStepFieldsAttachment=Ad,i.setAssetProcedureStepFieldsAttachments=fd,i.setAssetProcedureStepFieldsMany=vd,i.setAssetProcedureSteps=pr,i.setAssetProcedureType=cd,i.setAssetProcedureTypeAttachment=Ra,i.setAssetProcedureTypeAttachments=wa,i.setAssetProcedureTypeFieldValues=wc,i.setAssetProcedureTypeFieldValuesAttachment=pc,i.setAssetProcedureTypeFieldValuesAttachments=Ac,i.setAssetProcedureTypeFieldValuesMany=Ec,i.setAssetProcedureTypeFields=sc,i.setAssetProcedureTypeFieldsAttachment=Na,i.setAssetProcedureTypeFieldsAttachments=Ga,i.setAssetProcedureTypeFieldsMany=ic,i.setAssetProcedureTypes=dd,i.setAssetProcedures=Kc,i.setAssetStage=su,i.setAssetStageCompletion=Gr,i.setAssetStageCompletions=kr,i.setAssetStages=iu,i.setAssetType=io,i.setAssetTypeAttachment=Au,i.setAssetTypeAttachments=fu,i.setAssetTypeFieldValues=fl,i.setAssetTypeFieldValuesAttachment=il,i.setAssetTypeFieldValuesAttachments=nl,i.setAssetTypeFieldValuesMany=Sl,i.setAssetTypeFields=ku,i.setAssetTypeFieldsAttachment=Eu,i.setAssetTypeFieldsAttachments=vu,i.setAssetTypeFieldsMany=Hu,i.setAssetTypeIdentifier=vl,i.setAssetTypeIdentifierValue=Hl,i.setAssetTypeIdentifierValues=Kl,i.setAssetTypeIdentifiers=Vl,i.setAssetTypeStatus=Io,i.setAssetTypeStatuses=Oo,i.setAssetTypes=no,i.setAssets=Br,i.setClientSDK=xI,i.setClientStore=XI,i.setConversation=ra,i.setConversations=CO,i.setCurrentUser=xP,i.setDocument=Xo,i.setDocumentAttachment=qo,i.setDocumentAttachments=$o,i.setDocuments=Qo,i.setEmailDomain=oh,i.setEmailDomains=hh,i.setForm=Mm,i.setFormIdentifier=Rh,i.setFormIdentifierValue=Nh,i.setFormIdentifierValues=Gh,i.setFormIdentifiers=wh,i.setFormRevision=ym,i.setFormRevisionAttachment=sm,i.setFormRevisionAttachments=im,i.setFormRevisions=pm,i.setFormSubmission=Jm,i.setFormSubmissionAttachment=Cm,i.setFormSubmissionAttachments=Um,i.setFormSubmissions=Xm,i.setForms=_m,i.setGeoImage=uy,i.setGeoImages=ly,i.setIssue=_p,i.setIssueAssociation=gy,i.setIssueAssociations=Fy,i.setIssueAttachment=Ly,i.setIssueAttachments=Ny,i.setIssueComment=pp,i.setIssueCommentAttachment=tp,i.setIssueCommentAttachments=sp,i.setIssueComments=Ap,i.setIssueType=vf,i.setIssueTypeAttachment=Lp,i.setIssueTypeAttachments=Np,i.setIssueTypeFieldValues=pA,i.setIssueTypeFieldValuesAttachment=NA,i.setIssueTypeFieldValuesAttachments=GA,i.setIssueTypeFieldValuesMany=AA,i.setIssueTypeFields=wA,i.setIssueTypeFieldsAttachment=tA,i.setIssueTypeFieldsAttachments=sA,i.setIssueTypeFieldsMany=EA,i.setIssueTypeIdentifier=sf,i.setIssueTypeIdentifierValue=ff,i.setIssueTypeIdentifierValues=Sf,i.setIssueTypeIdentifiers=nf,i.setIssueTypeStatus=Hf,i.setIssueTypeStatuses=Kf,i.setIssueTypes=Vf,i.setIssueUpdate=sS,i.setIssueUpdates=iS,i.setIssues=Rp,i.setLoggedIn=vo,i.setOrganization=$S,i.setOrganizationAccess=bS,i.setOrganizationAccesses=MS,i.setOrganizations=qS,i.setProfilePicture=eF,i.setProject=WT,i.setProjectAccess=cT,i.setProjectAccesses=dT,i.setProjectAttachment=TT,i.setProjectAttachments=IT,i.setProjectFile=vT,i.setProjectFiles=VT,i.setProjects=KT,i.setRehydrated=mF,i.setTeam=FI,i.setTeamMembership=uI,i.setTeamMemberships=lI,i.setTeams=gI,i.setTokens=OP,i.setUploadUrl=EP,i.setUser=mS,i.setUsers=hS,i.shallowEqual=TO,i.slugify=VO,i.spacesToDashesLower=vO,i.teamMembershipReducer=pI,i.teamMembershipSlice=wn,i.teamReducer=VI,i.teamSlice=En,i.toFileNameSafeString=EO,i.toUuidArray=B,i.toUuidIdRecord=wO,i.truncate=BO,i.updateAsset=wr,i.updateAssetAttachment=Aa,i.updateAssetAttachments=fa,i.updateAssetProcedure=Nc,i.updateAssetProcedureStep=Sr,i.updateAssetProcedureStepFieldValues=nr,i.updateAssetProcedureStepFieldValuesAttachment=kd,i.updateAssetProcedureStepFieldValuesAttachments=Hd,i.updateAssetProcedureStepFieldValuesMany=ar,i.updateAssetProcedureStepFields=Vd,i.updateAssetProcedureStepFieldsAttachment=Sd,i.updateAssetProcedureStepFieldsAttachments=Td,i.updateAssetProcedureStepFieldsMany=Bd,i.updateAssetProcedureSteps=Tr,i.updateAssetProcedureType=sd,i.updateAssetProcedureTypeAttachment=Ea,i.updateAssetProcedureTypeAttachments=va,i.updateAssetProcedureTypeFieldValues=vc,i.updateAssetProcedureTypeFieldValuesAttachment=fc,i.updateAssetProcedureTypeFieldValuesAttachments=Sc,i.updateAssetProcedureTypeFieldValuesMany=Vc,i.updateAssetProcedureTypeFields=nc,i.updateAssetProcedureTypeFieldsAttachment=ka,i.updateAssetProcedureTypeFieldsAttachments=Ha,i.updateAssetProcedureTypeFieldsMany=ac,i.updateAssetProcedureTypes=id,i.updateAssetProcedures=Gc,i.updateAssetStage=cu,i.updateAssetStageCompletion=Hr,i.updateAssetStageCompletions=Kr,i.updateAssetStages=du,i.updateAssetType=ro,i.updateAssetTypeAttachment=Su,i.updateAssetTypeAttachments=Tu,i.updateAssetTypeFieldValues=Tl,i.updateAssetTypeFieldValuesAttachment=al,i.updateAssetTypeFieldValuesAttachments=cl,i.updateAssetTypeFieldValuesMany=Il,i.updateAssetTypeFields=Ku,i.updateAssetTypeFieldsAttachment=Vu,i.updateAssetTypeFieldsAttachments=Bu,i.updateAssetTypeFieldsMany=Wu,i.updateAssetTypeIdentifier=Bl,i.updateAssetTypeIdentifierValue=Wl,i.updateAssetTypeIdentifierValues=Yl,i.updateAssetTypeIdentifiers=zl,i.updateAssetTypeStatus=Po,i.updateAssetTypeStatuses=Fo,i.updateAssetTypes=uo,i.updateAssets=Er,i.updateConversation=ua,i.updateConversations=UO,i.updateDocument=xo,i.updateDocumentAttachment=Co,i.updateDocumentAttachments=Uo,i.updateDocuments=eh,i.updateEmailDomain=mh,i.updateEmailDomains=yh,i.updateForm=Rm,i.updateFormIdentifier=Eh,i.updateFormIdentifierValue=kh,i.updateFormIdentifierValues=Hh,i.updateFormIdentifiers=vh,i.updateFormRevision=Am,i.updateFormRevisionAttachment=nm,i.updateFormRevisionAttachments=am,i.updateFormRevisions=fm,i.updateFormSubmission=xm,i.updateFormSubmissionAttachment=Lm,i.updateFormSubmissionAttachments=Nm,i.updateFormSubmissions=ey,i.updateForms=wm,i.updateGeoImage=my,i.updateGeoImages=yy,i.updateIssue=wp,i.updateIssueAssociation=by,i.updateIssueAssociations=My,i.updateIssueAttachment=Gy,i.updateIssueAttachments=ky,i.updateIssueComment=fp,i.updateIssueCommentAttachment=ip,i.updateIssueCommentAttachments=np,i.updateIssueComments=Sp,i.updateIssueType=Bf,i.updateIssueTypeAttachment=Gp,i.updateIssueTypeAttachments=kp,i.updateIssueTypeFieldValues=fA,i.updateIssueTypeFieldValuesAttachment=kA,i.updateIssueTypeFieldValuesAttachments=HA,i.updateIssueTypeFieldValuesMany=SA,i.updateIssueTypeFields=vA,i.updateIssueTypeFieldsAttachment=iA,i.updateIssueTypeFieldsAttachments=nA,i.updateIssueTypeFieldsMany=VA,i.updateIssueTypeIdentifier=af,i.updateIssueTypeIdentifierValue=Tf,i.updateIssueTypeIdentifierValues=If,i.updateIssueTypeIdentifiers=cf,i.updateIssueTypeStatus=Wf,i.updateIssueTypeStatuses=Yf,i.updateIssueTypes=zf,i.updateIssueUpdate=nS,i.updateIssueUpdates=aS,i.updateIssues=Ep,i.updateOrganization=NS,i.updateOrganizationAccess=_S,i.updateOrganizationAccesses=RS,i.updateOrganizations=LS,i.updateProject=XT,i.updateProjectAccess=rT,i.updateProjectAccesses=uT,i.updateProjectAttachment=OT,i.updateProjectAttachments=PT,i.updateProjectFile=jT,i.updateProjectFiles=DT,i.updateProjects=JT,i.updateTeam=bI,i.updateTeamMembership=oI,i.updateTeamMemberships=hI,i.updateTeams=MI,i.updateUser=AS,i.updateUsers=pS,i.useSelectorBuilder=SO,i.userReducer=SS,i.userSlice=pn,i.uuidObj=P,i.uuidObjSortFn=Zt,i.uuidSortFn=It,i.versioningReducer=zI,i.versioningSlice=BI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|