@overmap-ai/core 1.1.0-gcs.0 → 1.1.0-gcs.1
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 +59 -63
- package/dist/overmap-core.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3670,7 +3670,7 @@ class B extends at {
|
|
|
3670
3670
|
);
|
|
3671
3671
|
}
|
|
3672
3672
|
}
|
|
3673
|
-
class
|
|
3673
|
+
class $ extends B {
|
|
3674
3674
|
constructor() {
|
|
3675
3675
|
super(...arguments);
|
|
3676
3676
|
l(this, "pageSize", nI);
|
|
@@ -3723,10 +3723,10 @@ class x extends B {
|
|
|
3723
3723
|
const { addMany: n, updateMany: a, deleteMany: r } = this.actions, d = (/* @__PURE__ */ new Date()).toISOString(), c = [], h = /* @__PURE__ */ new Set(), u = Xe(e, Math.min(i ?? e.length, Je)), m = [];
|
|
3724
3724
|
for (const b of u) {
|
|
3725
3725
|
const O = [], F = {}, v = [], D = [];
|
|
3726
|
-
for (const
|
|
3726
|
+
for (const j of b) {
|
|
3727
3727
|
let q;
|
|
3728
|
-
if ("file" in
|
|
3729
|
-
const { file: It, ...dr } =
|
|
3728
|
+
if ("file" in j) {
|
|
3729
|
+
const { file: It, ...dr } = j, et = await this.client.files.getFilePayload(It);
|
|
3730
3730
|
et.sha1 in F || (F[et.sha1] = et);
|
|
3731
3731
|
const Jt = URL.createObjectURL(It);
|
|
3732
3732
|
h.add(Jt), q = {
|
|
@@ -3738,14 +3738,14 @@ class x extends B {
|
|
|
3738
3738
|
file_url: Jt
|
|
3739
3739
|
};
|
|
3740
3740
|
} else
|
|
3741
|
-
q =
|
|
3742
|
-
const
|
|
3743
|
-
c.push(
|
|
3744
|
-
const C = this.buildBulkPayload(
|
|
3741
|
+
q = j;
|
|
3742
|
+
const x = this.buildModel(q);
|
|
3743
|
+
c.push(x);
|
|
3744
|
+
const C = this.buildBulkPayload(x);
|
|
3745
3745
|
O.push(C);
|
|
3746
|
-
const pt = this.getBlockers(
|
|
3746
|
+
const pt = this.getBlockers(x);
|
|
3747
3747
|
v.push(...pt);
|
|
3748
|
-
const cr = this.getBlocks(
|
|
3748
|
+
const cr = this.getBlocks(x);
|
|
3749
3749
|
D.push(...cr);
|
|
3750
3750
|
}
|
|
3751
3751
|
const z = {
|
|
@@ -3789,8 +3789,8 @@ class x extends B {
|
|
|
3789
3789
|
for (const [D, z] of Object.entries(v))
|
|
3790
3790
|
try {
|
|
3791
3791
|
await z, O.push(D);
|
|
3792
|
-
} catch (
|
|
3793
|
-
throw console.error("Upload to s3 using presigned url failed.",
|
|
3792
|
+
} catch (j) {
|
|
3793
|
+
throw console.error("Upload to s3 using presigned url failed.", j), j;
|
|
3794
3794
|
}
|
|
3795
3795
|
}
|
|
3796
3796
|
return O;
|
|
@@ -3815,7 +3815,7 @@ class x extends B {
|
|
|
3815
3815
|
}
|
|
3816
3816
|
}
|
|
3817
3817
|
}
|
|
3818
|
-
class sP extends
|
|
3818
|
+
class sP extends $ {
|
|
3819
3819
|
constructor() {
|
|
3820
3820
|
super(...arguments);
|
|
3821
3821
|
l(this, "name", "Asset attachment");
|
|
@@ -3985,7 +3985,7 @@ class iP extends B {
|
|
|
3985
3985
|
return this.dispatch(n(r)), r;
|
|
3986
3986
|
}
|
|
3987
3987
|
}
|
|
3988
|
-
class nP extends
|
|
3988
|
+
class nP extends $ {
|
|
3989
3989
|
constructor() {
|
|
3990
3990
|
super(...arguments);
|
|
3991
3991
|
l(this, "name", "Asset Procedure Step Field Values Attachment");
|
|
@@ -4154,7 +4154,7 @@ class aP extends B {
|
|
|
4154
4154
|
this.dispatch(r(m));
|
|
4155
4155
|
const w = [];
|
|
4156
4156
|
for (const b of E) {
|
|
4157
|
-
const { field_values: O } = b, F = O.map(({ asset: q }) => q), v = O.map(({ fields_revision: q }) => q), D = O.map(({ asset_procedure: q }) => q), z = O.map(({ uuid: q }) => q),
|
|
4157
|
+
const { field_values: O } = b, F = O.map(({ asset: q }) => q), v = O.map(({ fields_revision: q }) => q), D = O.map(({ asset_procedure: q }) => q), z = O.map(({ uuid: q }) => q), j = this.enqueueRequest({
|
|
4158
4158
|
description: A(o.POST, this.name, !0),
|
|
4159
4159
|
method: o.POST,
|
|
4160
4160
|
url: `${this.url}/bulk/`,
|
|
@@ -4162,7 +4162,7 @@ class aP extends B {
|
|
|
4162
4162
|
blockers: F.concat(v).concat(D),
|
|
4163
4163
|
blocks: z
|
|
4164
4164
|
});
|
|
4165
|
-
w.push(
|
|
4165
|
+
w.push(j);
|
|
4166
4166
|
}
|
|
4167
4167
|
return Promise.all(w).then((b) => {
|
|
4168
4168
|
this.dispatch(d(b.flat()));
|
|
@@ -4232,7 +4232,7 @@ class aP extends B {
|
|
|
4232
4232
|
return this.dispatch(n(r)), r;
|
|
4233
4233
|
}
|
|
4234
4234
|
}
|
|
4235
|
-
class rP extends
|
|
4235
|
+
class rP extends $ {
|
|
4236
4236
|
constructor() {
|
|
4237
4237
|
super(...arguments);
|
|
4238
4238
|
l(this, "name", "Asset Procedure Step Fields Attachment");
|
|
@@ -4504,7 +4504,7 @@ class dP extends B {
|
|
|
4504
4504
|
return this.dispatch(n(a)), a;
|
|
4505
4505
|
}
|
|
4506
4506
|
}
|
|
4507
|
-
class uP extends
|
|
4507
|
+
class uP extends $ {
|
|
4508
4508
|
constructor() {
|
|
4509
4509
|
super(...arguments);
|
|
4510
4510
|
l(this, "name", "Asset Procedure Attachment");
|
|
@@ -4581,7 +4581,7 @@ class uP extends x {
|
|
|
4581
4581
|
return this.dispatch(n(a)), a;
|
|
4582
4582
|
}
|
|
4583
4583
|
}
|
|
4584
|
-
class oP extends
|
|
4584
|
+
class oP extends $ {
|
|
4585
4585
|
constructor() {
|
|
4586
4586
|
super(...arguments);
|
|
4587
4587
|
l(this, "name", "Asset Procedure Type Field Values Attachment");
|
|
@@ -4749,7 +4749,7 @@ class lP extends B {
|
|
|
4749
4749
|
this.dispatch(r(m));
|
|
4750
4750
|
const w = [];
|
|
4751
4751
|
for (const b of E) {
|
|
4752
|
-
const { field_values: O } = b, F = O.map(({ asset: q }) => q), v = O.map(({ fields_revision: q }) => q), D = O.map(({ asset_procedure: q }) => q), z = O.map(({ uuid: q }) => q),
|
|
4752
|
+
const { field_values: O } = b, F = O.map(({ asset: q }) => q), v = O.map(({ fields_revision: q }) => q), D = O.map(({ asset_procedure: q }) => q), z = O.map(({ uuid: q }) => q), j = this.enqueueRequest({
|
|
4753
4753
|
description: A(o.POST, this.name, !0),
|
|
4754
4754
|
method: o.POST,
|
|
4755
4755
|
url: `${this.url}/bulk/`,
|
|
@@ -4757,7 +4757,7 @@ class lP extends B {
|
|
|
4757
4757
|
blockers: F.concat(v).concat(D),
|
|
4758
4758
|
blocks: z
|
|
4759
4759
|
});
|
|
4760
|
-
w.push(
|
|
4760
|
+
w.push(j);
|
|
4761
4761
|
}
|
|
4762
4762
|
return Promise.all(w).then((b) => {
|
|
4763
4763
|
this.dispatch(d(b.flat()));
|
|
@@ -4825,7 +4825,7 @@ class lP extends B {
|
|
|
4825
4825
|
return this.dispatch(n(r)), r;
|
|
4826
4826
|
}
|
|
4827
4827
|
}
|
|
4828
|
-
class hP extends
|
|
4828
|
+
class hP extends $ {
|
|
4829
4829
|
constructor() {
|
|
4830
4830
|
super(...arguments);
|
|
4831
4831
|
l(this, "name", "Asset Procedure Type Fields Attachment");
|
|
@@ -5453,7 +5453,7 @@ class AP extends B {
|
|
|
5453
5453
|
return this.dispatch(n(a)), a;
|
|
5454
5454
|
}
|
|
5455
5455
|
}
|
|
5456
|
-
class TP extends
|
|
5456
|
+
class TP extends $ {
|
|
5457
5457
|
constructor() {
|
|
5458
5458
|
super(...arguments);
|
|
5459
5459
|
l(this, "name", "Asset Type Attachment");
|
|
@@ -5525,7 +5525,7 @@ class TP extends x {
|
|
|
5525
5525
|
return this.dispatch(n(a)), a;
|
|
5526
5526
|
}
|
|
5527
5527
|
}
|
|
5528
|
-
class OP extends
|
|
5528
|
+
class OP extends $ {
|
|
5529
5529
|
constructor() {
|
|
5530
5530
|
super(...arguments);
|
|
5531
5531
|
l(this, "name", "Asset Type Field Values Attachment");
|
|
@@ -5766,7 +5766,7 @@ class SP extends B {
|
|
|
5766
5766
|
return this.dispatch(n(r)), r;
|
|
5767
5767
|
}
|
|
5768
5768
|
}
|
|
5769
|
-
class IP extends
|
|
5769
|
+
class IP extends $ {
|
|
5770
5770
|
constructor() {
|
|
5771
5771
|
super(...arguments);
|
|
5772
5772
|
l(this, "name", "Asset Type Fields Attachment");
|
|
@@ -6055,13 +6055,13 @@ class PP extends B {
|
|
|
6055
6055
|
created_by: c
|
|
6056
6056
|
});
|
|
6057
6057
|
m.push(z);
|
|
6058
|
-
const
|
|
6058
|
+
const j = {
|
|
6059
6059
|
uuid: z.uuid,
|
|
6060
6060
|
asset: z.asset,
|
|
6061
6061
|
asset_type_identifier: z.asset_type_identifier,
|
|
6062
6062
|
value: z.value
|
|
6063
6063
|
};
|
|
6064
|
-
b.push(
|
|
6064
|
+
b.push(j), O.push(z.asset), O.push(z.asset_type_identifier), F.push(z.uuid);
|
|
6065
6065
|
}
|
|
6066
6066
|
const v = {
|
|
6067
6067
|
payloads: b,
|
|
@@ -6316,7 +6316,7 @@ class MP extends B {
|
|
|
6316
6316
|
return this.dispatch(n(a)), a;
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
6319
|
-
class FP extends
|
|
6319
|
+
class FP extends $ {
|
|
6320
6320
|
constructor() {
|
|
6321
6321
|
super(...arguments);
|
|
6322
6322
|
l(this, "name", "Document Attachment");
|
|
@@ -6853,7 +6853,7 @@ class kP extends B {
|
|
|
6853
6853
|
return this.dispatch(n(r)), r;
|
|
6854
6854
|
}
|
|
6855
6855
|
}
|
|
6856
|
-
class vP extends
|
|
6856
|
+
class vP extends $ {
|
|
6857
6857
|
constructor() {
|
|
6858
6858
|
super(...arguments);
|
|
6859
6859
|
l(this, "name", "Form Revision Attachment");
|
|
@@ -7084,7 +7084,7 @@ class VP extends B {
|
|
|
7084
7084
|
return this.dispatch(n(a)), a;
|
|
7085
7085
|
}
|
|
7086
7086
|
}
|
|
7087
|
-
class qP extends
|
|
7087
|
+
class qP extends $ {
|
|
7088
7088
|
constructor() {
|
|
7089
7089
|
super(...arguments);
|
|
7090
7090
|
l(this, "name", "Form Submission Attachment");
|
|
@@ -7286,7 +7286,7 @@ class jP extends B {
|
|
|
7286
7286
|
return this.dispatch(n(r)), r;
|
|
7287
7287
|
}
|
|
7288
7288
|
}
|
|
7289
|
-
class $P extends
|
|
7289
|
+
class $P extends $ {
|
|
7290
7290
|
constructor() {
|
|
7291
7291
|
super(...arguments);
|
|
7292
7292
|
l(this, "name", "Geo Image");
|
|
@@ -7487,7 +7487,7 @@ class xP extends B {
|
|
|
7487
7487
|
return this.dispatch(n(r)), r;
|
|
7488
7488
|
}
|
|
7489
7489
|
}
|
|
7490
|
-
class DP extends
|
|
7490
|
+
class DP extends $ {
|
|
7491
7491
|
constructor() {
|
|
7492
7492
|
super(...arguments);
|
|
7493
7493
|
l(this, "name", "Issue Attachment");
|
|
@@ -7559,7 +7559,7 @@ class DP extends x {
|
|
|
7559
7559
|
return this.dispatch(n(r)), r;
|
|
7560
7560
|
}
|
|
7561
7561
|
}
|
|
7562
|
-
class CP extends
|
|
7562
|
+
class CP extends $ {
|
|
7563
7563
|
constructor() {
|
|
7564
7564
|
super(...arguments);
|
|
7565
7565
|
l(this, "name", "Issue Comment Attachment");
|
|
@@ -7933,7 +7933,7 @@ class LP extends B {
|
|
|
7933
7933
|
return this.dispatch(n(r)), r;
|
|
7934
7934
|
}
|
|
7935
7935
|
}
|
|
7936
|
-
class NP extends
|
|
7936
|
+
class NP extends $ {
|
|
7937
7937
|
constructor() {
|
|
7938
7938
|
super(...arguments);
|
|
7939
7939
|
l(this, "name", "Issue Type Attachment");
|
|
@@ -8005,7 +8005,7 @@ class NP extends x {
|
|
|
8005
8005
|
return this.dispatch(n(a)), a;
|
|
8006
8006
|
}
|
|
8007
8007
|
}
|
|
8008
|
-
class HP extends
|
|
8008
|
+
class HP extends $ {
|
|
8009
8009
|
constructor() {
|
|
8010
8010
|
super(...arguments);
|
|
8011
8011
|
l(this, "name", "Issue Type Field Values Attachment");
|
|
@@ -8199,7 +8199,7 @@ class GP extends B {
|
|
|
8199
8199
|
return this.dispatch(n(r)), r;
|
|
8200
8200
|
}
|
|
8201
8201
|
}
|
|
8202
|
-
class WP extends
|
|
8202
|
+
class WP extends $ {
|
|
8203
8203
|
constructor() {
|
|
8204
8204
|
super(...arguments);
|
|
8205
8205
|
l(this, "name", "Issue Type Fields Attachment");
|
|
@@ -9112,7 +9112,7 @@ class ig extends B {
|
|
|
9112
9112
|
return this.dispatch(n(a)), a;
|
|
9113
9113
|
}
|
|
9114
9114
|
}
|
|
9115
|
-
class ng extends
|
|
9115
|
+
class ng extends $ {
|
|
9116
9116
|
constructor() {
|
|
9117
9117
|
super(...arguments);
|
|
9118
9118
|
l(this, "name", "Project Attachment");
|
|
@@ -9184,7 +9184,7 @@ class ng extends x {
|
|
|
9184
9184
|
return this.dispatch(n(a)), a;
|
|
9185
9185
|
}
|
|
9186
9186
|
}
|
|
9187
|
-
class ag extends
|
|
9187
|
+
class ag extends $ {
|
|
9188
9188
|
constructor() {
|
|
9189
9189
|
super(...arguments);
|
|
9190
9190
|
l(this, "name", "Project File");
|
|
@@ -9598,52 +9598,48 @@ async function ir(t, s, e, i, n) {
|
|
|
9598
9598
|
if (T && !F)
|
|
9599
9599
|
throw new Error(`Cannot upload file ${T} because it's not cached.`);
|
|
9600
9600
|
!E && !O.startsWith("http") && (!O.startsWith("/") && !O.startsWith("blob:") && (O = "/" + O), O = t + O);
|
|
9601
|
-
const v = (
|
|
9601
|
+
const v = (x) => {
|
|
9602
9602
|
if (T) {
|
|
9603
9603
|
if (!d) throw new Error(`No S3 URL for file ${T}`);
|
|
9604
9604
|
if ("warning" in d) throw new Error(`S3 URL warning for file ${T}`);
|
|
9605
9605
|
if (!F) throw new Error(`No file for file ${T}`);
|
|
9606
9606
|
const C = d.fields["x-amz-checksum-sha1"];
|
|
9607
9607
|
if (!C) throw new Error(`No checksum for file ${T}`);
|
|
9608
|
-
return
|
|
9608
|
+
return x.set("x-amz-checksum-sha1", C).field({ ...c, ...d.fields }).attach("file", F);
|
|
9609
9609
|
}
|
|
9610
|
-
return
|
|
9610
|
+
return x.send(c);
|
|
9611
9611
|
}, z = {
|
|
9612
9612
|
[o.GET]: () => b ? tt.get(O.toString()).responseType("blob") : tt.get(O.toString()),
|
|
9613
9613
|
[o.POST]: () => {
|
|
9614
|
-
const
|
|
9615
|
-
return v(
|
|
9614
|
+
const x = tt.post(O.toString());
|
|
9615
|
+
return v(x);
|
|
9616
9616
|
},
|
|
9617
9617
|
[o.PATCH]: () => {
|
|
9618
|
-
const
|
|
9619
|
-
return v(
|
|
9618
|
+
const x = tt.patch(O.toString());
|
|
9619
|
+
return v(x);
|
|
9620
9620
|
},
|
|
9621
9621
|
[o.PUT]: () => {
|
|
9622
|
-
const
|
|
9623
|
-
return v(
|
|
9622
|
+
const x = tt.put(O.toString());
|
|
9623
|
+
return v(x);
|
|
9624
9624
|
},
|
|
9625
9625
|
[o.DELETE]: () => {
|
|
9626
|
-
const
|
|
9627
|
-
return v(
|
|
9626
|
+
const x = tt.delete(O.toString());
|
|
9627
|
+
return v(x);
|
|
9628
9628
|
}
|
|
9629
9629
|
}[u];
|
|
9630
|
-
let
|
|
9630
|
+
let j = z();
|
|
9631
9631
|
const q = () => {
|
|
9632
|
-
console.debug("aborting request:", s.url),
|
|
9632
|
+
console.debug("aborting request:", s.url), j.abort();
|
|
9633
9633
|
};
|
|
9634
|
-
|
|
9635
|
-
const j = i.auth.getAuthHeader();
|
|
9636
|
-
$ = $.set("Authorization", j);
|
|
9637
|
-
}
|
|
9638
|
-
h && ($ = $.set(h));
|
|
9634
|
+
n == null || n.addEventListener("abort", q), w && a && (j = i.auth.applyAuth(j)), h && (j = j.set(h));
|
|
9639
9635
|
try {
|
|
9640
|
-
return await
|
|
9641
|
-
} catch (
|
|
9642
|
-
const C = SI(
|
|
9636
|
+
return await j.query(m);
|
|
9637
|
+
} catch (x) {
|
|
9638
|
+
const C = SI(x);
|
|
9643
9639
|
if (a && C && i.auth.isAuthFailure(C))
|
|
9644
|
-
throw await i.auth.handleUnauthorized(
|
|
9640
|
+
throw await i.auth.handleUnauthorized(j, C), new L({
|
|
9645
9641
|
response: C,
|
|
9646
|
-
innerError:
|
|
9642
|
+
innerError: x,
|
|
9647
9643
|
// NOT `DISCARD_HTTP_STATUSES.includes(status)`: A CSRF failure is a 403, which is in that list,
|
|
9648
9644
|
// so computing it would discard the request the auth service just repaired, causing silent data loss on
|
|
9649
9645
|
// a stale CSRF token. An auth failure handled by the auth service is by definition retryable.
|
|
@@ -9652,7 +9648,7 @@ async function ir(t, s, e, i, n) {
|
|
|
9652
9648
|
const pt = C == null ? void 0 : C.status;
|
|
9653
9649
|
throw new L({
|
|
9654
9650
|
response: C,
|
|
9655
|
-
innerError:
|
|
9651
|
+
innerError: x,
|
|
9656
9652
|
discard: pt !== void 0 && Ja.includes(pt)
|
|
9657
9653
|
});
|
|
9658
9654
|
} finally {
|
|
@@ -10000,7 +9996,7 @@ export {
|
|
|
10000
9996
|
at as BaseApiService,
|
|
10001
9997
|
II as BaseAuthService,
|
|
10002
9998
|
St as BaseModelApiService,
|
|
10003
|
-
|
|
9999
|
+
$ as BaseOfflineFileModelApiService,
|
|
10004
10000
|
B as BaseOfflineModelApiService,
|
|
10005
10001
|
og as BaseSDK,
|
|
10006
10002
|
qr as COMMON_AUTO_FIELDS,
|
|
@@ -4,11 +4,11 @@ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
|
|
|
4
4
|
Action:`,s);const p=it();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",s.payload.uuid);const r=it();if(!r)throw new Error("Outbox coordinator not set");return r.registerRetry(s.payload.uuid),!1}function PF(t,s,e){var n;return(n=it())==null?void 0:n.peek()}function FF(t,s){return lt().dispatch(kS(new Date().getTime())),Ln}const rt="An unknown error occurred",bF=500,qI=["non_field_errors","detail"];function _F(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"?qI.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?qI.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>bF?rt:e}class L extends Error{constructor(e){super(rt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??_F(n,a)??rt,this.status=(n==null?void 0:n.status)??0,this.response=n,this.options=e}}function DI(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 $I extends MI{constructor(s){super(s)}applyAuth(s){const e=this.getAuthHeader();return e?s.set("Authorization",e):s}isAuthFailure(s){return s.status===401}}class st extends MI{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class gF extends st{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ia(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(aa(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(na(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:h.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(sa(n)),n}}function Qe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function S(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case h.GET:return`Get ${n}`;case h.POST:return`Create ${n}`;case h.PATCH:return`Update ${n}`;case h.PUT:return`Update ${n}`;case h.DELETE:return`Delete ${n}`}}class w extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class q extends w{constructor(){super(...arguments);m(this,"pageSize",_I)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,u=null,r=null;if("file"in e){const{file:M,...b}=e;u=await this.client.files.getFilePayload(M),r=URL.createObjectURL(M),d={...b,file_sha1:u.sha1,file_type:u.file_type,file_name:M.name,file_extension:u.extension,file_url:r}}else d=e;const y=this.buildModel(d),o=this.buildPayload(y);this.dispatch(n(y));const p=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{...o,...u?{file:u}:{}},blockers:this.getBlockers(y),blocks:this.getBlocks(y)});p.then(({instance:M})=>{this.dispatch(a(M))}).catch(M=>{throw this.dispatch(c(this.getId(y))),M}).finally(()=>{r&&URL.revokeObjectURL(r)});const T=p.then(({instance:M})=>M),E=p.then(async({instance:M,presigned_url:b})=>{try{return b&&await this.client.files.processPresignedUrl(M.file_sha1,b),M.file_sha1}catch(I){throw console.error("Upload to s3 using presigned url failed.",I),I}});return[y,T,E]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,u=new Date().toISOString(),r=[],y=new Set,o=Qe(e,Math.min(n??e.length,Xe)),p=[];for(const b of o){const I=[],g={},V=[],C=[];for(const $ of b){let j;if("file"in $){const{file:Vn,...Lb}=$,ot=await this.client.files.getFilePayload(Vn);ot.sha1 in g||(g[ot.sha1]=ot);const JI=URL.createObjectURL(Vn);y.add(JI),j={...Lb,file_sha1:ot.sha1,file_type:ot.file_type,file_name:Vn.name,file_extension:ot.extension,file_url:JI}}else j=$;const D=this.buildModel(j);r.push(D);const k=this.buildBulkPayload(D);I.push(k);const Gt=this.getBlockers(D);V.push(...Gt);const Ub=this.getBlocks(D);C.push(...Ub)}const v={payloads:I,submittedAt:u,files:Object.values(g),blockers:V,blocks:C};p.push(v)}this.dispatch(a(r));const T=p.map(b=>{const{submittedAt:I,files:g,payloads:V,blocks:C,blockers:v}=b;return this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:I,files:g,payloads:V},blockers:v,blocks:C})});Promise.all(T).then(b=>{const I=b.flatMap(g=>g.instances);this.dispatch(c(I))}).catch(b=>{throw this.dispatch(d(r.map(I=>this.getId(I)))),console.error(b),b}).finally(()=>{for(const b of y)URL.revokeObjectURL(b)});const E=Promise.all(T).then(b=>b.flatMap(({instances:I})=>I)),M=Promise.all(T).then(async b=>{const I=[];for(const{presigned_urls:g}of b){const V=this.client.files.processPresignedUrls(g);for(const[C,v]of Object.entries(V))try{await v,I.push(C)}catch($){throw console.error("Upload to s3 using presigned url failed.",$),$}}return I});return[r,E,M]}async delete(e){const{addOne:n,deleteOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(d)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(n(d)),u}}}class MF extends q{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:ua,addMany:ts,setOne:la,setMany:oa,updateOne:ha,updateMany:ma,deleteOne:ya,deleteMany:ss,initialize:ra});m(this,"selectors",{selectById:Aa,selectByIds:fa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(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 RF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Dc,addMany:ps,setOne:Lc,setMany:kc,updateOne:$c,updateMany:Cc,deleteOne:Uc,deleteMany:As,initialize:qc});m(this,"selectors",{selectById:Wc,selectByIds:Kc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset_procedure_type,e.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 wF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:Dd,addMany:bs,setOne:$d,setMany:Cd,updateOne:Ud,updateMany:Ld,deleteOne:kd,deleteMany:_s,initialize:qd});m(this,"selectors",{selectById:Gd,selectByIds:Hd})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 EF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:Jd,addMany:Xd,setOne:Qd,setMany:xd,updateOne:er,updateMany:tr,deleteOne:sr,deleteMany:ir,initialize:Zd});m(this,"selectors",{selectById:ar,selectByIds:cr})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{payloads:a,values:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=this.select(b=>{var I;return((I=b.userReducer.currentUser)==null?void 0:I.uuid)??null}),p=[],T=Qe(a,Math.min(n??a.length,Xe)),E=[];for(const b of T){const I=[];for(const g of b){const V=P({...g,values:g.values,created_by:o,submitted_at:y});p.push(V),I.push({uuid:V.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,asset_procedure_step:g.asset_procedure_step,published_at:g.published_at,values:V.values})}E.push({submitted_at:y,values:c,field_values:I})}this.dispatch(d(p));const M=[];for(const b of E){const{field_values:I}=b,g=I.map(({asset:j})=>j),V=I.map(({fields_revision:j})=>j),C=I.map(({asset_procedure:j})=>j),v=I.map(({uuid:j})=>j),$=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(V).concat(C),blocks:v});M.push($)}return Promise.all(M).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,M]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Wd(e));this.dispatch(n(e)),this.dispatch(_s(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(bs(u)),r}}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 BF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:ld,addMany:od,setOne:hd,setMany:md,updateOne:yd,updateMany:pd,deleteOne:Ad,deleteMany:fd,initialize:ud});m(this,"selectors",{selectById:Td,selectByIds:Id})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}buildBulkPayload(e){return{uuid:e.uuid,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}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 VF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:bd,addMany:_d,setOne:gd,setMany:Md,updateOne:Rd,updateMany:wd,deleteOne:Ed,deleteMany:Bd,initialize:Fd});m(this,"selectors",{selectById:Vd,selectByIds:vd})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_step],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),u}}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 vF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:hr,addMany:mr,setOne:lr,setMany:or,updateOne:yr,updateMany:pr,deleteOne:Ar,deleteMany:fr,initialize:ur});m(this,"selectors",{selectById:Tr,selectByIds:Ir})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteMany:n,addMany:a,addOne:c,deleteOne:d}=this.actions,{selectById:u}=this.selectors,r=this.select(u(e));if(!r)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=this.select(Or(e));this.dispatch(d(e)),this.dispatch(n(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(r)),this.dispatch(a(y)),o}}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 zF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:Pa,addMany:Fa,setOne:ba,setMany:_a,updateOne:ga,updateMany:Ma,deleteOne:Ra,deleteMany:wa,initialize:Oa});m(this,"selectors",{selectById:Va,selectByIds:va})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const{asset_procedure_type:n,file_sha1:a,file_extension:c,file_name:d,file_type:u,file_url:r}=e,y=this.select(p=>{var T;return((T=p.userReducer.currentUser)==null?void 0:T.uuid)??null}),o=new Date().toISOString();return P({file_url:r,file_sha1:a,file_extension:c,file_name:d,file_type:u,created_by:y,submitted_at:o,asset_procedure_type:n})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}buildBulkPayload(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 jF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:lc,addMany:ls,setOne:oc,setMany:hc,updateOne:mc,updateMany:yc,deleteOne:pc,deleteMany:os,initialize:uc});m(this,"selectors",{selectById:Sc,selectByIds:Tc})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 qF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Fc,addMany:bc,setOne:_c,setMany:gc,updateOne:Mc,updateMany:Rc,deleteOne:wc,deleteMany:Ec,initialize:Pc});m(this,"selectors",{selectById:vc,selectByIds:zc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{values:a,payloads:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=this.select(b=>{var I;return((I=b.userReducer.currentUser)==null?void 0:I.uuid)??null}),p=[],T=Qe(c,Math.min(n??c.length,Xe)),E=[];for(const b of T){const I=[];for(const g of b){const V=P({...g,values:g.values,created_by:o,submitted_at:y});p.push(V),I.push({uuid:V.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,published_at:g.published_at,values:V.values})}E.push({submitted_at:y,values:a,field_values:I})}this.dispatch(d(p));const M=[];for(const b of E){const{field_values:I}=b,g=I.map(({asset:j})=>j),V=I.map(({fields_revision:j})=>j),C=I.map(({asset_procedure:j})=>j),v=I.map(({uuid:j})=>j),$=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(V).concat(C),blocks:v});M.push($)}return Promise.all(M).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,M]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Ic(e));this.dispatch(n(e)),this.dispatch(os(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ls(u)),r}}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 DF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:qa,addMany:Da,setOne:$a,setMany:Ca,updateOne:Ua,updateMany:La,deleteOne:ka,deleteMany:Na,initialize:ja});m(this,"selectors",{selectById:Wa,selectByIds:Ka})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:Ja,addMany:Xa,setOne:Qa,setMany:xa,updateOne:ec,updateMany:tc,deleteOne:sc,deleteMany:ic,initialize:Za});m(this,"selectors",{selectById:cc,selectByIds:dc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:Jc,addMany:Xc,setOne:sd,setMany:id,updateOne:Qc,updateMany:xc,deleteOne:ed,deleteMany:td,initialize:Zc});m(this,"selectors",{selectById:cd,selectByIds:dd})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=this.select(Hc(e));this.dispatch(n(e)),this.dispatch(As(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ps(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class UF extends w{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:br,addMany:Bs,setOne:Rr,setMany:wr,updateOne:_r,updateMany:gr,deleteOne:Mr,deleteMany:Vs,initialize:Fr});m(this,"selectors",{selectById:Vr,selectByIds:vr})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{addOne:n,deleteOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset with uuid ${e} found in the store`);const u=this.select(Sa(e)),r=this.select(Fy(e)),y=this.select(Km(e));this.dispatch(a(e)),this.dispatch(ss(B(u))),this.dispatch(ct(B(r))),this.dispatch(tt(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(n(d)),this.dispatch(ts(u)),this.dispatch(at(r)),this.dispatch(et(y)),o}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Qe(e,Math.min(n??e.length,Xe)).map(y=>{const o=y.map(p=>P(p));return{batchId:xe.v4(),payload:{submitted_at:c,assets:o}}}),u=[];let r=null;for(const y of d){const{batchId:o,payload:p}=y,T=p.assets.map(({uuid:g})=>g),E=p.assets.map(({asset_type:g})=>g),M=p.assets.map(({project:g})=>g),b=p.assets.map(({status:g})=>g),I=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:p,blockers:(r?[r]:[]).concat(E).concat(M).concat(b),blocks:[o].concat(T)});r=y.batchId,u.push(I)}return Promise.all(u).then(y=>{const o=y.flat();this.dispatch(a(o))}),u}bulkUpdate(e,n){const{updateMany:a}=this.actions,{selectByIds:c}=this.selectors,d=B(e).toSorted(Pt);if(d.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(c(d)).toSorted(Jt);if(d.length!=u.length)throw new Error(`Attempting to bulk update ${d.length-u.length} assets that dont exist in the store`);const r=[];for(let T=0;T<d.length;T++)r.push({...u[T],...e[T]});this.dispatch(a(r));const y=Qe(e,Math.min(n??e.length,Xe)),o=[];let p=null;for(const T of y){const E=xe.v4(),M=B(T),b=T.map(({status:g})=>g).filter(Boolean),I=this.enqueueRequest({description:S(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:T},blockers:(p?[p]:[]).concat(M).concat(b),blocks:[E].concat(M)});o.push(I),p=E}return Promise.all(o).then(T=>{this.dispatch(a(T.flat()))}).catch(()=>{this.dispatch(a(u))}),[r,o]}async bulkDelete(e){const{addMany:n,deleteMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e)),u=this.select(by(e)),r=this.select(Ym(e));this.dispatch(a(e)),this.dispatch(ct(B(u))),this.dispatch(tt(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(y){throw this.dispatch(n(d)),this.dispatch(at(u)),this.dispatch(et(r)),y}}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 LF extends w{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:Dr,addMany:$r,setOne:Cr,setMany:Ur,updateOne:Lr,updateMany:kr,deleteOne:Nr,deleteMany:Gr,initialize:qr});m(this,"selectors",{selectById:Yr,selectByIds:Zr})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.asset_stage],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}bulkAdd(e){const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),u=this.select(T=>{var E;return((E=T.userReducer.currentUser)==null?void 0:E.uuid)??null}),r=e.map(T=>P(T)),y=r.map(T=>({...T,created_by:u,submitted_at:d})),o=y.map(({uuid:T})=>T);this.dispatch(n(y));const p=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,completions:r},blockers:[...e.map(T=>T.asset_procedure),...e.map(T=>T.asset_stage),...e.map(T=>T.asset)],blocks:o});return p.then(T=>{this.dispatch(a(T))}).catch(()=>{this.dispatch(c(o))}),[y,p]}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 kF extends w{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:eu,addMany:tu,setOne:Qr,setMany:xr,updateOne:su,updateMany:iu,deleteOne:nu,deleteMany:au,initialize:Xr});m(this,"selectors",{selectById:du,selectByIds:ru})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 NF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:ou,addMany:$s,setOne:hu,setMany:mu,updateOne:yu,updateMany:pu,deleteOne:Au,deleteMany:Cs,initialize:lu});m(this,"selectors",{selectById:Su,selectByIds:Tu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(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 GF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:Qu,addMany:Hs,setOne:xu,setMany:el,updateOne:tl,updateMany:sl,deleteOne:il,deleteMany:Ws,initialize:Xu});m(this,"selectors",{selectById:al,selectByIds:cl})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 HF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:ol,addMany:hl,setOne:ml,setMany:yl,updateOne:pl,updateMany:Al,deleteOne:fl,deleteMany:Sl,initialize:ll});m(this,"selectors",{selectById:Il,selectByIds:Ol})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{payloads:a,values:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=[],p=Qe(a,Math.min(n??a.length,Xe)),T=[];for(const M of p){const b=[];for(const I of M){const g=P({...I,values:I.values,created_by:this.select(V=>{var C;return((C=V.userReducer.currentUser)==null?void 0:C.uuid)??null}),submitted_at:y});o.push(g),b.push({uuid:g.uuid,asset:I.asset,fields_revision:I.fields_revision,published_at:I.published_at,values:g.values})}T.push({submitted_at:y,values:c,field_values:b})}this.dispatch(d(o));const E=[];for(const M of T){const{field_values:b}=M,I=b.map(({asset:v})=>v),g=b.map(({fields_revision:v})=>v),V=b.map(({uuid:v})=>v),C=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:M,blockers:I.concat(g),blocks:V});E.push(C)}return Promise.all(E).then(M=>{this.dispatch(u(M.flat()))}).catch(()=>{this.dispatch(r(B(o)))}),[o,E]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.asset],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(dl(e));this.dispatch(n(e)),this.dispatch(Ws(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(Hs(u)),r}}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 WF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:bu,addMany:_u,setOne:gu,setMany:Mu,updateOne:Ru,updateMany:wu,deleteOne:Eu,deleteMany:Bu,initialize:Fu});m(this,"selectors",{selectById:vu,selectByIds:zu})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 KF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:$u,addMany:Cu,setOne:Uu,setMany:Lu,updateOne:ku,updateMany:Nu,deleteOne:Gu,deleteMany:Hu,initialize:Du});m(this,"selectors",{selectById:Ku,selectByIds:Yu})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 YF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:_l,addMany:gl,setOne:Ml,setMany:Rl,updateOne:wl,updateMany:El,deleteOne:Bl,deleteMany:Vl,initialize:bl});m(this,"selectors",{selectById:zl,selectByIds:jl})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 ZF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Cl,addMany:Ul,setOne:Ll,setMany:kl,updateOne:Nl,updateMany:Gl,deleteOne:Hl,deleteMany:Wl,initialize:$l});m(this,"selectors",{selectById:Yl,selectByIds:Zl})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,u=new Date().toISOString(),r=this.select(M=>{var b;return((b=M.userReducer.currentUser)==null?void 0:b.uuid)??null}),y=Qe(e,Math.min(n??e.length,Xe)),o=[],p=[];for(const M of y){const b=[],I=[],g=[];for(const C of M){const v=P({...C,submitted_at:u,created_by:r});p.push(v);const $={uuid:v.uuid,asset:v.asset,asset_type_identifier:v.asset_type_identifier,value:v.value};b.push($),I.push(v.asset),I.push(v.asset_type_identifier),g.push(v.uuid)}const V={payloads:b,submitted_at:u,blockers:I,blocks:g};o.push(V)}this.dispatch(a(p));const T=o.map(M=>{const{payloads:b,submitted_at:I,blockers:g,blocks:V}=M;return this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:I,payloads:b},blockers:g,blocks:V})});Promise.all(T).then(M=>{this.dispatch(c(M.flat()))}).catch(M=>{throw this.dispatch(d(B(p))),M});const E=Promise.all(T).then(M=>M.flat());return[p,E]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 JF extends w{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:to,addMany:so,setOne:xl,setMany:eo,updateOne:io,updateMany:no,deleteOne:ao,deleteMany:co,initialize:Ql});m(this,"selectors",{selectById:uo,selectByIds:lo})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=this.select(Br(e)),r=this.select(Iu(e));this.dispatch(n(e)),this.dispatch(Vs(B(u))),this.dispatch(Cs(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(d)),this.dispatch(Bs(u)),this.dispatch($s(r)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class XF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:yo,addMany:po,setOne:Ao,setMany:fo,updateOne:So,updateMany:To,deleteOne:Io,deleteMany:Oo,initialize:mo});m(this,"selectors",{selectById:Fo,selectByIds:bo})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 QF extends q{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:Bo,addMany:Vo,setOne:vo,setMany:zo,updateOne:jo,updateMany:qo,deleteOne:Do,deleteMany:$o,initialize:Eo});m(this,"selectors",{selectById:Uo,selectByIds:Lo})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(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),u={};for(const{file_sha1:r,uuid:y}of a)r in u||(u[r]=[]),u[r].push(y);return d.then(r=>{const y=r.flatMap(o=>u[o]??[]);for(const o of y)this.makeReadable(o)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.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 xF extends w{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:Go});m(this,"selectors",{selectById:eh,selectByIds:th})}add(e){const{addOne:n,deleteOne:a,updateOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a,addMany:c,deleteMany:d}=this.actions,{selectById:u}=this.selectors,r=this.select(u(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=this.select(sh(e));this.dispatch(n(e)),this.dispatch(d(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(a(r)),this.dispatch(c(y)),o}}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 eb extends st{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const ft={},Rn=new Set;class tb extends st{constructor(){super(...arguments);m(this,"host");m(this,"dbPromise",sO.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 Ot(e);if(Rn.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),Rn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),Rn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let u;c in ft?u=ft[c]:Wn(e)?(u=Hn(e,a),ft[c]=u):(u=new Promise(o=>{this.performRequest({method:h.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const T=new File([p],a,{type:p.type});o(T)})}),ft[c]=u);let r;try{r=await u}catch(o){throw o instanceof L&&delete ft[c],o}const y=await Ot(r);if(y!==n){const o=`The hash of the file returned from the server (${y}) 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>bF?rt:e}class L extends Error{constructor(e){super(rt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??_F(n,a)??rt,this.status=(n==null?void 0:n.status)??0,this.response=n,this.options=e}}function DI(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 $I extends MI{constructor(s){super(s)}applyAuth(s){const e=this.getAuthHeader();return e?s.set("Authorization",e):s}isAuthFailure(s){return s.status===401}}class st extends MI{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class gF extends st{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ia(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(aa(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(na(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:h.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(sa(n)),n}}function Qe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function S(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case h.GET:return`Get ${n}`;case h.POST:return`Create ${n}`;case h.PATCH:return`Update ${n}`;case h.PUT:return`Update ${n}`;case h.DELETE:return`Delete ${n}`}}class w extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class q extends w{constructor(){super(...arguments);m(this,"pageSize",_I)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,u=null,r=null;if("file"in e){const{file:M,...b}=e;u=await this.client.files.getFilePayload(M),r=URL.createObjectURL(M),d={...b,file_sha1:u.sha1,file_type:u.file_type,file_name:M.name,file_extension:u.extension,file_url:r}}else d=e;const y=this.buildModel(d),o=this.buildPayload(y);this.dispatch(n(y));const p=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{...o,...u?{file:u}:{}},blockers:this.getBlockers(y),blocks:this.getBlocks(y)});p.then(({instance:M})=>{this.dispatch(a(M))}).catch(M=>{throw this.dispatch(c(this.getId(y))),M}).finally(()=>{r&&URL.revokeObjectURL(r)});const T=p.then(({instance:M})=>M),E=p.then(async({instance:M,presigned_url:b})=>{try{return b&&await this.client.files.processPresignedUrl(M.file_sha1,b),M.file_sha1}catch(I){throw console.error("Upload to s3 using presigned url failed.",I),I}});return[y,T,E]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,u=new Date().toISOString(),r=[],y=new Set,o=Qe(e,Math.min(n??e.length,Xe)),p=[];for(const b of o){const I=[],g={},V=[],C=[];for(const D of b){let j;if("file"in D){const{file:Vn,...Lb}=D,ot=await this.client.files.getFilePayload(Vn);ot.sha1 in g||(g[ot.sha1]=ot);const JI=URL.createObjectURL(Vn);y.add(JI),j={...Lb,file_sha1:ot.sha1,file_type:ot.file_type,file_name:Vn.name,file_extension:ot.extension,file_url:JI}}else j=D;const $=this.buildModel(j);r.push($);const k=this.buildBulkPayload($);I.push(k);const Gt=this.getBlockers($);V.push(...Gt);const Ub=this.getBlocks($);C.push(...Ub)}const v={payloads:I,submittedAt:u,files:Object.values(g),blockers:V,blocks:C};p.push(v)}this.dispatch(a(r));const T=p.map(b=>{const{submittedAt:I,files:g,payloads:V,blocks:C,blockers:v}=b;return this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:I,files:g,payloads:V},blockers:v,blocks:C})});Promise.all(T).then(b=>{const I=b.flatMap(g=>g.instances);this.dispatch(c(I))}).catch(b=>{throw this.dispatch(d(r.map(I=>this.getId(I)))),console.error(b),b}).finally(()=>{for(const b of y)URL.revokeObjectURL(b)});const E=Promise.all(T).then(b=>b.flatMap(({instances:I})=>I)),M=Promise.all(T).then(async b=>{const I=[];for(const{presigned_urls:g}of b){const V=this.client.files.processPresignedUrls(g);for(const[C,v]of Object.entries(V))try{await v,I.push(C)}catch(D){throw console.error("Upload to s3 using presigned url failed.",D),D}}return I});return[r,E,M]}async delete(e){const{addOne:n,deleteOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(d)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(n(d)),u}}}class MF extends q{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:ua,addMany:ts,setOne:la,setMany:oa,updateOne:ha,updateMany:ma,deleteOne:ya,deleteMany:ss,initialize:ra});m(this,"selectors",{selectById:Aa,selectByIds:fa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(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 RF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Dc,addMany:ps,setOne:Lc,setMany:kc,updateOne:$c,updateMany:Cc,deleteOne:Uc,deleteMany:As,initialize:qc});m(this,"selectors",{selectById:Wc,selectByIds:Kc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset_procedure_type,e.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 wF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:Dd,addMany:bs,setOne:$d,setMany:Cd,updateOne:Ud,updateMany:Ld,deleteOne:kd,deleteMany:_s,initialize:qd});m(this,"selectors",{selectById:Gd,selectByIds:Hd})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 EF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:Jd,addMany:Xd,setOne:Qd,setMany:xd,updateOne:er,updateMany:tr,deleteOne:sr,deleteMany:ir,initialize:Zd});m(this,"selectors",{selectById:ar,selectByIds:cr})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{payloads:a,values:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=this.select(b=>{var I;return((I=b.userReducer.currentUser)==null?void 0:I.uuid)??null}),p=[],T=Qe(a,Math.min(n??a.length,Xe)),E=[];for(const b of T){const I=[];for(const g of b){const V=P({...g,values:g.values,created_by:o,submitted_at:y});p.push(V),I.push({uuid:V.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,asset_procedure_step:g.asset_procedure_step,published_at:g.published_at,values:V.values})}E.push({submitted_at:y,values:c,field_values:I})}this.dispatch(d(p));const M=[];for(const b of E){const{field_values:I}=b,g=I.map(({asset:j})=>j),V=I.map(({fields_revision:j})=>j),C=I.map(({asset_procedure:j})=>j),v=I.map(({uuid:j})=>j),D=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(V).concat(C),blocks:v});M.push(D)}return Promise.all(M).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,M]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Wd(e));this.dispatch(n(e)),this.dispatch(_s(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(bs(u)),r}}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 BF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:ld,addMany:od,setOne:hd,setMany:md,updateOne:yd,updateMany:pd,deleteOne:Ad,deleteMany:fd,initialize:ud});m(this,"selectors",{selectById:Td,selectByIds:Id})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}buildBulkPayload(e){return{uuid:e.uuid,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}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 VF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:bd,addMany:_d,setOne:gd,setMany:Md,updateOne:Rd,updateMany:wd,deleteOne:Ed,deleteMany:Bd,initialize:Fd});m(this,"selectors",{selectById:Vd,selectByIds:vd})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_step],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),u}}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 vF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:hr,addMany:mr,setOne:lr,setMany:or,updateOne:yr,updateMany:pr,deleteOne:Ar,deleteMany:fr,initialize:ur});m(this,"selectors",{selectById:Tr,selectByIds:Ir})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteMany:n,addMany:a,addOne:c,deleteOne:d}=this.actions,{selectById:u}=this.selectors,r=this.select(u(e));if(!r)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=this.select(Or(e));this.dispatch(d(e)),this.dispatch(n(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(r)),this.dispatch(a(y)),o}}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 zF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:Pa,addMany:Fa,setOne:ba,setMany:_a,updateOne:ga,updateMany:Ma,deleteOne:Ra,deleteMany:wa,initialize:Oa});m(this,"selectors",{selectById:Va,selectByIds:va})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const{asset_procedure_type:n,file_sha1:a,file_extension:c,file_name:d,file_type:u,file_url:r}=e,y=this.select(p=>{var T;return((T=p.userReducer.currentUser)==null?void 0:T.uuid)??null}),o=new Date().toISOString();return P({file_url:r,file_sha1:a,file_extension:c,file_name:d,file_type:u,created_by:y,submitted_at:o,asset_procedure_type:n})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}buildBulkPayload(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 jF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:lc,addMany:ls,setOne:oc,setMany:hc,updateOne:mc,updateMany:yc,deleteOne:pc,deleteMany:os,initialize:uc});m(this,"selectors",{selectById:Sc,selectByIds:Tc})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 qF extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Fc,addMany:bc,setOne:_c,setMany:gc,updateOne:Mc,updateMany:Rc,deleteOne:wc,deleteMany:Ec,initialize:Pc});m(this,"selectors",{selectById:vc,selectByIds:zc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{values:a,payloads:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=this.select(b=>{var I;return((I=b.userReducer.currentUser)==null?void 0:I.uuid)??null}),p=[],T=Qe(c,Math.min(n??c.length,Xe)),E=[];for(const b of T){const I=[];for(const g of b){const V=P({...g,values:g.values,created_by:o,submitted_at:y});p.push(V),I.push({uuid:V.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,published_at:g.published_at,values:V.values})}E.push({submitted_at:y,values:a,field_values:I})}this.dispatch(d(p));const M=[];for(const b of E){const{field_values:I}=b,g=I.map(({asset:j})=>j),V=I.map(({fields_revision:j})=>j),C=I.map(({asset_procedure:j})=>j),v=I.map(({uuid:j})=>j),D=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(V).concat(C),blocks:v});M.push(D)}return Promise.all(M).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(r(B(p)))}),[p,M]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Ic(e));this.dispatch(n(e)),this.dispatch(os(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ls(u)),r}}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 DF extends q{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:qa,addMany:Da,setOne:$a,setMany:Ca,updateOne:Ua,updateMany:La,deleteOne:ka,deleteMany:Na,initialize:ja});m(this,"selectors",{selectById:Wa,selectByIds:Ka})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:Ja,addMany:Xa,setOne:Qa,setMany:xa,updateOne:ec,updateMany:tc,deleteOne:sc,deleteMany:ic,initialize:Za});m(this,"selectors",{selectById:cc,selectByIds:dc})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:Jc,addMany:Xc,setOne:sd,setMany:id,updateOne:Qc,updateMany:xc,deleteOne:ed,deleteMany:td,initialize:Zc});m(this,"selectors",{selectById:cd,selectByIds:dd})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=this.select(Hc(e));this.dispatch(n(e)),this.dispatch(As(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ps(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class UF extends w{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:br,addMany:Bs,setOne:Rr,setMany:wr,updateOne:_r,updateMany:gr,deleteOne:Mr,deleteMany:Vs,initialize:Fr});m(this,"selectors",{selectById:Vr,selectByIds:vr})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{addOne:n,deleteOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset with uuid ${e} found in the store`);const u=this.select(Sa(e)),r=this.select(Fy(e)),y=this.select(Km(e));this.dispatch(a(e)),this.dispatch(ss(B(u))),this.dispatch(ct(B(r))),this.dispatch(tt(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(n(d)),this.dispatch(ts(u)),this.dispatch(at(r)),this.dispatch(et(y)),o}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Qe(e,Math.min(n??e.length,Xe)).map(y=>{const o=y.map(p=>P(p));return{batchId:xe.v4(),payload:{submitted_at:c,assets:o}}}),u=[];let r=null;for(const y of d){const{batchId:o,payload:p}=y,T=p.assets.map(({uuid:g})=>g),E=p.assets.map(({asset_type:g})=>g),M=p.assets.map(({project:g})=>g),b=p.assets.map(({status:g})=>g),I=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:p,blockers:(r?[r]:[]).concat(E).concat(M).concat(b),blocks:[o].concat(T)});r=y.batchId,u.push(I)}return Promise.all(u).then(y=>{const o=y.flat();this.dispatch(a(o))}),u}bulkUpdate(e,n){const{updateMany:a}=this.actions,{selectByIds:c}=this.selectors,d=B(e).toSorted(Pt);if(d.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(c(d)).toSorted(Jt);if(d.length!=u.length)throw new Error(`Attempting to bulk update ${d.length-u.length} assets that dont exist in the store`);const r=[];for(let T=0;T<d.length;T++)r.push({...u[T],...e[T]});this.dispatch(a(r));const y=Qe(e,Math.min(n??e.length,Xe)),o=[];let p=null;for(const T of y){const E=xe.v4(),M=B(T),b=T.map(({status:g})=>g).filter(Boolean),I=this.enqueueRequest({description:S(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:T},blockers:(p?[p]:[]).concat(M).concat(b),blocks:[E].concat(M)});o.push(I),p=E}return Promise.all(o).then(T=>{this.dispatch(a(T.flat()))}).catch(()=>{this.dispatch(a(u))}),[r,o]}async bulkDelete(e){const{addMany:n,deleteMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e)),u=this.select(by(e)),r=this.select(Ym(e));this.dispatch(a(e)),this.dispatch(ct(B(u))),this.dispatch(tt(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(y){throw this.dispatch(n(d)),this.dispatch(at(u)),this.dispatch(et(r)),y}}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 LF extends w{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:Dr,addMany:$r,setOne:Cr,setMany:Ur,updateOne:Lr,updateMany:kr,deleteOne:Nr,deleteMany:Gr,initialize:qr});m(this,"selectors",{selectById:Yr,selectByIds:Zr})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.asset_stage],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}bulkAdd(e){const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),u=this.select(T=>{var E;return((E=T.userReducer.currentUser)==null?void 0:E.uuid)??null}),r=e.map(T=>P(T)),y=r.map(T=>({...T,created_by:u,submitted_at:d})),o=y.map(({uuid:T})=>T);this.dispatch(n(y));const p=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,completions:r},blockers:[...e.map(T=>T.asset_procedure),...e.map(T=>T.asset_stage),...e.map(T=>T.asset)],blocks:o});return p.then(T=>{this.dispatch(a(T))}).catch(()=>{this.dispatch(c(o))}),[y,p]}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 kF extends w{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:eu,addMany:tu,setOne:Qr,setMany:xr,updateOne:su,updateMany:iu,deleteOne:nu,deleteMany:au,initialize:Xr});m(this,"selectors",{selectById:du,selectByIds:ru})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 NF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:ou,addMany:$s,setOne:hu,setMany:mu,updateOne:yu,updateMany:pu,deleteOne:Au,deleteMany:Cs,initialize:lu});m(this,"selectors",{selectById:Su,selectByIds:Tu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(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 GF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:Qu,addMany:Hs,setOne:xu,setMany:el,updateOne:tl,updateMany:sl,deleteOne:il,deleteMany:Ws,initialize:Xu});m(this,"selectors",{selectById:al,selectByIds:cl})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 HF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:ol,addMany:hl,setOne:ml,setMany:yl,updateOne:pl,updateMany:Al,deleteOne:fl,deleteMany:Sl,initialize:ll});m(this,"selectors",{selectById:Il,selectByIds:Ol})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{payloads:a,values:c}=e,{addMany:d,setMany:u,deleteMany:r}=this.actions,y=new Date().toISOString(),o=[],p=Qe(a,Math.min(n??a.length,Xe)),T=[];for(const M of p){const b=[];for(const I of M){const g=P({...I,values:I.values,created_by:this.select(V=>{var C;return((C=V.userReducer.currentUser)==null?void 0:C.uuid)??null}),submitted_at:y});o.push(g),b.push({uuid:g.uuid,asset:I.asset,fields_revision:I.fields_revision,published_at:I.published_at,values:g.values})}T.push({submitted_at:y,values:c,field_values:b})}this.dispatch(d(o));const E=[];for(const M of T){const{field_values:b}=M,I=b.map(({asset:v})=>v),g=b.map(({fields_revision:v})=>v),V=b.map(({uuid:v})=>v),C=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:M,blockers:I.concat(g),blocks:V});E.push(C)}return Promise.all(E).then(M=>{this.dispatch(u(M.flat()))}).catch(()=>{this.dispatch(r(B(o)))}),[o,E]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.asset],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(dl(e));this.dispatch(n(e)),this.dispatch(Ws(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(Hs(u)),r}}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 WF extends q{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:bu,addMany:_u,setOne:gu,setMany:Mu,updateOne:Ru,updateMany:wu,deleteOne:Eu,deleteMany:Bu,initialize:Fu});m(this,"selectors",{selectById:vu,selectByIds:zu})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 KF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:$u,addMany:Cu,setOne:Uu,setMany:Lu,updateOne:ku,updateMany:Nu,deleteOne:Gu,deleteMany:Hu,initialize:Du});m(this,"selectors",{selectById:Ku,selectByIds:Yu})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 YF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:_l,addMany:gl,setOne:Ml,setMany:Rl,updateOne:wl,updateMany:El,deleteOne:Bl,deleteMany:Vl,initialize:bl});m(this,"selectors",{selectById:zl,selectByIds:jl})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 ZF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Cl,addMany:Ul,setOne:Ll,setMany:kl,updateOne:Nl,updateMany:Gl,deleteOne:Hl,deleteMany:Wl,initialize:$l});m(this,"selectors",{selectById:Yl,selectByIds:Zl})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,u=new Date().toISOString(),r=this.select(M=>{var b;return((b=M.userReducer.currentUser)==null?void 0:b.uuid)??null}),y=Qe(e,Math.min(n??e.length,Xe)),o=[],p=[];for(const M of y){const b=[],I=[],g=[];for(const C of M){const v=P({...C,submitted_at:u,created_by:r});p.push(v);const D={uuid:v.uuid,asset:v.asset,asset_type_identifier:v.asset_type_identifier,value:v.value};b.push(D),I.push(v.asset),I.push(v.asset_type_identifier),g.push(v.uuid)}const V={payloads:b,submitted_at:u,blockers:I,blocks:g};o.push(V)}this.dispatch(a(p));const T=o.map(M=>{const{payloads:b,submitted_at:I,blockers:g,blocks:V}=M;return this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:I,payloads:b},blockers:g,blocks:V})});Promise.all(T).then(M=>{this.dispatch(c(M.flat()))}).catch(M=>{throw this.dispatch(d(B(p))),M});const E=Promise.all(T).then(M=>M.flat());return[p,E]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 JF extends w{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:to,addMany:so,setOne:xl,setMany:eo,updateOne:io,updateMany:no,deleteOne:ao,deleteMany:co,initialize:Ql});m(this,"selectors",{selectById:uo,selectByIds:lo})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=this.select(Br(e)),r=this.select(Iu(e));this.dispatch(n(e)),this.dispatch(Vs(B(u))),this.dispatch(Cs(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(d)),this.dispatch(Bs(u)),this.dispatch($s(r)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class XF extends w{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:yo,addMany:po,setOne:Ao,setMany:fo,updateOne:So,updateMany:To,deleteOne:Io,deleteMany:Oo,initialize:mo});m(this,"selectors",{selectById:Fo,selectByIds:bo})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 QF extends q{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:Bo,addMany:Vo,setOne:vo,setMany:zo,updateOne:jo,updateMany:qo,deleteOne:Do,deleteMany:$o,initialize:Eo});m(this,"selectors",{selectById:Uo,selectByIds:Lo})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(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),u={};for(const{file_sha1:r,uuid:y}of a)r in u||(u[r]=[]),u[r].push(y);return d.then(r=>{const y=r.flatMap(o=>u[o]??[]);for(const o of y)this.makeReadable(o)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.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 xF extends w{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:Go});m(this,"selectors",{selectById:eh,selectByIds:th})}add(e){const{addOne:n,deleteOne:a,updateOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a,addMany:c,deleteMany:d}=this.actions,{selectById:u}=this.selectors,r=this.select(u(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=this.select(sh(e));this.dispatch(n(e)),this.dispatch(d(B(y)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(a(r)),this.dispatch(c(y)),o}}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 eb extends st{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const ft={},Rn=new Set;class tb extends st{constructor(){super(...arguments);m(this,"host");m(this,"dbPromise",sO.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 Ot(e);if(Rn.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),Rn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),Rn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let u;c in ft?u=ft[c]:Wn(e)?(u=Hn(e,a),ft[c]=u):(u=new Promise(o=>{this.performRequest({method:h.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const T=new File([p],a,{type:p.type});o(T)})}),ft[c]=u);let r;try{r=await u}catch(o){throw o instanceof L&&delete ft[c],o}const y=await Ot(r);if(y!==n){const o=`The hash of the file returned from the server (${y}) 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(o)}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:h.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 Ot(e),file_type:e.type,extension:Nn(e),size:e.size};return await this.client.files.addCache(e),a}}class sb extends w{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:rh,addMany:uh,setOne:lh,setMany:oh,updateOne:hh,updateMany:mh,deleteOne:yh,deleteMany:ph,initialize:dh});m(this,"selectors",{selectById:fh,selectByIds:Sh})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.form],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 ib extends w{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:Ph,addMany:Fh,setOne:bh,setMany:_h,updateOne:gh,updateMany:Mh,deleteOne:Rh,deleteMany:wh,initialize:Oh});m(this,"selectors",{selectById:Bh,selectByIds:Vh})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(a(d)),d}}class nb extends q{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:qh,addMany:Dh,setOne:$h,setMany:Ch,updateOne:Uh,updateMany:Lh,deleteOne:kh,deleteMany:Nh,initialize:jh});m(this,"selectors",{selectById:Hh,selectByIds:Wh})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,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 ab extends w{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:Jh,addMany:hi,setOne:Xh,setMany:Qh,updateOne:xh,updateMany:em,deleteOne:tm,deleteMany:mi,initialize:Zh});m(this,"selectors",{selectById:im,selectByIds:nm})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}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 cb extends w{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:um,addMany:lm,setOne:om,setMany:hm,updateOne:mm,updateMany:ym,deleteOne:pm,deleteMany:Am,initialize:rm});m(this,"selectors",{selectById:Tm,selectByIds:Im})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error("Expected form to exist");const u=this.select(Gm(e)),r=this.select(am(e));this.dispatch(n(e)),this.dispatch(tt(B(u))),this.dispatch(mi(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(d)),this.dispatch(hi(r)),this.dispatch(et(u)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class db extends q{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:Fm,addMany:fi,setOne:bm,setMany:_m,updateOne:gm,updateMany:Mm,deleteOne:Rm,deleteMany:Si,initialize:Pm});m(this,"selectors",{selectById:wm,selectByIds:Em})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,c=this.select(Oi(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}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 rb extends w{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Dm,addMany:et,setOne:jm,setMany:qm,updateOne:$m,updateMany:Cm,deleteOne:Um,deleteMany:tt,initialize:zm});m(this,"selectors",{selectById:km,selectByIds:Nm})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Bm(e));this.dispatch(n(e)),this.dispatch(Si(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(fi(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(a(d)),d}}class ub extends q{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:ey,addMany:ty,setOne:Qm,setMany:xm,updateOne:sy,updateMany:iy,deleteOne:ny,deleteMany:ay,initialize:Xm});m(this,"selectors",{selectById:dy,selectByIds:ry})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,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}}buildBulkPayload(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{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,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 lb extends w{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Ay,addMany:at,setOne:my,setMany:hy,updateOne:yy,updateMany:py,deleteOne:fy,deleteMany:ct,initialize:oy});m(this,"selectors",{selectById:Ty,selectByIds:Iy})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e){const{addMany:n,deleteMany:a,updateMany:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=e.map(o=>P({...o,submitted_at:u,created_by:d}));this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(o=>R(o)),submitted_at:u},blockers:r.flatMap(o=>[o.issue,o.asset]),blocks:B(r)});return y.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(a(B(r)))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 ob extends q{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:Ry,addMany:Mi,setOne:wy,setMany:Ey,updateOne:By,updateMany:Vy,deleteOne:vy,deleteMany:Ri,initialize:My});m(this,"selectors",{selectById:qy,selectByIds:Dy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(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 hb extends q{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Ly,addMany:ky,setOne:Ny,setMany:Gy,updateOne:Hy,updateMany:Wy,deleteOne:Ky,deleteMany:Yy,initialize:Uy});m(this,"selectors",{selectById:Jy,selectByIds:Xy})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(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 mb extends w{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:tp,addMany:sp,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:rp,initialize:ep});m(this,"selectors",{selectById:up,selectByIds:lp})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>r.userReducer.currentUser.uuid),submitted_at:new Date().toISOString()});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 yb extends w{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:yp,addMany:ji,setOne:pp,setMany:Ap,updateOne:fp,updateMany:Sp,deleteOne:Tp,deleteMany:qi,initialize:mp});m(this,"selectors",{selectById:Op,selectByIds:Pp})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.project,r.issue_type,r.status],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const d={...c,...e};this.dispatch(n(d));const u={};for(const o of[U.TITLE,U.DESCRIPTION,U.STATUS,U.PRIORITY,U.ASSIGNED_TO,U.DUE_DATE])if(o in e&&e[o]!==c[o])switch(o){case U.PRIORITY:u[o]=e.priority;break;case U.DUE_DATE:u[o]=e.due_date;break;case U.DESCRIPTION:u[o]=e.description??"";break;case U.TITLE:u[o]=e.title??"";break;case U.STATUS:{const p=e[o],T=this.select(en(p));if(!T)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);u[o]={name:T.name,color:T.color,uuid:T.uuid};break}case U.ASSIGNED_TO:{const p=e[o];if(p===null)u[o]=null;else{const T=this.select(Ut(p));if(!T)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);u[o]={email:T.email,uuid:T.uuid}}break}}const r=P({created_by:this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),submitted_at:new Date().toISOString(),issue:c.uuid,changes:u});this.dispatch(sn(r));const y=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return y.then(o=>{this.dispatch(n(o))}).catch(()=>{this.dispatch(n(c)),this.dispatch(an(r.uuid))}),[d,y]}bulkUpdate(e,n){const{updateMany:a}=this.actions,{selectByIds:c}=this.selectors,d=B(e).toSorted(Pt);if(d.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(c(d)).toSorted(Jt);if(d.length!=u.length)throw new Error(`Attempting to bulk update ${d.length-u.length} issues that dont exist in the store`);const r=[];for(let T=0;T<d.length;T++)r.push({...u[T],...e[T]});this.dispatch(a(r));const y=Qe(e,Math.min(n??e.length,Xe)),o=[];let p=null;for(const T of y){const E=xe.v4(),M=B(T),b=T.map(({status:g})=>g).filter(Boolean),I=this.enqueueRequest({description:S(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:T},blockers:(p?[p]:[]).concat(M).concat(b),blocks:[E].concat(M)});o.push(I),p=E}return Promise.all(o).then(T=>{this.dispatch(a(T.flat()))}).catch(()=>{this.dispatch(a(u))}),[r,o]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No issue with uuid ${e} found in the store`);const u=this.select(Py(e)),r=this.select(jy(e)),y=this.select(Jf(e)),o=this.select(Hm(e));this.dispatch(n(e)),this.dispatch(Ri(B(r))),this.dispatch(cn(B(y))),this.dispatch(ct(B(u))),this.dispatch(tt(B(o)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(d)),this.dispatch(Mi(r)),this.dispatch(nn(y)),this.dispatch(at(u)),this.dispatch(et(o)),p}}async bulkDelete(e){const{addMany:n,deleteMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e)),u=this.select(Oy(e)),r=this.select(Wm(e));this.dispatch(a(e)),this.dispatch(ct(B(u))),this.dispatch(tt(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(y){throw this.dispatch(n(d)),this.dispatch(at(u)),this.dispatch(et(r)),y}}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 pb extends q{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:Mp,addMany:Rp,setOne:wp,setMany:Ep,updateOne:Bp,updateMany:Vp,deleteOne:vp,deleteMany:zp,initialize:gp});m(this,"selectors",{selectById:qp,selectByIds:Dp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(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 Ab extends q{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:wA,addMany:Gi,setOne:EA,setMany:BA,updateOne:VA,updateMany:vA,deleteOne:zA,deleteMany:Hi,initialize:RA});m(this,"selectors",{selectById:qA,selectByIds:DA})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 fb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});m(this,"selectors",{selectById:lA,selectByIds:oA})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.issue],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select($A(e));this.dispatch(n(e)),this.dispatch(Hi(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(Gi(u)),r}}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 Sb extends q{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:Lp,addMany:kp,setOne:Np,setMany:Gp,updateOne:Hp,updateMany:Wp,deleteOne:Kp,deleteMany:Yp,initialize:Up});m(this,"selectors",{selectById:Jp,selectByIds:Xp})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 Tb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:SA,updateOne:TA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});m(this,"selectors",{selectById:bA,selectByIds:_A})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 Ib extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:kA,addMany:NA,setOne:GA,setMany:HA,updateOne:WA,updateMany:KA,deleteOne:YA,deleteMany:ZA,initialize:LA});m(this,"selectors",{selectById:XA,selectByIds:QA})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 Ob extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:sf,addMany:nf,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:lf,initialize:tf});m(this,"selectors",{selectById:hf,selectByIds:mf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 Pb extends w{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:ff,addMany:Sf,setOne:Tf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:bf,initialize:Af});m(this,"selectors",{selectById:gf,selectByIds:Mf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,submitted_at:u,created_by:d});this.dispatch(n(r));const y=this.enqueueRequest({method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=this.select(Fp(e));this.dispatch(n(e)),this.dispatch(qi(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ji(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Fb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:Bf,addMany:Vf,setOne:vf,setMany:zf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:$f,initialize:Ef});m(this,"selectors",{selectById:en,selectByIds:Uf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 bb extends w{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:sn,addMany:nn,setOne:Gf,setMany:Hf,updateOne:Wf,updateMany:Kf,deleteOne:an,deleteMany:cn,initialize:Nf});m(this,"selectors",{selectById:Yf,selectByIds:Zf})}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 _b=1800;function gb(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 Mb extends $I{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:h.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(Mo(!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.debug("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=iO(e).exp??n}catch{a=n}return a-n<_b}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 L&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??rt).toString()))}}}async handleUnauthorized(e,n){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new L({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new L({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:h.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(gb(a))})}}class St extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Rb extends St{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:oS,addMany:hS,setOne:mS,setMany:yS,updateOne:pS,updateMany:AS,deleteOne:fS,deleteMany:SS,initialize:lS});m(this,"selectors",{selectById:IS,selectByIds:OS})}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid)),d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e)),u=this.select(Ut(d.user));this.dispatch(n(d.uuid)),this.dispatch(on(d.user));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${d.uuid}/`,blockers:[d.uuid],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ln(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class wb extends St{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:RS,addMany:MS,setOne:gS,setMany:_S,updateOne:ES,updateMany:wS,deleteOne:BS,deleteMany:VS,initialize:bS});m(this,"selectors",{selectById:jS,selectByIds:qS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.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:S(h.PATCH,this.name,!1),method:h.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:S(h.POST,this.name,!1),method:h.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 Eb extends w{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:WS,addMany:KS,setOne:YS,setMany:ZS,updateOne:JS,updateMany:XS,deleteOne:QS,deleteMany:xS,initialize:HS});m(this,"selectors",{selectById:tT,selectByIds:sT})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[d.organization_access,d.project],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(c(d.uuid)),r}),[d,u]}bulkAdd(e){const{addMany:n,deleteMany:a,updateMany:c}=this.actions,d=this.select(y=>{var o;return((o=y.userReducer.currentUser)==null?void 0:o.uuid)??null}),u=e.map(y=>P({...y,created_by:d}));this.dispatch(n(u));const r=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(y=>R(y))},blockers:u.flatMap(y=>[y.project,y.organization_access]),blocks:u.map(y=>y.uuid)});return r.then(y=>{this.dispatch(c(y))}).catch(y=>{throw this.dispatch(a(u.map(o=>o.uuid))),y}),[u,r]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid)),d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 Bb extends q{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:aT,addMany:cT,setOne:dT,setMany:rT,updateOne:uT,updateMany:lT,deleteOne:oT,deleteMany:hT,initialize:nT});m(this,"selectors",{selectById:yT,selectByIds:pT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(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 Vb extends q{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:OT,addMany:PT,setOne:TT,setMany:IT,updateOne:FT,updateMany:bT,deleteOne:_T,deleteMany:gT,initialize:ST});m(this,"selectors",{selectById:wT,selectByIds:ET})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,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}}buildBulkPayload(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{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,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 vb extends St{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:DT,addMany:qT,setOne:jT,setMany:zT,updateOne:CT,updateMany:$T,deleteOne:UT,deleteMany:LT,initialize:vT});m(this,"selectors",{selectById:GT,selectByIds:HT})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:h.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.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 zb extends w{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:ZT,addMany:JT,setOne:XT,setMany:QT,updateOne:xT,updateMany:eI,deleteOne:tI,deleteMany:sI,initialize:YT});m(this,"selectors",{selectById:aI,selectByIds:cI})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[e.team],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}bulkAdd(e){const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=this.select(y=>{var o;return((o=y.userReducer.currentUser)==null?void 0:o.uuid)??null}),u=e.map(y=>P({...y,created_by:d}));this.dispatch(n(u));const r=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(y=>R(y))},blockers:u.map(y=>y.team),blocks:u.map(y=>y.uuid)});return r.then(y=>{this.dispatch(a(y))}).catch(()=>{this.dispatch(c(u.map(y=>y.uuid)))}),[u,r]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),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 jb extends w{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:uI,addMany:lI,setOne:oI,setMany:hI,updateOne:mI,updateMany:yI,deleteOne:pI,deleteMany:AI,initialize:rI});m(this,"selectors",{selectById:SI,selectByIds:TI})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),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 qb extends St{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:ln,addMany:sS,setOne:tS,setMany:eS,updateOne:nS,updateMany:iS,deleteOne:on,deleteMany:aS,initialize:xf});m(this,"selectors",{selectById:Ut,selectByIds:rS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:h.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 wn(t,s,e,n,a){const c=n instanceof st;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:u,payload:r,headers:y,method:o,queryParams:p,attachmentHash:T,isExternalUrl:E,isAuthNeeded:M,isResponseBlob:b}={...d,...s};let I=s.url;const g=T?await e.files.fetchCache(T):void 0;if(T&&!g)throw new Error(`Cannot upload file ${T} because it's not cached.`);!E&&!I.startsWith("http")&&(!I.startsWith("/")&&!I.startsWith("blob:")&&(I="/"+I),I=t+I);const V=D=>{if(T){if(!u)throw new Error(`No S3 URL for file ${T}`);if("warning"in u)throw new Error(`S3 URL warning for file ${T}`);if(!g)throw new Error(`No file for file ${T}`);const k=u.fields["x-amz-checksum-sha1"];if(!k)throw new Error(`No checksum for file ${T}`);return D.set("x-amz-checksum-sha1",k).field({...r,...u.fields}).attach("file",g)}return D.send(r)},v={[h.GET]:()=>b?nt.get(I.toString()).responseType("blob"):nt.get(I.toString()),[h.POST]:()=>{const D=nt.post(I.toString());return V(D)},[h.PATCH]:()=>{const D=nt.patch(I.toString());return V(D)},[h.PUT]:()=>{const D=nt.put(I.toString());return V(D)},[h.DELETE]:()=>{const D=nt.delete(I.toString());return V(D)}}[o];let $=v();const j=()=>{console.debug("aborting request:",s.url),$.abort()};if(a==null||a.addEventListener("abort",j),M&&c){const D=n.auth.getAuthHeader();$=$.set("Authorization",D)}y&&($=$.set(y));try{return await $.query(p)}catch(D){const k=DI(D);if(c&&k&&n.auth.isAuthFailure(k))throw await n.auth.handleUnauthorized($,k),new L({response:k,innerError:D,discard:!1});const Gt=k==null?void 0:k.status;throw new L({response:k,innerError:D,discard:Gt!==void 0&&Mn.includes(Gt)})}finally{a==null||a.removeEventListener("abort",j)}}class Db{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Wt,d={...e,uuid:e.uuid??xe.v4()};return wn(s,d,this,n,a).then(u=>{c.resolve(u.body)}).catch(u=>{u instanceof Error?c.reject(u):c.reject(new Error((u??rt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof L)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof L)throw a;return a})}_enqueueRequest(s,e,n){const a=new Wt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(US(c)),u=y=>{if(y)a.resolve(y.body);else{const o=new L({message:"Could not get a response from the server.",response:y,discard:!0});a.reject(o)}},r=y=>{y instanceof L?y.options.discard=!0:(console.error("Received an unexpected error while processing a request:",y,`
|
|
13
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(o)}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:h.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 Ot(e),file_type:e.type,extension:Nn(e),size:e.size};return await this.client.files.addCache(e),a}}class sb extends w{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:rh,addMany:uh,setOne:lh,setMany:oh,updateOne:hh,updateMany:mh,deleteOne:yh,deleteMany:ph,initialize:dh});m(this,"selectors",{selectById:fh,selectByIds:Sh})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.form],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 ib extends w{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:Ph,addMany:Fh,setOne:bh,setMany:_h,updateOne:gh,updateMany:Mh,deleteOne:Rh,deleteMany:wh,initialize:Oh});m(this,"selectors",{selectById:Bh,selectByIds:Vh})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(a(d)),d}}class nb extends q{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:qh,addMany:Dh,setOne:$h,setMany:Ch,updateOne:Uh,updateMany:Lh,deleteOne:kh,deleteMany:Nh,initialize:jh});m(this,"selectors",{selectById:Hh,selectByIds:Wh})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:u,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 ab extends w{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:Jh,addMany:hi,setOne:Xh,setMany:Qh,updateOne:xh,updateMany:em,deleteOne:tm,deleteMany:mi,initialize:Zh});m(this,"selectors",{selectById:im,selectByIds:nm})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}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 cb extends w{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:um,addMany:lm,setOne:om,setMany:hm,updateOne:mm,updateMany:ym,deleteOne:pm,deleteMany:Am,initialize:rm});m(this,"selectors",{selectById:Tm,selectByIds:Im})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error("Expected form to exist");const u=this.select(Gm(e)),r=this.select(am(e));this.dispatch(n(e)),this.dispatch(tt(B(u))),this.dispatch(mi(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(d)),this.dispatch(hi(r)),this.dispatch(et(u)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class db extends q{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:Fm,addMany:fi,setOne:bm,setMany:_m,updateOne:gm,updateMany:Mm,deleteOne:Rm,deleteMany:Si,initialize:Pm});m(this,"selectors",{selectById:wm,selectByIds:Em})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,c=this.select(Oi(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}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 rb extends w{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Dm,addMany:et,setOne:jm,setMany:qm,updateOne:$m,updateMany:Cm,deleteOne:Um,deleteMany:tt,initialize:zm});m(this,"selectors",{selectById:km,selectByIds:Nm})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Bm(e));this.dispatch(n(e)),this.dispatch(Si(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(fi(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(a(d)),d}}class ub extends q{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:ey,addMany:ty,setOne:Qm,setMany:xm,updateOne:sy,updateMany:iy,deleteOne:ny,deleteMany:ay,initialize:Xm});m(this,"selectors",{selectById:dy,selectByIds:ry})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,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}}buildBulkPayload(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{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,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 lb extends w{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Ay,addMany:at,setOne:my,setMany:hy,updateOne:yy,updateMany:py,deleteOne:fy,deleteMany:ct,initialize:oy});m(this,"selectors",{selectById:Ty,selectByIds:Iy})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}bulkAdd(e){const{addMany:n,deleteMany:a,updateMany:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=e.map(o=>P({...o,submitted_at:u,created_by:d}));this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(o=>R(o)),submitted_at:u},blockers:r.flatMap(o=>[o.issue,o.asset]),blocks:B(r)});return y.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(a(B(r)))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 ob extends q{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:Ry,addMany:Mi,setOne:wy,setMany:Ey,updateOne:By,updateMany:Vy,deleteOne:vy,deleteMany:Ri,initialize:My});m(this,"selectors",{selectById:qy,selectByIds:Dy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(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 hb extends q{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Ly,addMany:ky,setOne:Ny,setMany:Gy,updateOne:Hy,updateMany:Wy,deleteOne:Ky,deleteMany:Yy,initialize:Uy});m(this,"selectors",{selectById:Jy,selectByIds:Xy})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(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 mb extends w{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:tp,addMany:sp,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:rp,initialize:ep});m(this,"selectors",{selectById:up,selectByIds:lp})}add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>r.userReducer.currentUser.uuid),submitted_at:new Date().toISOString()});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 yb extends w{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:yp,addMany:ji,setOne:pp,setMany:Ap,updateOne:fp,updateMany:Sp,deleteOne:Tp,deleteMany:qi,initialize:mp});m(this,"selectors",{selectById:Op,selectByIds:Pp})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=new Date().toISOString(),u=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),r=P({...e,submitted_at:d,created_by:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.project,r.issue_type,r.status],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const d={...c,...e};this.dispatch(n(d));const u={};for(const o of[U.TITLE,U.DESCRIPTION,U.STATUS,U.PRIORITY,U.ASSIGNED_TO,U.DUE_DATE])if(o in e&&e[o]!==c[o])switch(o){case U.PRIORITY:u[o]=e.priority;break;case U.DUE_DATE:u[o]=e.due_date;break;case U.DESCRIPTION:u[o]=e.description??"";break;case U.TITLE:u[o]=e.title??"";break;case U.STATUS:{const p=e[o],T=this.select(en(p));if(!T)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);u[o]={name:T.name,color:T.color,uuid:T.uuid};break}case U.ASSIGNED_TO:{const p=e[o];if(p===null)u[o]=null;else{const T=this.select(Ut(p));if(!T)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);u[o]={email:T.email,uuid:T.uuid}}break}}const r=P({created_by:this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),submitted_at:new Date().toISOString(),issue:c.uuid,changes:u});this.dispatch(sn(r));const y=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return y.then(o=>{this.dispatch(n(o))}).catch(()=>{this.dispatch(n(c)),this.dispatch(an(r.uuid))}),[d,y]}bulkUpdate(e,n){const{updateMany:a}=this.actions,{selectByIds:c}=this.selectors,d=B(e).toSorted(Pt);if(d.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(c(d)).toSorted(Jt);if(d.length!=u.length)throw new Error(`Attempting to bulk update ${d.length-u.length} issues that dont exist in the store`);const r=[];for(let T=0;T<d.length;T++)r.push({...u[T],...e[T]});this.dispatch(a(r));const y=Qe(e,Math.min(n??e.length,Xe)),o=[];let p=null;for(const T of y){const E=xe.v4(),M=B(T),b=T.map(({status:g})=>g).filter(Boolean),I=this.enqueueRequest({description:S(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:T},blockers:(p?[p]:[]).concat(M).concat(b),blocks:[E].concat(M)});o.push(I),p=E}return Promise.all(o).then(T=>{this.dispatch(a(T.flat()))}).catch(()=>{this.dispatch(a(u))}),[r,o]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No issue with uuid ${e} found in the store`);const u=this.select(Py(e)),r=this.select(jy(e)),y=this.select(Jf(e)),o=this.select(Hm(e));this.dispatch(n(e)),this.dispatch(Ri(B(r))),this.dispatch(cn(B(y))),this.dispatch(ct(B(u))),this.dispatch(tt(B(o)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(d)),this.dispatch(Mi(r)),this.dispatch(nn(y)),this.dispatch(at(u)),this.dispatch(et(o)),p}}async bulkDelete(e){const{addMany:n,deleteMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e)),u=this.select(Oy(e)),r=this.select(Wm(e));this.dispatch(a(e)),this.dispatch(ct(B(u))),this.dispatch(tt(B(r)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(y){throw this.dispatch(n(d)),this.dispatch(at(u)),this.dispatch(et(r)),y}}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 pb extends q{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:Mp,addMany:Rp,setOne:wp,setMany:Ep,updateOne:Bp,updateMany:Vp,deleteOne:vp,deleteMany:zp,initialize:gp});m(this,"selectors",{selectById:qp,selectByIds:Dp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(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 Ab extends q{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:wA,addMany:Gi,setOne:EA,setMany:BA,updateOne:VA,updateMany:vA,deleteOne:zA,deleteMany:Hi,initialize:RA});m(this,"selectors",{selectById:qA,selectByIds:DA})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:u,file_extension:r}}async bulkDelete(e){const{deleteMany:n,addMany:a}=this.actions,{selectByIds:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(d)),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 fb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});m(this,"selectors",{selectById:lA,selectByIds:oA})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u}),y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(n(r)),y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.issue],blocks:[d.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select($A(e));this.dispatch(n(e)),this.dispatch(Hi(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(Gi(u)),r}}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 Sb extends q{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:Lp,addMany:kp,setOne:Np,setMany:Gp,updateOne:Hp,updateMany:Wp,deleteOne:Kp,deleteMany:Yp,initialize:Up});m(this,"selectors",{selectById:Jp,selectByIds:Xp})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:u,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 Tb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:SA,updateOne:TA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});m(this,"selectors",{selectById:bA,selectByIds:_A})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(o=>{throw this.dispatch(c(r.uuid)),o}),[r,y]}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 Ib extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:kA,addMany:NA,setOne:GA,setMany:HA,updateOne:WA,updateMany:KA,deleteOne:YA,deleteMany:ZA,initialize:LA});m(this,"selectors",{selectById:XA,selectByIds:QA})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[r.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 Ob extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:sf,addMany:nf,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:lf,initialize:tf});m(this,"selectors",{selectById:hf,selectByIds:mf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 Pb extends w{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:ff,addMany:Sf,setOne:Tf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:bf,initialize:Af});m(this,"selectors",{selectById:gf,selectByIds:Mf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,submitted_at:u,created_by:d});this.dispatch(n(r));const y=this.enqueueRequest({method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=this.select(Fp(e));this.dispatch(n(e)),this.dispatch(qi(B(u)));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ji(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Fb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:Bf,addMany:Vf,setOne:vf,setMany:zf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:$f,initialize:Ef});m(this,"selectors",{selectById:en,selectByIds:Uf})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=this.select(o=>{var p;return((p=o.userReducer.currentUser)==null?void 0:p.uuid)??null}),u=new Date().toISOString(),r=P({...e,created_by:d,submitted_at:u});this.dispatch(n(r));const y=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue_type],blocks:[r.uuid]});return y.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,y]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),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 bb extends w{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:sn,addMany:nn,setOne:Gf,setMany:Hf,updateOne:Wf,updateMany:Kf,deleteOne:an,deleteMany:cn,initialize:Nf});m(this,"selectors",{selectById:Yf,selectByIds:Zf})}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 _b=1800;function gb(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 Mb extends $I{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:h.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(Mo(!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.debug("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=iO(e).exp??n}catch{a=n}return a-n<_b}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 L&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??rt).toString()))}}}async handleUnauthorized(e,n){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new L({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new L({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:h.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(gb(a))})}}class St extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Rb extends St{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:oS,addMany:hS,setOne:mS,setMany:yS,updateOne:pS,updateMany:AS,deleteOne:fS,deleteMany:SS,initialize:lS});m(this,"selectors",{selectById:IS,selectByIds:OS})}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid)),d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e)),u=this.select(Ut(d.user));this.dispatch(n(d.uuid)),this.dispatch(on(d.user));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${d.uuid}/`,blockers:[d.uuid],blocks:[]})}catch(r){throw this.dispatch(a(d)),this.dispatch(ln(u)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class wb extends St{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:RS,addMany:MS,setOne:gS,setMany:_S,updateOne:ES,updateMany:wS,deleteOne:BS,deleteMany:VS,initialize:bS});m(this,"selectors",{selectById:jS,selectByIds:qS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.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:S(h.PATCH,this.name,!1),method:h.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:S(h.POST,this.name,!1),method:h.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 Eb extends w{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:WS,addMany:KS,setOne:YS,setMany:ZS,updateOne:JS,updateMany:XS,deleteOne:QS,deleteMany:xS,initialize:HS});m(this,"selectors",{selectById:tT,selectByIds:sT})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[d.organization_access,d.project],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(c(d.uuid)),r}),[d,u]}bulkAdd(e){const{addMany:n,deleteMany:a,updateMany:c}=this.actions,d=this.select(y=>{var o;return((o=y.userReducer.currentUser)==null?void 0:o.uuid)??null}),u=e.map(y=>P({...y,created_by:d}));this.dispatch(n(u));const r=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(y=>R(y))},blockers:u.flatMap(y=>[y.project,y.organization_access]),blocks:u.map(y=>y.uuid)});return r.then(y=>{this.dispatch(c(y))}).catch(y=>{throw this.dispatch(a(u.map(o=>o.uuid))),y}),[u,r]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid)),d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(r=>{this.dispatch(n(r))}).catch(r=>{throw this.dispatch(n(c)),r}),[d,u]}async delete(e){const{deleteOne:n,addOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(d)),u}}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 Bb extends q{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:aT,addMany:cT,setOne:dT,setMany:rT,updateOne:uT,updateMany:lT,deleteOne:oT,deleteMany:hT,initialize:nT});m(this,"selectors",{selectById:yT,selectByIds:pT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(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 Vb extends q{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:OT,addMany:PT,setOne:TT,setMany:IT,updateOne:FT,updateMany:bT,deleteOne:_T,deleteMany:gT,initialize:ST});m(this,"selectors",{selectById:wT,selectByIds:ET})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(c=>{var d;return((d=c.userReducer.currentUser)==null?void 0:d.uuid)??null}),a=new Date().toISOString();return P({...e,created_by:n,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,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}}buildBulkPayload(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{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,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 vb extends St{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:DT,addMany:qT,setOne:jT,setMany:zT,updateOne:CT,updateMany:$T,deleteOne:UT,deleteMany:LT,initialize:vT});m(this,"selectors",{selectById:GT,selectByIds:HT})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:h.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.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 zb extends w{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:ZT,addMany:JT,setOne:XT,setMany:QT,updateOne:xT,updateMany:eI,deleteOne:tI,deleteMany:sI,initialize:YT});m(this,"selectors",{selectById:aI,selectByIds:cI})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[e.team],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}bulkAdd(e){const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=this.select(y=>{var o;return((o=y.userReducer.currentUser)==null?void 0:o.uuid)??null}),u=e.map(y=>P({...y,created_by:d}));this.dispatch(n(u));const r=this.enqueueRequest({description:S(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(y=>R(y))},blockers:u.map(y=>y.team),blocks:u.map(y=>y.uuid)});return r.then(y=>{this.dispatch(a(y))}).catch(()=>{this.dispatch(c(u.map(y=>y.uuid)))}),[u,r]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),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 jb extends w{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:uI,addMany:lI,setOne:oI,setMany:hI,updateOne:mI,updateMany:yI,deleteOne:pI,deleteMany:AI,initialize:rI});m(this,"selectors",{selectById:SI,selectByIds:TI})}add(e){const{addOne:n,setOne:a,deleteOne:c}=this.actions,d=P({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>{var y;return((y=r.userReducer.currentUser)==null?void 0:y.uuid)??null})});this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return u.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,u]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.select(a(e.uuid));if(!c)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(n(d));const u=this.enqueueRequest({description:S(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(c))}),[d,u]}async delete(e){const{deleteOne:n,setOne:a}=this.actions,{selectById:c}=this.selectors,d=this.select(c(e));if(!d)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:S(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(a(d)),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 qb extends St{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:ln,addMany:sS,setOne:tS,setMany:eS,updateOne:nS,updateMany:iS,deleteOne:on,deleteMany:aS,initialize:xf});m(this,"selectors",{selectById:Ut,selectByIds:rS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:h.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 wn(t,s,e,n,a){const c=n instanceof st;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:u,payload:r,headers:y,method:o,queryParams:p,attachmentHash:T,isExternalUrl:E,isAuthNeeded:M,isResponseBlob:b}={...d,...s};let I=s.url;const g=T?await e.files.fetchCache(T):void 0;if(T&&!g)throw new Error(`Cannot upload file ${T} because it's not cached.`);!E&&!I.startsWith("http")&&(!I.startsWith("/")&&!I.startsWith("blob:")&&(I="/"+I),I=t+I);const V=$=>{if(T){if(!u)throw new Error(`No S3 URL for file ${T}`);if("warning"in u)throw new Error(`S3 URL warning for file ${T}`);if(!g)throw new Error(`No file for file ${T}`);const k=u.fields["x-amz-checksum-sha1"];if(!k)throw new Error(`No checksum for file ${T}`);return $.set("x-amz-checksum-sha1",k).field({...r,...u.fields}).attach("file",g)}return $.send(r)},v={[h.GET]:()=>b?nt.get(I.toString()).responseType("blob"):nt.get(I.toString()),[h.POST]:()=>{const $=nt.post(I.toString());return V($)},[h.PATCH]:()=>{const $=nt.patch(I.toString());return V($)},[h.PUT]:()=>{const $=nt.put(I.toString());return V($)},[h.DELETE]:()=>{const $=nt.delete(I.toString());return V($)}}[o];let D=v();const j=()=>{console.debug("aborting request:",s.url),D.abort()};a==null||a.addEventListener("abort",j),M&&c&&(D=n.auth.applyAuth(D)),y&&(D=D.set(y));try{return await D.query(p)}catch($){const k=DI($);if(c&&k&&n.auth.isAuthFailure(k))throw await n.auth.handleUnauthorized(D,k),new L({response:k,innerError:$,discard:!1});const Gt=k==null?void 0:k.status;throw new L({response:k,innerError:$,discard:Gt!==void 0&&Mn.includes(Gt)})}finally{a==null||a.removeEventListener("abort",j)}}class Db{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Wt,d={...e,uuid:e.uuid??xe.v4()};return wn(s,d,this,n,a).then(u=>{c.resolve(u.body)}).catch(u=>{u instanceof Error?c.reject(u):c.reject(new Error((u??rt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof L)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof L)throw a;return a})}_enqueueRequest(s,e,n){const a=new Wt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(US(c)),u=y=>{if(y)a.resolve(y.body);else{const o=new L({message:"Could not get a response from the server.",response:y,discard:!0});a.reject(o)}},r=y=>{y instanceof L?y.options.discard=!0:(console.error("Received an unexpected error while processing a request:",y,`
|
|
14
14
|
Converting error to APIError and discarding.`),y=new L({message:"An error occurred while processing the request.",innerError:y,discard:!0})),a.reject(y)};return d.then(u,r),a}async performPagination(s,e,n,a,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:u}=d,r=[];let y=await this.performRequest(s,d,a,c);for(r.push(y.results);y.next;)y=await this.performRequest(s,{url:y.next,method:u},a,c),r.push(y.results);return r}}class ut{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new nO.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(u=>a.payload.blockers.includes(u))&&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 CI;function UI(t){CI=t}function lt(){return CI}let LI;function kI(t){LI=t}function NI(){return LI}let En=null;function it(){const t=lt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(En)return En;const s=t.getState().offline.outbox,e=ut._fromOutbox(s);return En=e,e}const $b=(t,s)=>{const e=new s(t);return kI(e),UI(t),e};class Cb{constructor(s){m(this,"_all");m(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 Bn{constructor(){m(this,"next");this.next=null}then(s){return new Cb(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=NI();if(!n)throw new Error("Client SDK not set");return zI(s,n)}}}class GI extends Bn{async run(s){return super.run(s)}}class HI extends Bn{async run(s){return super.run(s)}}const WI=new GI().then(new HI).compile();function KI(t){var s;return(s=WI[0])==null?void 0:s.run(t)}var YI=(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))(YI||{});i.ALL_MIDDLEWARE=WI,i.APIError=L,i.AgentService=gF,i.AssetAttachmentService=MF,i.AssetProcedureService=RF,i.AssetProcedureStepFieldValuesAttachmentService=wF,i.AssetProcedureStepFieldValuesService=EF,i.AssetProcedureStepFieldsAttachmentService=BF,i.AssetProcedureStepFieldsService=VF,i.AssetProcedureStepService=vF,i.AssetProcedureTypeAttachmentService=zF,i.AssetProcedureTypeFieldValuesAttachmentService=jF,i.AssetProcedureTypeFieldValuesService=qF,i.AssetProcedureTypeFieldsAttachmentService=DF,i.AssetProcedureTypeFieldsService=$F,i.AssetProcedureTypeService=CF,i.AssetService=UF,i.AssetStageCompletionService=LF,i.AssetStageService=kF,i.AssetStatusType=$n,i.AssetTypeAttachmentService=NF,i.AssetTypeFieldValuesAttachmentService=GF,i.AssetTypeFieldValuesService=HF,i.AssetTypeFieldsAttachmentService=WF,i.AssetTypeFieldsService=KF,i.AssetTypeIdentifierService=YF,i.AssetTypeIdentifierValueService=ZF,i.AssetTypeService=JF,i.AssetTypeStatusService=XF,i.AttachmentModel=Cn,i.BaseApiService=st,i.BaseAuthService=$I,i.BaseModelApiService=St,i.BaseOfflineFileModelApiService=q,i.BaseOfflineModelApiService=w,i.BaseSDK=Db,i.COMMON_AUTO_FIELDS=Yn,i.DEFAULT_ISSUE_PRIORITY=aO,i.DEFAULT_PAGE_SIZE=bI,i.DISCARD_HTTP_STATUSES=Mn,i.DeferredPromise=Wt,i.DocumentAttachmentService=QF,i.DocumentService=xF,i.EMPTY_ARRAY=jn,i.EMPTY_OBJECT=qn,i.EmailVerificationService=eb,i.FILE_MODEL_DEFAULT_PAGE_SIZE=_I,i.FileService=tb,i.FormIdentifierService=sb,i.FormIdentifierValueService=ib,i.FormRevisionAttachmentService=nb,i.FormRevisionService=ab,i.FormService=cb,i.FormSubmissionAttachmentService=db,i.FormSubmissionService=rb,i.GeoImageService=ub,i.HttpMethod=h,i.IssueAssociationService=lb,i.IssueAttachmentService=ob,i.IssueCommentAttachmentService=hb,i.IssueCommentService=mb,i.IssuePriority=Ht,i.IssueService=yb,i.IssueStatusType=Un,i.IssueTypeAttachmentService=pb,i.IssueTypeFieldValuesAttachmentService=Ab,i.IssueTypeFieldValuesService=fb,i.IssueTypeFieldsAttachmentService=Sb,i.IssueTypeFieldsService=Tb,i.IssueTypeIdentifierService=Ib,i.IssueTypeIdentifierValueService=Ob,i.IssueTypeService=Pb,i.IssueTypeStatusService=Fb,i.IssueUpdateChange=U,i.IssueUpdateService=bb,i.JWTService=Mb,i.MAX_SERVICE_BATCH_SIZE=Xe,i.OUTBOX_RETRY_DELAY=Ln,i.OfflineAnalyticsMiddleware=GI,i.OfflineMiddleware=Bn,i.OrganizationAccessLevel=Dn,i.OrganizationAccessService=Rb,i.OrganizationService=wb,i.OutboxCoordinator=ut,i.ProjectAccessService=Eb,i.ProjectAttachmentService=Bb,i.ProjectFileService=Vb,i.ProjectService=vb,i.RESET_ORGANIZATION_STATE=_,i.RESET_PROJECT_STATE=z,i.RESET_STATE=O,i.RateLimitingMiddleware=HI,i.SelectorBuilder=RO,i.TeamMembershipService=zb,i.TeamService=jb,i.UNKNOWN_ERROR_MESSAGE=rt,i.UserService=qb,i.VERSION_REDUCER_KEY=ht,i.VerificationCodeType=YI,i._setLatestRetryTime=kS,i.addAsset=br,i.addAssetAttachment=ua,i.addAssetAttachments=ts,i.addAssetProcedure=Dc,i.addAssetProcedureStep=hr,i.addAssetProcedureStepFieldValues=Jd,i.addAssetProcedureStepFieldValuesAttachment=Dd,i.addAssetProcedureStepFieldValuesAttachments=bs,i.addAssetProcedureStepFieldValuesMany=Xd,i.addAssetProcedureStepFields=bd,i.addAssetProcedureStepFieldsAttachment=ld,i.addAssetProcedureStepFieldsAttachments=od,i.addAssetProcedureStepFieldsMany=_d,i.addAssetProcedureSteps=mr,i.addAssetProcedureType=Jc,i.addAssetProcedureTypeAttachment=Pa,i.addAssetProcedureTypeAttachments=Fa,i.addAssetProcedureTypeFieldValues=Fc,i.addAssetProcedureTypeFieldValuesAttachment=lc,i.addAssetProcedureTypeFieldValuesAttachments=ls,i.addAssetProcedureTypeFieldValuesMany=bc,i.addAssetProcedureTypeFields=Ja,i.addAssetProcedureTypeFieldsAttachment=qa,i.addAssetProcedureTypeFieldsAttachments=Da,i.addAssetProcedureTypeFieldsMany=Xa,i.addAssetProcedureTypes=Xc,i.addAssetProcedures=ps,i.addAssetStage=eu,i.addAssetStageCompletion=Dr,i.addAssetStageCompletions=$r,i.addAssetStages=tu,i.addAssetType=to,i.addAssetTypeAttachment=ou,i.addAssetTypeAttachments=$s,i.addAssetTypeFieldValues=ol,i.addAssetTypeFieldValuesAttachment=Qu,i.addAssetTypeFieldValuesAttachments=Hs,i.addAssetTypeFieldValuesMany=hl,i.addAssetTypeFields=$u,i.addAssetTypeFieldsAttachment=bu,i.addAssetTypeFieldsAttachments=_u,i.addAssetTypeFieldsMany=Cu,i.addAssetTypeIdentifier=_l,i.addAssetTypeIdentifierValue=Cl,i.addAssetTypeIdentifierValues=Ul,i.addAssetTypeIdentifiers=gl,i.addAssetTypeStatus=yo,i.addAssetTypeStatuses=po,i.addAssetTypes=so,i.addAssets=Bs,i.addConversation=ia,i.addConversations=wO,i.addDocument=Ho,i.addDocumentAttachment=Bo,i.addDocumentAttachments=Vo,i.addDocuments=Wo,i.addForm=um,i.addFormIdentifier=rh,i.addFormIdentifierValue=Ph,i.addFormIdentifierValues=Fh,i.addFormIdentifiers=uh,i.addFormRevision=Jh,i.addFormRevisionAttachment=qh,i.addFormRevisionAttachments=Dh,i.addFormRevisions=hi,i.addFormSubmission=Dm,i.addFormSubmissionAttachment=Fm,i.addFormSubmissionAttachments=fi,i.addFormSubmissions=et,i.addForms=lm,i.addGeoImage=ey,i.addGeoImages=ty,i.addIssue=yp,i.addIssueAssociation=Ay,i.addIssueAssociations=at,i.addIssueAttachment=Ry,i.addIssueAttachments=Mi,i.addIssueComment=tp,i.addIssueCommentAttachment=Ly,i.addIssueCommentAttachments=ky,i.addIssueComments=sp,i.addIssueType=ff,i.addIssueTypeAttachment=Mp,i.addIssueTypeAttachments=Rp,i.addIssueTypeFieldValues=tA,i.addIssueTypeFieldValuesAttachment=wA,i.addIssueTypeFieldValuesAttachments=Gi,i.addIssueTypeFieldValuesMany=sA,i.addIssueTypeFields=pA,i.addIssueTypeFieldsAttachment=Lp,i.addIssueTypeFieldsAttachments=kp,i.addIssueTypeFieldsMany=AA,i.addIssueTypeIdentifier=kA,i.addIssueTypeIdentifierValue=sf,i.addIssueTypeIdentifierValues=nf,i.addIssueTypeIdentifiers=NA,i.addIssueTypeStatus=Bf,i.addIssueTypeStatuses=Vf,i.addIssueTypes=Sf,i.addIssueUpdate=sn,i.addIssueUpdates=nn,i.addIssues=ji,i.addOrganization=RS,i.addOrganizationAccess=oS,i.addOrganizationAccesses=hS,i.addOrganizations=MS,i.addProject=DT,i.addProjectAccess=WS,i.addProjectAccesses=KS,i.addProjectAttachment=aT,i.addProjectAttachments=cT,i.addProjectFile=OT,i.addProjectFiles=PT,i.addProjects=qT,i.addTeam=uI,i.addTeamMembership=ZT,i.addTeamMemberships=JT,i.addTeams=lI,i.addUser=ln,i.addUsers=sS,i.agentsReducer=ca,i.agentsSlice=Qt,i.areArraysEqual=uO,i.assetAttachmentReducer=Ta,i.assetAttachmentSlice=es,i.assetProcedureReducer=Nc,i.assetProcedureSlice=ys,i.assetProcedureStepFieldValuesAttachmentReducer=Kd,i.assetProcedureStepFieldValuesAttachmentSlice=Fs,i.assetProcedureStepFieldValuesReducer=dr,i.assetProcedureStepFieldValuesSlice=Ms,i.assetProcedureStepFieldsAttachmentReducer=Od,i.assetProcedureStepFieldsAttachmentSlice=Ts,i.assetProcedureStepFieldsReducer=zd,i.assetProcedureStepFieldsSlice=Os,i.assetProcedureStepReducer=Sr,i.assetProcedureStepSlice=Rs,i.assetProcedureTypeAttachmentReducer=Ea,i.assetProcedureTypeAttachmentSlice=ns,i.assetProcedureTypeFieldValuesAttachmentReducer=Ac,i.assetProcedureTypeFieldValuesAttachmentSlice=us,i.assetProcedureTypeFieldValuesReducer=Bc,i.assetProcedureTypeFieldValuesSlice=ms,i.assetProcedureTypeFieldsAttachmentReducer=Ga,i.assetProcedureTypeFieldsAttachmentSlice=cs,i.assetProcedureTypeFieldsReducer=nc,i.assetProcedureTypeFieldsSlice=rs,i.assetProcedureTypeReducer=nd,i.assetProcedureTypeSlice=fs,i.assetReducer=zr,i.assetSlice=Es,i.assetStageCompletionReducer=Hr,i.assetStageCompletionSlice=vs,i.assetStageReducer=cu,i.assetStageSlice=zs,i.assetTypeAttachmentReducer=Ou,i.assetTypeAttachmentSlice=Ds,i.assetTypeFieldValuesAttachmentReducer=rl,i.assetTypeFieldValuesAttachmentSlice=Gs,i.assetTypeFieldValuesReducer=Pl,i.assetTypeFieldValuesSlice=Ys,i.assetTypeFieldsAttachmentReducer=ju,i.assetTypeFieldsAttachmentSlice=Ls,i.assetTypeFieldsReducer=Zu,i.assetTypeFieldsSlice=Ns,i.assetTypeIdentifierReducer=ql,i.assetTypeIdentifierSlice=Zs,i.assetTypeIdentifierValueReducer=Jl,i.assetTypeIdentifierValueSlice=Xs,i.assetTypeReducer=oo,i.assetTypeSlice=Qs,i.assetTypeStatusReducer=_o,i.assetTypeStatusSlice=ei,i.assetTypeStatusSortFn=Xn,i.authReducer=Ro,i.authSlice=Bt,i.baseReducer=hF,i.baseReducers=gn,i.clearTokens=mP,i.createModelAdapter=F,i.createOfflineAction=$S,i.createPayload=R,i.createSelectionAdapter=cO,i.deleteAsset=Mr,i.deleteAssetAttachment=ya,i.deleteAssetAttachments=ss,i.deleteAssetProcedure=Uc,i.deleteAssetProcedureStep=Ar,i.deleteAssetProcedureStepFieldValues=sr,i.deleteAssetProcedureStepFieldValuesAttachment=kd,i.deleteAssetProcedureStepFieldValuesAttachments=_s,i.deleteAssetProcedureStepFieldValuesMany=ir,i.deleteAssetProcedureStepFields=Ed,i.deleteAssetProcedureStepFieldsAttachment=Ad,i.deleteAssetProcedureStepFieldsAttachments=fd,i.deleteAssetProcedureStepFieldsMany=Bd,i.deleteAssetProcedureSteps=fr,i.deleteAssetProcedureType=ed,i.deleteAssetProcedureTypeAttachment=Ra,i.deleteAssetProcedureTypeAttachments=wa,i.deleteAssetProcedureTypeFieldValues=wc,i.deleteAssetProcedureTypeFieldValuesAttachment=pc,i.deleteAssetProcedureTypeFieldValuesAttachments=os,i.deleteAssetProcedureTypeFieldValuesMany=Ec,i.deleteAssetProcedureTypeFields=sc,i.deleteAssetProcedureTypeFieldsAttachment=ka,i.deleteAssetProcedureTypeFieldsAttachments=Na,i.deleteAssetProcedureTypeFieldsMany=ic,i.deleteAssetProcedureTypes=td,i.deleteAssetProcedures=As,i.deleteAssetStage=nu,i.deleteAssetStageCompletion=Nr,i.deleteAssetStageCompletions=Gr,i.deleteAssetStages=au,i.deleteAssetType=ao,i.deleteAssetTypeAttachment=Au,i.deleteAssetTypeAttachments=Cs,i.deleteAssetTypeFieldValues=fl,i.deleteAssetTypeFieldValuesAttachment=il,i.deleteAssetTypeFieldValuesAttachments=Ws,i.deleteAssetTypeFieldValuesMany=Sl,i.deleteAssetTypeFields=Gu,i.deleteAssetTypeFieldsAttachment=Eu,i.deleteAssetTypeFieldsAttachments=Bu,i.deleteAssetTypeFieldsMany=Hu,i.deleteAssetTypeIdentifier=Bl,i.deleteAssetTypeIdentifierValue=Hl,i.deleteAssetTypeIdentifierValues=Wl,i.deleteAssetTypeIdentifiers=Vl,i.deleteAssetTypeStatus=Io,i.deleteAssetTypeStatuses=Oo,i.deleteAssetTypes=co,i.deleteAssets=Vs,i.deleteConversation=VO,i.deleteConversations=vO,i.deleteDocument=Xo,i.deleteDocumentAttachment=Do,i.deleteDocumentAttachments=$o,i.deleteDocuments=Qo,i.deleteForm=pm,i.deleteFormIdentifier=yh,i.deleteFormIdentifierValue=Rh,i.deleteFormIdentifierValues=wh,i.deleteFormIdentifiers=ph,i.deleteFormRevision=tm,i.deleteFormRevisionAttachment=kh,i.deleteFormRevisionAttachments=Nh,i.deleteFormRevisions=mi,i.deleteFormSubmission=Um,i.deleteFormSubmissionAttachment=Rm,i.deleteFormSubmissionAttachments=Si,i.deleteFormSubmissions=tt,i.deleteForms=Am,i.deleteGeoImage=ny,i.deleteGeoImages=ay,i.deleteIssue=Tp,i.deleteIssueAssociation=fy,i.deleteIssueAssociations=ct,i.deleteIssueAttachment=vy,i.deleteIssueAttachments=Ri,i.deleteIssueComment=dp,i.deleteIssueCommentAttachment=Ky,i.deleteIssueCommentAttachments=Yy,i.deleteIssueComments=rp,i.deleteIssueType=Ff,i.deleteIssueTypeAttachment=vp,i.deleteIssueTypeAttachments=zp,i.deleteIssueTypeFieldValues=dA,i.deleteIssueTypeFieldValuesAttachment=zA,i.deleteIssueTypeFieldValuesAttachments=Hi,i.deleteIssueTypeFieldValuesMany=rA,i.deleteIssueTypeFields=OA,i.deleteIssueTypeFieldsAttachment=Kp,i.deleteIssueTypeFieldsAttachments=Yp,i.deleteIssueTypeFieldsMany=PA,i.deleteIssueTypeIdentifier=YA,i.deleteIssueTypeIdentifierValue=uf,i.deleteIssueTypeIdentifierValues=lf,i.deleteIssueTypeIdentifiers=ZA,i.deleteIssueTypeStatus=Df,i.deleteIssueTypeStatuses=$f,i.deleteIssueTypes=bf,i.deleteIssueUpdate=an,i.deleteIssueUpdates=cn,i.deleteIssues=qi,i.deleteOrganization=BS,i.deleteOrganizationAccess=fS,i.deleteOrganizationAccesses=SS,i.deleteOrganizations=VS,i.deleteProject=UT,i.deleteProjectAccess=QS,i.deleteProjectAccesses=xS,i.deleteProjectAttachment=oT,i.deleteProjectAttachments=hT,i.deleteProjectFile=_T,i.deleteProjectFiles=gT,i.deleteProjects=LT,i.deleteTeam=pI,i.deleteTeamMembership=tI,i.deleteTeamMemberships=sI,i.deleteTeams=AI,i.deleteUser=on,i.deleteUsers=aS,i.dequeue=vI,i.discard=jI,i.documentAttachmentReducer=ko,i.documentAttachmentSlice=si,i.documentSlice=ni,i.documentsReducer=xo,i.downloadFile=fO,i.emailRegex=_O,i.enqueue=VI,i.enqueueRequest=US,i.extractResponseFromError=DI,i.fallbackToEmptyArray=f,i.fallbackToEmptyObject=It,i.fetchBlobFromObjectUrl=Gn,i.fetchFileFromObjectUrl=Hn,i.fileReducer=ah,i.fileSlice=ci,i.formIdentifierReducer=Th,i.formIdentifierSlice=di,i.formIdentifierValueReducer=vh,i.formIdentifierValueSlice=ui,i.formReducer=fm,i.formRevisionAttachmentReducer=Kh,i.formRevisionAttachmentSlice=li,i.formRevisionReducer=cm,i.formRevisionsSlice=oi,i.formSlice=yi,i.formSubmissionAttachmentReducer=Vm,i.formSubmissionAttachmentSlice=Ai,i.formSubmissionReducer=Zm,i.formSubmissionSlice=Pi,i.geoImageReducer=uy,i.geoImageSlice=Fi,i.getAssetProcedureStepSubTree=Jn,i.getAssetProcedureStepTrees=gO,i.getClientSDK=NI,i.getClientStore=lt,i.getDocumentSubTree=ea,i.getDocumentTrees=MO,i.getFileExtension=Nn,i.getLocalDateString=kn,i.getLocalRelativeDateString=mO,i.getOutboxCoordinator=it,i.getRenamedFile=AO,i.getRequestDescription=S,i.getS3FileKey=pO,i.hashFile=Ot,i.initSDK=$b,i.initializeAssetAttachments=ra,i.initializeAssetProcedureStepFieldValues=Zd,i.initializeAssetProcedureStepFieldValuesAttachments=qd,i.initializeAssetProcedureStepFields=Fd,i.initializeAssetProcedureStepFieldsAttachments=ud,i.initializeAssetProcedureSteps=ur,i.initializeAssetProcedureTypeAttachments=Oa,i.initializeAssetProcedureTypeFieldValues=Pc,i.initializeAssetProcedureTypeFieldValuesAttachments=uc,i.initializeAssetProcedureTypeFields=Za,i.initializeAssetProcedureTypeFieldsAttachments=ja,i.initializeAssetProcedureTypes=Zc,i.initializeAssetProcedures=qc,i.initializeAssetStageCompletions=qr,i.initializeAssetStages=Xr,i.initializeAssetTypeAttachments=lu,i.initializeAssetTypeFieldValues=ll,i.initializeAssetTypeFieldValuesAttachments=Xu,i.initializeAssetTypeFields=Du,i.initializeAssetTypeFieldsAttachments=Fu,i.initializeAssetTypeIdentifierValues=$l,i.initializeAssetTypeIdentifiers=bl,i.initializeAssetTypeStatuses=mo,i.initializeAssetTypes=Ql,i.initializeAssets=Fr,i.initializeConversations=sa,i.initializeDocumentAttachments=Eo,i.initializeDocuments=Go,i.initializeFormIdentifierValues=Oh,i.initializeFormIdentifiers=dh,i.initializeFormRevisionAttachments=jh,i.initializeFormRevisions=Zh,i.initializeFormSubmissionAttachments=Pm,i.initializeFormSubmissions=zm,i.initializeForms=rm,i.initializeGeoImages=Xm,i.initializeIssueAssociations=oy,i.initializeIssueAttachments=My,i.initializeIssueCommentAttachments=Uy,i.initializeIssueComments=ep,i.initializeIssueTypeAttachments=gp,i.initializeIssueTypeFieldValues=eA,i.initializeIssueTypeFieldValuesAttachments=RA,i.initializeIssueTypeFields=yA,i.initializeIssueTypeFieldsAttachments=Up,i.initializeIssueTypeIdentifierValues=tf,i.initializeIssueTypeIdentifiers=LA,i.initializeIssueTypeStatuses=Ef,i.initializeIssueTypes=Af,i.initializeIssueUpdates=Nf,i.initializeIssues=mp,i.initializeOrganizationAccesses=lS,i.initializeOrganizations=bS,i.initializeProjectAccesses=HS,i.initializeProjectAttachments=nT,i.initializeProjectFiles=ST,i.initializeProjects=vT,i.initializeTeamMemberships=YT,i.initializeTeams=rI,i.initializeUsers=xf,i.isImageFile=SO,i.isObjectUrl=Wn,i.isToday=hO,i.issueAssociationReducer=_y,i.issueAssociationSlice=_i,i.issueAttachmentReducer=$y,i.issueAttachmentSlice=gi,i.issueCommentAttachmentReducer=Qy,i.issueCommentAttachmentSlice=Ei,i.issueCommentReducer=op,i.issueCommentSlice=Vi,i.issueReducer=bp,i.issueSlice=zi,i.issueTypeAttachmentReducer=$p,i.issueTypeAttachmentSlice=Di,i.issueTypeFieldValuesAttachmentReducer=CA,i.issueTypeFieldValuesAttachmentSlice=Ni,i.issueTypeFieldValuesReducer=hA,i.issueTypeFieldValuesSlice=Li,i.issueTypeFieldsAttachmentReducer=Qp,i.issueTypeFieldsAttachmentSlice=Ci,i.issueTypeFieldsReducer=gA,i.issueTypeFieldsSlice=ki,i.issueTypeIdentifierReducer=xA,i.issueTypeIdentifierSlice=Ki,i.issueTypeIdentifierValueReducer=yf,i.issueTypeIdentifierValueSlice=Zi,i.issueTypeReducer=Rf,i.issueTypeSlice=Ji,i.issueTypeStatusReducer=Lf,i.issueTypeStatusSlice=Qi,i.issueTypeStatusSortFn=Qn,i.issueUpdateReducer=Xf,i.issueUpdateSlice=tn,i.logOnlyOnce=TO,i.markAsDeleted=LS,i.markForDeletion=QP,i.memoize=Yt,i.organizationAccessReducer=TS,i.organizationAccessSlice=mn,i.organizationReducer=DS,i.organizationSlice=yn,i.outboxReducer=NS,i.outboxSlice=pn,i.overmapEnhancer=OF,i.overmapReducer=mF,i.overmapReducers=FI,i.performRequest=wn,i.performRequestFromAction=zI,i.projectAccessReducer=eT,i.projectAccessSlice=An,i.projectAttachmentReducer=AT,i.projectAttachmentSlice=Sn,i.projectFileReducer=BT,i.projectFileSlice=In,i.projectReducer=kT,i.projectSlice=On,i.rehydratedReducer=WT,i.rehydratedSlice=Pn,i.restructureSelectorWithArgs=A,i.runMiddleware=KI,i.selectAccessToken=yP,i.selectAccessesByUserOfProject=eF,i.selectAccessibleProjects=iF,i.selectActiveOrganizationAccess=YP,i.selectAllDocumentAttachments=ii,i.selectAssetAttachmentById=Aa,i.selectAssetAttachmentMapping=pa,i.selectAssetAttachments=is,i.selectAssetAttachmentsByIds=fa,i.selectAssetById=Vr,i.selectAssetProcedureById=Wc,i.selectAssetProcedureStepById=Tr,i.selectAssetProcedureStepFieldValues=mt,i.selectAssetProcedureStepFieldValuesAttachmentById=Gd,i.selectAssetProcedureStepFieldValuesAttachments=gs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Hd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Nd,i.selectAssetProcedureStepFieldValuesById=ar,i.selectAssetProcedureStepFieldValuesByIds=cr,i.selectAssetProcedureStepFieldValuesMapping=nr,i.selectAssetProcedureStepFieldValuesOfAsset=YO,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=ZO,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=JO,i.selectAssetProcedureStepFields=gt,i.selectAssetProcedureStepFieldsAttachmentById=Td,i.selectAssetProcedureStepFieldsAttachments=Is,i.selectAssetProcedureStepFieldsAttachmentsByIds=Id,i.selectAssetProcedureStepFieldsAttachmentsMapping=Sd,i.selectAssetProcedureStepFieldsById=Vd,i.selectAssetProcedureStepFieldsByIds=vd,i.selectAssetProcedureStepFieldsMapping=Ps,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=HO,i.selectAssetProcedureStepMapping=Mt,i.selectAssetProcedureSteps=ws,i.selectAssetProcedureStepsByIds=Ir,i.selectAssetProcedureStepsMappingOfAssetProcedureType=XO,i.selectAssetProcedureStepsOfAssetProcedureType=QO,i.selectAssetProcedureTypeAttachmentById=Va,i.selectAssetProcedureTypeAttachmentMapping=Ba,i.selectAssetProcedureTypeAttachments=as,i.selectAssetProcedureTypeAttachmentsByIds=va,i.selectAssetProcedureTypeById=cd,i.selectAssetProcedureTypeFieldValues=bt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Sc,i.selectAssetProcedureTypeFieldValuesAttachments=hs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Tc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=fc,i.selectAssetProcedureTypeFieldValuesById=vc,i.selectAssetProcedureTypeFieldValuesByIds=zc,i.selectAssetProcedureTypeFieldValuesMapping=Vc,i.selectAssetProcedureTypeFieldValuesOfAsset=UO,i.selectAssetProcedureTypeFields=Ft,i.selectAssetProcedureTypeFieldsAttachmentById=Wa,i.selectAssetProcedureTypeFieldsAttachments=ds,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Ka,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Ha,i.selectAssetProcedureTypeFieldsById=cc,i.selectAssetProcedureTypeFieldsByIds=dc,i.selectAssetProcedureTypeFieldsMapping=ac,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=$O,i.selectAssetProcedureTypes=Ss,i.selectAssetProcedureTypesByIds=dd,i.selectAssetProcedureTypesMapping=ad,i.selectAssetProcedureTypesOfOrganization=NO,i.selectAssetProcedures=_t,i.selectAssetProceduresByIds=Kc,i.selectAssetProceduresMapping=Gc,i.selectAssetProceduresOfAssetProcedureType=Hc,i.selectAssetProceduresOfAssetType=kO,i.selectAssetStageById=du,i.selectAssetStageCompletionById=Yr,i.selectAssetStageCompletionMapping=Wr,i.selectAssetStageCompletions=Kr,i.selectAssetStageCompletionsByIds=Zr,i.selectAssetStages=qs,i.selectAssetStagesByIds=ru,i.selectAssetStagesMappingOfAssetProcedureType=eP,i.selectAssetStagesOfAssetProcedureType=tP,i.selectAssetTypeAttachmentById=Su,i.selectAssetTypeAttachmentMapping=fu,i.selectAssetTypeAttachments=Us,i.selectAssetTypeAttachmentsByIds=Tu,i.selectAssetTypeById=uo,i.selectAssetTypeFieldValues=wt,i.selectAssetTypeFieldValuesAttachmentById=al,i.selectAssetTypeFieldValuesAttachments=Ks,i.selectAssetTypeFieldValuesAttachmentsByIds=cl,i.selectAssetTypeFieldValuesAttachmentsMapping=nl,i.selectAssetTypeFieldValuesById=Il,i.selectAssetTypeFieldValuesByIds=Ol,i.selectAssetTypeFieldValuesMapping=Tl,i.selectAssetTypeFieldValuesOfAsset=aP,i.selectAssetTypeFields=yt,i.selectAssetTypeFieldsAttachmentById=vu,i.selectAssetTypeFieldsAttachments=ks,i.selectAssetTypeFieldsAttachmentsByIds=zu,i.selectAssetTypeFieldsAttachmentsMapping=Vu,i.selectAssetTypeFieldsById=Ku,i.selectAssetTypeFieldsByIds=Yu,i.selectAssetTypeFieldsMapping=Wu,i.selectAssetTypeFieldsOfAssetType=iP,i.selectAssetTypeIdentifierById=zl,i.selectAssetTypeIdentifierMapping=vl,i.selectAssetTypeIdentifierValueById=Yl,i.selectAssetTypeIdentifierValueMapping=Kl,i.selectAssetTypeIdentifierValues=Et,i.selectAssetTypeIdentifierValuesByIds=Zl,i.selectAssetTypeIdentifierValuesOfAsset=rP,i.selectAssetTypeIdentifierValuesOfIdentifier=uP,i.selectAssetTypeIdentifiers=Js,i.selectAssetTypeIdentifiersByIds=jl,i.selectAssetTypeIdentifiersOfAssetType=dP,i.selectAssetTypeStatusById=Fo,i.selectAssetTypeStatusMapping=Po,i.selectAssetTypeStatuses=ti,i.selectAssetTypeStatusesByIds=bo,i.selectAssetTypeStatusesOfAssetType=oP,i.selectAssetTypeValuesOfAssetType=cP,i.selectAssetTypes=xs,i.selectAssetTypesByIds=lo,i.selectAssetTypesMapping=ro,i.selectAssetTypesOfOrganization=lP,i.selectAssets=Rt,i.selectAssetsByIds=vr,i.selectAssetsMapping=Er,i.selectAssetsOfAssetType=Br,i.selectAssetsOfProject=xO,i.selectAttachmentsOfAsset=Sa,i.selectAttachmentsOfAssetProcedureStepFieldValues=Wd,i.selectAttachmentsOfAssetProcedureStepFields=GO,i.selectAttachmentsOfAssetProcedureType=qO,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Ic,i.selectAttachmentsOfAssetProcedureTypeFields=DO,i.selectAttachmentsOfAssetType=Iu,i.selectAttachmentsOfAssetTypeFieldValues=dl,i.selectAttachmentsOfAssetTypeFields=sP,i.selectAttachmentsOfDocument=AP,i.selectAttachmentsOfFormRevision=_P,i.selectAttachmentsOfFormSubmission=Bm,i.selectAttachmentsOfIssue=jy,i.selectAttachmentsOfIssueComment=vP,i.selectAttachmentsOfIssueType=qP,i.selectAttachmentsOfIssueTypeFieldValues=$A,i.selectAttachmentsOfIssueTypeFields=DP,i.selectAttachmentsOfProject=sF,i.selectCommentsOfIssue=zP,i.selectConversation=jO,i.selectConversationMapping=xt,i.selectConversations=zO,i.selectCurrentUser=dS,i.selectDeletedRequests=JP,i.selectDescendantsOfAssetProcedureStep=Or,i.selectDescendantsOfDocument=sh,i.selectDocumentAttachmentById=Uo,i.selectDocumentAttachmentMapping=Co,i.selectDocumentAttachmentsByIds=Lo,i.selectDocumentById=eh,i.selectDocuments=Vt,i.selectDocumentsByIds=th,i.selectDocumentsMapping=ai,i.selectFieldValuesOfAssetProcedure=LO,i.selectFormById=Tm,i.selectFormIdentifierById=fh,i.selectFormIdentifierMapping=Ah,i.selectFormIdentifierValueById=Bh,i.selectFormIdentifierValueMapping=Eh,i.selectFormIdentifierValues=vt,i.selectFormIdentifierValuesByIds=Vh,i.selectFormIdentifierValuesOfFormSubmission=FP,i.selectFormIdentifierValuesOfIdentifier=bP,i.selectFormIdentifiers=ri,i.selectFormIdentifiersByIds=Sh,i.selectFormIdentifiersOfForm=PP,i.selectFormMapping=Sm,i.selectFormRevisionAttachmentById=Hh,i.selectFormRevisionAttachments=Gh,i.selectFormRevisionAttachmentsByIds=Wh,i.selectFormRevisionAttachmentsMapping=zt,i.selectFormRevisionById=im,i.selectFormRevisionMapping=sm,i.selectFormRevisions=jt,i.selectFormRevisionsByIds=nm,i.selectFormRevisionsOfForm=am,i.selectFormSubmissionAttachemntsByIds=Oi,i.selectFormSubmissionAttachmentById=wm,i.selectFormSubmissionAttachments=Ii,i.selectFormSubmissionAttachmentsByIds=Em,i.selectFormSubmissionAttachmentsMapping=Ti,i.selectFormSubmissionById=km,i.selectFormSubmissions=G,i.selectFormSubmissionsByIds=Nm,i.selectFormSubmissionsMapping=Lm,i.selectFormSubmissionsOfAsset=Km,i.selectFormSubmissionsOfAssets=Ym,i.selectFormSubmissionsOfForm=Gm,i.selectFormSubmissionsOfIssue=Hm,i.selectFormSubmissionsOfIssues=Wm,i.selectFormSubmissionsOfOrganization=RP,i.selectFormSubmissionsOfOrganizationAndForm=BP,i.selectFormSubmissionsOfProject=wP,i.selectFormSubmissionsOfProjectAndForm=EP,i.selectForms=pi,i.selectFormsByIds=Im,i.selectFormsOfOrganization=MP,i.selectGeoImageById=dy,i.selectGeoImageMapping=cy,i.selectGeoImages=bi,i.selectGeoImagesByIds=ry,i.selectGeoImagesOfProject=VP,i.selectIsLoggedIn=pP,i.selectIssueAssociationById=Ty,i.selectIssueAssociationMapping=Sy,i.selectIssueAssociations=dt,i.selectIssueAssociationsByIds=Iy,i.selectIssueAssociationsOfAsset=Fy,i.selectIssueAssociationsOfAssets=by,i.selectIssueAssociationsOfIssue=Py,i.selectIssueAssociationsOfIssues=Oy,i.selectIssueAttachmentById=qy,i.selectIssueAttachmentMapping=zy,i.selectIssueAttachments=wi,i.selectIssueAttachmentsByIds=Dy,i.selectIssueById=Op,i.selectIssueCommentAttachmentById=Jy,i.selectIssueCommentAttachmentMapping=Zy,i.selectIssueCommentAttachments=Bi,i.selectIssueCommentAttachmentsByIds=Xy,i.selectIssueCommentById=up,i.selectIssueCommentMapping=vi,i.selectIssueCommentsByIds=lp,i.selectIssueMapping=Ip,i.selectIssueTypeAttachmentById=qp,i.selectIssueTypeAttachmentMapping=jp,i.selectIssueTypeAttachments=$i,i.selectIssueTypeAttachmentsByIds=Dp,i.selectIssueTypeById=gf,i.selectIssueTypeFieldValues=Dt,i.selectIssueTypeFieldValuesAttachmentById=qA,i.selectIssueTypeFieldValuesAttachments=Wi,i.selectIssueTypeFieldValuesAttachmentsByIds=DA,i.selectIssueTypeFieldValuesAttachmentsMapping=jA,i.selectIssueTypeFieldValuesById=lA,i.selectIssueTypeFieldValuesByIds=oA,i.selectIssueTypeFieldValuesMapping=uA,i.selectIssueTypeFieldValuesOfIssue=$P,i.selectIssueTypeFields=pt,i.selectIssueTypeFieldsAttachmentById=Jp,i.selectIssueTypeFieldsAttachments=Ui,i.selectIssueTypeFieldsAttachmentsByIds=Xp,i.selectIssueTypeFieldsAttachmentsMapping=Zp,i.selectIssueTypeFieldsById=bA,i.selectIssueTypeFieldsByIds=_A,i.selectIssueTypeFieldsMapping=FA,i.selectIssueTypeFieldsOfIssueType=CP,i.selectIssueTypeIdentifierById=XA,i.selectIssueTypeIdentifierMapping=JA,i.selectIssueTypeIdentifierValueById=hf,i.selectIssueTypeIdentifierValueMapping=of,i.selectIssueTypeIdentifierValues=$t,i.selectIssueTypeIdentifierValuesByIds=mf,i.selectIssueTypeIdentifierValuesOfIdentifier=GP,i.selectIssueTypeIdentifierValuesOfIssue=NP,i.selectIssueTypeIdentifiers=Yi,i.selectIssueTypeIdentifiersByIds=QA,i.selectIssueTypeIdentifiersOfIssueType=kP,i.selectIssueTypeMapping=_f,i.selectIssueTypeStatusById=en,i.selectIssueTypeStatusMapping=Cf,i.selectIssueTypeStatuses=xi,i.selectIssueTypeStatusesByIds=Uf,i.selectIssueTypeStatusesOfIssueType=WP,i.selectIssueTypeValuesOfIssueType=LP,i.selectIssueTypes=Xi,i.selectIssueTypesByIds=Mf,i.selectIssueTypesOfOrganization=HP,i.selectIssueUpdateById=Yf,i.selectIssueUpdateMapping=dn,i.selectIssueUpdates=rn,i.selectIssueUpdatesByIds=Zf,i.selectIssueUpdatesOfIssue=Jf,i.selectIssues=qt,i.selectIssuesByIds=Pp,i.selectIssuesOfIssueType=Fp,i.selectIssuesOfProject=jP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=WO,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=CO,i.selectLatestAssetTypeFieldsOfAssetType=nP,i.selectLatestFieldsByAssetProcedureStep=KO,i.selectLatestFormRevisionOfForm=gP,i.selectLatestIssueTypeFieldsOfIssueType=UP,i.selectLatestRetryTime=XP,i.selectMembershipsByUserOfTeam=rF,i.selectOrganizationAccessById=IS,i.selectOrganizationAccessMapping=Lt,i.selectOrganizationAccessUserMapping=PS,i.selectOrganizationAccessesByIds=OS,i.selectOrganizationById=jS,i.selectOrganizationDocuments=SP,i.selectOrganizations=zS,i.selectOrganizationsByIds=qS,i.selectOrganizationsMapping=vS,i.selectProjectAccessById=tT,i.selectProjectAccessMapping=fn,i.selectProjectAccesses=At,i.selectProjectAccessesByIds=sT,i.selectProjectAccessesOfProject=xP,i.selectProjectAttachmentById=yT,i.selectProjectAttachmentMapping=mT,i.selectProjectAttachments=Tn,i.selectProjectAttachmentsByIds=pT,i.selectProjectById=GT,i.selectProjectDocuments=fP,i.selectProjectFileById=wT,i.selectProjectFileMapping=MT,i.selectProjectFiles=RT,i.selectProjectFilesByIds=ET,i.selectProjectMapping=NT,i.selectProjects=kt,i.selectProjectsByIds=HT,i.selectProjectsOfOrganization=nF,i.selectRehydrated=dF,i.selectStageMapping=js,i.selectTeamById=SI,i.selectTeamMembershipById=aI,i.selectTeamMemberships=Nt,i.selectTeamMembershipsByIds=cI,i.selectTeamMembershipsMapping=nI,i.selectTeams=_n,i.selectTeamsByIds=TI,i.selectTeamsMapping=fI,i.selectTeamsOfOrganization=lF,i.selectUploadUrl=OP,i.selectUserById=Ut,i.selectUsers=Ct,i.selectUsersByIds=rS,i.selectUsersMapping=hn,i.selectUsersOfOrganization=ZP,i.selectUsersOfProject=tF,i.selectUsersOfTeam=uF,i.setAsset=Rr,i.setAssetAttachment=la,i.setAssetAttachments=oa,i.setAssetProcedure=Lc,i.setAssetProcedureStep=lr,i.setAssetProcedureStepFieldValues=Qd,i.setAssetProcedureStepFieldValuesAttachment=$d,i.setAssetProcedureStepFieldValuesAttachments=Cd,i.setAssetProcedureStepFieldValuesMany=xd,i.setAssetProcedureStepFields=gd,i.setAssetProcedureStepFieldsAttachment=hd,i.setAssetProcedureStepFieldsAttachments=md,i.setAssetProcedureStepFieldsMany=Md,i.setAssetProcedureSteps=or,i.setAssetProcedureType=sd,i.setAssetProcedureTypeAttachment=ba,i.setAssetProcedureTypeAttachments=_a,i.setAssetProcedureTypeFieldValues=_c,i.setAssetProcedureTypeFieldValuesAttachment=oc,i.setAssetProcedureTypeFieldValuesAttachments=hc,i.setAssetProcedureTypeFieldValuesMany=gc,i.setAssetProcedureTypeFields=Qa,i.setAssetProcedureTypeFieldsAttachment=$a,i.setAssetProcedureTypeFieldsAttachments=Ca,i.setAssetProcedureTypeFieldsMany=xa,i.setAssetProcedureTypes=id,i.setAssetProcedures=kc,i.setAssetStage=Qr,i.setAssetStageCompletion=Cr,i.setAssetStageCompletions=Ur,i.setAssetStages=xr,i.setAssetType=xl,i.setAssetTypeAttachment=hu,i.setAssetTypeAttachments=mu,i.setAssetTypeFieldValues=ml,i.setAssetTypeFieldValuesAttachment=xu,i.setAssetTypeFieldValuesAttachments=el,i.setAssetTypeFieldValuesMany=yl,i.setAssetTypeFields=Uu,i.setAssetTypeFieldsAttachment=gu,i.setAssetTypeFieldsAttachments=Mu,i.setAssetTypeFieldsMany=Lu,i.setAssetTypeIdentifier=Ml,i.setAssetTypeIdentifierValue=Ll,i.setAssetTypeIdentifierValues=kl,i.setAssetTypeIdentifiers=Rl,i.setAssetTypeStatus=Ao,i.setAssetTypeStatuses=fo,i.setAssetTypes=eo,i.setAssets=wr,i.setClientSDK=kI,i.setClientStore=UI,i.setConversation=na,i.setConversations=EO,i.setCurrentUser=KP,i.setDocument=Ko,i.setDocumentAttachment=vo,i.setDocumentAttachments=zo,i.setDocuments=Yo,i.setForm=om,i.setFormIdentifier=lh,i.setFormIdentifierValue=bh,i.setFormIdentifierValues=_h,i.setFormIdentifiers=oh,i.setFormRevision=Xh,i.setFormRevisionAttachment=$h,i.setFormRevisionAttachments=Ch,i.setFormRevisions=Qh,i.setFormSubmission=jm,i.setFormSubmissionAttachment=bm,i.setFormSubmissionAttachments=_m,i.setFormSubmissions=qm,i.setForms=hm,i.setGeoImage=Qm,i.setGeoImages=xm,i.setIssue=pp,i.setIssueAssociation=my,i.setIssueAssociations=hy,i.setIssueAttachment=wy,i.setIssueAttachments=Ey,i.setIssueComment=ip,i.setIssueCommentAttachment=Ny,i.setIssueCommentAttachments=Gy,i.setIssueComments=np,i.setIssueType=Tf,i.setIssueTypeAttachment=wp,i.setIssueTypeAttachments=Ep,i.setIssueTypeFieldValues=iA,i.setIssueTypeFieldValuesAttachment=EA,i.setIssueTypeFieldValuesAttachments=BA,i.setIssueTypeFieldValuesMany=nA,i.setIssueTypeFields=fA,i.setIssueTypeFieldsAttachment=Np,i.setIssueTypeFieldsAttachments=Gp,i.setIssueTypeFieldsMany=SA,i.setIssueTypeIdentifier=GA,i.setIssueTypeIdentifierValue=af,i.setIssueTypeIdentifierValues=cf,i.setIssueTypeIdentifiers=HA,i.setIssueTypeStatus=vf,i.setIssueTypeStatuses=zf,i.setIssueTypes=If,i.setIssueUpdate=Gf,i.setIssueUpdates=Hf,i.setIssues=Ap,i.setLoggedIn=Mo,i.setOrganization=gS,i.setOrganizationAccess=mS,i.setOrganizationAccesses=yS,i.setOrganizations=_S,i.setProject=jT,i.setProjectAccess=YS,i.setProjectAccesses=ZS,i.setProjectAttachment=dT,i.setProjectAttachments=rT,i.setProjectFile=TT,i.setProjectFiles=IT,i.setProjects=zT,i.setRehydrated=cF,i.setTeam=oI,i.setTeamMembership=XT,i.setTeamMemberships=QT,i.setTeams=hI,i.setTokens=hP,i.setUploadUrl=IP,i.setUser=tS,i.setUsers=eS,i.shallowEqual=rO,i.slugify=FO,i.spacesToDashesLower=PO,i.submittedAtModelSortFn=Xt,i.teamMembershipReducer=iI,i.teamMembershipSlice=Fn,i.teamReducer=II,i.teamSlice=bn,i.toFileNameSafeString=OO,i.toUuidArray=B,i.toUuidIdRecord=IO,i.truncate=bO,i.updateAsset=_r,i.updateAssetAttachment=ha,i.updateAssetAttachments=ma,i.updateAssetProcedure=$c,i.updateAssetProcedureStep=yr,i.updateAssetProcedureStepFieldValues=er,i.updateAssetProcedureStepFieldValuesAttachment=Ud,i.updateAssetProcedureStepFieldValuesAttachments=Ld,i.updateAssetProcedureStepFieldValuesMany=tr,i.updateAssetProcedureStepFields=Rd,i.updateAssetProcedureStepFieldsAttachment=yd,i.updateAssetProcedureStepFieldsAttachments=pd,i.updateAssetProcedureStepFieldsMany=wd,i.updateAssetProcedureSteps=pr,i.updateAssetProcedureType=Qc,i.updateAssetProcedureTypeAttachment=ga,i.updateAssetProcedureTypeAttachments=Ma,i.updateAssetProcedureTypeFieldValues=Mc,i.updateAssetProcedureTypeFieldValuesAttachment=mc,i.updateAssetProcedureTypeFieldValuesAttachments=yc,i.updateAssetProcedureTypeFieldValuesMany=Rc,i.updateAssetProcedureTypeFields=ec,i.updateAssetProcedureTypeFieldsAttachment=Ua,i.updateAssetProcedureTypeFieldsAttachments=La,i.updateAssetProcedureTypeFieldsMany=tc,i.updateAssetProcedureTypes=xc,i.updateAssetProcedures=Cc,i.updateAssetStage=su,i.updateAssetStageCompletion=Lr,i.updateAssetStageCompletions=kr,i.updateAssetStages=iu,i.updateAssetType=io,i.updateAssetTypeAttachment=yu,i.updateAssetTypeAttachments=pu,i.updateAssetTypeFieldValues=pl,i.updateAssetTypeFieldValuesAttachment=tl,i.updateAssetTypeFieldValuesAttachments=sl,i.updateAssetTypeFieldValuesMany=Al,i.updateAssetTypeFields=ku,i.updateAssetTypeFieldsAttachment=Ru,i.updateAssetTypeFieldsAttachments=wu,i.updateAssetTypeFieldsMany=Nu,i.updateAssetTypeIdentifier=wl,i.updateAssetTypeIdentifierValue=Nl,i.updateAssetTypeIdentifierValues=Gl,i.updateAssetTypeIdentifiers=El,i.updateAssetTypeStatus=So,i.updateAssetTypeStatuses=To,i.updateAssetTypes=no,i.updateAssets=gr,i.updateConversation=aa,i.updateConversations=BO,i.updateDocument=Zo,i.updateDocumentAttachment=jo,i.updateDocumentAttachments=qo,i.updateDocuments=Jo,i.updateForm=mm,i.updateFormIdentifier=hh,i.updateFormIdentifierValue=gh,i.updateFormIdentifierValues=Mh,i.updateFormIdentifiers=mh,i.updateFormRevision=xh,i.updateFormRevisionAttachment=Uh,i.updateFormRevisionAttachments=Lh,i.updateFormRevisions=em,i.updateFormSubmission=$m,i.updateFormSubmissionAttachment=gm,i.updateFormSubmissionAttachments=Mm,i.updateFormSubmissions=Cm,i.updateForms=ym,i.updateGeoImage=sy,i.updateGeoImages=iy,i.updateIssue=fp,i.updateIssueAssociation=yy,i.updateIssueAssociations=py,i.updateIssueAttachment=By,i.updateIssueAttachments=Vy,i.updateIssueComment=ap,i.updateIssueCommentAttachment=Hy,i.updateIssueCommentAttachments=Wy,i.updateIssueComments=cp,i.updateIssueType=Of,i.updateIssueTypeAttachment=Bp,i.updateIssueTypeAttachments=Vp,i.updateIssueTypeFieldValues=aA,i.updateIssueTypeFieldValuesAttachment=VA,i.updateIssueTypeFieldValuesAttachments=vA,i.updateIssueTypeFieldValuesMany=cA,i.updateIssueTypeFields=TA,i.updateIssueTypeFieldsAttachment=Hp,i.updateIssueTypeFieldsAttachments=Wp,i.updateIssueTypeFieldsMany=IA,i.updateIssueTypeIdentifier=WA,i.updateIssueTypeIdentifierValue=df,i.updateIssueTypeIdentifierValues=rf,i.updateIssueTypeIdentifiers=KA,i.updateIssueTypeStatus=jf,i.updateIssueTypeStatuses=qf,i.updateIssueTypes=Pf,i.updateIssueUpdate=Wf,i.updateIssueUpdates=Kf,i.updateIssues=Sp,i.updateOrganization=ES,i.updateOrganizationAccess=pS,i.updateOrganizationAccesses=AS,i.updateOrganizations=wS,i.updateProject=CT,i.updateProjectAccess=JS,i.updateProjectAccesses=XS,i.updateProjectAttachment=uT,i.updateProjectAttachments=lT,i.updateProjectFile=FT,i.updateProjectFiles=bT,i.updateProjects=$T,i.updateTeam=mI,i.updateTeamMembership=xT,i.updateTeamMemberships=eI,i.updateTeams=yI,i.updateUser=nS,i.updateUsers=iS,i.useSelectorBuilder=dO,i.userReducer=cS,i.userSlice=un,i.uuidObj=P,i.uuidObjSortFn=Jt,i.uuidSortFn=Pt,i.versioningReducer=PI,i.versioningSlice=OI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|