@overmap-ai/core 1.0.78-bulk-update.15 → 1.0.78-bulk-update.16

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.
@@ -5126,19 +5126,15 @@ class Gg extends k {
5126
5126
  }), d = [];
5127
5127
  let c = null;
5128
5128
  for (const u of o) {
5129
- const { batchId: p, payload: y } = u, f = y.assets.map(({ uuid: v }) => v), T = y.assets.map(({ asset_type: v }) => v), b = y.assets.map(({ project: v }) => v), I = T.concat(b);
5130
- c && I.push(c);
5131
- const P = f;
5132
- P.push(p);
5133
- const g = this.enqueueRequest({
5129
+ const { batchId: p, payload: y } = u, f = y.assets.map(({ uuid: g }) => g), T = y.assets.map(({ asset_type: g }) => g), b = y.assets.map(({ project: g }) => g), I = y.assets.map(({ status: g }) => g), P = this.enqueueRequest({
5134
5130
  description: O(l.POST, this.name, !0),
5135
5131
  method: l.POST,
5136
5132
  url: `${this.url}/bulk/`,
5137
5133
  payload: y,
5138
- blockers: I,
5139
- blocks: P
5134
+ blockers: (c ? [c] : []).concat(T).concat(b).concat(I),
5135
+ blocks: [p].concat(f)
5140
5136
  });
5141
- c = u.batchId, d.push(g);
5137
+ c = u.batchId, d.push(P);
5142
5138
  }
5143
5139
  return Promise.all(d).then((u) => {
5144
5140
  const p = u.flat();
@@ -5171,8 +5167,8 @@ class Gg extends k {
5171
5167
  payload: {
5172
5168
  payloads: f
5173
5169
  },
5174
- blockers: b.concat(I).concat(y ? [y] : []),
5175
- blocks: b.concat([T])
5170
+ blockers: (y ? [y] : []).concat(b).concat(I),
5171
+ blocks: [T].concat(b)
5176
5172
  });
5177
5173
  p.push(P), y = T;
5178
5174
  }
@@ -8074,8 +8070,8 @@ class b_ extends k {
8074
8070
  payload: {
8075
8071
  payloads: f
8076
8072
  },
8077
- blockers: b.concat(I).concat(P).concat(y ? [y] : []),
8078
- blocks: b.concat([T])
8073
+ blockers: (y ? [y] : []).concat(b).concat(I).concat(P),
8074
+ blocks: [T].concat(b)
8079
8075
  });
8080
8076
  p.push(g), y = T;
8081
8077
  }
@@ -9943,8 +9939,8 @@ class nt {
9943
9939
  if (this.graph.addNode(s.payload.uuid, s), !(s.payload.blockers.length === 0 || this.graph.size() === 1))
9944
9940
  for (const e of this.graph.overallOrder()) {
9945
9941
  if (e === s.payload.uuid) continue;
9946
- const i = this.graph.getNodeData(e);
9947
- s.payload.blockers.some((n) => i.payload.blocks.includes(n)) && this._addDependency(s.payload.uuid, e);
9942
+ const i = this.graph.getNodeData(e), n = new Set(i.payload.blocks);
9943
+ s.payload.blockers.some((a) => n.has(a)) && this._addDependency(s.payload.uuid, e);
9948
9944
  }
9949
9945
  }
9950
9946
  /**
@@ -9958,7 +9954,8 @@ class nt {
9958
9954
  this.graph.addNode(s.payload.uuid, s);
9959
9955
  for (const e of this.graph.overallOrder()) {
9960
9956
  if (e === s.payload.uuid) continue;
9961
- this.graph.getNodeData(e).payload.blockers.some((n) => s.payload.blocks.includes(n)) && this._addDependency(e, s.payload.uuid);
9957
+ const i = this.graph.getNodeData(e), n = new Set(i.payload.blocks);
9958
+ i.payload.blockers.some((a) => n.has(a)) && this._addDependency(e, s.payload.uuid);
9962
9959
  }
9963
9960
  }
9964
9961
  /**
@@ -5,11 +5,11 @@ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
5
5
  Action:`,s);const p=tt();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const u=tt();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function QF(t,s,e){var n;return(n=tt())==null?void 0:n.peek()}function xF(t,s){return dt().dispatch(AT(new Date().getTime())),Jn}const nt="An unknown error occurred",eg=500,mO=["non_field_errors","detail"];function tg(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"?mO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?mO.includes(a)?c.join(`
6
6
  `):c.map(r=>`${a}: ${r}`).join(`
7
7
  `):`${a}: ${JSON.stringify(c)}`).join(`
8
- `)}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>eg?nt:e}class U extends Error{constructor(e){super(nt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??tg(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function yO(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 sg extends nO{constructor(s){super(s)}}class et extends nO{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class ig extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(la(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ha(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(oa(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(ua(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);y(this,"pageSize",sO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],h=[],p={};for(const I of e){const{modelUuid:F,file:P}=I,g=await this.client.files.getFilePayload(P);g.sha1 in p||(p[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),h.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:F})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(F)}).catch(()=>{this.dispatch(r(d.map(I=>this.getId(I))))}),[d,A.then(({attachments:I})=>I)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class ng extends Xe{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:Aa,addMany:Qt,setOne:fa,setMany:Sa,updateOne:Ta,updateMany:Ia,deleteOne:Oa,deleteMany:xt,initialize:pa});y(this,"selectors",{selectById:Fa,selectByIds:ga})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class ag extends Xe{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:wa,addMany:Ea,setOne:va,setMany:Va,updateOne:za,updateMany:Ba,deleteOne:ja,deleteMany:qa,initialize:Ra});y(this,"selectors",{selectById:$a,selectByIds:Ua})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 cg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Na,addMany:Ga,setOne:Ha,setMany:Wa,updateOne:Ka,updateMany:Ya,deleteOne:Za,deleteMany:Ja,initialize:ka});y(this,"selectors",{selectById:xa,selectByIds:ec})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 dg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:ic,addMany:nc,setOne:ac,setMany:cc,updateOne:dc,updateMany:rc,deleteOne:uc,deleteMany:lc,initialize:sc});y(this,"selectors",{selectById:mc,selectByIds:yc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}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}class rg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:fc,addMany:ds,setOne:Sc,setMany:Tc,updateOne:Ic,updateMany:Oc,deleteOne:Pc,deleteMany:rs,initialize:Ac});y(this,"selectors",{selectById:bc,selectByIds:_c})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class ug extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:Ec,addMany:vc,setOne:Vc,setMany:zc,updateOne:Bc,updateMany:jc,deleteOne:qc,deleteMany:Dc,initialize:wc});y(this,"selectors",{selectById:Uc,selectByIds:Lc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(c,Math.min(n??c.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:a,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Mc(e)(l);this.dispatch(a(e)),this.dispatch(rs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ds(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class lg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Gc,addMany:hs,setOne:Yc,setMany:Zc,updateOne:Hc,updateMany:Wc,deleteOne:Kc,deleteMany:ms,initialize:Nc});y(this,"selectors",{selectById:xc,selectByIds:ed})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class og extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:id,addMany:nd,setOne:ud,setMany:ld,updateOne:ad,updateMany:cd,deleteOne:dd,deleteMany:rd,initialize:sd});y(this,"selectors",{selectById:md,selectByIds:yd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Qc(e)(l);this.dispatch(a(e)),this.dispatch(ms(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(hs(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class hg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:fd,addMany:Sd,setOne:Td,setMany:Id,updateOne:Od,updateMany:Pd,deleteOne:Fd,deleteMany:gd,initialize:Ad});y(this,"selectors",{selectById:_d,selectByIds:Md})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 mg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:vd,addMany:Vd,setOne:zd,setMany:Bd,updateOne:jd,updateMany:qd,deleteOne:Dd,deleteMany:Cd,initialize:Ed});y(this,"selectors",{selectById:$d,selectByIds:Ud})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Gd,addMany:Os,setOne:Hd,setMany:Wd,updateOne:Kd,updateMany:Yd,deleteOne:Zd,deleteMany:Ps,initialize:Nd});y(this,"selectors",{selectById:Xd,selectByIds:Qd})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class pg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:ir,addMany:nr,setOne:ar,setMany:cr,updateOne:dr,updateMany:rr,deleteOne:ur,deleteMany:lr,initialize:sr});y(this,"selectors",{selectById:hr,selectByIds:mr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(a,Math.min(n??a.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,asset_procedure_step:b.asset_procedure_step,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:c,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=xd(e)(l);this.dispatch(a(e)),this.dispatch(Ps(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Os(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Ag extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Tr,addMany:Ir,setOne:fr,setMany:Sr,updateOne:Or,updateMany:Pr,deleteOne:Fr,deleteMany:gr,initialize:Ar});y(this,"selectors",{selectById:_r,selectByIds:Mr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=Rr(e)(d);this.dispatch(l(e)),this.dispatch(a(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:vr,addMany:Rs,setOne:jr,setMany:qr,updateOne:Vr,updateMany:zr,deleteOne:Br,deleteMany:ws,initialize:Er});y(this,"selectors",{selectById:$r,selectByIds:Ur})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=ba(e)(l),h=Qy(e)(l);this.dispatch(c(e)),this.dispatch(xt(D(d))),this.dispatch(vt(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(u)),this.dispatch(Qt(d)),this.dispatch(Et(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,Math.min(n??e.length,k)).map(h=>{const p=h.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:p}}}),u=[];let d=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(({uuid:E})=>E),I=A.assets.map(({asset_type:E})=>E),F=A.assets.map(({project:E})=>E),P=I.concat(F);d&&P.push(d);const g=f;g.push(p);const b=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:P,blocks:g});d=h.batchId,u.push(b)}return Promise.all(u).then(h=>{const p=h.flat();this.dispatch(a(p))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(A?[A]:[]),blocks:F.concat([I])});p.push(g),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Sg extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Gr,addMany:Hr,setOne:Wr,setMany:Kr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Xr,initialize:Nr});y(this,"selectors",{selectById:tu,selectByIds:su})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(I=>M(I)),h=d.map(I=>({...I,created_by:u,submitted_at:l})),p=h.map(({uuid:I})=>I);this.dispatch(a(h));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(I=>I.asset_procedure),...e.map(I=>I.asset_stage),...e.map(I=>I.asset)],blocks:p});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Tg extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:du,addMany:ru,setOne:au,setMany:cu,updateOne:uu,updateMany:lu,deleteOne:ou,deleteMany:hu,initialize:nu});y(this,"selectors",{selectById:yu,selectByIds:pu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 Ig extends Xe{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Su,addMany:js,setOne:Tu,setMany:Iu,updateOne:Ou,updateMany:Pu,deleteOne:Fu,deleteMany:qs,initialize:fu});y(this,"selectors",{selectById:bu,selectByIds:_u})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 Og extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:vu,addMany:Vu,setOne:zu,setMany:Bu,updateOne:ju,updateMany:qu,deleteOne:Du,deleteMany:Cu,initialize:Eu});y(this,"selectors",{selectById:Uu,selectByIds:Lu})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 Pg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Hu,addMany:Wu,setOne:Ku,setMany:Yu,updateOne:Zu,updateMany:Ju,deleteOne:Xu,deleteMany:Qu,initialize:Gu});y(this,"selectors",{selectById:el,selectByIds:tl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Fg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:al,addMany:ks,setOne:cl,setMany:dl,updateOne:rl,updateMany:ul,deleteOne:ll,deleteMany:Ns,initialize:nl});y(this,"selectors",{selectById:hl,selectByIds:ml})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class gg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Sl,addMany:Tl,setOne:Il,setMany:Ol,updateOne:Pl,updateMany:Fl,deleteOne:gl,deleteMany:bl,initialize:fl});y(this,"selectors",{selectById:Ml,selectByIds:Rl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=[],p=Qe(a,Math.min(n??a.length,k)),A=[];for(const F of p){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});h.push(b),P.push({uuid:b.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:b.values})}A.push({submitted_at:d,values:c,field_values:P})}this.dispatch(r(h));const f=[];for(const F of A){const{field_values:P}=F,g=P.map(({asset:z})=>z),b=P.map(({fields_revision:z})=>z),E=P.map(({uuid:z})=>z),B=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:F,blockers:g.concat(b),blocks:E});f.push(B)}return Promise.all(f).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(D(h)))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=yl(e)(l);this.dispatch(a(e)),this.dispatch(Ns(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ks(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class bg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:Vl,addMany:zl,setOne:Bl,setMany:jl,updateOne:ql,updateMany:Dl,deleteOne:Cl,deleteMany:$l,initialize:vl});y(this,"selectors",{selectById:Ll,selectByIds:kl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 _g extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Wl,addMany:Kl,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:xl,initialize:Hl});y(this,"selectors",{selectById:to,selectByIds:so})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Mg extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:uo,addMany:lo,setOne:co,setMany:ro,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:yo,initialize:ao});y(this,"selectors",{selectById:Ao,selectByIds:fo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=Cr(e)(l),h=Mu(e)(l);this.dispatch(a(e)),this.dispatch(ws(D(d))),this.dispatch(qs(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Rs(d)),this.dispatch(js(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:Oo,addMany:Po,setOne:Fo,setMany:go,updateOne:bo,updateMany:_o,deleteOne:Mo,deleteMany:Ro,initialize:Io});y(this,"selectors",{selectById:Eo,selectByIds:vo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 wg extends v{constructor(){super(...arguments);y(this,"name","Category");y(this,"url","/categories");y(this,"actions",{addOne:Co,addMany:$o,setOne:Uo,setMany:Lo,updateOne:ko,updateMany:No,deleteOne:Go,deleteMany:Ho,initialize:Do});y(this,"selectors",{selectById:ti,selectByIds:Ko})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 Eg extends Xe{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Xo,addMany:Qo,setOne:xo,setMany:eh,updateOne:th,updateMany:sh,deleteOne:ih,deleteMany:nh,initialize:Jo});y(this,"selectors",{selectById:ch,selectByIds:dh})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=new Date().toISOString(),d=[],h=[],p={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in p||(p[b.sha1]=b,A[b.sha1]=[]);const E=this.buildModel({file:g,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:P});d.push(E),h.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(F=>F.uuid),blockers:d.map(F=>F.file_sha1)});return f.then(({attachments:F,presigned_urls:P})=>{this.dispatch(c(F));const g=this.client.files.processPresignedUrls(P);for(const[b,E]of Object.entries(g))E.then(()=>{const B=A[b];for(const z of B)this.makeReadable(z)})}).catch(()=>{this.dispatch(r(d.map(F=>F.uuid)))}),[d,f.then(({attachments:F})=>F)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class vg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:oh,addMany:hh,setOne:mh,setMany:yh,updateOne:ph,updateMany:Ah,deleteOne:fh,deleteMany:Sh,initialize:lh});y(this,"selectors",{selectById:Ih,selectByIds:Oh})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=Ph(e)(d);this.dispatch(a(e)),this.dispatch(l(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(r(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class at extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Vg extends at{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:bh,addMany:_h,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:Eh,deleteOne:vh,deleteMany:Vh,initialize:gh});y(this,"selectors",{selectById:Bh,selectByIds:jh})}async add(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class zg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const Ut={},qn=new Set;let Lt=0,Dn=0,Cn=0;const Bg=20;class jg extends et{constructor(){super(...arguments);y(this,"host");y(this,"_dbPromise",VO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Kt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:m.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await it(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch($h({sha1:e,...c})),c}async addCache(e,n){if(qn.has(n))return;if(!e.type){const r=e.name.split("."),l=r[r.length-1];e=new File([e],e.name,{type:l})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),Lt++):(await a.put("files",e,n),Dn++),qn.add(n),Cn++,Cn%Bg===0&&console.debug(`File cache summary: ${Lt} hits and ${Dn} misses, ${Lt/(Lt+Dn)*100}% hit rate over ${Cn} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),qn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Uh(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Kt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const h=await xn(e),p=new File([h],a??n,{type:h.type});return await this.addCache(p,n),p}let l=Ut[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(p=>{const A=new File([p],a??n,{type:p.type});h(A)})}),Ut[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof U&&delete Ut[c],h}if(u){const h=await it(d);if(h!==n){const f=`The hash of the file returned from the server (${h}) does not match the
8
+ `)}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>eg?nt:e}class U extends Error{constructor(e){super(nt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??tg(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function yO(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 sg extends nO{constructor(s){super(s)}}class et extends nO{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class ig extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(la(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ha(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(oa(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(ua(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);y(this,"pageSize",sO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],h=[],p={};for(const I of e){const{modelUuid:F,file:P}=I,g=await this.client.files.getFilePayload(P);g.sha1 in p||(p[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),h.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:F})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(F)}).catch(()=>{this.dispatch(r(d.map(I=>this.getId(I))))}),[d,A.then(({attachments:I})=>I)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class ng extends Xe{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:Aa,addMany:Qt,setOne:fa,setMany:Sa,updateOne:Ta,updateMany:Ia,deleteOne:Oa,deleteMany:xt,initialize:pa});y(this,"selectors",{selectById:Fa,selectByIds:ga})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class ag extends Xe{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:wa,addMany:Ea,setOne:va,setMany:Va,updateOne:za,updateMany:Ba,deleteOne:ja,deleteMany:qa,initialize:Ra});y(this,"selectors",{selectById:$a,selectByIds:Ua})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 cg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Na,addMany:Ga,setOne:Ha,setMany:Wa,updateOne:Ka,updateMany:Ya,deleteOne:Za,deleteMany:Ja,initialize:ka});y(this,"selectors",{selectById:xa,selectByIds:ec})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 dg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:ic,addMany:nc,setOne:ac,setMany:cc,updateOne:dc,updateMany:rc,deleteOne:uc,deleteMany:lc,initialize:sc});y(this,"selectors",{selectById:mc,selectByIds:yc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}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}class rg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:fc,addMany:ds,setOne:Sc,setMany:Tc,updateOne:Ic,updateMany:Oc,deleteOne:Pc,deleteMany:rs,initialize:Ac});y(this,"selectors",{selectById:bc,selectByIds:_c})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class ug extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:Ec,addMany:vc,setOne:Vc,setMany:zc,updateOne:Bc,updateMany:jc,deleteOne:qc,deleteMany:Dc,initialize:wc});y(this,"selectors",{selectById:Uc,selectByIds:Lc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(c,Math.min(n??c.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:a,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Mc(e)(l);this.dispatch(a(e)),this.dispatch(rs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ds(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class lg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Gc,addMany:hs,setOne:Yc,setMany:Zc,updateOne:Hc,updateMany:Wc,deleteOne:Kc,deleteMany:ms,initialize:Nc});y(this,"selectors",{selectById:xc,selectByIds:ed})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class og extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:id,addMany:nd,setOne:ud,setMany:ld,updateOne:ad,updateMany:cd,deleteOne:dd,deleteMany:rd,initialize:sd});y(this,"selectors",{selectById:md,selectByIds:yd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Qc(e)(l);this.dispatch(a(e)),this.dispatch(ms(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(hs(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class hg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:fd,addMany:Sd,setOne:Td,setMany:Id,updateOne:Od,updateMany:Pd,deleteOne:Fd,deleteMany:gd,initialize:Ad});y(this,"selectors",{selectById:_d,selectByIds:Md})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 mg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:vd,addMany:Vd,setOne:zd,setMany:Bd,updateOne:jd,updateMany:qd,deleteOne:Dd,deleteMany:Cd,initialize:Ed});y(this,"selectors",{selectById:$d,selectByIds:Ud})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Gd,addMany:Os,setOne:Hd,setMany:Wd,updateOne:Kd,updateMany:Yd,deleteOne:Zd,deleteMany:Ps,initialize:Nd});y(this,"selectors",{selectById:Xd,selectByIds:Qd})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class pg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:ir,addMany:nr,setOne:ar,setMany:cr,updateOne:dr,updateMany:rr,deleteOne:ur,deleteMany:lr,initialize:sr});y(this,"selectors",{selectById:hr,selectByIds:mr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(a,Math.min(n??a.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,asset_procedure_step:b.asset_procedure_step,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:c,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=xd(e)(l);this.dispatch(a(e)),this.dispatch(Ps(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Os(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Ag extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Tr,addMany:Ir,setOne:fr,setMany:Sr,updateOne:Or,updateMany:Pr,deleteOne:Fr,deleteMany:gr,initialize:Ar});y(this,"selectors",{selectById:_r,selectByIds:Mr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=Rr(e)(d);this.dispatch(l(e)),this.dispatch(a(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:vr,addMany:Rs,setOne:jr,setMany:qr,updateOne:Vr,updateMany:zr,deleteOne:Br,deleteMany:ws,initialize:Er});y(this,"selectors",{selectById:$r,selectByIds:Ur})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=ba(e)(l),h=Qy(e)(l);this.dispatch(c(e)),this.dispatch(xt(D(d))),this.dispatch(vt(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(u)),this.dispatch(Qt(d)),this.dispatch(Et(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,Math.min(n??e.length,k)).map(h=>{const p=h.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:p}}}),u=[];let d=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(({uuid:b})=>b),I=A.assets.map(({asset_type:b})=>b),F=A.assets.map(({project:b})=>b),P=A.assets.map(({status:b})=>b),g=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:(d?[d]:[]).concat(I).concat(F).concat(P),blocks:[p].concat(f)});d=h.batchId,u.push(g)}return Promise.all(u).then(h=>{const p=h.flat();this.dispatch(a(p))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:(A?[A]:[]).concat(F).concat(P),blocks:[I].concat(F)});p.push(g),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Sg extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Gr,addMany:Hr,setOne:Wr,setMany:Kr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Xr,initialize:Nr});y(this,"selectors",{selectById:tu,selectByIds:su})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(I=>M(I)),h=d.map(I=>({...I,created_by:u,submitted_at:l})),p=h.map(({uuid:I})=>I);this.dispatch(a(h));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(I=>I.asset_procedure),...e.map(I=>I.asset_stage),...e.map(I=>I.asset)],blocks:p});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Tg extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:du,addMany:ru,setOne:au,setMany:cu,updateOne:uu,updateMany:lu,deleteOne:ou,deleteMany:hu,initialize:nu});y(this,"selectors",{selectById:yu,selectByIds:pu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 Ig extends Xe{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Su,addMany:js,setOne:Tu,setMany:Iu,updateOne:Ou,updateMany:Pu,deleteOne:Fu,deleteMany:qs,initialize:fu});y(this,"selectors",{selectById:bu,selectByIds:_u})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 Og extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:vu,addMany:Vu,setOne:zu,setMany:Bu,updateOne:ju,updateMany:qu,deleteOne:Du,deleteMany:Cu,initialize:Eu});y(this,"selectors",{selectById:Uu,selectByIds:Lu})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 Pg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Hu,addMany:Wu,setOne:Ku,setMany:Yu,updateOne:Zu,updateMany:Ju,deleteOne:Xu,deleteMany:Qu,initialize:Gu});y(this,"selectors",{selectById:el,selectByIds:tl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Fg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:al,addMany:ks,setOne:cl,setMany:dl,updateOne:rl,updateMany:ul,deleteOne:ll,deleteMany:Ns,initialize:nl});y(this,"selectors",{selectById:hl,selectByIds:ml})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class gg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Sl,addMany:Tl,setOne:Il,setMany:Ol,updateOne:Pl,updateMany:Fl,deleteOne:gl,deleteMany:bl,initialize:fl});y(this,"selectors",{selectById:Ml,selectByIds:Rl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=[],p=Qe(a,Math.min(n??a.length,k)),A=[];for(const F of p){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});h.push(b),P.push({uuid:b.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:b.values})}A.push({submitted_at:d,values:c,field_values:P})}this.dispatch(r(h));const f=[];for(const F of A){const{field_values:P}=F,g=P.map(({asset:z})=>z),b=P.map(({fields_revision:z})=>z),E=P.map(({uuid:z})=>z),B=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:F,blockers:g.concat(b),blocks:E});f.push(B)}return Promise.all(f).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(D(h)))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=yl(e)(l);this.dispatch(a(e)),this.dispatch(Ns(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ks(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class bg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:Vl,addMany:zl,setOne:Bl,setMany:jl,updateOne:ql,updateMany:Dl,deleteOne:Cl,deleteMany:$l,initialize:vl});y(this,"selectors",{selectById:Ll,selectByIds:kl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 _g extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Wl,addMany:Kl,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:xl,initialize:Hl});y(this,"selectors",{selectById:to,selectByIds:so})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Mg extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:uo,addMany:lo,setOne:co,setMany:ro,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:yo,initialize:ao});y(this,"selectors",{selectById:Ao,selectByIds:fo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=Cr(e)(l),h=Mu(e)(l);this.dispatch(a(e)),this.dispatch(ws(D(d))),this.dispatch(qs(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Rs(d)),this.dispatch(js(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:Oo,addMany:Po,setOne:Fo,setMany:go,updateOne:bo,updateMany:_o,deleteOne:Mo,deleteMany:Ro,initialize:Io});y(this,"selectors",{selectById:Eo,selectByIds:vo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 wg extends v{constructor(){super(...arguments);y(this,"name","Category");y(this,"url","/categories");y(this,"actions",{addOne:Co,addMany:$o,setOne:Uo,setMany:Lo,updateOne:ko,updateMany:No,deleteOne:Go,deleteMany:Ho,initialize:Do});y(this,"selectors",{selectById:ti,selectByIds:Ko})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 Eg extends Xe{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Xo,addMany:Qo,setOne:xo,setMany:eh,updateOne:th,updateMany:sh,deleteOne:ih,deleteMany:nh,initialize:Jo});y(this,"selectors",{selectById:ch,selectByIds:dh})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=new Date().toISOString(),d=[],h=[],p={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in p||(p[b.sha1]=b,A[b.sha1]=[]);const E=this.buildModel({file:g,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:P});d.push(E),h.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(F=>F.uuid),blockers:d.map(F=>F.file_sha1)});return f.then(({attachments:F,presigned_urls:P})=>{this.dispatch(c(F));const g=this.client.files.processPresignedUrls(P);for(const[b,E]of Object.entries(g))E.then(()=>{const B=A[b];for(const z of B)this.makeReadable(z)})}).catch(()=>{this.dispatch(r(d.map(F=>F.uuid)))}),[d,f.then(({attachments:F})=>F)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class vg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:oh,addMany:hh,setOne:mh,setMany:yh,updateOne:ph,updateMany:Ah,deleteOne:fh,deleteMany:Sh,initialize:lh});y(this,"selectors",{selectById:Ih,selectByIds:Oh})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=Ph(e)(d);this.dispatch(a(e)),this.dispatch(l(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(r(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class at extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Vg extends at{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:bh,addMany:_h,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:Eh,deleteOne:vh,deleteMany:Vh,initialize:gh});y(this,"selectors",{selectById:Bh,selectByIds:jh})}async add(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class zg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const Ut={},qn=new Set;let Lt=0,Dn=0,Cn=0;const Bg=20;class jg extends et{constructor(){super(...arguments);y(this,"host");y(this,"_dbPromise",VO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Kt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:m.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await it(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch($h({sha1:e,...c})),c}async addCache(e,n){if(qn.has(n))return;if(!e.type){const r=e.name.split("."),l=r[r.length-1];e=new File([e],e.name,{type:l})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),Lt++):(await a.put("files",e,n),Dn++),qn.add(n),Cn++,Cn%Bg===0&&console.debug(`File cache summary: ${Lt} hits and ${Dn} misses, ${Lt/(Lt+Dn)*100}% hit rate over ${Cn} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),qn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Uh(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Kt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const h=await xn(e),p=new File([h],a??n,{type:h.type});return await this.addCache(p,n),p}let l=Ut[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(p=>{const A=new File([p],a??n,{type:p.type});h(A)})}),Ut[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof U&&delete Ut[c],h}if(u){const h=await it(d);if(h!==n){const f=`The hash of the file returned from the server (${h}) does not match the
9
9
  expected hash (${n}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=a??h+"."+p;if(d=Qn(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),Ut[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await it(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class qg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Gh,addMany:Hh,setOne:Wh,setMany:Kh,updateOne:Yh,updateMany:Zh,deleteOne:Jh,deleteMany:Xh,initialize:Nh});y(this,"selectors",{selectById:xh,selectByIds:em})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 Dg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:nm,addMany:am,setOne:cm,setMany:dm,updateOne:rm,updateMany:um,deleteOne:lm,deleteMany:om,initialize:im});y(this,"selectors",{selectById:mm,selectByIds:ym})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Cg extends v{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:Sm,addMany:Tm,setOne:Im,setMany:Om,updateOne:Pm,updateMany:Fm,deleteOne:gm,deleteMany:bm,initialize:fm});y(this,"selectors",{selectById:Mm,selectByIds:Rm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{revisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,form_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 $g extends v{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:yi,addMany:pi,setOne:Vm,setMany:zm,updateOne:Bm,updateMany:jm,deleteOne:Ai,deleteMany:fi,initialize:vm});y(this,"selectors",{selectById:qm,selectByIds:Dm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Ug extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:km,addMany:Nm,setOne:Gm,setMany:Hm,updateOne:Wm,updateMany:Km,deleteOne:Ym,deleteMany:Zm,initialize:Lm});y(this,"selectors",{selectById:Qm,selectByIds:xm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=M({...e,submitted_at:l,created_by:u}),h=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(yi(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return p.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(Ai(h.uuid)),f}),[d,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error("Expected form to exist");const d=Fy(e)(l),h=Cm(e)(l);this.dispatch(a(e)),this.dispatch(wi(D(d))),this.dispatch(fi(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(pi(h)),this.dispatch(Ri(d)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends v{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:sy,addMany:Pi,setOne:iy,setMany:ny,updateOne:ay,updateMany:cy,deleteOne:dy,deleteMany:Fi,initialize:ty});y(this,"selectors",{selectById:ry,selectByIds:uy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{submissionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_submission:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,form_submission:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=_i(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class kg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:Ay,addMany:Ri,setOne:yy,setMany:py,updateOne:fy,updateMany:Sy,deleteOne:Ty,deleteMany:wi,initialize:my});y(this,"selectors",{selectById:Oy,selectByIds:Py})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ly(e)(l);this.dispatch(a(e)),this.dispatch(Fi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Pi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Ng extends v{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:wy,addMany:Ey,setOne:My,setMany:Ry,updateOne:vy,updateMany:Vy,deleteOne:zy,deleteMany:By,initialize:_y});y(this,"selectors",{selectById:qy,selectByIds:Dy})}async add(e){var F;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=u.project,A=await this.client.files.getFilePayload(l),f=M({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:h});this.dispatch(a(f));const I=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[p],blockers:[p]});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.then(P=>P.geo_image)]}async bulkAdd(e,n){var F;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((F=a.getState().userReducer.currentUser)==null?void 0:F.id)??null,h=[],p=[],A=[],f={};for(const P of e){const{file:g,...b}=P,E=await this.client.files.getFilePayload(g);E.sha1 in f||(f[E.sha1]=E);const B=M({...b,file_name:g.name,file_sha1:E.sha1,file_type:g.type,file:URL.createObjectURL(g),submitted_at:u,created_by:d,project:n});h.push(B),p.push(B.uuid),A.push({uuid:B.uuid,sha1:B.file_sha1,file_name:B.file_name,title:B.title,description:B.description,geo_marker:B.geo_marker,canvas_marker:B.canvas_marker,direction:B.direction,original_date:B.original_date})}this.dispatch(c(h));const I=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:p});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(p))}),[h,I.then(P=>P.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Gg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Hy,addMany:Et,setOne:ky,setMany:Ly,updateOne:Ny,updateMany:Gy,deleteOne:Wy,deleteMany:vt,initialize:Uy});y(this,"selectors",{selectById:Yy,selectByIds:Zy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Hg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:sp,addMany:ji,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:qi,initialize:tp});y(this,"selectors",{selectById:lp,selectByIds:op})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Wg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:pp,addMany:Ap,setOne:fp,setMany:Sp,updateOne:Tp,updateMany:Ip,deleteOne:Op,deleteMany:Pp,initialize:yp});y(this,"selectors",{selectById:gp,selectByIds:bp})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Kg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:wp,addMany:Ep,setOne:vp,setMany:Vp,updateOne:zp,updateMany:Bp,deleteOne:jp,deleteMany:qp,initialize:Rp});y(this,"selectors",{selectById:Dp,selectByIds:Cp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=M({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Yg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:kp,addMany:Ni,setOne:Np,setMany:Gp,updateOne:Hp,updateMany:Wp,deleteOne:Kp,deleteMany:Gi,initialize:Lp});y(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=M({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(h.uuid)),f}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.CATEGORY,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case $.PRIORITY:u[A]=e[A];break;case $.DUE_DATE:u[A]=e[A];break;case $.DESCRIPTION:u[A]=e[A];break;case $.TITLE:u[A]=e[A];break;case $.STATUS:{const f=e[A],I=un(f)(c);if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:I.name,color:I.color,uuid:I.uuid};break}case $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=ti(f)(c);if(!I)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:I.name,color:I.color,uuid:I.uuid}}break}case $.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=qt(f)(c);if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:I.username,id:I.id}}break}}const d=M({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(on(d));const h=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(mn(d.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:E})=>E).filter(Boolean),g=f.map(({category:E})=>E).filter(Boolean),b=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(g).concat(A?[A]:[]),blocks:F.concat([I])});p.push(b),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=up(e)(l),h=gS(e)(l),p={};for(const f of Jy(e)(l))p[f.uuid]=f;for(const f of Xy(e)(l))p[f.uuid]=f;const A=Object.values(p);this.dispatch(a(e)),this.dispatch(qi(D(d))),this.dispatch(yn(D(h))),this.dispatch(vt(D(A)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(ji(d)),this.dispatch(hn(h)),this.dispatch(Et(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Zg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});y(this,"selectors",{selectById:lA,selectByIds:oA})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 Jg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:SA,updateOne:TA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});y(this,"selectors",{selectById:gA,selectByIds:bA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_extension:g.extension,field_identifier:F,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 Xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:NA,addMany:GA,setOne:HA,setMany:WA,updateOne:KA,updateMany:YA,deleteOne:ZA,deleteMany:JA,initialize:kA});y(this,"selectors",{selectById:QA,selectByIds:xA})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Qg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:nf,addMany:Qi,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:xi,initialize:sf});y(this,"selectors",{selectById:of,selectByIds:hf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldValuesUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,field_values:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,field_values:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return p.then(({presigned_urls:f,attachments:I})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(I))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:wA,addMany:EA,setOne:vA,setMany:VA,updateOne:zA,updateMany:BA,deleteOne:jA,deleteMany:qA,initialize:RA});y(this,"selectors",{selectById:CA,selectByIds:$A})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=mf(e)(l);this.dispatch(a(e)),this.dispatch(xi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Qi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class eb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:ff,addMany:Sf,setOne:Tf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:gf,initialize:Af});y(this,"selectors",{selectById:_f,selectByIds:Mf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 tb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:vf,addMany:Vf,setOne:zf,setMany:Bf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:Cf,initialize:Ef});y(this,"selectors",{selectById:Uf,selectByIds:Lf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class sb extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Hf,addMany:Wf,setOne:Kf,setMany:Yf,updateOne:Zf,updateMany:Jf,deleteOne:Xf,deleteMany:Qf,initialize:Gf});y(this,"selectors",{selectById:eS,selectByIds:tS})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Xp(e)(l);this.dispatch(a(e)),this.dispatch(Gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ni(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ib extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:aS,addMany:cS,setOne:dS,setMany:rS,updateOne:uS,updateMany:lS,deleteOne:oS,deleteMany:hS,initialize:nS});y(this,"selectors",{selectById:un,selectByIds:yS})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 nb extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:on,addMany:hn,setOne:SS,setMany:TS,updateOne:IS,updateMany:OS,deleteOne:mn,deleteMany:yn,initialize:fS});y(this,"selectors",{selectById:PS,selectByIds:FS})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const ab=1800;function cb(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 db extends sg{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Bo(!1)),this.clearTokens(),this.dispatch(_()),this.dispatch(_())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=zO(e).exp??n}catch{a=n}return a-n<ab}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 U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??nt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(cb(a))})}}class rb extends at{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:$S,addMany:US,setOne:LS,setMany:kS,updateOne:NS,updateMany:GS,deleteOne:HS,deleteMany:WS,initialize:CS});y(this,"selectors",{selectById:YS,selectByIds:ZS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=qt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(Tn(u.user));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Sn(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ub extends at{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:sT,addMany:tT,setOne:eT,setMany:xS,updateOne:nT,updateMany:iT,deleteOne:aT,deleteMany:cT,initialize:QS});y(this,"selectors",{selectById:uT,selectByIds:lT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class lb extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:IT,addMany:OT,setOne:PT,setMany:FT,updateOne:gT,updateMany:bT,deleteOne:_T,deleteMany:MT,initialize:TT});y(this,"selectors",{selectById:wT,selectByIds:ET})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>V(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(A=>A.uuid))),p}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 ob extends Xe{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:zT,addMany:BT,setOne:jT,setMany:qT,updateOne:DT,updateMany:CT,deleteOne:$T,deleteMany:UT,initialize:VT});y(this,"selectors",{selectById:kT,selectByIds:NT})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}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 hb extends v{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:ZT,addMany:JT,setOne:KT,setMany:YT,updateOne:XT,updateMany:QT,deleteOne:xT,deleteMany:eI,initialize:WT});y(this,"selectors",{selectById:cI,selectByIds:dI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const h={...r};delete h.file,l={method:m.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,p)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:m.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(p)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(iI),this.dispatch(sI(null)),this.dispatch(tI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class mb extends at{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:yI,addMany:mI,setOne:hI,setMany:oI,updateOne:AI,updateMany:pI,deleteOne:fI,deleteMany:SI,initialize:lI});y(this,"selectors",{selectById:OI,selectByIds:PI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:V(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yb extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:_I,addMany:MI,setOne:RI,setMany:wI,updateOne:EI,updateMany:vI,deleteOne:VI,deleteMany:zI,initialize:bI});y(this,"selectors",{selectById:qI,selectByIds:DI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>V(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}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 pb extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:UI,addMany:LI,setOne:kI,setMany:NI,updateOne:GI,updateMany:HI,deleteOne:WI,deleteMany:KI,initialize:$I});y(this,"selectors",{selectById:ZI,selectByIds:JI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ab extends at{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:Sn,addMany:ES,setOne:wS,setMany:RS,updateOne:VS,updateMany:vS,deleteOne:Tn,deleteMany:zS,initialize:MS});y(this,"selectors",{selectById:qt,selectByIds:qS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:r,...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 $n(t,s,e,n,a){const c=n instanceof et;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,isResponseBlob:F}={...r,...s};let P=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!P.startsWith("http")&&(!P.startsWith("/")&&!P.startsWith("blob:")&&(P="/"+P),P=t+P);const b=q=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const j=l.fields["x-amz-checksum-sha1"];if(!j)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",j).field({...u,...l.fields}).attach("file",g)}return q.send(u)},B={[m.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[m.POST]:()=>{const q=st.post(P.toString());return b(q)},[m.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[m.PUT]:()=>{const q=st.put(P.toString());return b(q)},[m.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[h];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),I&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(p)}catch(q){const j=yO(q),_O=j==null?void 0:j.status;if(c&&_O===401)return await n.auth.handleUnauthorized(z,j),z.query(p);throw new U({response:j,innerError:q,discard:jn.includes(_O)})}}class fb{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Nt,r={...e,uuid:e.uuid??xe.v4()};return $n(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??nt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof U)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof U)throw a;return a})}_enqueueRequest(s,e,n){const a=new Nt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(yT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},u=d=>{d instanceof U?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
- Converting error to APIError and discarding.`),d=new U({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class ct{constructor(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new BO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new ct;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 r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&ct._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){ct._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);s.payload.blockers.some(a=>n.payload.blocks.includes(a))&&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;this.graph.getNodeData(e).payload.blockers.some(a=>s.payload.blocks.includes(a))&&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 pO;function AO(t){pO=t}function dt(){return pO}let fO;function SO(t){fO=t}function TO(){return fO}let Un=null;function tt(){const t=dt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Un)return Un;const s=t.getState().offline.outbox,e=ct._fromOutbox(s);return Un=e,e}const Sb=(t,s)=>{const e=new s(t);return SO(e),AO(t),e};class Tb{constructor(s){y(this,"_all");y(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class Ln{constructor(){y(this,"next");this.next=null}then(s){return new Tb(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!dt())throw new Error("Client store not set");const n=TO();if(!n)throw new Error("Client SDK not set");return oO(s,n)}}}class IO extends Ln{async run(s){return super.run(s)}}class OO extends Ln{async run(s){return super.run(s)}}const PO=new IO().then(new OO).compile();function FO(t){var s;return(s=PO[0])==null?void 0:s.run(t)}var gO=(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))(gO||{});i.ALL_MIDDLEWARE=PO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=sO,i.AgentService=ig,i.AssetAttachmentService=ng,i.AssetProcedureService=lg,i.AssetProcedureStepFieldValuesAttachmentService=yg,i.AssetProcedureStepFieldValuesService=pg,i.AssetProcedureStepFieldsAttachmentService=hg,i.AssetProcedureStepFieldsService=mg,i.AssetProcedureStepService=Ag,i.AssetProcedureTypeAttachmentService=ag,i.AssetProcedureTypeFieldValuesAttachmentService=rg,i.AssetProcedureTypeFieldValuesService=ug,i.AssetProcedureTypeFieldsAttachmentService=cg,i.AssetProcedureTypeFieldsService=dg,i.AssetProcedureTypeService=og,i.AssetService=fg,i.AssetStageCompletionService=Sg,i.AssetStageService=Tg,i.AssetStatusType=Kn,i.AssetTypeAttachmentService=Ig,i.AssetTypeFieldValuesAttachmentService=Fg,i.AssetTypeFieldValuesService=gg,i.AssetTypeFieldsAttachmentService=Og,i.AssetTypeFieldsService=Pg,i.AssetTypeIdentifierService=bg,i.AssetTypeIdentifierValueService=_g,i.AssetTypeService=Mg,i.AssetTypeStatusService=Rg,i.AttachmentModel=Yn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=fb,i.COMMON_AUTO_FIELDS=ta,i.CategoryService=wg,i.DEFAULT_ISSUE_PRIORITY=jO,i.DEFAULT_PAGE_SIZE=tO,i.DISCARD_HTTP_STATUSES=jn,i.DeferredPromise=Nt,i.DocumentAttachmentService=Eg,i.DocumentService=vg,i.EMPTY_ARRAY=Gn,i.EMPTY_OBJECT=Hn,i.EmailDomainsService=Vg,i.EmailVerificationService=zg,i.FileService=jg,i.FormIdentifierService=qg,i.FormIdentifierValueService=Dg,i.FormRevisionAttachmentService=Cg,i.FormRevisionService=$g,i.FormService=Ug,i.FormSubmissionAttachmentService=Lg,i.FormSubmissionService=kg,i.GeoImageService=Ng,i.HttpMethod=m,i.IssueAssociationService=Gg,i.IssueAttachmentService=Hg,i.IssueCommentAttachmentService=Wg,i.IssueCommentService=Kg,i.IssuePriority=kt,i.IssueService=Yg,i.IssueStatusType=Zn,i.IssueTypeAttachmentService=Zg,i.IssueTypeFieldValuesAttachmentService=Qg,i.IssueTypeFieldValuesService=xg,i.IssueTypeFieldsAttachmentService=Jg,i.IssueTypeFieldsService=Xg,i.IssueTypeIdentifierService=eb,i.IssueTypeIdentifierValueService=tb,i.IssueTypeService=sb,i.IssueTypeStatusService=ib,i.IssueUpdateChange=$,i.IssueUpdateService=nb,i.JWTService=db,i.MAX_SERVICE_BATCH_SIZE=k,i.OUTBOX_RETRY_DELAY=Jn,i.OfflineAnalyticsMiddleware=IO,i.OfflineMiddleware=Ln,i.OrganizationAccessLevel=Wn,i.OrganizationAccessService=rb,i.OrganizationService=ub,i.OutboxCoordinator=ct,i.ProjectAccessService=lb,i.ProjectAttachmentService=ob,i.ProjectFileService=hb,i.ProjectService=mb,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=OO,i.SelectorBuilder=aP,i.TeamMembershipService=yb,i.TeamService=pb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Ab,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=gO,i._setLatestRetryTime=AT,i.addAsset=vr,i.addAssetAttachment=Aa,i.addAssetAttachments=Qt,i.addAssetProcedure=Gc,i.addAssetProcedureStep=Tr,i.addAssetProcedureStepFieldValues=ir,i.addAssetProcedureStepFieldValuesAttachment=Gd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=nr,i.addAssetProcedureStepFields=vd,i.addAssetProcedureStepFieldsAttachment=fd,i.addAssetProcedureStepFieldsAttachments=Sd,i.addAssetProcedureStepFieldsMany=Vd,i.addAssetProcedureSteps=Ir,i.addAssetProcedureType=id,i.addAssetProcedureTypeAttachment=wa,i.addAssetProcedureTypeAttachments=Ea,i.addAssetProcedureTypeFieldValues=Ec,i.addAssetProcedureTypeFieldValuesAttachment=fc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=vc,i.addAssetProcedureTypeFields=ic,i.addAssetProcedureTypeFieldsAttachment=Na,i.addAssetProcedureTypeFieldsAttachments=Ga,i.addAssetProcedureTypeFieldsMany=nc,i.addAssetProcedureTypes=nd,i.addAssetProcedures=hs,i.addAssetStage=du,i.addAssetStageCompletion=Gr,i.addAssetStageCompletions=Hr,i.addAssetStages=ru,i.addAssetType=uo,i.addAssetTypeAttachment=Su,i.addAssetTypeAttachments=js,i.addAssetTypeFieldValues=Sl,i.addAssetTypeFieldValuesAttachment=al,i.addAssetTypeFieldValuesAttachments=ks,i.addAssetTypeFieldValuesMany=Tl,i.addAssetTypeFields=Hu,i.addAssetTypeFieldsAttachment=vu,i.addAssetTypeFieldsAttachments=Vu,i.addAssetTypeFieldsMany=Wu,i.addAssetTypeIdentifier=Vl,i.addAssetTypeIdentifierValue=Wl,i.addAssetTypeIdentifierValues=Kl,i.addAssetTypeIdentifiers=zl,i.addAssetTypeStatus=Oo,i.addAssetTypeStatuses=Po,i.addAssetTypes=lo,i.addAssets=Rs,i.addCategories=$o,i.addCategory=Co,i.addConversation=la,i.addConversations=cP,i.addDocument=oh,i.addDocumentAttachment=Xo,i.addDocumentAttachments=Qo,i.addDocuments=hh,i.addEmailDomain=bh,i.addEmailDomains=_h,i.addForm=km,i.addFormIdentifier=Gh,i.addFormIdentifierValue=nm,i.addFormIdentifierValues=am,i.addFormIdentifiers=Hh,i.addFormRevision=yi,i.addFormRevisionAttachment=Sm,i.addFormRevisionAttachments=Tm,i.addFormRevisions=pi,i.addFormSubmission=Ay,i.addFormSubmissionAttachment=sy,i.addFormSubmissionAttachments=Pi,i.addFormSubmissions=Ri,i.addForms=Nm,i.addGeoImage=wy,i.addGeoImages=Ey,i.addIssue=kp,i.addIssueAssociation=Hy,i.addIssueAssociations=Et,i.addIssueAttachment=sp,i.addIssueAttachments=ji,i.addIssueComment=wp,i.addIssueCommentAttachment=pp,i.addIssueCommentAttachments=Ap,i.addIssueComments=Ep,i.addIssueType=Hf,i.addIssueTypeAttachment=tA,i.addIssueTypeAttachments=sA,i.addIssueTypeFieldValues=wA,i.addIssueTypeFieldValuesAttachment=nf,i.addIssueTypeFieldValuesAttachments=Qi,i.addIssueTypeFieldValuesMany=EA,i.addIssueTypeFields=NA,i.addIssueTypeFieldsAttachment=pA,i.addIssueTypeFieldsAttachments=AA,i.addIssueTypeFieldsMany=GA,i.addIssueTypeIdentifier=ff,i.addIssueTypeIdentifierValue=vf,i.addIssueTypeIdentifierValues=Vf,i.addIssueTypeIdentifiers=Sf,i.addIssueTypeStatus=aS,i.addIssueTypeStatuses=cS,i.addIssueTypes=Wf,i.addIssueUpdate=on,i.addIssueUpdates=hn,i.addIssues=Ni,i.addOrganization=sT,i.addOrganizationAccess=$S,i.addOrganizationAccesses=US,i.addOrganizations=tT,i.addProject=yI,i.addProjectAccess=IT,i.addProjectAccesses=OT,i.addProjectAttachment=zT,i.addProjectAttachments=BT,i.addProjectFile=ZT,i.addProjectFiles=JT,i.addProjects=mI,i.addTeam=UI,i.addTeamMembership=_I,i.addTeamMemberships=MI,i.addTeams=LI,i.addUser=Sn,i.addUsers=ES,i.agentsReducer=ma,i.agentsSlice=Zt,i.areArraysEqual=$O,i.assetAttachmentReducer=_a,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=Jc,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=er,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=yr,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=Rd,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=Ld,i.assetProcedureStepFieldsSlice=Ss,i.assetProcedureStepReducer=br,i.assetProcedureStepSlice=bs,i.assetProcedureTypeAttachmentReducer=Da,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=Fc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=Cc,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=Xa,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=oc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=od,i.assetProcedureTypeSlice=ys,i.assetReducer=Lr,i.assetSlice=Ms,i.assetStageCompletionReducer=Qr,i.assetStageCompletionSlice=Es,i.assetStageReducer=mu,i.assetStageSlice=vs,i.assetTypeAttachmentReducer=Ru,i.assetTypeAttachmentSlice=Bs,i.assetTypeFieldValuesAttachmentReducer=pl,i.assetTypeFieldValuesAttachmentSlice=Ls,i.assetTypeFieldValuesReducer=wl,i.assetTypeFieldValuesSlice=Hs,i.assetTypeFieldsAttachmentReducer=ku,i.assetTypeFieldsAttachmentSlice=Cs,i.assetTypeFieldsReducer=sl,i.assetTypeFieldsSlice=Us,i.assetTypeIdentifierReducer=Nl,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=io,i.assetTypeIdentifierValueSlice=Ys,i.assetTypeReducer=So,i.assetTypeSlice=Zs,i.assetTypeStatusReducer=Vo,i.assetTypeStatusSlice=Xs,i.assetTypeStatusSortFn=na,i.authReducer=jo,i.authSlice=bt,i.baseReducer=kF,i.baseReducers=Bn,i.blobToBase64=YO,i.categoryReducer=Yo,i.categorySlice=xs,i.clearTokens=GP,i.constructUploadedFilePayloads=KO,i.createModelAdapter=R,i.createOfflineAction=hT,i.createPayload=V,i.createSelectionAdapter=qO,i.deleteAsset=Br,i.deleteAssetAttachment=Oa,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Kc,i.deleteAssetProcedureStep=Fr,i.deleteAssetProcedureStepFieldValues=ur,i.deleteAssetProcedureStepFieldValuesAttachment=Zd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,i.deleteAssetProcedureStepFieldValuesMany=lr,i.deleteAssetProcedureStepFields=Dd,i.deleteAssetProcedureStepFieldsAttachment=Fd,i.deleteAssetProcedureStepFieldsAttachments=gd,i.deleteAssetProcedureStepFieldsMany=Cd,i.deleteAssetProcedureSteps=gr,i.deleteAssetProcedureType=dd,i.deleteAssetProcedureTypeAttachment=ja,i.deleteAssetProcedureTypeAttachments=qa,i.deleteAssetProcedureTypeFieldValues=qc,i.deleteAssetProcedureTypeFieldValuesAttachment=Pc,i.deleteAssetProcedureTypeFieldValuesAttachments=rs,i.deleteAssetProcedureTypeFieldValuesMany=Dc,i.deleteAssetProcedureTypeFields=uc,i.deleteAssetProcedureTypeFieldsAttachment=Za,i.deleteAssetProcedureTypeFieldsAttachments=Ja,i.deleteAssetProcedureTypeFieldsMany=lc,i.deleteAssetProcedureTypes=rd,i.deleteAssetProcedures=ms,i.deleteAssetStage=ou,i.deleteAssetStageCompletion=Jr,i.deleteAssetStageCompletions=Xr,i.deleteAssetStages=hu,i.deleteAssetType=mo,i.deleteAssetTypeAttachment=Fu,i.deleteAssetTypeAttachments=qs,i.deleteAssetTypeFieldValues=gl,i.deleteAssetTypeFieldValuesAttachment=ll,i.deleteAssetTypeFieldValuesAttachments=Ns,i.deleteAssetTypeFieldValuesMany=bl,i.deleteAssetTypeFields=Xu,i.deleteAssetTypeFieldsAttachment=Du,i.deleteAssetTypeFieldsAttachments=Cu,i.deleteAssetTypeFieldsMany=Qu,i.deleteAssetTypeIdentifier=Cl,i.deleteAssetTypeIdentifierValue=Ql,i.deleteAssetTypeIdentifierValues=xl,i.deleteAssetTypeIdentifiers=$l,i.deleteAssetTypeStatus=Mo,i.deleteAssetTypeStatuses=Ro,i.deleteAssetTypes=yo,i.deleteAssets=ws,i.deleteCategories=Ho,i.deleteCategory=Go,i.deleteConversation=uP,i.deleteConversations=lP,i.deleteDocument=fh,i.deleteDocumentAttachment=ih,i.deleteDocumentAttachments=nh,i.deleteDocuments=Sh,i.deleteEmailDomain=vh,i.deleteEmailDomains=Vh,i.deleteForm=Ym,i.deleteFormIdentifier=Jh,i.deleteFormIdentifierValue=lm,i.deleteFormIdentifierValues=om,i.deleteFormIdentifiers=Xh,i.deleteFormRevision=Ai,i.deleteFormRevisionAttachment=gm,i.deleteFormRevisionAttachments=bm,i.deleteFormRevisions=fi,i.deleteFormSubmission=Ty,i.deleteFormSubmissionAttachment=dy,i.deleteFormSubmissionAttachments=Fi,i.deleteFormSubmissions=wi,i.deleteForms=Zm,i.deleteGeoImage=zy,i.deleteGeoImages=By,i.deleteIssue=Kp,i.deleteIssueAssociation=Wy,i.deleteIssueAssociations=vt,i.deleteIssueAttachment=dp,i.deleteIssueAttachments=qi,i.deleteIssueComment=jp,i.deleteIssueCommentAttachment=Op,i.deleteIssueCommentAttachments=Pp,i.deleteIssueComments=qp,i.deleteIssueType=Xf,i.deleteIssueTypeAttachment=dA,i.deleteIssueTypeAttachments=rA,i.deleteIssueTypeFieldValues=jA,i.deleteIssueTypeFieldValuesAttachment=uf,i.deleteIssueTypeFieldValuesAttachments=xi,i.deleteIssueTypeFieldValuesMany=qA,i.deleteIssueTypeFields=ZA,i.deleteIssueTypeFieldsAttachment=OA,i.deleteIssueTypeFieldsAttachments=PA,i.deleteIssueTypeFieldsMany=JA,i.deleteIssueTypeIdentifier=Ff,i.deleteIssueTypeIdentifierValue=Df,i.deleteIssueTypeIdentifierValues=Cf,i.deleteIssueTypeIdentifiers=gf,i.deleteIssueTypeStatus=oS,i.deleteIssueTypeStatuses=hS,i.deleteIssueTypes=Qf,i.deleteIssueUpdate=mn,i.deleteIssueUpdates=yn,i.deleteIssues=Gi,i.deleteOrganization=aT,i.deleteOrganizationAccess=HS,i.deleteOrganizationAccesses=WS,i.deleteOrganizations=cT,i.deleteProject=fI,i.deleteProjectAccess=_T,i.deleteProjectAccesses=MT,i.deleteProjectAttachment=$T,i.deleteProjectAttachments=UT,i.deleteProjectFile=xT,i.deleteProjectFiles=eI,i.deleteProjects=SI,i.deleteTeam=WI,i.deleteTeamMembership=VI,i.deleteTeamMemberships=zI,i.deleteTeams=KI,i.deleteUser=Tn,i.deleteUsers=zS,i.dequeue=lO,i.discard=hO,i.documentAttachmentReducer=rh,i.documentAttachmentSlice=si,i.documentSlice=ni,i.documentsReducer=Th,i.downloadFile=ZO,i.downloadInMemoryFile=WO,i.emailDomainsReducer=qh,i.emailDomainsSlice=ci,i.emailRegex=sP,i.enqueue=uO,i.enqueueRequest=yT,i.extractResponseFromError=yO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=Lh,i.fileSlice=ri,i.fileToBlob=xn,i.formIdentifierReducer=tm,i.formIdentifierSlice=ui,i.formIdentifierValueReducer=pm,i.formIdentifierValueSlice=oi,i.formReducer=Jm,i.formRevisionAttachmentReducer=wm,i.formRevisionAttachmentSlice=hi,i.formRevisionReducer=$m,i.formRevisionsSlice=mi,i.formSlice=Ti,i.formSubmissionAttachmentReducer=oy,i.formSubmissionAttachmentSlice=Oi,i.formSubmissionReducer=gy,i.formSubmissionSlice=Mi,i.geoImageReducer=Cy,i.geoImageSlice=vi,i.getAssetProcedureStepSubTree=ia,i.getAssetProcedureStepTrees=iP,i.getClientSDK=TO,i.getClientStore=dt,i.getDocumentSubTree=da,i.getDocumentTrees=nP,i.getFileIdentifier=HO,i.getFileS3Key=Kt,i.getLocalDateString=Xn,i.getLocalRelativeDateString=NO,i.getOutboxCoordinator=tt,i.getRenamedFile=Qn,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Sb,i.initializeAssetAttachments=pa,i.initializeAssetProcedureStepFieldValues=sr,i.initializeAssetProcedureStepFieldValuesAttachments=Nd,i.initializeAssetProcedureStepFields=Ed,i.initializeAssetProcedureStepFieldsAttachments=Ad,i.initializeAssetProcedureSteps=Ar,i.initializeAssetProcedureTypeAttachments=Ra,i.initializeAssetProcedureTypeFieldValues=wc,i.initializeAssetProcedureTypeFieldValuesAttachments=Ac,i.initializeAssetProcedureTypeFields=sc,i.initializeAssetProcedureTypeFieldsAttachments=ka,i.initializeAssetProcedureTypes=sd,i.initializeAssetProcedures=Nc,i.initializeAssetStageCompletions=Nr,i.initializeAssetStages=nu,i.initializeAssetTypeAttachments=fu,i.initializeAssetTypeFieldValues=fl,i.initializeAssetTypeFieldValuesAttachments=nl,i.initializeAssetTypeFields=Gu,i.initializeAssetTypeFieldsAttachments=Eu,i.initializeAssetTypeIdentifierValues=Hl,i.initializeAssetTypeIdentifiers=vl,i.initializeAssetTypeStatuses=Io,i.initializeAssetTypes=ao,i.initializeAssets=Er,i.initializeCategories=Do,i.initializeConversations=ua,i.initializeDocumentAttachments=Jo,i.initializeDocuments=lh,i.initializeEmailDomains=gh,i.initializeFormIdentifierValues=im,i.initializeFormIdentifiers=Nh,i.initializeFormRevisionAttachments=fm,i.initializeFormRevisions=vm,i.initializeFormSubmissionAttachments=ty,i.initializeFormSubmissions=my,i.initializeForms=Lm,i.initializeGeoImages=_y,i.initializeIssueAssociations=Uy,i.initializeIssueAttachments=tp,i.initializeIssueCommentAttachments=yp,i.initializeIssueComments=Rp,i.initializeIssueTypeAttachments=eA,i.initializeIssueTypeFieldValues=RA,i.initializeIssueTypeFieldValuesAttachments=sf,i.initializeIssueTypeFields=kA,i.initializeIssueTypeFieldsAttachments=yA,i.initializeIssueTypeIdentifierValues=Ef,i.initializeIssueTypeIdentifiers=Af,i.initializeIssueTypeStatuses=nS,i.initializeIssueTypes=Gf,i.initializeIssueUpdates=fS,i.initializeIssues=Lp,i.initializeOrganizationAccesses=CS,i.initializeOrganizations=QS,i.initializeProjectAccesses=TT,i.initializeProjectAttachments=VT,i.initializeProjectFiles=WT,i.initializeProjects=lI,i.initializeTeamMemberships=bI,i.initializeTeams=$I,i.initializeUsers=MS,i.isToday=kO,i.issueAssociationReducer=xy,i.issueAssociationSlice=zi,i.issueAttachmentReducer=hp,i.issueAttachmentSlice=Bi,i.issueCommentAttachmentReducer=_p,i.issueCommentAttachmentSlice=Ci,i.issueCommentReducer=$p,i.issueCommentSlice=Ui,i.issueReducer=Qp,i.issueSlice=ki,i.issueTypeAttachmentReducer=hA,i.issueTypeAttachmentSlice=Hi,i.issueTypeFieldValuesAttachmentReducer=yf,i.issueTypeFieldValuesAttachmentSlice=Xi,i.issueTypeFieldValuesReducer=UA,i.issueTypeFieldValuesSlice=Zi,i.issueTypeFieldsAttachmentReducer=_A,i.issueTypeFieldsAttachmentSlice=Ki,i.issueTypeFieldsReducer=ef,i.issueTypeFieldsSlice=Ji,i.issueTypeIdentifierReducer=Rf,i.issueTypeIdentifierSlice=tn,i.issueTypeIdentifierValueReducer=kf,i.issueTypeIdentifierValueSlice=nn,i.issueTypeReducer=sS,i.issueTypeSlice=an,i.issueTypeStatusReducer=pS,i.issueTypeStatusSlice=dn,i.issueTypeStatusSortFn=aa,i.issueUpdateReducer=bS,i.issueUpdateSlice=ln,i.logOnlyOnce=JO,i.markAsDeleted=pT,i.markForDeletion=_F,i.memoize=Ht,i.organizationAccessReducer=KS,i.organizationAccessSlice=On,i.organizationReducer=oT,i.organizationSlice=Pn,i.outboxReducer=fT,i.outboxSlice=Fn,i.overmapEnhancer=XF,i.overmapReducer=NF,i.overmapReducers=eO,i.performRequest=$n,i.performRequestFromAction=oO,i.projectAccessReducer=RT,i.projectAccessSlice=gn,i.projectAttachmentReducer=GT,i.projectAttachmentSlice=_n,i.projectFileReducer=rI,i.projectFileSlice=Rn,i.projectReducer=TI,i.projectSlice=wn,i.rehydratedReducer=FI,i.rehydratedSlice=En,i.restructureSelectorWithArgs=S,i.runMiddleware=FO,i.saveActiveProjectFileBounds=iI,i.selectAccessToken=HP,i.selectAccessesByUserOfProject=RF,i.selectAccessibleProjects=zF,i.selectActiveOrganizationAccess=PF,i.selectActiveProjectFileId=vF,i.selectAllDocumentAttachments=ii,i.selectAssetAttachmentById=Fa,i.selectAssetAttachmentMapping=Pa,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=ga,i.selectAssetById=$r,i.selectAssetProcedureById=xc,i.selectAssetProcedureStepById=_r,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=Xd,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Qd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Jd,i.selectAssetProcedureStepFieldValuesById=hr,i.selectAssetProcedureStepFieldValuesByIds=mr,i.selectAssetProcedureStepFieldValuesMapping=or,i.selectAssetProcedureStepFieldValuesOfAsset=bP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=_P,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=MP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=_d,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=Md,i.selectAssetProcedureStepFieldsAttachmentsMapping=bd,i.selectAssetProcedureStepFieldsById=$d,i.selectAssetProcedureStepFieldsByIds=Ud,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=PP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=Mr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=RP,i.selectAssetProcedureStepsOfAssetProcedureType=wP,i.selectAssetProcedureTypeAttachmentById=$a,i.selectAssetProcedureTypeAttachmentMapping=Ca,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=Ua,i.selectAssetProcedureTypeById=md,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=bc,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=_c,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=gc,i.selectAssetProcedureTypeFieldValuesById=Uc,i.selectAssetProcedureTypeFieldValuesByIds=Lc,i.selectAssetProcedureTypeFieldValuesMapping=$c,i.selectAssetProcedureTypeFieldValuesOfAsset=fP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=xa,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=ec,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Qa,i.selectAssetProcedureTypeFieldsById=mc,i.selectAssetProcedureTypeFieldsByIds=yc,i.selectAssetProcedureTypeFieldsMapping=hc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=pP,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=yd,i.selectAssetProcedureTypesMapping=hd,i.selectAssetProcedureTypesOfOrganization=IP,i.selectAssetProcedures=Tt,i.selectAssetProceduresByIds=ed,i.selectAssetProceduresMapping=Xc,i.selectAssetProceduresOfAssetProcedureType=Qc,i.selectAssetProceduresOfAssetType=TP,i.selectAssetStageById=yu,i.selectAssetStageCompletionById=tu,i.selectAssetStageCompletionMapping=xr,i.selectAssetStageCompletions=eu,i.selectAssetStageCompletionsByIds=su,i.selectAssetStages=zs,i.selectAssetStagesByIds=pu,i.selectAssetStagesMappingOfAssetProcedureType=vP,i.selectAssetStagesOfAssetProcedureType=VP,i.selectAssetTypeAttachmentById=bu,i.selectAssetTypeAttachmentMapping=gu,i.selectAssetTypeAttachments=Ds,i.selectAssetTypeAttachmentsByIds=_u,i.selectAssetTypeById=Ao,i.selectAssetTypeFieldValues=Ft,i.selectAssetTypeFieldValuesAttachmentById=hl,i.selectAssetTypeFieldValuesAttachments=Gs,i.selectAssetTypeFieldValuesAttachmentsByIds=ml,i.selectAssetTypeFieldValuesAttachmentsMapping=ol,i.selectAssetTypeFieldValuesById=Ml,i.selectAssetTypeFieldValuesByIds=Rl,i.selectAssetTypeFieldValuesMapping=_l,i.selectAssetTypeFieldValuesOfAsset=qP,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Uu,i.selectAssetTypeFieldsAttachments=$s,i.selectAssetTypeFieldsAttachmentsByIds=Lu,i.selectAssetTypeFieldsAttachmentsMapping=$u,i.selectAssetTypeFieldsById=el,i.selectAssetTypeFieldsByIds=tl,i.selectAssetTypeFieldsMapping=xu,i.selectAssetTypeFieldsOfAssetType=BP,i.selectAssetTypeIdentifierById=Ll,i.selectAssetTypeIdentifierMapping=Ul,i.selectAssetTypeIdentifierValueById=to,i.selectAssetTypeIdentifierValueMapping=eo,i.selectAssetTypeIdentifierValues=gt,i.selectAssetTypeIdentifierValuesByIds=so,i.selectAssetTypeIdentifierValuesOfAsset=$P,i.selectAssetTypeIdentifierValuesOfIdentifier=UP,i.selectAssetTypeIdentifiers=Ks,i.selectAssetTypeIdentifiersByIds=kl,i.selectAssetTypeIdentifiersOfAssetType=CP,i.selectAssetTypeStatusById=Eo,i.selectAssetTypeStatusMapping=wo,i.selectAssetTypeStatuses=Qs,i.selectAssetTypeStatusesByIds=vo,i.selectAssetTypeStatusesOfAssetType=kP,i.selectAssetTypeValuesOfAssetType=DP,i.selectAssetTypes=Js,i.selectAssetTypesByIds=fo,i.selectAssetTypesMapping=po,i.selectAssetTypesOfOrganization=LP,i.selectAssets=Pt,i.selectAssetsByIds=Ur,i.selectAssetsMapping=Dr,i.selectAssetsOfAssetType=Cr,i.selectAssetsOfProject=EP,i.selectAttachmentsOfAsset=ba,i.selectAttachmentsOfAssetProcedureStepFieldValues=xd,i.selectAttachmentsOfAssetProcedureStepFields=OP,i.selectAttachmentsOfAssetProcedureType=mP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Mc,i.selectAttachmentsOfAssetProcedureTypeFields=yP,i.selectAttachmentsOfAssetType=Mu,i.selectAttachmentsOfAssetTypeFieldValues=yl,i.selectAttachmentsOfAssetTypeFields=zP,i.selectAttachmentsOfDocument=YP,i.selectAttachmentsOfFormRevision=sF,i.selectAttachmentsOfFormSubmission=ly,i.selectAttachmentsOfIssue=up,i.selectAttachmentsOfIssueComment=cF,i.selectAttachmentsOfIssueType=uF,i.selectAttachmentsOfIssueTypeFieldValues=mf,i.selectAttachmentsOfIssueTypeFields=lF,i.selectAttachmentsOfProject=EF,i.selectCategories=ei,i.selectCategoriesByIds=Ko,i.selectCategoriesOfProject=KP,i.selectCategoryById=ti,i.selectCategoryMapping=Wo,i.selectCommentsOfIssue=dF,i.selectConversation=hP,i.selectConversationMapping=Jt,i.selectConversations=oP,i.selectCurrentUser=jS,i.selectDeletedRequests=gF,i.selectDescendantsOfAssetProcedureStep=Rr,i.selectDescendantsOfDocument=Ph,i.selectDocumentAttachmentById=ch,i.selectDocumentAttachmentMapping=ah,i.selectDocumentAttachmentsByIds=dh,i.selectDocumentById=Ih,i.selectDocuments=_t,i.selectDocumentsByIds=Oh,i.selectDocumentsMapping=ai,i.selectEmailDomainById=Bh,i.selectEmailDomains=di,i.selectEmailDomainsAsMapping=zh,i.selectEmailDomainsByIds=jh,i.selectEmailDomainsOfOrganization=XP,i.selectFieldValuesOfAssetProcedure=SP,i.selectFormById=Qm,i.selectFormIdentifierById=xh,i.selectFormIdentifierMapping=Qh,i.selectFormIdentifierValueById=mm,i.selectFormIdentifierValueMapping=hm,i.selectFormIdentifierValues=Mt,i.selectFormIdentifierValuesByIds=ym,i.selectFormIdentifierValuesOfFormSubmission=eF,i.selectFormIdentifierValuesOfIdentifier=tF,i.selectFormIdentifiers=li,i.selectFormIdentifiersByIds=em,i.selectFormIdentifiersOfForm=xP,i.selectFormMapping=Xm,i.selectFormRevisionAttachmentById=Mm,i.selectFormRevisionAttachments=_m,i.selectFormRevisionAttachmentsByIds=Rm,i.selectFormRevisionAttachmentsMapping=Rt,i.selectFormRevisionById=qm,i.selectFormRevisionMapping=Si,i.selectFormRevisions=wt,i.selectFormRevisionsByIds=Dm,i.selectFormRevisionsOfForm=Cm,i.selectFormSubmissionAttachemntsByIds=_i,i.selectFormSubmissionAttachmentById=ry,i.selectFormSubmissionAttachments=bi,i.selectFormSubmissionAttachmentsByIds=uy,i.selectFormSubmissionAttachmentsMapping=gi,i.selectFormSubmissionById=Oy,i.selectFormSubmissions=Iy,i.selectFormSubmissionsByIds=Py,i.selectFormSubmissionsMapping=Ei,i.selectFormSubmissionsOfForm=Fy,i.selectForms=Ii,i.selectFormsByIds=xm,i.selectFormsOfOrganization=nF,i.selectGeoImageById=qy,i.selectGeoImageMapping=jy,i.selectGeoImages=Vi,i.selectGeoImagesByIds=Dy,i.selectGeoImagesOfProject=aF,i.selectIsImportingProjectFile=VF,i.selectIsLoggedIn=WP,i.selectIssueAssociationById=Yy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Ky,i.selectIssueAssociationsByIds=Zy,i.selectIssueAssociationsOfAsset=Qy,i.selectIssueAssociationsOfIssue=Xy,i.selectIssueAssociationsToIssue=Jy,i.selectIssueAttachmentById=lp,i.selectIssueAttachmentMapping=rp,i.selectIssueAttachments=Di,i.selectIssueAttachmentsByIds=op,i.selectIssueById=Zp,i.selectIssueCommentAttachmentById=gp,i.selectIssueCommentAttachmentMapping=Fp,i.selectIssueCommentAttachments=$i,i.selectIssueCommentAttachmentsByIds=bp,i.selectIssueCommentById=Dp,i.selectIssueCommentMapping=Li,i.selectIssueCommentsByIds=Cp,i.selectIssueMapping=Yp,i.selectIssueTypeAttachmentById=lA,i.selectIssueTypeAttachmentMapping=uA,i.selectIssueTypeAttachments=Wi,i.selectIssueTypeAttachmentsByIds=oA,i.selectIssueTypeById=eS,i.selectIssueTypeFieldValues=zt,i.selectIssueTypeFieldValuesAttachmentById=of,i.selectIssueTypeFieldValuesAttachments=en,i.selectIssueTypeFieldValuesAttachmentsByIds=hf,i.selectIssueTypeFieldValuesAttachmentsMapping=lf,i.selectIssueTypeFieldValuesById=CA,i.selectIssueTypeFieldValuesByIds=$A,i.selectIssueTypeFieldValuesMapping=DA,i.selectIssueTypeFieldValuesOfIssue=oF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=gA,i.selectIssueTypeFieldsAttachments=Yi,i.selectIssueTypeFieldsAttachmentsByIds=bA,i.selectIssueTypeFieldsAttachmentsMapping=FA,i.selectIssueTypeFieldsById=QA,i.selectIssueTypeFieldsByIds=xA,i.selectIssueTypeFieldsMapping=XA,i.selectIssueTypeFieldsOfIssueType=hF,i.selectIssueTypeIdentifierById=_f,i.selectIssueTypeIdentifierMapping=bf,i.selectIssueTypeIdentifierValueById=Uf,i.selectIssueTypeIdentifierValueMapping=$f,i.selectIssueTypeIdentifierValues=Bt,i.selectIssueTypeIdentifierValuesByIds=Lf,i.selectIssueTypeIdentifierValuesOfIdentifier=fF,i.selectIssueTypeIdentifierValuesOfIssue=AF,i.selectIssueTypeIdentifiers=sn,i.selectIssueTypeIdentifiersByIds=Mf,i.selectIssueTypeIdentifiersOfIssueType=pF,i.selectIssueTypeMapping=xf,i.selectIssueTypeStatusById=un,i.selectIssueTypeStatusMapping=mS,i.selectIssueTypeStatuses=rn,i.selectIssueTypeStatusesByIds=yS,i.selectIssueTypeStatusesOfIssueType=TF,i.selectIssueTypeValuesOfIssueType=yF,i.selectIssueTypes=cn,i.selectIssueTypesByIds=tS,i.selectIssueTypesOfOrganization=SF,i.selectIssueUpdateById=PS,i.selectIssueUpdateMapping=pn,i.selectIssueUpdates=An,i.selectIssueUpdatesByIds=FS,i.selectIssueUpdatesOfIssue=gS,i.selectIssues=Vt,i.selectIssuesByIds=Jp,i.selectIssuesOfIssueType=Xp,i.selectIssuesOfProject=rF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=FP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=AP,i.selectLatestAssetTypeFieldsOfAssetType=jP,i.selectLatestFieldsByAssetProcedureStep=gP,i.selectLatestFormRevisionOfForm=iF,i.selectLatestIssueTypeFieldsOfIssueType=mF,i.selectLatestRetryTime=bF,i.selectMembershipsByUserOfTeam=CF,i.selectOrganizationAccessById=YS,i.selectOrganizationAccessMapping=Dt,i.selectOrganizationAccessUserMapping=JS,i.selectOrganizationAccessesByIds=ZS,i.selectOrganizationById=uT,i.selectOrganizationDocuments=JP,i.selectOrganizations=rT,i.selectOrganizationsByIds=lT,i.selectOrganizationsMapping=dT,i.selectProjectAccessById=wT,i.selectProjectAccessMapping=bn,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=ET,i.selectProjectAccessesOfProject=MF,i.selectProjectAttachmentById=kT,i.selectProjectAttachmentMapping=LT,i.selectProjectAttachments=Mn,i.selectProjectAttachmentsByIds=NT,i.selectProjectById=OI,i.selectProjectDocuments=ZP,i.selectProjectFileById=cI,i.selectProjectFileMapping=nI,i.selectProjectFiles=aI,i.selectProjectFilesByIds=dI,i.selectProjectMapping=II,i.selectProjects=Ct,i.selectProjectsByIds=PI,i.selectProjectsOfOrganization=BF,i.selectRehydrated=DF,i.selectStageMapping=Vs,i.selectTeamById=ZI,i.selectTeamMembershipById=qI,i.selectTeamMemberships=$t,i.selectTeamMembershipsByIds=DI,i.selectTeamMembershipsMapping=jI,i.selectTeams=zn,i.selectTeamsByIds=JI,i.selectTeamsMapping=YI,i.selectTeamsOfOrganization=UF,i.selectUploadUrl=Uh,i.selectUserById=qt,i.selectUsers=jt,i.selectUsersByIds=qS,i.selectUsersMapping=In,i.selectUsersOfOrganization=FF,i.selectUsersOfProject=wF,i.selectUsersOfTeam=$F,i.setActiveProjectFileId=sI,i.setAsset=jr,i.setAssetAttachment=fa,i.setAssetAttachments=Sa,i.setAssetProcedure=Yc,i.setAssetProcedureStep=fr,i.setAssetProcedureStepFieldValues=ar,i.setAssetProcedureStepFieldValuesAttachment=Hd,i.setAssetProcedureStepFieldValuesAttachments=Wd,i.setAssetProcedureStepFieldValuesMany=cr,i.setAssetProcedureStepFields=zd,i.setAssetProcedureStepFieldsAttachment=Td,i.setAssetProcedureStepFieldsAttachments=Id,i.setAssetProcedureStepFieldsMany=Bd,i.setAssetProcedureSteps=Sr,i.setAssetProcedureType=ud,i.setAssetProcedureTypeAttachment=va,i.setAssetProcedureTypeAttachments=Va,i.setAssetProcedureTypeFieldValues=Vc,i.setAssetProcedureTypeFieldValuesAttachment=Sc,i.setAssetProcedureTypeFieldValuesAttachments=Tc,i.setAssetProcedureTypeFieldValuesMany=zc,i.setAssetProcedureTypeFields=ac,i.setAssetProcedureTypeFieldsAttachment=Ha,i.setAssetProcedureTypeFieldsAttachments=Wa,i.setAssetProcedureTypeFieldsMany=cc,i.setAssetProcedureTypes=ld,i.setAssetProcedures=Zc,i.setAssetStage=au,i.setAssetStageCompletion=Wr,i.setAssetStageCompletions=Kr,i.setAssetStages=cu,i.setAssetType=co,i.setAssetTypeAttachment=Tu,i.setAssetTypeAttachments=Iu,i.setAssetTypeFieldValues=Il,i.setAssetTypeFieldValuesAttachment=cl,i.setAssetTypeFieldValuesAttachments=dl,i.setAssetTypeFieldValuesMany=Ol,i.setAssetTypeFields=Ku,i.setAssetTypeFieldsAttachment=zu,i.setAssetTypeFieldsAttachments=Bu,i.setAssetTypeFieldsMany=Yu,i.setAssetTypeIdentifier=Bl,i.setAssetTypeIdentifierValue=Yl,i.setAssetTypeIdentifierValues=Zl,i.setAssetTypeIdentifiers=jl,i.setAssetTypeStatus=Fo,i.setAssetTypeStatuses=go,i.setAssetTypes=ro,i.setAssets=qr,i.setCategories=Lo,i.setCategory=Uo,i.setClientSDK=SO,i.setClientStore=AO,i.setConversation=oa,i.setConversations=dP,i.setCurrentUser=IF,i.setDocument=mh,i.setDocumentAttachment=xo,i.setDocumentAttachments=eh,i.setDocuments=yh,i.setEmailDomain=Mh,i.setEmailDomains=Rh,i.setForm=Gm,i.setFormIdentifier=Wh,i.setFormIdentifierValue=cm,i.setFormIdentifierValues=dm,i.setFormIdentifiers=Kh,i.setFormRevision=Vm,i.setFormRevisionAttachment=Im,i.setFormRevisionAttachments=Om,i.setFormRevisions=zm,i.setFormSubmission=yy,i.setFormSubmissionAttachment=iy,i.setFormSubmissionAttachments=ny,i.setFormSubmissions=py,i.setForms=Hm,i.setGeoImage=My,i.setGeoImages=Ry,i.setIsImportingProjectFile=tI,i.setIssue=Np,i.setIssueAssociation=ky,i.setIssueAssociations=Ly,i.setIssueAttachment=ip,i.setIssueAttachments=np,i.setIssueComment=vp,i.setIssueCommentAttachment=fp,i.setIssueCommentAttachments=Sp,i.setIssueComments=Vp,i.setIssueType=Kf,i.setIssueTypeAttachment=iA,i.setIssueTypeAttachments=nA,i.setIssueTypeFieldValues=vA,i.setIssueTypeFieldValuesAttachment=af,i.setIssueTypeFieldValuesAttachments=cf,i.setIssueTypeFieldValuesMany=VA,i.setIssueTypeFields=HA,i.setIssueTypeFieldsAttachment=fA,i.setIssueTypeFieldsAttachments=SA,i.setIssueTypeFieldsMany=WA,i.setIssueTypeIdentifier=Tf,i.setIssueTypeIdentifierValue=zf,i.setIssueTypeIdentifierValues=Bf,i.setIssueTypeIdentifiers=If,i.setIssueTypeStatus=dS,i.setIssueTypeStatuses=rS,i.setIssueTypes=Yf,i.setIssueUpdate=SS,i.setIssueUpdates=TS,i.setIssues=Gp,i.setLoggedIn=Bo,i.setOrganization=eT,i.setOrganizationAccess=LS,i.setOrganizationAccesses=kS,i.setOrganizations=xS,i.setProfilePicture=OF,i.setProject=hI,i.setProjectAccess=PT,i.setProjectAccesses=FT,i.setProjectAttachment=jT,i.setProjectAttachments=qT,i.setProjectFile=KT,i.setProjectFiles=YT,i.setProjects=oI,i.setRehydrated=qF,i.setTeam=kI,i.setTeamMembership=RI,i.setTeamMemberships=wI,i.setTeams=NI,i.setTokens=NP,i.setUploadUrl=$h,i.setUser=wS,i.setUsers=RS,i.shallowEqual=CO,i.slugify=eP,i.spacesToDashesLower=xO,i.teamMembershipReducer=BI,i.teamMembershipSlice=vn,i.teamReducer=XI,i.teamSlice=Vn,i.toFileNameSafeString=QO,i.toUuidArray=D,i.toUuidIdRecord=XO,i.truncate=tP,i.updateAsset=Vr,i.updateAssetAttachment=Ta,i.updateAssetAttachments=Ia,i.updateAssetProcedure=Hc,i.updateAssetProcedureStep=Or,i.updateAssetProcedureStepFieldValues=dr,i.updateAssetProcedureStepFieldValuesAttachment=Kd,i.updateAssetProcedureStepFieldValuesAttachments=Yd,i.updateAssetProcedureStepFieldValuesMany=rr,i.updateAssetProcedureStepFields=jd,i.updateAssetProcedureStepFieldsAttachment=Od,i.updateAssetProcedureStepFieldsAttachments=Pd,i.updateAssetProcedureStepFieldsMany=qd,i.updateAssetProcedureSteps=Pr,i.updateAssetProcedureType=ad,i.updateAssetProcedureTypeAttachment=za,i.updateAssetProcedureTypeAttachments=Ba,i.updateAssetProcedureTypeFieldValues=Bc,i.updateAssetProcedureTypeFieldValuesAttachment=Ic,i.updateAssetProcedureTypeFieldValuesAttachments=Oc,i.updateAssetProcedureTypeFieldValuesMany=jc,i.updateAssetProcedureTypeFields=dc,i.updateAssetProcedureTypeFieldsAttachment=Ka,i.updateAssetProcedureTypeFieldsAttachments=Ya,i.updateAssetProcedureTypeFieldsMany=rc,i.updateAssetProcedureTypes=cd,i.updateAssetProcedures=Wc,i.updateAssetStage=uu,i.updateAssetStageCompletion=Yr,i.updateAssetStageCompletions=Zr,i.updateAssetStages=lu,i.updateAssetType=oo,i.updateAssetTypeAttachment=Ou,i.updateAssetTypeAttachments=Pu,i.updateAssetTypeFieldValues=Pl,i.updateAssetTypeFieldValuesAttachment=rl,i.updateAssetTypeFieldValuesAttachments=ul,i.updateAssetTypeFieldValuesMany=Fl,i.updateAssetTypeFields=Zu,i.updateAssetTypeFieldsAttachment=ju,i.updateAssetTypeFieldsAttachments=qu,i.updateAssetTypeFieldsMany=Ju,i.updateAssetTypeIdentifier=ql,i.updateAssetTypeIdentifierValue=Jl,i.updateAssetTypeIdentifierValues=Xl,i.updateAssetTypeIdentifiers=Dl,i.updateAssetTypeStatus=bo,i.updateAssetTypeStatuses=_o,i.updateAssetTypes=ho,i.updateAssets=zr,i.updateCategories=No,i.updateCategory=ko,i.updateConversation=ha,i.updateConversations=rP,i.updateDocument=ph,i.updateDocumentAttachment=th,i.updateDocumentAttachments=sh,i.updateDocuments=Ah,i.updateEmailDomain=wh,i.updateEmailDomains=Eh,i.updateForm=Wm,i.updateFormIdentifier=Yh,i.updateFormIdentifierValue=rm,i.updateFormIdentifierValues=um,i.updateFormIdentifiers=Zh,i.updateFormRevision=Bm,i.updateFormRevisionAttachment=Pm,i.updateFormRevisionAttachments=Fm,i.updateFormRevisions=jm,i.updateFormSubmission=fy,i.updateFormSubmissionAttachment=ay,i.updateFormSubmissionAttachments=cy,i.updateFormSubmissions=Sy,i.updateForms=Km,i.updateGeoImage=vy,i.updateGeoImages=Vy,i.updateIssue=Hp,i.updateIssueAssociation=Ny,i.updateIssueAssociations=Gy,i.updateIssueAttachment=ap,i.updateIssueAttachments=cp,i.updateIssueComment=zp,i.updateIssueCommentAttachment=Tp,i.updateIssueCommentAttachments=Ip,i.updateIssueComments=Bp,i.updateIssueType=Zf,i.updateIssueTypeAttachment=aA,i.updateIssueTypeAttachments=cA,i.updateIssueTypeFieldValues=zA,i.updateIssueTypeFieldValuesAttachment=df,i.updateIssueTypeFieldValuesAttachments=rf,i.updateIssueTypeFieldValuesMany=BA,i.updateIssueTypeFields=KA,i.updateIssueTypeFieldsAttachment=TA,i.updateIssueTypeFieldsAttachments=IA,i.updateIssueTypeFieldsMany=YA,i.updateIssueTypeIdentifier=Of,i.updateIssueTypeIdentifierValue=jf,i.updateIssueTypeIdentifierValues=qf,i.updateIssueTypeIdentifiers=Pf,i.updateIssueTypeStatus=uS,i.updateIssueTypeStatuses=lS,i.updateIssueTypes=Jf,i.updateIssueUpdate=IS,i.updateIssueUpdates=OS,i.updateIssues=Wp,i.updateOrganization=nT,i.updateOrganizationAccess=NS,i.updateOrganizationAccesses=GS,i.updateOrganizations=iT,i.updateProject=AI,i.updateProjectAccess=gT,i.updateProjectAccesses=bT,i.updateProjectAttachment=DT,i.updateProjectAttachments=CT,i.updateProjectFile=XT,i.updateProjectFiles=QT,i.updateProjects=pI,i.updateTeam=GI,i.updateTeamMembership=EI,i.updateTeamMemberships=vI,i.updateTeams=HI,i.updateUser=VS,i.updateUsers=vS,i.useSelectorBuilder=DO,i.userReducer=BS,i.userSlice=fn,i.uuidObj=M,i.uuidObjSortFn=Yt,i.uuidSortFn=At,i.versioningReducer=xI,i.versioningSlice=QI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=a??h+"."+p;if(d=Qn(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),Ut[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await it(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class qg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Gh,addMany:Hh,setOne:Wh,setMany:Kh,updateOne:Yh,updateMany:Zh,deleteOne:Jh,deleteMany:Xh,initialize:Nh});y(this,"selectors",{selectById:xh,selectByIds:em})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 Dg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:nm,addMany:am,setOne:cm,setMany:dm,updateOne:rm,updateMany:um,deleteOne:lm,deleteMany:om,initialize:im});y(this,"selectors",{selectById:mm,selectByIds:ym})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Cg extends v{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:Sm,addMany:Tm,setOne:Im,setMany:Om,updateOne:Pm,updateMany:Fm,deleteOne:gm,deleteMany:bm,initialize:fm});y(this,"selectors",{selectById:Mm,selectByIds:Rm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{revisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,form_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 $g extends v{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:yi,addMany:pi,setOne:Vm,setMany:zm,updateOne:Bm,updateMany:jm,deleteOne:Ai,deleteMany:fi,initialize:vm});y(this,"selectors",{selectById:qm,selectByIds:Dm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Ug extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:km,addMany:Nm,setOne:Gm,setMany:Hm,updateOne:Wm,updateMany:Km,deleteOne:Ym,deleteMany:Zm,initialize:Lm});y(this,"selectors",{selectById:Qm,selectByIds:xm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=M({...e,submitted_at:l,created_by:u}),h=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(yi(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return p.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(Ai(h.uuid)),f}),[d,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error("Expected form to exist");const d=Fy(e)(l),h=Cm(e)(l);this.dispatch(a(e)),this.dispatch(wi(D(d))),this.dispatch(fi(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(pi(h)),this.dispatch(Ri(d)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends v{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:sy,addMany:Pi,setOne:iy,setMany:ny,updateOne:ay,updateMany:cy,deleteOne:dy,deleteMany:Fi,initialize:ty});y(this,"selectors",{selectById:ry,selectByIds:uy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{submissionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_submission:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,form_submission:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=_i(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class kg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:Ay,addMany:Ri,setOne:yy,setMany:py,updateOne:fy,updateMany:Sy,deleteOne:Ty,deleteMany:wi,initialize:my});y(this,"selectors",{selectById:Oy,selectByIds:Py})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ly(e)(l);this.dispatch(a(e)),this.dispatch(Fi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Pi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Ng extends v{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:wy,addMany:Ey,setOne:My,setMany:Ry,updateOne:vy,updateMany:Vy,deleteOne:zy,deleteMany:By,initialize:_y});y(this,"selectors",{selectById:qy,selectByIds:Dy})}async add(e){var F;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=u.project,A=await this.client.files.getFilePayload(l),f=M({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:h});this.dispatch(a(f));const I=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[p],blockers:[p]});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.then(P=>P.geo_image)]}async bulkAdd(e,n){var F;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((F=a.getState().userReducer.currentUser)==null?void 0:F.id)??null,h=[],p=[],A=[],f={};for(const P of e){const{file:g,...b}=P,E=await this.client.files.getFilePayload(g);E.sha1 in f||(f[E.sha1]=E);const B=M({...b,file_name:g.name,file_sha1:E.sha1,file_type:g.type,file:URL.createObjectURL(g),submitted_at:u,created_by:d,project:n});h.push(B),p.push(B.uuid),A.push({uuid:B.uuid,sha1:B.file_sha1,file_name:B.file_name,title:B.title,description:B.description,geo_marker:B.geo_marker,canvas_marker:B.canvas_marker,direction:B.direction,original_date:B.original_date})}this.dispatch(c(h));const I=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:p});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(p))}),[h,I.then(P=>P.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Gg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Hy,addMany:Et,setOne:ky,setMany:Ly,updateOne:Ny,updateMany:Gy,deleteOne:Wy,deleteMany:vt,initialize:Uy});y(this,"selectors",{selectById:Yy,selectByIds:Zy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Hg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:sp,addMany:ji,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:qi,initialize:tp});y(this,"selectors",{selectById:lp,selectByIds:op})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Wg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:pp,addMany:Ap,setOne:fp,setMany:Sp,updateOne:Tp,updateMany:Ip,deleteOne:Op,deleteMany:Pp,initialize:yp});y(this,"selectors",{selectById:gp,selectByIds:bp})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Kg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:wp,addMany:Ep,setOne:vp,setMany:Vp,updateOne:zp,updateMany:Bp,deleteOne:jp,deleteMany:qp,initialize:Rp});y(this,"selectors",{selectById:Dp,selectByIds:Cp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=M({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Yg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:kp,addMany:Ni,setOne:Np,setMany:Gp,updateOne:Hp,updateMany:Wp,deleteOne:Kp,deleteMany:Gi,initialize:Lp});y(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=M({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(h.uuid)),f}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.CATEGORY,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case $.PRIORITY:u[A]=e[A];break;case $.DUE_DATE:u[A]=e[A];break;case $.DESCRIPTION:u[A]=e[A];break;case $.TITLE:u[A]=e[A];break;case $.STATUS:{const f=e[A],I=un(f)(c);if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:I.name,color:I.color,uuid:I.uuid};break}case $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=ti(f)(c);if(!I)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:I.name,color:I.color,uuid:I.uuid}}break}case $.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=qt(f)(c);if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:I.username,id:I.id}}break}}const d=M({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(on(d));const h=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(mn(d.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:E})=>E).filter(Boolean),g=f.map(({category:E})=>E).filter(Boolean),b=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:(A?[A]:[]).concat(F).concat(P).concat(g),blocks:[I].concat(F)});p.push(b),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=up(e)(l),h=gS(e)(l),p={};for(const f of Jy(e)(l))p[f.uuid]=f;for(const f of Xy(e)(l))p[f.uuid]=f;const A=Object.values(p);this.dispatch(a(e)),this.dispatch(qi(D(d))),this.dispatch(yn(D(h))),this.dispatch(vt(D(A)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(ji(d)),this.dispatch(hn(h)),this.dispatch(Et(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Zg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});y(this,"selectors",{selectById:lA,selectByIds:oA})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}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 Jg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:SA,updateOne:TA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});y(this,"selectors",{selectById:gA,selectByIds:bA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_extension:g.extension,field_identifier:F,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}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 Xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:NA,addMany:GA,setOne:HA,setMany:WA,updateOne:KA,updateMany:YA,deleteOne:ZA,deleteMany:JA,initialize:kA});y(this,"selectors",{selectById:QA,selectByIds:xA})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Qg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:nf,addMany:Qi,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:xi,initialize:sf});y(this,"selectors",{selectById:of,selectByIds:hf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldValuesUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,field_values:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,field_values:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return p.then(({presigned_urls:f,attachments:I})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(I))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:wA,addMany:EA,setOne:vA,setMany:VA,updateOne:zA,updateMany:BA,deleteOne:jA,deleteMany:qA,initialize:RA});y(this,"selectors",{selectById:CA,selectByIds:$A})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=mf(e)(l);this.dispatch(a(e)),this.dispatch(xi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Qi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class eb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:ff,addMany:Sf,setOne:Tf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:gf,initialize:Af});y(this,"selectors",{selectById:_f,selectByIds:Mf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}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 tb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:vf,addMany:Vf,setOne:zf,setMany:Bf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:Cf,initialize:Ef});y(this,"selectors",{selectById:Uf,selectByIds:Lf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class sb extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Hf,addMany:Wf,setOne:Kf,setMany:Yf,updateOne:Zf,updateMany:Jf,deleteOne:Xf,deleteMany:Qf,initialize:Gf});y(this,"selectors",{selectById:eS,selectByIds:tS})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Xp(e)(l);this.dispatch(a(e)),this.dispatch(Gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ni(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ib extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:aS,addMany:cS,setOne:dS,setMany:rS,updateOne:uS,updateMany:lS,deleteOne:oS,deleteMany:hS,initialize:nS});y(this,"selectors",{selectById:un,selectByIds:yS})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 nb extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:on,addMany:hn,setOne:SS,setMany:TS,updateOne:IS,updateMany:OS,deleteOne:mn,deleteMany:yn,initialize:fS});y(this,"selectors",{selectById:PS,selectByIds:FS})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const ab=1800;function cb(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 db extends sg{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Bo(!1)),this.clearTokens(),this.dispatch(_()),this.dispatch(_())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=zO(e).exp??n}catch{a=n}return a-n<ab}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 U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??nt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(cb(a))})}}class rb extends at{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:$S,addMany:US,setOne:LS,setMany:kS,updateOne:NS,updateMany:GS,deleteOne:HS,deleteMany:WS,initialize:CS});y(this,"selectors",{selectById:YS,selectByIds:ZS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=qt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(Tn(u.user));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Sn(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ub extends at{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:sT,addMany:tT,setOne:eT,setMany:xS,updateOne:nT,updateMany:iT,deleteOne:aT,deleteMany:cT,initialize:QS});y(this,"selectors",{selectById:uT,selectByIds:lT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class lb extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:IT,addMany:OT,setOne:PT,setMany:FT,updateOne:gT,updateMany:bT,deleteOne:_T,deleteMany:MT,initialize:TT});y(this,"selectors",{selectById:wT,selectByIds:ET})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>V(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(A=>A.uuid))),p}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),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 ob extends Xe{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:zT,addMany:BT,setOne:jT,setMany:qT,updateOne:DT,updateMany:CT,deleteOne:$T,deleteMany:UT,initialize:VT});y(this,"selectors",{selectById:kT,selectByIds:NT})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}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 hb extends v{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:ZT,addMany:JT,setOne:KT,setMany:YT,updateOne:XT,updateMany:QT,deleteOne:xT,deleteMany:eI,initialize:WT});y(this,"selectors",{selectById:cI,selectByIds:dI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const h={...r};delete h.file,l={method:m.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,p)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:m.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(p)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(iI),this.dispatch(sI(null)),this.dispatch(tI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class mb extends at{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:yI,addMany:mI,setOne:hI,setMany:oI,updateOne:AI,updateMany:pI,deleteOne:fI,deleteMany:SI,initialize:lI});y(this,"selectors",{selectById:OI,selectByIds:PI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:V(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yb extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:_I,addMany:MI,setOne:RI,setMany:wI,updateOne:EI,updateMany:vI,deleteOne:VI,deleteMany:zI,initialize:bI});y(this,"selectors",{selectById:qI,selectByIds:DI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>V(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}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 pb extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:UI,addMany:LI,setOne:kI,setMany:NI,updateOne:GI,updateMany:HI,deleteOne:WI,deleteMany:KI,initialize:$I});y(this,"selectors",{selectById:ZI,selectByIds:JI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ab extends at{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:Sn,addMany:ES,setOne:wS,setMany:RS,updateOne:VS,updateMany:vS,deleteOne:Tn,deleteMany:zS,initialize:MS});y(this,"selectors",{selectById:qt,selectByIds:qS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:r,...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 $n(t,s,e,n,a){const c=n instanceof et;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,isResponseBlob:F}={...r,...s};let P=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!P.startsWith("http")&&(!P.startsWith("/")&&!P.startsWith("blob:")&&(P="/"+P),P=t+P);const b=q=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const j=l.fields["x-amz-checksum-sha1"];if(!j)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",j).field({...u,...l.fields}).attach("file",g)}return q.send(u)},B={[m.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[m.POST]:()=>{const q=st.post(P.toString());return b(q)},[m.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[m.PUT]:()=>{const q=st.put(P.toString());return b(q)},[m.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[h];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),I&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(p)}catch(q){const j=yO(q),_O=j==null?void 0:j.status;if(c&&_O===401)return await n.auth.handleUnauthorized(z,j),z.query(p);throw new U({response:j,innerError:q,discard:jn.includes(_O)})}}class fb{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Nt,r={...e,uuid:e.uuid??xe.v4()};return $n(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??nt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof U)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof U)throw a;return a})}_enqueueRequest(s,e,n){const a=new Nt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(yT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},u=d=>{d instanceof U?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
+ Converting error to APIError and discarding.`),d=new U({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class ct{constructor(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new BO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new ct;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 r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&ct._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){ct._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(n.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 pO;function AO(t){pO=t}function dt(){return pO}let fO;function SO(t){fO=t}function TO(){return fO}let Un=null;function tt(){const t=dt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Un)return Un;const s=t.getState().offline.outbox,e=ct._fromOutbox(s);return Un=e,e}const Sb=(t,s)=>{const e=new s(t);return SO(e),AO(t),e};class Tb{constructor(s){y(this,"_all");y(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class Ln{constructor(){y(this,"next");this.next=null}then(s){return new Tb(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!dt())throw new Error("Client store not set");const n=TO();if(!n)throw new Error("Client SDK not set");return oO(s,n)}}}class IO extends Ln{async run(s){return super.run(s)}}class OO extends Ln{async run(s){return super.run(s)}}const PO=new IO().then(new OO).compile();function FO(t){var s;return(s=PO[0])==null?void 0:s.run(t)}var gO=(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))(gO||{});i.ALL_MIDDLEWARE=PO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=sO,i.AgentService=ig,i.AssetAttachmentService=ng,i.AssetProcedureService=lg,i.AssetProcedureStepFieldValuesAttachmentService=yg,i.AssetProcedureStepFieldValuesService=pg,i.AssetProcedureStepFieldsAttachmentService=hg,i.AssetProcedureStepFieldsService=mg,i.AssetProcedureStepService=Ag,i.AssetProcedureTypeAttachmentService=ag,i.AssetProcedureTypeFieldValuesAttachmentService=rg,i.AssetProcedureTypeFieldValuesService=ug,i.AssetProcedureTypeFieldsAttachmentService=cg,i.AssetProcedureTypeFieldsService=dg,i.AssetProcedureTypeService=og,i.AssetService=fg,i.AssetStageCompletionService=Sg,i.AssetStageService=Tg,i.AssetStatusType=Kn,i.AssetTypeAttachmentService=Ig,i.AssetTypeFieldValuesAttachmentService=Fg,i.AssetTypeFieldValuesService=gg,i.AssetTypeFieldsAttachmentService=Og,i.AssetTypeFieldsService=Pg,i.AssetTypeIdentifierService=bg,i.AssetTypeIdentifierValueService=_g,i.AssetTypeService=Mg,i.AssetTypeStatusService=Rg,i.AttachmentModel=Yn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=fb,i.COMMON_AUTO_FIELDS=ta,i.CategoryService=wg,i.DEFAULT_ISSUE_PRIORITY=jO,i.DEFAULT_PAGE_SIZE=tO,i.DISCARD_HTTP_STATUSES=jn,i.DeferredPromise=Nt,i.DocumentAttachmentService=Eg,i.DocumentService=vg,i.EMPTY_ARRAY=Gn,i.EMPTY_OBJECT=Hn,i.EmailDomainsService=Vg,i.EmailVerificationService=zg,i.FileService=jg,i.FormIdentifierService=qg,i.FormIdentifierValueService=Dg,i.FormRevisionAttachmentService=Cg,i.FormRevisionService=$g,i.FormService=Ug,i.FormSubmissionAttachmentService=Lg,i.FormSubmissionService=kg,i.GeoImageService=Ng,i.HttpMethod=m,i.IssueAssociationService=Gg,i.IssueAttachmentService=Hg,i.IssueCommentAttachmentService=Wg,i.IssueCommentService=Kg,i.IssuePriority=kt,i.IssueService=Yg,i.IssueStatusType=Zn,i.IssueTypeAttachmentService=Zg,i.IssueTypeFieldValuesAttachmentService=Qg,i.IssueTypeFieldValuesService=xg,i.IssueTypeFieldsAttachmentService=Jg,i.IssueTypeFieldsService=Xg,i.IssueTypeIdentifierService=eb,i.IssueTypeIdentifierValueService=tb,i.IssueTypeService=sb,i.IssueTypeStatusService=ib,i.IssueUpdateChange=$,i.IssueUpdateService=nb,i.JWTService=db,i.MAX_SERVICE_BATCH_SIZE=k,i.OUTBOX_RETRY_DELAY=Jn,i.OfflineAnalyticsMiddleware=IO,i.OfflineMiddleware=Ln,i.OrganizationAccessLevel=Wn,i.OrganizationAccessService=rb,i.OrganizationService=ub,i.OutboxCoordinator=ct,i.ProjectAccessService=lb,i.ProjectAttachmentService=ob,i.ProjectFileService=hb,i.ProjectService=mb,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=OO,i.SelectorBuilder=aP,i.TeamMembershipService=yb,i.TeamService=pb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Ab,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=gO,i._setLatestRetryTime=AT,i.addAsset=vr,i.addAssetAttachment=Aa,i.addAssetAttachments=Qt,i.addAssetProcedure=Gc,i.addAssetProcedureStep=Tr,i.addAssetProcedureStepFieldValues=ir,i.addAssetProcedureStepFieldValuesAttachment=Gd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=nr,i.addAssetProcedureStepFields=vd,i.addAssetProcedureStepFieldsAttachment=fd,i.addAssetProcedureStepFieldsAttachments=Sd,i.addAssetProcedureStepFieldsMany=Vd,i.addAssetProcedureSteps=Ir,i.addAssetProcedureType=id,i.addAssetProcedureTypeAttachment=wa,i.addAssetProcedureTypeAttachments=Ea,i.addAssetProcedureTypeFieldValues=Ec,i.addAssetProcedureTypeFieldValuesAttachment=fc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=vc,i.addAssetProcedureTypeFields=ic,i.addAssetProcedureTypeFieldsAttachment=Na,i.addAssetProcedureTypeFieldsAttachments=Ga,i.addAssetProcedureTypeFieldsMany=nc,i.addAssetProcedureTypes=nd,i.addAssetProcedures=hs,i.addAssetStage=du,i.addAssetStageCompletion=Gr,i.addAssetStageCompletions=Hr,i.addAssetStages=ru,i.addAssetType=uo,i.addAssetTypeAttachment=Su,i.addAssetTypeAttachments=js,i.addAssetTypeFieldValues=Sl,i.addAssetTypeFieldValuesAttachment=al,i.addAssetTypeFieldValuesAttachments=ks,i.addAssetTypeFieldValuesMany=Tl,i.addAssetTypeFields=Hu,i.addAssetTypeFieldsAttachment=vu,i.addAssetTypeFieldsAttachments=Vu,i.addAssetTypeFieldsMany=Wu,i.addAssetTypeIdentifier=Vl,i.addAssetTypeIdentifierValue=Wl,i.addAssetTypeIdentifierValues=Kl,i.addAssetTypeIdentifiers=zl,i.addAssetTypeStatus=Oo,i.addAssetTypeStatuses=Po,i.addAssetTypes=lo,i.addAssets=Rs,i.addCategories=$o,i.addCategory=Co,i.addConversation=la,i.addConversations=cP,i.addDocument=oh,i.addDocumentAttachment=Xo,i.addDocumentAttachments=Qo,i.addDocuments=hh,i.addEmailDomain=bh,i.addEmailDomains=_h,i.addForm=km,i.addFormIdentifier=Gh,i.addFormIdentifierValue=nm,i.addFormIdentifierValues=am,i.addFormIdentifiers=Hh,i.addFormRevision=yi,i.addFormRevisionAttachment=Sm,i.addFormRevisionAttachments=Tm,i.addFormRevisions=pi,i.addFormSubmission=Ay,i.addFormSubmissionAttachment=sy,i.addFormSubmissionAttachments=Pi,i.addFormSubmissions=Ri,i.addForms=Nm,i.addGeoImage=wy,i.addGeoImages=Ey,i.addIssue=kp,i.addIssueAssociation=Hy,i.addIssueAssociations=Et,i.addIssueAttachment=sp,i.addIssueAttachments=ji,i.addIssueComment=wp,i.addIssueCommentAttachment=pp,i.addIssueCommentAttachments=Ap,i.addIssueComments=Ep,i.addIssueType=Hf,i.addIssueTypeAttachment=tA,i.addIssueTypeAttachments=sA,i.addIssueTypeFieldValues=wA,i.addIssueTypeFieldValuesAttachment=nf,i.addIssueTypeFieldValuesAttachments=Qi,i.addIssueTypeFieldValuesMany=EA,i.addIssueTypeFields=NA,i.addIssueTypeFieldsAttachment=pA,i.addIssueTypeFieldsAttachments=AA,i.addIssueTypeFieldsMany=GA,i.addIssueTypeIdentifier=ff,i.addIssueTypeIdentifierValue=vf,i.addIssueTypeIdentifierValues=Vf,i.addIssueTypeIdentifiers=Sf,i.addIssueTypeStatus=aS,i.addIssueTypeStatuses=cS,i.addIssueTypes=Wf,i.addIssueUpdate=on,i.addIssueUpdates=hn,i.addIssues=Ni,i.addOrganization=sT,i.addOrganizationAccess=$S,i.addOrganizationAccesses=US,i.addOrganizations=tT,i.addProject=yI,i.addProjectAccess=IT,i.addProjectAccesses=OT,i.addProjectAttachment=zT,i.addProjectAttachments=BT,i.addProjectFile=ZT,i.addProjectFiles=JT,i.addProjects=mI,i.addTeam=UI,i.addTeamMembership=_I,i.addTeamMemberships=MI,i.addTeams=LI,i.addUser=Sn,i.addUsers=ES,i.agentsReducer=ma,i.agentsSlice=Zt,i.areArraysEqual=$O,i.assetAttachmentReducer=_a,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=Jc,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=er,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=yr,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=Rd,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=Ld,i.assetProcedureStepFieldsSlice=Ss,i.assetProcedureStepReducer=br,i.assetProcedureStepSlice=bs,i.assetProcedureTypeAttachmentReducer=Da,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=Fc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=Cc,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=Xa,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=oc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=od,i.assetProcedureTypeSlice=ys,i.assetReducer=Lr,i.assetSlice=Ms,i.assetStageCompletionReducer=Qr,i.assetStageCompletionSlice=Es,i.assetStageReducer=mu,i.assetStageSlice=vs,i.assetTypeAttachmentReducer=Ru,i.assetTypeAttachmentSlice=Bs,i.assetTypeFieldValuesAttachmentReducer=pl,i.assetTypeFieldValuesAttachmentSlice=Ls,i.assetTypeFieldValuesReducer=wl,i.assetTypeFieldValuesSlice=Hs,i.assetTypeFieldsAttachmentReducer=ku,i.assetTypeFieldsAttachmentSlice=Cs,i.assetTypeFieldsReducer=sl,i.assetTypeFieldsSlice=Us,i.assetTypeIdentifierReducer=Nl,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=io,i.assetTypeIdentifierValueSlice=Ys,i.assetTypeReducer=So,i.assetTypeSlice=Zs,i.assetTypeStatusReducer=Vo,i.assetTypeStatusSlice=Xs,i.assetTypeStatusSortFn=na,i.authReducer=jo,i.authSlice=bt,i.baseReducer=kF,i.baseReducers=Bn,i.blobToBase64=YO,i.categoryReducer=Yo,i.categorySlice=xs,i.clearTokens=GP,i.constructUploadedFilePayloads=KO,i.createModelAdapter=R,i.createOfflineAction=hT,i.createPayload=V,i.createSelectionAdapter=qO,i.deleteAsset=Br,i.deleteAssetAttachment=Oa,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Kc,i.deleteAssetProcedureStep=Fr,i.deleteAssetProcedureStepFieldValues=ur,i.deleteAssetProcedureStepFieldValuesAttachment=Zd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,i.deleteAssetProcedureStepFieldValuesMany=lr,i.deleteAssetProcedureStepFields=Dd,i.deleteAssetProcedureStepFieldsAttachment=Fd,i.deleteAssetProcedureStepFieldsAttachments=gd,i.deleteAssetProcedureStepFieldsMany=Cd,i.deleteAssetProcedureSteps=gr,i.deleteAssetProcedureType=dd,i.deleteAssetProcedureTypeAttachment=ja,i.deleteAssetProcedureTypeAttachments=qa,i.deleteAssetProcedureTypeFieldValues=qc,i.deleteAssetProcedureTypeFieldValuesAttachment=Pc,i.deleteAssetProcedureTypeFieldValuesAttachments=rs,i.deleteAssetProcedureTypeFieldValuesMany=Dc,i.deleteAssetProcedureTypeFields=uc,i.deleteAssetProcedureTypeFieldsAttachment=Za,i.deleteAssetProcedureTypeFieldsAttachments=Ja,i.deleteAssetProcedureTypeFieldsMany=lc,i.deleteAssetProcedureTypes=rd,i.deleteAssetProcedures=ms,i.deleteAssetStage=ou,i.deleteAssetStageCompletion=Jr,i.deleteAssetStageCompletions=Xr,i.deleteAssetStages=hu,i.deleteAssetType=mo,i.deleteAssetTypeAttachment=Fu,i.deleteAssetTypeAttachments=qs,i.deleteAssetTypeFieldValues=gl,i.deleteAssetTypeFieldValuesAttachment=ll,i.deleteAssetTypeFieldValuesAttachments=Ns,i.deleteAssetTypeFieldValuesMany=bl,i.deleteAssetTypeFields=Xu,i.deleteAssetTypeFieldsAttachment=Du,i.deleteAssetTypeFieldsAttachments=Cu,i.deleteAssetTypeFieldsMany=Qu,i.deleteAssetTypeIdentifier=Cl,i.deleteAssetTypeIdentifierValue=Ql,i.deleteAssetTypeIdentifierValues=xl,i.deleteAssetTypeIdentifiers=$l,i.deleteAssetTypeStatus=Mo,i.deleteAssetTypeStatuses=Ro,i.deleteAssetTypes=yo,i.deleteAssets=ws,i.deleteCategories=Ho,i.deleteCategory=Go,i.deleteConversation=uP,i.deleteConversations=lP,i.deleteDocument=fh,i.deleteDocumentAttachment=ih,i.deleteDocumentAttachments=nh,i.deleteDocuments=Sh,i.deleteEmailDomain=vh,i.deleteEmailDomains=Vh,i.deleteForm=Ym,i.deleteFormIdentifier=Jh,i.deleteFormIdentifierValue=lm,i.deleteFormIdentifierValues=om,i.deleteFormIdentifiers=Xh,i.deleteFormRevision=Ai,i.deleteFormRevisionAttachment=gm,i.deleteFormRevisionAttachments=bm,i.deleteFormRevisions=fi,i.deleteFormSubmission=Ty,i.deleteFormSubmissionAttachment=dy,i.deleteFormSubmissionAttachments=Fi,i.deleteFormSubmissions=wi,i.deleteForms=Zm,i.deleteGeoImage=zy,i.deleteGeoImages=By,i.deleteIssue=Kp,i.deleteIssueAssociation=Wy,i.deleteIssueAssociations=vt,i.deleteIssueAttachment=dp,i.deleteIssueAttachments=qi,i.deleteIssueComment=jp,i.deleteIssueCommentAttachment=Op,i.deleteIssueCommentAttachments=Pp,i.deleteIssueComments=qp,i.deleteIssueType=Xf,i.deleteIssueTypeAttachment=dA,i.deleteIssueTypeAttachments=rA,i.deleteIssueTypeFieldValues=jA,i.deleteIssueTypeFieldValuesAttachment=uf,i.deleteIssueTypeFieldValuesAttachments=xi,i.deleteIssueTypeFieldValuesMany=qA,i.deleteIssueTypeFields=ZA,i.deleteIssueTypeFieldsAttachment=OA,i.deleteIssueTypeFieldsAttachments=PA,i.deleteIssueTypeFieldsMany=JA,i.deleteIssueTypeIdentifier=Ff,i.deleteIssueTypeIdentifierValue=Df,i.deleteIssueTypeIdentifierValues=Cf,i.deleteIssueTypeIdentifiers=gf,i.deleteIssueTypeStatus=oS,i.deleteIssueTypeStatuses=hS,i.deleteIssueTypes=Qf,i.deleteIssueUpdate=mn,i.deleteIssueUpdates=yn,i.deleteIssues=Gi,i.deleteOrganization=aT,i.deleteOrganizationAccess=HS,i.deleteOrganizationAccesses=WS,i.deleteOrganizations=cT,i.deleteProject=fI,i.deleteProjectAccess=_T,i.deleteProjectAccesses=MT,i.deleteProjectAttachment=$T,i.deleteProjectAttachments=UT,i.deleteProjectFile=xT,i.deleteProjectFiles=eI,i.deleteProjects=SI,i.deleteTeam=WI,i.deleteTeamMembership=VI,i.deleteTeamMemberships=zI,i.deleteTeams=KI,i.deleteUser=Tn,i.deleteUsers=zS,i.dequeue=lO,i.discard=hO,i.documentAttachmentReducer=rh,i.documentAttachmentSlice=si,i.documentSlice=ni,i.documentsReducer=Th,i.downloadFile=ZO,i.downloadInMemoryFile=WO,i.emailDomainsReducer=qh,i.emailDomainsSlice=ci,i.emailRegex=sP,i.enqueue=uO,i.enqueueRequest=yT,i.extractResponseFromError=yO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=Lh,i.fileSlice=ri,i.fileToBlob=xn,i.formIdentifierReducer=tm,i.formIdentifierSlice=ui,i.formIdentifierValueReducer=pm,i.formIdentifierValueSlice=oi,i.formReducer=Jm,i.formRevisionAttachmentReducer=wm,i.formRevisionAttachmentSlice=hi,i.formRevisionReducer=$m,i.formRevisionsSlice=mi,i.formSlice=Ti,i.formSubmissionAttachmentReducer=oy,i.formSubmissionAttachmentSlice=Oi,i.formSubmissionReducer=gy,i.formSubmissionSlice=Mi,i.geoImageReducer=Cy,i.geoImageSlice=vi,i.getAssetProcedureStepSubTree=ia,i.getAssetProcedureStepTrees=iP,i.getClientSDK=TO,i.getClientStore=dt,i.getDocumentSubTree=da,i.getDocumentTrees=nP,i.getFileIdentifier=HO,i.getFileS3Key=Kt,i.getLocalDateString=Xn,i.getLocalRelativeDateString=NO,i.getOutboxCoordinator=tt,i.getRenamedFile=Qn,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Sb,i.initializeAssetAttachments=pa,i.initializeAssetProcedureStepFieldValues=sr,i.initializeAssetProcedureStepFieldValuesAttachments=Nd,i.initializeAssetProcedureStepFields=Ed,i.initializeAssetProcedureStepFieldsAttachments=Ad,i.initializeAssetProcedureSteps=Ar,i.initializeAssetProcedureTypeAttachments=Ra,i.initializeAssetProcedureTypeFieldValues=wc,i.initializeAssetProcedureTypeFieldValuesAttachments=Ac,i.initializeAssetProcedureTypeFields=sc,i.initializeAssetProcedureTypeFieldsAttachments=ka,i.initializeAssetProcedureTypes=sd,i.initializeAssetProcedures=Nc,i.initializeAssetStageCompletions=Nr,i.initializeAssetStages=nu,i.initializeAssetTypeAttachments=fu,i.initializeAssetTypeFieldValues=fl,i.initializeAssetTypeFieldValuesAttachments=nl,i.initializeAssetTypeFields=Gu,i.initializeAssetTypeFieldsAttachments=Eu,i.initializeAssetTypeIdentifierValues=Hl,i.initializeAssetTypeIdentifiers=vl,i.initializeAssetTypeStatuses=Io,i.initializeAssetTypes=ao,i.initializeAssets=Er,i.initializeCategories=Do,i.initializeConversations=ua,i.initializeDocumentAttachments=Jo,i.initializeDocuments=lh,i.initializeEmailDomains=gh,i.initializeFormIdentifierValues=im,i.initializeFormIdentifiers=Nh,i.initializeFormRevisionAttachments=fm,i.initializeFormRevisions=vm,i.initializeFormSubmissionAttachments=ty,i.initializeFormSubmissions=my,i.initializeForms=Lm,i.initializeGeoImages=_y,i.initializeIssueAssociations=Uy,i.initializeIssueAttachments=tp,i.initializeIssueCommentAttachments=yp,i.initializeIssueComments=Rp,i.initializeIssueTypeAttachments=eA,i.initializeIssueTypeFieldValues=RA,i.initializeIssueTypeFieldValuesAttachments=sf,i.initializeIssueTypeFields=kA,i.initializeIssueTypeFieldsAttachments=yA,i.initializeIssueTypeIdentifierValues=Ef,i.initializeIssueTypeIdentifiers=Af,i.initializeIssueTypeStatuses=nS,i.initializeIssueTypes=Gf,i.initializeIssueUpdates=fS,i.initializeIssues=Lp,i.initializeOrganizationAccesses=CS,i.initializeOrganizations=QS,i.initializeProjectAccesses=TT,i.initializeProjectAttachments=VT,i.initializeProjectFiles=WT,i.initializeProjects=lI,i.initializeTeamMemberships=bI,i.initializeTeams=$I,i.initializeUsers=MS,i.isToday=kO,i.issueAssociationReducer=xy,i.issueAssociationSlice=zi,i.issueAttachmentReducer=hp,i.issueAttachmentSlice=Bi,i.issueCommentAttachmentReducer=_p,i.issueCommentAttachmentSlice=Ci,i.issueCommentReducer=$p,i.issueCommentSlice=Ui,i.issueReducer=Qp,i.issueSlice=ki,i.issueTypeAttachmentReducer=hA,i.issueTypeAttachmentSlice=Hi,i.issueTypeFieldValuesAttachmentReducer=yf,i.issueTypeFieldValuesAttachmentSlice=Xi,i.issueTypeFieldValuesReducer=UA,i.issueTypeFieldValuesSlice=Zi,i.issueTypeFieldsAttachmentReducer=_A,i.issueTypeFieldsAttachmentSlice=Ki,i.issueTypeFieldsReducer=ef,i.issueTypeFieldsSlice=Ji,i.issueTypeIdentifierReducer=Rf,i.issueTypeIdentifierSlice=tn,i.issueTypeIdentifierValueReducer=kf,i.issueTypeIdentifierValueSlice=nn,i.issueTypeReducer=sS,i.issueTypeSlice=an,i.issueTypeStatusReducer=pS,i.issueTypeStatusSlice=dn,i.issueTypeStatusSortFn=aa,i.issueUpdateReducer=bS,i.issueUpdateSlice=ln,i.logOnlyOnce=JO,i.markAsDeleted=pT,i.markForDeletion=_F,i.memoize=Ht,i.organizationAccessReducer=KS,i.organizationAccessSlice=On,i.organizationReducer=oT,i.organizationSlice=Pn,i.outboxReducer=fT,i.outboxSlice=Fn,i.overmapEnhancer=XF,i.overmapReducer=NF,i.overmapReducers=eO,i.performRequest=$n,i.performRequestFromAction=oO,i.projectAccessReducer=RT,i.projectAccessSlice=gn,i.projectAttachmentReducer=GT,i.projectAttachmentSlice=_n,i.projectFileReducer=rI,i.projectFileSlice=Rn,i.projectReducer=TI,i.projectSlice=wn,i.rehydratedReducer=FI,i.rehydratedSlice=En,i.restructureSelectorWithArgs=S,i.runMiddleware=FO,i.saveActiveProjectFileBounds=iI,i.selectAccessToken=HP,i.selectAccessesByUserOfProject=RF,i.selectAccessibleProjects=zF,i.selectActiveOrganizationAccess=PF,i.selectActiveProjectFileId=vF,i.selectAllDocumentAttachments=ii,i.selectAssetAttachmentById=Fa,i.selectAssetAttachmentMapping=Pa,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=ga,i.selectAssetById=$r,i.selectAssetProcedureById=xc,i.selectAssetProcedureStepById=_r,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=Xd,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Qd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Jd,i.selectAssetProcedureStepFieldValuesById=hr,i.selectAssetProcedureStepFieldValuesByIds=mr,i.selectAssetProcedureStepFieldValuesMapping=or,i.selectAssetProcedureStepFieldValuesOfAsset=bP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=_P,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=MP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=_d,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=Md,i.selectAssetProcedureStepFieldsAttachmentsMapping=bd,i.selectAssetProcedureStepFieldsById=$d,i.selectAssetProcedureStepFieldsByIds=Ud,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=PP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=Mr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=RP,i.selectAssetProcedureStepsOfAssetProcedureType=wP,i.selectAssetProcedureTypeAttachmentById=$a,i.selectAssetProcedureTypeAttachmentMapping=Ca,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=Ua,i.selectAssetProcedureTypeById=md,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=bc,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=_c,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=gc,i.selectAssetProcedureTypeFieldValuesById=Uc,i.selectAssetProcedureTypeFieldValuesByIds=Lc,i.selectAssetProcedureTypeFieldValuesMapping=$c,i.selectAssetProcedureTypeFieldValuesOfAsset=fP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=xa,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=ec,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Qa,i.selectAssetProcedureTypeFieldsById=mc,i.selectAssetProcedureTypeFieldsByIds=yc,i.selectAssetProcedureTypeFieldsMapping=hc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=pP,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=yd,i.selectAssetProcedureTypesMapping=hd,i.selectAssetProcedureTypesOfOrganization=IP,i.selectAssetProcedures=Tt,i.selectAssetProceduresByIds=ed,i.selectAssetProceduresMapping=Xc,i.selectAssetProceduresOfAssetProcedureType=Qc,i.selectAssetProceduresOfAssetType=TP,i.selectAssetStageById=yu,i.selectAssetStageCompletionById=tu,i.selectAssetStageCompletionMapping=xr,i.selectAssetStageCompletions=eu,i.selectAssetStageCompletionsByIds=su,i.selectAssetStages=zs,i.selectAssetStagesByIds=pu,i.selectAssetStagesMappingOfAssetProcedureType=vP,i.selectAssetStagesOfAssetProcedureType=VP,i.selectAssetTypeAttachmentById=bu,i.selectAssetTypeAttachmentMapping=gu,i.selectAssetTypeAttachments=Ds,i.selectAssetTypeAttachmentsByIds=_u,i.selectAssetTypeById=Ao,i.selectAssetTypeFieldValues=Ft,i.selectAssetTypeFieldValuesAttachmentById=hl,i.selectAssetTypeFieldValuesAttachments=Gs,i.selectAssetTypeFieldValuesAttachmentsByIds=ml,i.selectAssetTypeFieldValuesAttachmentsMapping=ol,i.selectAssetTypeFieldValuesById=Ml,i.selectAssetTypeFieldValuesByIds=Rl,i.selectAssetTypeFieldValuesMapping=_l,i.selectAssetTypeFieldValuesOfAsset=qP,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Uu,i.selectAssetTypeFieldsAttachments=$s,i.selectAssetTypeFieldsAttachmentsByIds=Lu,i.selectAssetTypeFieldsAttachmentsMapping=$u,i.selectAssetTypeFieldsById=el,i.selectAssetTypeFieldsByIds=tl,i.selectAssetTypeFieldsMapping=xu,i.selectAssetTypeFieldsOfAssetType=BP,i.selectAssetTypeIdentifierById=Ll,i.selectAssetTypeIdentifierMapping=Ul,i.selectAssetTypeIdentifierValueById=to,i.selectAssetTypeIdentifierValueMapping=eo,i.selectAssetTypeIdentifierValues=gt,i.selectAssetTypeIdentifierValuesByIds=so,i.selectAssetTypeIdentifierValuesOfAsset=$P,i.selectAssetTypeIdentifierValuesOfIdentifier=UP,i.selectAssetTypeIdentifiers=Ks,i.selectAssetTypeIdentifiersByIds=kl,i.selectAssetTypeIdentifiersOfAssetType=CP,i.selectAssetTypeStatusById=Eo,i.selectAssetTypeStatusMapping=wo,i.selectAssetTypeStatuses=Qs,i.selectAssetTypeStatusesByIds=vo,i.selectAssetTypeStatusesOfAssetType=kP,i.selectAssetTypeValuesOfAssetType=DP,i.selectAssetTypes=Js,i.selectAssetTypesByIds=fo,i.selectAssetTypesMapping=po,i.selectAssetTypesOfOrganization=LP,i.selectAssets=Pt,i.selectAssetsByIds=Ur,i.selectAssetsMapping=Dr,i.selectAssetsOfAssetType=Cr,i.selectAssetsOfProject=EP,i.selectAttachmentsOfAsset=ba,i.selectAttachmentsOfAssetProcedureStepFieldValues=xd,i.selectAttachmentsOfAssetProcedureStepFields=OP,i.selectAttachmentsOfAssetProcedureType=mP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Mc,i.selectAttachmentsOfAssetProcedureTypeFields=yP,i.selectAttachmentsOfAssetType=Mu,i.selectAttachmentsOfAssetTypeFieldValues=yl,i.selectAttachmentsOfAssetTypeFields=zP,i.selectAttachmentsOfDocument=YP,i.selectAttachmentsOfFormRevision=sF,i.selectAttachmentsOfFormSubmission=ly,i.selectAttachmentsOfIssue=up,i.selectAttachmentsOfIssueComment=cF,i.selectAttachmentsOfIssueType=uF,i.selectAttachmentsOfIssueTypeFieldValues=mf,i.selectAttachmentsOfIssueTypeFields=lF,i.selectAttachmentsOfProject=EF,i.selectCategories=ei,i.selectCategoriesByIds=Ko,i.selectCategoriesOfProject=KP,i.selectCategoryById=ti,i.selectCategoryMapping=Wo,i.selectCommentsOfIssue=dF,i.selectConversation=hP,i.selectConversationMapping=Jt,i.selectConversations=oP,i.selectCurrentUser=jS,i.selectDeletedRequests=gF,i.selectDescendantsOfAssetProcedureStep=Rr,i.selectDescendantsOfDocument=Ph,i.selectDocumentAttachmentById=ch,i.selectDocumentAttachmentMapping=ah,i.selectDocumentAttachmentsByIds=dh,i.selectDocumentById=Ih,i.selectDocuments=_t,i.selectDocumentsByIds=Oh,i.selectDocumentsMapping=ai,i.selectEmailDomainById=Bh,i.selectEmailDomains=di,i.selectEmailDomainsAsMapping=zh,i.selectEmailDomainsByIds=jh,i.selectEmailDomainsOfOrganization=XP,i.selectFieldValuesOfAssetProcedure=SP,i.selectFormById=Qm,i.selectFormIdentifierById=xh,i.selectFormIdentifierMapping=Qh,i.selectFormIdentifierValueById=mm,i.selectFormIdentifierValueMapping=hm,i.selectFormIdentifierValues=Mt,i.selectFormIdentifierValuesByIds=ym,i.selectFormIdentifierValuesOfFormSubmission=eF,i.selectFormIdentifierValuesOfIdentifier=tF,i.selectFormIdentifiers=li,i.selectFormIdentifiersByIds=em,i.selectFormIdentifiersOfForm=xP,i.selectFormMapping=Xm,i.selectFormRevisionAttachmentById=Mm,i.selectFormRevisionAttachments=_m,i.selectFormRevisionAttachmentsByIds=Rm,i.selectFormRevisionAttachmentsMapping=Rt,i.selectFormRevisionById=qm,i.selectFormRevisionMapping=Si,i.selectFormRevisions=wt,i.selectFormRevisionsByIds=Dm,i.selectFormRevisionsOfForm=Cm,i.selectFormSubmissionAttachemntsByIds=_i,i.selectFormSubmissionAttachmentById=ry,i.selectFormSubmissionAttachments=bi,i.selectFormSubmissionAttachmentsByIds=uy,i.selectFormSubmissionAttachmentsMapping=gi,i.selectFormSubmissionById=Oy,i.selectFormSubmissions=Iy,i.selectFormSubmissionsByIds=Py,i.selectFormSubmissionsMapping=Ei,i.selectFormSubmissionsOfForm=Fy,i.selectForms=Ii,i.selectFormsByIds=xm,i.selectFormsOfOrganization=nF,i.selectGeoImageById=qy,i.selectGeoImageMapping=jy,i.selectGeoImages=Vi,i.selectGeoImagesByIds=Dy,i.selectGeoImagesOfProject=aF,i.selectIsImportingProjectFile=VF,i.selectIsLoggedIn=WP,i.selectIssueAssociationById=Yy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Ky,i.selectIssueAssociationsByIds=Zy,i.selectIssueAssociationsOfAsset=Qy,i.selectIssueAssociationsOfIssue=Xy,i.selectIssueAssociationsToIssue=Jy,i.selectIssueAttachmentById=lp,i.selectIssueAttachmentMapping=rp,i.selectIssueAttachments=Di,i.selectIssueAttachmentsByIds=op,i.selectIssueById=Zp,i.selectIssueCommentAttachmentById=gp,i.selectIssueCommentAttachmentMapping=Fp,i.selectIssueCommentAttachments=$i,i.selectIssueCommentAttachmentsByIds=bp,i.selectIssueCommentById=Dp,i.selectIssueCommentMapping=Li,i.selectIssueCommentsByIds=Cp,i.selectIssueMapping=Yp,i.selectIssueTypeAttachmentById=lA,i.selectIssueTypeAttachmentMapping=uA,i.selectIssueTypeAttachments=Wi,i.selectIssueTypeAttachmentsByIds=oA,i.selectIssueTypeById=eS,i.selectIssueTypeFieldValues=zt,i.selectIssueTypeFieldValuesAttachmentById=of,i.selectIssueTypeFieldValuesAttachments=en,i.selectIssueTypeFieldValuesAttachmentsByIds=hf,i.selectIssueTypeFieldValuesAttachmentsMapping=lf,i.selectIssueTypeFieldValuesById=CA,i.selectIssueTypeFieldValuesByIds=$A,i.selectIssueTypeFieldValuesMapping=DA,i.selectIssueTypeFieldValuesOfIssue=oF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=gA,i.selectIssueTypeFieldsAttachments=Yi,i.selectIssueTypeFieldsAttachmentsByIds=bA,i.selectIssueTypeFieldsAttachmentsMapping=FA,i.selectIssueTypeFieldsById=QA,i.selectIssueTypeFieldsByIds=xA,i.selectIssueTypeFieldsMapping=XA,i.selectIssueTypeFieldsOfIssueType=hF,i.selectIssueTypeIdentifierById=_f,i.selectIssueTypeIdentifierMapping=bf,i.selectIssueTypeIdentifierValueById=Uf,i.selectIssueTypeIdentifierValueMapping=$f,i.selectIssueTypeIdentifierValues=Bt,i.selectIssueTypeIdentifierValuesByIds=Lf,i.selectIssueTypeIdentifierValuesOfIdentifier=fF,i.selectIssueTypeIdentifierValuesOfIssue=AF,i.selectIssueTypeIdentifiers=sn,i.selectIssueTypeIdentifiersByIds=Mf,i.selectIssueTypeIdentifiersOfIssueType=pF,i.selectIssueTypeMapping=xf,i.selectIssueTypeStatusById=un,i.selectIssueTypeStatusMapping=mS,i.selectIssueTypeStatuses=rn,i.selectIssueTypeStatusesByIds=yS,i.selectIssueTypeStatusesOfIssueType=TF,i.selectIssueTypeValuesOfIssueType=yF,i.selectIssueTypes=cn,i.selectIssueTypesByIds=tS,i.selectIssueTypesOfOrganization=SF,i.selectIssueUpdateById=PS,i.selectIssueUpdateMapping=pn,i.selectIssueUpdates=An,i.selectIssueUpdatesByIds=FS,i.selectIssueUpdatesOfIssue=gS,i.selectIssues=Vt,i.selectIssuesByIds=Jp,i.selectIssuesOfIssueType=Xp,i.selectIssuesOfProject=rF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=FP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=AP,i.selectLatestAssetTypeFieldsOfAssetType=jP,i.selectLatestFieldsByAssetProcedureStep=gP,i.selectLatestFormRevisionOfForm=iF,i.selectLatestIssueTypeFieldsOfIssueType=mF,i.selectLatestRetryTime=bF,i.selectMembershipsByUserOfTeam=CF,i.selectOrganizationAccessById=YS,i.selectOrganizationAccessMapping=Dt,i.selectOrganizationAccessUserMapping=JS,i.selectOrganizationAccessesByIds=ZS,i.selectOrganizationById=uT,i.selectOrganizationDocuments=JP,i.selectOrganizations=rT,i.selectOrganizationsByIds=lT,i.selectOrganizationsMapping=dT,i.selectProjectAccessById=wT,i.selectProjectAccessMapping=bn,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=ET,i.selectProjectAccessesOfProject=MF,i.selectProjectAttachmentById=kT,i.selectProjectAttachmentMapping=LT,i.selectProjectAttachments=Mn,i.selectProjectAttachmentsByIds=NT,i.selectProjectById=OI,i.selectProjectDocuments=ZP,i.selectProjectFileById=cI,i.selectProjectFileMapping=nI,i.selectProjectFiles=aI,i.selectProjectFilesByIds=dI,i.selectProjectMapping=II,i.selectProjects=Ct,i.selectProjectsByIds=PI,i.selectProjectsOfOrganization=BF,i.selectRehydrated=DF,i.selectStageMapping=Vs,i.selectTeamById=ZI,i.selectTeamMembershipById=qI,i.selectTeamMemberships=$t,i.selectTeamMembershipsByIds=DI,i.selectTeamMembershipsMapping=jI,i.selectTeams=zn,i.selectTeamsByIds=JI,i.selectTeamsMapping=YI,i.selectTeamsOfOrganization=UF,i.selectUploadUrl=Uh,i.selectUserById=qt,i.selectUsers=jt,i.selectUsersByIds=qS,i.selectUsersMapping=In,i.selectUsersOfOrganization=FF,i.selectUsersOfProject=wF,i.selectUsersOfTeam=$F,i.setActiveProjectFileId=sI,i.setAsset=jr,i.setAssetAttachment=fa,i.setAssetAttachments=Sa,i.setAssetProcedure=Yc,i.setAssetProcedureStep=fr,i.setAssetProcedureStepFieldValues=ar,i.setAssetProcedureStepFieldValuesAttachment=Hd,i.setAssetProcedureStepFieldValuesAttachments=Wd,i.setAssetProcedureStepFieldValuesMany=cr,i.setAssetProcedureStepFields=zd,i.setAssetProcedureStepFieldsAttachment=Td,i.setAssetProcedureStepFieldsAttachments=Id,i.setAssetProcedureStepFieldsMany=Bd,i.setAssetProcedureSteps=Sr,i.setAssetProcedureType=ud,i.setAssetProcedureTypeAttachment=va,i.setAssetProcedureTypeAttachments=Va,i.setAssetProcedureTypeFieldValues=Vc,i.setAssetProcedureTypeFieldValuesAttachment=Sc,i.setAssetProcedureTypeFieldValuesAttachments=Tc,i.setAssetProcedureTypeFieldValuesMany=zc,i.setAssetProcedureTypeFields=ac,i.setAssetProcedureTypeFieldsAttachment=Ha,i.setAssetProcedureTypeFieldsAttachments=Wa,i.setAssetProcedureTypeFieldsMany=cc,i.setAssetProcedureTypes=ld,i.setAssetProcedures=Zc,i.setAssetStage=au,i.setAssetStageCompletion=Wr,i.setAssetStageCompletions=Kr,i.setAssetStages=cu,i.setAssetType=co,i.setAssetTypeAttachment=Tu,i.setAssetTypeAttachments=Iu,i.setAssetTypeFieldValues=Il,i.setAssetTypeFieldValuesAttachment=cl,i.setAssetTypeFieldValuesAttachments=dl,i.setAssetTypeFieldValuesMany=Ol,i.setAssetTypeFields=Ku,i.setAssetTypeFieldsAttachment=zu,i.setAssetTypeFieldsAttachments=Bu,i.setAssetTypeFieldsMany=Yu,i.setAssetTypeIdentifier=Bl,i.setAssetTypeIdentifierValue=Yl,i.setAssetTypeIdentifierValues=Zl,i.setAssetTypeIdentifiers=jl,i.setAssetTypeStatus=Fo,i.setAssetTypeStatuses=go,i.setAssetTypes=ro,i.setAssets=qr,i.setCategories=Lo,i.setCategory=Uo,i.setClientSDK=SO,i.setClientStore=AO,i.setConversation=oa,i.setConversations=dP,i.setCurrentUser=IF,i.setDocument=mh,i.setDocumentAttachment=xo,i.setDocumentAttachments=eh,i.setDocuments=yh,i.setEmailDomain=Mh,i.setEmailDomains=Rh,i.setForm=Gm,i.setFormIdentifier=Wh,i.setFormIdentifierValue=cm,i.setFormIdentifierValues=dm,i.setFormIdentifiers=Kh,i.setFormRevision=Vm,i.setFormRevisionAttachment=Im,i.setFormRevisionAttachments=Om,i.setFormRevisions=zm,i.setFormSubmission=yy,i.setFormSubmissionAttachment=iy,i.setFormSubmissionAttachments=ny,i.setFormSubmissions=py,i.setForms=Hm,i.setGeoImage=My,i.setGeoImages=Ry,i.setIsImportingProjectFile=tI,i.setIssue=Np,i.setIssueAssociation=ky,i.setIssueAssociations=Ly,i.setIssueAttachment=ip,i.setIssueAttachments=np,i.setIssueComment=vp,i.setIssueCommentAttachment=fp,i.setIssueCommentAttachments=Sp,i.setIssueComments=Vp,i.setIssueType=Kf,i.setIssueTypeAttachment=iA,i.setIssueTypeAttachments=nA,i.setIssueTypeFieldValues=vA,i.setIssueTypeFieldValuesAttachment=af,i.setIssueTypeFieldValuesAttachments=cf,i.setIssueTypeFieldValuesMany=VA,i.setIssueTypeFields=HA,i.setIssueTypeFieldsAttachment=fA,i.setIssueTypeFieldsAttachments=SA,i.setIssueTypeFieldsMany=WA,i.setIssueTypeIdentifier=Tf,i.setIssueTypeIdentifierValue=zf,i.setIssueTypeIdentifierValues=Bf,i.setIssueTypeIdentifiers=If,i.setIssueTypeStatus=dS,i.setIssueTypeStatuses=rS,i.setIssueTypes=Yf,i.setIssueUpdate=SS,i.setIssueUpdates=TS,i.setIssues=Gp,i.setLoggedIn=Bo,i.setOrganization=eT,i.setOrganizationAccess=LS,i.setOrganizationAccesses=kS,i.setOrganizations=xS,i.setProfilePicture=OF,i.setProject=hI,i.setProjectAccess=PT,i.setProjectAccesses=FT,i.setProjectAttachment=jT,i.setProjectAttachments=qT,i.setProjectFile=KT,i.setProjectFiles=YT,i.setProjects=oI,i.setRehydrated=qF,i.setTeam=kI,i.setTeamMembership=RI,i.setTeamMemberships=wI,i.setTeams=NI,i.setTokens=NP,i.setUploadUrl=$h,i.setUser=wS,i.setUsers=RS,i.shallowEqual=CO,i.slugify=eP,i.spacesToDashesLower=xO,i.teamMembershipReducer=BI,i.teamMembershipSlice=vn,i.teamReducer=XI,i.teamSlice=Vn,i.toFileNameSafeString=QO,i.toUuidArray=D,i.toUuidIdRecord=XO,i.truncate=tP,i.updateAsset=Vr,i.updateAssetAttachment=Ta,i.updateAssetAttachments=Ia,i.updateAssetProcedure=Hc,i.updateAssetProcedureStep=Or,i.updateAssetProcedureStepFieldValues=dr,i.updateAssetProcedureStepFieldValuesAttachment=Kd,i.updateAssetProcedureStepFieldValuesAttachments=Yd,i.updateAssetProcedureStepFieldValuesMany=rr,i.updateAssetProcedureStepFields=jd,i.updateAssetProcedureStepFieldsAttachment=Od,i.updateAssetProcedureStepFieldsAttachments=Pd,i.updateAssetProcedureStepFieldsMany=qd,i.updateAssetProcedureSteps=Pr,i.updateAssetProcedureType=ad,i.updateAssetProcedureTypeAttachment=za,i.updateAssetProcedureTypeAttachments=Ba,i.updateAssetProcedureTypeFieldValues=Bc,i.updateAssetProcedureTypeFieldValuesAttachment=Ic,i.updateAssetProcedureTypeFieldValuesAttachments=Oc,i.updateAssetProcedureTypeFieldValuesMany=jc,i.updateAssetProcedureTypeFields=dc,i.updateAssetProcedureTypeFieldsAttachment=Ka,i.updateAssetProcedureTypeFieldsAttachments=Ya,i.updateAssetProcedureTypeFieldsMany=rc,i.updateAssetProcedureTypes=cd,i.updateAssetProcedures=Wc,i.updateAssetStage=uu,i.updateAssetStageCompletion=Yr,i.updateAssetStageCompletions=Zr,i.updateAssetStages=lu,i.updateAssetType=oo,i.updateAssetTypeAttachment=Ou,i.updateAssetTypeAttachments=Pu,i.updateAssetTypeFieldValues=Pl,i.updateAssetTypeFieldValuesAttachment=rl,i.updateAssetTypeFieldValuesAttachments=ul,i.updateAssetTypeFieldValuesMany=Fl,i.updateAssetTypeFields=Zu,i.updateAssetTypeFieldsAttachment=ju,i.updateAssetTypeFieldsAttachments=qu,i.updateAssetTypeFieldsMany=Ju,i.updateAssetTypeIdentifier=ql,i.updateAssetTypeIdentifierValue=Jl,i.updateAssetTypeIdentifierValues=Xl,i.updateAssetTypeIdentifiers=Dl,i.updateAssetTypeStatus=bo,i.updateAssetTypeStatuses=_o,i.updateAssetTypes=ho,i.updateAssets=zr,i.updateCategories=No,i.updateCategory=ko,i.updateConversation=ha,i.updateConversations=rP,i.updateDocument=ph,i.updateDocumentAttachment=th,i.updateDocumentAttachments=sh,i.updateDocuments=Ah,i.updateEmailDomain=wh,i.updateEmailDomains=Eh,i.updateForm=Wm,i.updateFormIdentifier=Yh,i.updateFormIdentifierValue=rm,i.updateFormIdentifierValues=um,i.updateFormIdentifiers=Zh,i.updateFormRevision=Bm,i.updateFormRevisionAttachment=Pm,i.updateFormRevisionAttachments=Fm,i.updateFormRevisions=jm,i.updateFormSubmission=fy,i.updateFormSubmissionAttachment=ay,i.updateFormSubmissionAttachments=cy,i.updateFormSubmissions=Sy,i.updateForms=Km,i.updateGeoImage=vy,i.updateGeoImages=Vy,i.updateIssue=Hp,i.updateIssueAssociation=Ny,i.updateIssueAssociations=Gy,i.updateIssueAttachment=ap,i.updateIssueAttachments=cp,i.updateIssueComment=zp,i.updateIssueCommentAttachment=Tp,i.updateIssueCommentAttachments=Ip,i.updateIssueComments=Bp,i.updateIssueType=Zf,i.updateIssueTypeAttachment=aA,i.updateIssueTypeAttachments=cA,i.updateIssueTypeFieldValues=zA,i.updateIssueTypeFieldValuesAttachment=df,i.updateIssueTypeFieldValuesAttachments=rf,i.updateIssueTypeFieldValuesMany=BA,i.updateIssueTypeFields=KA,i.updateIssueTypeFieldsAttachment=TA,i.updateIssueTypeFieldsAttachments=IA,i.updateIssueTypeFieldsMany=YA,i.updateIssueTypeIdentifier=Of,i.updateIssueTypeIdentifierValue=jf,i.updateIssueTypeIdentifierValues=qf,i.updateIssueTypeIdentifiers=Pf,i.updateIssueTypeStatus=uS,i.updateIssueTypeStatuses=lS,i.updateIssueTypes=Jf,i.updateIssueUpdate=IS,i.updateIssueUpdates=OS,i.updateIssues=Wp,i.updateOrganization=nT,i.updateOrganizationAccess=NS,i.updateOrganizationAccesses=GS,i.updateOrganizations=iT,i.updateProject=AI,i.updateProjectAccess=gT,i.updateProjectAccesses=bT,i.updateProjectAttachment=DT,i.updateProjectAttachments=CT,i.updateProjectFile=XT,i.updateProjectFiles=QT,i.updateProjects=pI,i.updateTeam=GI,i.updateTeamMembership=EI,i.updateTeamMemberships=vI,i.updateTeams=HI,i.updateUser=VS,i.updateUsers=vS,i.useSelectorBuilder=DO,i.userReducer=BS,i.userSlice=fn,i.uuidObj=M,i.uuidObjSortFn=Yt,i.uuidSortFn=At,i.versioningReducer=xI,i.versioningSlice=QI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overmap-ai/core",
3
- "version": "1.0.78-bulk-update.15",
3
+ "version": "1.0.78-bulk-update.16",
4
4
  "description": "Core functionality for Overmap",
5
5
  "keywords": [
6
6
  "components",